From df3cd9c72d0f49764635672bda0d733eec10d69c Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Tue, 25 Jul 2023 11:37:34 +0100 Subject: [PATCH] Import pyqt6_6.5.2.orig.tar.gz [dgit import orig pyqt6_6.5.2.orig.tar.gz] --- ChangeLog | 3890 +++++++++++++ LICENSE | 674 +++ NEWS | 107 + PKG-INFO | 64 + README | 53 + __init__.py | 20 + config-tests/cfgtest_QtCore.cpp | 39 + config-tests/cfgtest_QtGui.cpp | 45 + config-tests/cfgtest_QtNetwork.cpp | 33 + config-tests/cfgtest_QtPrintSupport.cpp | 41 + dbus/dbus.cpp | 422 ++ dbus/helper.h | 71 + designer/designer.pro-in | 23 + designer/pluginloader.cpp | 326 ++ designer/pluginloader.h | 66 + .../designer/calculatorform/calculatorform.py | 71 + .../designer/calculatorform/calculatorform.ui | 284 + .../calculatorform/ui_calculatorform.py | 93 + examples/designer/plugins/plugins.py | 83 + .../plugins/python/analogclockplugin.py | 193 + .../plugins/python/bubbleswidgetplugin.py | 192 + .../plugins/python/counterlabelplugin.py | 103 + .../plugins/python/datetimeeditplugin.py | 126 + .../plugins/python/helloglwidgetplugin.py | 103 + .../plugins/python/multipagewidgetplugin.py | 142 + .../plugins/python/polygonwidgetplugin.py | 173 + .../designer/plugins/python/pydemoplugin.py | 168 + .../plugins/python/pythonconsoleplugin.py | 141 + .../designer/plugins/widgets/analogclock.py | 186 + .../designer/plugins/widgets/bubbleswidget.py | 333 ++ .../designer/plugins/widgets/counterlabel.py | 175 + .../designer/plugins/widgets/datetimeedit.py | 369 ++ .../designer/plugins/widgets/helloglwidget.py | 261 + .../plugins/widgets/multipagewidget.py | 105 + .../designer/plugins/widgets/polygonwidget.py | 190 + examples/designer/plugins/widgets/pydemo.py | 153 + .../plugins/widgets/pythonconsolewidget.py | 96 + examples/desktop/screenshot.py | 172 + examples/desktop/systray/images/bad.png | Bin 0 -> 2496 bytes examples/desktop/systray/images/heart.png | Bin 0 -> 25780 bytes examples/desktop/systray/images/trash.png | Bin 0 -> 12128 bytes examples/desktop/systray/systray.py | 239 + examples/dialogs/classwizard/classwizard.py | 410 ++ .../dialogs/classwizard/images/background.png | Bin 0 -> 22578 bytes .../dialogs/classwizard/images/banner.png | Bin 0 -> 3947 bytes examples/dialogs/classwizard/images/logo1.png | Bin 0 -> 1619 bytes examples/dialogs/classwizard/images/logo2.png | Bin 0 -> 1619 bytes examples/dialogs/classwizard/images/logo3.png | Bin 0 -> 1619 bytes .../dialogs/classwizard/images/watermark1.png | Bin 0 -> 14516 bytes .../dialogs/classwizard/images/watermark2.png | Bin 0 -> 14912 bytes examples/dialogs/configdialog/configdialog.py | 246 + .../dialogs/configdialog/images/config.png | Bin 0 -> 7059 bytes .../dialogs/configdialog/images/query.png | Bin 0 -> 2269 bytes .../dialogs/configdialog/images/update.png | Bin 0 -> 8296 bytes examples/dialogs/extension.py | 114 + examples/dialogs/findfiles.py | 217 + examples/dialogs/standarddialogs.py | 319 + examples/dialogs/tabdialog.py | 207 + examples/dialogs/trivialwizard.py | 111 + .../delayedencoding/delayedencoding.py | 135 + .../delayedencoding/images/drag.png | Bin 0 -> 977 bytes .../delayedencoding/images/example.svg | 59 + .../draggableicons/draggableicons.py | 163 + .../draggableicons/images/boat.png | Bin 0 -> 2772 bytes .../draganddrop/draggableicons/images/car.png | Bin 0 -> 2963 bytes .../draggableicons/images/house.png | Bin 0 -> 3292 bytes .../draggabletext/draggabletext.py | 153 + examples/draganddrop/draggabletext/words.txt | 41 + examples/draganddrop/dropsite.py | 180 + .../fridgemagnets/fridgemagnets.py | 190 + examples/draganddrop/fridgemagnets/words.txt | 48 + examples/draganddrop/puzzle/example.jpg | Bin 0 -> 42654 bytes examples/draganddrop/puzzle/puzzle.py | 371 ++ .../multimedia/audiodevices/audiodevices.py | 207 + .../audiodevices/audiodevicesbase.ui | 311 + .../audiodevices/ui_audiodevicesbase.py | 191 + examples/multimedia/audiooutput.py | 267 + examples/multimediawidgets/camera/camera.py | 573 ++ examples/multimediawidgets/camera/camera.ui | 482 ++ .../camera/images/shutter.svg | 21 + .../multimediawidgets/camera/imagesettings.ui | 123 + .../multimediawidgets/camera/ui_camera.py | 182 + .../camera/ui_imagesettings.py | 62 + .../camera/ui_videosettings.py | 112 + .../multimediawidgets/camera/videosettings.ui | 202 + .../multimediawidgets/videographicsitem.py | 169 + examples/multimediawidgets/videowidget.py | 156 + examples/qml/referenceexamples/adding.py | 102 + examples/qml/referenceexamples/attached.py | 225 + examples/qml/referenceexamples/binding.py | 328 ++ examples/qml/referenceexamples/coercion.py | 148 + examples/qml/referenceexamples/default.py | 148 + examples/qml/referenceexamples/grouped.py | 217 + examples/qml/referenceexamples/methods.py | 144 + examples/qml/referenceexamples/properties.py | 135 + examples/qml/referenceexamples/signal.py | 243 + examples/qml/referenceexamples/valuesource.py | 326 ++ examples/quick/animation/animation.py | 60 + examples/quick/animation/animation.qml | 63 + .../animation/basics/color-animation.qml | 123 + .../animation/basics/images/face-smile.png | Bin 0 -> 15408 bytes .../quick/animation/basics/images/moon.png | Bin 0 -> 2433 bytes .../quick/animation/basics/images/shadow.png | Bin 0 -> 425 bytes .../quick/animation/basics/images/star.png | Bin 0 -> 349 bytes .../quick/animation/basics/images/sun.png | Bin 0 -> 8153 bytes .../animation/basics/property-animation.qml | 107 + .../quick/animation/behaviors/SideRect.qml | 62 + .../animation/behaviors/behavior-example.qml | 120 + .../quick/animation/behaviors/tvtennis.qml | 111 + .../quick/animation/behaviors/wigglytext.qml | 112 + examples/quick/animation/easing/easing.qml | 156 + .../animation/pathanimation/pathanimation.qml | 107 + .../pathinterpolator/pathinterpolator.qml | 113 + examples/quick/animation/states/qt-logo.png | Bin 0 -> 5149 bytes examples/quick/animation/states/states.qml | 103 + .../quick/animation/states/transitions.qml | 132 + .../quick/canvas/bezierCurve/bezierCurve.qml | 123 + examples/quick/canvas/canvas.py | 60 + examples/quick/canvas/canvas.qml | 60 + examples/quick/canvas/clip/clip.qml | 150 + examples/quick/canvas/contents/Button.qml | 87 + examples/quick/canvas/contents/ScrollBar.qml | 74 + examples/quick/canvas/contents/Slider.qml | 115 + examples/quick/canvas/contents/TitleBar.qml | 70 + examples/quick/canvas/contents/ToolBar.qml | 69 + .../canvas/contents/images/button-pressed.png | Bin 0 -> 571 bytes .../quick/canvas/contents/images/button.png | Bin 0 -> 564 bytes .../quick/canvas/contents/images/default.svg | 82 + .../quick/canvas/contents/images/gloss.png | Bin 0 -> 1236 bytes .../quick/canvas/contents/images/lineedit.png | Bin 0 -> 1415 bytes .../quick/canvas/contents/images/lineedit.sci | 5 + .../quick/canvas/contents/images/quit.png | Bin 0 -> 2369 bytes .../quick/canvas/contents/images/stripes.png | Bin 0 -> 257 bytes .../quick/canvas/contents/images/titlebar.png | Bin 0 -> 1436 bytes .../quick/canvas/contents/images/titlebar.sci | 5 + .../canvas/contents/images/toolbutton.png | Bin 0 -> 2550 bytes .../canvas/contents/images/toolbutton.sci | 5 + examples/quick/canvas/contents/qt-logo.png | Bin 0 -> 23519 bytes .../quadraticCurveTo/quadraticCurveTo.qml | 130 + .../quick/canvas/roundedrect/roundedrect.qml | 123 + examples/quick/canvas/smile/smile.qml | 126 + examples/quick/canvas/squircle/squircle.png | Bin 0 -> 771 bytes examples/quick/canvas/squircle/squircle.qml | 153 + examples/quick/canvas/tiger/tiger.js | 721 +++ examples/quick/canvas/tiger/tiger.qml | 128 + .../abstractitemmodel/abstractitemmodel.py | 121 + .../quick/models/abstractitemmodel/view.qml | 50 + .../models/objectlistmodel/objectlistmodel.py | 102 + .../quick/models/objectlistmodel/view.qml | 67 + .../models/stringlistmodel/stringlistmodel.py | 64 + .../quick/models/stringlistmodel/view.qml | 66 + .../customgeometry/customgeometry.py | 186 + .../quick/scenegraph/customgeometry/main.qml | 74 + examples/quick/shared/Button.qml | 91 + examples/quick/shared/LauncherList.qml | 153 + .../quick/shared/SimpleLauncherDelegate.qml | 89 + examples/quick/shared/images/back.png | Bin 0 -> 1590 bytes examples/quick/shared/images/next.png | Bin 0 -> 1371 bytes .../extending/chapter1-basics/app.qml | 59 + .../chapter1-basics/chapter1-basics.py | 99 + .../extending/chapter2-methods/app.qml | 65 + .../chapter2-methods/chapter2-methods.py | 103 + .../extending/chapter3-bindings/app.qml | 73 + .../chapter3-bindings/chapter3-bindings.py | 104 + .../chapter4-customPropertyTypes/app.qml | 59 + .../chapter4-customPropertyTypes.py | 112 + .../extending/chapter5-listproperties/app.qml | 69 + .../chapter5-listproperties.py | 125 + .../chapter6-plugins/Charts/chartsplugin.py | 51 + .../chapter6-plugins/Charts/piechart.py | 66 + .../chapter6-plugins/Charts/pieslice.py | 84 + .../extending/chapter6-plugins/Charts/qmldir | 2 + .../extending/chapter6-plugins/app.qml | 69 + examples/richtext/textobject/heart.svg | 55 + examples/richtext/textobject/textobject.py | 122 + lupdate/__init__.py | 20 + lupdate/designer_source.py | 68 + lupdate/lupdate.py | 98 + lupdate/pylupdate.py | 87 + lupdate/python_source.py | 361 ++ lupdate/source_file.py | 29 + lupdate/translation_file.py | 413 ++ lupdate/translations.py | 51 + lupdate/user.py | 47 + project.py | 915 +++ pyproject.toml | 17 + qmlscene/pluginloader.cpp | 376 ++ qmlscene/pluginloader.h | 57 + qmlscene/qmlscene.pro-in | 23 + qpy/QtCore/qpycore_api.h | 117 + qpy/QtCore/qpycore_chimera.cpp | 1905 ++++++ qpy/QtCore/qpycore_chimera.h | 283 + qpy/QtCore/qpycore_chimera_signature.cpp | 93 + qpy/QtCore/qpycore_chimera_storage.cpp | 126 + qpy/QtCore/qpycore_classinfo.cpp | 109 + qpy/QtCore/qpycore_classinfo.h | 31 + qpy/QtCore/qpycore_decorators.cpp | 159 + qpy/QtCore/qpycore_enums_flags.cpp | 253 + qpy/QtCore/qpycore_enums_flags.h | 42 + qpy/QtCore/qpycore_event_handlers.cpp | 123 + qpy/QtCore/qpycore_event_handlers.h | 53 + qpy/QtCore/qpycore_init.cpp | 106 + qpy/QtCore/qpycore_misc.cpp | 72 + qpy/QtCore/qpycore_misc.h | 36 + qpy/QtCore/qpycore_namespace.h | 35 + qpy/QtCore/qpycore_objectified_strings.h | 38 + qpy/QtCore/qpycore_post_init.cpp | 111 + qpy/QtCore/qpycore_public_api.cpp | 449 ++ qpy/QtCore/qpycore_public_api.h | 115 + qpy/QtCore/qpycore_pyqtboundsignal.cpp | 1011 ++++ qpy/QtCore/qpycore_pyqtboundsignal.h | 69 + qpy/QtCore/qpycore_pyqtconfigure.cpp | 239 + qpy/QtCore/qpycore_pyqtmethodproxy.cpp | 266 + qpy/QtCore/qpycore_pyqtmethodproxy.h | 67 + qpy/QtCore/qpycore_pyqtmutexlocker.cpp | 86 + qpy/QtCore/qpycore_pyqtmutexlocker.h | 45 + qpy/QtCore/qpycore_pyqtproperty.cpp | 582 ++ qpy/QtCore/qpycore_pyqtproperty.h | 82 + qpy/QtCore/qpycore_pyqtpyobject.cpp | 213 + qpy/QtCore/qpycore_pyqtpyobject.h | 56 + qpy/QtCore/qpycore_pyqtsignal.cpp | 753 +++ qpy/QtCore/qpycore_pyqtsignal.h | 87 + qpy/QtCore/qpycore_pyqtslot.cpp | 339 ++ qpy/QtCore/qpycore_pyqtslot.h | 73 + qpy/QtCore/qpycore_pyqtslotproxy.cpp | 407 ++ qpy/QtCore/qpycore_pyqtslotproxy.h | 116 + qpy/QtCore/qpycore_qjsonvalue.cpp | 163 + qpy/QtCore/qpycore_qmessagelogger.cpp | 102 + qpy/QtCore/qpycore_qmetaobject.cpp | 164 + qpy/QtCore/qpycore_qmetaobject_helpers.cpp | 159 + qpy/QtCore/qpycore_qmetaobjectbuilder.h | 124 + qpy/QtCore/qpycore_qobject_getattr.cpp | 131 + qpy/QtCore/qpycore_qobject_helpers.cpp | 291 + qpy/QtCore/qpycore_qobject_helpers.h | 40 + qpy/QtCore/qpycore_qstring.cpp | 147 + qpy/QtCore/qpycore_qt_conf.cpp | 118 + qpy/QtCore/qpycore_qvariant.cpp | 79 + qpy/QtCore/qpycore_qvariant_value.cpp | 228 + qpy/QtCore/qpycore_types.cpp | 530 ++ qpy/QtCore/qpycore_types.h | 56 + qpy/QtDBus/qpydbus_api.h | 29 + qpy/QtDBus/qpydbus_chimera_helpers.cpp | 257 + qpy/QtDBus/qpydbus_chimera_helpers.h | 37 + qpy/QtDBus/qpydbus_post_init.cpp | 38 + qpy/QtDBus/qpydbuspendingreply.cpp | 66 + qpy/QtDBus/qpydbuspendingreply.h | 41 + qpy/QtDBus/qpydbusreply.cpp | 145 + qpy/QtDBus/qpydbusreply.h | 60 + .../qpydesignercontainerextension.h | 42 + .../qpydesignercustomwidgetcollectionplugin.h | 42 + .../qpydesignercustomwidgetplugin.h | 42 + .../qpydesignermembersheetextension.h | 42 + .../qpydesignerpropertysheetextension.h | 42 + qpy/QtDesigner/qpydesignertaskmenuextension.h | 42 + qpy/QtOpenGL/qpyopengl_add_constants.cpp | 5121 +++++++++++++++++ qpy/QtOpenGL/qpyopengl_api.h | 69 + qpy/QtOpenGL/qpyopengl_array_convertors.cpp | 189 + qpy/QtOpenGL/qpyopengl_attribute_array.cpp | 269 + qpy/QtOpenGL/qpyopengl_data_cache.cpp | 239 + qpy/QtOpenGL/qpyopengl_data_cache.h | 96 + qpy/QtOpenGL/qpyopengl_get.cpp | 174 + qpy/QtOpenGL/qpyopengl_init.cpp | 33 + qpy/QtOpenGL/qpyopengl_misc.h | 35 + .../qpyopengl_uniform_value_array.cpp | 420 ++ qpy/QtOpenGL/qpyopengl_value_array.cpp | 396 ++ qpy/QtOpenGL/qpyopengl_version_functions.cpp | 110 + qpy/QtQml/qpyqml_api.h | 63 + qpy/QtQml/qpyqml_listdata.cpp | 58 + qpy/QtQml/qpyqml_listdata.h | 50 + qpy/QtQml/qpyqml_post_init.cpp | 69 + qpy/QtQml/qpyqml_qjsvalue.cpp | 115 + qpy/QtQml/qpyqml_register_singleton_type.cpp | 170 + qpy/QtQml/qpyqml_register_type.cpp | 395 ++ qpy/QtQml/qpyqmllistproperty.cpp | 348 ++ qpy/QtQml/qpyqmllistproperty.h | 35 + qpy/QtQml/qpyqmllistpropertywrapper.cpp | 227 + qpy/QtQml/qpyqmllistpropertywrapper.h | 59 + qpy/QtQml/qpyqmlobject.cpp | 687 +++ qpy/QtQml/qpyqmlobject.h | 219 + qpy/QtQml/qpyqmlsingletonobject.cpp | 110 + qpy/QtQml/qpyqmlsingletonobject.h | 100 + qpy/QtQml/qpyqmlvalidator.cpp | 407 ++ qpy/QtQml/qpyqmlvalidator.h | 117 + qpy/QtQuick/qpyquick_api.h | 33 + qpy/QtQuick/qpyquick_chimera_helpers.cpp | 157 + qpy/QtQuick/qpyquick_chimera_helpers.h | 44 + qpy/QtQuick/qpyquick_post_init.cpp | 58 + qpy/QtQuick/qpyquick_register_type.cpp | 55 + qpy/QtQuick/qpyquick_register_type.h | 39 + qpy/QtQuick/qpyquickframebufferobject.cpp | 184 + qpy/QtQuick/qpyquickframebufferobject.h | 97 + qpy/QtQuick/qpyquickitem.cpp | 255 + qpy/QtQuick/qpyquickitem.h | 128 + qpy/QtQuick/qpyquickpainteditem.cpp | 184 + qpy/QtQuick/qpyquickpainteditem.h | 98 + qpy/QtQuick/qpyquickview.cpp | 163 + qpy/QtQuick/qpyquickview.h | 88 + qpy/QtQuick/qpyquickwindow.cpp | 163 + qpy/QtQuick/qpyquickwindow.h | 88 + qpy/QtWidgets/qpywidgets_api.h | 29 + qpy/QtWidgets/qpywidgets_chimera_helpers.cpp | 53 + qpy/QtWidgets/qpywidgets_chimera_helpers.h | 37 + qpy/QtWidgets/qpywidgets_post_init.cpp | 41 + qpy/QtWidgets/qpywidgets_qaction_helpers.cpp | 35 + qpy/QtWidgets/qpywidgets_qaction_helpers.h | 33 + sip/QAxContainer/QAxContainermod.sip | 49 + sip/QAxContainer/qaxbase.sip | 151 + sip/QAxContainer/qaxobject.sip | 89 + sip/QAxContainer/qaxobjectinterface.sip | 34 + sip/QAxContainer/qaxwidget.sip | 73 + sip/QtBluetooth/QtBluetoothmod.sip | 71 + sip/QtBluetooth/qbluetooth.sip | 55 + sip/QtBluetooth/qbluetoothaddress.sip | 52 + .../qbluetoothdevicediscoveryagent.sip | 81 + sip/QtBluetooth/qbluetoothdeviceinfo.sip | 245 + sip/QtBluetooth/qbluetoothhostinfo.sip | 47 + sip/QtBluetooth/qbluetoothlocaldevice.sip | 79 + sip/QtBluetooth/qbluetoothserver.sip | 101 + .../qbluetoothservicediscoveryagent.sip | 75 + sip/QtBluetooth/qbluetoothserviceinfo.sip | 95 + sip/QtBluetooth/qbluetoothsocket.sip | 140 + sip/QtBluetooth/qbluetoothuuid.sip | 347 ++ sip/QtBluetooth/qlowenergyadvertisingdata.sip | 66 + .../qlowenergyadvertisingparameters.sip | 88 + sip/QtBluetooth/qlowenergycharacteristic.sip | 68 + .../qlowenergycharacteristicdata.sip | 61 + .../qlowenergyconnectionparameters.sip | 51 + sip/QtBluetooth/qlowenergycontroller.sip | 125 + sip/QtBluetooth/qlowenergydescriptor.sip | 48 + sip/QtBluetooth/qlowenergydescriptordata.sip | 56 + sip/QtBluetooth/qlowenergyservice.sip | 107 + sip/QtBluetooth/qlowenergyservicedata.sip | 62 + sip/QtBluetooth/qpybluetooth_qlist.sip | 133 + sip/QtBluetooth/qpybluetooth_qmultihash.sip | 183 + sip/QtBluetooth/qpybluetooth_quint128.sip | 115 + sip/QtCore/QtCoremod.sip | 214 + sip/QtCore/qabstractanimation.sip | 82 + sip/QtCore/qabstracteventdispatcher.sip | 63 + sip/QtCore/qabstractitemmodel.sip | 317 + sip/QtCore/qabstractnativeeventfilter.sip | 36 + sip/QtCore/qabstractproxymodel.sip | 67 + sip/QtCore/qanimationgroup.sip | 43 + sip/QtCore/qanystringview.sip | 92 + sip/QtCore/qbasictimer.sip | 41 + sip/QtCore/qbitarray.sip | 82 + sip/QtCore/qbuffer.sip | 114 + sip/QtCore/qbytearray.sip | 451 ++ sip/QtCore/qbytearrayalgorithms.sip | 31 + sip/QtCore/qbytearraylist.sip | 124 + sip/QtCore/qbytearraymatcher.sip | 56 + sip/QtCore/qbytearrayview.sip | 79 + sip/QtCore/qcalendar.sip | 96 + sip/QtCore/qcborcommon.sip | 99 + sip/QtCore/qcborstreamreader.sip | 128 + sip/QtCore/qcborstreamwriter.sip | 81 + sip/QtCore/qchar.sip | 51 + sip/QtCore/qcollator.sip | 69 + sip/QtCore/qcommandlineoption.sip | 55 + sip/QtCore/qcommandlineparser.sip | 75 + sip/QtCore/qconcatenatetablesproxymodel.sip | 90 + sip/QtCore/qcoreapplication.sip | 407 ++ sip/QtCore/qcoreevent.sip | 278 + sip/QtCore/qcryptographichash.sip | 91 + sip/QtCore/qdatastream.sip | 512 ++ sip/QtCore/qdatetime.sip | 467 ++ sip/QtCore/qdeadlinetimer.sip | 66 + sip/QtCore/qdir.sip | 201 + sip/QtCore/qdiriterator.sip | 55 + sip/QtCore/qeasingcurve.sip | 288 + sip/QtCore/qelapsedtimer.sip | 57 + sip/QtCore/qeventloop.sip | 70 + sip/QtCore/qfile.sip | 66 + sip/QtCore/qfiledevice.sip | 213 + sip/QtCore/qfileinfo.sip | 104 + sip/QtCore/qfileselector.sip | 37 + sip/QtCore/qfilesystemwatcher.sip | 43 + sip/QtCore/qflags.sip | 49 + sip/QtCore/qglobal.sip | 198 + sip/QtCore/qidentityproxymodel.sip | 51 + sip/QtCore/qiodevice.sip | 429 ++ sip/QtCore/qiodevicebase.sip | 50 + sip/QtCore/qitemselectionmodel.sip | 263 + sip/QtCore/qjsonarray.sip | 129 + sip/QtCore/qjsondocument.sip | 92 + sip/QtCore/qjsonobject.sip | 136 + sip/QtCore/qjsonvalue.sip | 83 + sip/QtCore/qlibrary.sip | 60 + sip/QtCore/qlibraryinfo.sip | 61 + sip/QtCore/qline.sip | 171 + sip/QtCore/qlocale.sip | 1169 ++++ sip/QtCore/qlockfile.sip | 54 + sip/QtCore/qlogging.sip | 233 + sip/QtCore/qloggingcategory.sip | 45 + sip/QtCore/qmargins.sip | 113 + sip/QtCore/qmessageauthenticationcode.sip | 55 + sip/QtCore/qmetaobject.sip | 270 + sip/QtCore/qmetatype.sip | 191 + sip/QtCore/qmimedata.sip | 56 + sip/QtCore/qmimedatabase.sip | 54 + sip/QtCore/qmimetype.sip | 54 + sip/QtCore/qmutex.sip | 57 + sip/QtCore/qmutexlocker.sip | 65 + sip/QtCore/qnamespace.sip | 1610 ++++++ sip/QtCore/qnumeric.sip | 48 + sip/QtCore/qobject.sip | 624 ++ sip/QtCore/qobjectcleanuphandler.sip | 36 + sip/QtCore/qobjectdefs.sip | 197 + sip/QtCore/qoperatingsystemversion.sip | 223 + sip/QtCore/qparallelanimationgroup.sip | 39 + sip/QtCore/qpauseanimation.sip | 39 + sip/QtCore/qpermissions.sip | 292 + sip/QtCore/qpluginloader.sip | 43 + sip/QtCore/qpoint.sip | 154 + sip/QtCore/qprocess.sip | 245 + sip/QtCore/qpropertyanimation.sip | 42 + sip/QtCore/qpycore_qhash.sip | 489 ++ sip/QtCore/qpycore_qlist.sip | 1492 +++++ sip/QtCore/qpycore_qmap.sip | 425 ++ sip/QtCore/qpycore_qset.sip | 244 + sip/QtCore/qpycore_std_pair.sip | 503 ++ sip/QtCore/qpycore_virtual_error_handler.sip | 23 + sip/QtCore/qrandom.sip | 50 + sip/QtCore/qreadwritelock.sip | 104 + sip/QtCore/qrect.sip | 286 + sip/QtCore/qregularexpression.sip | 186 + sip/QtCore/qresource.sip | 81 + sip/QtCore/qrunnable.sip | 55 + sip/QtCore/qsavefile.sip | 70 + sip/QtCore/qsemaphore.sip | 55 + sip/QtCore/qsequentialanimationgroup.sip | 45 + sip/QtCore/qsettings.sip | 153 + sip/QtCore/qsharedmemory.sip | 75 + sip/QtCore/qsignalmapper.sip | 48 + sip/QtCore/qsize.sip | 166 + sip/QtCore/qsocketnotifier.sip | 58 + sip/QtCore/qsortfilterproxymodel.sip | 119 + sip/QtCore/qstandardpaths.sip | 78 + sip/QtCore/qstorageinfo.sip | 57 + sip/QtCore/qstring.sip | 47 + sip/QtCore/qstringconverter.sip | 113 + sip/QtCore/qstringconverter_base.sip | 88 + sip/QtCore/qstringlist.sip | 124 + sip/QtCore/qstringlistmodel.sip | 47 + sip/QtCore/qstringview.sip | 48 + sip/QtCore/qsysinfo.sip | 53 + sip/QtCore/qsystemsemaphore.sip | 58 + sip/QtCore/qtemporarydir.sip | 46 + sip/QtCore/qtemporaryfile.sip | 47 + sip/QtCore/qtenvironmentvariables.sip | 43 + sip/QtCore/qtextboundaryfinder.sip | 65 + sip/QtCore/qtextstream.sip | 177 + sip/QtCore/qthread.sip | 85 + sip/QtCore/qthreadpool.sip | 177 + sip/QtCore/qtimeline.sip | 85 + sip/QtCore/qtimer.sip | 83 + sip/QtCore/qtimezone.sip | 153 + sip/QtCore/qtranslator.sip | 39 + sip/QtCore/qtransposeproxymodel.sip | 51 + sip/QtCore/qtversion.sip | 31 + sip/QtCore/qtypes.sip | 77 + sip/QtCore/qurl.sip | 187 + sip/QtCore/qurlquery.sip | 69 + sip/QtCore/quuid.sip | 117 + sip/QtCore/qvariant.sip | 99 + sip/QtCore/qvariantanimation.sip | 56 + sip/QtCore/qversionnumber.sip | 111 + sip/QtCore/qwaitcondition.sip | 41 + sip/QtCore/qwineventnotifier.sip | 54 + sip/QtCore/qxmlstream.sip | 537 ++ sip/QtDBus/QtDBusmod.sip | 61 + sip/QtDBus/qdbusabstractadaptor.sip | 38 + sip/QtDBus/qdbusabstractinterface.sip | 224 + sip/QtDBus/qdbusargument.sip | 175 + sip/QtDBus/qdbusconnection.sip | 251 + sip/QtDBus/qdbusconnectioninterface.sip | 72 + sip/QtDBus/qdbuserror.sip | 69 + sip/QtDBus/qdbusextratypes.sip | 83 + sip/QtDBus/qdbusinterface.sip | 32 + sip/QtDBus/qdbusmessage.sip | 72 + sip/QtDBus/qdbuspendingcall.sip | 54 + sip/QtDBus/qdbusservicewatcher.sip | 54 + sip/QtDBus/qdbusunixfiledescriptor.sip | 39 + sip/QtDBus/qpydbuspendingreply.sip | 44 + sip/QtDBus/qpydbusreply.sip | 238 + sip/QtDesigner/QtDesignermod.sip | 73 + sip/QtDesigner/abstractactioneditor.sip | 38 + sip/QtDesigner/abstractformbuilder.sip | 40 + sip/QtDesigner/abstractformeditor.sip | 46 + sip/QtDesigner/abstractformwindow.sip | 106 + sip/QtDesigner/abstractformwindowcursor.sip | 68 + sip/QtDesigner/abstractformwindowmanager.sip | 88 + sip/QtDesigner/abstractobjectinspector.sip | 36 + sip/QtDesigner/abstractpropertyeditor.sip | 44 + sip/QtDesigner/abstractwidgetbox.sip | 36 + sip/QtDesigner/container.sip | 44 + sip/QtDesigner/customwidget.sip | 54 + sip/QtDesigner/default_extensionfactory.sip | 36 + sip/QtDesigner/extension.sip | 45 + sip/QtDesigner/formbuilder.sip | 37 + sip/QtDesigner/membersheet.sip | 49 + sip/QtDesigner/propertysheet.sip | 51 + sip/QtDesigner/qextensionmanager.sip | 77 + .../qpydesignercontainerextension.sip | 32 + ...pydesignercustomwidgetcollectionplugin.sip | 33 + .../qpydesignercustomwidgetplugin.sip | 32 + .../qpydesignermembersheetextension.sip | 32 + .../qpydesignerpropertysheetextension.sip | 33 + .../qpydesignertaskmenuextension.sip | 32 + sip/QtDesigner/taskmenu.sip | 37 + sip/QtGui/QtGuimod.sip | 137 + sip/QtGui/opengl_types.sip | 43 + sip/QtGui/qabstractfileiconprovider.sip | 57 + sip/QtGui/qabstracttextdocumentlayout.sip | 99 + sip/QtGui/qaction.sip | 154 + sip/QtGui/qactiongroup.sip | 61 + sip/QtGui/qbackingstore.sip | 43 + sip/QtGui/qbitmap.sip | 51 + sip/QtGui/qbrush.sip | 422 ++ sip/QtGui/qclipboard.sip | 92 + sip/QtGui/qcolor.sip | 397 ++ sip/QtGui/qcolorspace.sip | 108 + sip/QtGui/qcolortransform.sip | 47 + sip/QtGui/qcursor.sip | 90 + sip/QtGui/qdesktopservices.sip | 67 + sip/QtGui/qdrag.sip | 55 + sip/QtGui/qevent.sip | 850 +++ sip/QtGui/qeventpoint.sip | 73 + sip/QtGui/qfilesystemmodel.sip | 111 + sip/QtGui/qfont.sip | 214 + sip/QtGui/qfontdatabase.sip | 107 + sip/QtGui/qfontinfo.sip | 46 + sip/QtGui/qfontmetrics.sip | 197 + sip/QtGui/qgenericmatrix.sip | 942 +++ sip/QtGui/qglyphrun.sip | 84 + sip/QtGui/qguiapplication.sip | 261 + sip/QtGui/qicon.sip | 99 + sip/QtGui/qiconengine.sip | 70 + sip/QtGui/qimage.sip | 398 ++ sip/QtGui/qimageiohandler.sip | 88 + sip/QtGui/qimagereader.sip | 96 + sip/QtGui/qimagewriter.sip | 73 + sip/QtGui/qinputdevice.sip | 89 + sip/QtGui/qinputmethod.sip | 77 + sip/QtGui/qkeysequence.sip | 239 + sip/QtGui/qmatrix4x4.sip | 296 + sip/QtGui/qmovie.sip | 91 + sip/QtGui/qoffscreensurface.sip | 45 + sip/QtGui/qopenglcontext.sip | 88 + sip/QtGui/qpagedpaintdevice.sip | 47 + sip/QtGui/qpagelayout.sip | 90 + sip/QtGui/qpageranges.sip | 64 + sip/QtGui/qpagesize.sip | 216 + sip/QtGui/qpaintdevice.sip | 71 + sip/QtGui/qpaintdevicewindow.sip | 41 + sip/QtGui/qpaintengine.sip | 189 + sip/QtGui/qpainter.sip | 554 ++ sip/QtGui/qpainterpath.sip | 165 + sip/QtGui/qpalette.sip | 125 + sip/QtGui/qpdfwriter.sip | 51 + sip/QtGui/qpen.sip | 103 + sip/QtGui/qpicture.sip | 57 + sip/QtGui/qpixelformat.sip | 134 + sip/QtGui/qpixmap.sip | 111 + sip/QtGui/qpixmapcache.sip | 76 + sip/QtGui/qpointingdevice.sip | 71 + sip/QtGui/qpolygon.sip | 461 ++ sip/QtGui/qpygui_qlist.sip | 102 + sip/QtGui/qquaternion.sip | 117 + sip/QtGui/qrasterwindow.sip | 35 + sip/QtGui/qrawfont.sip | 92 + sip/QtGui/qregion.sip | 112 + sip/QtGui/qrgb.sip | 37 + sip/QtGui/qrgba64.sip | 67 + sip/QtGui/qscreen.sip | 77 + sip/QtGui/qsessionmanager.sip | 62 + sip/QtGui/qshortcut.sip | 171 + sip/QtGui/qstandarditemmodel.sip | 207 + sip/QtGui/qstatictext.sip | 55 + sip/QtGui/qstylehints.sip | 100 + sip/QtGui/qsurface.sip | 58 + sip/QtGui/qsurfaceformat.sip | 112 + sip/QtGui/qsyntaxhighlighter.sip | 89 + sip/QtGui/qtextcursor.sip | 158 + sip/QtGui/qtextdocument.sip | 380 ++ sip/QtGui/qtextdocumentfragment.sip | 49 + sip/QtGui/qtextdocumentwriter.sip | 46 + sip/QtGui/qtextformat.sip | 654 +++ sip/QtGui/qtextlayout.sip | 195 + sip/QtGui/qtextlist.sip | 41 + sip/QtGui/qtextobject.sip | 292 + sip/QtGui/qtextoption.sip | 96 + sip/QtGui/qtexttable.sip | 75 + sip/QtGui/qtransform.sip | 132 + sip/QtGui/qundogroup.sip | 57 + sip/QtGui/qundostack.sip | 95 + sip/QtGui/qutimimeconverter.sip | 47 + sip/QtGui/qvalidator.sip | 113 + sip/QtGui/qvectornd.sip | 259 + sip/QtGui/qwindow.sip | 216 + sip/QtGui/qwindowdefs.sip | 24 + sip/QtHelp/QtHelpmod.sip | 61 + sip/QtHelp/qcompressedhelpinfo.sip | 39 + sip/QtHelp/qhelpcontentwidget.sip | 76 + sip/QtHelp/qhelpengine.sip | 37 + sip/QtHelp/qhelpenginecore.sip | 105 + sip/QtHelp/qhelpfilterdata.sip | 39 + sip/QtHelp/qhelpfilterengine.sip | 51 + sip/QtHelp/qhelpfiltersettingswidget.sip | 36 + sip/QtHelp/qhelpindexwidget.sip | 59 + sip/QtHelp/qhelplink.sip | 31 + sip/QtHelp/qhelpsearchengine.sip | 90 + sip/QtHelp/qhelpsearchquerywidget.sip | 47 + sip/QtHelp/qhelpsearchresultwidget.sip | 35 + sip/QtMultimedia/QtMultimediamod.sip | 74 + sip/QtMultimedia/qaudio.sip | 59 + sip/QtMultimedia/qaudiobuffer.sip | 59 + sip/QtMultimedia/qaudiodecoder.sip | 74 + sip/QtMultimedia/qaudiodevice.sip | 62 + sip/QtMultimedia/qaudioformat.sip | 118 + sip/QtMultimedia/qaudioinput.sip | 50 + sip/QtMultimedia/qaudiooutput.sip | 50 + sip/QtMultimedia/qaudiosink.sip | 56 + sip/QtMultimedia/qaudiosource.sip | 56 + sip/QtMultimedia/qcamera.sip | 241 + sip/QtMultimedia/qcameradevice.sip | 76 + sip/QtMultimedia/qimagecapture.sip | 99 + sip/QtMultimedia/qmediacapturesession.sip | 71 + sip/QtMultimedia/qmediadevices.sip | 47 + sip/QtMultimedia/qmediaformat.sip | 120 + sip/QtMultimedia/qmediametadata.sip | 82 + sip/QtMultimedia/qmediaplayer.sip | 146 + sip/QtMultimedia/qmediarecorder.sip | 121 + sip/QtMultimedia/qmediatimerange.sip | 89 + sip/QtMultimedia/qpymultimedia_qlist.sip | 530 ++ sip/QtMultimedia/qscreencapture.sip | 62 + sip/QtMultimedia/qsoundeffect.sip | 80 + sip/QtMultimedia/qvideoframe.sip | 122 + sip/QtMultimedia/qvideoframeformat.sip | 175 + sip/QtMultimedia/qvideosink.sip | 46 + .../QtMultimediaWidgetsmod.sip | 51 + .../qgraphicsvideoitem.sip | 59 + sip/QtMultimediaWidgets/qvideowidget.sip | 84 + sip/QtNetwork/QtNetworkmod.sip | 89 + sip/QtNetwork/qabstractnetworkcache.sip | 78 + sip/QtNetwork/qabstractsocket.sip | 330 ++ sip/QtNetwork/qauthenticator.sip | 44 + sip/QtNetwork/qdnslookup.sip | 173 + sip/QtNetwork/qhostaddress.sip | 189 + sip/QtNetwork/qhostinfo.sip | 87 + sip/QtNetwork/qhstspolicy.sip | 51 + sip/QtNetwork/qhttp1configuration.sip | 50 + sip/QtNetwork/qhttp2configuration.sip | 47 + sip/QtNetwork/qhttpmultipart.sip | 64 + sip/QtNetwork/qlocalserver.sip | 75 + sip/QtNetwork/qlocalsocket.sip | 214 + sip/QtNetwork/qnetworkaccessmanager.sip | 108 + sip/QtNetwork/qnetworkcookie.sip | 78 + sip/QtNetwork/qnetworkcookiejar.sip | 42 + sip/QtNetwork/qnetworkdatagram.sip | 51 + sip/QtNetwork/qnetworkdiskcache.sip | 50 + sip/QtNetwork/qnetworkinformation.sip | 123 + sip/QtNetwork/qnetworkinterface.sip | 120 + sip/QtNetwork/qnetworkproxy.sip | 139 + sip/QtNetwork/qnetworkreply.sip | 175 + sip/QtNetwork/qnetworkrequest.sip | 167 + sip/QtNetwork/qocspresponse.sip | 84 + sip/QtNetwork/qpassworddigestor.sip | 35 + sip/QtNetwork/qpynetwork_qhash.sip | 132 + sip/QtNetwork/qpynetwork_qlist.sip | 349 ++ sip/QtNetwork/qpynetwork_qmap.sip | 208 + sip/QtNetwork/qssl.sip | 169 + sip/QtNetwork/qsslcertificate.sip | 95 + sip/QtNetwork/qsslcertificateextension.sip | 43 + sip/QtNetwork/qsslcipher.sip | 51 + sip/QtNetwork/qsslconfiguration.sip | 124 + sip/QtNetwork/qssldiffiehellmanparameters.sip | 62 + sip/QtNetwork/qsslellipticcurve.sip | 51 + sip/QtNetwork/qsslerror.sip | 91 + sip/QtNetwork/qsslkey.sip | 51 + .../qsslpresharedkeyauthenticator.sip | 51 + sip/QtNetwork/qsslserver.sip | 55 + sip/QtNetwork/qsslsocket.sip | 225 + sip/QtNetwork/qtcpserver.sip | 71 + sip/QtNetwork/qtcpsocket.sip | 32 + sip/QtNetwork/qudpsocket.sip | 95 + sip/QtNfc/QtNfcmod.sip | 55 + sip/QtNfc/qndeffilter.sip | 58 + sip/QtNfc/qndefmessage.sip | 74 + sip/QtNfc/qndefnfcsmartposterrecord.sip | 96 + sip/QtNfc/qndefnfctextrecord.sip | 49 + sip/QtNfc/qndefnfcurirecord.sip | 38 + sip/QtNfc/qndefrecord.sip | 93 + sip/QtNfc/qnearfieldmanager.sip | 107 + sip/QtNfc/qnearfieldtarget.sip | 110 + sip/QtOpenGL/QtOpenGLmod.sip | 68 + sip/QtOpenGL/qopenglbuffer.sip | 96 + sip/QtOpenGL/qopengldebug.sip | 163 + sip/QtOpenGL/qopenglframebufferobject.sip | 115 + sip/QtOpenGL/qopenglfunctions_2_0.sip | 2919 ++++++++++ sip/QtOpenGL/qopenglfunctions_2_1.sip | 2920 ++++++++++ sip/QtOpenGL/qopenglfunctions_4_1_core.sip | 1074 ++++ sip/QtOpenGL/qopenglfunctions_es2.sip | 815 +++ sip/QtOpenGL/qopenglpaintdevice.sip | 49 + sip/QtOpenGL/qopenglpixeltransferoptions.sip | 50 + sip/QtOpenGL/qopenglshaderprogram.sip | 319 + sip/QtOpenGL/qopengltexture.sip | 462 ++ sip/QtOpenGL/qopengltextureblitter.sip | 57 + sip/QtOpenGL/qopengltimerquery.sip | 71 + sip/QtOpenGL/qopenglversionfunctions.sip | 30 + .../qopenglversionfunctionsfactory.sip | 34 + sip/QtOpenGL/qopenglversionprofile.sip | 48 + sip/QtOpenGL/qopenglvertexarrayobject.sip | 65 + sip/QtOpenGL/qopenglwindow.sip | 61 + sip/QtOpenGL/qpyopengl_qlist.sip | 129 + sip/QtOpenGL/qpyopengl_std_pair.sip | 111 + sip/QtOpenGLWidgets/QtOpenGLWidgetsmod.sip | 51 + sip/QtOpenGLWidgets/qopenglwidget.sip | 117 + sip/QtPdf/QtPdfmod.sip | 56 + sip/QtPdf/qpdfbookmarkmodel.sip | 52 + sip/QtPdf/qpdfdocument.sip | 124 + sip/QtPdf/qpdfdocumentrenderoptions.sip | 63 + sip/QtPdf/qpdflink.sip | 44 + sip/QtPdf/qpdfpagenavigator.sip | 53 + sip/QtPdf/qpdfpagerenderer.sip | 47 + sip/QtPdf/qpdfsearchmodel.sip | 59 + sip/QtPdf/qpdfselection.sip | 43 + sip/QtPdfWidgets/QtPdfWidgetsmod.sip | 50 + sip/QtPdfWidgets/qpdfview.sip | 101 + sip/QtPositioning/QtPositioningmod.sip | 61 + sip/QtPositioning/qgeoaddress.sip | 71 + sip/QtPositioning/qgeoareamonitorinfo.sip | 66 + sip/QtPositioning/qgeoareamonitorsource.sip | 74 + sip/QtPositioning/qgeocircle.sip | 53 + sip/QtPositioning/qgeocoordinate.sip | 85 + sip/QtPositioning/qgeolocation.sip | 57 + sip/QtPositioning/qgeopath.sip | 62 + sip/QtPositioning/qgeopolygon.sip | 65 + sip/QtPositioning/qgeopositioninfo.sip | 77 + sip/QtPositioning/qgeopositioninfosource.sip | 114 + sip/QtPositioning/qgeorectangle.sip | 70 + sip/QtPositioning/qgeosatelliteinfo.sip | 76 + sip/QtPositioning/qgeosatelliteinfosource.sip | 69 + sip/QtPositioning/qgeoshape.sip | 94 + sip/QtPositioning/qnmeapositioninfosource.sip | 62 + .../qnmeasatelliteinfosource.sip | 68 + sip/QtPrintSupport/QtPrintSupportmod.sip | 58 + sip/QtPrintSupport/qabstractprintdialog.sip | 134 + sip/QtPrintSupport/qpagesetupdialog.sip | 71 + sip/QtPrintSupport/qprintdialog.sip | 80 + sip/QtPrintSupport/qprintengine.sip | 78 + sip/QtPrintSupport/qprinter.sip | 178 + sip/QtPrintSupport/qprinterinfo.sip | 61 + sip/QtPrintSupport/qprintpreviewdialog.sip | 59 + sip/QtPrintSupport/qprintpreviewwidget.sip | 82 + sip/QtPrintSupport/qpyprintsupport_qlist.sip | 229 + sip/QtQml/QtQmlmod.sip | 74 + sip/QtQml/qjsengine.sip | 208 + sip/QtQml/qjsmanagedvalue.sip | 99 + sip/QtQml/qjsprimitivevalue.sip | 117 + sip/QtQml/qjsvalue.sip | 117 + sip/QtQml/qjsvalueiterator.sip | 39 + sip/QtQml/qmlattachedpropertiesobject.sip | 42 + sip/QtQml/qmlregistertype.sip | 82 + sip/QtQml/qpyqmllistproperty.sip | 40 + sip/QtQml/qqml.sip | 36 + sip/QtQml/qqmlabstracturlinterceptor.sip | 41 + sip/QtQml/qqmlapplicationengine.sip | 54 + sip/QtQml/qqmlcomponent.sip | 91 + sip/QtQml/qqmlcontext.sip | 60 + sip/QtQml/qqmlengine.sip | 184 + sip/QtQml/qqmlerror.sip | 52 + sip/QtQml/qqmlexpression.sip | 52 + sip/QtQml/qqmlextensionplugin.sip | 47 + sip/QtQml/qqmlfileselector.sip | 35 + sip/QtQml/qqmlincubator.sip | 85 + sip/QtQml/qqmllist.sip | 55 + sip/QtQml/qqmlnetworkaccessmanagerfactory.sip | 32 + sip/QtQml/qqmlparserstatus.sip | 34 + sip/QtQml/qqmlproperty.sip | 130 + sip/QtQml/qqmlpropertymap.sip | 53 + sip/QtQml/qqmlpropertyvaluesource.sip | 33 + sip/QtQml/qqmlscriptstring.sip | 41 + sip/QtQuick/QtQuickmod.sip | 78 + sip/QtQuick/qquickframebufferobject.sip | 81 + sip/QtQuick/qquickgraphicsconfiguration.sip | 76 + sip/QtQuick/qquickgraphicsdevice.sip | 37 + sip/QtQuick/qquickimageprovider.sip | 84 + sip/QtQuick/qquickitem.sip | 320 + sip/QtQuick/qquickitemgrabresult.sip | 45 + sip/QtQuick/qquickpainteditem.sip | 91 + sip/QtQuick/qquickrendercontrol.sip | 51 + sip/QtQuick/qquickrendertarget.sip | 61 + sip/QtQuick/qquicktextdocument.sip | 32 + sip/QtQuick/qquickview.sip | 75 + sip/QtQuick/qquickwindow.sip | 206 + sip/QtQuick/qsgflatcolormaterial.sip | 36 + sip/QtQuick/qsggeometry.sip | 355 ++ sip/QtQuick/qsgimagenode.sip | 66 + sip/QtQuick/qsgmaterial.sip | 53 + sip/QtQuick/qsgmaterialshader.sip | 165 + sip/QtQuick/qsgmaterialtype.sip | 28 + sip/QtQuick/qsgnode.sip | 335 ++ sip/QtQuick/qsgrectanglenode.sip | 36 + sip/QtQuick/qsgrendererinterface.sip | 107 + sip/QtQuick/qsgrendernode.sip | 82 + sip/QtQuick/qsgsimplerectnode.sip | 37 + sip/QtQuick/qsgsimpletexturenode.sip | 55 + sip/QtQuick/qsgtexture.sip | 88 + sip/QtQuick/qsgtexture_platform.sip | 46 + sip/QtQuick/qsgtexturematerial.sip | 57 + sip/QtQuick/qsgtextureprovider.sip | 34 + sip/QtQuick/qsgvertexcolormaterial.sip | 36 + sip/QtQuick3D/QtQuick3Dmod.sip | 53 + sip/QtQuick3D/qquick3d.sip | 31 + sip/QtQuick3D/qquick3dgeometry.sip | 132 + sip/QtQuick3D/qquick3dobject.sip | 75 + sip/QtQuick3D/qquick3dtexturedata.sip | 81 + sip/QtQuickWidgets/QtQuickWidgetsmod.sip | 52 + sip/QtQuickWidgets/qquickwidget.sip | 102 + sip/QtRemoteObjects/QtRemoteObjectsmod.sip | 53 + .../qremoteobjectabstractitemmodelreplica.sip | 54 + .../qremoteobjectdynamicreplica.sip | 38 + sip/QtRemoteObjects/qremoteobjectnode.sip | 191 + sip/QtRemoteObjects/qremoteobjectregistry.sip | 43 + sip/QtRemoteObjects/qremoteobjectreplica.sip | 55 + sip/QtRemoteObjects/qtremoteobjectglobal.sip | 67 + sip/QtSensors/QtSensorsmod.sip | 64 + sip/QtSensors/qaccelerometer.sip | 81 + sip/QtSensors/qambientlightsensor.sip | 74 + sip/QtSensors/qambienttemperaturesensor.sip | 64 + sip/QtSensors/qcompass.sip | 66 + sip/QtSensors/qgyroscope.sip | 68 + sip/QtSensors/qhumiditysensor.sip | 66 + sip/QtSensors/qirproximitysensor.sip | 64 + sip/QtSensors/qlidsensor.sip | 70 + sip/QtSensors/qlightsensor.sip | 69 + sip/QtSensors/qmagnetometer.sip | 75 + sip/QtSensors/qorientationsensor.sip | 75 + sip/QtSensors/qpressuresensor.sip | 66 + sip/QtSensors/qproximitysensor.sip | 64 + sip/QtSensors/qrotationsensor.sip | 71 + sip/QtSensors/qsensor.sip | 234 + sip/QtSensors/qtapsensor.sip | 88 + sip/QtSensors/qtiltsensor.sip | 67 + sip/QtSerialPort/QtSerialPortmod.sip | 49 + sip/QtSerialPort/qserialport.sip | 282 + sip/QtSerialPort/qserialportinfo.sip | 52 + sip/QtSpatialAudio/QtSpatialAudiomod.sip | 53 + sip/QtSpatialAudio/qambientsound.sip | 62 + sip/QtSpatialAudio/qaudioengine.sip | 105 + sip/QtSpatialAudio/qaudiolistener.sip | 41 + sip/QtSpatialAudio/qaudioroom.sip | 100 + sip/QtSpatialAudio/qspatialsound.sip | 99 + sip/QtSql/QtSqlmod.sip | 61 + sip/QtSql/qsqldatabase.sip | 92 + sip/QtSql/qsqldriver.sip | 156 + sip/QtSql/qsqlerror.sip | 51 + sip/QtSql/qsqlfield.sip | 70 + sip/QtSql/qsqlindex.sip | 41 + sip/QtSql/qsqlquery.sip | 83 + sip/QtSql/qsqlquerymodel.sip | 75 + sip/QtSql/qsqlrecord.sip | 61 + sip/QtSql/qsqlrelationaldelegate.sip | 35 + sip/QtSql/qsqlrelationaltablemodel.sip | 73 + sip/QtSql/qsqlresult.sip | 87 + sip/QtSql/qsqltablemodel.sip | 96 + sip/QtSql/qtsqlglobal.sip | 60 + sip/QtSvg/QtSvgmod.sip | 50 + sip/QtSvg/qsvggenerator.sip | 69 + sip/QtSvg/qsvgrenderer.sip | 93 + sip/QtSvgWidgets/QtSvgWidgetsmod.sip | 52 + sip/QtSvgWidgets/qgraphicssvgitem.sip | 54 + sip/QtSvgWidgets/qsvgwidget.sip | 71 + sip/QtTest/QtTestmod.sip | 54 + sip/QtTest/qabstractitemmodeltester.sip | 47 + sip/QtTest/qsignalspy.sip | 101 + sip/QtTest/qtestkeyboard.sip | 59 + sip/QtTest/qtestmouse.sip | 39 + sip/QtTest/qtestsystem.sip | 34 + sip/QtTextToSpeech/QtTextToSpeechmod.sip | 49 + sip/QtTextToSpeech/qtexttospeech.sip | 121 + sip/QtTextToSpeech/qvoice.sip | 61 + sip/QtWebChannel/QtWebChannelmod.sip | 49 + sip/QtWebChannel/qwebchannel.sip | 80 + .../qwebchannelabstracttransport.sip | 42 + sip/QtWebSockets/QtWebSocketsmod.sip | 54 + sip/QtWebSockets/qmaskgenerator.sip | 38 + sip/QtWebSockets/qwebsocket.sip | 180 + .../qwebsocketcorsauthenticator.sip | 41 + .../qwebsockethandshakeoptions.sip | 46 + sip/QtWebSockets/qwebsocketprotocol.sip | 62 + sip/QtWebSockets/qwebsocketserver.sip | 99 + sip/QtWidgets/QtWidgetsmod.sip | 161 + sip/QtWidgets/qabstractbutton.sip | 82 + sip/QtWidgets/qabstractitemdelegate.sip | 55 + sip/QtWidgets/qabstractitemview.sip | 282 + sip/QtWidgets/qabstractscrollarea.sip | 85 + sip/QtWidgets/qabstractslider.sip | 98 + sip/QtWidgets/qabstractspinbox.sip | 124 + sip/QtWidgets/qapplication.sip | 310 + sip/QtWidgets/qboxlayout.sip | 145 + sip/QtWidgets/qbuttongroup.sip | 52 + sip/QtWidgets/qcalendarwidget.sip | 119 + sip/QtWidgets/qcheckbox.sip | 51 + sip/QtWidgets/qcolordialog.sip | 83 + sip/QtWidgets/qcolumnview.sip | 65 + sip/QtWidgets/qcombobox.sip | 164 + sip/QtWidgets/qcommandlinkbutton.sip | 46 + sip/QtWidgets/qcommonstyle.sip | 50 + sip/QtWidgets/qcompleter.sip | 95 + sip/QtWidgets/qdatawidgetmapper.sip | 69 + sip/QtWidgets/qdatetimeedit.sip | 148 + sip/QtWidgets/qdial.sip | 53 + sip/QtWidgets/qdialog.sip | 80 + sip/QtWidgets/qdialogbuttonbox.sip | 107 + sip/QtWidgets/qdockwidget.sip | 70 + sip/QtWidgets/qdrawutil.sip | 39 + sip/QtWidgets/qerrormessage.sip | 41 + sip/QtWidgets/qfiledialog.sip | 311 + sip/QtWidgets/qfileiconprovider.sip | 34 + sip/QtWidgets/qfilesystemmodel.sip | 21 + sip/QtWidgets/qfocusframe.sip | 40 + sip/QtWidgets/qfontcombobox.sip | 91 + sip/QtWidgets/qfontdialog.sip | 81 + sip/QtWidgets/qformlayout.sip | 135 + sip/QtWidgets/qframe.sip | 77 + sip/QtWidgets/qgesture.sip | 191 + sip/QtWidgets/qgesturerecognizer.sip | 48 + sip/QtWidgets/qgraphicsanchorlayout.sip | 67 + sip/QtWidgets/qgraphicseffect.sip | 183 + sip/QtWidgets/qgraphicsgridlayout.sip | 100 + sip/QtWidgets/qgraphicsitem.sip | 698 +++ sip/QtWidgets/qgraphicslayout.sip | 45 + sip/QtWidgets/qgraphicslayoutitem.sip | 76 + sip/QtWidgets/qgraphicslinearlayout.sip | 79 + sip/QtWidgets/qgraphicsproxywidget.sip | 88 + sip/QtWidgets/qgraphicsscene.sip | 167 + sip/QtWidgets/qgraphicssceneevent.sip | 235 + sip/QtWidgets/qgraphicstransform.sip | 87 + sip/QtWidgets/qgraphicsview.sip | 186 + sip/QtWidgets/qgraphicswidget.sip | 122 + sip/QtWidgets/qgridlayout.sip | 144 + sip/QtWidgets/qgroupbox.sip | 62 + sip/QtWidgets/qheaderview.sip | 179 + sip/QtWidgets/qinputdialog.sip | 123 + sip/QtWidgets/qitemdelegate.sip | 51 + sip/QtWidgets/qitemeditorfactory.sip | 49 + sip/QtWidgets/qkeysequenceedit.sip | 73 + sip/QtWidgets/qlabel.sip | 191 + sip/QtWidgets/qlayout.sip | 171 + sip/QtWidgets/qlayoutitem.sip | 117 + sip/QtWidgets/qlcdnumber.sip | 82 + sip/QtWidgets/qlineedit.sip | 153 + sip/QtWidgets/qlistview.sip | 139 + sip/QtWidgets/qlistwidget.sip | 195 + sip/QtWidgets/qmainwindow.sip | 109 + sip/QtWidgets/qmdiarea.sip | 125 + sip/QtWidgets/qmdisubwindow.sip | 117 + sip/QtWidgets/qmenu.sip | 147 + sip/QtWidgets/qmenubar.sip | 99 + sip/QtWidgets/qmessagebox.sip | 162 + sip/QtWidgets/qplaintextedit.sip | 189 + sip/QtWidgets/qprogressbar.sip | 70 + sip/QtWidgets/qprogressdialog.sip | 85 + sip/QtWidgets/qproxystyle.sip | 61 + sip/QtWidgets/qpushbutton.sip | 57 + sip/QtWidgets/qpywidgets_qlist.sip | 120 + sip/QtWidgets/qradiobutton.sip | 42 + sip/QtWidgets/qrubberband.sip | 54 + sip/QtWidgets/qscrollarea.sip | 50 + sip/QtWidgets/qscrollbar.sip | 46 + sip/QtWidgets/qscroller.sip | 87 + sip/QtWidgets/qscrollerproperties.sip | 80 + sip/QtWidgets/qsizegrip.sip | 45 + sip/QtWidgets/qsizepolicy.sip | 108 + sip/QtWidgets/qslider.sip | 57 + sip/QtWidgets/qspinbox.sip | 106 + sip/QtWidgets/qsplashscreen.sip | 50 + sip/QtWidgets/qsplitter.sip | 98 + sip/QtWidgets/qstackedlayout.sip | 112 + sip/QtWidgets/qstackedwidget.sip | 51 + sip/QtWidgets/qstatusbar.sip | 55 + sip/QtWidgets/qstyle.sip | 696 +++ sip/QtWidgets/qstyleditemdelegate.sip | 46 + sip/QtWidgets/qstylefactory.sip | 32 + sip/QtWidgets/qstyleoption.sip | 1069 ++++ sip/QtWidgets/qstylepainter.sip | 41 + sip/QtWidgets/qsystemtrayicon.sip | 78 + sip/QtWidgets/qtabbar.sip | 163 + sip/QtWidgets/qtableview.sip | 114 + sip/QtWidgets/qtablewidget.sip | 247 + sip/QtWidgets/qtabwidget.sip | 132 + sip/QtWidgets/qtextbrowser.sip | 82 + sip/QtWidgets/qtextedit.sip | 202 + sip/QtWidgets/qtoolbar.sip | 121 + sip/QtWidgets/qtoolbox.sip | 64 + sip/QtWidgets/qtoolbutton.sip | 76 + sip/QtWidgets/qtooltip.sip | 40 + sip/QtWidgets/qtreeview.sip | 155 + sip/QtWidgets/qtreewidget.sip | 246 + sip/QtWidgets/qtreewidgetitemiterator.sip | 67 + sip/QtWidgets/qundoview.sip | 44 + sip/QtWidgets/qwhatsthis.sip | 38 + sip/QtWidgets/qwidget.sip | 515 ++ sip/QtWidgets/qwidgetaction.sip | 43 + sip/QtWidgets/qwizard.sip | 238 + sip/QtXml/QtXmlmod.sip | 48 + sip/QtXml/qdom.sip | 528 ++ sip/pyqt-gpl.sip | 1 + uic/Compiler/__init__.py | 20 + uic/Compiler/as_string.py | 40 + uic/Compiler/compiler.py | 107 + uic/Compiler/indenter.py | 77 + uic/Compiler/misc.py | 59 + uic/Compiler/proxy_metaclass.py | 100 + uic/Compiler/qobjectcreator.py | 178 + uic/Compiler/qtproxies.py | 471 ++ uic/Loader/__init__.py | 20 + uic/Loader/loader.py | 62 + uic/Loader/qobjectcreator.py | 158 + uic/__init__.py | 23 + uic/compile_ui.py | 172 + uic/enum_map.py | 494 ++ uic/exceptions.py | 70 + uic/icon_cache.py | 159 + uic/load_ui.py | 86 + uic/objcreator.py | 165 + uic/properties.py | 538 ++ uic/pyuic.py | 179 + uic/ui_file.py | 92 + uic/uiparser.py | 1038 ++++ uic/widget-plugins/qaxcontainer.py | 33 + uic/widget-plugins/qscintilla.py | 33 + uic/widget-plugins/qtcharts.py | 33 + uic/widget-plugins/qtprintsupport.py | 33 + uic/widget-plugins/qtquickwidgets.py | 33 + uic/widget-plugins/qtwebenginewidgets.py | 33 + 1037 files changed, 143684 insertions(+) create mode 100644 ChangeLog create mode 100644 LICENSE create mode 100644 NEWS create mode 100644 PKG-INFO create mode 100644 README create mode 100644 __init__.py create mode 100644 config-tests/cfgtest_QtCore.cpp create mode 100644 config-tests/cfgtest_QtGui.cpp create mode 100644 config-tests/cfgtest_QtNetwork.cpp create mode 100644 config-tests/cfgtest_QtPrintSupport.cpp create mode 100644 dbus/dbus.cpp create mode 100644 dbus/helper.h create mode 100644 designer/designer.pro-in create mode 100644 designer/pluginloader.cpp create mode 100644 designer/pluginloader.h create mode 100644 examples/designer/calculatorform/calculatorform.py create mode 100644 examples/designer/calculatorform/calculatorform.ui create mode 100644 examples/designer/calculatorform/ui_calculatorform.py create mode 100644 examples/designer/plugins/plugins.py create mode 100644 examples/designer/plugins/python/analogclockplugin.py create mode 100644 examples/designer/plugins/python/bubbleswidgetplugin.py create mode 100644 examples/designer/plugins/python/counterlabelplugin.py create mode 100644 examples/designer/plugins/python/datetimeeditplugin.py create mode 100644 examples/designer/plugins/python/helloglwidgetplugin.py create mode 100644 examples/designer/plugins/python/multipagewidgetplugin.py create mode 100644 examples/designer/plugins/python/polygonwidgetplugin.py create mode 100644 examples/designer/plugins/python/pydemoplugin.py create mode 100644 examples/designer/plugins/python/pythonconsoleplugin.py create mode 100644 examples/designer/plugins/widgets/analogclock.py create mode 100644 examples/designer/plugins/widgets/bubbleswidget.py create mode 100644 examples/designer/plugins/widgets/counterlabel.py create mode 100644 examples/designer/plugins/widgets/datetimeedit.py create mode 100644 examples/designer/plugins/widgets/helloglwidget.py create mode 100644 examples/designer/plugins/widgets/multipagewidget.py create mode 100644 examples/designer/plugins/widgets/polygonwidget.py create mode 100644 examples/designer/plugins/widgets/pydemo.py create mode 100644 examples/designer/plugins/widgets/pythonconsolewidget.py create mode 100644 examples/desktop/screenshot.py create mode 100644 examples/desktop/systray/images/bad.png create mode 100644 examples/desktop/systray/images/heart.png create mode 100644 examples/desktop/systray/images/trash.png create mode 100644 examples/desktop/systray/systray.py create mode 100644 examples/dialogs/classwizard/classwizard.py create mode 100644 examples/dialogs/classwizard/images/background.png create mode 100644 examples/dialogs/classwizard/images/banner.png create mode 100644 examples/dialogs/classwizard/images/logo1.png create mode 100644 examples/dialogs/classwizard/images/logo2.png create mode 100644 examples/dialogs/classwizard/images/logo3.png create mode 100644 examples/dialogs/classwizard/images/watermark1.png create mode 100644 examples/dialogs/classwizard/images/watermark2.png create mode 100644 examples/dialogs/configdialog/configdialog.py create mode 100644 examples/dialogs/configdialog/images/config.png create mode 100644 examples/dialogs/configdialog/images/query.png create mode 100644 examples/dialogs/configdialog/images/update.png create mode 100644 examples/dialogs/extension.py create mode 100644 examples/dialogs/findfiles.py create mode 100644 examples/dialogs/standarddialogs.py create mode 100644 examples/dialogs/tabdialog.py create mode 100644 examples/dialogs/trivialwizard.py create mode 100644 examples/draganddrop/delayedencoding/delayedencoding.py create mode 100644 examples/draganddrop/delayedencoding/images/drag.png create mode 100644 examples/draganddrop/delayedencoding/images/example.svg create mode 100644 examples/draganddrop/draggableicons/draggableicons.py create mode 100644 examples/draganddrop/draggableicons/images/boat.png create mode 100644 examples/draganddrop/draggableicons/images/car.png create mode 100644 examples/draganddrop/draggableicons/images/house.png create mode 100644 examples/draganddrop/draggabletext/draggabletext.py create mode 100644 examples/draganddrop/draggabletext/words.txt create mode 100644 examples/draganddrop/dropsite.py create mode 100644 examples/draganddrop/fridgemagnets/fridgemagnets.py create mode 100644 examples/draganddrop/fridgemagnets/words.txt create mode 100644 examples/draganddrop/puzzle/example.jpg create mode 100644 examples/draganddrop/puzzle/puzzle.py create mode 100644 examples/multimedia/audiodevices/audiodevices.py create mode 100644 examples/multimedia/audiodevices/audiodevicesbase.ui create mode 100644 examples/multimedia/audiodevices/ui_audiodevicesbase.py create mode 100644 examples/multimedia/audiooutput.py create mode 100644 examples/multimediawidgets/camera/camera.py create mode 100644 examples/multimediawidgets/camera/camera.ui create mode 100644 examples/multimediawidgets/camera/images/shutter.svg create mode 100644 examples/multimediawidgets/camera/imagesettings.ui create mode 100644 examples/multimediawidgets/camera/ui_camera.py create mode 100644 examples/multimediawidgets/camera/ui_imagesettings.py create mode 100644 examples/multimediawidgets/camera/ui_videosettings.py create mode 100644 examples/multimediawidgets/camera/videosettings.ui create mode 100644 examples/multimediawidgets/videographicsitem.py create mode 100644 examples/multimediawidgets/videowidget.py create mode 100755 examples/qml/referenceexamples/adding.py create mode 100755 examples/qml/referenceexamples/attached.py create mode 100755 examples/qml/referenceexamples/binding.py create mode 100755 examples/qml/referenceexamples/coercion.py create mode 100755 examples/qml/referenceexamples/default.py create mode 100755 examples/qml/referenceexamples/grouped.py create mode 100755 examples/qml/referenceexamples/methods.py create mode 100755 examples/qml/referenceexamples/properties.py create mode 100755 examples/qml/referenceexamples/signal.py create mode 100755 examples/qml/referenceexamples/valuesource.py create mode 100644 examples/quick/animation/animation.py create mode 100644 examples/quick/animation/animation.qml create mode 100644 examples/quick/animation/basics/color-animation.qml create mode 100644 examples/quick/animation/basics/images/face-smile.png create mode 100644 examples/quick/animation/basics/images/moon.png create mode 100644 examples/quick/animation/basics/images/shadow.png create mode 100644 examples/quick/animation/basics/images/star.png create mode 100644 examples/quick/animation/basics/images/sun.png create mode 100644 examples/quick/animation/basics/property-animation.qml create mode 100644 examples/quick/animation/behaviors/SideRect.qml create mode 100644 examples/quick/animation/behaviors/behavior-example.qml create mode 100644 examples/quick/animation/behaviors/tvtennis.qml create mode 100644 examples/quick/animation/behaviors/wigglytext.qml create mode 100644 examples/quick/animation/easing/easing.qml create mode 100644 examples/quick/animation/pathanimation/pathanimation.qml create mode 100644 examples/quick/animation/pathinterpolator/pathinterpolator.qml create mode 100644 examples/quick/animation/states/qt-logo.png create mode 100644 examples/quick/animation/states/states.qml create mode 100644 examples/quick/animation/states/transitions.qml create mode 100644 examples/quick/canvas/bezierCurve/bezierCurve.qml create mode 100644 examples/quick/canvas/canvas.py create mode 100644 examples/quick/canvas/canvas.qml create mode 100644 examples/quick/canvas/clip/clip.qml create mode 100644 examples/quick/canvas/contents/Button.qml create mode 100644 examples/quick/canvas/contents/ScrollBar.qml create mode 100644 examples/quick/canvas/contents/Slider.qml create mode 100644 examples/quick/canvas/contents/TitleBar.qml create mode 100644 examples/quick/canvas/contents/ToolBar.qml create mode 100644 examples/quick/canvas/contents/images/button-pressed.png create mode 100644 examples/quick/canvas/contents/images/button.png create mode 100644 examples/quick/canvas/contents/images/default.svg create mode 100644 examples/quick/canvas/contents/images/gloss.png create mode 100644 examples/quick/canvas/contents/images/lineedit.png create mode 100644 examples/quick/canvas/contents/images/lineedit.sci create mode 100644 examples/quick/canvas/contents/images/quit.png create mode 100644 examples/quick/canvas/contents/images/stripes.png create mode 100644 examples/quick/canvas/contents/images/titlebar.png create mode 100644 examples/quick/canvas/contents/images/titlebar.sci create mode 100644 examples/quick/canvas/contents/images/toolbutton.png create mode 100644 examples/quick/canvas/contents/images/toolbutton.sci create mode 100644 examples/quick/canvas/contents/qt-logo.png create mode 100644 examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml create mode 100644 examples/quick/canvas/roundedrect/roundedrect.qml create mode 100644 examples/quick/canvas/smile/smile.qml create mode 100644 examples/quick/canvas/squircle/squircle.png create mode 100644 examples/quick/canvas/squircle/squircle.qml create mode 100644 examples/quick/canvas/tiger/tiger.js create mode 100644 examples/quick/canvas/tiger/tiger.qml create mode 100644 examples/quick/models/abstractitemmodel/abstractitemmodel.py create mode 100644 examples/quick/models/abstractitemmodel/view.qml create mode 100644 examples/quick/models/objectlistmodel/objectlistmodel.py create mode 100644 examples/quick/models/objectlistmodel/view.qml create mode 100644 examples/quick/models/stringlistmodel/stringlistmodel.py create mode 100644 examples/quick/models/stringlistmodel/view.qml create mode 100644 examples/quick/scenegraph/customgeometry/customgeometry.py create mode 100644 examples/quick/scenegraph/customgeometry/main.qml create mode 100644 examples/quick/shared/Button.qml create mode 100644 examples/quick/shared/LauncherList.qml create mode 100644 examples/quick/shared/SimpleLauncherDelegate.qml create mode 100644 examples/quick/shared/images/back.png create mode 100644 examples/quick/shared/images/next.png create mode 100644 examples/quick/tutorials/extending/chapter1-basics/app.qml create mode 100644 examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.py create mode 100644 examples/quick/tutorials/extending/chapter2-methods/app.qml create mode 100644 examples/quick/tutorials/extending/chapter2-methods/chapter2-methods.py create mode 100644 examples/quick/tutorials/extending/chapter3-bindings/app.qml create mode 100644 examples/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.py create mode 100644 examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml create mode 100644 examples/quick/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.py create mode 100644 examples/quick/tutorials/extending/chapter5-listproperties/app.qml create mode 100644 examples/quick/tutorials/extending/chapter5-listproperties/chapter5-listproperties.py create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/Charts/chartsplugin.py create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/Charts/piechart.py create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/Charts/pieslice.py create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/app.qml create mode 100644 examples/richtext/textobject/heart.svg create mode 100644 examples/richtext/textobject/textobject.py create mode 100644 lupdate/__init__.py create mode 100644 lupdate/designer_source.py create mode 100644 lupdate/lupdate.py create mode 100644 lupdate/pylupdate.py create mode 100644 lupdate/python_source.py create mode 100644 lupdate/source_file.py create mode 100644 lupdate/translation_file.py create mode 100644 lupdate/translations.py create mode 100644 lupdate/user.py create mode 100644 project.py create mode 100644 pyproject.toml create mode 100644 qmlscene/pluginloader.cpp create mode 100644 qmlscene/pluginloader.h create mode 100644 qmlscene/qmlscene.pro-in create mode 100644 qpy/QtCore/qpycore_api.h create mode 100644 qpy/QtCore/qpycore_chimera.cpp create mode 100644 qpy/QtCore/qpycore_chimera.h create mode 100644 qpy/QtCore/qpycore_chimera_signature.cpp create mode 100644 qpy/QtCore/qpycore_chimera_storage.cpp create mode 100644 qpy/QtCore/qpycore_classinfo.cpp create mode 100644 qpy/QtCore/qpycore_classinfo.h create mode 100644 qpy/QtCore/qpycore_decorators.cpp create mode 100644 qpy/QtCore/qpycore_enums_flags.cpp create mode 100644 qpy/QtCore/qpycore_enums_flags.h create mode 100644 qpy/QtCore/qpycore_event_handlers.cpp create mode 100644 qpy/QtCore/qpycore_event_handlers.h create mode 100644 qpy/QtCore/qpycore_init.cpp create mode 100644 qpy/QtCore/qpycore_misc.cpp create mode 100644 qpy/QtCore/qpycore_misc.h create mode 100644 qpy/QtCore/qpycore_namespace.h create mode 100644 qpy/QtCore/qpycore_objectified_strings.h create mode 100644 qpy/QtCore/qpycore_post_init.cpp create mode 100644 qpy/QtCore/qpycore_public_api.cpp create mode 100644 qpy/QtCore/qpycore_public_api.h create mode 100644 qpy/QtCore/qpycore_pyqtboundsignal.cpp create mode 100644 qpy/QtCore/qpycore_pyqtboundsignal.h create mode 100644 qpy/QtCore/qpycore_pyqtconfigure.cpp create mode 100644 qpy/QtCore/qpycore_pyqtmethodproxy.cpp create mode 100644 qpy/QtCore/qpycore_pyqtmethodproxy.h create mode 100644 qpy/QtCore/qpycore_pyqtmutexlocker.cpp create mode 100644 qpy/QtCore/qpycore_pyqtmutexlocker.h create mode 100644 qpy/QtCore/qpycore_pyqtproperty.cpp create mode 100644 qpy/QtCore/qpycore_pyqtproperty.h create mode 100644 qpy/QtCore/qpycore_pyqtpyobject.cpp create mode 100644 qpy/QtCore/qpycore_pyqtpyobject.h create mode 100644 qpy/QtCore/qpycore_pyqtsignal.cpp create mode 100644 qpy/QtCore/qpycore_pyqtsignal.h create mode 100644 qpy/QtCore/qpycore_pyqtslot.cpp create mode 100644 qpy/QtCore/qpycore_pyqtslot.h create mode 100644 qpy/QtCore/qpycore_pyqtslotproxy.cpp create mode 100644 qpy/QtCore/qpycore_pyqtslotproxy.h create mode 100644 qpy/QtCore/qpycore_qjsonvalue.cpp create mode 100644 qpy/QtCore/qpycore_qmessagelogger.cpp create mode 100644 qpy/QtCore/qpycore_qmetaobject.cpp create mode 100644 qpy/QtCore/qpycore_qmetaobject_helpers.cpp create mode 100644 qpy/QtCore/qpycore_qmetaobjectbuilder.h create mode 100644 qpy/QtCore/qpycore_qobject_getattr.cpp create mode 100644 qpy/QtCore/qpycore_qobject_helpers.cpp create mode 100644 qpy/QtCore/qpycore_qobject_helpers.h create mode 100644 qpy/QtCore/qpycore_qstring.cpp create mode 100644 qpy/QtCore/qpycore_qt_conf.cpp create mode 100644 qpy/QtCore/qpycore_qvariant.cpp create mode 100644 qpy/QtCore/qpycore_qvariant_value.cpp create mode 100644 qpy/QtCore/qpycore_types.cpp create mode 100644 qpy/QtCore/qpycore_types.h create mode 100644 qpy/QtDBus/qpydbus_api.h create mode 100644 qpy/QtDBus/qpydbus_chimera_helpers.cpp create mode 100644 qpy/QtDBus/qpydbus_chimera_helpers.h create mode 100644 qpy/QtDBus/qpydbus_post_init.cpp create mode 100644 qpy/QtDBus/qpydbuspendingreply.cpp create mode 100644 qpy/QtDBus/qpydbuspendingreply.h create mode 100644 qpy/QtDBus/qpydbusreply.cpp create mode 100644 qpy/QtDBus/qpydbusreply.h create mode 100644 qpy/QtDesigner/qpydesignercontainerextension.h create mode 100644 qpy/QtDesigner/qpydesignercustomwidgetcollectionplugin.h create mode 100644 qpy/QtDesigner/qpydesignercustomwidgetplugin.h create mode 100644 qpy/QtDesigner/qpydesignermembersheetextension.h create mode 100644 qpy/QtDesigner/qpydesignerpropertysheetextension.h create mode 100644 qpy/QtDesigner/qpydesignertaskmenuextension.h create mode 100644 qpy/QtOpenGL/qpyopengl_add_constants.cpp create mode 100644 qpy/QtOpenGL/qpyopengl_api.h create mode 100644 qpy/QtOpenGL/qpyopengl_array_convertors.cpp create mode 100644 qpy/QtOpenGL/qpyopengl_attribute_array.cpp create mode 100644 qpy/QtOpenGL/qpyopengl_data_cache.cpp create mode 100644 qpy/QtOpenGL/qpyopengl_data_cache.h create mode 100644 qpy/QtOpenGL/qpyopengl_get.cpp create mode 100644 qpy/QtOpenGL/qpyopengl_init.cpp create mode 100644 qpy/QtOpenGL/qpyopengl_misc.h create mode 100644 qpy/QtOpenGL/qpyopengl_uniform_value_array.cpp create mode 100644 qpy/QtOpenGL/qpyopengl_value_array.cpp create mode 100644 qpy/QtOpenGL/qpyopengl_version_functions.cpp create mode 100644 qpy/QtQml/qpyqml_api.h create mode 100644 qpy/QtQml/qpyqml_listdata.cpp create mode 100644 qpy/QtQml/qpyqml_listdata.h create mode 100644 qpy/QtQml/qpyqml_post_init.cpp create mode 100644 qpy/QtQml/qpyqml_qjsvalue.cpp create mode 100644 qpy/QtQml/qpyqml_register_singleton_type.cpp create mode 100644 qpy/QtQml/qpyqml_register_type.cpp create mode 100644 qpy/QtQml/qpyqmllistproperty.cpp create mode 100644 qpy/QtQml/qpyqmllistproperty.h create mode 100644 qpy/QtQml/qpyqmllistpropertywrapper.cpp create mode 100644 qpy/QtQml/qpyqmllistpropertywrapper.h create mode 100644 qpy/QtQml/qpyqmlobject.cpp create mode 100644 qpy/QtQml/qpyqmlobject.h create mode 100644 qpy/QtQml/qpyqmlsingletonobject.cpp create mode 100644 qpy/QtQml/qpyqmlsingletonobject.h create mode 100644 qpy/QtQml/qpyqmlvalidator.cpp create mode 100644 qpy/QtQml/qpyqmlvalidator.h create mode 100644 qpy/QtQuick/qpyquick_api.h create mode 100644 qpy/QtQuick/qpyquick_chimera_helpers.cpp create mode 100644 qpy/QtQuick/qpyquick_chimera_helpers.h create mode 100644 qpy/QtQuick/qpyquick_post_init.cpp create mode 100644 qpy/QtQuick/qpyquick_register_type.cpp create mode 100644 qpy/QtQuick/qpyquick_register_type.h create mode 100644 qpy/QtQuick/qpyquickframebufferobject.cpp create mode 100644 qpy/QtQuick/qpyquickframebufferobject.h create mode 100644 qpy/QtQuick/qpyquickitem.cpp create mode 100644 qpy/QtQuick/qpyquickitem.h create mode 100644 qpy/QtQuick/qpyquickpainteditem.cpp create mode 100644 qpy/QtQuick/qpyquickpainteditem.h create mode 100644 qpy/QtQuick/qpyquickview.cpp create mode 100644 qpy/QtQuick/qpyquickview.h create mode 100644 qpy/QtQuick/qpyquickwindow.cpp create mode 100644 qpy/QtQuick/qpyquickwindow.h create mode 100644 qpy/QtWidgets/qpywidgets_api.h create mode 100644 qpy/QtWidgets/qpywidgets_chimera_helpers.cpp create mode 100644 qpy/QtWidgets/qpywidgets_chimera_helpers.h create mode 100644 qpy/QtWidgets/qpywidgets_post_init.cpp create mode 100644 qpy/QtWidgets/qpywidgets_qaction_helpers.cpp create mode 100644 qpy/QtWidgets/qpywidgets_qaction_helpers.h create mode 100644 sip/QAxContainer/QAxContainermod.sip create mode 100644 sip/QAxContainer/qaxbase.sip create mode 100644 sip/QAxContainer/qaxobject.sip create mode 100644 sip/QAxContainer/qaxobjectinterface.sip create mode 100644 sip/QAxContainer/qaxwidget.sip create mode 100644 sip/QtBluetooth/QtBluetoothmod.sip create mode 100644 sip/QtBluetooth/qbluetooth.sip create mode 100644 sip/QtBluetooth/qbluetoothaddress.sip create mode 100644 sip/QtBluetooth/qbluetoothdevicediscoveryagent.sip create mode 100644 sip/QtBluetooth/qbluetoothdeviceinfo.sip create mode 100644 sip/QtBluetooth/qbluetoothhostinfo.sip create mode 100644 sip/QtBluetooth/qbluetoothlocaldevice.sip create mode 100644 sip/QtBluetooth/qbluetoothserver.sip create mode 100644 sip/QtBluetooth/qbluetoothservicediscoveryagent.sip create mode 100644 sip/QtBluetooth/qbluetoothserviceinfo.sip create mode 100644 sip/QtBluetooth/qbluetoothsocket.sip create mode 100644 sip/QtBluetooth/qbluetoothuuid.sip create mode 100644 sip/QtBluetooth/qlowenergyadvertisingdata.sip create mode 100644 sip/QtBluetooth/qlowenergyadvertisingparameters.sip create mode 100644 sip/QtBluetooth/qlowenergycharacteristic.sip create mode 100644 sip/QtBluetooth/qlowenergycharacteristicdata.sip create mode 100644 sip/QtBluetooth/qlowenergyconnectionparameters.sip create mode 100644 sip/QtBluetooth/qlowenergycontroller.sip create mode 100644 sip/QtBluetooth/qlowenergydescriptor.sip create mode 100644 sip/QtBluetooth/qlowenergydescriptordata.sip create mode 100644 sip/QtBluetooth/qlowenergyservice.sip create mode 100644 sip/QtBluetooth/qlowenergyservicedata.sip create mode 100644 sip/QtBluetooth/qpybluetooth_qlist.sip create mode 100644 sip/QtBluetooth/qpybluetooth_qmultihash.sip create mode 100644 sip/QtBluetooth/qpybluetooth_quint128.sip create mode 100644 sip/QtCore/QtCoremod.sip create mode 100644 sip/QtCore/qabstractanimation.sip create mode 100644 sip/QtCore/qabstracteventdispatcher.sip create mode 100644 sip/QtCore/qabstractitemmodel.sip create mode 100644 sip/QtCore/qabstractnativeeventfilter.sip create mode 100644 sip/QtCore/qabstractproxymodel.sip create mode 100644 sip/QtCore/qanimationgroup.sip create mode 100644 sip/QtCore/qanystringview.sip create mode 100644 sip/QtCore/qbasictimer.sip create mode 100644 sip/QtCore/qbitarray.sip create mode 100644 sip/QtCore/qbuffer.sip create mode 100644 sip/QtCore/qbytearray.sip create mode 100644 sip/QtCore/qbytearrayalgorithms.sip create mode 100644 sip/QtCore/qbytearraylist.sip create mode 100644 sip/QtCore/qbytearraymatcher.sip create mode 100644 sip/QtCore/qbytearrayview.sip create mode 100644 sip/QtCore/qcalendar.sip create mode 100644 sip/QtCore/qcborcommon.sip create mode 100644 sip/QtCore/qcborstreamreader.sip create mode 100644 sip/QtCore/qcborstreamwriter.sip create mode 100644 sip/QtCore/qchar.sip create mode 100644 sip/QtCore/qcollator.sip create mode 100644 sip/QtCore/qcommandlineoption.sip create mode 100644 sip/QtCore/qcommandlineparser.sip create mode 100644 sip/QtCore/qconcatenatetablesproxymodel.sip create mode 100644 sip/QtCore/qcoreapplication.sip create mode 100644 sip/QtCore/qcoreevent.sip create mode 100644 sip/QtCore/qcryptographichash.sip create mode 100644 sip/QtCore/qdatastream.sip create mode 100644 sip/QtCore/qdatetime.sip create mode 100644 sip/QtCore/qdeadlinetimer.sip create mode 100644 sip/QtCore/qdir.sip create mode 100644 sip/QtCore/qdiriterator.sip create mode 100644 sip/QtCore/qeasingcurve.sip create mode 100644 sip/QtCore/qelapsedtimer.sip create mode 100644 sip/QtCore/qeventloop.sip create mode 100644 sip/QtCore/qfile.sip create mode 100644 sip/QtCore/qfiledevice.sip create mode 100644 sip/QtCore/qfileinfo.sip create mode 100644 sip/QtCore/qfileselector.sip create mode 100644 sip/QtCore/qfilesystemwatcher.sip create mode 100644 sip/QtCore/qflags.sip create mode 100644 sip/QtCore/qglobal.sip create mode 100644 sip/QtCore/qidentityproxymodel.sip create mode 100644 sip/QtCore/qiodevice.sip create mode 100644 sip/QtCore/qiodevicebase.sip create mode 100644 sip/QtCore/qitemselectionmodel.sip create mode 100644 sip/QtCore/qjsonarray.sip create mode 100644 sip/QtCore/qjsondocument.sip create mode 100644 sip/QtCore/qjsonobject.sip create mode 100644 sip/QtCore/qjsonvalue.sip create mode 100644 sip/QtCore/qlibrary.sip create mode 100644 sip/QtCore/qlibraryinfo.sip create mode 100644 sip/QtCore/qline.sip create mode 100644 sip/QtCore/qlocale.sip create mode 100644 sip/QtCore/qlockfile.sip create mode 100644 sip/QtCore/qlogging.sip create mode 100644 sip/QtCore/qloggingcategory.sip create mode 100644 sip/QtCore/qmargins.sip create mode 100644 sip/QtCore/qmessageauthenticationcode.sip create mode 100644 sip/QtCore/qmetaobject.sip create mode 100644 sip/QtCore/qmetatype.sip create mode 100644 sip/QtCore/qmimedata.sip create mode 100644 sip/QtCore/qmimedatabase.sip create mode 100644 sip/QtCore/qmimetype.sip create mode 100644 sip/QtCore/qmutex.sip create mode 100644 sip/QtCore/qmutexlocker.sip create mode 100644 sip/QtCore/qnamespace.sip create mode 100644 sip/QtCore/qnumeric.sip create mode 100644 sip/QtCore/qobject.sip create mode 100644 sip/QtCore/qobjectcleanuphandler.sip create mode 100644 sip/QtCore/qobjectdefs.sip create mode 100644 sip/QtCore/qoperatingsystemversion.sip create mode 100644 sip/QtCore/qparallelanimationgroup.sip create mode 100644 sip/QtCore/qpauseanimation.sip create mode 100644 sip/QtCore/qpermissions.sip create mode 100644 sip/QtCore/qpluginloader.sip create mode 100644 sip/QtCore/qpoint.sip create mode 100644 sip/QtCore/qprocess.sip create mode 100644 sip/QtCore/qpropertyanimation.sip create mode 100644 sip/QtCore/qpycore_qhash.sip create mode 100644 sip/QtCore/qpycore_qlist.sip create mode 100644 sip/QtCore/qpycore_qmap.sip create mode 100644 sip/QtCore/qpycore_qset.sip create mode 100644 sip/QtCore/qpycore_std_pair.sip create mode 100644 sip/QtCore/qpycore_virtual_error_handler.sip create mode 100644 sip/QtCore/qrandom.sip create mode 100644 sip/QtCore/qreadwritelock.sip create mode 100644 sip/QtCore/qrect.sip create mode 100644 sip/QtCore/qregularexpression.sip create mode 100644 sip/QtCore/qresource.sip create mode 100644 sip/QtCore/qrunnable.sip create mode 100644 sip/QtCore/qsavefile.sip create mode 100644 sip/QtCore/qsemaphore.sip create mode 100644 sip/QtCore/qsequentialanimationgroup.sip create mode 100644 sip/QtCore/qsettings.sip create mode 100644 sip/QtCore/qsharedmemory.sip create mode 100644 sip/QtCore/qsignalmapper.sip create mode 100644 sip/QtCore/qsize.sip create mode 100644 sip/QtCore/qsocketnotifier.sip create mode 100644 sip/QtCore/qsortfilterproxymodel.sip create mode 100644 sip/QtCore/qstandardpaths.sip create mode 100644 sip/QtCore/qstorageinfo.sip create mode 100644 sip/QtCore/qstring.sip create mode 100644 sip/QtCore/qstringconverter.sip create mode 100644 sip/QtCore/qstringconverter_base.sip create mode 100644 sip/QtCore/qstringlist.sip create mode 100644 sip/QtCore/qstringlistmodel.sip create mode 100644 sip/QtCore/qstringview.sip create mode 100644 sip/QtCore/qsysinfo.sip create mode 100644 sip/QtCore/qsystemsemaphore.sip create mode 100644 sip/QtCore/qtemporarydir.sip create mode 100644 sip/QtCore/qtemporaryfile.sip create mode 100644 sip/QtCore/qtenvironmentvariables.sip create mode 100644 sip/QtCore/qtextboundaryfinder.sip create mode 100644 sip/QtCore/qtextstream.sip create mode 100644 sip/QtCore/qthread.sip create mode 100644 sip/QtCore/qthreadpool.sip create mode 100644 sip/QtCore/qtimeline.sip create mode 100644 sip/QtCore/qtimer.sip create mode 100644 sip/QtCore/qtimezone.sip create mode 100644 sip/QtCore/qtranslator.sip create mode 100644 sip/QtCore/qtransposeproxymodel.sip create mode 100644 sip/QtCore/qtversion.sip create mode 100644 sip/QtCore/qtypes.sip create mode 100644 sip/QtCore/qurl.sip create mode 100644 sip/QtCore/qurlquery.sip create mode 100644 sip/QtCore/quuid.sip create mode 100644 sip/QtCore/qvariant.sip create mode 100644 sip/QtCore/qvariantanimation.sip create mode 100644 sip/QtCore/qversionnumber.sip create mode 100644 sip/QtCore/qwaitcondition.sip create mode 100644 sip/QtCore/qwineventnotifier.sip create mode 100644 sip/QtCore/qxmlstream.sip create mode 100644 sip/QtDBus/QtDBusmod.sip create mode 100644 sip/QtDBus/qdbusabstractadaptor.sip create mode 100644 sip/QtDBus/qdbusabstractinterface.sip create mode 100644 sip/QtDBus/qdbusargument.sip create mode 100644 sip/QtDBus/qdbusconnection.sip create mode 100644 sip/QtDBus/qdbusconnectioninterface.sip create mode 100644 sip/QtDBus/qdbuserror.sip create mode 100644 sip/QtDBus/qdbusextratypes.sip create mode 100644 sip/QtDBus/qdbusinterface.sip create mode 100644 sip/QtDBus/qdbusmessage.sip create mode 100644 sip/QtDBus/qdbuspendingcall.sip create mode 100644 sip/QtDBus/qdbusservicewatcher.sip create mode 100644 sip/QtDBus/qdbusunixfiledescriptor.sip create mode 100644 sip/QtDBus/qpydbuspendingreply.sip create mode 100644 sip/QtDBus/qpydbusreply.sip create mode 100644 sip/QtDesigner/QtDesignermod.sip create mode 100644 sip/QtDesigner/abstractactioneditor.sip create mode 100644 sip/QtDesigner/abstractformbuilder.sip create mode 100644 sip/QtDesigner/abstractformeditor.sip create mode 100644 sip/QtDesigner/abstractformwindow.sip create mode 100644 sip/QtDesigner/abstractformwindowcursor.sip create mode 100644 sip/QtDesigner/abstractformwindowmanager.sip create mode 100644 sip/QtDesigner/abstractobjectinspector.sip create mode 100644 sip/QtDesigner/abstractpropertyeditor.sip create mode 100644 sip/QtDesigner/abstractwidgetbox.sip create mode 100644 sip/QtDesigner/container.sip create mode 100644 sip/QtDesigner/customwidget.sip create mode 100644 sip/QtDesigner/default_extensionfactory.sip create mode 100644 sip/QtDesigner/extension.sip create mode 100644 sip/QtDesigner/formbuilder.sip create mode 100644 sip/QtDesigner/membersheet.sip create mode 100644 sip/QtDesigner/propertysheet.sip create mode 100644 sip/QtDesigner/qextensionmanager.sip create mode 100644 sip/QtDesigner/qpydesignercontainerextension.sip create mode 100644 sip/QtDesigner/qpydesignercustomwidgetcollectionplugin.sip create mode 100644 sip/QtDesigner/qpydesignercustomwidgetplugin.sip create mode 100644 sip/QtDesigner/qpydesignermembersheetextension.sip create mode 100644 sip/QtDesigner/qpydesignerpropertysheetextension.sip create mode 100644 sip/QtDesigner/qpydesignertaskmenuextension.sip create mode 100644 sip/QtDesigner/taskmenu.sip create mode 100644 sip/QtGui/QtGuimod.sip create mode 100644 sip/QtGui/opengl_types.sip create mode 100644 sip/QtGui/qabstractfileiconprovider.sip create mode 100644 sip/QtGui/qabstracttextdocumentlayout.sip create mode 100644 sip/QtGui/qaction.sip create mode 100644 sip/QtGui/qactiongroup.sip create mode 100644 sip/QtGui/qbackingstore.sip create mode 100644 sip/QtGui/qbitmap.sip create mode 100644 sip/QtGui/qbrush.sip create mode 100644 sip/QtGui/qclipboard.sip create mode 100644 sip/QtGui/qcolor.sip create mode 100644 sip/QtGui/qcolorspace.sip create mode 100644 sip/QtGui/qcolortransform.sip create mode 100644 sip/QtGui/qcursor.sip create mode 100644 sip/QtGui/qdesktopservices.sip create mode 100644 sip/QtGui/qdrag.sip create mode 100644 sip/QtGui/qevent.sip create mode 100644 sip/QtGui/qeventpoint.sip create mode 100644 sip/QtGui/qfilesystemmodel.sip create mode 100644 sip/QtGui/qfont.sip create mode 100644 sip/QtGui/qfontdatabase.sip create mode 100644 sip/QtGui/qfontinfo.sip create mode 100644 sip/QtGui/qfontmetrics.sip create mode 100644 sip/QtGui/qgenericmatrix.sip create mode 100644 sip/QtGui/qglyphrun.sip create mode 100644 sip/QtGui/qguiapplication.sip create mode 100644 sip/QtGui/qicon.sip create mode 100644 sip/QtGui/qiconengine.sip create mode 100644 sip/QtGui/qimage.sip create mode 100644 sip/QtGui/qimageiohandler.sip create mode 100644 sip/QtGui/qimagereader.sip create mode 100644 sip/QtGui/qimagewriter.sip create mode 100644 sip/QtGui/qinputdevice.sip create mode 100644 sip/QtGui/qinputmethod.sip create mode 100644 sip/QtGui/qkeysequence.sip create mode 100644 sip/QtGui/qmatrix4x4.sip create mode 100644 sip/QtGui/qmovie.sip create mode 100644 sip/QtGui/qoffscreensurface.sip create mode 100644 sip/QtGui/qopenglcontext.sip create mode 100644 sip/QtGui/qpagedpaintdevice.sip create mode 100644 sip/QtGui/qpagelayout.sip create mode 100644 sip/QtGui/qpageranges.sip create mode 100644 sip/QtGui/qpagesize.sip create mode 100644 sip/QtGui/qpaintdevice.sip create mode 100644 sip/QtGui/qpaintdevicewindow.sip create mode 100644 sip/QtGui/qpaintengine.sip create mode 100644 sip/QtGui/qpainter.sip create mode 100644 sip/QtGui/qpainterpath.sip create mode 100644 sip/QtGui/qpalette.sip create mode 100644 sip/QtGui/qpdfwriter.sip create mode 100644 sip/QtGui/qpen.sip create mode 100644 sip/QtGui/qpicture.sip create mode 100644 sip/QtGui/qpixelformat.sip create mode 100644 sip/QtGui/qpixmap.sip create mode 100644 sip/QtGui/qpixmapcache.sip create mode 100644 sip/QtGui/qpointingdevice.sip create mode 100644 sip/QtGui/qpolygon.sip create mode 100644 sip/QtGui/qpygui_qlist.sip create mode 100644 sip/QtGui/qquaternion.sip create mode 100644 sip/QtGui/qrasterwindow.sip create mode 100644 sip/QtGui/qrawfont.sip create mode 100644 sip/QtGui/qregion.sip create mode 100644 sip/QtGui/qrgb.sip create mode 100644 sip/QtGui/qrgba64.sip create mode 100644 sip/QtGui/qscreen.sip create mode 100644 sip/QtGui/qsessionmanager.sip create mode 100644 sip/QtGui/qshortcut.sip create mode 100644 sip/QtGui/qstandarditemmodel.sip create mode 100644 sip/QtGui/qstatictext.sip create mode 100644 sip/QtGui/qstylehints.sip create mode 100644 sip/QtGui/qsurface.sip create mode 100644 sip/QtGui/qsurfaceformat.sip create mode 100644 sip/QtGui/qsyntaxhighlighter.sip create mode 100644 sip/QtGui/qtextcursor.sip create mode 100644 sip/QtGui/qtextdocument.sip create mode 100644 sip/QtGui/qtextdocumentfragment.sip create mode 100644 sip/QtGui/qtextdocumentwriter.sip create mode 100644 sip/QtGui/qtextformat.sip create mode 100644 sip/QtGui/qtextlayout.sip create mode 100644 sip/QtGui/qtextlist.sip create mode 100644 sip/QtGui/qtextobject.sip create mode 100644 sip/QtGui/qtextoption.sip create mode 100644 sip/QtGui/qtexttable.sip create mode 100644 sip/QtGui/qtransform.sip create mode 100644 sip/QtGui/qundogroup.sip create mode 100644 sip/QtGui/qundostack.sip create mode 100644 sip/QtGui/qutimimeconverter.sip create mode 100644 sip/QtGui/qvalidator.sip create mode 100644 sip/QtGui/qvectornd.sip create mode 100644 sip/QtGui/qwindow.sip create mode 100644 sip/QtGui/qwindowdefs.sip create mode 100644 sip/QtHelp/QtHelpmod.sip create mode 100644 sip/QtHelp/qcompressedhelpinfo.sip create mode 100644 sip/QtHelp/qhelpcontentwidget.sip create mode 100644 sip/QtHelp/qhelpengine.sip create mode 100644 sip/QtHelp/qhelpenginecore.sip create mode 100644 sip/QtHelp/qhelpfilterdata.sip create mode 100644 sip/QtHelp/qhelpfilterengine.sip create mode 100644 sip/QtHelp/qhelpfiltersettingswidget.sip create mode 100644 sip/QtHelp/qhelpindexwidget.sip create mode 100644 sip/QtHelp/qhelplink.sip create mode 100644 sip/QtHelp/qhelpsearchengine.sip create mode 100644 sip/QtHelp/qhelpsearchquerywidget.sip create mode 100644 sip/QtHelp/qhelpsearchresultwidget.sip create mode 100644 sip/QtMultimedia/QtMultimediamod.sip create mode 100644 sip/QtMultimedia/qaudio.sip create mode 100644 sip/QtMultimedia/qaudiobuffer.sip create mode 100644 sip/QtMultimedia/qaudiodecoder.sip create mode 100644 sip/QtMultimedia/qaudiodevice.sip create mode 100644 sip/QtMultimedia/qaudioformat.sip create mode 100644 sip/QtMultimedia/qaudioinput.sip create mode 100644 sip/QtMultimedia/qaudiooutput.sip create mode 100644 sip/QtMultimedia/qaudiosink.sip create mode 100644 sip/QtMultimedia/qaudiosource.sip create mode 100644 sip/QtMultimedia/qcamera.sip create mode 100644 sip/QtMultimedia/qcameradevice.sip create mode 100644 sip/QtMultimedia/qimagecapture.sip create mode 100644 sip/QtMultimedia/qmediacapturesession.sip create mode 100644 sip/QtMultimedia/qmediadevices.sip create mode 100644 sip/QtMultimedia/qmediaformat.sip create mode 100644 sip/QtMultimedia/qmediametadata.sip create mode 100644 sip/QtMultimedia/qmediaplayer.sip create mode 100644 sip/QtMultimedia/qmediarecorder.sip create mode 100644 sip/QtMultimedia/qmediatimerange.sip create mode 100644 sip/QtMultimedia/qpymultimedia_qlist.sip create mode 100644 sip/QtMultimedia/qscreencapture.sip create mode 100644 sip/QtMultimedia/qsoundeffect.sip create mode 100644 sip/QtMultimedia/qvideoframe.sip create mode 100644 sip/QtMultimedia/qvideoframeformat.sip create mode 100644 sip/QtMultimedia/qvideosink.sip create mode 100644 sip/QtMultimediaWidgets/QtMultimediaWidgetsmod.sip create mode 100644 sip/QtMultimediaWidgets/qgraphicsvideoitem.sip create mode 100644 sip/QtMultimediaWidgets/qvideowidget.sip create mode 100644 sip/QtNetwork/QtNetworkmod.sip create mode 100644 sip/QtNetwork/qabstractnetworkcache.sip create mode 100644 sip/QtNetwork/qabstractsocket.sip create mode 100644 sip/QtNetwork/qauthenticator.sip create mode 100644 sip/QtNetwork/qdnslookup.sip create mode 100644 sip/QtNetwork/qhostaddress.sip create mode 100644 sip/QtNetwork/qhostinfo.sip create mode 100644 sip/QtNetwork/qhstspolicy.sip create mode 100644 sip/QtNetwork/qhttp1configuration.sip create mode 100644 sip/QtNetwork/qhttp2configuration.sip create mode 100644 sip/QtNetwork/qhttpmultipart.sip create mode 100644 sip/QtNetwork/qlocalserver.sip create mode 100644 sip/QtNetwork/qlocalsocket.sip create mode 100644 sip/QtNetwork/qnetworkaccessmanager.sip create mode 100644 sip/QtNetwork/qnetworkcookie.sip create mode 100644 sip/QtNetwork/qnetworkcookiejar.sip create mode 100644 sip/QtNetwork/qnetworkdatagram.sip create mode 100644 sip/QtNetwork/qnetworkdiskcache.sip create mode 100644 sip/QtNetwork/qnetworkinformation.sip create mode 100644 sip/QtNetwork/qnetworkinterface.sip create mode 100644 sip/QtNetwork/qnetworkproxy.sip create mode 100644 sip/QtNetwork/qnetworkreply.sip create mode 100644 sip/QtNetwork/qnetworkrequest.sip create mode 100644 sip/QtNetwork/qocspresponse.sip create mode 100644 sip/QtNetwork/qpassworddigestor.sip create mode 100644 sip/QtNetwork/qpynetwork_qhash.sip create mode 100644 sip/QtNetwork/qpynetwork_qlist.sip create mode 100644 sip/QtNetwork/qpynetwork_qmap.sip create mode 100644 sip/QtNetwork/qssl.sip create mode 100644 sip/QtNetwork/qsslcertificate.sip create mode 100644 sip/QtNetwork/qsslcertificateextension.sip create mode 100644 sip/QtNetwork/qsslcipher.sip create mode 100644 sip/QtNetwork/qsslconfiguration.sip create mode 100644 sip/QtNetwork/qssldiffiehellmanparameters.sip create mode 100644 sip/QtNetwork/qsslellipticcurve.sip create mode 100644 sip/QtNetwork/qsslerror.sip create mode 100644 sip/QtNetwork/qsslkey.sip create mode 100644 sip/QtNetwork/qsslpresharedkeyauthenticator.sip create mode 100644 sip/QtNetwork/qsslserver.sip create mode 100644 sip/QtNetwork/qsslsocket.sip create mode 100644 sip/QtNetwork/qtcpserver.sip create mode 100644 sip/QtNetwork/qtcpsocket.sip create mode 100644 sip/QtNetwork/qudpsocket.sip create mode 100644 sip/QtNfc/QtNfcmod.sip create mode 100644 sip/QtNfc/qndeffilter.sip create mode 100644 sip/QtNfc/qndefmessage.sip create mode 100644 sip/QtNfc/qndefnfcsmartposterrecord.sip create mode 100644 sip/QtNfc/qndefnfctextrecord.sip create mode 100644 sip/QtNfc/qndefnfcurirecord.sip create mode 100644 sip/QtNfc/qndefrecord.sip create mode 100644 sip/QtNfc/qnearfieldmanager.sip create mode 100644 sip/QtNfc/qnearfieldtarget.sip create mode 100644 sip/QtOpenGL/QtOpenGLmod.sip create mode 100644 sip/QtOpenGL/qopenglbuffer.sip create mode 100644 sip/QtOpenGL/qopengldebug.sip create mode 100644 sip/QtOpenGL/qopenglframebufferobject.sip create mode 100644 sip/QtOpenGL/qopenglfunctions_2_0.sip create mode 100644 sip/QtOpenGL/qopenglfunctions_2_1.sip create mode 100644 sip/QtOpenGL/qopenglfunctions_4_1_core.sip create mode 100644 sip/QtOpenGL/qopenglfunctions_es2.sip create mode 100644 sip/QtOpenGL/qopenglpaintdevice.sip create mode 100644 sip/QtOpenGL/qopenglpixeltransferoptions.sip create mode 100644 sip/QtOpenGL/qopenglshaderprogram.sip create mode 100644 sip/QtOpenGL/qopengltexture.sip create mode 100644 sip/QtOpenGL/qopengltextureblitter.sip create mode 100644 sip/QtOpenGL/qopengltimerquery.sip create mode 100644 sip/QtOpenGL/qopenglversionfunctions.sip create mode 100644 sip/QtOpenGL/qopenglversionfunctionsfactory.sip create mode 100644 sip/QtOpenGL/qopenglversionprofile.sip create mode 100644 sip/QtOpenGL/qopenglvertexarrayobject.sip create mode 100644 sip/QtOpenGL/qopenglwindow.sip create mode 100644 sip/QtOpenGL/qpyopengl_qlist.sip create mode 100644 sip/QtOpenGL/qpyopengl_std_pair.sip create mode 100644 sip/QtOpenGLWidgets/QtOpenGLWidgetsmod.sip create mode 100644 sip/QtOpenGLWidgets/qopenglwidget.sip create mode 100644 sip/QtPdf/QtPdfmod.sip create mode 100644 sip/QtPdf/qpdfbookmarkmodel.sip create mode 100644 sip/QtPdf/qpdfdocument.sip create mode 100644 sip/QtPdf/qpdfdocumentrenderoptions.sip create mode 100644 sip/QtPdf/qpdflink.sip create mode 100644 sip/QtPdf/qpdfpagenavigator.sip create mode 100644 sip/QtPdf/qpdfpagerenderer.sip create mode 100644 sip/QtPdf/qpdfsearchmodel.sip create mode 100644 sip/QtPdf/qpdfselection.sip create mode 100644 sip/QtPdfWidgets/QtPdfWidgetsmod.sip create mode 100644 sip/QtPdfWidgets/qpdfview.sip create mode 100644 sip/QtPositioning/QtPositioningmod.sip create mode 100644 sip/QtPositioning/qgeoaddress.sip create mode 100644 sip/QtPositioning/qgeoareamonitorinfo.sip create mode 100644 sip/QtPositioning/qgeoareamonitorsource.sip create mode 100644 sip/QtPositioning/qgeocircle.sip create mode 100644 sip/QtPositioning/qgeocoordinate.sip create mode 100644 sip/QtPositioning/qgeolocation.sip create mode 100644 sip/QtPositioning/qgeopath.sip create mode 100644 sip/QtPositioning/qgeopolygon.sip create mode 100644 sip/QtPositioning/qgeopositioninfo.sip create mode 100644 sip/QtPositioning/qgeopositioninfosource.sip create mode 100644 sip/QtPositioning/qgeorectangle.sip create mode 100644 sip/QtPositioning/qgeosatelliteinfo.sip create mode 100644 sip/QtPositioning/qgeosatelliteinfosource.sip create mode 100644 sip/QtPositioning/qgeoshape.sip create mode 100644 sip/QtPositioning/qnmeapositioninfosource.sip create mode 100644 sip/QtPositioning/qnmeasatelliteinfosource.sip create mode 100644 sip/QtPrintSupport/QtPrintSupportmod.sip create mode 100644 sip/QtPrintSupport/qabstractprintdialog.sip create mode 100644 sip/QtPrintSupport/qpagesetupdialog.sip create mode 100644 sip/QtPrintSupport/qprintdialog.sip create mode 100644 sip/QtPrintSupport/qprintengine.sip create mode 100644 sip/QtPrintSupport/qprinter.sip create mode 100644 sip/QtPrintSupport/qprinterinfo.sip create mode 100644 sip/QtPrintSupport/qprintpreviewdialog.sip create mode 100644 sip/QtPrintSupport/qprintpreviewwidget.sip create mode 100644 sip/QtPrintSupport/qpyprintsupport_qlist.sip create mode 100644 sip/QtQml/QtQmlmod.sip create mode 100644 sip/QtQml/qjsengine.sip create mode 100644 sip/QtQml/qjsmanagedvalue.sip create mode 100644 sip/QtQml/qjsprimitivevalue.sip create mode 100644 sip/QtQml/qjsvalue.sip create mode 100644 sip/QtQml/qjsvalueiterator.sip create mode 100644 sip/QtQml/qmlattachedpropertiesobject.sip create mode 100644 sip/QtQml/qmlregistertype.sip create mode 100644 sip/QtQml/qpyqmllistproperty.sip create mode 100644 sip/QtQml/qqml.sip create mode 100644 sip/QtQml/qqmlabstracturlinterceptor.sip create mode 100644 sip/QtQml/qqmlapplicationengine.sip create mode 100644 sip/QtQml/qqmlcomponent.sip create mode 100644 sip/QtQml/qqmlcontext.sip create mode 100644 sip/QtQml/qqmlengine.sip create mode 100644 sip/QtQml/qqmlerror.sip create mode 100644 sip/QtQml/qqmlexpression.sip create mode 100644 sip/QtQml/qqmlextensionplugin.sip create mode 100644 sip/QtQml/qqmlfileselector.sip create mode 100644 sip/QtQml/qqmlincubator.sip create mode 100644 sip/QtQml/qqmllist.sip create mode 100644 sip/QtQml/qqmlnetworkaccessmanagerfactory.sip create mode 100644 sip/QtQml/qqmlparserstatus.sip create mode 100644 sip/QtQml/qqmlproperty.sip create mode 100644 sip/QtQml/qqmlpropertymap.sip create mode 100644 sip/QtQml/qqmlpropertyvaluesource.sip create mode 100644 sip/QtQml/qqmlscriptstring.sip create mode 100644 sip/QtQuick/QtQuickmod.sip create mode 100644 sip/QtQuick/qquickframebufferobject.sip create mode 100644 sip/QtQuick/qquickgraphicsconfiguration.sip create mode 100644 sip/QtQuick/qquickgraphicsdevice.sip create mode 100644 sip/QtQuick/qquickimageprovider.sip create mode 100644 sip/QtQuick/qquickitem.sip create mode 100644 sip/QtQuick/qquickitemgrabresult.sip create mode 100644 sip/QtQuick/qquickpainteditem.sip create mode 100644 sip/QtQuick/qquickrendercontrol.sip create mode 100644 sip/QtQuick/qquickrendertarget.sip create mode 100644 sip/QtQuick/qquicktextdocument.sip create mode 100644 sip/QtQuick/qquickview.sip create mode 100644 sip/QtQuick/qquickwindow.sip create mode 100644 sip/QtQuick/qsgflatcolormaterial.sip create mode 100644 sip/QtQuick/qsggeometry.sip create mode 100644 sip/QtQuick/qsgimagenode.sip create mode 100644 sip/QtQuick/qsgmaterial.sip create mode 100644 sip/QtQuick/qsgmaterialshader.sip create mode 100644 sip/QtQuick/qsgmaterialtype.sip create mode 100644 sip/QtQuick/qsgnode.sip create mode 100644 sip/QtQuick/qsgrectanglenode.sip create mode 100644 sip/QtQuick/qsgrendererinterface.sip create mode 100644 sip/QtQuick/qsgrendernode.sip create mode 100644 sip/QtQuick/qsgsimplerectnode.sip create mode 100644 sip/QtQuick/qsgsimpletexturenode.sip create mode 100644 sip/QtQuick/qsgtexture.sip create mode 100644 sip/QtQuick/qsgtexture_platform.sip create mode 100644 sip/QtQuick/qsgtexturematerial.sip create mode 100644 sip/QtQuick/qsgtextureprovider.sip create mode 100644 sip/QtQuick/qsgvertexcolormaterial.sip create mode 100644 sip/QtQuick3D/QtQuick3Dmod.sip create mode 100644 sip/QtQuick3D/qquick3d.sip create mode 100644 sip/QtQuick3D/qquick3dgeometry.sip create mode 100644 sip/QtQuick3D/qquick3dobject.sip create mode 100644 sip/QtQuick3D/qquick3dtexturedata.sip create mode 100644 sip/QtQuickWidgets/QtQuickWidgetsmod.sip create mode 100644 sip/QtQuickWidgets/qquickwidget.sip create mode 100644 sip/QtRemoteObjects/QtRemoteObjectsmod.sip create mode 100644 sip/QtRemoteObjects/qremoteobjectabstractitemmodelreplica.sip create mode 100644 sip/QtRemoteObjects/qremoteobjectdynamicreplica.sip create mode 100644 sip/QtRemoteObjects/qremoteobjectnode.sip create mode 100644 sip/QtRemoteObjects/qremoteobjectregistry.sip create mode 100644 sip/QtRemoteObjects/qremoteobjectreplica.sip create mode 100644 sip/QtRemoteObjects/qtremoteobjectglobal.sip create mode 100644 sip/QtSensors/QtSensorsmod.sip create mode 100644 sip/QtSensors/qaccelerometer.sip create mode 100644 sip/QtSensors/qambientlightsensor.sip create mode 100644 sip/QtSensors/qambienttemperaturesensor.sip create mode 100644 sip/QtSensors/qcompass.sip create mode 100644 sip/QtSensors/qgyroscope.sip create mode 100644 sip/QtSensors/qhumiditysensor.sip create mode 100644 sip/QtSensors/qirproximitysensor.sip create mode 100644 sip/QtSensors/qlidsensor.sip create mode 100644 sip/QtSensors/qlightsensor.sip create mode 100644 sip/QtSensors/qmagnetometer.sip create mode 100644 sip/QtSensors/qorientationsensor.sip create mode 100644 sip/QtSensors/qpressuresensor.sip create mode 100644 sip/QtSensors/qproximitysensor.sip create mode 100644 sip/QtSensors/qrotationsensor.sip create mode 100644 sip/QtSensors/qsensor.sip create mode 100644 sip/QtSensors/qtapsensor.sip create mode 100644 sip/QtSensors/qtiltsensor.sip create mode 100644 sip/QtSerialPort/QtSerialPortmod.sip create mode 100644 sip/QtSerialPort/qserialport.sip create mode 100644 sip/QtSerialPort/qserialportinfo.sip create mode 100644 sip/QtSpatialAudio/QtSpatialAudiomod.sip create mode 100644 sip/QtSpatialAudio/qambientsound.sip create mode 100644 sip/QtSpatialAudio/qaudioengine.sip create mode 100644 sip/QtSpatialAudio/qaudiolistener.sip create mode 100644 sip/QtSpatialAudio/qaudioroom.sip create mode 100644 sip/QtSpatialAudio/qspatialsound.sip create mode 100644 sip/QtSql/QtSqlmod.sip create mode 100644 sip/QtSql/qsqldatabase.sip create mode 100644 sip/QtSql/qsqldriver.sip create mode 100644 sip/QtSql/qsqlerror.sip create mode 100644 sip/QtSql/qsqlfield.sip create mode 100644 sip/QtSql/qsqlindex.sip create mode 100644 sip/QtSql/qsqlquery.sip create mode 100644 sip/QtSql/qsqlquerymodel.sip create mode 100644 sip/QtSql/qsqlrecord.sip create mode 100644 sip/QtSql/qsqlrelationaldelegate.sip create mode 100644 sip/QtSql/qsqlrelationaltablemodel.sip create mode 100644 sip/QtSql/qsqlresult.sip create mode 100644 sip/QtSql/qsqltablemodel.sip create mode 100644 sip/QtSql/qtsqlglobal.sip create mode 100644 sip/QtSvg/QtSvgmod.sip create mode 100644 sip/QtSvg/qsvggenerator.sip create mode 100644 sip/QtSvg/qsvgrenderer.sip create mode 100644 sip/QtSvgWidgets/QtSvgWidgetsmod.sip create mode 100644 sip/QtSvgWidgets/qgraphicssvgitem.sip create mode 100644 sip/QtSvgWidgets/qsvgwidget.sip create mode 100644 sip/QtTest/QtTestmod.sip create mode 100644 sip/QtTest/qabstractitemmodeltester.sip create mode 100644 sip/QtTest/qsignalspy.sip create mode 100644 sip/QtTest/qtestkeyboard.sip create mode 100644 sip/QtTest/qtestmouse.sip create mode 100644 sip/QtTest/qtestsystem.sip create mode 100644 sip/QtTextToSpeech/QtTextToSpeechmod.sip create mode 100644 sip/QtTextToSpeech/qtexttospeech.sip create mode 100644 sip/QtTextToSpeech/qvoice.sip create mode 100644 sip/QtWebChannel/QtWebChannelmod.sip create mode 100644 sip/QtWebChannel/qwebchannel.sip create mode 100644 sip/QtWebChannel/qwebchannelabstracttransport.sip create mode 100644 sip/QtWebSockets/QtWebSocketsmod.sip create mode 100644 sip/QtWebSockets/qmaskgenerator.sip create mode 100644 sip/QtWebSockets/qwebsocket.sip create mode 100644 sip/QtWebSockets/qwebsocketcorsauthenticator.sip create mode 100644 sip/QtWebSockets/qwebsockethandshakeoptions.sip create mode 100644 sip/QtWebSockets/qwebsocketprotocol.sip create mode 100644 sip/QtWebSockets/qwebsocketserver.sip create mode 100644 sip/QtWidgets/QtWidgetsmod.sip create mode 100644 sip/QtWidgets/qabstractbutton.sip create mode 100644 sip/QtWidgets/qabstractitemdelegate.sip create mode 100644 sip/QtWidgets/qabstractitemview.sip create mode 100644 sip/QtWidgets/qabstractscrollarea.sip create mode 100644 sip/QtWidgets/qabstractslider.sip create mode 100644 sip/QtWidgets/qabstractspinbox.sip create mode 100644 sip/QtWidgets/qapplication.sip create mode 100644 sip/QtWidgets/qboxlayout.sip create mode 100644 sip/QtWidgets/qbuttongroup.sip create mode 100644 sip/QtWidgets/qcalendarwidget.sip create mode 100644 sip/QtWidgets/qcheckbox.sip create mode 100644 sip/QtWidgets/qcolordialog.sip create mode 100644 sip/QtWidgets/qcolumnview.sip create mode 100644 sip/QtWidgets/qcombobox.sip create mode 100644 sip/QtWidgets/qcommandlinkbutton.sip create mode 100644 sip/QtWidgets/qcommonstyle.sip create mode 100644 sip/QtWidgets/qcompleter.sip create mode 100644 sip/QtWidgets/qdatawidgetmapper.sip create mode 100644 sip/QtWidgets/qdatetimeedit.sip create mode 100644 sip/QtWidgets/qdial.sip create mode 100644 sip/QtWidgets/qdialog.sip create mode 100644 sip/QtWidgets/qdialogbuttonbox.sip create mode 100644 sip/QtWidgets/qdockwidget.sip create mode 100644 sip/QtWidgets/qdrawutil.sip create mode 100644 sip/QtWidgets/qerrormessage.sip create mode 100644 sip/QtWidgets/qfiledialog.sip create mode 100644 sip/QtWidgets/qfileiconprovider.sip create mode 100644 sip/QtWidgets/qfilesystemmodel.sip create mode 100644 sip/QtWidgets/qfocusframe.sip create mode 100644 sip/QtWidgets/qfontcombobox.sip create mode 100644 sip/QtWidgets/qfontdialog.sip create mode 100644 sip/QtWidgets/qformlayout.sip create mode 100644 sip/QtWidgets/qframe.sip create mode 100644 sip/QtWidgets/qgesture.sip create mode 100644 sip/QtWidgets/qgesturerecognizer.sip create mode 100644 sip/QtWidgets/qgraphicsanchorlayout.sip create mode 100644 sip/QtWidgets/qgraphicseffect.sip create mode 100644 sip/QtWidgets/qgraphicsgridlayout.sip create mode 100644 sip/QtWidgets/qgraphicsitem.sip create mode 100644 sip/QtWidgets/qgraphicslayout.sip create mode 100644 sip/QtWidgets/qgraphicslayoutitem.sip create mode 100644 sip/QtWidgets/qgraphicslinearlayout.sip create mode 100644 sip/QtWidgets/qgraphicsproxywidget.sip create mode 100644 sip/QtWidgets/qgraphicsscene.sip create mode 100644 sip/QtWidgets/qgraphicssceneevent.sip create mode 100644 sip/QtWidgets/qgraphicstransform.sip create mode 100644 sip/QtWidgets/qgraphicsview.sip create mode 100644 sip/QtWidgets/qgraphicswidget.sip create mode 100644 sip/QtWidgets/qgridlayout.sip create mode 100644 sip/QtWidgets/qgroupbox.sip create mode 100644 sip/QtWidgets/qheaderview.sip create mode 100644 sip/QtWidgets/qinputdialog.sip create mode 100644 sip/QtWidgets/qitemdelegate.sip create mode 100644 sip/QtWidgets/qitemeditorfactory.sip create mode 100644 sip/QtWidgets/qkeysequenceedit.sip create mode 100644 sip/QtWidgets/qlabel.sip create mode 100644 sip/QtWidgets/qlayout.sip create mode 100644 sip/QtWidgets/qlayoutitem.sip create mode 100644 sip/QtWidgets/qlcdnumber.sip create mode 100644 sip/QtWidgets/qlineedit.sip create mode 100644 sip/QtWidgets/qlistview.sip create mode 100644 sip/QtWidgets/qlistwidget.sip create mode 100644 sip/QtWidgets/qmainwindow.sip create mode 100644 sip/QtWidgets/qmdiarea.sip create mode 100644 sip/QtWidgets/qmdisubwindow.sip create mode 100644 sip/QtWidgets/qmenu.sip create mode 100644 sip/QtWidgets/qmenubar.sip create mode 100644 sip/QtWidgets/qmessagebox.sip create mode 100644 sip/QtWidgets/qplaintextedit.sip create mode 100644 sip/QtWidgets/qprogressbar.sip create mode 100644 sip/QtWidgets/qprogressdialog.sip create mode 100644 sip/QtWidgets/qproxystyle.sip create mode 100644 sip/QtWidgets/qpushbutton.sip create mode 100644 sip/QtWidgets/qpywidgets_qlist.sip create mode 100644 sip/QtWidgets/qradiobutton.sip create mode 100644 sip/QtWidgets/qrubberband.sip create mode 100644 sip/QtWidgets/qscrollarea.sip create mode 100644 sip/QtWidgets/qscrollbar.sip create mode 100644 sip/QtWidgets/qscroller.sip create mode 100644 sip/QtWidgets/qscrollerproperties.sip create mode 100644 sip/QtWidgets/qsizegrip.sip create mode 100644 sip/QtWidgets/qsizepolicy.sip create mode 100644 sip/QtWidgets/qslider.sip create mode 100644 sip/QtWidgets/qspinbox.sip create mode 100644 sip/QtWidgets/qsplashscreen.sip create mode 100644 sip/QtWidgets/qsplitter.sip create mode 100644 sip/QtWidgets/qstackedlayout.sip create mode 100644 sip/QtWidgets/qstackedwidget.sip create mode 100644 sip/QtWidgets/qstatusbar.sip create mode 100644 sip/QtWidgets/qstyle.sip create mode 100644 sip/QtWidgets/qstyleditemdelegate.sip create mode 100644 sip/QtWidgets/qstylefactory.sip create mode 100644 sip/QtWidgets/qstyleoption.sip create mode 100644 sip/QtWidgets/qstylepainter.sip create mode 100644 sip/QtWidgets/qsystemtrayicon.sip create mode 100644 sip/QtWidgets/qtabbar.sip create mode 100644 sip/QtWidgets/qtableview.sip create mode 100644 sip/QtWidgets/qtablewidget.sip create mode 100644 sip/QtWidgets/qtabwidget.sip create mode 100644 sip/QtWidgets/qtextbrowser.sip create mode 100644 sip/QtWidgets/qtextedit.sip create mode 100644 sip/QtWidgets/qtoolbar.sip create mode 100644 sip/QtWidgets/qtoolbox.sip create mode 100644 sip/QtWidgets/qtoolbutton.sip create mode 100644 sip/QtWidgets/qtooltip.sip create mode 100644 sip/QtWidgets/qtreeview.sip create mode 100644 sip/QtWidgets/qtreewidget.sip create mode 100644 sip/QtWidgets/qtreewidgetitemiterator.sip create mode 100644 sip/QtWidgets/qundoview.sip create mode 100644 sip/QtWidgets/qwhatsthis.sip create mode 100644 sip/QtWidgets/qwidget.sip create mode 100644 sip/QtWidgets/qwidgetaction.sip create mode 100644 sip/QtWidgets/qwizard.sip create mode 100644 sip/QtXml/QtXmlmod.sip create mode 100644 sip/QtXml/qdom.sip create mode 100644 sip/pyqt-gpl.sip create mode 100644 uic/Compiler/__init__.py create mode 100644 uic/Compiler/as_string.py create mode 100644 uic/Compiler/compiler.py create mode 100644 uic/Compiler/indenter.py create mode 100644 uic/Compiler/misc.py create mode 100644 uic/Compiler/proxy_metaclass.py create mode 100644 uic/Compiler/qobjectcreator.py create mode 100644 uic/Compiler/qtproxies.py create mode 100644 uic/Loader/__init__.py create mode 100644 uic/Loader/loader.py create mode 100644 uic/Loader/qobjectcreator.py create mode 100644 uic/__init__.py create mode 100644 uic/compile_ui.py create mode 100644 uic/enum_map.py create mode 100644 uic/exceptions.py create mode 100644 uic/icon_cache.py create mode 100644 uic/load_ui.py create mode 100644 uic/objcreator.py create mode 100644 uic/properties.py create mode 100644 uic/pyuic.py create mode 100644 uic/ui_file.py create mode 100644 uic/uiparser.py create mode 100644 uic/widget-plugins/qaxcontainer.py create mode 100644 uic/widget-plugins/qscintilla.py create mode 100644 uic/widget-plugins/qtcharts.py create mode 100644 uic/widget-plugins/qtprintsupport.py create mode 100644 uic/widget-plugins/qtquickwidgets.py create mode 100644 uic/widget-plugins/qtwebenginewidgets.py diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..12bfb45 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,3890 @@ +2023-07-22 Phil Thompson + + * NEWS, extras/lupdate/python_source.py: + Fixed an exception in pylupdate. + [38c17a29338d] [6.5.2] <6.5-maint> + +2023-07-21 Phil Thompson + + * NEWS, qpy/QtCore/qstring.sip: + Fixed a regression in using None as a QString. + [6089948fc034] <6.5-maint> + +2023-07-15 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the type hints for all ellipsis arguments. + [dc5cc8a6f07d] <6.5-maint> + +2023-07-14 Phil Thompson + + * qpy/QtCore/qstring.sip: + Further fix fro QString's type hint. + [5c0f11c46cb1] <6.5-maint> + + * NEWS, qpy/QtCore/qstring.sip: + Fixed the type hint for QString. + [2857fd3946c7] <6.5-maint> + +2023-07-12 Phil Thompson + + * PyQt6.msp: + Another type hint fix for QObject.findChild(). + [dd57f73873eb] <6.5-maint> + + * PyQt6.msp: + Fixed the type hints fro QObject.findChild() and + QObject.findChildren(). + [b088d75e77d6] <6.5-maint> + +2023-07-09 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed PYQT_SLOT for the QtCore module. + [f5cb0b97d94e] <6.5-maint> + +2023-07-05 Phil Thompson + + * extras/lupdate/python_source.py: + pylupdate will now look for tr() and translate() as a function as + well as a method. + [a0230e25929a] <6.5-maint> + + * PyQt6.msp: + Fixed the type hint for pyqtSlot(). + [b8e51995b3c5] <6.5-maint> + + * PyQt6.msp: + Fixed the type hint for PYQT_SLOT. + [8c73a0c3dd1f] <6.5-maint> + + * NEWS, PyQt6.msp, qpy/QtCore/qbytearrayview.sip: + Fixed the type hints for QByteArray and QByteArrayView. + [f631f8e6cc3e] <6.5-maint> + +2023-06-08 Phil Thompson + + * NEWS, PyQt6.msp, project.py: + Added the missing QEvent.Type.EnterEditFocus and + QEvent.Type.LeaveEditFocus enum members. + [a8d9583f33d9] <6.5-maint> + + * NEWS, PyQt6.msp: + Added the missing QEvent.Type.NativeGesture and QEvent.Type.Quit + enum members. + [ebd0738bb268] <6.5-maint> + +2023-06-04 Phil Thompson + + * NEWS: + Updated the NEWS file. + [6590e301a19c] <6.5-maint> + + * config-tests/cfgtest_QtCore.cpp: + Fixed building against Qt older than v6.5. + [4860e1d699d4] <6.5-maint> + +2023-06-02 Phil Thompson + + * .hgtags: + Added tag 6.5.1 for changeset 443f350df939 + [9d6e72a95cae] <6.5-maint> + +2023-05-26 Phil Thompson + + * NEWS, qpy/QtCore/qpycore_pyqtboundsignal.cpp: + Fixed a regression that broke pyqtSlot arguments that where + typedefs. + [443f350df939] [6.5.1] <6.5-maint> + +2023-05-25 Phil Thompson + + * NEWS, project.py: + Ensure the permission plugins are built in. + [dea56beea30d] <6.5-maint> + +2023-05-23 Phil Thompson + + * PyQt6.msp: + Fixed the conversion of QPermission. + [ba763ef07730] <6.5-maint> + +2023-05-22 Phil Thompson + + * PyQt6.msp, config-tests/cfgtest_QtCore.cpp: + Fixed build issues with the permissions support. + [04c3b8f59a6c] <6.5-maint> + + * NEWS, PyQt6.msp, config-tests/cfgtest_QtCore.cpp: + Added support for QPermission et al. + [f673353b1366] <6.5-maint> + +2023-04-24 Phil Thompson + + * extras/uic/pyuic.py: + pyuic6 doesn't, for consistency reasons, recurse when compiling a + directory. + [7f0f1196edd6] <6.5-maint> + + * NEWS, extras/uic/compile_ui.py, extras/uic/pyuic.py: + compileUiDir() can now compile muliple .ui files in parallel. pyuic6 + can now compile a directory contents. + [09ca845e4626] <6.5-maint> + +2023-04-05 Phil Thompson + + * .hgtags: + Added tag 6.5.0 for changeset db2b0386d4f1 + [a2256de71810] + + * NEWS, qpy/QtCore/qpycore_chimera.cpp: + Fixed a regression in the handling of QFlags as signal arguments. + [db2b0386d4f1] [6.5.0] + +2023-04-04 Phil Thompson + + * NEWS, PyQt6.msp, project.py, pyproject.toml: + Added the QtSpatialAudio module. + [077c776029a6] + +2023-04-03 Phil Thompson + + * NEWS, PyQt6.msp: + Updated for Qt v6.5.0. + [729660e6fc61] + +2023-03-31 Phil Thompson + + * PyQt6.msp: + Updated QtWidgets for Qt v6.5.0rc. + [626287dd0ed1] + + * NEWS, PyQt6.msp: + Updated QtRemoteObjects, QtSensors, QtSql, QtSvg, QtSvgWidgets, + QtTest, QtTextToSpeech, QtWebChannel, QtWebSockets and QtXml for Qt + v6.5.0rc. + [161ffed7ef69] + +2023-03-30 Phil Thompson + + * PyQt6.msp: + Updated QtQml, QtQuick, QtQuick3D and QtQuickWidgets for Qt + v6.5.0rc. + [8ae811bd2c98] + + * NEWS, PyQt6.msp: + Updated QtNetwork, QtNfc, QtOpenGL, QtOpenGLWidgets, QtPdf, + QtPdfWidgets, QtPoitioning and QtPrintSupport for Qt v6.5.0rc. + [b4b6ff5dc2d6] + + * PyQt6.msp, mksccode/QtMultimedia.versions: + Updated the sub-class convertor code for QtMultimedia. + [5fbc985e8383] + + * PyQt6.msp, qpy/QtCore/qpycore_qlist.sip: + Updated QtDBus, QtDesigner, QtGui, QtHelp, QtMultimedia and + QtMultimediaWidgets for Qt v6.5.0rc. + [a721ab062d44] + +2023-03-29 Phil Thompson + + * NEWS, PyQt6.msp: + Updated QtBluetooth and QtCore for Qt v6.5.0rc. + [8f2a4645ecca] + + * Merged the 6.4-maint branch. + [43d0515da1a2] + +2023-03-25 Phil Thompson + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h: + Ensure Qt property getters and setters handle user-defined enums + properly. Note that Designer still requires enums to be registered. + [1765171f142d] <6.4-maint> + + * NEWS, PyQt6.msp: + Improved the error checking when writing an enum property. + [8432953b3600] <6.4-maint> + +2023-03-24 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed QMetaProperty.write() to handle values of unregistered enums. + [2064a87dba00] <6.4-maint> + +2023-03-19 Phil Thompson + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h: + Further improvements to reading user-defined Enum properties. + [be6f382a1f57] <6.4-maint> + + * NEWS, qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h, + qpy/QtCore/qpycore_enums_flags.cpp, qpy/QtCore/qpycore_types.cpp, + test/metaobject/test_pyqtproperty.py: + Fixed QMetaProperty.read() for user-defined enums. + [9ef37f530e08] <6.4-maint> + +2023-03-08 Phil Thompson + + * NEWS, qpy/QtCore/qpycore_pyqtboundsignal.cpp: + When comparing types of a decorated slot, use the name of the C++ + type rather rather than the meta-type (which may have changed). + [9d77aaabfdff] <6.4-maint> + +2023-02-02 Phil Thompson + + * .hgtags: + Added tag 6.4.2 for changeset 0cf0f5deb862 + [6008d812dbde] <6.4-maint> + +2023-01-28 Phil Thompson + + * NEWS, extras/lupdate/lupdate.py: + Fixed a regression in pylupdate. + [0cf0f5deb862] [6.4.2] <6.4-maint> + +2023-01-27 Phil Thompson + + * .hgtags: + Added tag 6.4.1 for changeset f633ac74eeef + [ffbaf766f709] <6.4-maint> + + * NEWS, qpy/QtCore/qpycore_qt_conf.cpp: + Fixed the embedded qt.conf on Windows where there are non-ASCII + characters in the pathname of the installation directory. + [f633ac74eeef] [6.4.1] <6.4-maint> + +2023-01-22 Phil Thompson + + * qpy/QtCore/qpycore_qvariant_value.cpp: + Fixed the implementation of QSettings.value() for a list of strings. + [a4b3ad49321b] <6.4-maint> + + * NEWS, PyQt6.msp: + Fixed the base types of the QPdfBookmarkModel.Role and + QPdfSearchModel.Role enums. + [78cd78751823] <6.4-maint> + +2023-01-15 Phil Thompson + + * PyQt6.msp: + More Windows build fixes. + [557383d31eef] <6.4-maint> + + * NEWS, PyQt6.msp: + Fixed build errors on Windows. + [2c160e7075fb] <6.4-maint> + +2023-01-13 Phil Thompson + + * PyQt6.msp: + Fixed the base type of the QPdfDocument.PageModelRole enum. + [c31b80437d87] <6.4-maint> + + * extras/uic/Compiler/compiler.py, + extras/uic/Compiler/qobjectcreator.py, + extras/uic/Compiler/qtproxies.py, extras/uic/Loader/loader.py, + extras/uic/Loader/qobjectcreator.py, extras/uic/icon_cache.py, + extras/uic/objcreator.py, extras/uic/properties.py, + extras/uic/uiparser.py: + Refactored pyuic so that parent objects are specified as keyword + arguments when possible so that custom widgets can have additional, + preceding optional arguments. + [5e44e8a15f2a] <6.4-maint> + + * NEWS, pyproject.toml, qpy/QtCore/qpycore_chimera.cpp: + Backout the removal of support for unregistered enums as we still + have to support protected enums and classes without a QMetaObject. + [77ec5687a5fc] <6.4-maint> + +2023-01-12 Phil Thompson + + * NEWS, pyproject.toml, qpy/QtCore/qpycore_chimera.cpp: + Require SIP v6.7.6 so that all enums are registered with Qt. + Simplify the enum support when converting types now that all will be + registered. + [79807338ba98] <6.4-maint> + +2023-01-11 Phil Thompson + + * NEWS, qpy/QtCore/qpycore_chimera.cpp: + Fixed regressions related to the handling of global enums in + connections. + [4f773319fd9a] <6.4-maint> + +2022-12-14 Phil Thompson + + * NEWS, qpy/QtCore/qpycore_chimera.cpp: + Fixed the handling of Qt properties when the type was a Python enum. + [255ebf0c8996] <6.4-maint> + +2022-12-04 Phil Thompson + + * NEWS, PyQt6.msp: + Added toHBITMAP(), fromHBITMAP(), toHICON() and fromHICON() to + QImage. + [1a471b580467] <6.4-maint> + +2022-10-28 Phil Thompson + + * extras/lupdate/lupdate.py: + plupdate will now properly exclude subdirectories. + [ccf01ff6a08e] <6.4-maint> + + * extras/lupdate/lupdate.py: + pylupdate will ignore hidden files and directories when reading a + directory. + [301190b67f05] <6.4-maint> + + * NEWS, extras/uic/compile_ui.py: + Fixed uic.compileUiDir() when the default system encoding is not + UTF8. + [9d65afef0172] <6.4-maint> + +2022-10-10 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed QBoxLayout.insertItem() ownership bug. + [ed33831448da] <6.4-maint> + +2022-10-03 Phil Thompson + + * NEWS, PyQt6.msp: + Added allocationLimit() and setAllocationLimit() to QImageReader. + [aec5200df9d5] <6.4-maint> + +2022-09-30 Phil Thompson + + * .hgtags: + Added tag 6.4.0 for changeset 72aaf7b1fea2 + [e028d20626d7] + + * NEWS, PyQt6.msp: + Updated for Qt v6.4.0. + [72aaf7b1fea2] [6.4.0] + +2022-09-24 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the base type of the QTextDocument.ResourceType enum. + [97cfbe3484d8] + +2022-09-21 Phil Thompson + + * NEWS, PyQt6.msp: + Added a missing enum annotation. + [333d7ba4f471] + +2022-09-20 Phil Thompson + + * NEWS, PyQt6.msp, project.py: + Added the QtPdfWidgets module. + [04542ff1a3b4] + + * NEWS, PyQt6.msp, project.py: + Added the QtPdf module. + [8520491f7511] + + * PyQt6.msp: + Updated the rest of the modules fro Qt v6.4.0rc. + [b3a74e3fcad6] + + * PyQt6.msp: + Updated QtOpenGL, QtOpenGLWidgets, QtPositioning and QtPrintSupport + for Qt v6.4.0rc. + [2e5315bc05d2] + + * PyQt6.msp, mksccode/QtNetwork.versions: + Updated QtNetwork and QtNfc for Qt v6.4.0rc. + [c625c73c833a] + + * PyQt6.msp: + Updated QtMultimedia and QtMultimediaWidgets for Qt v6.4.0rc. + [7343cfb4cce7] + + * PyQt6.msp: + Updated QtBluetooth, QtDBus, QtDesigner, QtHelp and QtXML for Qt + v6.4.0rc. + [50664878b4ff] + + * NEWS, PyQt6.msp: + Updated QtWidgets for Qt v6.4.0rc. + [b44e64308188] + +2022-09-19 Phil Thompson + + * PyQt6.msp: + Updated QtGui for Qt v6.4.0rc. + [aae1f9b46109] + + * NEWS, PyQt6.msp, qpy/QtCore/qanystringview.sip: + Updated QtCore for Qt v6.4.0rc. + [0532498dffc2] + +2022-09-18 Phil Thompson + + * NEWS: + Updated the NEWS file. + [dcf4f7a92812] + + * Merged the 6.3-maint branch. + [7a20935c2832] + +2022-09-17 Phil Thompson + + * NEWS, qpy/QtCore/qpycore_qobject_helpers.cpp: + Fixed calling QObject::inherits() from C++ on instances that were + created by Python (and so was an instance of a generated derived + class), had it's ownership transfered to C++ and the Python object + garbage collected. This broke all sub-class converter code. + [5f7909b6c1e3] <6.3-maint> + +2022-09-15 Phil Thompson + + * NEWS, test/pyuic/QWidget/Widget03.ui: + Fixed an incorrect test that breaks on Python v3.11. + [bbfa52dc5e6f] <6.3-maint> + +2022-08-16 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the base type of FocusPolicy. + [0215c2d5adbf] <6.3-maint> + +2022-07-24 Phil Thompson + + * misc/pyqt-commercial.sip: + Backed out changeset d3417110f23a as we can now fix universal wheels + on Linux. + [c6e64811b96a] <6.3-maint> + +2022-07-19 Phil Thompson + + * NEWS, PyQt6.msp, qpy/QtWidgets/qpywidgets_post_init.cpp, + qpy/QtWidgets/qpywidgets_qaction_helpers.cpp, + qpy/QtWidgets/qpywidgets_qaction_helpers.h: + Added QAction.menu() and QAction.setMenu(). + [b8ba8efcf473] <6.3-maint> + + * NEWS, extras/lupdate/translation_file.py: + Fixed pylupdate when restoring vanished messages. + [8969d2e77bff] <6.3-maint> + +2022-07-16 Phil Thompson + + * misc/pyqt-commercial.sip: + Fixed the license check in commercial wheels for macOS. + [d3417110f23a] <6.3-maint> + +2022-06-30 Phil Thompson + + * NEWS, extras/uic/enum_map.py: + Fixed pyuic's handling of Qt.ShortcutContext. + [6b3e1d8bc7ec] <6.3-maint> + +2022-06-25 Phil Thompson + + * NEWS, PyQt6.msp, config-tests/cfgtest_QtNetwork.cpp: + Fixed building against Qt installations with SSL support but no DTLS + support. + [613ea495ccce] <6.3-maint> + +2022-06-22 Phil Thompson + + * NEWS, qpy/QtCore/qpycore_chimera.cpp: + Fixed the handling of enums when they haven't been registered with + Qt's meta-type system. + [3e79aeb5464d] <6.3-maint> + +2022-06-17 Phil Thompson + + * .hgtags: + Added tag 6.3.1 for changeset 247d2c1d453c + [e666010cdfc4] <6.3-maint> + + * NEWS, qpy/QtCore/qpycore_chimera.cpp, + qpy/QtCore/qpycore_chimera_storage.cpp: + Fixed issues when emitting signals with enum arguments. + [247d2c1d453c] [6.3.1] <6.3-maint> + +2022-06-15 Phil Thompson + + * NEWS, PyQt6.msp: + Added qRegisterResourceData() and qUnregisterResourceData. + [4302c2940491] <6.3-maint> + +2022-06-06 Phil Thompson + + * NEWS, PyQt6.msp: + Reordered QPainter methods so that QPolygon[F] are not handled as + sequences. + [eeab18cf3dc2] <6.3-maint> + +2022-06-05 Phil Thompson + + * NEWS, qpy/QtCore/qpycore_chimera.cpp: + Fixed the handling of char* slot arguments. + [d367df954b70] <6.3-maint> + +2022-05-20 Phil Thompson + + * NEWS, PyQt6.msp: + Refactored the QPainter draw methods to exploit sip.array objects. + [c6715cccc537] <6.3-maint> + +2022-05-17 Phil Thompson + + * NEWS: + Updated the NEWS file for sip.array. + [1adefd1499a6] <6.3-maint> + +2022-05-15 Phil Thompson + + * NEWS, PyQt6.msp, project.py: + v13.4 of the sip ABI is now required (for the missing enum member + support). Reverted the support for using an int instead of a + Qt.GestureType. Deprecated (rather than removed) the QEvent ctor + that takes an int argument. + [d2ec9265d699] <6.3-maint> + +2022-05-01 Phil Thompson + + * NEWS, PyQt6.msp: + Fixes for building against a debug version of Python. + [94918729af61] <6.3-maint> + +2022-04-19 Phil Thompson + + * NEWS, PyQt6.msp: + Added resize() to QPolygon, QPolygonF and QXmlStreamAttributes. + [b6869cdce5ce] <6.3-maint> + +2022-04-12 Phil Thompson + + * .hgtags: + Added tag 6.3.0 for changeset 373bc2a6447e + [22bcfae615cd] + +2022-04-01 Phil Thompson + + * PyQt6.msp: + Fixes for when building without protected being public. + [373bc2a6447e] [6.3.0] + + * NEWS, project.py, qpy/QtCore/qpycore_post_init.cpp, + qpy/QtCore/qpycore_post_init.cpp.in: + Removed some legacy SIP v4 support. + [184d70406908] + +2022-03-31 Phil Thompson + + * PyQt6.msp: + Updated the remaining modules for Qt v6.3.0rc. + [1c4354d61062] + + * PyQt6.msp: + Updated QtHelp, QtMultimedia, QtMultimediaWidgets and QtNetwork for + Qt v6.3.0rc. + [0566b82df55b] + + * PyQt6.msp, qpy/QtBluetooth/qpybluetooth_qmultihash.sip: + Updated QtBluetooth, QtDBus, QtDesigner and QtGui for Qt v6.3.0rc. + [cd140f0de691] + + * NEWS, PyQt6.msp: + Updated QtCore for Qt v6.3.0rc. + [a87a5ea93c97] + +2022-03-28 Phil Thompson + + * NEWS: + Merged the 6.2-maint branch. + [962af9bda6d0] + +2022-03-18 Phil Thompson + + * NEWS, qpy/QtCore/qpycore_pyqtslot.cpp: + Keep a strong reference to methods when they are used as slots. + [d70742ec07e0] <6.2-maint> + +2022-02-26 Phil Thompson + + * NEWS, qpy/QtQml/qpyqml_listdata.cpp: + Fixed a bug in the tidying up of QQmlListProperty. + [3ce5cad6fbfe] <6.2-maint> + +2022-02-01 Phil Thompson + + * .hgtags: + Added tag 6.2.3 for changeset bf840012bc47 + [76ccb7cf3d45] <6.2-maint> + + * qpy/QtCore/qpycore_pyqtpyobject.cpp, + qpy/QtCore/qpycore_pyqtpyobject.h: + Explicitly support comparisons of Python objects wrapped in a + QVariant. + [bf840012bc47] [6.2.3] <6.2-maint> + + * PyQt6.msp: + Release the GIL when calling the QThreadPool dtor. + [1e096bc898df] <6.2-maint> + + * NEWS, PyQt6.msp: + Fixed the QLocale.FloatingPointPrecisionOption enum. + [76db78226e19] <6.2-maint> + +2022-01-25 Phil Thompson + + * NEWS, PyQt6.msp: + Removed a couple of undocumented operators introduced in Qt v6.2. + [f07068587ea8] <6.2-maint> + +2022-01-24 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the QFont.Stretch enum. + [28de6ce508ce] <6.2-maint> + +2022-01-10 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the usage of Qt.GestureType to account for Qt returning custom + values. + [2d2edf8288be] <6.2-maint> + +2022-01-07 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the QSizePolicy.PolicyFlag enum. However currently it can only + be used in combinations represented by the Policy enum. + [1b9d11f650ad] <6.2-maint> + +2022-01-04 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the QTableWidgetItem.ItemType enum. + [5d1e04945454] <6.2-maint> + +2021-12-11 Phil Thompson + + * NEWS, qpy/QtNetwork/qpynetwork_qmap.sip: + Fixed the handling of the result of + QSslCertificate.subjectAlternativeNames(). + [31743f3a2aec] <6.2-maint> + +2021-12-01 Phil Thompson + + * .hgtags: + Added tag 6.2.2 for changeset dd1923cdf995 + [4f95f58edfec] <6.2-maint> + + * NEWS, PyQt6.msp: + Added the missing QMediaPlayer loop-related methods. + [dd1923cdf995] [6.2.2] <6.2-maint> + +2021-11-29 Phil Thompson + + * PyQt6.msp: + Fixed the toString(), toDisplayString() and toEncoded() methods of + QUrl to accept QUrl.ComponentFormattingOptions flags. + [94ac53ce9297] <6.2-maint> + + * NEWS, PyQt6.msp: + Use a dedicated QEventLoop in the event hook as Qt6 seems to hide + windows when the main event loop exits. + [0b618767ac61] <6.2-maint> + +2021-11-24 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the QListWidgetItem.ItemType and QTreeWidgetItem.ItemType + enums. + [fc30342b6025] <6.2-maint> + +2021-11-22 Phil Thompson + + * NEWS, PyQt6.msp: + Added /Constrained/ to the QVariant serialiser so that it doesn't + act as a catchall and bypass all subsequent serialisers (including + slot extenders). + [ce7d2be67940] <6.2-maint> + +2021-11-21 Phil Thompson + + * project.py: + Update the minimum ABI version of the sip module. + [6e81d758b971] <6.2-maint> + + * PyQt6.msp: + Qt.FocusPolicy members are now flags. + [6f4ebc7b30e4] <6.2-maint> + + * NEWS, PyQt6.msp, pyproject.toml: + Fixed the QStyle enums that have a custom base value so that the + value is unsigned and can be added to. + [8cd2a8c92b07] <6.2-maint> + +2021-11-19 Phil Thompson + + * NEWS, extras/uic/uiparser.py: + Fixed pyuic handling of alignment flags. + [2c1990da7bb3] <6.2-maint> + +2021-11-18 Phil Thompson + + * NEWS, PyQt6.msp: + Added the missing QBluetoothUuid ctors. + [a26c8d542c4a] <6.2-maint> + +2021-11-16 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the QBluetoothDeviceDiscoveryAgent.DiscoveryMethod enum. + [a3c9210b471e] <6.2-maint> + +2021-11-15 Phil Thompson + + * NEWS, extras/uic/enum_map.py: + Fixes for pyuic handling of QFormLayout enums. + [3c3c854f3f80] <6.2-maint> + +2021-10-28 Phil Thompson + + * .hgtags: + Added tag 6.2.1 for changeset a2c450b78bfa + [cda76ceff903] <6.2-maint> + + * NEWS, PyQt6.msp: + Added the QLowEnergyController.mtuChanged() signal which is now + documented in Qtv v6.2.1. + [a2c450b78bfa] [6.2.1] <6.2-maint> + +2021-10-24 Phil Thompson + + * extras/uic/Compiler/qtproxies.py: + Generate typing information to ignore connect() in pyuic generated + code. + [9c0e41c7ff2e] <6.2-maint> + + * NEWS, PyQt6.msp, pyproject.toml: + Fixed pickling of QByteArray with Python v3.10. + [a0e71847dd24] <6.2-maint> + + * test/classes/test_QByteArray.py: + Added the QByteArray pickle test. + [5030955cccde] <6.2-maint> + +2021-10-23 Phil Thompson + + * NEWS, PyQt6.msp: + Remove QObject.__getattr__() from QtCore.pyi as it hides + missing/mistyped attribute names. + [57b7422b71ce] <6.2-maint> + +2021-10-22 Phil Thompson + + * NEWS, extras/uic/enum_map.py: + Fixed pyuic's handling of QAction::MenuRole. + [8810cca5e9b4] <6.2-maint> + +2021-10-16 Phil Thompson + + * NEWS, pyproject.toml: + SIP v6.3.2 is required to fix the /KeepReference/ in QImage ctors. + [cb499c4af6b0] <6.2-maint> + +2021-10-04 Phil Thompson + + * NEWS, extras/lupdate/python_source.py: + Fixed QCoreApplication.translate() when the third argument is None. + [5133bf2070f2] <6.2-maint> + +2021-09-30 Phil Thompson + + * .hgtags: + Added tag 6.2.0 for changeset 0bb49dbf5c8b + [15bf52145355] + + * NEWS, PyQt6.msp: + Updated for Qt v6.2.0. + [0bb49dbf5c8b] [6.2.0] + +2021-09-29 Phil Thompson + + * NEWS, PyQt6.msp: + QCoreApplication.exit() is a slot from Qt v6.1. + [7c555d2bd771] + +2021-09-25 Phil Thompson + + * NEWS, qpy/QtCore/qpycore_pyqtmethodproxy.cpp: + Fixed the invocation of meta-type methods so that the result is + available. + [ca7422fddf5a] + +2021-09-23 Phil Thompson + + * unsupported/PyQt6-Purchasing/NEWS, + unsupported/PyQt6-Purchasing/PyQt6-Purchasing.msp, + unsupported/PyQt6-Purchasing/README, + unsupported/PyQt6-Purchasing/pyproject.toml: + Removed the 'unsupported' directory. + [b4df868a6b6d] + + * NEWS, PyQt6.msp, rb-product.toml: + Fixed the problem with QtRemoteObjects. + [127c837acbdf] + +2021-09-22 Phil Thompson + + * NEWS, PyQt6.msp: + Completed the port of QtNfc. + [512a66074830] + + * NEWS, PyQt6.msp, qpy/QtBluetooth/qpybluetooth_qlist.sip, + qpy/QtBluetooth/qpybluetooth_qmultihash.sip, + qpy/QtBluetooth/qpybluetooth_quint128.sip: + Completed the port of QtBluetooth. + [307d01aee62e] + + * project.py: + Added QtBluetooth and QtNfc to project.py. + [b2fe08777621] + + * PyQt6.msp: + Initial port of QtNfc. + [4ca5c5f2750d] + + * PyQt6.msp: + Initial port of QtBluetooth. + [60f45c3128bc] + + * modules/QAxContainer/qaxobject.sip: + Updated the sub-class convertor code for QAxContainer. + [de79cd0d7580] + + * PyQt6.msp, unsupported/PyQt6-Connectivity/PyQt6-Connectivity.msp: + Add QtBluetooth and QtNfc from PyQt5 to the project file. + [9aed3a4f9e43] + + * unsupported/PyQt6-Purchasing/PyQt6-Purchasing.msp, + unsupported/PyQt6-Unsupported.msp, unsupported/PyQt6-WebEngine/NEWS, + unsupported/PyQt6-WebEngine/README, + unsupported/PyQt6-WebEngine/pyproject.toml: + Tidies up the 'unsupported' directory. + [fdaad46be1d2] + + * modules/QAxContainer/QAxContainermod.sip, + modules/QAxContainer/qaxbase.sip, + modules/QAxContainer/qaxobject.sip, + modules/QAxContainer/qaxobjectinterface.sip, + modules/QAxContainer/qaxwidget.sip: + Ported QAxContainer to Qt6. + [04a550de425a] + + * NEWS, project.py, rb-product.toml: + Enable the build of QAxContainer. + [10b014f1c5ff] + +2021-09-17 Phil Thompson + + * NEWS, PyQt6.msp: + Updated for Qt v6.2.0rc. + [190b41cab26f] + +2021-09-05 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the QNetworkInformation.reachabilityChanged() signal. + [a63b3cecae2c] + +2021-08-27 Phil Thompson + + * NEWS, PyQt6.msp: + Added the missing QMouseEvent.pos() which is now documented. + [23e7523010e8] + +2021-08-26 Phil Thompson + + * PyQt6.msp: + Fixed the QUrl.ComponentFormattingOption and + QUrl.UrlFormattingOption enums. + [3dc0b4d025d1] + + * rb-product.toml: + Disable QtRemoteObjects in the build system as the workaround + doesn't seem to be reliable. + [b89426d33166] + +2021-08-22 Phil Thompson + + * NEWS, PyQt6.msp, project.py: + Worked around the problem with QtRemoteObjects. + [6537839dd6fa] + +2021-08-19 Phil Thompson + + * NEWS, PyQt6.msp, project.py: + Updated for Qt v6.2.0beta3. + [12e1add66527] + +2021-08-07 Phil Thompson + + * project.py: + Disable QtRemoteObjects because of apparent problems with Qt + v6.2.0beta2. + [4e2cdf6d8481] + +2021-08-06 Phil Thompson + + * pyproject.toml: + Updated the SIP and PyQt-builder version dependencies. + [41fe621c64d7] + +2021-08-05 Phil Thompson + + * PyQt6.msp: + Ignore multi-data in QtRemoteObjects. + [3a85941675c1] + + * NEWS, PyQt6.msp, project.py: + Added QtWebSockets. + [83f7983dc69d] + + * NEWS, PyQt6.msp, project.py: + Added QtWebChannel. + [4f1ded0754d6] + + * NEWS, PyQt6.msp, project.py: + Added QtSensors. + [222091df778d] + + * NEWS, PyQt6.msp, project.py: + Added QtRemoteObjects. + [b204f04c9a0c] + + * NEWS, PyQt6.msp, project.py: + Added QtPositioning. + [b38d5aae7842] + + * NEWS, PyQt6.msp, project.py: + Added the QtSerialPort module. + [cf48cdf5c172] + + * project.py: + Removed QtBluetooth and QtNfc from the build system. + [17e5bf532a8d] + + * PyQt6.msp: + Removed QtBluetooth and QtNfc from the project. + [b9b06ad7df34] + + * unsupported/PyQt6-Connectivity/PyQt6-Connectivity.msp: + Added PyQt6-Connectivity as an unsupported project. + [2790e860c346] + +2021-08-01 Phil Thompson + + * examples/multimediawidgets/camera/camera.py, + examples/multimediawidgets/camera/camera.ui, + examples/multimediawidgets/camera/images/shutter.svg, + examples/multimediawidgets/camera/imagesettings.ui, + examples/multimediawidgets/camera/ui_camera.py, + examples/multimediawidgets/camera/ui_imagesettings.py, + examples/multimediawidgets/camera/ui_videosettings.py, + examples/multimediawidgets/camera/videosettings.ui: + Added the camera example although it has a number of issues. + [16f0c36a9f19] + + * PyQt6.msp: + Added QMediaRecorder.captureSession(). + [74855b5a7487] + + * qpy/QtMultimedia/qpymultimedia_qlist.sip: + Added the QList mapped types for the QMediaFormat enums. + [f36b6bf9c145] + + * qpy/QtMultimedia/qpymultimedia_qlist.sip: + Implemented the mapped type for QList. + [80046bdc1f87] + + * PyQt6.msp: + Added the FileFormat related methods to QImageCapture. + [b69357b96fec] + + * PyQt6.msp: + Fixed the QMediaRecorder signals. + [9c49ecdb1195] + +2021-07-31 Phil Thompson + + * PyQt6.msp: + Added static methods to QMediaFormat. + [524ea52f51b9] + + * PyQt6.msp: + Updated for Qt v6.2.0beta2. + [643d1fc97e09] + + * examples/multimediawidgets/videographicsitem.py, + examples/multimediawidgets/videowidget.py: + Added the videographicsitem and videowidget QtMultimediaWidgets + examples. + [e6ecf20ffc28] + + * PyQt6.msp: + Added QMediaMetaData.keys(). + [d46d3083187b] + + * NEWS, PyQt6.msp: + Added QMediaMetaData.insert(). + [cda59a750906] + +2021-07-28 Phil Thompson + + * NEWS, PyQt6.msp: + Added the data() and constData() methods to QAudioBuffer. + [500bc39c2cb2] + + * PyQt6.msp: + Fixed the QMediaPlayer signals. + [4fbc54197a4b] + +2021-07-19 Phil Thompson + + * NEWS, examples/multimedia/audiodevices/audiodevices.py, + examples/multimedia/audiodevices/audiodevicesbase.ui, + examples/multimedia/audiodevices/ui_audiodevicesbase.py, + examples/multimedia/audiooutput.py: + Ported the QtMultimedia examples from PyQt5. + [136a95203f5c] + +2021-07-18 Phil Thompson + + * NEWS, PyQt6.msp, project.py: + Added the QtMultimediaWidgets module. + [a189c0448865] + + * NEWS, PyQt6.msp, project.py, + qpy/QtMultimedia/qpymultimedia_qlist.sip: + Completed the initial support for QtMultimedia. + [005a5a6f2279] + +2021-07-17 Phil Thompson + + * PyQt6.msp, qpy/QtMultimedia/qpymultimedia_qlist.sip: + Completed the first pass through QtMultimedia. + [47189280cc1a] + +2021-07-16 Phil Thompson + + * NEWS, PyQt6.msp: + Started work on QtMultimedia. + [f2b2d9c9fa52] + +2021-07-14 Phil Thompson + + * NEWS, PyQt6.msp, mksccode/QtOpenGL.versions, + qpy/QtOpenGL/qpyopengl_qlist.sip: + Fixed building against Qt configured for OpenGL ES2. + [95a652ce2d96] + +2021-07-12 Phil Thompson + + * qpy/QtCore/qpycore_std_pair.sip: + Added the std::pair mapped type needed by + PyQt6-Charts. + [92db4a18d792] + + * qpy/QtCore/qpycore_qlist.sip: + Fixed an exception message un the QList convertor. + [e6453b26c219] + + * PyQt6.msp: + Completed the support for Qt v6.2.0beta1. + [163831f2aae3] + + * NEWS, PyQt6.msp: + Initial pass through Qt v6.2.0beta1. + [1a6569729dc9] + + * Merged the 6.1-maint branch. + [2e3463b0829c] + +2021-07-09 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the ordering of the QCompleter ctors so that a + QAbstractItemModel argument doesn't get interpreted as a parent + QObject argument. + [1eed874dbae5] <6.1-maint> + +2021-06-13 Phil Thompson + + * .hgtags: + Added tag 6.1.1 for changeset 4a8c6ec34804 + [248b4a679303] <6.1-maint> + + * NEWS, PyQt6.msp: + Fixed a v6.1.0 regression in QImage.fill(). + [4a8c6ec34804] [6.1.1] <6.1-maint> + +2021-06-03 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the base type of the QFileSystemModel.Roles enum. + [87985eec2ed8] <6.1-maint> + +2021-05-30 Phil Thompson + + * extras/lupdate/translation_file.py: + The pylupdate6 summary is now created with one print statement to + reduce the chance it gets mixed up with other parallel output. + [daf3e2fbfb6f] <6.1-maint> + + * extras/lupdate/translation_file.py: + pylupdate6 bug fix. + [b5519af5a1bc] <6.1-maint> + + * extras/lupdate/translation_file.py: + Always use POSIX line endings in the .ts file. + [c7f2160e2cf7] <6.1-maint> + + * NEWS, extras/lupdate/python_source.py: + pylupdate6 now handles PEP 263 embedded source encodings in .py + files. + [b42c29091f7a] <6.1-maint> + +2021-05-24 Phil Thompson + + * NEWS, extras/lupdate/lupdate.py, extras/lupdate/pylupdate.py: + Added the --exclude command line option to pylupdate6 and the + corresponding Python API. + [4b85ca61b80f] <6.1-maint> + +2021-05-21 Phil Thompson + + * qpy/QtCore/qpycore_qmap.sip: + Completed the full implementation of the QMultiMap mapped type. + [f2ea0ac13dfe] <6.1-maint> + + * NEWS, PyQt6.msp: + Fixed the conversion of QHostAddress.SpecialAddress. + [e16e11b73278] <6.1-maint> + +2021-05-20 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the conversion of bytes objects with embedded zeros to + QByteArray. + [0d9a294fd927] <6.1-maint> + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h: + Fixed the handling of char* in signal and slot signatures. + [82d5a4a5e954] <6.1-maint> + + * qpy/QtCore/qpycore_decorators.cpp: + Improved an error message. + [00929c4e1a2a] <6.1-maint> + +2021-05-17 Phil Thompson + + * NEWS, PyQt6.msp: + Restored the QtCore.QXmlStreamAttributes class from PyQt5. + [a9c3a332ca56] <6.1-maint> + +2021-05-14 Phil Thompson + + * NEWS, PyQt6.msp: + Added the missing QtQml.QQmlExtensionPlugin class. + [e55eb8b00533] <6.1-maint> + +2021-05-07 Phil Thompson + + * .hgtags: + Added tag 6.1.0 for changeset 596ddcf79bcb + [8694eb36e6e3] + +2021-05-06 Phil Thompson + + * PyQt6.msp: + Added support for QJSPrimitiveValue etc. + [596ddcf79bcb] [6.1.0] + + * NEWS, PyQt6.msp, mksccode/QtNetwork.versions: + Added support for QNetworkInformation. + [fc63e614aaaf] + +2021-05-01 Phil Thompson + + * NEWS, PyQt6.msp: + Updated for Qt v6.1.0rc2. + [2b64a149a6ac] + +2021-04-26 Phil Thompson + + * NEWS, PyQt6.msp: + Added the missing QLayout.setAlignment() overload. + [e49adf63dc0e] + +2021-04-25 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed __rmul__ for QSize and QSizeF. + [d9cfdf83c8f5] + + * qpy/QtCore/qpycore_chimera.cpp: + Fixed the handling of QFlag properties. + [6f61dacb0579] + +2021-04-24 Phil Thompson + + * PyQt6.msp: + Updated for Qt v6.1.0rc. + [51097cc1d2c8] + + * NEWS, qpy/QtCore/qflags.sip: + Fixed the conversion of QFlags. + [9f0d75e7e5dd] + +2021-04-22 Phil Thompson + + * NEWS, PyQt6.msp: + Fixed the automatic conversion of a QEasingCurve.Type to a + QEasingCurve. + [db75ac715a51] + +2021-04-21 Phil Thompson + + * PyQt6.msp: + Fixed the base type of Qt.WindowFlag. + [9a82622d34d3] + +2021-04-19 Phil Thompson + + * PyQt6.msp: + Allow QEvent and QChildEvent to be created using an int event type. + [590701bb226e] + +2021-04-17 Phil Thompson + + * PyQt6.msp: + Added the resource provider support for QTextDocument. + [bdbf71443638] + + * PyQt6.msp: + Implemented the resource provider support for QLabel. + [ce14b46f9be1] + +2021-04-16 Phil Thompson + + * extras/designer/pluginloader.cpp, extras/qmlscene/pluginloader.cpp: + Fixes for the plugin loaders. + [fd3365056f64] + + * PyQt6.msp, qpy/QtNetwork/qpynetwork_qlist.sip: + Completed the QtNetwork changes for Qt v6.1. + [78306f7b92f3] + + * NEWS, PyQt6.msp, qpy/QtCore/qpycore_qlist.sip: + Updated QColorSpec for Qt v6.1. + [102dcde6cb12] + +2021-04-10 Phil Thompson + + * PyQt6.msp: + First pass through Qt v6.1. + [f953fc79b5e5] + + * NEWS, PyQt6.msp: + Added a base version. + [8e4326d7bcf4] + + * DevelopersNotes.txt: + The developer notes are no longer required. + [d39c4c8a1065] + +2021-04-05 Phil Thompson + + * unsupported/PyQt6-Unsupported.msp: + Another forward port for QtWebEngine from PyQt5. + [5216e3e10fad] + + * unsupported/PyQt6-Unsupported.msp: + Forward ported the latest QtWebEngine changes from PyQt5. + [db5459a18a78] + +2021-03-31 Phil Thompson + + * qpy/QtDataVisualization/qpydatavisualization_qlist.sip: + Removed the last vestiges of QtDataVisualization. + [ef3513699255] + + * PyQt6.msp: + Fixed the base type of Qt.Key. + [45ed8f417097] + +2021-03-30 Phil Thompson + + * NEWS, PyQt6.msp: + Allow an integer ARGB value to be used whenever a QColor is + expected. + [3534999634cd] + + * unsupported/PyQt6-Unsupported.msp: + Tidied up the "unsupported" project. + [673cd94e1f26] + + * test/misc/test_pickle.py: + Fixed the unit tests for the renamed flags. + [a6069cc88f20] + + * unsupported/PyQt6-Charts/NEWS, unsupported/PyQt6-Charts/README, + unsupported/PyQt6-Charts/mksccode/QtCharts.versions, + unsupported/PyQt6-Charts/pyproject.toml, + unsupported/PyQt6-DataVisualization/NEWS, + unsupported/PyQt6-DataVisualization/README, unsupported/PyQt6-DataVi + sualization/mksccode/QtDataVisualization.versions, + unsupported/PyQt6-DataVisualization/pyproject.toml, + unsupported/PyQt6-Purchasing/pyproject.toml, + unsupported/PyQt6-Unsupported.msp, + unsupported/PyQt6-WebEngine/pyproject.toml: + Removed PyQt6-Charts and PyQt6-DataVisualization "unsupported" + projects. + [8d1a612af2a0] + +2021-03-21 Phil Thompson + + * NEWS: + Updated the NEWS file. + [b6c90242cc6a] + + * PyQt6.msp, examples/designer/calculatorform/ui_calculatorform.py, + examples/designer/plugins/widgets/analogclock.py, + examples/designer/plugins/widgets/bubbleswidget.py, + examples/designer/plugins/widgets/counterlabel.py, + examples/designer/plugins/widgets/helloglwidget.py, + examples/designer/plugins/widgets/polygonwidget.py, + examples/desktop/screenshot.py, + examples/dialogs/configdialog/configdialog.py, + examples/dialogs/extension.py, examples/dialogs/findfiles.py, + examples/dialogs/standarddialogs.py, examples/dialogs/tabdialog.py, + examples/draganddrop/delayedencoding/delayedencoding.py, + examples/draganddrop/draggableicons/draggableicons.py, + examples/draganddrop/draggabletext/draggabletext.py, + examples/draganddrop/dropsite.py, + examples/draganddrop/fridgemagnets/fridgemagnets.py, + examples/draganddrop/puzzle/puzzle.py, examples/quick/tutorials/exte + nding/chapter1-basics/chapter1-basics.py, examples/quick/tutorials/e + xtending/chapter2-methods/chapter2-methods.py, examples/quick/tutori + als/extending/chapter3-bindings/chapter3-bindings.py, examples/quick + /tutorials/extending/chapter4-customPropertyTypes/chapter4-customPro + pertyTypes.py, examples/quick/tutorials/extending/chapter5-listprope + rties/chapter5-listproperties.py, examples/quick/tutorials/extending + /chapter6-plugins/Charts/pieslice.py, extras/uic/enum_map.py, + extras/uic/uiparser.py: + Removed all the renaming of flag based enums so that they use the + enum name. + [ceddf66fcfeb] + + * Merged the 6.0-maint branch. + [3921624a6c57] + +2021-03-10 Phil Thompson + + * NEWS, extras/uic/enum_map.py: + Fixed pyuic's handling of the QLayout.SizeConstraint enum. + [0fc1a8dd2534] <6.0-maint> + +2021-03-05 Phil Thompson + + * .hgtags: + Added tag 6.0.3 for changeset b53bfff704f6 + [1c8e346871e4] <6.0-maint> + + * NEWS: + Released as v6.0.3. + [b53bfff704f6] [6.0.3] <6.0-maint> + + * qpy/QtCore/qpycore_qt_conf.cpp: + Fixed the embedded conf file. + [4a33096c52bc] <6.0-maint> + +2021-03-04 Phil Thompson + + * project.py: + Fixed the Qt subdirectory in __init__.py. + [ae45dbef9d89] <6.0-maint> + +2021-03-02 Phil Thompson + + * extras/uic/Compiler/qtproxies.py: + Fixed QAction and QActionGroup in pyuic. + [44ab6ba3f031] <6.0-maint> + + * NEWS: + Updated the NEWS file. + [9512b5ae9fa6] <6.0-maint> + + * PyQt6.msp: + Fixed the base type of QDialog.DialogCode. + [4b95c1e2881e] <6.0-maint> + +2021-02-27 Phil Thompson + + * pyproject.toml: + Fixed the project dependencies. + [05b9aa1414bd] <6.0-maint> + +2021-02-26 Phil Thompson + + * PyQt6.msp: + Changed the base type of QMessageBox.StandardButtons so that exec() + can return a button as an int. + [fc6309f743ac] <6.0-maint> + +2021-02-25 Phil Thompson + + * extras/uic/uiparser.py: + Fixed the handling of DockWidgetAreas in pyuic. + [cc8eb5b0e586] <6.0-maint> + +2021-02-22 Phil Thompson + + * .hgtags: + Added tag 6.0.2 for changeset 79c47417a960 + [d3c2ea0144c1] <6.0-maint> + + * NEWS: + Released as v6.0.2. + [79c47417a960] [6.0.2] <6.0-maint> + + * NEWS: + Updated the NEWS file. + [54dfec551415] <6.0-maint> + +2021-02-21 Phil Thompson + + * extras/dbus/dbus.cpp: + Fixed a compile error in the Python-dbus support. + [f06de706de94] <6.0-maint> + +2021-02-15 Phil Thompson + + * project.py, pyproject.toml: + Rely on PyQt-builder v1.9 to set the minimum glibc and macOS + versions. + [14c3445834d0] <6.0-maint> + + * PyQt6.msp: + Fixed a number of potential deadlocks in QSettings and + QLibraryInfo.path(). + [f47905c60c0a] <6.0-maint> + +2021-02-13 Phil Thompson + + * PyQt6.msp: + Removed the internal QQmlExtensionPlugin class. + [3a0a1e415b25] <6.0-maint> + + * PyQt6.msp: + Removed the internal qIsGray(). + [4c94569c3333] <6.0-maint> + +2021-02-12 Phil Thompson + + * PyQt6.msp: + Removed the internal qSharedBuild(). + [398c68ef66af] <6.0-maint> + + * PyQt6.msp: + Removed the internal qIsNull(). + [a989cc9346ad] <6.0-maint> + + * PyQt6.msp: + Removed the internal qErrnoWarning(). + [1bd5053693fe] <6.0-maint> + + * PyQt6.msp: + Added the missing QTextStream-related functions defined in the Qt + namespace. + [7c1bcb927b2d] <6.0-maint> + + * PyQt6.msp: + Removed QT_TR_NOOP_UTF8. + [543b1cbdd133] <6.0-maint> + +2021-02-10 Phil Thompson + + * PyQt6.msp: + Restored the PyQt5 behaviour of QIODevice.readLine(). + [a80b9cb45289] <6.0-maint> + +2021-02-09 Phil Thompson + + * extras/uic/enum_map.py: + Fixed the handling of QSizePolicy by uic.loadUi(). + [50ec168b7758] <6.0-maint> + +2021-02-08 Phil Thompson + + * qpy/QtCore/qpycore_chimera.cpp: + Fixed the parsing of pointers to non-QObject types. + [f6e1ff4d1b58] <6.0-maint> + +2021-02-05 Phil Thompson + + * .hgtags: + Added tag 6.0.1 for changeset ccd0fa4fc522 + [3f2f1fb12ef0] <6.0-maint> + + * NEWS: + Released as v6.0.1. + [ccd0fa4fc522] [6.0.1] <6.0-maint> + + * extras/designer/pluginloader.cpp, extras/qmlscene/pluginloader.cpp: + Fixed build problems on Windows. + [4ffbc71fc950] <6.0-maint> + +2021-02-04 Phil Thompson + + * NEWS: + Updated the NEWS file. + [9801e803f723] <6.0-maint> + + * NEWS: + Updated the NEWS file. + [ae8da9d65e30] <6.0-maint> + + * examples/draganddrop/delayedencoding/delayedencoding.py, + examples/draganddrop/delayedencoding/images/drag.png, + examples/draganddrop/delayedencoding/images/example.svg, + examples/draganddrop/draggableicons/draggableicons.py, + examples/draganddrop/draggableicons/images/boat.png, + examples/draganddrop/draggableicons/images/car.png, + examples/draganddrop/draggableicons/images/house.png, + examples/draganddrop/draggabletext/draggabletext.py, + examples/draganddrop/draggabletext/words.txt, + examples/draganddrop/dropsite.py, + examples/draganddrop/fridgemagnets/fridgemagnets.py, + examples/draganddrop/fridgemagnets/words.txt, + examples/draganddrop/puzzle/example.jpg, + examples/draganddrop/puzzle/puzzle.py: + Ported the drag'n'drop examples. + [20e0d10de086] <6.0-maint> + + * PyQt6.msp: + Fixed the type of Qt.TextFlag. + [2dfa82fa2f22] <6.0-maint> + +2021-02-01 Phil Thompson + + * examples/dialogs/classwizard/classwizard.py, + examples/dialogs/classwizard/images/background.png, + examples/dialogs/classwizard/images/banner.png, + examples/dialogs/classwizard/images/logo1.png, + examples/dialogs/classwizard/images/logo2.png, + examples/dialogs/classwizard/images/logo3.png, + examples/dialogs/classwizard/images/watermark1.png, + examples/dialogs/classwizard/images/watermark2.png, + examples/dialogs/configdialog/configdialog.py, + examples/dialogs/configdialog/images/config.png, + examples/dialogs/configdialog/images/query.png, + examples/dialogs/configdialog/images/update.png, + examples/dialogs/extension.py, examples/dialogs/findfiles.py, + examples/dialogs/standarddialogs.py, examples/dialogs/tabdialog.py, + examples/dialogs/trivialwizard.py: + Ported the dialogs examples. + [469e6900995c] <6.0-maint> + + * PyQt6.msp: + Fix the types of the Shape and Shadow enums of QFrame. + [2cd6dd0666f3] <6.0-maint> + + * examples/desktop/screenshot.py, + examples/desktop/systray/images/bad.png, + examples/desktop/systray/images/heart.png, + examples/desktop/systray/images/trash.png, + examples/desktop/systray/systray.py: + Ported the desktop examples. + [f416d1380d4d] <6.0-maint> + +2021-01-29 Phil Thompson + + * examples/quick/scenegraph/customgeometry/customgeometry.py, examples + /quick/tutorials/extending/chapter1-basics/chapter1-basics.py, examp + les/quick/tutorials/extending/chapter2-methods/chapter2-methods.py, + e + xamples/quick/tutorials/extending/chapter3-bindings/chapter3-binding + s.py, examples/quick/tutorials/extending/chapter4-customPropertyType + s/chapter4-customPropertyTypes.py, examples/quick/tutorials/extendin + g/chapter5-listproperties/chapter5-listproperties.py, examples/quick + /tutorials/extending/chapter6-plugins/Charts/chartsplugin.py: + Don't specify the QML name unncessarily in the QtQuick examples. + [0bc143ed9ed6] <6.0-maint> + +2021-01-26 Phil Thompson + + * extras/qmlscene/pluginloader.cpp: + Ported Designer plugin changes to the qmlscene plugin. + [8391d88f9c70] <6.0-maint> + + * extras/designer/pluginloader.cpp: + Remove redundant code from the Designer plugin. + [f5f241310d79] <6.0-maint> + + * extras/designer/pluginloader.cpp: + The Designer plugin now handles being run from a venv. + [5695e5c98db4] <6.0-maint> + + * examples/designer/calculatorform/calculatorform.py, + examples/designer/calculatorform/calculatorform.ui, + examples/designer/calculatorform/ui_calculatorform.py, + examples/designer/plugins/plugins.py, + examples/designer/plugins/python/analogclockplugin.py, + examples/designer/plugins/python/bubbleswidgetplugin.py, + examples/designer/plugins/python/counterlabelplugin.py, + examples/designer/plugins/python/datetimeeditplugin.py, + examples/designer/plugins/python/helloglwidgetplugin.py, + examples/designer/plugins/python/multipagewidgetplugin.py, + examples/designer/plugins/python/polygonwidgetplugin.py, + examples/designer/plugins/python/pydemoplugin.py, + examples/designer/plugins/python/pythonconsoleplugin.py, + examples/designer/plugins/widgets/analogclock.py, + examples/designer/plugins/widgets/bubbleswidget.py, + examples/designer/plugins/widgets/counterlabel.py, + examples/designer/plugins/widgets/datetimeedit.py, + examples/designer/plugins/widgets/helloglwidget.py, + examples/designer/plugins/widgets/multipagewidget.py, + examples/designer/plugins/widgets/polygonwidget.py, + examples/designer/plugins/widgets/pydemo.py, + examples/designer/plugins/widgets/pythonconsolewidget.py: + Added the designer examples. + [7c145449f6c2] <6.0-maint> + + * PyQt6.msp: + Fixed the QFontMetrics and QFontMetricsF ctors. + [62828ed053a6] <6.0-maint> + +2021-01-24 Phil Thompson + + * examples/quick/animation/animation.py, + examples/quick/animation/animation.qml, + examples/quick/animation/basics/color-animation.qml, + examples/quick/animation/basics/images/face-smile.png, + examples/quick/animation/basics/images/moon.png, + examples/quick/animation/basics/images/shadow.png, + examples/quick/animation/basics/images/star.png, + examples/quick/animation/basics/images/sun.png, + examples/quick/animation/basics/property-animation.qml, + examples/quick/animation/behaviors/SideRect.qml, + examples/quick/animation/behaviors/behavior-example.qml, + examples/quick/animation/behaviors/tvtennis.qml, + examples/quick/animation/behaviors/wigglytext.qml, + examples/quick/animation/easing/easing.qml, + examples/quick/animation/pathanimation/pathanimation.qml, + examples/quick/animation/pathinterpolator/pathinterpolator.qml, + examples/quick/animation/states/qt-logo.png, + examples/quick/animation/states/states.qml, + examples/quick/animation/states/transitions.qml, + examples/quick/canvas/bezierCurve/bezierCurve.qml, + examples/quick/canvas/canvas.py, examples/quick/canvas/canvas.qml, + examples/quick/canvas/clip/clip.qml, + examples/quick/canvas/contents/Button.qml, + examples/quick/canvas/contents/ScrollBar.qml, + examples/quick/canvas/contents/Slider.qml, + examples/quick/canvas/contents/TitleBar.qml, + examples/quick/canvas/contents/ToolBar.qml, + examples/quick/canvas/contents/images/button-pressed.png, + examples/quick/canvas/contents/images/button.png, + examples/quick/canvas/contents/images/default.svg, + examples/quick/canvas/contents/images/gloss.png, + examples/quick/canvas/contents/images/lineedit.png, + examples/quick/canvas/contents/images/lineedit.sci, + examples/quick/canvas/contents/images/quit.png, + examples/quick/canvas/contents/images/stripes.png, + examples/quick/canvas/contents/images/titlebar.png, + examples/quick/canvas/contents/images/titlebar.sci, + examples/quick/canvas/contents/images/toolbutton.png, + examples/quick/canvas/contents/images/toolbutton.sci, + examples/quick/canvas/contents/qt-logo.png, + examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml, + examples/quick/canvas/roundedrect/roundedrect.qml, + examples/quick/canvas/smile/smile.qml, + examples/quick/canvas/squircle/squircle.png, + examples/quick/canvas/squircle/squircle.qml, + examples/quick/canvas/tiger/tiger.js, + examples/quick/canvas/tiger/tiger.qml, + examples/quick/models/abstractitemmodel/abstractitemmodel.py, + examples/quick/models/abstractitemmodel/view.qml, + examples/quick/models/objectlistmodel/objectlistmodel.py, + examples/quick/models/objectlistmodel/view.qml, + examples/quick/models/stringlistmodel/stringlistmodel.py, + examples/quick/models/stringlistmodel/view.qml, + examples/quick/scenegraph/customgeometry/customgeometry.py, + examples/quick/scenegraph/customgeometry/main.qml, + examples/quick/shared/Button.qml, + examples/quick/shared/LauncherList.qml, + examples/quick/shared/SimpleLauncherDelegate.qml, + examples/quick/shared/images/back.png, + examples/quick/shared/images/next.png, + examples/quick/tutorials/extending/chapter1-basics/app.qml, examples + /quick/tutorials/extending/chapter1-basics/chapter1-basics.py, + examples/quick/tutorials/extending/chapter2-methods/app.qml, example + s/quick/tutorials/extending/chapter2-methods/chapter2-methods.py, + examples/quick/tutorials/extending/chapter3-bindings/app.qml, exampl + es/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.py, + examples/quick/tutorials/extending/chapter4-customPropertyTypes/app. + qml, examples/quick/tutorials/extending/chapter4-customPropertyTypes + /chapter4-customPropertyTypes.py, + examples/quick/tutorials/extending/chapter5-listproperties/app.qml, + e + xamples/quick/tutorials/extending/chapter5-listproperties/chapter5-l + istproperties.py, examples/quick/tutorials/extending/chapter6-plugin + s/Charts/chartsplugin.py, examples/quick/tutorials/extending/chapter + 6-plugins/Charts/piechart.py, examples/quick/tutorials/extending/cha + pter6-plugins/Charts/pieslice.py, + examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir, + examples/quick/tutorials/extending/chapter6-plugins/app.qml: + Ported the QtQuick examples from PyQt5. + [94dd3c5f9a15] <6.0-maint> + + * PyQt6.msp: + Fixed the '*' operator between QPoint and QPointF and floats. + [6ac2e72a68a4] <6.0-maint> + + * PyQt6.msp: + Fixed the QSGGeometry.DrawingMode enum. + [8860f30c90ba] <6.0-maint> + +2021-01-21 Phil Thompson + + * qpy/QtBluetooth/qpybluetooth_qlist.sip, + qpy/QtCore/qpycore_qlist.sip, + qpy/QtDataVisualization/qpydatavisualization_qlist.sip, + qpy/QtGui/qpygui_qlist.sip, + qpy/QtMultimedia/qpymultimedia_qlist.sip, + qpy/QtOpenGL/qpyopengl_qlist.sip, + qpy/QtPrintSupport/qpyprintsupport_qlist.sip, + qpy/QtWidgets/qpywidgets_qlist.sip: + iUpdates all of the QList mapped type convertors to ignore bytes + objects (as they currently ignore unicode objects). + [c84b4dbb8259] <6.0-maint> + + * examples/richtext/textobject/heart.svg, + examples/richtext/textobject/textobject.py: + Ported the textobject.py example. + [f9c710c2ab38] <6.0-maint> + + * PyQt6.msp: + Fix the QTextFormat enums that allow the user to define additional + values. + [98f2f67e93b2] <6.0-maint> + +2021-01-17 Phil Thompson + + * README, pyproject.toml, unsupported/PyQt6-Charts/README, + unsupported/PyQt6-Charts/pyproject.toml, + unsupported/PyQt6-DataVisualization/README, + unsupported/PyQt6-DataVisualization/pyproject.toml, + unsupported/PyQt6-Purchasing/README, + unsupported/PyQt6-Purchasing/pyproject.toml, + unsupported/PyQt6-WebEngine/README, + unsupported/PyQt6-WebEngine/pyproject.toml: + Wheels depend on an external Qt wheel rather than bundle Qt. + [99e49fea1bd5] <6.0-maint> + +2021-01-16 Phil Thompson + + * PyQt6.msp: + QMetaType.name() now returns a bytes object to be consistent with + QMetaType.fromName(). + [aff2c62bfdd1] <6.0-maint> + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h, + qpy/QtCore/qpycore_types.cpp, test/classes/test_QVariant.py, + test/metaobject/test_pyqtproperty.py: + It is no longer necessary to fudge the meta-type of wrapped enums as + they all have their own Qt meta-type id. + [c87603357133] <6.0-maint> + + * qpy/QtCore/qpycore_chimera.cpp: + Fixed the type parsing of enum properties. + [c840be8e65cf] <6.0-maint> + +2021-01-13 Phil Thompson + + * PyQt6.msp: + Fixed the QKeySequence() ctor and type convertor. + [e116b55c87bf] <6.0-maint> + + * PyQt6.msp: + Reverted the behaviour of the QImage ctors to that of PyQt5 so that + unnecessary restrictions (eg. the number of dimensions) were not + imposed. + [3ebeab7b321e] <6.0-maint> + + * NEWS, PyQt6.msp: + Added QSocketNotifier. + [383f828d5269] <6.0-maint> + +2021-01-10 Phil Thompson + + * extras/lupdate/pylupdate.py: + Fixed a pylupdate regression. + [ae3cac2d629c] <6.0-maint> + + * extras/lupdate/pylupdate.py, extras/uic/pyuic.py: + Further tweaks to the pyuic and pylupdate main() functions. + [c2e09795240a] <6.0-maint> + + * extras/lupdate/pylupdate.py: + Fix the return code handling of pylupdate. + [6c29337a0644] <6.0-maint> + + * extras/uic/pyuic.py: + Make sure the pyuic return code is retruned properly. + [ac6152d35c63] <6.0-maint> + +2021-01-09 Phil Thompson + + * extras/uic/uiparser.py: + Complete the pyuic fixes for QActionGroup. + [f721d31c0e63] <6.0-maint> + +2021-01-08 Phil Thompson + + * PyQt6.msp: + Restored the readString() and writeString() methods of QDataStream. + Fixed QDataStream.writeBytes() and added support for writing any + object that implements the buffer protocol. + [6ad6a175283f] <6.0-maint> + + * PyQt6.msp: + QDataStream.Version is now an IntEnum because + QDataStrean.setVersion() has an int argument. + [8ab112f4dd64] <6.0-maint> + + * PyQt6.msp: + QEvent.type() now returns an int and QEvent.Type is now sub-classed + from IntEnum. These changes are required to a) cope with internal + event types and b) user defined event types. + [dc39bbd4c986] <6.0-maint> + + * extras/uic/icon_cache.py: + Fixed pyuic handling of QIcon. + [f375f1cedb46] <6.0-maint> + +2021-01-06 Phil Thompson + + * PyQt6.msp: + Don't define the OpenGL enums in QtQuick and use the provided + alternatives in the handwritten code. + [222b4dc0f424] <6.0-maint> + +2021-01-05 Phil Thompson + + * extras/uic/uiparser.py, rb-product.toml: + Fix QActionGroup in pyuic. + [0e778d0bffe9] <6.0-maint> + +2021-01-04 Phil Thompson + + * .hgtags: + Added tag 6.0.0 for changeset f34d70fe36f2 + [771d5d2132e3] + + * NEWS: + Released as v6.0.0. + [f34d70fe36f2] [6.0.0] + + * pyproject.toml: + Require Python v3.6.1 because PyUnicode_GetLength() is missing from + the limited API in v3.6.0. + [3c657f034069] + + * NEWS: + Updated the NEWS file. + [c5f56d16fdcb] + +2021-01-03 Phil Thompson + + * PyQt6.msp: + Fixed a type hint typo. + [7457f9bec24b] + + * PyQt6.msp: + More type hint improvments. + [a44b127d851f] + + * PyQt6.msp: + No longer allow a QPoint when a QPointF is expected. + [29784d4497a7] + + * PyQt6.msp: + Reorder a couple of methods to remove a mypy error. + [036ef03abd5a] + + * PyQt6.msp, qpy/QtQml/qmlregistertype.sip: + More type hint fixes. + [d467a5493bf2] + + * PyQt6.msp: + Fixed a couple of type hints. + [22bd87864223] + +2021-01-02 Phil Thompson + + * PyQt6.msp, qpy/QtQml/qmlregistertype.sip: + More type hint fixes. + [eb64d6fcb08e] + + * PyQt6.msp, qpy/QtQml/qmlregistertype.sip: + Fixed many type hints. + [af5f13a27189] + +2020-12-31 Phil Thompson + + * DevelopersNotes.txt: + Added DevelopersNotes.txt. + [a8034a952af2] + + * NEWS, PyQt6.msp, README, config-tests/cfgtest_QtCore.cpp, config- + tests/cfgtest_QtGui.cpp, config-tests/cfgtest_QtNetwork.cpp, config- + tests/cfgtest_QtPrintSupport.cpp, misc/__init__.py, + misc/license.dat.commercial, misc/license.dat.internal, misc/pyqt- + commercial.sip, misc/pyqt-gpl.sip, misc/pyqt-internal.sip, + mksccode/QtCore.versions, mksccode/QtGui.versions, + mksccode/QtNetwork.versions, mksccode/QtPrintSupport.versions, + project.py, projects/PyQt6-Charts/NEWS, + projects/PyQt6-Charts/README, + projects/PyQt6-Charts/mksccode/QtCharts.versions, + projects/PyQt6-Charts/pyproject.toml, + projects/PyQt6-DataVisualization/NEWS, + projects/PyQt6-DataVisualization/README, projects/PyQt6-DataVisualiz + ation/mksccode/QtDataVisualization.versions, + projects/PyQt6-DataVisualization/pyproject.toml, + projects/PyQt6-Purchasing/NEWS, projects/PyQt6-Purchasing/README, + projects/PyQt6-Purchasing/pyproject.toml, + projects/PyQt6-WebEngine/NEWS, projects/PyQt6-WebEngine/README, + projects/PyQt6-WebEngine/pyproject.toml, projects/PyQt6/Modules, + projects/PyQt6/NEWS, projects/PyQt6/QtCore.versions, + projects/PyQt6/QtGui.versions, projects/PyQt6/QtNetwork.versions, + projects/PyQt6/QtPrintSupport.versions, projects/PyQt6/README, + projects/PyQt6/__init__.py, projects/PyQt6/config- + tests/cfgtest_QtCore.cpp, projects/PyQt6/config- + tests/cfgtest_QtGui.cpp, projects/PyQt6/config- + tests/cfgtest_QtNetwork.cpp, projects/PyQt6/config- + tests/cfgtest_QtPrintSupport.cpp, + projects/PyQt6/license.dat.commercial, + projects/PyQt6/license.dat.internal, projects/PyQt6/project.py, + projects/PyQt6/pyproject.toml, projects/PyQt6/pyqt-commercial.sip, + projects/PyQt6/pyqt-gpl.sip, projects/PyQt6/pyqt-internal.sip, + pyproject.toml, unsupported/PyQt6-Charts/NEWS, + unsupported/PyQt6-Charts/README, + unsupported/PyQt6-Charts/mksccode/QtCharts.versions, + unsupported/PyQt6-Charts/pyproject.toml, + unsupported/PyQt6-DataVisualization/NEWS, + unsupported/PyQt6-DataVisualization/README, unsupported/PyQt6-DataVi + sualization/mksccode/QtDataVisualization.versions, + unsupported/PyQt6-DataVisualization/pyproject.toml, + unsupported/PyQt6-Purchasing/NEWS, + unsupported/PyQt6-Purchasing/README, + unsupported/PyQt6-Purchasing/pyproject.toml, + unsupported/PyQt6-Unsupported.msp, unsupported/PyQt6-WebEngine/NEWS, + unsupported/PyQt6-WebEngine/README, + unsupported/PyQt6-WebEngine/pyproject.toml: + Restructued the repo layout now that we know the long term project + structure. + [ed58c869cfac] + + * PyQt6.msp: + Qt.ItemDataRole is now int based. + [1d254e41b191] + +2020-12-30 Phil Thompson + + * projects/PyQt6-Charts/Modules, + projects/PyQt6-Charts/mksccode/QtCharts.versions, + projects/PyQt6-DataVisualization/Modules, projects/PyQt6-DataVisuali + zation/mksccode/QtDataVisualization.versions, + projects/PyQt6-Purchasing/Modules, projects/PyQt6-WebEngine/Modules: + Tidy ups of the (as yet unsupported) sub-projects. + [192a82c99649] + + * PyQt6.msp: + The charts module is QtCharts in PyQt6. + [957c7ea5a4d9] + + * PyQt6.msp, projects/PyQt6-3D/Modules, projects/PyQt6-3D/NEWS, + projects/PyQt6-3D/README, projects/PyQt6-3D/pyproject.toml, + qpy/Qt3DCore/qsharedpointer.sip, qpy/Qt3DRender/qvector.sip: + Removed the Qt3D modules as they now have their own product. + [12224511c465] + +2020-12-29 Phil Thompson + + * tools/adlib.py: + Removed adlib.py as the additional libraries can easily be built + with qmake. + [df5c3ac7b7be] + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Removed QtNetworkAuth as it is now a separate product. + [f5385c7df11e] + + * projects/PyQt6-3D/pyproject.toml, + projects/PyQt6-Charts/pyproject.toml, + projects/PyQt6-DataVisualization/pyproject.toml, + projects/PyQt6-Purchasing/pyproject.toml, + projects/PyQt6-WebEngine/pyproject.toml: + Fixed typos in the sub-project pyproject.toml files. + [222ea0e173ef] + + * projects/PyQt6-3D/pyproject.toml, + projects/PyQt6-Charts/pyproject.toml, + projects/PyQt6-DataVisualization/pyproject.toml, + projects/PyQt6-Purchasing/pyproject.toml, + projects/PyQt6-WebEngine/pyproject.toml: + Specify the minimum GLIBC and macOS versions for the sub-projects. + [06a5b4b15797] + + * projects/PyQt6-3D/pyproject.toml, + projects/PyQt6-Charts/pyproject.toml, + projects/PyQt6-DataVisualization/pyproject.toml, + projects/PyQt6-Purchasing/pyproject.toml, + projects/PyQt6-WebEngine/pyproject.toml: + Hardcode the PyQt6 dependency as we are not going to synch minor + version numbers. + [dc0923611afc] + + * projects/PyQt3D6/Modules, projects/PyQt3D6/NEWS, + projects/PyQt3D6/README, projects/PyQt3D6/pyproject.toml, + projects/PyQt6-3D/Modules, projects/PyQt6-3D/NEWS, + projects/PyQt6-3D/README, projects/PyQt6-3D/pyproject.toml, + projects/PyQt6-Charts/Modules, projects/PyQt6-Charts/NEWS, + projects/PyQt6-Charts/README, projects/PyQt6-Charts/pyproject.toml, + projects/PyQt6-DataVisualization/Modules, + projects/PyQt6-DataVisualization/NEWS, + projects/PyQt6-DataVisualization/README, + projects/PyQt6-DataVisualization/pyproject.toml, + projects/PyQt6-Purchasing/Modules, projects/PyQt6-Purchasing/NEWS, + projects/PyQt6-Purchasing/README, + projects/PyQt6-Purchasing/pyproject.toml, + projects/PyQt6-WebEngine/Modules, projects/PyQt6-WebEngine/NEWS, + projects/PyQt6-WebEngine/README, + projects/PyQt6-WebEngine/pyproject.toml, + projects/PyQtChart6/Modules, projects/PyQtChart6/NEWS, + projects/PyQtChart6/README, projects/PyQtChart6/pyproject.toml, + projects/PyQtDataVisualization6/Modules, + projects/PyQtDataVisualization6/NEWS, + projects/PyQtDataVisualization6/README, + projects/PyQtDataVisualization6/pyproject.toml, + projects/PyQtPurchasing6/Modules, projects/PyQtPurchasing6/NEWS, + projects/PyQtPurchasing6/README, + projects/PyQtPurchasing6/pyproject.toml, + projects/PyQtWebEngine6/Modules, projects/PyQtWebEngine6/NEWS, + projects/PyQtWebEngine6/README, + projects/PyQtWebEngine6/pyproject.toml: + Renamed the (as yet unsupported) additional library projects + according to the new naming convention. + [179ae818b445] + +2020-12-28 Phil Thompson + + * PyQt6.msp: + Fixed the QByteArray type hint. + [66aecd4316bd] + +2020-12-27 Phil Thompson + + * tools/adlib.py: + Fixed a missing import in adlib.py. + [b7e67504f12b] + + * tools/adlib.py: + Windows fixes for adlib.py. + [caf0ef3e0549] + + * tools/adlib.py: + Don't rely on conan being on PATH. + [caf3390c65fd] + + * tools/adlib.py: + Added the adlib.py tool for handling the qtimageformats additional + library. + [04543ec809d3] + + * tools/mksccode.py: + Updated the argument parser of the mksccode.py tool. + [eaf5788bdfba] + +2020-12-26 Phil Thompson + + * extras/lupdate/python_source.py: + Fixed the disambiguation for NOOP translations. + [e7c5a1fae5eb] + + * extras/lupdate/python_source.py, extras/lupdate/translation_file.py: + Fix the handling of disambiguation comments. + [0081ddee87fc] + +2020-12-25 Phil Thompson + + * extras/lupdate/translation_file.py: + Don't refer to duplicates of new messages as existing messages. + [31c947366e1b] + + * extras/lupdate/translation_file.py: + Improved the layout of the pylupdate summary. + [6547208726b2] + + * extras/lupdate/designer_source.py: + Properly handle 'string' tag in a .ui file. + [993587caab3f] + +2020-12-24 Phil Thompson + + * PyQt6.msp: + Disable default ctors for all QtGui events. + [aafee11e4e11] + + * PyQt6.msp: + QtCore QEvent sub-classes have no default ctors. + [78c8029521bd] + + * PyQt6.msp: + More readData() and writeData() fixes. + [5d5e55086619] + + * PyQt6.msp: + Fixed readData() and writeData() handwritten code. + [a9517b9e3b93] + + * PyQt6.msp: + Remove some PyQt5 Windows-specific methods. + [5d153a6d8ca8] + + * PyQt6.msp: + Use Py_hash_t and Py_ssize_t where required. + [349f062273ae] + +2020-12-23 Phil Thompson + + * extras/lupdate/translation_file.py: + Fix pylupdate when comparing messages. Indent the .ts file XML when + using Python v3.9 and later. + [9bc99ae6c985] + + * extras/lupdate/designer_source.py, extras/lupdate/python_source.py: + Ignore empty strings in .py and .ui files. + [ca36f83cc200] + +2020-12-22 Phil Thompson + + * extras/lupdate/python_source.py: + pylupdate fixes for handling the third argument to tr(). + [2cb451473d69] + +2020-12-21 Phil Thompson + + * projects/PyQt3D6/pyproject.toml, projects/PyQt6/pyproject.toml, + projects/PyQtChart6/pyproject.toml, + projects/PyQtDataVisualization6/pyproject.toml, + projects/PyQtPurchasing6/pyproject.toml, + projects/PyQtWebEngine6/pyproject.toml: + PyQt-builder v1.7 will be required. + [52b5da7e6bc5] + + * test/metaobject/test_pyqtproperty.py: + Restored the test of using the property system for enums now that + SIP generates the necessary calls to qMetaTypeId(). + [c186ae30acf7] + +2020-12-20 Phil Thompson + + * test/metaobject/test_pyqtproperty.py, + test/metaobject/test_qvariantmap.py: + Fixed the outstanding tests. + [ef8f637e7e04] + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h, + test/classes/test_QVariant.py: + Fixed the conversions of QVariantMap, QVariantList etc. to Python. + [4ae02d5f28c7] + +2020-12-19 Phil Thompson + + * qpy/QtCore/qpycore_chimera.cpp: + Refactored the mapped type convertors. + [6aed0cfc99eb] + + * PyQt6.msp, qpy/QtCore/qpycore_qvector.sip: + Removed all uses of QVector. + [0c7ecfe2445b] + + * qpy/QtCore/qpycore_chimera.cpp, test/classes/test_QVariant.py: + Fixed the convert of dict to QVariant with a non-string key. + [05f3e9d38191] + + * extras/uic/enum_map.py, extras/uic/properties.py, + test/pyuic/QWidget/Widget03.ui: + More pyuic fixes. + [1e6a643a923f] + + * PyQt6.msp: + Qt::Alignment has to be IntFlag because the various + setTextAlignment() methods expect an int argument. + [a25cba5fd69b] + + * PyQt6.msp: + QFont.StyleStrategy contains flags. + [b87c02c16962] + + * PyQt6.msp: + QFont.setWeight() will now accept an int and a QFont.Weight. + QFont.weight() returns an int. + [1b235c631f79] + + * extras/uic/enum_map.py, extras/uic/properties.py, + test/pyuic/test_pyuic.py: + pyuic fixes. + [70f4487e467a] + +2020-12-18 Phil Thompson + + * test/classes/test_QVariant.py, test/dbus/test_multibus.py, + test/mapped_types/test_QList.py, + test/metaobject/test_pyqtproperty.py, + test/metaobject/test_qvariantmap.py, test/misc/test_repr.py, + test/pyuic/test_pyuic.py: + Initial pass through the unit tests. + [b462ad16d2dc] + + * projects/PyQt6/project.py: + Specify the minimum versions of glibc and macOS. + [d3934fa19d77] + + * qpy/QtQml/qmlregistertype.sip, qpy/QtQml/qpyqml_register_type.cpp: + Removed some code needed by (unsupported) versions of GCC. + [303bea01c4c8] + + * qpy/QtQml/qmlregistertype.sip, qpy/QtQml/qpyqml_api.h, + qpy/QtQml/qpyqml_register_type.cpp: + Implemented qmlRegisterAnonymousType() and + qmlRegisterSingletonInstance(). + [d4822fe422bd] + + * qpy/QtQml/qmlattachedpropertiesobject.sip, + qpy/QtQml/qmlregistertype.sip, qpy/QtQml/qpyqml_api.h, + qpy/QtQml/qpyqml_register_type.cpp: + Fixed support for attached properties. + [7132f63b9927] + + * examples/qml/referenceexamples/binding.py, + examples/qml/referenceexamples/valuesource.py: + QMl example fixes. + [9e9c4e5ce94d] + +2020-12-17 Phil Thompson + + * examples/qml/referenceexamples/default.py: + Fixed the default.py QML example. + [7b737e4d1cdb] + + * qpy/QtQml/qpyqml_post_init.cpp: + Fix QML list properties. + [9d9536278e60] + + * qpy/QtQml/qpyqml_post_init.cpp: + Removed a legacy cast. + [cc23f3eb651a] + +2020-12-16 Phil Thompson + + * extras/lupdate/python_source.py: + Gracefully handle syntax errors in Python source files. + [7edaf6316381] + + * extras/lupdate/lupdate.py, extras/lupdate/pylupdate.py, + extras/lupdate/translation_file.py: + Existing translations will be used where possible. A summary + (suppressable using the --no-summary option) is displayed. + [1c3fb51b4aa3] + + * extras/lupdate/lupdate.py, extras/lupdate/pylupdate.py, + extras/lupdate/translation_file.py: + Added support for the --no-obsolete option and obsolete messages. + [efd4f9451f59] + +2020-12-14 Phil Thompson + + * modules/QtAndroidExtras/QtAndroidExtrasmod.sip, + modules/QtAndroidExtras/qandroidjniobject.sip, + modules/QtAndroidExtras/qtandroid.sip, + modules/QtMacExtras/QtMacExtrasmod.sip, + modules/QtMacExtras/qmacpasteboardmime.sip, + modules/QtMacExtras/qmactoolbar.sip, + modules/QtMacExtras/qmactoolbaritem.sip, + modules/QtMacExtras/qtmac.sip, + modules/QtWinExtras/QtWinExtrasmod.sip, + modules/QtWinExtras/qwinfunctions.sip, + modules/QtWinExtras/qwinjumplist.sip, + modules/QtWinExtras/qwinjumplistcategory.sip, + modules/QtWinExtras/qwinjumplistitem.sip, + modules/QtWinExtras/qwintaskbarbutton.sip, + modules/QtWinExtras/qwintaskbarprogress.sip, + modules/QtWinExtras/qwinthumbnailtoolbar.sip, + modules/QtWinExtras/qwinthumbnailtoolbutton.sip, + modules/QtX11Extras/QtX11Extrasmod.sip, + modules/QtX11Extras/qx11info_x11.sip, projects/PyQt6/project.py: + Removed the legacy "Extras" modules. + [774b4acf6f22] + + * qpy/QtCore/qpycore_api.h, qpy/QtCore/qpycore_init.cpp, + qpy/QtCore/qpycore_public_api.cpp: + Don't call the QCoreApplication dtor if we didn't call the ctor. + [d947284f2b92] + +2020-12-11 Phil Thompson + + * PyQt6.msp: + Updated for Qt v6.0.0. + [179cebdaa175] + +2020-12-09 Phil Thompson + + * extras/uic/enum_map.py, extras/uic/properties.py: + Completed the pyuic changes. + [01faaf18f852] + + * PyQt6.msp: + Removed some internal enum members. Enums no longer have to be + constrained. + [13c2f924f71d] + +2020-12-08 Phil Thompson + + * extras/uic/Compiler/qtproxies.py, extras/uic/enum_map.py, + extras/uic/properties.py: + pyuic fixes. + [b01d8894edc7] + + * PyQt6.msp: + Removed a couple of internal enum members. + [d7873d822d39] + + * PyQt6.msp: + Fixed creating a QColor from a GlobalColor. + [63928f38b8a0] + + * PyQt6.msp: + Fixed the creation of a QCursor from a CursorShape. + [a58b5cbd3860] + +2020-12-07 Phil Thompson + + * PyQt6.msp: + Added QImage.setAlphaChannel(). + [6df3e04649ef] + +2020-12-05 Phil Thompson + + * extras/uic/properties.py: + Fixed scoped types in pyuic when loading a .ui file. + [c7bec57b9d88] + + * PyQt6.msp: + Removed the QT_MAC_WANTS_LAYER workaround as it's not needed with + Qt6. + [ac7bd5f81f99] + + * extras/uic/compile_ui.py, extras/uic/enum_map.py, + extras/uic/properties.py, extras/uic/uiparser.py: + Initial support for fully scoped enums in pyuic. + [3545be202518] + + * extras/uic/uiparser.py: + Fixed pyuic handling of size policies. + [9cbd62c0f5ec] + + * extras/uic/uiparser.py: + pyuic fixes for form layouts. + [145e473b3550] + +2020-12-03 Phil Thompson + + * PyQt6.msp, examples/qml/referenceexamples/attached.py, + examples/qml/referenceexamples/binding.py, + examples/qml/referenceexamples/default.py, + examples/qml/referenceexamples/grouped.py, + examples/qml/referenceexamples/signal.py, + examples/qml/referenceexamples/valuesource.py, + qpy/QtCore/qpycore_classinfo.cpp, + test/metaobject/test_qclassinfo.py: + Changed the signature of pyqtClassInfo() because QML uses characters + that cannot be used in a Python identifier. + [19103b6b0443] + + * PyQt6.msp: + Updated for Qt v6.0.0rc2. + [71d325f6834f] + +2020-12-02 Phil Thompson + + * examples/qml/referenceexamples/adding.py, + examples/qml/referenceexamples/attached.py, + examples/qml/referenceexamples/binding.py, + examples/qml/referenceexamples/coercion.py, + examples/qml/referenceexamples/default.py, + examples/qml/referenceexamples/grouped.py, + examples/qml/referenceexamples/methods.py, + examples/qml/referenceexamples/properties.py, + examples/qml/referenceexamples/signal.py, + examples/qml/referenceexamples/valuesource.py: + Added the QML examples. + [9adff8784705] + + * qpy/QtCore/qpycore_qmetaobjectbuilder.h, + qpy/QtCore/qpycore_types.cpp, qpy/QtQml/qmlregistertype.sip, + qpy/QtQml/qpyqml_register_singleton_type.cpp, + qpy/QtQml/qpyqml_register_type.cpp, + qpy/QtQml/qpyqmllistproperty.cpp: + The QML registration functions now have the name as the last, and + optional, argument. The default name is taken from the type being + registered. + [faebb54b01c6] + +2020-12-01 Phil Thompson + + * PyQt6.msp: + Fixed the fully qualified names of the sip builtin types. + [f970363f81be] + + * PyQt6.msp: + Removed the resource system hooks. + [c6125be2d315] + + * PyQt6.msp, projects/PyQt6/config-tests/cfgtest_QtCore.cpp, + projects/PyQt6/config-tests/cfgtest_QtNetwork.cpp, projects/PyQt6 + /config-tests/cfgtest_QtPrintSupport.cpp: + Updated the feature configuration tests. + [07499ea2808f] + +2020-11-30 Phil Thompson + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Ported QtQuick3D and QtQuickWidgets. + [24558dbbb5ba] + + * PyQt6.msp, qpy/QtQuick/qpyquick_chimera_helpers.cpp, + qpy/QtQuick/qpyquick_chimera_helpers.h, + qpy/QtQuick/qpyquickframebufferobject.cpp, + qpy/QtQuick/qpyquickitem.cpp, qpy/QtQuick/qpyquickpainteditem.cpp, + qpy/QtQuick/qpyquickview.cpp, qpy/QtQuick/qpyquickwindow.cpp: + Completed QtQuick (for now). + [82cd622c8b75] + +2020-11-29 Phil Thompson + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py, + qpy/QtCore/qbytearraylist.sip: + First pass through QtQuick. + [b08ce1c79954] + + * PyQt6.msp, extras/qmlscene/pluginloader.cpp, projects/PyQt6/Modules, + projects/PyQt6/project.py, + qpy/QtQml/qmlattachedpropertiesobject.sip, + qpy/QtQml/qmlregistertype.sip, qpy/QtQml/qpyqml_api.h, + qpy/QtQml/qpyqml_register_singleton_type.cpp, + qpy/QtQml/qpyqml_register_type.cpp, + qpy/QtQml/qpyqmllistproperty.cpp: + Ported QtQml. + [d77190c8d22c] + +2020-11-28 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qpycore_qlist.sip, + qpy/QtCore/qpycore_qpair.sip, qpy/QtCore/qpycore_std_pair.sip, + qpy/QtGui/opengl_types.sip, qpy/QtOpenGL/qpyopengl_api.h, + qpy/QtOpenGL/qpyopengl_array_convertors.cpp, + qpy/QtOpenGL/qpyopengl_data_cache.h, + qpy/QtOpenGL/qpyopengl_std_pair.sip, + qpy/QtOpenGL/qpyopengl_value_array.cpp, + qpy/QtOpenGL/qpyopengl_version_functions.cpp: + Completed the port of QtOpenGL. + [5c4bbe555837] + +2020-11-27 Phil Thompson + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/QtGui.versions, + projects/PyQt6/config-tests/cfgtest_QtGui.cpp, + projects/PyQt6/project.py, qpy/QtCore/qpycore_qlist.sip, + qpy/QtGui/opengl_types.sip, + qpy/QtOpenGL/qpyopengl_add_constants.cpp, + qpy/QtOpenGL/qpyopengl_api.h, + qpy/QtOpenGL/qpyopengl_array_convertors.cpp, + qpy/QtOpenGL/qpyopengl_attribute_array.cpp, + qpy/QtOpenGL/qpyopengl_data_cache.cpp, + qpy/QtOpenGL/qpyopengl_data_cache.h, qpy/QtOpenGL/qpyopengl_get.cpp, + qpy/QtOpenGL/qpyopengl_init.cpp, qpy/QtOpenGL/qpyopengl_qlist.sip, + qpy/QtOpenGL/qpyopengl_qpair.sip, + qpy/QtOpenGL/qpyopengl_qvector.sip, + qpy/QtOpenGL/qpyopengl_std_pair.sip, + qpy/QtOpenGL/qpyopengl_uniform_value_array.cpp, + qpy/QtOpenGL/qpyopengl_value_array.cpp, + qpy/QtOpenGL/qpyopengl_version_functions.cpp, + tools/OpenGL/gen_opengl_constants.py: + Initial pass through the port of QtOpenGL. + [9758fa02a55c] + +2020-11-26 Phil Thompson + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Ported QtXml. + [34d6ae39f52a] + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Ported QtTest. + [f659109b0fd0] + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Ported QtSvg. + [492a7a4e2f60] + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Ported QtSql. + [283705efb009] + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/QtCore.versions, + projects/PyQt6/QtGui.versions, + projects/PyQt6/QtPrintSupport.versions, projects/PyQt6/project.py, + qpy/QtPrintSupport/qpyprintsupport_qlist.sip: + Ported QtPrintSupport. + [7200dec0095d] + + * PyQt6.msp: + Updated for Qt v6.0.0rc. + [22d7178b9d61] + +2020-11-25 Phil Thompson + + * PyQt6.msp: + Eliminated all remaining warning messages. + [ffddad72bcfe] + + * PyQt6.msp, projects/PyQt6/project.py: + Ensure that the buffer protocol can be used for all writeData() + implementations. + [8b67fd2bc643] + + * PyQt6.msp, projects/PyQt6/Modules, + projects/PyQt6/QtNetwork.versions, projects/PyQt6/project.py: + Ported QtNetwork. + [4f350f4cdc7c] + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Ported QtHelp. + [f93cd8d1b207] + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Ported QtDesigner. + [3233b05fde65] + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Ported QtDBus. + [e1491e940d08] + + * PyQt6.msp, qpy/QtWidgets/qmaccocoaviewcontainer.sip: + QtWidgets now builds without warnings. + [44f1bc2ac21e] + +2020-11-24 Phil Thompson + + * PyQt6.msp: + Completed the porting of QtWidgets. + [7b141726025e] + +2020-11-23 Phil Thompson + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Work on QtWidgets. + [9b3edac520d2] + +2020-11-22 Phil Thompson + + * PyQt6.msp: + QImage fixes. + [f74c666a81d5] + +2020-11-21 Phil Thompson + + * PyQt6.msp: + Completed the QtGui implementation. + [2d14a1a4c258] + + * PyQt6.msp: + Added the QObject sub-class code for QtGui. + [31609a1eb40f] + + * PyQt6.msp: + Completed the QEvent support in QtGui. + [959c175bdc0d] + +2020-11-20 Phil Thompson + + * projects/PyQt6/Modules, projects/PyQt6/project.py: + Don't generate .sip files for modules not yet ported. + [c7cba18d2b0c] + + * PyQt6.msp, projects/PyQt6/Modules, projects/PyQt6/project.py: + Removed the internal version-specific OpenGL modules. + [45b963fea98c] + + * PyQt6.msp: + QtGui now builds without warnings. + [ab05d3ffc6af] + + * PyQt6.msp, projects/PyQt6/project.py, qpy/QtCore/qpycore_qlist.sip, + qpy/QtGui/opengl_types.sip, qpy/QtGui/qpygui_qpair.sip, + qpy/QtGui/qpygui_qvector.sip, qpy/QtOpenGL/opengl_types.sip, + qpy/QtOpenGL/qpyopengl_qpair.sip, + qpy/QtOpenGL/qpyopengl_qvector.sip: + Fixes so that SIP parses QtGui. + [d6787031f3f4] + + * PyQt6.msp, qpy/QtGui/opengl_types.sip, + qpy/QtGui/qpyopengl_add_constants.cpp, qpy/QtGui/qpyopengl_api.h, + qpy/QtGui/qpyopengl_array_convertors.cpp, + qpy/QtGui/qpyopengl_attribute_array.cpp, + qpy/QtGui/qpyopengl_data_cache.cpp, + qpy/QtGui/qpyopengl_data_cache.h, qpy/QtGui/qpyopengl_get.cpp, + qpy/QtGui/qpyopengl_init.cpp, qpy/QtGui/qpyopengl_misc.h, + qpy/QtGui/qpyopengl_uniform_value_array.cpp, + qpy/QtGui/qpyopengl_value_array.cpp, + qpy/QtGui/qpyopengl_version_functions.cpp, + qpy/QtOpenGL/opengl_types.sip, + qpy/QtOpenGL/qpyopengl_add_constants.cpp, + qpy/QtOpenGL/qpyopengl_api.h, + qpy/QtOpenGL/qpyopengl_array_convertors.cpp, + qpy/QtOpenGL/qpyopengl_attribute_array.cpp, + qpy/QtOpenGL/qpyopengl_data_cache.cpp, + qpy/QtOpenGL/qpyopengl_data_cache.h, qpy/QtOpenGL/qpyopengl_get.cpp, + qpy/QtOpenGL/qpyopengl_init.cpp, qpy/QtOpenGL/qpyopengl_misc.h, + qpy/QtOpenGL/qpyopengl_uniform_value_array.cpp, + qpy/QtOpenGL/qpyopengl_value_array.cpp, + qpy/QtOpenGL/qpyopengl_version_functions.cpp: + Moved the OpenGL stuff from QtGui to QtOpenGL. + [da79c41d0698] + +2020-11-19 Phil Thompson + + * PyQt6.msp: + Completed the initial run through of QtGui. + [4f49b6ee5b8c] + + * PyQt6.msp: + Moe work on QtGui. + [fea98385a350] + + * PyQt6.msp: + More work on QtGui. + [5b033bc6d3f0] + +2020-11-18 Phil Thompson + + * PyQt6.msp: + Work on QtGui. + [81e9984ec299] + + * PyQt6.msp: + Removed some redundant %MethodCode. + [6218efb96825] + + * PyQt6.msp: + Added the QObject sub-class convertor code. + [cedfb4d930d4] + + * tools/mksccode.py: + Fixed the script for generating sub-class convertor code. + [fb15c90fb5ce] + + * PyQt6.msp: + Implemented the operator|() overloads that create a QKeyCombination. + [8f4131e92e48] + +2020-11-17 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qmutexlocker.sip, + qpy/QtCore/qpycore_pyqtmutexlocker.cpp, + qpy/QtCore/qpycore_pyqtmutexlocker.h: + Implemented QMutexLocker. + [72c25137e386] + +2020-11-16 Phil Thompson + + * PyQt6.msp: + Finish QMutex. + [f6c686dc795a] + + * PyQt6.msp: + Fixed some minor TODOs. + [1f6556f41d57] + + * PyQt6.msp: + Updated QCborStreamWriter. + [e84c4ca54da3] + + * PyQt6.msp: + Updated QCborStreamReader. + [dc0d7dcf5cc8] + + * PyQt6.msp, qpy/QtCore/qpycore_api.h, qpy/QtCore/qpycore_chimera.cpp, + qpy/QtCore/qpycore_qvariantmap.cpp, + qpy/QtCore/qpycore_qvariantmap.sip: + Removed the old QVariantMap support. + [960789898bc5] + + * qpy/QtCore/qpycore_chimera.cpp: + Refactored the QVariantMap support. + [1d3795e9e8ad] + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h: + Refactored the QVariantHash support. + [f23c4e26dc86] + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h: + Refactored the QVariantList support. + [11504464fe75] + + * PyQt6.msp, qpy/QtCore/qpycore_chimera.cpp, + qpy/QtCore/qpycore_chimera.h: + Added support for QVariantPair. + [2c8990b62862] + +2020-11-15 Phil Thompson + + * qpy/QtCore/qpycore_chimera.cpp: + Added support for QMetaType::Nullptr. + [fa10c713aedf] + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h: + Added support for QMetaType::Char16 and QMetaType::Char32. + [b382e36d4a51] + + * qpy/QtCore/qpycore_chimera.cpp: + Don't handle a 'char *' as a QString (or as a bytes object as PyQt5) + when parsing a C++ type specified as a string. + [204855e7571e] + + * PyQt6.msp: + Updated for Qt v6.0.0.0beta5. + [c51cc6316690] + +2020-11-14 Phil Thompson + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h, + qpy/QtCore/qpycore_chimera_storage.cpp, + qpy/QtCore/qpycore_post_init.cpp.in, + qpy/QtCore/qpycore_public_api.cpp, qpy/QtCore/qpycore_public_api.h, + qpy/QtCore/qpycore_pyqtboundsignal.cpp, + qpy/QtCore/qpycore_pyqtpyobject.cpp, + qpy/QtCore/qpycore_pyqtpyobject.h, + qpy/QtCore/qpycore_qvariant_value.cpp, qpy/QtCore/qpycore_types.cpp: + QtCore now builds without compiler warnings. + [5c62dfc70218] + +2020-11-13 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qpycore_chimera.cpp, + qpy/QtCore/qpycore_pyqtsignal.cpp, qpy/QtCore/qpycore_pyqtslot.cpp, + qpy/QtCore/qpycore_qstring.cpp, + qpy/QtCore/qpycore_qvariant_value.cpp: + Remove deprecated API elements. + [4355f4316eba] + +2020-11-12 Phil Thompson + + * PyQt6.msp: + Updated for Qt v6.0.0.0beta4. + [ddf87413aa33] + + * PyQt6.msp, qpy/QtCore/qpycore_post_init.cpp.in, + qpy/QtCore/qpycore_public_api.cpp, + qpy/QtCore/qpycore_pyqtslotproxy.cpp, + qpy/QtCore/qpycore_pyqtslotproxy.h, + qpy/QtCore/qpycore_qobject_helpers.cpp: + The QtCore module now builds and can be imported. + [4c45e3aa0d68] + + * PyQt6.msp: + Bug fixes. + [ea3efdf4c3a2] + +2020-11-11 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qbytearrayview.sip, + qpy/QtCore/qpycore_chimera.cpp, + qpy/QtCore/qpycore_chimera_storage.cpp, qpy/QtCore/qsysinfo.sip: + Bug fixes. + [d1733bcde2d0] + + * PyQt6.msp: + Removed QModelRoleDataSpan because it is inappropriate in a Python + context. + [f29867eac956] + + * PyQt6.msp: + The QtCore code is now generated. + [325f92fe27dc] + +2020-11-10 Phil Thompson + + * PyQt6.msp, projects/PyQt6/project.py, qpy/QtCore/qbytearrayview.sip, + qpy/QtCore/qpycore_qlist.sip, qpy/QtCore/qpycore_qvector.sip, + qpy/QtCore/qstring.sip, qpy/QtCore/qstringview.sip: + More work on QtCore. + [3bf0bb52a577] + +2020-11-09 Phil Thompson + + * PyQt6.msp: + Updated QtCore for Qt v6.0.0beta3. + [8fc0f04e50de] + +2020-11-05 Phil Thompson + + * PyQt6.msp: + Refactored the QIODevice methods in QtCore. + [41825eabd9ef] + +2020-11-04 Phil Thompson + + * PyQt6.msp: + QIODevice updates. + [b29cf9904968] + + * PyQt6.msp: + Completed the initial pass of QtCore. + [be3d02b2c14a] + + * PyQt6.msp: + More work on QtCore. + [a7d1ca9ba59d] + +2020-11-03 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qchar.sip: + More work on QtCore. + [abaae2bba4aa] + +2020-11-01 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qbytearrayview.sip: + Re-factored the QByteArray support. + [98b7277f1167] + +2020-10-28 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qstring.sip: + Move qstring.sip out of the project. + [01aeac0b5e87] + + * PyQt6.msp: + More work on QtCore. + [2025096ebd84] + +2020-10-25 Phil Thompson + + * PyQt6.msp: + Updating of some QtCore classes. + [df82a8e5f31c] + +2020-10-24 Phil Thompson + + * projects/PyQt3D6/pyproject.toml, projects/PyQtChart6/pyproject.toml, + projects/PyQtDataVisualization6/pyproject.toml, + projects/PyQtPurchasing6/pyproject.toml, + projects/PyQtWebEngine6/pyproject.toml: + Updated the pyproject.toml files now that Qt6 is being used. + [333636927a25] + + * PyQt6.msp, projects/PyQt6/project.py: + Scan QtCore from Qt v6.0.0beta removing the .sip files for the + corresponding removed .h files. + [6ee9b41573b9] + +2020-10-23 Phil Thompson + + * extras/lupdate/designer_source.py: + Provided a comment about the element. + [0b27ecd8b925] + + * extras/lupdate/translation_file.py: + .ts files created from .ui files now contain location information. + [7783517e0365] + + * extras/lupdate/designer_source.py, extras/uic/ui_file.py: + pylupdate now handles the attributes of a string element in a .ui + file. + [9a55e5300725] + + * extras/lupdate/designer_source.py, extras/lupdate/lupdate.py, + extras/lupdate/pylupdate.py, extras/lupdate/python_source.py, + extras/lupdate/source_file.py, extras/lupdate/translation_file.py, + extras/uic/compile_ui.py, extras/uic/ui_file.py, + extras/uic/uiparser.py: + pylupdate will now handle .ui files. + [551b6804f90c] + +2020-10-22 Phil Thompson + + * extras/uic/__init__.py, extras/uic/exceptions.py, + extras/uic/pyuic.py, extras/uic/ui_file.py, extras/uic/uiparser.py: + Refactor the parsing of a .ui file so it can be reused by pylupdate. + [27ae3f8ba09e] + +2020-10-10 Phil Thompson + + * PyQt6.msp: + QObject.tr() is now implemented as a class method so it can be + called with an explicit context. + [a6af3664d65a] + +2020-10-09 Phil Thompson + + * extras/lupdate/python_source.py, extras/lupdate/translation_file.py, + extras/lupdate/translations.py: + Added support for embedded translator comments to pylupdate. + [36e006df69cb] + +2020-10-08 Phil Thompson + + * extras/lupdate/translation_file.py: + Added the 'numerusform' tag when required. + [a08ac34a887e] + + * extras/lupdate/lupdate.py, extras/lupdate/pylupdate.py, + extras/lupdate/python_source.py: + A directory can be specified as well as the name of a Python file. + [1181e4c8cd61] + + * extras/lupdate/translation_file.py: + Contexts are now sorted by their name. + [7458543602c6] + + * extras/lupdate/translation_file.py: + There is no need to use escape() as etree handles it automatically. + [31e3a843636a] + + * extras/lupdate/python_source.py, extras/lupdate/translation_file.py: + Context names now include any scoping class. + [1c753b1b3c2c] + + * extras/lupdate/translation_file.py: + Fixed the updating of a message location. + [6b151a4e4c6e] + + * extras/lupdate/translation_file.py, extras/lupdate/user.py: + Improve the dispay of source text in progress messages. + [d81c802ed873] + + * extras/lupdate/translation_file.py: + The Python source filename is relative to the .ts filename. + [3db8d5efaeae] + + * extras/lupdate/pylupdate.py: + Improvements to the error report text. + [8fa461638929] + + * extras/lupdate/exceptions.py, extras/lupdate/lupdate.py, + extras/lupdate/messages.py, extras/lupdate/pylupdate.py, + extras/lupdate/python_source.py, extras/lupdate/translation_file.py, + extras/lupdate/user.py: + Added the --verbose flag to pylupdate. + [bebff95dab1d] + +2020-10-06 Phil Thompson + + * extras/lupdate/exceptions.py, extras/lupdate/lupdate.py, + extras/lupdate/messages.py, extras/lupdate/pylupdate.py, + extras/lupdate/python_source.py, extras/lupdate/translation_file.py: + Added the messaging and error handling infrastructure. + [0bb5ca9f9a86] + + * extras/lupdate/python_source.py, extras/lupdate/translation_file.py, + extras/lupdate/translations.py: + Completed the initial implementation of pylupdate. + [3cda34ff4e37] + +2020-10-04 Phil Thompson + + * extras/lupdate/__init__.py, extras/lupdate/lupdate.py, + extras/lupdate/pylupdate.py, extras/lupdate/python_source.py, + extras/lupdate/translation_file.py, + extras/pylupdate/lupdate/__init__.py, + extras/pylupdate/lupdate/lupdate.py, + extras/pylupdate/lupdate/pylupdate.py, + extras/pylupdate/lupdate/python_source.py, + extras/pylupdate/lupdate/translation_file.py, + extras/pyuic/uic/Compiler/__init__.py, + extras/pyuic/uic/Compiler/as_string.py, + extras/pyuic/uic/Compiler/compiler.py, + extras/pyuic/uic/Compiler/indenter.py, + extras/pyuic/uic/Compiler/misc.py, + extras/pyuic/uic/Compiler/proxy_metaclass.py, + extras/pyuic/uic/Compiler/qobjectcreator.py, + extras/pyuic/uic/Compiler/qtproxies.py, + extras/pyuic/uic/Loader/__init__.py, + extras/pyuic/uic/Loader/loader.py, + extras/pyuic/uic/Loader/qobjectcreator.py, + extras/pyuic/uic/__init__.py, extras/pyuic/uic/compile_ui.py, + extras/pyuic/uic/exceptions.py, extras/pyuic/uic/icon_cache.py, + extras/pyuic/uic/load_ui.py, extras/pyuic/uic/objcreator.py, + extras/pyuic/uic/properties.py, extras/pyuic/uic/pyuic.py, + extras/pyuic/uic/uiparser.py, extras/pyuic/uic/widget- + plugins/qaxcontainer.py, extras/pyuic/uic/widget- + plugins/qscintilla.py, extras/pyuic/uic/widget-plugins/qtcharts.py, + extras/pyuic/uic/widget-plugins/qtprintsupport.py, extras/pyuic/uic + /widget-plugins/qtquickwidgets.py, extras/pyuic/uic/widget- + plugins/qtwebenginewidgets.py, extras/uic/Compiler/__init__.py, + extras/uic/Compiler/as_string.py, extras/uic/Compiler/compiler.py, + extras/uic/Compiler/indenter.py, extras/uic/Compiler/misc.py, + extras/uic/Compiler/proxy_metaclass.py, + extras/uic/Compiler/qobjectcreator.py, + extras/uic/Compiler/qtproxies.py, extras/uic/Loader/__init__.py, + extras/uic/Loader/loader.py, extras/uic/Loader/qobjectcreator.py, + extras/uic/__init__.py, extras/uic/compile_ui.py, + extras/uic/exceptions.py, extras/uic/icon_cache.py, + extras/uic/load_ui.py, extras/uic/objcreator.py, + extras/uic/properties.py, extras/uic/pyuic.py, + extras/uic/uiparser.py, extras/uic/widget-plugins/qaxcontainer.py, + extras/uic/widget-plugins/qscintilla.py, extras/uic/widget- + plugins/qtcharts.py, extras/uic/widget-plugins/qtprintsupport.py, + extras/uic/widget-plugins/qtquickwidgets.py, extras/uic/widget- + plugins/qtwebenginewidgets.py, projects/PyQt6/project.py: + Simplified the directory structure of pyuic and pylupdate. + [65479b8446aa] + + * extras/pylupdate/lupdate/__init__.py, + extras/pylupdate/lupdate/lupdate.py, + extras/pylupdate/lupdate/pylupdate.py, + extras/pylupdate/lupdate/python_source.py, + extras/pylupdate/lupdate/translation_file.py, + extras/pylupdate/pylupdate_main.py, + extras/pylupdate/pylupdatemod.sip, projects/PyQt6/project.py: + Added the stub of the pylupdate6 implementation. + [4922d727e586] + + * extras/pyuic/uic/pyuic.py: + Fixed the name of pyuic6. + [9e2d19ebf2bb] + + * extras/designer/pluginloader.cpp, extras/qmlscene/pluginloader.cpp: + Eliminate deprecation warnings from Python v3.9. + [ed7abf162983] + + * PyQt6.msp: + Ensure QtQuick will build without OpenGL. + [a70f17b8c38c] + +2020-10-03 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qpycore_enums_flags.cpp: + pyqtEnum() now makes use of SIP_PYENUM and sipIsEnumFlag(). + [02632981bade] + + * qpy/QtCore/qpycore_enums_flags.cpp, + qpy/QtCore/qpycore_enums_flags.h, qpy/QtCore/qpycore_types.cpp: + Use a better data type for holding parsed enum members. + [5a1bc01a7c46] + + * qpy/QtCore/qpycore_classinfo.cpp, qpy/QtCore/qpycore_classinfo.h, + qpy/QtCore/qpycore_decorators.cpp, + qpy/QtCore/qpycore_enums_flags.cpp, qpy/QtCore/qpycore_misc.cpp, + qpy/QtCore/qpycore_misc.h, qpy/QtCore/qpycore_pyqtboundsignal.cpp, + qpy/QtCore/qpycore_pyqtconfigure.cpp, + qpy/QtCore/qpycore_pyqtsignal.cpp, + qpy/QtCore/qpycore_qmetaobject_helpers.cpp, + qpy/QtCore/qpycore_types.cpp: + Check the arguments of pyqtClassInfo when they are passed rather + than when they are used. + [7286db7eec67] + + * PyQt6.msp, qpy/QtCore/qpycore_api.h, + qpy/QtCore/qpycore_classinfo.cpp, + qpy/QtCore/qpycore_enums_flags.cpp, + qpy/QtCore/qpycore_enums_flags.h, qpy/QtCore/qpycore_types.cpp, + test/metaobject/test_qenum.py: + Replaced Q_ENUM and Q_FLAG with pyqtEnum. + [f6df9d5af282] + +2020-10-02 Phil Thompson + + * qpy/QtCore/qpycore_pyqtboundsignal.cpp, + qpy/QtCore/qpycore_pyqtconfigure.cpp, + qpy/QtCore/qpycore_qobject_helpers.cpp, + qpy/QtCore/qpycore_types.cpp: + Improved the method of ensuring the QMetaObject is created in time. + [a386fa108f2c] + + * qpy/QtCore/qpycore_pyqtboundsignal.cpp, + qpy/QtCore/qpycore_qobject_helpers.cpp, + qpy/QtCore/qpycore_types.cpp, qpy/QtCore/qpycore_types.h: + Ensure the QMetaObject is created in time. + [1f0154cd9c57] + + * PyQt6.msp, qpy/QtCore/qpycore_api.h, + qpy/QtCore/qpycore_classinfo.cpp, qpy/QtCore/qpycore_classinfo.h, + qpy/QtCore/qpycore_post_init.cpp.in, qpy/QtCore/qpycore_types.cpp, + qpy/QtCore/qpycore_types.h, test/metaobject/test_qclassinfo.py: + A QMetaObject is now created when referenced rather than when the + QObject sub-class is defined. Replaced Q_CLASSINFO with the + pyqtClassInfo class decorator. + [478204118318] + +2020-10-01 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qpycore_api.h, qpy/QtCore/qpycore_chimera.h, + qpy/QtCore/qpycore_enums_flags.cpp, + qpy/QtCore/qpycore_enums_flags.h, test/metaobject/test_qenum.py: + Removed support for Q_ENUMS and Q_FLAGS. + [04924904e31b] + + * test/metaobject/test_qclassinfo.py: + Added the Q_CLASSINFO unit test. + [1780fdda45b8] + +2020-09-28 Phil Thompson + + * PyQt6.msp: + Removed the unused qsql.h file. + [14ff91794411] + + * PyQt6.msp: + Added a missing /TransferBack/ annotation to QLayout.removeWidget(). + [a98e3346fddd] + +2020-09-25 Phil Thompson + + * projects/PyQt3D6/pyproject.toml, projects/PyQtChart6/pyproject.toml, + projects/PyQtDataVisualization6/pyproject.toml, + projects/PyQtPurchasing6/pyproject.toml, + projects/PyQtWebEngine6/pyproject.toml: + Fixed the temporary specification of the ABI version. + [1e66bd83ae93] + + * test/pyuic/test_pyuic.py: + All unit tests now pass (except for the one pyuic expected failure). + [5bc0c7ad9c31] + + * extras/pyuic/uic/Compiler/compiler.py, + extras/pyuic/uic/Loader/loader.py, extras/pyuic/uic/__init__.py, + extras/pyuic/uic/compile_ui.py, extras/pyuic/uic/driver.py, + extras/pyuic/uic/load_ui.py, extras/pyuic/uic/pyuic.py, + extras/pyuic/uic/uiparser.py: + Refactored pyuic and removed support for resource files. + [ced4605bfb06] + +2020-09-24 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qpycore_api.h, + qpy/QtCore/qpycore_pyqtconfigure.cpp, + qpy/QtCore/qpycore_qvariant.cpp, + test/metaobject/test_pyqtproperty.py: + QMetaProperty.read() now correctly handles enum properties. + [baf5b002d176] + + * test/misc/test_pickle.py: + Fixed the unit test for pickling enums. + [e35c7596760d] + + * qpy/QtCore/qpycore_chimera.cpp, test/classes/test_QVariant.py: + Fixes for converting enums to QVariants. + [a58086482403] + + * test/classes/test_QFlags.py: + Removed the QFlags unit test as it would only be testing standard + Python enums. + [1b59859b92d0] + + * PyQt6.msp: + Renamed the enums implementing QFlags. + [24360bd5c4ef] + + * PyQt6.msp: + Don't use /PyName/ to handle clashes with Python keywords now that + SIP v6 will handle it automatically. + [b7050df954a7] + + * PyQt6.msp, qpy/QtCore/qflags.sip: + QFlags is now implemented as enum.Flag. + [1e6401e9e31e] + +2020-09-23 Phil Thompson + + * PyQt6.msp: + Update the PyQt annotations on QUrlTwoFlags. + [0acd56a19476] + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_chimera.h, + qpy/QtCore/qpycore_pyqtsignal.cpp, + qpy/QtCore/qpycore_qobject_helpers.cpp, + qpy/QtCore/qpycore_types.cpp: + Don't assume that there is plugin data for a type. The QFlags flag + is now part of the mapped type plugin. + [0758332c5800] + + * qpy/QtCore/qpycore_chimera.cpp, qpy/QtCore/qpycore_misc.cpp, + qpy/QtCore/qpycore_misc.h, qpy/QtCore/qpycore_qobject_helpers.cpp, + qpy/QtCore/qpycore_types.cpp: + Renamed qpycore_is_pyqt_class() to qpycore_is_pyqt_type(). + [094cb8d31f38] + + * qpy/QtCore/qflags.sip: + Reimplemented QFlags as a mapped type. + [9a06be216246] + + * PyQt6.msp, qpy/QtCore/qflags.sip: + Moved the QFlags implementation out of the project file. + [8a6cea906ea0] + + * extras/pyuic/uic/Loader/loader.py: + Fix pyuic. + [b621768247ea] + +2020-09-21 Phil Thompson + + * projects/PyQt6/project.py: + Fixed a regression in the name of the sip module to be used. + [3a242e9b4743] + +2020-09-18 Phil Thompson + + * projects/PyQt6/project.py: + Check the version of Qt is supported. + [f71b7e5daa26] + +2020-09-17 Phil Thompson + + * projects/PyQt3D6/pyproject.toml, projects/PyQt6/project.py, + projects/PyQtChart6/pyproject.toml, + projects/PyQtDataVisualization6/pyproject.toml, + projects/PyQtPurchasing6/pyproject.toml, + projects/PyQtWebEngine6/pyproject.toml: + Explicity set the ABI version until we start using Qt6. + [b9f688d9255f] + + * projects/PyQt3D6/pyproject.toml, projects/PyQt6/project.py, + projects/PyQt6/pyproject.toml, projects/PyQtChart6/pyproject.toml, + projects/PyQtDataVisualization6/pyproject.toml, + projects/PyQtPurchasing6/pyproject.toml, + projects/PyQtWebEngine6/pyproject.toml: + Require PyQt-builder v1.6 as we no longer specify the sip module and + ABI. + [1ed491e43ee4] + + * PyQt6.msp: + Added the QT_MAC_WANTS_LAYER workaround for missing paint events. + [d89c9fad5d09] + +2020-09-15 Phil Thompson + + * qpy/QtCore/qpycore_pyqtboundsignal.cpp, + test/metaobject/test_pyqtboundsignal.py: + Bound signals are now hashable. + [6fe95eb8c9ca] + +2020-09-14 Phil Thompson + + * PyQt6.msp: + Removed some legacy casts. + [fd0e56cd4bc7] + + * PyQt6.msp: + Removed qApp. + [7abdd4517679] + + * test/classes/test_QQmlComponent.py, test/classes/test_QSignalSpy.py, + test/mapped_types/__init__.py, test/mapped_types/test_QList.py, + test/metaobject/__init__.py, test/metaobject/test_connections.py, + test/metaobject/test_connectslotsbyname.py, + test/metaobject/test_gc_slots.py, test/metaobject/test_invoke.py, + test/metaobject/test_pyqtproperty.py, + test/metaobject/test_pyqtsignal.py, + test/metaobject/test_pyqtslot.py, test/metaobject/test_qenum.py, + test/metaobject/test_qvariantmap.py, test/metaobject/test_sender.py, + test/misc/__init__.py, test/misc/test_pickle.py, + test/misc/test_repr.py, test/pyuic/QMainWindow/MainWindow00.ui, + test/pyuic/QToolBox/ToolBox00.ui, test/pyuic/QToolBox/ToolBox01.ui, + test/pyuic/QWidget/Widget00.ui, test/pyuic/QWidget/Widget01.ui, + test/pyuic/QWidget/Widget02.ui, test/pyuic/QWidget/Widget03.ui, + test/pyuic/QWidget/Widget04.ui, test/pyuic/QWidget/Widget05.ui, + test/pyuic/__init__.py, test/pyuic/test_pyuic.py, + test/tests/mapped_types/__init__.py, + test/tests/mapped_types/test_QList.py, + test/tests/metaobject/__init__.py, + test/tests/metaobject/test_connections.py, + test/tests/metaobject/test_connectslotsbyname.py, + test/tests/metaobject/test_gc_slots.py, + test/tests/metaobject/test_invoke.py, + test/tests/metaobject/test_pyqtproperty.py, + test/tests/metaobject/test_pyqtsignal.py, + test/tests/metaobject/test_pyqtslot.py, + test/tests/metaobject/test_qenum.py, + test/tests/metaobject/test_qvariantmap.py, + test/tests/metaobject/test_sender.py, test/tests/misc/__init__.py, + test/tests/misc/test_pickle.py, test/tests/misc/test_repr.py, + test/tests/pyuic/QMainWindow/MainWindow00.ui, + test/tests/pyuic/QToolBox/ToolBox00.ui, + test/tests/pyuic/QToolBox/ToolBox01.ui, + test/tests/pyuic/QWidget/Widget00.ui, + test/tests/pyuic/QWidget/Widget01.ui, + test/tests/pyuic/QWidget/Widget02.ui, + test/tests/pyuic/QWidget/Widget03.ui, + test/tests/pyuic/QWidget/Widget04.ui, + test/tests/pyuic/QWidget/Widget05.ui, test/tests/pyuic/__init__.py, + test/tests/pyuic/test_pyuic.py: + Completed the initial refactoring of the unit tests. + [eb200713c25e] + +2020-09-12 Phil Thompson + + * test/classes/__init__.py, test/classes/test_QByteArray.py, + test/classes/test_QFlags.py, test/classes/test_QObject.py, + test/classes/test_QQmlComponent.py, test/classes/test_QSettings.py, + test/classes/test_QSignalSpy.py, test/classes/test_QVariant.py, + test/dbus/test_multibus.py, test/runtests.py, + test/tests/__init__.py, test/tests/classes/__init__.py, + test/tests/classes/test_QByteArray.py, + test/tests/classes/test_QFlags.py, + test/tests/classes/test_QObject.py, + test/tests/classes/test_QQmlComponent.py, + test/tests/classes/test_QSettings.py, + test/tests/classes/test_QSignalSpy.py, + test/tests/classes/test_QVariant.py: + Parial refactoring of the unit tests. + [7244f37eb2a2] + +2020-09-11 Phil Thompson + + * PyQt6.msp: + QSGNode fixes from PyQt5. + [572b4061a97a] + + * projects/PyQt6/project.py: + Fixed a typo in the handling of platform tags. + [11cbef1a82d1] + + * projects/PyQt6/project.py: + The full set of platforms tags can now be derived from py_platform. + [7e814ddb9952] + +2020-09-10 Phil Thompson + + * extras/pyuic/uic/Compiler/compiler.py, + extras/pyuic/uic/Compiler/qtproxies.py, + extras/pyuic/uic/Loader/qobjectcreator.py, + extras/pyuic/uic/__init__.py, extras/pyuic/uic/driver.py, + extras/pyuic/uic/pyuic.py, extras/pyuic/uic/uiparser.py, + extras/pyuic/uic/widget-plugins/qaxcontainer.py, extras/pyuic/uic + /widget-plugins/qscintilla.py, extras/pyuic/uic/widget- + plugins/qtcharts.py, extras/pyuic/uic/widget- + plugins/qtprintsupport.py, extras/pyuic/uic/widget- + plugins/qtquickwidgets.py, extras/pyuic/uic/widget- + plugins/qtwebenginewidgets.py, extras/pyuic/uic/widget- + plugins/qtwebkit.py: + Updated pyuic for PyQt6. + [7ce320fb7235] + + * extras/pyuic/uic/Compiler/as_string.py, + extras/pyuic/uic/Compiler/qobjectcreator.py, + extras/pyuic/uic/Compiler/qtproxies.py, + extras/pyuic/uic/__init__.py, extras/pyuic/uic/driver.py, + extras/pyuic/uic/port_v2/__init__.py, + extras/pyuic/uic/port_v2/as_string.py, + extras/pyuic/uic/port_v2/ascii_upper.py, + extras/pyuic/uic/port_v2/proxy_base.py, + extras/pyuic/uic/port_v2/string_io.py, + extras/pyuic/uic/port_v3/__init__.py, + extras/pyuic/uic/port_v3/as_string.py, + extras/pyuic/uic/port_v3/ascii_upper.py, + extras/pyuic/uic/port_v3/proxy_base.py, + extras/pyuic/uic/port_v3/string_io.py, + extras/pyuic/uic/properties.py: + Removed the Python v2 support from pyuic. + [42116b5282a0] + + * PyQt6.msp: + Handle the wrapping of the project version attributes consistently. + [74e630b207d0] + + * projects/PyQt6/project.py: + Fixed the handling of the .sip handling the license. + [c6c896d0db2e] + + * projects/PyQt6/pyqt-commercial.sip: + Updated an error message. + [cd90da846e38] + + * projects/PyQt6/project.py: + Remove the redundant code to create the Qt composite module. + [84f08ad54745] + + * PyQt6.msp, qpy/QtCore/qpycore_chimera.cpp, + qpy/QtCore/qpycore_post_init.cpp.in, + qpy/QtCore/qpycore_pyqtsignal.cpp, qpy/QtCore/qpycore_pyqtsignal.h, + qpy/QtCore/qpycore_qobject_helpers.cpp, + qpy/QtCore/qpycore_types.cpp: + Use the PyQt6 %Plugin. + [6fd31e04b6e4] + + * rb-product, rb-product.toml, test/dbus/test_multibus.py, + test/runtests.py, test/tests/__init__.py, + test/tests/classes/__init__.py, + test/tests/classes/test_QByteArray.py, + test/tests/classes/test_QFlags.py, + test/tests/classes/test_QObject.py, + test/tests/classes/test_QQmlComponent.py, + test/tests/classes/test_QSettings.py, + test/tests/classes/test_QSignalSpy.py, + test/tests/classes/test_QVariant.py, + test/tests/mapped_types/__init__.py, + test/tests/mapped_types/test_QList.py, + test/tests/metaobject/__init__.py, + test/tests/metaobject/test_connections.py, + test/tests/metaobject/test_connectslotsbyname.py, + test/tests/metaobject/test_gc_slots.py, + test/tests/metaobject/test_invoke.py, + test/tests/metaobject/test_pyqtproperty.py, + test/tests/metaobject/test_pyqtsignal.py, + test/tests/metaobject/test_pyqtslot.py, + test/tests/metaobject/test_qenum.py, + test/tests/metaobject/test_qvariantmap.py, + test/tests/metaobject/test_sender.py, test/tests/misc/__init__.py, + test/tests/misc/test_pickle.py, test/tests/misc/test_repr.py, + test/tests/pyuic/QMainWindow/MainWindow00.ui, + test/tests/pyuic/QToolBox/ToolBox00.ui, + test/tests/pyuic/QToolBox/ToolBox01.ui, + test/tests/pyuic/QWidget/Widget00.ui, + test/tests/pyuic/QWidget/Widget01.ui, + test/tests/pyuic/QWidget/Widget02.ui, + test/tests/pyuic/QWidget/Widget03.ui, + test/tests/pyuic/QWidget/Widget04.ui, + test/tests/pyuic/QWidget/Widget05.ui, test/tests/pyuic/__init__.py, + test/tests/pyuic/test_pyuic.py: + Add the PyQt5 tests. + [e58465fae79f] + +2020-09-09 Phil Thompson + + * projects/PyQt3D/METADATA.in, projects/PyQt3D/Modules, + projects/PyQt3D/NEWS, projects/PyQt3D/README, + projects/PyQt3D/pyproject.toml, projects/PyQt3D6/Modules, + projects/PyQt3D6/NEWS, projects/PyQt3D6/README, + projects/PyQt3D6/pyproject.toml, projects/PyQt6/METADATA.in, + projects/PyQtChart/METADATA.in, projects/PyQtChart/Modules, + projects/PyQtChart/NEWS, projects/PyQtChart/README, + projects/PyQtChart/pyproject.toml, projects/PyQtChart6/Modules, + projects/PyQtChart6/NEWS, projects/PyQtChart6/README, + projects/PyQtChart6/pyproject.toml, + projects/PyQtDataVisualization/METADATA.in, + projects/PyQtDataVisualization/Modules, + projects/PyQtDataVisualization/NEWS, + projects/PyQtDataVisualization/README, + projects/PyQtDataVisualization/pyproject.toml, + projects/PyQtDataVisualization6/Modules, + projects/PyQtDataVisualization6/NEWS, + projects/PyQtDataVisualization6/README, + projects/PyQtDataVisualization6/pyproject.toml, + projects/PyQtPurchasing/METADATA.in, + projects/PyQtPurchasing/Modules, projects/PyQtPurchasing/NEWS, + projects/PyQtPurchasing/README, + projects/PyQtPurchasing/pyproject.toml, + projects/PyQtPurchasing6/Modules, projects/PyQtPurchasing6/NEWS, + projects/PyQtPurchasing6/README, + projects/PyQtPurchasing6/pyproject.toml, + projects/PyQtWebEngine/METADATA.in, projects/PyQtWebEngine/Modules, + projects/PyQtWebEngine/NEWS, projects/PyQtWebEngine/README, + projects/PyQtWebEngine/pyproject.toml, + projects/PyQtWebEngine6/Modules, projects/PyQtWebEngine6/NEWS, + projects/PyQtWebEngine6/README, + projects/PyQtWebEngine6/pyproject.toml: + Gave the subprojects a '6' suffix so that they can be installed side + by side with the PyQt5 versions. + [8c6d04c537ef] + + * projects/PyQt3D/METADATA.in, projects/PyQt3D/Modules, + projects/PyQt3D/NEWS, projects/PyQt3D/README, + projects/PyQt3D/pyproject.toml, projects/PyQt6/pyproject.toml, + projects/PyQtChart/METADATA.in, projects/PyQtChart/Modules, + projects/PyQtChart/NEWS, projects/PyQtChart/README, + projects/PyQtChart/pyproject.toml, + projects/PyQtDataVisualization/METADATA.in, + projects/PyQtDataVisualization/Modules, + projects/PyQtDataVisualization/NEWS, + projects/PyQtDataVisualization/README, + projects/PyQtDataVisualization/pyproject.toml, + projects/PyQtPurchasing/pyproject.toml, + projects/PyQtWebEngine/METADATA.in, projects/PyQtWebEngine/Modules, + projects/PyQtWebEngine/NEWS, projects/PyQtWebEngine/README, + projects/PyQtWebEngine/pyproject.toml: + Added the remaining PyQt sub-projects. + [77362503963b] + + * qpy/QtDataVisualization/qpydatavisualization_qlist.sip: + More SIP_SSIZE_T removals. + [b3ee41e1e684] + + * PyQt6.msp: + Removed SIP_SSIZE_T. + [59c1c6367e48] + + * PyQt6.msp: + Fixed a legacy macro. + [2df55da1386c] + + * PyQt6.msp: + Removed an old timeline. + [8cf15fb9f795] + + * projects/PyQt6/pyproject.toml: + Fixed a type in the PyQt6 metadata. + [df71929ed61f] + + * qpy/QtCore/qpycore_post_init.cpp.in: + Remove the reference to sipEnableOverflowChecking(). + [056baebe726e] + + * qpy/Qt3DCore/qsharedpointer.sip, + qpy/QtCore/qpycore_chimera_signature.cpp, + qpy/QtCore/qpycore_qmetaobject.cpp, + qpy/QtGui/qpyopengl_attribute_array.cpp, + qpy/QtGui/qpyopengl_uniform_value_array.cpp: + Removed all references to SIP_USE_PYCAPSULE. + [cb708d30e5d9] + + * projects/PyQt6/license.dat.commercial, + projects/PyQt6/license.dat.internal, projects/PyQt6/project.py: + Updates to the PyQt6 project build system. + [dd2edf3eae7c] + + * PyQt6.msp: + For the moment treat WebAssembly the same as Linux. + [aafdd15f84e3] + +2020-09-08 Phil Thompson + + * extras/dbus/dbus.cpp, extras/dbus/helper.h, extras/designer/designer + .pro-in, extras/designer/pluginloader.cpp, + extras/designer/pluginloader.h, extras/pylupdate/pylupdate_main.py, + extras/pylupdate/pylupdatemod.sip, + extras/pyuic/uic/Compiler/__init__.py, + extras/pyuic/uic/Compiler/compiler.py, + extras/pyuic/uic/Compiler/indenter.py, + extras/pyuic/uic/Compiler/misc.py, + extras/pyuic/uic/Compiler/proxy_metaclass.py, + extras/pyuic/uic/Compiler/qobjectcreator.py, + extras/pyuic/uic/Compiler/qtproxies.py, + extras/pyuic/uic/Loader/__init__.py, + extras/pyuic/uic/Loader/loader.py, + extras/pyuic/uic/Loader/qobjectcreator.py, + extras/pyuic/uic/__init__.py, extras/pyuic/uic/driver.py, + extras/pyuic/uic/exceptions.py, extras/pyuic/uic/icon_cache.py, + extras/pyuic/uic/objcreator.py, + extras/pyuic/uic/port_v2/__init__.py, + extras/pyuic/uic/port_v2/as_string.py, + extras/pyuic/uic/port_v2/ascii_upper.py, + extras/pyuic/uic/port_v2/proxy_base.py, + extras/pyuic/uic/port_v2/string_io.py, + extras/pyuic/uic/port_v3/__init__.py, + extras/pyuic/uic/port_v3/as_string.py, + extras/pyuic/uic/port_v3/ascii_upper.py, + extras/pyuic/uic/port_v3/proxy_base.py, + extras/pyuic/uic/port_v3/string_io.py, + extras/pyuic/uic/properties.py, extras/pyuic/uic/pyuic.py, + extras/pyuic/uic/uiparser.py, extras/pyuic/uic/widget- + plugins/qaxcontainer.py, extras/pyuic/uic/widget- + plugins/qscintilla.py, extras/pyuic/uic/widget-plugins/qtcharts.py, + extras/pyuic/uic/widget-plugins/qtprintsupport.py, extras/pyuic/uic + /widget-plugins/qtquickwidgets.py, extras/pyuic/uic/widget- + plugins/qtwebenginewidgets.py, extras/pyuic/uic/widget- + plugins/qtwebkit.py, extras/qmlscene/pluginloader.cpp, + extras/qmlscene/pluginloader.h, extras/qmlscene/qmlscene.pro-in: + Added the extra stuff from PyQt5. + [46613e339d46] + + * modules/QAxContainer/QAxContainermod.sip, + modules/QAxContainer/qaxbase.sip, + modules/QAxContainer/qaxobject.sip, + modules/QAxContainer/qaxwidget.sip, + modules/QtAndroidExtras/QtAndroidExtrasmod.sip, + modules/QtAndroidExtras/qandroidjniobject.sip, + modules/QtAndroidExtras/qtandroid.sip, + modules/QtMacExtras/QtMacExtrasmod.sip, + modules/QtMacExtras/qmacpasteboardmime.sip, + modules/QtMacExtras/qmactoolbar.sip, + modules/QtMacExtras/qmactoolbaritem.sip, + modules/QtMacExtras/qtmac.sip, + modules/QtWinExtras/QtWinExtrasmod.sip, + modules/QtWinExtras/qwinfunctions.sip, + modules/QtWinExtras/qwinjumplist.sip, + modules/QtWinExtras/qwinjumplistcategory.sip, + modules/QtWinExtras/qwinjumplistitem.sip, + modules/QtWinExtras/qwintaskbarbutton.sip, + modules/QtWinExtras/qwintaskbarprogress.sip, + modules/QtWinExtras/qwinthumbnailtoolbar.sip, + modules/QtWinExtras/qwinthumbnailtoolbutton.sip, + modules/QtX11Extras/QtX11Extrasmod.sip, + modules/QtX11Extras/qx11info_x11.sip: + Added the platform-specific handwritten modules from PyQt5. + [db1fd2139285] + + * .hgignore, projects/PyQt6/Modules, projects/PyQtPurchasing/Modules: + Added the Modules files for the currently implemented projects. + [49e21155f9e4] + + * projects/PyQt6/METADATA.in, projects/PyQt6/NEWS, + projects/PyQtPurchasing/METADATA.in, projects/PyQtPurchasing/NEWS, + projects/PyQtPurchasing/README, + projects/PyQtPurchasing/pyproject.toml: + Updated project build systems. + [3d0e682b0503] + + * tools/OpenGL/gen_opengl_constants.py, tools/OpenGL/gl.xml, + tools/mksccode.py: + Added some tools from PyQt5. + [0736add6b699] + + * projects/PyQt6/README, projects/PyQt6/__init__.py, projects/PyQt6 + /config-tests/cfgtest_QtCore.cpp, projects/PyQt6/config- + tests/cfgtest_QtGui.cpp, projects/PyQt6/config- + tests/cfgtest_QtNetwork.cpp, projects/PyQt6/config- + tests/cfgtest_QtPrintSupport.cpp, projects/PyQt6/project.py, + projects/PyQt6/pyproject.toml, projects/PyQt6/pyqt-commercial.sip, + projects/PyQt6/pyqt-gpl.sip, projects/PyQt6/pyqt-internal.sip: + Added the initial build system for the PyQt6 project. + [ea310826f59a] + + * rb-product: + Added the rb-product file. + [8c1ccc17e43b] + + * qpy/QtCore/qpycore_post_init.cpp.in: + Removed QtCore.PYQT_CONFIGURATION. + [243be8a8f9af] + + * qpy/QtCore/qpycore_pyqtslot.cpp, qpy/QtCore/qpycore_pyqtslot.h, + qpy/QtCore/qpycore_pyqtslotproxy.cpp, qpy/QtCore/qpycore_types.cpp: + Refactor the PyQtSlot ctors. + [6e87b0219b71] + +2020-09-07 Phil Thompson + + * PyQt6.msp, qpy/QtCore/qpycore_chimera.cpp, + qpy/QtCore/qpycore_public_api.cpp, + qpy/QtCore/qpycore_pyqtpyobject.cpp, qpy/QtCore/qpycore_qhash.sip, + qpy/QtCore/qpycore_qlist.sip, qpy/QtCore/qpycore_qmap.sip, + qpy/QtCore/qpycore_qmessagelogger.cpp, + qpy/QtCore/qpycore_qvector.sip, qpy/QtCore/qpycore_types.cpp, + qpy/QtGui/qpyopengl_array_convertors.cpp: + Removed calls to SIPLong_*() and SIPBytes_()*. + [9f8927c1a7aa] + + * PyQt6.msp, qpy/Qt3DRender/qvector.sip, qpy/QtCore/qpycore_init.cpp, + qpy/QtCore/qpycore_misc.cpp, qpy/QtCore/qpycore_post_init.cpp.in, + qpy/QtCore/qpycore_public_api.cpp, qpy/QtCore/qpycore_public_api.h, + qpy/QtCore/qpycore_pyqtboundsignal.cpp, + qpy/QtCore/qpycore_pyqtmethodproxy.cpp, + qpy/QtCore/qpycore_pyqtproperty.cpp, + qpy/QtCore/qpycore_pyqtpyobject.cpp, + qpy/QtCore/qpycore_pyqtsignal.cpp, + qpy/QtCore/qpycore_pyqtslotproxy.cpp, qpy/QtCore/qpycore_qlist.sip, + qpy/QtCore/qpycore_qmessagelogger.cpp, + qpy/QtCore/qpycore_qmetaobject_helpers.cpp, + qpy/QtCore/qpycore_qobject_helpers.cpp, + qpy/QtCore/qpycore_qt_conf.cpp, + qpy/QtCore/qpycore_qvariant_value.cpp, + qpy/QtCore/qpycore_virtual_error_handler.sip, + qpy/QtCore/qstringlist.sip, qpy/QtDBus/qpydbus_post_init.cpp, + qpy/QtDBus/qpydbuspendingreply.cpp, qpy/QtDBus/qpydbusreply.cpp, + qpy/QtDataVisualization/qpydatavisualization_qlist.sip, + qpy/QtGui/qpyopengl_data_cache.cpp, qpy/QtGui/qpyopengl_init.cpp, + qpy/QtGui/qpyopengl_version_functions.cpp, + qpy/QtQml/qmlattachedpropertiesobject.sip, + qpy/QtQml/qmlregistertype.sip, qpy/QtQml/qpyqml_api.h, + qpy/QtQml/qpyqml_post_init.cpp, + qpy/QtQml/qpyqml_register_singleton_type.cpp, + qpy/QtQml/qpyqml_register_type.cpp, + qpy/QtQml/qpyqmllistproperty.cpp, + qpy/QtQml/qpyqmllistpropertywrapper.cpp, qpy/QtQml/qpyqmlobject.cpp, + qpy/QtQml/qpyqmlsingletonobject.cpp, qpy/QtQml/qpyqmlvalidator.cpp, + qpy/QtQuick/qpyquick_api.h, qpy/QtQuick/qpyquick_post_init.cpp, + qpy/QtQuick/qpyquickframebufferobject.cpp, + qpy/QtQuick/qpyquickitem.cpp, qpy/QtQuick/qpyquickpainteditem.cpp, + qpy/QtQuick/qpyquickview.cpp, qpy/QtQuick/qpyquickwindow.cpp, + qpy/QtWidgets/qpywidgets_post_init.cpp: + Removed references to PyQt5 and pyqt5. + [797c8a7cb2fe] + + * qpy/Qt3DCore/qsharedpointer.sip, qpy/Qt3DRender/qvector.sip, + qpy/QtBluetooth/qpybluetooth_qlist.sip, + qpy/QtBluetooth/qpybluetooth_quint128.sip, + qpy/QtCore/qjsonarray.sip, qpy/QtCore/qjsonobject.sip, + qpy/QtCore/qpycore_api.h, qpy/QtCore/qpycore_chimera.cpp, + qpy/QtCore/qpycore_chimera.h, + qpy/QtCore/qpycore_chimera_signature.cpp, + qpy/QtCore/qpycore_chimera_storage.cpp, + qpy/QtCore/qpycore_classinfo.cpp, qpy/QtCore/qpycore_classinfo.h, + qpy/QtCore/qpycore_decorators.cpp, + qpy/QtCore/qpycore_enums_flags.cpp, + qpy/QtCore/qpycore_enums_flags.h, + qpy/QtCore/qpycore_event_handlers.cpp, + qpy/QtCore/qpycore_event_handlers.h, qpy/QtCore/qpycore_init.cpp, + qpy/QtCore/qpycore_misc.cpp, qpy/QtCore/qpycore_misc.h, + qpy/QtCore/qpycore_namespace.h, + qpy/QtCore/qpycore_objectified_strings.h, + qpy/QtCore/qpycore_post_init.cpp.in, + qpy/QtCore/qpycore_public_api.cpp, qpy/QtCore/qpycore_public_api.h, + qpy/QtCore/qpycore_pyqtboundsignal.cpp, + qpy/QtCore/qpycore_pyqtboundsignal.h, + qpy/QtCore/qpycore_pyqtconfigure.cpp, + qpy/QtCore/qpycore_pyqtmethodproxy.cpp, + qpy/QtCore/qpycore_pyqtmethodproxy.h, + qpy/QtCore/qpycore_pyqtproperty.cpp, + qpy/QtCore/qpycore_pyqtproperty.h, + qpy/QtCore/qpycore_pyqtpyobject.cpp, + qpy/QtCore/qpycore_pyqtpyobject.h, + qpy/QtCore/qpycore_pyqtsignal.cpp, qpy/QtCore/qpycore_pyqtsignal.h, + qpy/QtCore/qpycore_pyqtslot.cpp, qpy/QtCore/qpycore_pyqtslot.h, + qpy/QtCore/qpycore_pyqtslotproxy.cpp, + qpy/QtCore/qpycore_pyqtslotproxy.h, qpy/QtCore/qpycore_qhash.sip, + qpy/QtCore/qpycore_qjsonvalue.cpp, qpy/QtCore/qpycore_qlist.sip, + qpy/QtCore/qpycore_qmap.sip, qpy/QtCore/qpycore_qmessagelogger.cpp, + qpy/QtCore/qpycore_qmetaobject.cpp, + qpy/QtCore/qpycore_qmetaobject_helpers.cpp, + qpy/QtCore/qpycore_qmetaobjectbuilder.h, + qpy/QtCore/qpycore_qobject_getattr.cpp, + qpy/QtCore/qpycore_qobject_helpers.cpp, + qpy/QtCore/qpycore_qobject_helpers.h, qpy/QtCore/qpycore_qpair.sip, + qpy/QtCore/qpycore_qset.sip, qpy/QtCore/qpycore_qstring.cpp, + qpy/QtCore/qpycore_qt_conf.cpp, qpy/QtCore/qpycore_qvariant.cpp, + qpy/QtCore/qpycore_qvariant_value.cpp, + qpy/QtCore/qpycore_qvariantmap.cpp, + qpy/QtCore/qpycore_qvariantmap.sip, qpy/QtCore/qpycore_qvector.sip, + qpy/QtCore/qpycore_types.cpp, qpy/QtCore/qpycore_types.h, + qpy/QtCore/qpycore_virtual_error_handler.sip, + qpy/QtCore/qstringlist.sip, qpy/QtCore/qsysinfo.sip, + qpy/QtCore/qwineventnotifier.sip, qpy/QtDBus/qpydbus_api.h, + qpy/QtDBus/qpydbus_chimera_helpers.cpp, + qpy/QtDBus/qpydbus_chimera_helpers.h, + qpy/QtDBus/qpydbus_post_init.cpp, + qpy/QtDBus/qpydbuspendingreply.cpp, + qpy/QtDBus/qpydbuspendingreply.h, + qpy/QtDBus/qpydbuspendingreply.sip, qpy/QtDBus/qpydbusreply.cpp, + qpy/QtDBus/qpydbusreply.h, qpy/QtDBus/qpydbusreply.sip, + qpy/QtDataVisualization/qpydatavisualization_qlist.sip, + qpy/QtDesigner/qpydesignercontainerextension.h, + qpy/QtDesigner/qpydesignercontainerextension.sip, + qpy/QtDesigner/qpydesignercustomwidgetcollectionplugin.h, + qpy/QtDesigner/qpydesignercustomwidgetcollectionplugin.sip, + qpy/QtDesigner/qpydesignercustomwidgetplugin.h, + qpy/QtDesigner/qpydesignercustomwidgetplugin.sip, + qpy/QtDesigner/qpydesignermembersheetextension.h, + qpy/QtDesigner/qpydesignermembersheetextension.sip, + qpy/QtDesigner/qpydesignerpropertysheetextension.h, + qpy/QtDesigner/qpydesignerpropertysheetextension.sip, + qpy/QtDesigner/qpydesignertaskmenuextension.h, + qpy/QtDesigner/qpydesignertaskmenuextension.sip, + qpy/QtGui/opengl_types.sip, qpy/QtGui/qpygui_qlist.sip, + qpy/QtGui/qpygui_qpair.sip, qpy/QtGui/qpygui_qvector.sip, + qpy/QtGui/qpyopengl_add_constants.cpp, qpy/QtGui/qpyopengl_api.h, + qpy/QtGui/qpyopengl_array_convertors.cpp, + qpy/QtGui/qpyopengl_attribute_array.cpp, + qpy/QtGui/qpyopengl_data_cache.cpp, + qpy/QtGui/qpyopengl_data_cache.h, qpy/QtGui/qpyopengl_get.cpp, + qpy/QtGui/qpyopengl_init.cpp, qpy/QtGui/qpyopengl_misc.h, + qpy/QtGui/qpyopengl_uniform_value_array.cpp, + qpy/QtGui/qpyopengl_value_array.cpp, + qpy/QtGui/qpyopengl_version_functions.cpp, + qpy/QtMultimedia/qpymultimedia_qlist.sip, + qpy/QtNetwork/qpynetwork_qhash.sip, + qpy/QtNetwork/qpynetwork_qmap.sip, + qpy/QtPrintSupport/qpyprintsupport_qlist.sip, + qpy/QtQml/qmlattachedpropertiesobject.sip, + qpy/QtQml/qmlregistertype.sip, qpy/QtQml/qpyqml_api.h, + qpy/QtQml/qpyqml_listdata.cpp, qpy/QtQml/qpyqml_listdata.h, + qpy/QtQml/qpyqml_post_init.cpp, qpy/QtQml/qpyqml_qjsvalue.cpp, + qpy/QtQml/qpyqml_register_singleton_type.cpp, + qpy/QtQml/qpyqml_register_type.cpp, + qpy/QtQml/qpyqmllistproperty.cpp, qpy/QtQml/qpyqmllistproperty.h, + qpy/QtQml/qpyqmllistproperty.sip, + qpy/QtQml/qpyqmllistpropertywrapper.cpp, + qpy/QtQml/qpyqmllistpropertywrapper.h, qpy/QtQml/qpyqmlobject.cpp, + qpy/QtQml/qpyqmlobject.h, qpy/QtQml/qpyqmlsingletonobject.cpp, + qpy/QtQml/qpyqmlsingletonobject.h, qpy/QtQml/qpyqmlvalidator.cpp, + qpy/QtQml/qpyqmlvalidator.h, qpy/QtQuick/qpyquick_api.h, + qpy/QtQuick/qpyquick_chimera_helpers.cpp, + qpy/QtQuick/qpyquick_chimera_helpers.h, + qpy/QtQuick/qpyquick_post_init.cpp, + qpy/QtQuick/qpyquick_register_type.cpp, + qpy/QtQuick/qpyquick_register_type.h, + qpy/QtQuick/qpyquickframebufferobject.cpp, + qpy/QtQuick/qpyquickframebufferobject.h, + qpy/QtQuick/qpyquickitem.cpp, qpy/QtQuick/qpyquickitem.h, + qpy/QtQuick/qpyquickpainteditem.cpp, + qpy/QtQuick/qpyquickpainteditem.h, qpy/QtQuick/qpyquickview.cpp, + qpy/QtQuick/qpyquickview.h, qpy/QtQuick/qpyquickwindow.cpp, + qpy/QtQuick/qpyquickwindow.h, + qpy/QtWidgets/qmaccocoaviewcontainer.sip, + qpy/QtWidgets/qpywidgets_api.h, + qpy/QtWidgets/qpywidgets_chimera_helpers.cpp, + qpy/QtWidgets/qpywidgets_chimera_helpers.h, + qpy/QtWidgets/qpywidgets_post_init.cpp, + qpy/QtWidgets/qpywidgets_qlist.sip: + Added the qpy support code from PyQt5 but with most redundant code + removed. + [27152732c630] + + * PyQt6.msp: + Removal of more Python v2 handwritten code. + [3541f134d6cc] + + * PyQt6.msp: + Removed any reference to old Qt timelines. + [04f530adec6d] + + * PyQt6.msp: + Removed all Qt version dependent code. + [76eafef36ace] + + * PyQt6.msp: + Updated the platform definitions. + [32f373a5ff13] + + * PyQt6.msp: + Removed all Python v2 handwritten code. + [ee05a90c906a] + + * PyQt6.msp: + Removed the Py_v3 feature. Removed all implementations of exec_() + and print_(). + [f7489cd39d11] + + * PyQt6.msp: + Imported the other sub-projects. + [b228f7b24140] + + * PyQt6.msp: + Removed all old versions and unsupported modules. + [0855d708b41f] + +2020-09-03 Phil Thompson + + * PyQt6.msp: + Added the current PyQt5 project file as the basis of PyQt6. + [77889d649aa0] + + * .hgignore: + Added .hgignore. + [232375a0de55] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..f748126 --- /dev/null +++ b/NEWS @@ -0,0 +1,107 @@ +v6.5.2 22nd July 2023 + - Added the missing NativeGesture, Quit, EnterEditFocus and LeaveEditFocus + members of QEventType. + - Bug fixes. + +v6.5.1 26th May 2023 + - Added support for QPermission and related classes and methods. + - Added the max_workers argument to uic.compileUiDir() to specifiy the + maximum number of worker processes to use when compiling the .ui files in a + directory. + - pyuic6 will now compile all the .ui files in a directory if the name of the + directory is passed instead of a .ui file. + - Added the --max-workers command line option to pyuic6. + - Bug fixes. + +v6.5.0 5th April 2023 + - Added support for Qt v6.5 including the QtSpatialAudio module. + - Bug fixes. + +v6.4.2 28th January 2023 + - Bug fixes. + +v6.4.1 27th January 2023 + - Added allocationLimit() and setAllocationLimit() to QImageReader. + - Added toHBITMAP(), fromHBITMAP(), toHICON() and fromHICON() to QImage on + Windows. + - Bug fixes. + +v6.4.0 30th September 2022 + - Added support for Qt v6.4 including the QtPdf, QtPdfWidgets and + QtTextToSpeech modules. + - Added QAction.menu() and QAction.setMenu(). + - Bug fixes. + +v6.3.1 17th June 2022 + - Added qRegisterResourceData() and qUnregisterResourceData() to QtCore to + help in supporting legacy resource files from PyQt5. + - Requires v13.4 of the sip module which adds support for enums with missing + members and the sip.array support. + - Reverted the Qt.GestureType related changes made in v6.2.3 as they are no + longer necessary with the support for missing enum members. + - The QEvent constructor that takes an int argument is now deprecated. + - Refactored the draw methods of QPainter to accept sip.array objects of + appropriate types. Such arrays, once initialised, can be used very + efficiently as they do not require repeated conversion from the usual + Python collection types. + - Added resize() to QPolygon, QPolygonF and QXmlStreamAttributes. + - Bug fixes. + +v6.3.0 1st April 2022 + - Added support for Qt v6.3. + - Bug fixes. + +v6.2.3 1st February 2022 + - All Qt.GestureType callable arguments will also accept an int. All + callables that return a Qt::GestureType in C++ will return an int (which + can be compared with a Qt.GestureType member). + - Bug fixes. + +v6.2.2 1st December 2021 + - Added the missing QBluetoothUuid constructors. + - Added the missing QMediaPlayer loop-related methods. + - Bug fixes. + +v6.2.1 28th October 2021 + - Bug fixes. + +v6.2.0 30th September 2021 + - Added support for Qt v6.2 including the QtBluetooth, QtMultimedia, + QtMultimediaWidgets, QtNfc, QtPositioning, QtRemoteObjects, QtSensors, + QtSerialPort, QtWebChannel and QtWebSockets modules. + - Added support for QAxContainer on Windows. + - Ported the QtMultimedia examples from PyQt5. + - Bug fixes. + +v6.1.2 9th July 2021 + - Bug fixes. + +v6.1.1 13th June 2021 + - Added the missing QtCore.QXmlStreamAttributes class. + - Added the missing QtQml.QQmlExtensionPlugin class. + - Added the --exclude command line option to pylupdate6. + - pylupdate6 now handles PEP 263 embedded source encodings in .py files. + - Bug fixes. + +v6.1.0 6th May 2021 + - Added support for Qt v6.1. + - All flag-based enums have been renamed so that they use the name of the Qt + enum rather than the name of the Qt QFlag. + - An integer ARGB value can now be used whenever a QColor is expected. + +v6.0.3 5th March 2021 + - Bug fixes. + +v6.0.2 23rd February 2021 + - Bug fixes. + +v6.0.1 5th February 2021 + - Added QSocketNotifier. + - The Qt Designer and qmlscene plugins now work when installed in a venv. + - Ported some of the PyQt5 examples. + - Wheels now assume that the corresponding Qt libraries are in an external + wheel rather than being bundled. + - Bug fixes. + +v6.0.0 4th January 2021 + - The first release of PyQt6. diff --git a/PKG-INFO b/PKG-INFO new file mode 100644 index 0000000..3bf3255 --- /dev/null +++ b/PKG-INFO @@ -0,0 +1,64 @@ +Metadata-Version: 2.1 +Name: PyQt6 +Version: 6.5.2 +Requires-Python: >=3.6.1 +Summary: Python bindings for the Qt cross platform application toolkit +Home-Page: https://www.riverbankcomputing.com/software/pyqt/ +Author: Riverbank Computing Limited +Author-Email: info@riverbankcomputing.com +License: GPL v3 +Requires-Dist: PyQt6-sip (>=13.4, <14) + +PyQt6 - Comprehensive Python Bindings for Qt v6 +=============================================== + +Qt is set of cross-platform C++ libraries that implement high-level APIs for +accessing many aspects of modern desktop and mobile systems. These include +location and positioning services, multimedia, NFC and Bluetooth connectivity, +a Chromium based web browser, as well as traditional UI development. + +PyQt6 is a comprehensive set of Python bindings for Qt v6. It is implemented +as more than 35 extension modules and enables Python to be used as an +alternative application development language to C++ on all supported platforms +including iOS and Android. + +PyQt6 may also be embedded in C++ based applications to allow users of those +applications to configure or enhance the functionality of those applications. + + +Author +------ + +PyQt6 is copyright (c) Riverbank Computing Limited. Its homepage is +https://www.riverbankcomputing.com/software/pyqt/. + +Support may be obtained from the PyQt mailing list at +https://www.riverbankcomputing.com/mailman/listinfo/pyqt/. + + +License +------- + +PyQt6 is released under the GPL v3 license and under a commercial license that +allows for the development of proprietary applications. + + +Documentation +------------- + +The documentation for the latest release can be found +`here `__. + + +Installation +------------ + +The GPL version of PyQt6 can be installed from PyPI:: + + pip install PyQt6 + +``pip`` will also build and install the bindings from the sdist package but +Qt's ``qmake`` tool must be on ``PATH``. + +The ``sip-install`` tool will also install the bindings from the sdist package +but will allow you to configure many aspects of the installation. diff --git a/README b/README new file mode 100644 index 0000000..04a01dc --- /dev/null +++ b/README @@ -0,0 +1,53 @@ +PyQt6 - Comprehensive Python Bindings for Qt v6 +=============================================== + +Qt is set of cross-platform C++ libraries that implement high-level APIs for +accessing many aspects of modern desktop and mobile systems. These include +location and positioning services, multimedia, NFC and Bluetooth connectivity, +a Chromium based web browser, as well as traditional UI development. + +PyQt6 is a comprehensive set of Python bindings for Qt v6. It is implemented +as more than 35 extension modules and enables Python to be used as an +alternative application development language to C++ on all supported platforms +including iOS and Android. + +PyQt6 may also be embedded in C++ based applications to allow users of those +applications to configure or enhance the functionality of those applications. + + +Author +------ + +PyQt6 is copyright (c) Riverbank Computing Limited. Its homepage is +https://www.riverbankcomputing.com/software/pyqt/. + +Support may be obtained from the PyQt mailing list at +https://www.riverbankcomputing.com/mailman/listinfo/pyqt/. + + +License +------- + +PyQt6 is released under the GPL v3 license and under a commercial license that +allows for the development of proprietary applications. + + +Documentation +------------- + +The documentation for the latest release can be found +`here `__. + + +Installation +------------ + +The GPL version of PyQt6 can be installed from PyPI:: + + pip install PyQt6 + +``pip`` will also build and install the bindings from the sdist package but +Qt's ``qmake`` tool must be on ``PATH``. + +The ``sip-install`` tool will also install the bindings from the sdist package +but will allow you to configure many aspects of the installation. diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..806e161 --- /dev/null +++ b/__init__.py @@ -0,0 +1,20 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +# Support PyQt6 sub-packages that have been created by setuptools. +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/config-tests/cfgtest_QtCore.cpp b/config-tests/cfgtest_QtCore.cpp new file mode 100644 index 0000000..3417d9f --- /dev/null +++ b/config-tests/cfgtest_QtCore.cpp @@ -0,0 +1,39 @@ +#include +#include +#include +#include + + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + QFile outf(argv[1]); + + if (!outf.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Text)) + return 1; + + QTextStream out(&outf); + + // This is not a feature and needs to be handled separately. +#if defined(QT_SHARED) || defined(QT_DLL) + out << "shared\n"; +#else + out << "static\n"; +#endif + + // Determine which features should be disabled. + +#if defined(QT_NO_PROCESS) + out << "PyQt_Process\n"; +#endif + + // qreal is double unless QT_COORD_TYPE is defined. + if (sizeof (qreal) != sizeof (double)) + out << "PyQt_qreal_double\n"; + +#if QT_VERSION < 0x060500 || !QT_CONFIG(permissions) + out << "PyQt_Permissions"; +#endif + + return 0; +} diff --git a/config-tests/cfgtest_QtGui.cpp b/config-tests/cfgtest_QtGui.cpp new file mode 100644 index 0000000..ac0dd2b --- /dev/null +++ b/config-tests/cfgtest_QtGui.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +#include + +#include +#include + + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + QFile outf(argv[1]); + + if (!outf.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Text)) + return 1; + + QTextStream out(&outf); + + // The link test. + new QFont(); + + // Determine which features should be disabled. + +#if defined(QT_NO_ACCESSIBILITY) + out << "PyQt_Accessibility\n"; +#endif + +#if !QT_CONFIG(opengles2) + out << "PyQt_OpenGL_ES2\n"; +#if defined(QT_NO_OPENGL) + out << "PyQt_OpenGL\n"; +#endif +#endif + +#if defined(QT_NO_RAWFONT) + out << "PyQt_RawFont\n"; +#endif + +#if defined(QT_NO_SESSIONMANAGER) + out << "PyQt_SessionManager\n"; +#endif + + return 0; +} diff --git a/config-tests/cfgtest_QtNetwork.cpp b/config-tests/cfgtest_QtNetwork.cpp new file mode 100644 index 0000000..7c3c091 --- /dev/null +++ b/config-tests/cfgtest_QtNetwork.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +#include + +#include + + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + QFile outf(argv[1]); + + if (!outf.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Text)) + return 1; + + QTextStream out(&outf); + + // The link test. + new QHostAddress(); + + // Determine which features should be disabled. + +#if !QT_CONFIG(ssl) + out << "PyQt_SSL\n"; +#endif + +#if !QT_CONFIG(dtls) + out << "PyQt_DTLS\n"; +#endif + + return 0; +} diff --git a/config-tests/cfgtest_QtPrintSupport.cpp b/config-tests/cfgtest_QtPrintSupport.cpp new file mode 100644 index 0000000..d2df555 --- /dev/null +++ b/config-tests/cfgtest_QtPrintSupport.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include + +#include + + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + QFile outf(argv[1]); + + if (!outf.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Text)) + return 1; + + QTextStream out(&outf); + + // The link test. + new QPrinter(); + + // Determine which features should be disabled. + +#if defined(QT_NO_PRINTER) + out << "PyQt_Printer\n"; +#endif + +#if !QT_CONFIG(printdialog) + out << "PyQt_PrintDialog\n"; +#endif + +#if !QT_CONFIG(printpreviewdialog) + out << "PyQt_PrintPreviewDialog\n"; +#endif + +#if !QT_CONFIG(printpreviewwidget) + out << "PyQt_PrintPreviewWidget\n"; +#endif + + return 0; +} diff --git a/dbus/dbus.cpp b/dbus/dbus.cpp new file mode 100644 index 0000000..3a9a6e8 --- /dev/null +++ b/dbus/dbus.cpp @@ -0,0 +1,422 @@ +// This is the SIP interface definition for the Qt support for the standard +// Python DBus bindings. +// +// Copyright (c) 2021 Riverbank Computing Limited +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, copy, +// modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + + +#include + +#include +#include +#include +#include + +#include "helper.h" + + +// The callback to add a watch. +extern "C" {static dbus_bool_t add_watch(DBusWatch *watch, void *data);} +static dbus_bool_t add_watch(DBusWatch *watch, void *data) +{ + pyqt6DBusHelper *hlp = reinterpret_cast(data); + + int fd = dbus_watch_get_fd(watch); + unsigned int flags = dbus_watch_get_flags(watch); + dbus_bool_t enabled = dbus_watch_get_enabled(watch); + + pyqt6DBusHelper::Watcher watcher; + watcher.watch = watch; + + if (flags & DBUS_WATCH_READABLE) + { + watcher.read = new QSocketNotifier(fd, QSocketNotifier::Read, hlp); + watcher.read->setEnabled(enabled); + hlp->connect(watcher.read, SIGNAL(activated(int)), SLOT(readSocket(int))); + } + + if (flags & DBUS_WATCH_WRITABLE) + { + watcher.write = new QSocketNotifier(fd, QSocketNotifier::Write, hlp); + watcher.write->setEnabled(enabled); + hlp->connect(watcher.write, SIGNAL(activated(int)), SLOT(writeSocket(int))); + } + + hlp->watchers.insert(fd, watcher); + + return true; +} + + +// The callback to remove a watch. +extern "C" {static void remove_watch(DBusWatch *watch, void *data);} +static void remove_watch(DBusWatch *watch, void *data) +{ + pyqt6DBusHelper *hlp = reinterpret_cast(data); + + int fd = dbus_watch_get_fd(watch); + + pyqt6DBusHelper::Watchers::iterator it = hlp->watchers.find(fd); + + while (it != hlp->watchers.end() && it.key() == fd) + { + pyqt6DBusHelper::Watcher &watcher = it.value(); + + if (watcher.watch == watch) + { + if (watcher.read) + delete watcher.read; + + if (watcher.write) + delete watcher.write; + + hlp->watchers.erase(it); + + return; + } + + ++it; + } +} + + +// The callback to toggle a watch. +extern "C" {static void toggle_watch(DBusWatch *watch, void *data);} +static void toggle_watch(DBusWatch *watch, void *data) +{ + pyqt6DBusHelper *hlp = reinterpret_cast(data); + + int fd = dbus_watch_get_fd(watch); + unsigned int flags = dbus_watch_get_flags(watch); + dbus_bool_t enabled = dbus_watch_get_enabled(watch); + + pyqt6DBusHelper::Watchers::const_iterator it = hlp->watchers.find(fd); + + while (it != hlp->watchers.end() && it.key() == fd) + { + const pyqt6DBusHelper::Watcher &watcher = it.value(); + + if (watcher.watch == watch) + { + if (flags & DBUS_WATCH_READABLE && watcher.read) + watcher.read->setEnabled(enabled); + + if (flags & DBUS_WATCH_WRITABLE && watcher.write) + watcher.write->setEnabled(enabled); + + return; + } + + ++it; + } +} + + +// The callback to add a timeout. +extern "C" {static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data);} +static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) +{ + // Nothing to do if the timeout is disabled. + if (!dbus_timeout_get_enabled(timeout)) + return true; + + // Pretend it is successful if there is no application instance. This can + // happen if the global application gets garbage collected before the + // dbus-python main loop does. + if (!QCoreApplication::instance()) + return true; + + pyqt6DBusHelper *hlp = reinterpret_cast(data); + + int id = hlp->startTimer(dbus_timeout_get_interval(timeout)); + + if (!id) + return false; + + hlp->timeouts[id] = timeout; + + return true; +} + + +// The callback to remove a timeout. +extern "C" {static void remove_timeout(DBusTimeout *timeout, void *data);} +static void remove_timeout(DBusTimeout *timeout, void *data) +{ + pyqt6DBusHelper *hlp = reinterpret_cast(data); + + pyqt6DBusHelper::Timeouts::iterator it = hlp->timeouts.begin(); + + while (it != hlp->timeouts.end()) + if (it.value() == timeout) + { + hlp->killTimer(it.key()); + it = hlp->timeouts.erase(it); + } + else + ++it; +} + + +// The callback to toggle a timeout. +extern "C" {static void toggle_timeout(DBusTimeout *timeout, void *data);} +static void toggle_timeout(DBusTimeout *timeout, void *data) +{ + remove_timeout(timeout, data); + add_timeout(timeout, data); +} + + +// The callback to delete a helper instance. +extern "C" {static void dbus_qt_delete_helper(void *data);} +static void dbus_qt_delete_helper(void *data) +{ + delete reinterpret_cast(data); +} + + +// The callback to wakeup the event loop. +extern "C" {static void wakeup_main(void *data);} +static void wakeup_main(void *data) +{ + pyqt6DBusHelper *hlp = reinterpret_cast(data); + + QTimer::singleShot(0, hlp, SLOT(dispatch())); +} + + +// The callback to set up a DBus connection. +extern "C" {static dbus_bool_t dbus_qt_conn(DBusConnection *conn, void *data);} +static dbus_bool_t dbus_qt_conn(DBusConnection *conn, void *data) +{ + bool rc; + + Py_BEGIN_ALLOW_THREADS + + pyqt6DBusHelper *hlp = reinterpret_cast(data); + + hlp->connections.append(conn); + + if (!dbus_connection_set_watch_functions(conn, add_watch, remove_watch, + toggle_watch, data, 0)) + rc = false; + else if (!dbus_connection_set_timeout_functions(conn, add_timeout, + remove_timeout, toggle_timeout, data, 0)) + rc = false; + else + rc = true; + + dbus_connection_set_wakeup_main_function(conn, wakeup_main, hlp, 0); + + Py_END_ALLOW_THREADS + + return rc; +} + + +// The callback to set up a DBus server. +extern "C" {static dbus_bool_t dbus_qt_srv(DBusServer *srv, void *data);} +static dbus_bool_t dbus_qt_srv(DBusServer *srv, void *data) +{ + bool rc; + + Py_BEGIN_ALLOW_THREADS + + if (!dbus_server_set_watch_functions(srv, add_watch, remove_watch, + toggle_watch, data, 0)) + rc = false; + else if (!dbus_server_set_timeout_functions(srv, add_timeout, + remove_timeout, toggle_timeout, data, 0)) + rc = false; + else + rc = true; + + Py_END_ALLOW_THREADS + + return rc; +} + + +// Create a new helper instance. +pyqt6DBusHelper::pyqt6DBusHelper() : QObject() +{ +} + + +// Handle a socket being ready to read. +void pyqt6DBusHelper::readSocket(int fd) +{ + Watchers::const_iterator it = watchers.find(fd); + + while (it != watchers.end() && it.key() == fd) + { + const Watcher &watcher = it.value(); + + if (watcher.read && watcher.read->isEnabled()) + { + watcher.read->setEnabled(false); + dbus_watch_handle(watcher.watch, DBUS_WATCH_READABLE); + + // The notifier could have just been destroyed. + if (watcher.read) + watcher.read->setEnabled(true); + + break; + } + + ++it; + } + + dispatch(); +} + + +// Handle a socket being ready to write. +void pyqt6DBusHelper::writeSocket(int fd) +{ + Watchers::const_iterator it = watchers.find(fd); + + while (it != watchers.end() && it.key() == fd) + { + const Watcher &watcher = it.value(); + + if (watcher.write && watcher.write->isEnabled()) + { + watcher.write->setEnabled(false); + dbus_watch_handle(watcher.watch, DBUS_WATCH_WRITABLE); + + // The notifier could have just been destroyed. + if (watcher.write) + watcher.write->setEnabled(true); + + break; + } + + ++it; + } +} + + +// Handoff to the connection dispatcher while there is data. +void pyqt6DBusHelper::dispatch() +{ + for (Connections::const_iterator it = connections.constBegin(); it != connections.constEnd(); ++it) + while (dbus_connection_dispatch(*it) == DBUS_DISPATCH_DATA_REMAINS) + ; +} + + +// Reimplemented to handle timer events. +void pyqt6DBusHelper::timerEvent(QTimerEvent *e) +{ + DBusTimeout *timeout = timeouts.value(e->timerId()); + + if (timeout) + dbus_timeout_handle(timeout); +} + + +PyDoc_STRVAR(DBusQtMainLoop__doc__, +"DBusQtMainLoop([set_as_default=False]) -> NativeMainLoop\n" +"\n" +"Return a NativeMainLoop object.\n" +"\n" +"If the keyword argument set_as_default is given and is True, set the new\n" +"main loop as the default for all new Connection or Bus instances.\n"); + +extern "C" {static PyObject *DBusQtMainLoop(PyObject *, PyObject *args, PyObject *kwargs);} +static PyObject *DBusQtMainLoop(PyObject *, PyObject *args, PyObject *kwargs) +{ + if (PyTuple_Size(args) != 0) + { + PyErr_SetString(PyExc_TypeError, "DBusQtMainLoop() takes no positional arguments"); + return 0; + } + + int set_as_default = 0; + static char *argnames[] = {"set_as_default", 0}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i", argnames, &set_as_default)) + return 0; + + pyqt6DBusHelper *hlp = new pyqt6DBusHelper; + + PyObject *mainloop = DBusPyNativeMainLoop_New4(dbus_qt_conn, dbus_qt_srv, + dbus_qt_delete_helper, hlp); + + if (!mainloop) + { + delete hlp; + return 0; + } + + if (set_as_default) + { + PyObject *func = PyObject_GetAttrString(_dbus_bindings_module, "set_default_main_loop"); + + if (!func) + { + Py_DECREF(mainloop); + return 0; + } + + PyObject *res = PyObject_CallFunctionObjArgs(func, mainloop, 0); + Py_DECREF(func); + + if (!res) + { + Py_DECREF(mainloop); + return 0; + } + + Py_DECREF(res); + } + + return mainloop; +} + + +// The table of module functions. +static PyMethodDef module_functions[] = { + {"DBusQtMainLoop", (PyCFunction)DBusQtMainLoop, METH_VARARGS|METH_KEYWORDS, + DBusQtMainLoop__doc__}, + {0, 0, 0, 0} +}; + + +// The module entry point. +PyMODINIT_FUNC PyInit_pyqt6() +{ + static PyModuleDef module_def = { + PyModuleDef_HEAD_INIT, + "pyqt6", + NULL, + -1, + module_functions, + }; + + // Import the generic part of the Python DBus bindings. + if (import_dbus_bindings("dbus.mainloop.pyqt6") < 0) + return 0; + + return PyModule_Create(&module_def); +} diff --git a/dbus/helper.h b/dbus/helper.h new file mode 100644 index 0000000..93e0f6b --- /dev/null +++ b/dbus/helper.h @@ -0,0 +1,71 @@ +// This is the declaration of the helper class for the Qt specific support for +// the standard Python DBus bindings. +// +// Copyright (c) 2020 Riverbank Computing Limited +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, copy, +// modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + + +#include +#include +#include +#include +#include +#include + +#include + + +class QTimerEvent; + + +class pyqt6DBusHelper : public QObject +{ + Q_OBJECT + +public: + struct Watcher + { + Watcher() : watch(0), read(0), write(0) {} + + DBusWatch *watch; + QPointer read; + QPointer write; + }; + + typedef QMultiHash Watchers; + typedef QHash Timeouts; + typedef QListConnections; + + pyqt6DBusHelper(); + + Watchers watchers; + Timeouts timeouts; + Connections connections; + +public slots: + void readSocket(int fd); + void writeSocket(int fd); + void dispatch(); + +protected: + void timerEvent(QTimerEvent *e); +}; diff --git a/designer/designer.pro-in b/designer/designer.pro-in new file mode 100644 index 0000000..14dff62 --- /dev/null +++ b/designer/designer.pro-in @@ -0,0 +1,23 @@ +CONFIG += plugin @QTCONFIG@ warn_on +QT += designer + +# Work around QTBUG-39300. +CONFIG -= android_install + +TARGET = pyqt6 +TEMPLATE = lib + +INCLUDEPATH += @PYINCDIR@ +LIBS += @PYLINK@ +DEFINES += PYTHON_LIB=\\\"@PYSHLIB@\\\" + +SOURCES = pluginloader.cpp +HEADERS = pluginloader.h + +# Install. +target.path = @QTPLUGINDIR@ + +python.path = @QTPLUGINDIR@ +python.files = python + +INSTALLS += target python diff --git a/designer/pluginloader.cpp b/designer/pluginloader.cpp new file mode 100644 index 0000000..c32356c --- /dev/null +++ b/designer/pluginloader.cpp @@ -0,0 +1,326 @@ +/* + * This is the Qt Designer plugin that collects all the Python plugins it can + * find as a widget collection to Designer. + * + * Copyright (c) 2023 Riverbank Computing Limited + * + * This file is part of PyQt6. + * + * This file may be used under the terms of the GNU General Public License + * version 3.0 as published by the Free Software Foundation and appearing in + * the file LICENSE included in the packaging of this file. Please review the + * following information to ensure the GNU General Public License version 3.0 + * requirements will be met: http://www.gnu.org/copyleft/gpl.html. + * + * If you do not wish to use this file under the terms of the GPL version 3.0 + * then you may purchase a commercial license. For more information contact + * info@riverbankcomputing.com. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + + +#include "pluginloader.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../qpy/QtDesigner/qpydesignercustomwidgetplugin.h" + + +// Construct the collection of Python widgets. +PyCustomWidgets::PyCustomWidgets(QObject *parent) : QObject(parent), + sys_path(0), sip_unwrapinstance(0), qtdesigner_custom(0) +{ + // Get the default list of directories to search. These correspond to a + // standard "python" subdirectory of all the places that Designer looks for + // its own plugins. + QStringList default_dirs; + + QStringList path_list = QCoreApplication::libraryPaths(); + foreach (const QString &path, path_list) + default_dirs.append(path + QDir::separator() + + QLatin1String("designer") + QDir::separator() + + QLatin1String("python")); + + default_dirs.append(QDir::homePath() + QDir::separator() + + QLatin1String(".designer") + QDir::separator() + + QLatin1String("plugins") + QDir::separator() + + QLatin1String("python")); + + // Get the list of directories to search. + QStringList dirs; + char *pyqt_path = getenv("PYQTDESIGNERPATH"); + + if (pyqt_path) + { +#if defined(Q_OS_WIN) + QLatin1Char sep(';'); +#else + QLatin1Char sep(':'); +#endif + + QStringList pyqt_dirs = QString::fromLatin1(pyqt_path).split(sep); + + for (QStringList::const_iterator it = pyqt_dirs.constBegin(); it != pyqt_dirs.constEnd(); ++it) + if ((*it).isEmpty()) + dirs << default_dirs; + else + dirs.append(QDir(*it).canonicalPath()); + } + else + dirs = default_dirs; + + // Go through each directory. + for (int i = 0; i < dirs.size(); ++i) + { + QString dir = dirs.at(i); + + // Get a list of all candidate plugin modules. We sort by name to + // provide control over the order they are imported. + QStringList candidates = QDir(dir).entryList(QDir::Files, QDir::Name); + QStringList plugins; + + for (int p = 0; p < candidates.size(); ++p) + { + QStringList parts = candidates.at(p).split('.'); + + if (parts.size() != 2) + continue; + + if (!parts.at(1).startsWith("py")) + continue; + + const QString &plugin = parts.at(0); + + if (!plugin.endsWith("plugin")) + continue; + + if (plugins.contains(plugin)) + continue; + + plugins.append(plugin); + } + + // Skip if there is nothing of interest in this directory. + if (!plugins.size()) + continue; + + // Make sure the interpreter is initialised. Leave this as late as + // possible. + if (!Py_IsInitialized()) + { + QLibrary library(PYTHON_LIB); + + library.setLoadHints(QLibrary::ExportExternalSymbolsHint); + + if (!library.load()) + return; + + // If we seem to be running in a venv the set the program name + // explicitly so that Python finds the right site-packages. + QString venv = QString::fromLocal8Bit(qgetenv("VIRTUAL_ENV")); + + if (!venv.isEmpty()) + { + venv.append(QDir::separator()); +#if defined(Q_OS_WIN) + venv.append(QLatin1String("Scripts")); +#else + venv.append(QLatin1String("bin")); +#endif + venv.append(QDir::separator()).append(QLatin1String("python")); + + wchar_t *venv_wc = new wchar_t[venv.length() + 1]; + venv_wc[venv.toWCharArray(venv_wc)] = L'\0'; + + Py_SetProgramName(venv_wc); + + delete[] venv_wc; + } + + Py_Initialize(); + +#ifdef WITH_THREAD + // Make sure we don't have the GIL. +#if PY_VERSION_HEX < 0x03070000 + PyEval_InitThreads(); +#endif + PyEval_SaveThread(); +#endif + } + + // Import the plugins with the GIL held. +#if defined(WITH_THREAD) + PyGILState_STATE gil_state = PyGILState_Ensure(); +#endif + + bool fatal = importPlugins(dir, plugins); + +#if defined(WITH_THREAD) + PyGILState_Release(gil_state); +#endif + + if (fatal) + break; + } +} + + +// Import the plugins from a directory. +bool PyCustomWidgets::importPlugins(const QString &dir, const QStringList &plugins) +{ + // Make sure we have sys.path. + if (!sys_path) + { + sys_path = getModuleAttr("sys", "path"); + + if (!sys_path) + return true; + } + + // Make sure we have sip.unwrapinstance. + if (!sip_unwrapinstance) + { + sip_unwrapinstance = getModuleAttr("PyQt6.sip", "unwrapinstance"); + + if (!sip_unwrapinstance) + return true; + } + + // Convert the directory to a Python object with native separators. + QString native_dir = QDir::toNativeSeparators(dir); + + PyObject *dobj = PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, native_dir.constData(), native_dir.length()); + + if (!dobj) + { + PyErr_Print(); + return false; + } + + // Add the directory to sys.path. + int rc = PyList_Append(sys_path, dobj); + Py_DECREF(dobj); + + if (rc < 0) + { + PyErr_Print(); + return false; + } + + // Import each plugin. + for (int plug = 0; plug < plugins.size(); ++plug) + { + PyObject *plug_mod = PyImport_ImportModule(plugins.at(plug).toLatin1().data()); + + if (!plug_mod) + { + PyErr_Print(); + continue; + } + + // Make sure we have QPyDesignerCustomWidgetPlugin. We make sure this + // is after the import of the first plugin to allow that plugin to + // change any API versions. + if (!qtdesigner_custom) + { + qtdesigner_custom = getModuleAttr("PyQt6.QtDesigner", "QPyDesignerCustomWidgetPlugin"); + + if (!qtdesigner_custom) + return true; + } + + // Go through the module looking for types that implement + // QDesignerCustomWidgetInterface (ie. by deriving from + // QPyDesignerCustomWidgetPlugin). + PyObject *mod_dict = PyModule_GetDict(plug_mod); + PyObject *key, *value; + Py_ssize_t pos = 0; + + while (PyDict_Next(mod_dict, &pos, &key, &value)) + { + if (!PyType_Check(value)) + continue; + + if (value == qtdesigner_custom) + continue; + + if (!PyType_IsSubtype((PyTypeObject *)value, (PyTypeObject *)qtdesigner_custom)) + continue; + + // Create the plugin instance. Note that we don't give it a + // parent, which make things easier. It also means that Python + // owns the instance so we don't decrement the reference count so + // that it doesn't get garbage collected. + PyObject *plugobj = PyObject_CallObject(value, NULL); + + if (!plugobj) + { + PyErr_Print(); + continue; + } + + // Get the address of the C++ instance. + PyObject *plugaddr = PyObject_CallFunctionObjArgs(sip_unwrapinstance, plugobj, NULL); + + if (!plugaddr) + { + Py_DECREF(plugobj); + PyErr_Print(); + continue; + } + + void *addr = PyLong_AsVoidPtr(plugaddr); + Py_DECREF(plugaddr); + + widgets.append(reinterpret_cast(addr)); + } + + Py_DECREF(plug_mod); + } + + // No fatal errors. + return false; +} + + +// Return the list of custom widgets. +QList PyCustomWidgets::customWidgets() const +{ + return widgets; +} + + +// Return the named attribute object from the named module. +PyObject *PyCustomWidgets::getModuleAttr(const char *module, const char *attr) +{ + PyObject *mod = PyImport_ImportModule(module); + + if (!mod) + { + PyErr_Print(); + return 0; + } + + PyObject *obj = PyObject_GetAttrString(mod, attr); + + Py_DECREF(mod); + + if (!obj) + { + PyErr_Print(); + return 0; + } + + return obj; +} diff --git a/designer/pluginloader.h b/designer/pluginloader.h new file mode 100644 index 0000000..9d6f5d4 --- /dev/null +++ b/designer/pluginloader.h @@ -0,0 +1,66 @@ +/* + * This is the interface of the Qt Designer plugin. + * + * Copyright (c) 2023 Riverbank Computing Limited + * + * This file is part of PyQt6. + * + * This file may be used under the terms of the GNU General Public License + * version 3.0 as published by the Free Software Foundation and appearing in + * the file LICENSE included in the packaging of this file. Please review the + * following information to ensure the GNU General Public License version 3.0 + * requirements will be met: http://www.gnu.org/copyleft/gpl.html. + * + * If you do not wish to use this file under the terms of the GPL version 3.0 + * then you may purchase a commercial license. For more information contact + * info@riverbankcomputing.com. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + + +#ifndef _PLUGINLOADER_H +#define _PLUGINLOADER_H + +#include + +#include +#include +#include + + +QT_BEGIN_NAMESPACE +class QDesignerCustomWidgetInterface; +QT_END_NAMESPACE + + +class PyCustomWidgets + : public QObject, public QDesignerCustomWidgetCollectionInterface +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface") + Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) + +public: + PyCustomWidgets(QObject *parent = 0); + + virtual QList customWidgets() const; + +private: + bool importPlugins(const QString &dir, const QStringList &plugins); + static PyObject *getModuleAttr(const char *module, const char *attr); + + // The sys.path object if we need it. + PyObject *sys_path; + + // The sip.unwrapinstance object if we need it. + PyObject *sip_unwrapinstance; + + // The PyQt6.QtDesigner.QPyDesignerCustomWidgetPlugin object if we need it. + PyObject *qtdesigner_custom; + + QList widgets; +}; + +#endif diff --git a/examples/designer/calculatorform/calculatorform.py b/examples/designer/calculatorform/calculatorform.py new file mode 100644 index 0000000..cb9f1ab --- /dev/null +++ b/examples/designer/calculatorform/calculatorform.py @@ -0,0 +1,71 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import pyqtSlot +from PyQt6.QtWidgets import QApplication, QWidget + +from ui_calculatorform import Ui_CalculatorForm + + +class CalculatorForm(QWidget): + def __init__(self, parent=None): + super().__init__(parent) + + self.ui = Ui_CalculatorForm() + + self.ui.setupUi(self) + + @pyqtSlot(int) + def on_inputSpinBox1_valueChanged(self, value): + self.ui.outputWidget.setText(str(value + self.ui.inputSpinBox2.value())) + + @pyqtSlot(int) + def on_inputSpinBox2_valueChanged(self, value): + self.ui.outputWidget.setText(str(value + self.ui.inputSpinBox1.value())) + + +if __name__ == '__main__': + import sys + + app = QApplication(sys.argv) + calculator = CalculatorForm() + calculator.show() + sys.exit(app.exec()) diff --git a/examples/designer/calculatorform/calculatorform.ui b/examples/designer/calculatorform/calculatorform.ui new file mode 100644 index 0000000..3a95639 --- /dev/null +++ b/examples/designer/calculatorform/calculatorform.ui @@ -0,0 +1,284 @@ + + + + + CalculatorForm + + + CalculatorForm + + + + 0 + 0 + 400 + 300 + + + + + 5 + 5 + 0 + 0 + + + + Calculator Form + + + + + + + 9 + + + 6 + + + + + horizontalSpacer + + + + 239 + 9 + 152 + 52 + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + label_3_2 + + + + 169 + 9 + 20 + 52 + + + + = + + + Qt::AlignCenter + + + + + + + + + + 1 + + + 6 + + + + + label_2_2_2 + + + + 1 + 1 + 36 + 17 + + + + Output + + + + + + + outputWidget + + + + 1 + 24 + 36 + 27 + + + + QFrame::Box + + + QFrame::Sunken + + + 0 + + + Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask + + + + + + + + + verticalSpacer + + + + 89 + 67 + 20 + 224 + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 1 + + + 6 + + + + + label_2 + + + + 1 + 1 + 46 + 19 + + + + Input 2 + + + + + + + inputSpinBox2 + + + + 1 + 26 + 46 + 25 + + + + + + + + + + label_3 + + + + 63 + 9 + 20 + 52 + + + + + + + + Qt::AlignCenter + + + + + + + + + + 1 + + + 6 + + + + + label + + + + 1 + 1 + 46 + 19 + + + + Input 1 + + + + + + + inputSpinBox1 + + + + 1 + 26 + 46 + 25 + + + + + + + + + + + + diff --git a/examples/designer/calculatorform/ui_calculatorform.py b/examples/designer/calculatorform/ui_calculatorform.py new file mode 100644 index 0000000..21fbc8d --- /dev/null +++ b/examples/designer/calculatorform/ui_calculatorform.py @@ -0,0 +1,93 @@ +# Form implementation generated from reading ui file 'calculatorform.ui' +# +# Created by: PyQt6 UI code generator 6.1.0.dev2103211315 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_CalculatorForm(object): + def setupUi(self, CalculatorForm): + CalculatorForm.setObjectName("CalculatorForm") + CalculatorForm.resize(400, 300) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy(5), QtWidgets.QSizePolicy.Policy(5)) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(CalculatorForm.sizePolicy().hasHeightForWidth()) + CalculatorForm.setSizePolicy(sizePolicy) + self.gridlayout = QtWidgets.QGridLayout(CalculatorForm) + self.gridlayout.setContentsMargins(9, 9, 9, 9) + self.gridlayout.setSpacing(6) + self.gridlayout.setObjectName("gridlayout") + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum) + self.gridlayout.addItem(spacerItem, 0, 6, 1, 1) + self.label_3_2 = QtWidgets.QLabel(CalculatorForm) + self.label_3_2.setGeometry(QtCore.QRect(169, 9, 20, 52)) + self.label_3_2.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.label_3_2.setObjectName("label_3_2") + self.gridlayout.addWidget(self.label_3_2, 0, 4, 1, 1) + self.vboxlayout = QtWidgets.QVBoxLayout() + self.vboxlayout.setContentsMargins(1, 1, 1, 1) + self.vboxlayout.setSpacing(6) + self.vboxlayout.setObjectName("vboxlayout") + self.label_2_2_2 = QtWidgets.QLabel(CalculatorForm) + self.label_2_2_2.setGeometry(QtCore.QRect(1, 1, 36, 17)) + self.label_2_2_2.setObjectName("label_2_2_2") + self.vboxlayout.addWidget(self.label_2_2_2) + self.outputWidget = QtWidgets.QLabel(CalculatorForm) + self.outputWidget.setGeometry(QtCore.QRect(1, 24, 36, 27)) + self.outputWidget.setFrameShape(QtWidgets.QFrame.Shape.Box) + self.outputWidget.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) + self.outputWidget.setAlignment(QtCore.Qt.AlignmentFlag.AlignAbsolute|QtCore.Qt.AlignmentFlag.AlignBottom|QtCore.Qt.AlignmentFlag.AlignCenter|QtCore.Qt.AlignmentFlag.AlignHCenter|QtCore.Qt.AlignmentFlag.AlignHorizontal_Mask|QtCore.Qt.AlignmentFlag.AlignJustify|QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignRight|QtCore.Qt.AlignmentFlag.AlignTop|QtCore.Qt.AlignmentFlag.AlignTrailing|QtCore.Qt.AlignmentFlag.AlignVCenter|QtCore.Qt.AlignmentFlag.AlignVertical_Mask) + self.outputWidget.setObjectName("outputWidget") + self.vboxlayout.addWidget(self.outputWidget) + self.gridlayout.addLayout(self.vboxlayout, 0, 5, 1, 1) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.gridlayout.addItem(spacerItem1, 1, 2, 1, 1) + self.vboxlayout1 = QtWidgets.QVBoxLayout() + self.vboxlayout1.setContentsMargins(1, 1, 1, 1) + self.vboxlayout1.setSpacing(6) + self.vboxlayout1.setObjectName("vboxlayout1") + self.label_2 = QtWidgets.QLabel(CalculatorForm) + self.label_2.setGeometry(QtCore.QRect(1, 1, 46, 19)) + self.label_2.setObjectName("label_2") + self.vboxlayout1.addWidget(self.label_2) + self.inputSpinBox2 = QtWidgets.QSpinBox(CalculatorForm) + self.inputSpinBox2.setGeometry(QtCore.QRect(1, 26, 46, 25)) + self.inputSpinBox2.setObjectName("inputSpinBox2") + self.vboxlayout1.addWidget(self.inputSpinBox2) + self.gridlayout.addLayout(self.vboxlayout1, 0, 3, 1, 1) + self.label_3 = QtWidgets.QLabel(CalculatorForm) + self.label_3.setGeometry(QtCore.QRect(63, 9, 20, 52)) + self.label_3.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.label_3.setObjectName("label_3") + self.gridlayout.addWidget(self.label_3, 0, 1, 1, 1) + self.vboxlayout2 = QtWidgets.QVBoxLayout() + self.vboxlayout2.setContentsMargins(1, 1, 1, 1) + self.vboxlayout2.setSpacing(6) + self.vboxlayout2.setObjectName("vboxlayout2") + self.label = QtWidgets.QLabel(CalculatorForm) + self.label.setGeometry(QtCore.QRect(1, 1, 46, 19)) + self.label.setObjectName("label") + self.vboxlayout2.addWidget(self.label) + self.inputSpinBox1 = QtWidgets.QSpinBox(CalculatorForm) + self.inputSpinBox1.setGeometry(QtCore.QRect(1, 26, 46, 25)) + self.inputSpinBox1.setObjectName("inputSpinBox1") + self.vboxlayout2.addWidget(self.inputSpinBox1) + self.gridlayout.addLayout(self.vboxlayout2, 0, 0, 1, 1) + + self.retranslateUi(CalculatorForm) + QtCore.QMetaObject.connectSlotsByName(CalculatorForm) + + def retranslateUi(self, CalculatorForm): + _translate = QtCore.QCoreApplication.translate + CalculatorForm.setWindowTitle(_translate("CalculatorForm", "Calculator Form")) + self.label_3_2.setText(_translate("CalculatorForm", "=")) + self.label_2_2_2.setText(_translate("CalculatorForm", "Output")) + self.outputWidget.setText(_translate("CalculatorForm", "0")) + self.label_2.setText(_translate("CalculatorForm", "Input 2")) + self.label_3.setText(_translate("CalculatorForm", "+")) + self.label.setText(_translate("CalculatorForm", "Input 1")) diff --git a/examples/designer/plugins/plugins.py b/examples/designer/plugins/plugins.py new file mode 100644 index 0000000..3458a94 --- /dev/null +++ b/examples/designer/plugins/plugins.py @@ -0,0 +1,83 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Riverbank Computing Limited nor the names of +## its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +import sys +import os + +from PyQt6.QtCore import QLibraryInfo, QProcess, QProcessEnvironment +from PyQt6.QtWidgets import QApplication, QMessageBox + + +app = QApplication(sys.argv) + +QMessageBox.information(None, "PyQt Designer Plugins", + "

This example will start Qt Designer when you click the OK " + "button.

" + "

Before doing so it sets the PYQTDESIGNERPATH environment " + "variable to the python directory that is part of this " + "example. This directory contains all the example Python plugin " + "modules.

" + "

It also sets the PYTHONPATH environment variable to the " + "widgets directory that is also part of this example. This " + "directory contains the Python modules that implement the example " + "custom widgets.

" + "

All of the example custom widgets should then appear in " + "Designer's widget box in the PyQt Examples group.

") + +# Tell Qt Designer where it can find the directory containing the plugins and +# Python where it can find the widgets. +base = os.path.dirname(__file__) +env = QProcessEnvironment.systemEnvironment() +env.insert('PYQTDESIGNERPATH', os.path.join(base, 'python')) +env.insert('PYTHONPATH', os.path.join(base, 'widgets')) + +# Start Designer. +designer = QProcess() +designer.setProcessEnvironment(env) + +designer_bin = QLibraryInfo.path(QLibraryInfo.LibraryPath.BinariesPath) + +if sys.platform == 'darwin': + designer_bin += '/Designer.app/Contents/MacOS/Designer' +else: + designer_bin += '/designer' + +designer.start(designer_bin) +designer.waitForFinished(-1) + +sys.exit(designer.exitCode()) diff --git a/examples/designer/plugins/python/analogclockplugin.py b/examples/designer/plugins/python/analogclockplugin.py new file mode 100644 index 0000000..bac35f4 --- /dev/null +++ b/examples/designer/plugins/python/analogclockplugin.py @@ -0,0 +1,193 @@ +""" +analogclockplugin.py + +An analog clock custom widget plugin for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +from PyQt6.QtGui import QIcon, QPixmap +from PyQt6.QtDesigner import QPyDesignerCustomWidgetPlugin + +from analogclock import PyAnalogClock + + +class PyAnalogClockPlugin(QPyDesignerCustomWidgetPlugin): + """PyAnalogClockPlugin(QPyDesignerCustomWidgetPlugin) + + Provides a Python custom plugin for Qt Designer by implementing the + QDesignerCustomWidgetPlugin via a PyQt-specific custom plugin class. + """ + + # The __init__() method is only used to set up the plugin and define its + # initialized variable. + def __init__(self, parent=None): + + super().__init__(parent) + + self.initialized = False + + # The initialize() and isInitialized() methods allow the plugin to set up + # any required resources, ensuring that this can only happen once for each + # plugin. + def initialize(self, core): + + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + + return self.initialized + + # This factory method creates new instances of our custom widget with the + # appropriate parent. + def createWidget(self, parent): + return PyAnalogClock(parent) + + # This method returns the name of the custom widget class that is provided + # by this plugin. + def name(self): + return "PyAnalogClock" + + # Returns the name of the group in Qt Designer's widget box that this + # widget belongs to. + def group(self): + return "PyQt Examples" + + # Returns the icon used to represent the custom widget in Qt Designer's + # widget box. + def icon(self): + return QIcon(_logo_pixmap) + + # Returns a short description of the custom widget for use in a tool tip. + def toolTip(self): + return "" + + # Returns a short description of the custom widget for use in a "What's + # This?" help message for the widget. + def whatsThis(self): + return "" + + # Returns True if the custom widget acts as a container for other widgets; + # otherwise returns False. Note that plugins for custom containers also + # need to provide an implementation of the QDesignerContainerExtension + # interface if they need to add custom editing support to Qt Designer. + def isContainer(self): + return False + + # Returns an XML description of a custom widget instance that describes + # default values for its properties. Each custom widget created by this + # plugin will be configured using this description. + def domXml(self): + return '\n' \ + ' \n' \ + ' The current time\n' \ + ' \n' \ + ' \n' \ + ' The analog clock widget displays the current ' \ + 'time.\n' \ + ' \n' \ + '\n' + + # Returns the module containing the custom widget class. It may include + # a module path. + def includeFile(self): + return "analogclock" + + +# Define the image used for the icon. +_logo_16x16_xpm = [ + "16 16 58 1", + "L c #2d2d2d", + "N c #4f4f4f", + "K c #636363", + "J c #666666", + "I c #696969", + "D c #727272", + "F c #737373", + "O c #757575", + "G c #7f7f7f", + "o c #878787", + "t c #888888", + "Y c #898989", + "c c #8a8a8a", + "d c #8b8b8b", + "H c #8d8d8d", + "Q c #8f8f8f", + "b c #909090", + "M c #959595", + "g c #979797", + "n c #989898", + "x c #999999", + "0 c #9a9a9a", + "X c #9b9b9b", + "a c #9d9d9d", + "E c #9e9e9e", + "1 c #9f9f9f", + "T c #a0a0a0", + "v c #a1a1a1", + "r c #a2a2a2", + "B c #a6a6a6", + "R c #a7a7a7", + "3 c #a8a8a8", + "z c #aaaaaa", + "A c #ababab", + "m c #acacac", + "h c #adadad", + "u c #b1b1b1", + "q c #b2b2b2", + "V c #bfbfbf", + "W c #c6c6c6", + "w c #c7c7c7", + "s c #c8c8c8", + "p c #c9c9c9", + "k c #cdcdcd", + "l c #cfcfcf", + "2 c #d3d3d3", + "S c #d4d4d4", + "C c #d5d5d5", + "y c #d8d8d8", + "# c #d9d9d9", + "e c #dadada", + "i c #dbdbdb", + "P c #dcdcdc", + "U c #dfdfdf", + "j c #e1e1e1", + "f c #fbfbfb", + "Z c #fcfcfc", + ". c #ffffff", + "....#abcdbae....", + "..fghijkljimnf..", + ".fopjjjqrjjjstf.", + ".gsjjjjuvjjjjwx.", + "yvjjjjjzbjjjjjAi", + "BCjjjjjaDjjjjjiE", + "bjjjjjjEFjjjjjjG", + "HjjjjjjIJjjjjjjc", + "HjjjjjjnKLtjjjjc", + "bjjjjjjj#MNOPjjQ", + "RSjjjjjjjj#mdPiE", + "#TjjjjjjjjjjUjzP", + ".nVjjjjjjjjjjWX.", + ".fEVjjjjjjjjWYZ.", + "..f012jjjj2EXZ..", + "....i3QccQ3P...."] + +_logo_pixmap = QPixmap(_logo_16x16_xpm) diff --git a/examples/designer/plugins/python/bubbleswidgetplugin.py b/examples/designer/plugins/python/bubbleswidgetplugin.py new file mode 100644 index 0000000..9471005 --- /dev/null +++ b/examples/designer/plugins/python/bubbleswidgetplugin.py @@ -0,0 +1,192 @@ +""" +bubbleswidgetplugin.py + +A bubbles widget custom widget plugin for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +from PyQt6.QtGui import QIcon, QPixmap +from PyQt6.QtDesigner import QPyDesignerCustomWidgetPlugin + +from bubbleswidget import BubblesWidget + + +class BubblesPlugin(QPyDesignerCustomWidgetPlugin): + """BubblesPlugin(QPyDesignerCustomWidgetPlugin) + + Provides a Python custom plugin for Qt Designer by implementing the + QDesignerCustomWidgetPlugin via a PyQt-specific custom plugin class. + """ + + # The __init__() method is only used to set up the plugin and define its + # initialized variable. + def __init__(self, parent=None): + + super().__init__(parent) + + self.initialized = False + + # The initialize() and isInitialized() methods allow the plugin to set up + # any required resources, ensuring that this can only happen once for each + # plugin. + def initialize(self, core): + + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + + return self.initialized + + # This factory method creates new instances of our custom widget with the + # appropriate parent. + def createWidget(self, parent): + + return BubblesWidget(parent) + + # This method returns the name of the custom widget class that is provided + # by this plugin. + def name(self): + + return "BubblesWidget" + + # Returns the name of the group in Qt Designer's widget box that this + # widget belongs to. + def group(self): + + return "PyQt Examples" + + # Returns the icon used to represent the custom widget in Qt Designer's + # widget box. + def icon(self): + + return QIcon(_logo_pixmap) + + # Returns a short description of the custom widget for use in a tool tip. + def toolTip(self): + + return "" + + # Returns a short description of the custom widget for use in a "What's + # This?" help message for the widget. + def whatsThis(self): + + return "" + + # Returns True if the custom widget acts as a container for other widgets; + # otherwise returns False. Note that plugins for custom containers also + # need to provide an implementation of the QDesignerContainerExtension + # interface if they need to add custom editing support to Qt Designer. + def isContainer(self): + + return False + + # Returns an XML description of a custom widget instance that describes + # default values for its properties. Each custom widget created by this + # plugin will be configured using this description. + def domXml(self): + + return '\n' \ + ' \n' \ + ' Click and drag here\n' \ + ' \n' \ + ' \n' \ + ' The bubbles widget displays colorful ' \ + 'bubbles.\n' \ + ' \n' \ + '\n' + + # Returns the module containing the custom widget class. It may include + # a module path. + def includeFile(self): + + return "bubbleswidget" + + +# Define the image used for the icon. +_logo_16x16_xpm = [ +"16 16 48 1", +"O c #d0cfcf", +"d c #d0d0d0", +"i c #d3d3d2", +"q c #d3d3d3", +"M c #dad7d7", +"g c #dad8d7", +"e c #dcd9d9", +"f c #e0dcdc", +"c c #e0e0e0", +"L c #e1dddb", +"D c #e1dddc", +"E c #e1e0e0", +"R c #e1e1e1", +"Q c #e2dedc", +"p c #e2dedd", +"j c #e3dfdf", +"b c #e7e7e7", +"S c #ebe4e3", +"z c #ebe5e3", +"r c #ece6e8", +"a c #eeeeee", +"N c #f6edeb", +"I c #f6eeed", +"o c #f6eeee", +"h c #f7f7f7", +"K c #f8efee", +"C c #f8efef", +"T c #f8f8f8", +"y c #f9f1f0", +"H c #f9f1f1", +"n c #f9f1f2", +"m c #f9f1f3", +"k c #f9f2f4", +"x c #faf3f5", +"l c #faf3f6", +"w c #faf3f7", +"G c #faf3f8", +"v c #fbf5fa", +"s c #fbf5fb", +"u c #fbf5fc", +"t c #fbf5fd", +"# c #fbfbfb", +"J c #fcf6fe", +"B c #fcf7fe", +"P c #fcfcfc", +"F c #fdf8ff", +"A c #fefbff", +". c #ffffff", +".....#abba#.....", +"...#cdeffgdc#...", +"..hijkllmnopqh..", +".#irstuvwxnyzq#.", +".cjs.ABuvwknCDE.", +"#dktAAFtsGlmHId#", +"aeluBFJusGlmHKga", +"bflvutusvGlmHKLb", +"bfmwvssvGwxmHKLb", +"agnxwGGGwlmnyKMa", +"#donklllxmnHCNOP", +".cpynmmmmnHCKQR.", +".#qzCHHHHyCKSqP.", +"..hqDIKKKKNQqT..", +"...#EdgLLMORP...", +".....#abbaP....."] + +_logo_pixmap = QPixmap(_logo_16x16_xpm) diff --git a/examples/designer/plugins/python/counterlabelplugin.py b/examples/designer/plugins/python/counterlabelplugin.py new file mode 100644 index 0000000..05f2752 --- /dev/null +++ b/examples/designer/plugins/python/counterlabelplugin.py @@ -0,0 +1,103 @@ +""" +counterlabelplugin.py + +A counter label custom widget plugin for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +from PyQt6.QtGui import QIcon +from PyQt6.QtDesigner import QPyDesignerCustomWidgetPlugin + +from counterlabel import CounterLabel + + +class CounterLabelPlugin(QPyDesignerCustomWidgetPlugin): + """CounterLabelPlugin(QPyDesignerCustomWidgetPlugin) + + Provides a Python custom plugin for Qt Designer by implementing the + QDesignerCustomWidgetPlugin via a PyQt-specific custom plugin class. + """ + + # The __init__() method is only used to set up the plugin and define its + # initialized variable. + def __init__(self, parent=None): + + super().__init__(parent) + + self.initialized = False + + def initialize(self, formEditor): + + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + + return self.initialized + + # This factory method creates new instances of our custom widget with the + # appropriate parent. + def createWidget(self, parent): + widget = CounterLabel(parent) + widget.setValue(1) + return widget + + # This method returns the name of the custom widget class that is provided + # by this plugin. + def name(self): + return "CounterLabel" + + # Returns the name of the group in Qt Designer's widget box that this + # widget belongs to. + def group(self): + return "PyQt Examples" + + # Returns the icon used to represent the custom widget in Qt Designer's + # widget box. + def icon(self): + return QIcon() + + # Returns a short description of the custom widget for use in a tool tip. + def toolTip(self): + return "" + + # Returns a short description of the custom widget for use in a "What's + # This?" help message for the widget. + def whatsThis(self): + return "" + + # Returns True if the custom widget acts as a container for other widgets; + # otherwise returns False. Note that plugins for custom containers also + # need to provide an implementation of the QDesignerContainerExtension + # interface if they need to add custom editing support to Qt Designer. + def isContainer(self): + return False + + # Returns an XML description of a custom widget instance that describes + # default values for its properties. Each custom widget created by this + # plugin will be configured using this description. + def domXml(self): + return '\n' + + # Returns the module containing the custom widget class. It may include + # a module path. + def includeFile(self): + return "counterlabel" diff --git a/examples/designer/plugins/python/datetimeeditplugin.py b/examples/designer/plugins/python/datetimeeditplugin.py new file mode 100644 index 0000000..cca2227 --- /dev/null +++ b/examples/designer/plugins/python/datetimeeditplugin.py @@ -0,0 +1,126 @@ +#============================================================================# +# Designer plugins for PyDateEdit and PyDateTimeEdit # +#----------------------------------------------------------------------------# +# Copyright (c) 2008 by Denviso GmbH, # +# # +# All Rights Reserved # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, # +# provided that the above copyright notice appear in all copies and that # +# both that copyright notice and this permission notice appear in # +# supporting documentation. # +# # +# DENVISO DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS # +# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # +# AND FITNESS, IN NO EVENT SHALL DENVISO BE LIABLE FOR ANY # +# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE # +# OR PERFORMANCE OF THIS SOFTWARE. # +#----------------------------------------------------------------------------# + + +from PyQt6.QtGui import QIcon +from PyQt6.QtDesigner import QPyDesignerCustomWidgetPlugin + +from datetimeedit import PyDateEdit, PyDateTimeEdit + + +#============================================================================# +# The group name in designer widgetbox # +#----------------------------------------------------------------------------# +DESIGNER_GROUP_NAME = "PyQt Examples" + + +#============================================================================# +# Plugin for PyDateEdit # +#----------------------------------------------------------------------------# +class PyDateEditPlugin(QPyDesignerCustomWidgetPlugin): + + def __init__(self, parent=None): + super().__init__(parent) + + self.initialized = False + + def initialize(self, formEditor): + if self.initialized: + return + self.initialized = True + + def isInitialized(self): + return self.initialized + + def isContainer(self): + return False + + def icon(self): + return QIcon() + + def domXml(self): + return '\n\n' + + def group(self): + return DESIGNER_GROUP_NAME + + def includeFile(self): + return "datetimeedit" + + def name(self): + return "PyDateEdit" + + def toolTip(self): + return "" + + def whatsThis(self): + return "" + + def createWidget(self, parent): + return PyDateEdit(parent) + + +#============================================================================# +# Plugin for PyDateTimeEdit # +#----------------------------------------------------------------------------# +class PyDateTimeEditPlugin(QPyDesignerCustomWidgetPlugin): + + def __init__(self, parent=None): + super().__init__(parent) + + self.initialized = False + + def initialize(self, formEditor): + if self.initialized: + return + self.initialized = True + + def isInitialized(self): + return self.initialized + + def isContainer(self): + return False + + def icon(self): + return QIcon() + + def domXml(self): + return '\n\n' + + def group(self): + return DESIGNER_GROUP_NAME + + def includeFile(self): + return "datetimeedit" + + def name(self): + return "PyDateTimeEdit" + + def toolTip(self): + return "" + + def whatsThis(self): + return "" + + def createWidget(self, parent): + return PyDateTimeEdit(parent) diff --git a/examples/designer/plugins/python/helloglwidgetplugin.py b/examples/designer/plugins/python/helloglwidgetplugin.py new file mode 100644 index 0000000..f3f1a61 --- /dev/null +++ b/examples/designer/plugins/python/helloglwidgetplugin.py @@ -0,0 +1,103 @@ +""" +helloglwidgetplugin.py + +A simple OpenGL custom widget plugin for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +from PyQt6.QtGui import QIcon +from PyQt6.QtDesigner import QPyDesignerCustomWidgetPlugin + +from helloglwidget import HelloGLWidget + + +class HelloGLWidgetPlugin(QPyDesignerCustomWidgetPlugin): + """HelloGLWidgetPlugin(QPyDesignerCustomWidgetPlugin) + + Provides a Python custom plugin for Qt Designer by implementing the + QDesignerCustomWidgetPlugin via a PyQt-specific custom plugin class. + """ + + # The __init__() method is only used to set up the plugin and define its + # initialized variable. + def __init__(self, parent=None): + + super().__init__(parent) + + self.initialized = False + + # The initialize() and isInitialized() methods allow the plugin to set up + # any required resources, ensuring that this can only happen once for each + # plugin. + def initialize(self, core): + + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + return self.initialized + + # This factory method creates new instances of our custom widget with the + # appropriate parent. + def createWidget(self, parent): + return HelloGLWidget(parent) + + # This method returns the name of the custom widget class that is provided + # by this plugin. + def name(self): + return "HelloGLWidget" + + # Returns the name of the group in Qt Designer's widget box that this + # widget belongs to. + def group(self): + return "PyQt Examples" + + # Returns the icon used to represent the custom widget in Qt Designer's + # widget box. + def icon(self): + return QIcon() + + # Returns a short description of the custom widget for use in a tool tip. + def toolTip(self): + return "" + + # Returns a short description of the custom widget for use in a "What's + # This?" help message for the widget. + def whatsThis(self): + return "" + + # Returns True if the custom widget acts as a container for other widgets; + # otherwise returns False. Note that plugins for custom containers also + # need to provide an implementation of the QDesignerContainerExtension + # interface if they need to add custom editing support to Qt Designer. + def isContainer(self): + return False + + # Returns an XML description of a custom widget instance that describes + # default values for its properties. Each custom widget created by this + # plugin will be configured using this description. + def domXml(self): + return '\n' + + # Returns the module containing the custom widget class. It may include + # a module path. + def includeFile(self): + return "helloglwidget" diff --git a/examples/designer/plugins/python/multipagewidgetplugin.py b/examples/designer/plugins/python/multipagewidgetplugin.py new file mode 100644 index 0000000..75bb89a --- /dev/null +++ b/examples/designer/plugins/python/multipagewidgetplugin.py @@ -0,0 +1,142 @@ +#============================================================================# +# PyQt6 port of the designer/containerextension example from Qt v4.x # +#----------------------------------------------------------------------------# +from PyQt6.QtGui import QIcon +from PyQt6.QtDesigner import (QDesignerFormWindowInterface, QExtensionFactory, + QPyDesignerContainerExtension, QPyDesignerCustomWidgetPlugin, + QPyDesignerPropertySheetExtension) +from PyQt6.sip import cast + +from multipagewidget import PyMultiPageWidget + + +Q_TYPEID = { + 'QDesignerContainerExtension': 'org.qt-project.Qt.Designer.Container', + 'QDesignerPropertySheetExtension': 'org.qt-project.Qt.Designer.PropertySheet' +} + + +#============================================================================# +# ContainerExtension # +#----------------------------------------------------------------------------# +class MultiPageWidgetContainerExtension(QPyDesignerContainerExtension): + def __init__(self, widget, parent=None): + super().__init__(parent) + + self._widget = widget + + def addWidget(self, widget): + self._widget.addPage(widget) + + def count(self): + return self._widget.count() + + def currentIndex(self): + return self._widget.getCurrentIndex() + + def insertWidget(self, index, widget): + self._widget.insertPage(index, widget) + + def remove(self, index): + self._widget.removePage(index) + + def setCurrentIndex(self, index): + self._widget.setCurrentIndex(index) + + def widget(self, index): + return self._widget.widget(index) + + +#============================================================================# +# ExtensionFactory # +#----------------------------------------------------------------------------# +class MultiPageWidgetExtensionFactory(QExtensionFactory): + def __init__(self, parent=None): + super().__init__(parent) + + def createExtension(self, obj, iid, parent): + if iid != Q_TYPEID['QDesignerContainerExtension']: + return None + if isinstance(obj, PyMultiPageWidget): + return MultiPageWidgetContainerExtension(obj, parent) + return None + + +#============================================================================# +# CustomWidgetPlugin # +#----------------------------------------------------------------------------# +class MultiPageWidgetPlugin(QPyDesignerCustomWidgetPlugin): + + def __init__(self, parent=None): + super().__init__(parent) + + self.initialized = False + + def initialize(self, formEditor): + if self.initialized: + return + manager = formEditor.extensionManager() + if manager: + self.factory = MultiPageWidgetExtensionFactory(manager) + manager.registerExtensions(self.factory, Q_TYPEID['QDesignerContainerExtension']) + self.initialized = True + + def isInitialized(self): + return self.initialized + + def createWidget(self, parent): + widget = PyMultiPageWidget(parent) + widget.currentIndexChanged.connect(self.currentIndexChanged) + widget.pageTitleChanged.connect(self.pageTitleChanged) + return widget + + def name(self): + return "PyMultiPageWidget" + + def group(self): + return "PyQt Examples" + + def icon(self): + return QIcon() + + def toolTip(self): + return "" + + def whatsThis(self): + return "" + + def isContainer(self): + return True + + def domXml(self): + return ('' + ' ' + '') + + def includeFile(self): + return "multipagewidget" + + def currentIndexChanged(self, index): + widget = self.sender() + if widget and isinstance(widget, PyMultiPageWidget): + form = QDesignerFormWindowInterface.findFormWindow(widget) + if form: + form.emitSelectionChanged() + + def pageTitleChanged(self, title): + widget = self.sender() + if widget and isinstance(widget, PyMultiPageWidget): + page = widget.widget(widget.getCurrentIndex()) + form = QDesignerFormWindowInterface.findFormWindow(widget) + if form: + editor = form.core() + manager = editor.extensionManager() + sheet = manager.extension(page, Q_TYPEID['QDesignerPropertySheetExtension']) + # This explicit cast is necessary here + sheet = cast(sheet, QPyDesignerPropertySheetExtension) + propertyIndex = sheet.indexOf('windowTitle') + sheet.setChanged(propertyIndex, True) + +#============================================================================# +# EOF # +#----------------------------------------------------------------------------# diff --git a/examples/designer/plugins/python/polygonwidgetplugin.py b/examples/designer/plugins/python/polygonwidgetplugin.py new file mode 100644 index 0000000..103ac0d --- /dev/null +++ b/examples/designer/plugins/python/polygonwidgetplugin.py @@ -0,0 +1,173 @@ +""" +polygonwidgetplugin.py + +A polygon widget custom widget plugin for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +from PyQt6.QtGui import QIcon, QPixmap +from PyQt6.QtDesigner import QPyDesignerCustomWidgetPlugin + +from polygonwidget import PolygonWidget + + +class PolygonWidgetPlugin(QPyDesignerCustomWidgetPlugin): + """PolygonWidgetPlugin(QPyDesignerCustomWidgetPlugin) + + Provides a Python custom plugin for Qt Designer by implementing the + QDesignerCustomWidgetPlugin via a PyQt-specific custom plugin class. + """ + + # The __init__() method is only used to set up the plugin and define its + # initialized variable. + def __init__(self, parent=None): + + super().__init__(parent) + + self.initialized = False + + # The initialize() and isInitialized() methods allow the plugin to set up + # any required resources, ensuring that this can only happen once for each + # plugin. + def initialize(self, core): + + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + + return self.initialized + + # This factory method creates new instances of our custom widget with the + # appropriate parent. + def createWidget(self, parent): + return PolygonWidget(parent) + + # This method returns the name of the custom widget class that is provided + # by this plugin. + def name(self): + return "PolygonWidget" + + # Returns the name of the group in Qt Designer's widget box that this + # widget belongs to. + def group(self): + return "PyQt Examples" + + # Returns the icon used to represent the custom widget in Qt Designer's + # widget box. + def icon(self): + return QIcon(_logo_pixmap) + + # Returns a short description of the custom widget for use in a tool tip. + def toolTip(self): + return "" + + # Returns a short description of the custom widget for use in a "What's + # This?" help message for the widget. + def whatsThis(self): + return "" + + # Returns True if the custom widget acts as a container for other widgets; + # otherwise returns False. Note that plugins for custom containers also + # need to provide an implementation of the QDesignerContainerExtension + # interface if they need to add custom editing support to Qt Designer. + def isContainer(self): + return False + + # Returns an XML description of a custom widget instance that describes + # default values for its properties. Each custom widget created by this + # plugin will be configured using this description. + def domXml(self): + return '\n' + + # Returns the module containing the custom widget class. It may include + # a module path. + def includeFile(self): + return "polygonwidget" + + +# Define the image used for the icon. +_logo_16x16_xpm = [ +"16 16 46 1", +". c #a5a5dc", +"l c #a69fd6", +"k c #a7a5da", +"h c #a7a6dc", +"a c #a7a7de", +"Q c #a8a5da", +"s c #a9a7d7", +"R c #a9a9e0", +"z c #abaad4", +"E c #afafda", +"M c #afafdb", +"K c #b0a8e2", +"o c #b1afe4", +"p c #b2b2d7", +"# c #b2b2ed", +"i c #b39eb6", +"F c #b3b3e1", +"e c #b4b4ef", +"t c #b58bab", +"d c #b6b6f2", +"n c #b798b8", +"P c #b798b9", +"c c #b8b6f2", +"D c #b8b89c", +"m c #b9648d", +"J c #ba84b0", +"A c #bdbdfb", +"f c #bfbffe", +"g c #c06996", +"b c #c0c0ff", +"B c #cbb889", +"L c #cbb989", +"O c #cfcf87", +"I c #d09585", +"w c #d0cf86", +"x c #dede81", +"G c #e8e87c", +"q c #edde7b", +"N c #f1e07b", +"v c #f2e07b", +"H c #f6e57c", +"j c #fb917e", +"u c #ffb580", +"r c #ffda80", +"C c #fffe80", +"y c #ffff80", +".##############a", +"#bbbbbbbbcdbbbbe", +"#bbbbbbbfghbbbbe", +"#bbbbbbbijkbbbbe", +"#blmnobpqrsbbbbe", +"#bbtuvwxyyzbbbbe", +"#bbABCyyyyDEfbbe", +"#bbbFGyyyyyHIJKe", +"#bbbFGyyyyyHIJKe", +"#bbALCyyyyDMfbbe", +"#bbtuNOxyyzbbbbe", +"#blmPobpqrsbbbbe", +"#bbbbbbbijQbbbbe", +"#bbbbbbbfghbbbbe", +"#bbbbbbbbcdbbbbe", +"aeeeeeeeeeeeeeeR"] + +_logo_pixmap = QPixmap(_logo_16x16_xpm) diff --git a/examples/designer/plugins/python/pydemoplugin.py b/examples/designer/plugins/python/pydemoplugin.py new file mode 100644 index 0000000..bf6a76a --- /dev/null +++ b/examples/designer/plugins/python/pydemoplugin.py @@ -0,0 +1,168 @@ +# A demonstration custom widget plugin for Qt Designer. +# +# Copyright (c) 2021 Riverbank Computing Limited + + +from PyQt6.QtGui import QIcon, QPixmap +from PyQt6.QtDesigner import QPyDesignerCustomWidgetPlugin + +from pydemo import PyDemo + + +# This class implements the interface expected by Qt Designer to access the +# custom widget. See the description of the QDesignerCustomWidgetInterface +# class for full details. +class PyDemoPlugin(QPyDesignerCustomWidgetPlugin): + + # Initialise the instance. + def __init__(self, parent=None): + super().__init__(parent) + + self._initialized = False + + # Initialise the custom widget for use with the specified formEditor + # interface. + def initialize(self, formEditor): + if self._initialized: + return + + self._initialized = True + + # Return True if the custom widget has been intialised. + def isInitialized(self): + return self._initialized + + # Return a new instance of the custom widget with the given parent. + def createWidget(self, parent): + return PyDemo(parent) + + # Return the name of the class that implements the custom widget. + def name(self): + return "PyDemo" + + # Return the name of the group to which the custom widget belongs. A new + # group will be created if it doesn't already exist. + def group(self): + return "PyQt Examples" + + # Return the icon used to represent the custom widget in Designer's widget + # box. + def icon(self): + return QIcon(_logo_pixmap) + + # Return a short description of the custom widget used by Designer in a + # tool tip. + def toolTip(self): + return "PyQt demonstration widget" + + # Return a full description of the custom widget used by Designer in + # "What's This?" help for the widget. + def whatsThis(self): + return "PyDemo is a demonstration custom widget written in Python " \ + "using PyQt." + + # Return True if the custom widget acts as a container for other widgets. + def isContainer(self): + return False + + # Return an XML fragment that allows the default values of the custom + # widget's properties to be overridden. + def domXml(self): + return '\n' \ + ' \n' \ + ' PyQt demonstration widget\n' \ + ' \n' \ + ' \n' \ + ' PyDemo is a demonstration custom widget written ' \ + 'in Python using PyQt.\n' \ + ' \n' \ + '\n' + + # Return the name of the module containing the class that implements the + # custom widget. It may include a module path. + def includeFile(self): + return "pydemo" + + +# Define the image used for the icon. +_logo_16x16_xpm = [ +"16 16 61 1", +"6 c #5bbd7c", +"a c #7aaada", +"h c #7eaddb", +"n c #7faddb", +"E c #82afdc", +"x c #83b0dd", +"C c #84b0dd", +"z c #84b1dd", +"B c #85b1dd", +"u c #87b2de", +"U c #9ec1e4", +"Z c #9fc1e4", +"H c #a1c3e5", +"Y c #a5c5e4", +"V c #a6c6e4", +"P c #afcbe2", +"S c #afcbe3", +"O c #b1cde9", +"T c #b2cee9", +"t c #b4cee3", +"r c #b5cee3", +"q c #c2d8ee", +"0 c #c7dbef", +"f c #cedddb", +"b c #cfdddb", +"1 c #d0e1f2", +"J c #d8e2d2", +"I c #d9e2d2", +"# c #dfeaf6", +"g c #e3edf7", +"K c #ecf2f9", +"N c #ecf3f9", +"o c #eeecbb", +"i c #f2edb2", +"l c #f2edb3", +"w c #f6eea6", +"v c #f7eea6", +"W c #fcee8c", +"m c #fcfdfe", +"L c #fdec73", +"k c #fedd00", +"e c #fede06", +"p c #fede07", +"j c #fee013", +"X c #fee015", +"s c #fee223", +"d c #fee32c", +"A c #fee749", +"Q c #fee850", +"R c #fee851", +"D c #fee854", +"y c #feea65", +"M c #feec74", +"c c #feed7c", +"F c #feee85", +"G c #feee86", +"5 c #fef095", +"4 c #fef195", +"3 c #fef6bb", +"2 c #fefdf5", +". c #fefefe", +"..#abcdeedcfa#..", +".ghijkkkkkkjlhg.", +"mnopkkkkkkkkponm", +"qrskkkkkkkkkkstq", +"uvkkkkkkkkkkkkwu", +"xykkkkkkkkkkkkyx", +"zAkkkkkkkkkkkkAB", +"CDkkkkkkkkkkkkDC", +"EFkkkkkkkkkkkkGE", +"HIekkkkkkkkkkeJH", +"KBLkkkkkkkkkkMBN", +".OPQkkkkkkkkRST.", +"..UVWXkkkkXWYZ..", +"...0123453210...", +"6666666666666666", +"BBBBBBBBBBBBBBBB"] + +_logo_pixmap = QPixmap(_logo_16x16_xpm) diff --git a/examples/designer/plugins/python/pythonconsoleplugin.py b/examples/designer/plugins/python/pythonconsoleplugin.py new file mode 100644 index 0000000..28fd715 --- /dev/null +++ b/examples/designer/plugins/python/pythonconsoleplugin.py @@ -0,0 +1,141 @@ +""" +pythonconsoleplugin.py + +A Python console custom widget plugin for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +from PyQt6.QtGui import QIcon, QPixmap +from PyQt6.QtDesigner import QPyDesignerCustomWidgetPlugin + +from pythonconsolewidget import PythonConsoleWidget + + +class PythonConsolePlugin(QPyDesignerCustomWidgetPlugin): + """PythonConsolePlugin(QPyDesignerCustomWidgetPlugin) + + Provides a Python custom plugin for Qt Designer by implementing the + QDesignerCustomWidgetPlugin via a PyQt-specific custom plugin class. + """ + + # The __init__() method is only used to set up the plugin and define its + # initialized variable. + def __init__(self, parent=None): + + super().__init__(parent) + + self.initialized = False + + # The initialize() and isInitialized() methods allow the plugin to set up + # any required resources, ensuring that this can only happen once for each + # plugin. + def initialize(self, core): + + if self.initialized: + return + + self.initialized = True + + def isInitialized(self): + + return self.initialized + + # This factory method creates new instances of our custom widget with the + # appropriate parent. + def createWidget(self, parent): + return PythonConsoleWidget(parent) + + # This method returns the name of the custom widget class that is provided + # by this plugin. + def name(self): + return "PythonConsoleWidget" + + # Returns the name of the group in Qt Designer's widget box that this + # widget belongs to. + def group(self): + return "PyQt Examples" + + # Returns the icon used to represent the custom widget in Qt Designer's + # widget box. + def icon(self): + return QIcon(_logo_pixmap) + + # Returns a short description of the custom widget for use in a tool tip. + def toolTip(self): + return "" + + # Returns a short description of the custom widget for use in a "What's + # This?" help message for the widget. + def whatsThis(self): + return "" + + # Returns True if the custom widget acts as a container for other widgets; + # otherwise returns False. Note that plugins for custom containers also + # need to provide an implementation of the QDesignerContainerExtension + # interface if they need to add custom editing support to Qt Designer. + def isContainer(self): + return False + + # Returns an XML description of a custom widget instance that describes + # default values for its properties. Each custom widget created by this + # plugin will be configured using this description. + def domXml(self): + return '\n' \ + ' \n' \ + ' Python console\n' \ + ' \n' \ + ' \n' \ + ' The Python console widget can be used to explore ' \ + 'Qt Designer.\n' \ + ' \n' \ + '\n' + + # Returns the module containing the custom widget class. It may include + # a module path. + def includeFile(self): + return "pythonconsolewidget" + + +# Define the image used for the icon. +_logo_16x16_xpm = [ + "16 16 6 1", + " c None", + ". c #FFFFFF", + "a c #000000", + "b c #808080", + "c c #C0C0C0", + "d c #404040", + "................", + "................", + "................", + ".aa..aa..aa.....", + "..aa..aa..aa....", + "...aa..aa..aa...", + "....aa..aa..aa..", + ".....aa..aa..aa.", + ".....aa..aa..aa.", + "....aa..aa..aa..", + "...aa..aa..aa...", + "..aa..aa..aa....", + ".aa..aa..aa.....", + "................", + "................", + "................"] + +_logo_pixmap = QPixmap(_logo_16x16_xpm) diff --git a/examples/designer/plugins/widgets/analogclock.py b/examples/designer/plugins/widgets/analogclock.py new file mode 100644 index 0000000..dfbfee8 --- /dev/null +++ b/examples/designer/plugins/widgets/analogclock.py @@ -0,0 +1,186 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import (pyqtProperty, pyqtSignal, pyqtSlot, QPoint, QSize, + Qt, QTime, QTimer) +from PyQt6.QtGui import QBrush, QColor, QPainter, QPen, QPolygon +from PyQt6.QtWidgets import QApplication, QWidget + + +class PyAnalogClock(QWidget): + """PyAnalogClock(QWidget) + + Provides an analog clock custom widget with signals, slots and properties. + The implementation is based on the Analog Clock example provided with both + Qt and PyQt. + """ + + # Emitted when the clock's time changes. + timeChanged = pyqtSignal(QTime) + + # Emitted when the clock's time zone changes. + timeZoneChanged = pyqtSignal(int) + + def __init__(self, parent=None): + + super().__init__(parent) + + self.timeZoneOffset = 0 + + timer = QTimer(self) + timer.timeout.connect(self.update) + timer.timeout.connect(self.updateTime) + timer.start(1000) + + self.setWindowTitle("Analog Clock") + self.resize(200, 200) + + self.hourHand = QPolygon([ + QPoint(7, 8), + QPoint(-7, 8), + QPoint(0, -40) + ]) + self.minuteHand = QPolygon([ + QPoint(7, 8), + QPoint(-7, 8), + QPoint(0, -70) + ]) + + self.hourColor = QColor(0, 127, 0) + self.minuteColor = QColor(0, 127, 127, 191) + + def paintEvent(self, event): + + side = min(self.width(), self.height()) + time = QTime.currentTime() + time = time.addSecs(self.timeZoneOffset * 3600) + + painter = QPainter() + painter.begin(self) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) + painter.translate(self.width() / 2, self.height() / 2) + painter.scale(side / 200.0, side / 200.0) + + painter.setPen(Qt.PenStyle.NoPen) + painter.setBrush(QBrush(self.hourColor)) + + painter.save() + painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0))) + painter.drawConvexPolygon(self.hourHand) + painter.restore() + + painter.setPen(self.hourColor) + + for i in range(0, 12): + painter.drawLine(88, 0, 96, 0) + painter.rotate(30.0) + + painter.setPen(Qt.PenStyle.NoPen) + painter.setBrush(QBrush(self.minuteColor)) + + painter.save() + painter.rotate(6.0 * (time.minute() + time.second() / 60.0)) + painter.drawConvexPolygon(self.minuteHand) + painter.restore() + + painter.setPen(QPen(self.minuteColor)) + + for j in range(0, 60): + if (j % 5) != 0: + painter.drawLine(92, 0, 96, 0) + painter.rotate(6.0) + + painter.end() + + def minimumSizeHint(self): + + return QSize(50, 50) + + def sizeHint(self): + + return QSize(100, 100) + + def updateTime(self): + + self.timeChanged.emit(QTime.currentTime()) + + # The timeZone property is implemented using the getTimeZone() getter + # method, the setTimeZone() setter method, and the resetTimeZone() method. + + # The getter just returns the internal time zone value. + def getTimeZone(self): + + return self.timeZoneOffset + + # The setTimeZone() method is also defined to be a slot. The @pyqtSlot + # decorator is used to tell PyQt which argument type the method expects, + # and is especially useful when you want to define slots with the same + # name that accept different argument types. + + @pyqtSlot(int) + def setTimeZone(self, value): + + self.timeZoneOffset = value + self.timeZoneChanged.emit(value) + self.update() + + # Qt's property system supports properties that can be reset to their + # original values. This method enables the timeZone property to be reset. + def resetTimeZone(self): + + self.timeZoneOffset = 0 + self.timeZoneChanged.emit(0) + self.update() + + # Qt-style properties are defined differently to Python's properties. + # To declare a property, we call pyqtProperty() to specify the type and, + # in this case, getter, setter and resetter methods. + timeZone = pyqtProperty(int, getTimeZone, setTimeZone, resetTimeZone) + + +if __name__ == "__main__": + + import sys + + app = QApplication(sys.argv) + clock = PyAnalogClock() + clock.show() + sys.exit(app.exec()) diff --git a/examples/designer/plugins/widgets/bubbleswidget.py b/examples/designer/plugins/widgets/bubbleswidget.py new file mode 100644 index 0000000..9989620 --- /dev/null +++ b/examples/designer/plugins/widgets/bubbleswidget.py @@ -0,0 +1,333 @@ +""" +bubbleswidget.py + +A PyQt custom widget example for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +import random + +from PyQt6.QtCore import (pyqtProperty, pyqtSignal, pyqtSlot, QPointF, QRectF, + QSize, QSizeF, Qt, QTimer) +from PyQt6.QtGui import QBrush, QColor, QPainter, QPen, QRadialGradient +from PyQt6.QtWidgets import QApplication, QWidget + + +class BaseClass(QWidget): + """BaseClass(QWidget) + + Provides a base custom widget class to show that properties implemented + in Python can be inherited and shown as belonging to distinct classes + in Qt Designer's Property Editor. + """ + + def __init__(self, parent=None): + + super().__init__(parent) + + self.resetAuthor() + + # Define getter, setter and resetter methods for the author property. + + def getAuthor(self): + return self._author + + def setAuthor(self, name): + self._author = name + + def resetAuthor(self): + self._author = "David Boddie" + + author = pyqtProperty(str, getAuthor, setAuthor, resetAuthor) + + +class Bubble: + """Bubble + + Provides a class to represent individual bubbles in a BubblesWidget. + Each Bubble instance can render itself onto a paint device using a + QPainter passed to its drawBubble() method. + """ + + def __init__(self, position, radius, speed, innerColor, outerColor): + + self.position = position + self.radius = radius + self.speed = speed + self.innerColor = innerColor + self.outerColor = outerColor + self.updateBrush() + + def updateBrush(self): + + gradient = QRadialGradient( + QPointF(self.radius, self.radius), self.radius, + QPointF(self.radius*0.5, self.radius*0.5)) + + gradient.setColorAt(0, QColor(255, 255, 255, 255)) + gradient.setColorAt(0.25, self.innerColor) + gradient.setColorAt(1, self.outerColor) + self.brush = QBrush(gradient) + + def drawBubble(self, painter): + + painter.save() + painter.translate(self.position.x() - self.radius, + self.position.y() - self.radius) + painter.setBrush(self.brush) + painter.drawEllipse(0, 0, int(2*self.radius), int(2*self.radius)) + painter.restore() + + +class BubblesWidget(BaseClass): + """BubblesWidget(BaseClass) + + Provides a custom widget that shows a number of rising bubbles. + Various properties are defined so that the user can customize the + appearance of the widget, and change the number and behaviour of the + bubbles shown. + """ + + # We define two signals that are used to indicate changes to the status + # of the widget. + bubbleLeft = pyqtSignal() + bubblesRemaining = pyqtSignal(int) + + def __init__(self, parent=None): + + super().__init__(parent) + + self.pen = QPen(QColor("#cccccc")) + self.bubbles = [] + self.backgroundColor1 = self.randomColor() + self.backgroundColor2 = self.randomColor().darker(150) + self.newBubble = None + + random.seed() + + self.animation_timer = QTimer(self) + self.animation_timer.setSingleShot(False) + self.animation_timer.timeout.connect(self.animate) + self.animation_timer.start(25) + + self.bubbleTimer = QTimer() + self.bubbleTimer.setSingleShot(False) + self.bubbleTimer.timeout.connect(self.expandBubble) + + self.setMouseTracking(True) + self.setMinimumSize(QSize(200, 200)) + self.setWindowTitle("Bubble Maker") + + def paintEvent(self, event): + + background = QRadialGradient(QPointF(self.rect().topLeft()), 500, + QPointF(self.rect().bottomRight())) + background.setColorAt(0, self.backgroundColor1) + background.setColorAt(1, self.backgroundColor2) + + painter = QPainter() + painter.begin(self) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) + painter.fillRect(event.rect(), QBrush(background)) + + painter.setPen(self.pen) + + for bubble in self.bubbles: + + if QRectF(bubble.position - QPointF(bubble.radius, bubble.radius), + QSizeF(2*bubble.radius, 2*bubble.radius)).intersects(QRectF(event.rect())): + bubble.drawBubble(painter) + + if self.newBubble: + + self.newBubble.drawBubble(painter) + + painter.end() + + def mousePressEvent(self, event): + + if event.button() == Qt.MouseButton.LeftButton and self.newBubble is None: + + self.newBubble = Bubble(QPointF(event.position()), 4.0, + 1.0 + random.random() * 7, + self.randomColor(), self.randomColor()) + self.bubbleTimer.start(50) + event.accept() + + def mouseMoveEvent(self, event): + + if self.newBubble: + + self.update( + QRectF(self.newBubble.position - \ + QPointF(self.newBubble.radius + 1, self.newBubble.radius + 1), + QSizeF(2*self.newBubble.radius + 2, 2*self.newBubble.radius + 2)).toRect() + ) + self.newBubble.position = QPointF(event.position()) + self.update( + QRectF(self.newBubble.position - \ + QPointF(self.newBubble.radius + 1, self.newBubble.radius + 1), + QSizeF(2*self.newBubble.radius + 2, 2*self.newBubble.radius + 2)).toRect() + ) + + event.accept() + + def mouseReleaseEvent(self, event): + + if self.newBubble: + + self.bubbles.append(self.newBubble) + self.newBubble = None + self.bubbleTimer.stop() + self.bubblesRemaining.emit(len(self.bubbles)) + + event.accept() + + def expandBubble(self): + + if self.newBubble: + + self.newBubble.radius = min(self.newBubble.radius + 4.0, + self.width()/8.0, self.height()/8.0) + self.update( + QRectF(self.newBubble.position - \ + QPointF(self.newBubble.radius + 1, self.newBubble.radius + 1), + QSizeF(2*self.newBubble.radius + 2, 2*self.newBubble.radius + 2)).toRect() + ) + self.newBubble.updateBrush() + + def randomColor(self): + + red = int(205 + random.random() * 50) + green = int(205 + random.random() * 50) + blue = int(205 + random.random() * 50) + alpha = int(91 + random.random() * 100) + + return QColor(red, green, blue, alpha) + + def animate(self): + + bubbles = [] + left = False + for bubble in self.bubbles: + + bubble.position = bubble.position + QPointF(0, -bubble.speed) + + self.update( + QRectF(bubble.position - QPointF(bubble.radius + 1, + bubble.radius + 1), + QSizeF(2*bubble.radius + 2, 2*bubble.radius + 2 + bubble.speed)).toRect()) + + if bubble.position.y() + bubble.radius > 0: + bubbles.append(bubble) + else: + self.bubbleLeft.emit() + left = True + + if self.newBubble: + self.update( + QRectF(self.newBubble.position - QPointF( + self.newBubble.radius + 1, + self.newBubble.radius + 1), + QSizeF(2*self.newBubble.radius + 2, 2*self.newBubble.radius + 2)).toRect()) + + self.bubbles = bubbles + if left: + self.bubblesRemaining.emit(len(self.bubbles)) + + def sizeHint(self): + + return QSize(200, 200) + + # We provide getter and setter methods for the numberOfBubbles property. + def getBubbles(self): + + return len(self.bubbles) + + # The setBubbles() method can also be used as a slot. + @pyqtSlot(int) + def setBubbles(self, value): + + value = max(0, value) + + while len(self.bubbles) < value: + + newBubble = Bubble(QPointF(random.random() * self.width(), + random.random() * self.height()), + 4.0 + random.random() * 20, + 1.0 + random.random() * 7, + self.randomColor(), self.randomColor()) + newBubble.updateBrush() + self.bubbles.append(newBubble) + + self.bubbles = self.bubbles[:value] + self.bubblesRemaining.emit(value) + self.update() + + numberOfBubbles = pyqtProperty(int, getBubbles, setBubbles) + + # We provide getter and setter methods for the color1 and color2 + # properties. The red, green and blue components for the QColor + # values stored in these properties can be edited individually in + # Qt Designer. + + def getColor1(self): + + return self.backgroundColor1 + + def setColor1(self, value): + + self.backgroundColor1 = QColor(value) + self.update() + + color1 = pyqtProperty(QColor, getColor1, setColor1) + + def getColor2(self): + + return self.backgroundColor2 + + def setColor2(self, value): + + self.backgroundColor2 = QColor(value) + self.update() + + color2 = pyqtProperty(QColor, getColor2, setColor2) + + # The stop() and start() slots provide simple control over the animation + # of the bubbles in the widget. + + @pyqtSlot() + def stop(self): + + self.animation_timer.stop() + + @pyqtSlot() + def start(self): + + self.animation_timer.start(25) + + +if __name__ == "__main__": + + import sys + + app = QApplication(sys.argv) + widget = BubblesWidget() + widget.show() + sys.exit(app.exec()) diff --git a/examples/designer/plugins/widgets/counterlabel.py b/examples/designer/plugins/widgets/counterlabel.py new file mode 100644 index 0000000..3aa69ed --- /dev/null +++ b/examples/designer/plugins/widgets/counterlabel.py @@ -0,0 +1,175 @@ +""" +counterlabel.py + +A PyQt custom widget example for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QRectF, QSize, Qt +from PyQt6.QtGui import QFont, QFontMetricsF, QPainter +from PyQt6.QtWidgets import QApplication, QWidget + + +class CounterLabel(QWidget): + """CounterLabel(QWidget) + + Provides a custom label widget to be used as a counter, with signals + similar to those provided by QAbstractSlider subclasses and properties + similar to those provided by QLabel. + """ + + # We define two signals that are used to indicate changes to the status + # of the widget. + valueChanged = pyqtSignal((int, ), (str, )) + + def __init__(self, parent=None): + + super().__init__(parent) + + self.setAutoFillBackground(False) + + self._font = QFont() + self._minimum = 1 + self._maximum = 1 + self._value = 1 + self._offset = 0 + self.rescale() + self.reposition() + + def paintEvent(self, event): + + p = QPainter() + p.begin(self) + p.setRenderHint(QPainter.RenderHint.Antialiasing) + p.setFont(self._font) + p.translate(self.width()/2.0, self.height()/2.0) + p.scale(self._scale, self._scale) + p.drawText(int(self._xpos), int(self._ypos), str(self._value)) + p.end() + + def sizeHint(self): + return QSize(32, 32) + + def rescale(self): + + fm = QFontMetricsF(self._font, self) + maxRect = fm.boundingRect(QRectF(self.rect()), + Qt.AlignmentFlag.AlignCenter, str(self._maximum)) + xscale = float(self.width())/maxRect.width() + yscale = float(self.height())/maxRect.height() + self._scale = min(xscale, yscale) + + def reposition(self): + + fm = QFontMetricsF(self._font, self) + rect = fm.boundingRect(QRectF(self.rect()), + Qt.AlignmentFlag.AlignCenter, str(self._value)) + self._xpos = -rect.width()/2.0 + self._ypos = rect.height()/2.0 - fm.descent() + self.update() + + # Provide getter and setter methods for the font property. + + def getFont(self): + return self._font + + def setFont(self, font): + self._font = font + self.rescale() + self.reposition() + + font = pyqtProperty(QFont, getFont, setFont) + + # Provide getter and setter methods for the minimum and maximum properties. + + def getMinimum(self): + return self._minimum + + def setMinimum(self, value): + self._minimum = value + if self._minimum > self._maximum: + self.setMaximum(self._minimum) + if self._minimum > self._value: + self.setValue(self._minimum) + + minimum = pyqtProperty(int, getMinimum, setMinimum) + + def getMaximum(self): + return self._maximum + + def setMaximum(self, value): + self._maximum = value + self._minimum = min(self._minimum, self._maximum) + if self._maximum < self._value: + self.setValue(self._maximum) + self.rescale() + self.reposition() + + maximum = pyqtProperty(int, getMaximum, setMaximum) + + # We provide an offset property to allow the value shown to differ from + # the internal value held by the widget. + + def getOffset(self): + return self._offset + + def setOffset(self, value): + self._offset = value + + offset = pyqtProperty(int, getOffset, setOffset) + + # The value property is implemented using the getValue() and setValue() + # methods. + + def getValue(self): + return self._value + + # The setter method for the value property can also be used as a slot. + @pyqtSlot(int) + def setValue(self, value): + if not self._minimum <= value <= self._maximum: + return + self._value = value + self.valueChanged[int].emit(value + self._offset) + self.valueChanged[str].emit(str(value + self._offset)) + self.reposition() + + value = pyqtProperty(int, getValue, setValue) + + # Like QAbstractSpinBox, we provide stepUp() and stepDown() slots to + # enable the value to be incremented and decremented. + + @pyqtSlot() + def stepUp(self): + self.setValue(self._value + 1) + + @pyqtSlot() + def stepDown(self): + self.setValue(self._value - 1) + + +if __name__ == "__main__": + + import sys + + app = QApplication(sys.argv) + widget = CounterLabel() + widget.setValue(123) + widget.show() + sys.exit(app.exec()) diff --git a/examples/designer/plugins/widgets/datetimeedit.py b/examples/designer/plugins/widgets/datetimeedit.py new file mode 100644 index 0000000..63f9ed2 --- /dev/null +++ b/examples/designer/plugins/widgets/datetimeedit.py @@ -0,0 +1,369 @@ +#============================================================================# +# (Re)Implementation of QDateEdit and QDateTimeEdit. These classes force the # +# use of the calendar popup. # +#----------------------------------------------------------------------------# +# Copyright (c) 2008 by Denviso GmbH, # +# # +# All Rights Reserved # +# # +# Permission to use, copy, modify, and distribute this software and its # +# documentation for any purpose and without fee is hereby granted, # +# provided that the above copyright notice appear in all copies and that # +# both that copyright notice and this permission notice appear in # +# supporting documentation. # +# # +# DENVISO DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS # +# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # +# AND FITNESS, IN NO EVENT SHALL DENVISO BE LIABLE FOR ANY # +# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER # +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE # +# OR PERFORMANCE OF THIS SOFTWARE. # +#----------------------------------------------------------------------------# + +from PyQt6.QtCore import pyqtProperty, Qt +from PyQt6.QtWidgets import (QApplication, QCalendarWidget, QDateEdit, + QDateTimeEdit, QHBoxLayout, QWidget) + + +#============================================================================# +# PyDateEdit # +#----------------------------------------------------------------------------# +class PyDateEdit(QDateEdit): + # + # Initialize base class + # Force use of the calendar popup + # Set default values for calendar properties + # + def __init__(self, *args): + super().__init__(*args) + + self.setCalendarPopup(True) + self.__cw = None + self.__firstDayOfWeek = Qt.DayOfWeek.Monday + self.__gridVisible = False + self.__horizontalHeaderFormat = QCalendarWidget.HorizontalHeaderFormat.ShortDayNames + self.__verticalHeaderFormat = QCalendarWidget.VerticalHeaderFormat.ISOWeekNumbers + self.__navigationBarVisible = True + + # + # Call event handler of base class + # Get the calendar widget, if not already done + # Set the calendar properties + # + def mousePressEvent(self, event): + super().mousePressEvent(event) + + if not self.__cw: + self.__cw = self.findChild(QCalendarWidget) + if self.__cw: + self.__cw.setFirstDayOfWeek(self.__firstDayOfWeek) + self.__cw.setGridVisible(self.__gridVisible) + self.__cw.setHorizontalHeaderFormat(self.__horizontalHeaderFormat) + self.__cw.setVerticalHeaderFormat(self.__verticalHeaderFormat) + self.__cw.setNavigationBarVisible(self.__navigationBarVisible) + + # + # Make sure, the calendarPopup property is invisible in Designer + # + def getCalendarPopup(self): + return True + calendarPopup = pyqtProperty(bool, fget=getCalendarPopup) + + # + # Property firstDayOfWeek: Qt::DayOfWeek + # Get: getFirstDayOfWeek() + # Set: setFirstDayOfWeek() + # Reset: resetFirstDayOfWeek() + # + def getFirstDayOfWeek(self): + return self.__firstDayOfWeek + def setFirstDayOfWeek(self, dayOfWeek): + if dayOfWeek != self.__firstDayOfWeek: + self.__firstDayOfWeek = dayOfWeek + if self.__cw: + self.__cw.setFirstDayOfWeek(dayOfWeek) + def resetFirstDayOfWeek(self): + if self.__firstDayOfWeek != Qt.DayOfWeek.Monday: + self.__firstDayOfWeek = Qt.DayOfWeek.Monday + if self.__cw: + self.__cw.setFirstDayOfWeek(Qt.DayOfWeek.Monday) + firstDayOfWeek = pyqtProperty(Qt.DayOfWeek, + fget=getFirstDayOfWeek, + fset=setFirstDayOfWeek, + freset=resetFirstDayOfWeek) + + # + # Property gridVisible: bool + # Get: isGridVisible() + # Set: setGridVisible() + # Reset: resetGridVisible() + # + def isGridVisible(self): + return self.__gridVisible + def setGridVisible(self, show): + if show != self.__gridVisible: + self.__gridVisible = show + if self.__cw: + self.__cw.setGridVisible(show) + def resetGridVisible(self): + if self.__gridVisible != False: + self.__gridVisible = False + if self.__cw: + self.__cw.setGridVisible(False) + gridVisible = pyqtProperty(bool, + fget=isGridVisible, + fset=setGridVisible, + freset=resetGridVisible) + + # + # Property horizontalHeaderFormat: QCalendarWidget::HorizontalHeaderFormat + # Get: getHorizontalHeaderFormat() + # Set: setHorizontalHeaderFormat() + # Reset: resetHorizontalHeaderFormat() + # + def getHorizontalHeaderFormat(self): + return self.__horizontalHeaderFormat + def setHorizontalHeaderFormat(self, format): + if format != self.__horizontalHeaderFormat: + self.__horizontalHeaderFormat = format + if self.__cw: + self.__cw.setHorizontalHeaderFormat(format) + def resetHorizontalHeaderFormat(self): + if self.__horizontalHeaderFormat != QCalendarWidget.HorizontalHeaderFormat.ShortDayNames: + self.__horizontalHeaderFormat = QCalendarWidget.HorizontalHeaderFormat.ShortDayNames + if self.__cw: + self.__cw.setHorizontalHeaderFormat(QCalendarWidget.HorizontalHeaderFormat.ShortDayNames) + horizontalHeaderFormat = pyqtProperty(QCalendarWidget.HorizontalHeaderFormat, + fget=getHorizontalHeaderFormat, + fset=setHorizontalHeaderFormat, + freset=resetHorizontalHeaderFormat) + + # + # Property verticalHeaderFormat: QCalendarWidget::VerticalHeaderFormat + # Get: getVerticalHeaderFormat() + # Set: setVerticalHeaderFormat() + # Reset: resetVerticalHeaderFormat() + # + def getVerticalHeaderFormat(self): + return self.__verticalHeaderFormat + def setVerticalHeaderFormat(self, format): + if format != self.__verticalHeaderFormat: + self.__verticalHeaderFormat = format + if self.__cw: + self.__cw.setVerticalHeaderFormat(format) + def resetVerticalHeaderFormat(self): + if self.__verticalHeaderFormat != QCalendarWidget.VerticalHeaderFormat.ISOWeekNumbers: + self.__verticalHeaderFormat = QCalendarWidget.VerticalHeaderFormat.ISOWeekNumbers + if self.__cw: + self.__cw.setVerticalHeaderFormat(QCalendarWidget.VerticalHeaderFormat.ISOWeekNumbers) + verticalHeaderFormat = pyqtProperty(QCalendarWidget.VerticalHeaderFormat, + fget=getVerticalHeaderFormat, + fset=setVerticalHeaderFormat, + freset=resetVerticalHeaderFormat) + + # + # Property navigationBarVisible: bool + # Get: isNavigationBarVisible() + # Set: setNavigationBarVisible() + # Reset: resetNavigationBarVisible() + # + def isNavigationBarVisible(self): + return self.__navigationBarVisible + def setNavigationBarVisible(self, visible): + if visible != self.__navigationBarVisible: + self.__navigationBarVisible = visible + if self.__cw: + self.__cw.setNavigationBarVisible(visible) + def resetNavigationBarVisible(self): + if self.__navigationBarVisible != True: + self.__navigationBarVisible = True + if self.__cw: + self.__cw.setNavigationBarVisible(True) + navigationBarVisible = pyqtProperty(bool, + fget=isNavigationBarVisible, + fset=setNavigationBarVisible, + freset=resetNavigationBarVisible) + + +#============================================================================# +# PyDateTimeEdit # +#----------------------------------------------------------------------------# +class PyDateTimeEdit(QDateTimeEdit): + # + # Initialize base class + # Force use of the calendar popup + # Set default values for calendar properties + # + def __init__(self, *args): + super().__init__(*args) + + self.setCalendarPopup(True) + self.__cw = None + self.__firstDayOfWeek = Qt.DayOfWeek.Monday + self.__gridVisible = False + self.__horizontalHeaderFormat = QCalendarWidget.HorizontalHeaderFormat.ShortDayNames + self.__verticalHeaderFormat = QCalendarWidget.VerticalHeaderFormat.ISOWeekNumbers + self.__navigationBarVisible = True + + # + # Call event handler of base class + # Get the calendar widget, if not already done + # Set the calendar properties + # + def mousePressEvent(self, event): + super().mousePressEvent(event) + + if not self.__cw: + self.__cw = self.findChild(QCalendarWidget) + if self.__cw: + self.__cw.setFirstDayOfWeek(self.__firstDayOfWeek) + self.__cw.setGridVisible(self.__gridVisible) + self.__cw.setHorizontalHeaderFormat(self.__horizontalHeaderFormat) + self.__cw.setVerticalHeaderFormat(self.__verticalHeaderFormat) + self.__cw.setNavigationBarVisible(self.__navigationBarVisible) + + # + # Make sure, the calendarPopup property is invisible in Designer + # + def getCalendarPopup(self): + return True + calendarPopup = pyqtProperty(bool, fget=getCalendarPopup) + + # + # Property firstDayOfWeek: Qt::DayOfWeek + # Get: getFirstDayOfWeek() + # Set: setFirstDayOfWeek() + # Reset: resetFirstDayOfWeek() + # + def getFirstDayOfWeek(self): + return self.__firstDayOfWeek + def setFirstDayOfWeek(self, dayOfWeek): + if dayOfWeek != self.__firstDayOfWeek: + self.__firstDayOfWeek = dayOfWeek + if self.__cw: + self.__cw.setFirstDayOfWeek(dayOfWeek) + def resetFirstDayOfWeek(self): + if self.__firstDayOfWeek != Qt.DayOfWeek.Monday: + self.__firstDayOfWeek = Qt.DayOfWeek.Monday + if self.__cw: + self.__cw.setFirstDayOfWeek(Qt.DayOfWeek.Monday) + firstDayOfWeek = pyqtProperty(Qt.DayOfWeek, + fget=getFirstDayOfWeek, + fset=setFirstDayOfWeek, + freset=resetFirstDayOfWeek) + + # + # Property gridVisible: bool + # Get: isGridVisible() + # Set: setGridVisible() + # Reset: resetGridVisible() + # + def isGridVisible(self): + return self.__gridVisible + def setGridVisible(self, show): + if show != self.__gridVisible: + self.__gridVisible = show + if self.__cw: + self.__cw.setGridVisible(show) + def resetGridVisible(self): + if self.__gridVisible != False: + self.__gridVisible = False + if self.__cw: + self.__cw.setGridVisible(False) + gridVisible = pyqtProperty(bool, + fget=isGridVisible, + fset=setGridVisible, + freset=resetGridVisible) + + # + # Property horizontalHeaderFormat: QCalendarWidget::HorizontalHeaderFormat + # Get: getHorizontalHeaderFormat() + # Set: setHorizontalHeaderFormat() + # Reset: resetHorizontalHeaderFormat() + # + def getHorizontalHeaderFormat(self): + return self.__horizontalHeaderFormat + def setHorizontalHeaderFormat(self, format): + if format != self.__horizontalHeaderFormat: + self.__horizontalHeaderFormat = format + if self.__cw: + self.__cw.setHorizontalHeaderFormat(format) + def resetHorizontalHeaderFormat(self): + if self.__horizontalHeaderFormat != QCalendarWidget.HorizontalHeaderFormat.ShortDayNames: + self.__horizontalHeaderFormat = QCalendarWidget.HorizontalHeaderFormat.ShortDayNames + if self.__cw: + self.__cw.setHorizontalHeaderFormat(QCalendarWidget.HorizontalHeaderFormat.ShortDayNames) + horizontalHeaderFormat = pyqtProperty(QCalendarWidget.HorizontalHeaderFormat, + fget=getHorizontalHeaderFormat, + fset=setHorizontalHeaderFormat, + freset=resetHorizontalHeaderFormat) + + # + # Property verticalHeaderFormat: QCalendarWidget::VerticalHeaderFormat + # Get: getVerticalHeaderFormat() + # Set: setVerticalHeaderFormat() + # Reset: resetVerticalHeaderFormat() + # + def getVerticalHeaderFormat(self): + return self.__verticalHeaderFormat + def setVerticalHeaderFormat(self, format): + if format != self.__verticalHeaderFormat: + self.__verticalHeaderFormat = format + if self.__cw: + self.__cw.setVerticalHeaderFormat(format) + def resetVerticalHeaderFormat(self): + if self.__verticalHeaderFormat != QCalendarWidget.VerticalHeaderFormat.ISOWeekNumbers: + self.__verticalHeaderFormat = QCalendarWidget.VerticalHeaderFormat.ISOWeekNumbers + if self.__cw: + self.__cw.setVerticalHeaderFormat(QCalendarWidget.VerticalHeaderFormat.ISOWeekNumbers) + verticalHeaderFormat = pyqtProperty(QCalendarWidget.VerticalHeaderFormat, + fget=getVerticalHeaderFormat, + fset=setVerticalHeaderFormat, + freset=resetVerticalHeaderFormat) + + # + # Property navigationBarVisible: bool + # Get: isNavigationBarVisible() + # Set: setNavigationBarVisible() + # Reset: resetNavigationBarVisible() + # + def isNavigationBarVisible(self): + return self.__navigationBarVisible + def setNavigationBarVisible(self, visible): + if visible != self.__navigationBarVisible: + self.__navigationBarVisible = visible + if self.__cw: + self.__cw.setNavigationBarVisible(visible) + def resetNavigationBarVisible(self): + if self.__navigationBarVisible != True: + self.__navigationBarVisible = True + if self.__cw: + self.__cw.setNavigationBarVisible(True) + navigationBarVisible = pyqtProperty(bool, + fget=isNavigationBarVisible, + fset=setNavigationBarVisible, + freset=resetNavigationBarVisible) + + +if __name__ == "__main__": + + import sys + + app = QApplication(sys.argv) + + w = QWidget() + lay = QHBoxLayout() + + lay.addWidget(PyDateEdit()) + lay.addWidget(PyDateTimeEdit()) + + w.setLayout(lay) + w.show() + + sys.exit(app.exec()) + +#============================================================================# +# EOF # +#----------------------------------------------------------------------------# diff --git a/examples/designer/plugins/widgets/helloglwidget.py b/examples/designer/plugins/widgets/helloglwidget.py new file mode 100644 index 0000000..1ec2b41 --- /dev/null +++ b/examples/designer/plugins/widgets/helloglwidget.py @@ -0,0 +1,261 @@ +""" +helloglwidget.py + +A simple OpenGL custom widget for Qt Designer. + +Copyright (C) 2007 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +import math + +from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QPointF, QSize, Qt +from PyQt6.QtGui import QColor, QOpenGLContext +from PyQt6.QtOpenGL import QOpenGLVersionFunctionsFactory +from PyQt6.QtOpenGLWidgets import QOpenGLWidget +from PyQt6.QtWidgets import QApplication + + +class HelloGLWidget(QOpenGLWidget): + """HelloGLWidget(QOpenGLWidget) + + Provides a custom widget to display an OpenGL-rendered Qt logo. + Various properties and slots are defined so that the user can rotate + the logo, and signals are defined to enable other components to + react to changes to its orientation. + """ + + # We define three signals that are used to indicate changes to the + # rotation of the logo. + xRotationChanged = pyqtSignal(int) + yRotationChanged = pyqtSignal(int) + zRotationChanged = pyqtSignal(int) + + def __init__(self, parent=None): + super().__init__(parent) + + self.object = 0 + self.xRot = 0 + self.yRot = 0 + self.zRot = 0 + + self.lastPos = QPointF() + + self.trolltechGreen = QColor.fromCmykF(0.40, 0.0, 1.0, 0.0) + self.trolltechPurple = QColor.fromCmykF(0.39, 0.39, 0.0, 0.0) + + self.setWindowTitle("Hello GL") + + # The rotation of the logo about the x-axis can be controlled using the + # xRotation property, defined using the following getter and setter + # methods. + + def getXRotation(self): + return self.xRot + + # The setXRotation() setter method is also a slot. + @pyqtSlot(int) + def setXRotation(self, angle): + angle = self.normalizeAngle(angle) + if angle != self.xRot: + self.xRot = angle + self.xRotationChanged.emit(angle) + self.update() + + xRotation = pyqtProperty(int, getXRotation, setXRotation) + + # The rotation of the logo about the y-axis can be controlled using the + # yRotation property, defined using the following getter and setter + # methods. + + def getYRotation(self): + return self.yRot + + # The setYRotation() setter method is also a slot. + @pyqtSlot(int) + def setYRotation(self, angle): + angle = self.normalizeAngle(angle) + if angle != self.yRot: + self.yRot = angle + self.yRotationChanged.emit(angle) + self.update() + + yRotation = pyqtProperty(int, getYRotation, setYRotation) + + # The rotation of the logo about the z-axis can be controlled using the + # zRotation property, defined using the following getter and setter + # methods. + + def getZRotation(self): + return self.zRot + + # The setZRotation() setter method is also a slot. + @pyqtSlot(int) + def setZRotation(self, angle): + angle = self.normalizeAngle(angle) + if angle != self.zRot: + self.zRot = angle + self.zRotationChanged.emit(angle) + self.update() + + zRotation = pyqtProperty(int, getZRotation, setZRotation) + + def minimumSizeHint(self): + return QSize(50, 50) + + def sizeHint(self): + return QSize(200, 200) + + def initializeGL(self): + self.gl = QOpenGLVersionFunctionsFactory.get( + context=QOpenGLContext.currentContext()) + + self.setClearColor(self.trolltechPurple.darker()) + self.object = self.makeObject() + self.gl.glShadeModel(self.gl.GL_SMOOTH) + self.gl.glEnable(self.gl.GL_DEPTH_TEST) + self.gl.glEnable(self.gl.GL_CULL_FACE) + + def paintGL(self): + self.gl.glClear(self.gl.GL_COLOR_BUFFER_BIT | self.gl.GL_DEPTH_BUFFER_BIT) + self.gl.glLoadIdentity() + self.gl.glTranslated(0.0, 0.0, -10.0) + self.gl.glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0) + self.gl.glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0) + self.gl.glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0) + self.gl.glCallList(self.object) + + def resizeGL(self, width, height): + side = min(width, height) + self.gl.glViewport((width - side) // 2, (height - side) // 2, side, + side) + + self.gl.glMatrixMode(self.gl.GL_PROJECTION) + self.gl.glLoadIdentity() + self.gl.glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0) + self.gl.glMatrixMode(self.gl.GL_MODELVIEW) + + def mousePressEvent(self, event): + self.lastPos = QPointF(event.position()) + + def mouseMoveEvent(self, event): + dx = int(event.position().x() - self.lastPos.x()) + dy = int(event.position().y() - self.lastPos.y()) + + if event.buttons() & Qt.MouseButton.LeftButton: + self.setXRotation(self.xRot + 8 * dy) + self.setYRotation(self.yRot + 8 * dx) + elif event.buttons() & Qt.MouseButton.RightButton: + self.setXRotation(self.xRot + 8 * dy) + self.setZRotation(self.zRot + 8 * dx) + + self.lastPos = QPointF(event.position()) + + def makeObject(self): + genList = self.gl.glGenLists(1) + self.gl.glNewList(genList, self.gl.GL_COMPILE) + + self.gl.glBegin(self.gl.GL_QUADS) + + x1 = +0.06 + y1 = -0.14 + x2 = +0.14 + y2 = -0.06 + x3 = +0.08 + y3 = +0.00 + x4 = +0.30 + y4 = +0.22 + + self.quad(x1, y1, x2, y2, y2, x2, y1, x1) + self.quad(x3, y3, x4, y4, y4, x4, y3, x3) + + self.extrude(x1, y1, x2, y2) + self.extrude(x2, y2, y2, x2) + self.extrude(y2, x2, y1, x1) + self.extrude(y1, x1, x1, y1) + self.extrude(x3, y3, x4, y4) + self.extrude(x4, y4, y4, x4) + self.extrude(y4, x4, y3, x3) + + NumSectors = 200 + + for i in range(NumSectors): + angle1 = (i * 2 * math.pi) / NumSectors + x5 = 0.30 * math.sin(angle1) + y5 = 0.30 * math.cos(angle1) + x6 = 0.20 * math.sin(angle1) + y6 = 0.20 * math.cos(angle1) + + angle2 = ((i + 1) * 2 * math.pi) / NumSectors + x7 = 0.20 * math.sin(angle2) + y7 = 0.20 * math.cos(angle2) + x8 = 0.30 * math.sin(angle2) + y8 = 0.30 * math.cos(angle2) + + self.quad(x5, y5, x6, y6, x7, y7, x8, y8) + + self.extrude(x6, y6, x7, y7) + self.extrude(x8, y8, x5, y5) + + self.gl.glEnd() + self.gl.glEndList() + + return genList + + def quad(self, x1, y1, x2, y2, x3, y3, x4, y4): + self.setColor(self.trolltechGreen) + + self.gl.glVertex3d(x1, y1, -0.05) + self.gl.glVertex3d(x2, y2, -0.05) + self.gl.glVertex3d(x3, y3, -0.05) + self.gl.glVertex3d(x4, y4, -0.05) + + self.gl.glVertex3d(x4, y4, +0.05) + self.gl.glVertex3d(x3, y3, +0.05) + self.gl.glVertex3d(x2, y2, +0.05) + self.gl.glVertex3d(x1, y1, +0.05) + + def extrude(self, x1, y1, x2, y2): + self.setColor(self.trolltechGreen.darker(250 + int(100 * x1))) + + self.gl.glVertex3d(x1, y1, +0.05) + self.gl.glVertex3d(x2, y2, +0.05) + self.gl.glVertex3d(x2, y2, -0.05) + self.gl.glVertex3d(x1, y1, -0.05) + + def normalizeAngle(self, angle): + while angle < 0: + angle += 360 * 16 + while angle > 360 * 16: + angle -= 360 * 16 + return angle + + def setClearColor(self, c): + self.gl.glClearColor(c.redF(), c.greenF(), c.blueF(), c.alphaF()) + + def setColor(self, c): + self.gl.glColor4f(c.redF(), c.greenF(), c.blueF(), c.alphaF()) + + +if __name__ == "__main__": + + import sys + + app = QApplication(sys.argv) + widget = HelloGLWidget() + widget.show() + sys.exit(app.exec()) diff --git a/examples/designer/plugins/widgets/multipagewidget.py b/examples/designer/plugins/widgets/multipagewidget.py new file mode 100644 index 0000000..11eba12 --- /dev/null +++ b/examples/designer/plugins/widgets/multipagewidget.py @@ -0,0 +1,105 @@ +#============================================================================# +# PyQt6 port of the designer/containerextension example from Qt v6.x # +#----------------------------------------------------------------------------# +from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QSize +from PyQt6.QtWidgets import (QApplication, QComboBox, QLabel, QStackedWidget, + QVBoxLayout, QWidget) + + +#============================================================================# +# Implementation of a MultiPageWidget using a QComboBox and a QStackedWidget # +#----------------------------------------------------------------------------# +class PyMultiPageWidget(QWidget): + + currentIndexChanged = pyqtSignal(int) + + pageTitleChanged = pyqtSignal(str) + + def __init__(self, parent=None): + super().__init__(parent) + + self.comboBox = QComboBox() + # MAGIC + # It is important that the combo box has an object name beginning + # with '__qt__passive_', otherwise, it is inactive in the form editor + # of the designer and you can't change the current page via the + # combo box. + # MAGIC + self.comboBox.setObjectName('__qt__passive_comboBox') + self.stackWidget = QStackedWidget() + self.comboBox.activated.connect(self.setCurrentIndex) + self.layout = QVBoxLayout() + self.layout.addWidget(self.comboBox) + self.layout.addWidget(self.stackWidget) + self.setLayout(self.layout) + + def sizeHint(self): + return QSize(200, 150) + + def count(self): + return self.stackWidget.count() + + def widget(self, index): + return self.stackWidget.widget(index) + + @pyqtSlot(QWidget) + def addPage(self, page): + self.insertPage(self.count(), page) + + @pyqtSlot(int, QWidget) + def insertPage(self, index, page): + page.setParent(self.stackWidget) + self.stackWidget.insertWidget(index, page) + title = page.windowTitle() + if title == "": + title = "Page %d" % (self.comboBox.count() + 1) + page.setWindowTitle(title) + self.comboBox.insertItem(index, title) + + @pyqtSlot(int) + def removePage(self, index): + widget = self.stackWidget.widget(index) + self.stackWidget.removeWidget(widget) + self.comboBox.removeItem(index) + + def getPageTitle(self): + cw = self.stackWidget.currentWidget() + return cw.windowTitle() if cw is not None else '' + + @pyqtSlot(str) + def setPageTitle(self, newTitle): + cw = self.stackWidget.currentWidget() + if cw is not None: + self.comboBox.setItemText(self.getCurrentIndex(), newTitle) + cw.setWindowTitle(newTitle) + self.pageTitleChanged.emit(newTitle) + + def getCurrentIndex(self): + return self.stackWidget.currentIndex() + + @pyqtSlot(int) + def setCurrentIndex(self, index): + if index != self.getCurrentIndex(): + self.stackWidget.setCurrentIndex(index) + self.comboBox.setCurrentIndex(index) + self.currentIndexChanged.emit(index) + + pageTitle = pyqtProperty(str, fget=getPageTitle, fset=setPageTitle, stored=False) + currentIndex = pyqtProperty(int, fget=getCurrentIndex, fset=setCurrentIndex) + + +#============================================================================# +# Main for testing the class # +#----------------------------------------------------------------------------# +if __name__ == "__main__": + import sys + app = QApplication(sys.argv) + widget = PyMultiPageWidget() + widget.addPage(QLabel('This is page #1')) + widget.addPage(QLabel('This is page #2')) + widget.show() + sys.exit(app.exec()) + +#============================================================================# +# EOF # +#----------------------------------------------------------------------------# diff --git a/examples/designer/plugins/widgets/polygonwidget.py b/examples/designer/plugins/widgets/polygonwidget.py new file mode 100644 index 0000000..823fbee --- /dev/null +++ b/examples/designer/plugins/widgets/polygonwidget.py @@ -0,0 +1,190 @@ +""" +polygonwidget.py + +A PyQt custom widget example for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +import math + +from PyQt6.QtCore import pyqtProperty, pyqtSlot, QPointF, QSize +from PyQt6.QtGui import QBrush, QColor, QPainter, QPainterPath, QRadialGradient +from PyQt6.QtWidgets import QApplication, QWidget + + +class PolygonWidget(QWidget): + """PolygonWidget(QWidget) + + Provides a custom widget to display a polygon with properties and slots + that can be used to customize its appearance. + """ + + def __init__(self, parent=None): + + super().__init__(parent) + + self._sides = 5 + self._innerRadius = 20 + self._outerRadius = 50 + self._angle = 0 + + self.createPath() + + self._innerColor = QColor(255, 255, 128) + self._outerColor = QColor(255, 0, 128) + + self.createGradient() + + def paintEvent(self, event): + + painter = QPainter() + painter.begin(self) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) + painter.setBrush(QBrush(QColor(192, 192, 255))) + painter.drawRect(event.rect()) + + painter.translate(self.width()/2.0, self.height()/2.0) + painter.rotate(self._angle) + painter.setBrush(QBrush(self.gradient)) + painter.drawPath(self.path) + painter.end() + + def sizeHint(self): + + return QSize(2*self._outerRadius + 20, 2*self._outerRadius + 20) + + def createPath(self): + + self.path = QPainterPath() + angle = 2*math.pi/self._sides + self.path.moveTo(self._outerRadius, 0) + for step in range(1, self._sides + 1): + self.path.lineTo( + self._innerRadius * math.cos((step - 0.5) * angle), + self._innerRadius * math.sin((step - 0.5) * angle) + ) + self.path.lineTo( + self._outerRadius * math.cos(step * angle), + self._outerRadius * math.sin(step * angle) + ) + self.path.closeSubpath() + + def createGradient(self): + + center = QPointF(0, 0) + self.gradient = QRadialGradient(center, self._outerRadius, center) + self.gradient.setColorAt(0.5, QColor(self._innerColor)) + self.gradient.setColorAt(1.0, QColor(self._outerColor)) + + # The angle property is implemented using the getAngle() and setAngle() + # methods. + + def getAngle(self): + return self._angle + + # The setAngle() setter method is also a slot. + @pyqtSlot(int) + def setAngle(self, angle): + self._angle = min(max(0, angle), 360) + self.update() + + angle = pyqtProperty(int, getAngle, setAngle) + + # The innerRadius property is implemented using the getInnerRadius() and + # setInnerRadius() methods. + + def getInnerRadius(self): + return self._innerRadius + + # The setInnerRadius() setter method is also a slot. + @pyqtSlot(int) + def setInnerRadius(self, radius): + self._innerRadius = radius + self.createPath() + self.createGradient() + self.update() + + innerRadius = pyqtProperty(int, getInnerRadius, setInnerRadius) + + # The outerRadius property is implemented using the getOuterRadius() and + # setOuterRadius() methods. + + def getOuterRadius(self): + return self._outerRadius + + # The setOuterRadius() setter method is also a slot. + @pyqtSlot(int) + def setOuterRadius(self, radius): + self._outerRadius = radius + self.createPath() + self.createGradient() + self.update() + + outerRadius = pyqtProperty(int, getOuterRadius, setOuterRadius) + + # The numberOfSides property is implemented using the getNumberOfSides() + # and setNumberOfSides() methods. + + def getNumberOfSides(self): + return self._sides + + # The setNumberOfSides() setter method is also a slot. + @pyqtSlot(int) + def setNumberOfSides(self, sides): + self._sides = max(3, sides) + self.createPath() + self.update() + + numberOfSides = pyqtProperty(int, getNumberOfSides, setNumberOfSides) + + # The innerColor property is implemented using the getInnerColor() and + # setInnerColor() methods. + + def getInnerColor(self): + return self._innerColor + + def setInnerColor(self, color): + self._innerColor = max(3, color) + self.createGradient() + self.update() + + innerColor = pyqtProperty(QColor, getInnerColor, setInnerColor) + + # The outerColor property is implemented using the getOuterColor() and + # setOuterColor() methods. + + def getOuterColor(self): + return self._outerColor + + def setOuterColor(self, color): + self._outerColor = color + self.createGradient() + self.update() + + outerColor = pyqtProperty(QColor, getOuterColor, setOuterColor) + + +if __name__ == "__main__": + + import sys + + app = QApplication(sys.argv) + window = PolygonWidget() + window.show() + sys.exit(app.exec()) diff --git a/examples/designer/plugins/widgets/pydemo.py b/examples/designer/plugins/widgets/pydemo.py new file mode 100644 index 0000000..7857d5b --- /dev/null +++ b/examples/designer/plugins/widgets/pydemo.py @@ -0,0 +1,153 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Riverbank Computing Limited nor the names of +## its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot +from PyQt6.QtWidgets import QApplication, QTextEdit + + +# The purpose of this class is to show that Designer's property editor shows +# all Python classes in the hierarchy that define properties. +class PyTextViewer(QTextEdit): + + # Initialise the instance. + def __init__(self, parent=None): + super().__init__(parent) + + self.setReadOnly(True) + + # Initialise the author property by calling it's reset function. + self.resetAuthor() + + # The getter for the author property. Note that we cannot follow the Qt + # naming convention (ie. by using the naming the getter "author") because + # it would conflict with the property name. + def getAuthor(self): + return self._author + + # The setter for the author property. + def setAuthor(self, name): + self._author = name + + # The resetter for the author property. Only Qt Designer uses this. Qt + # Designer does not use the deleter function of the property. + def resetAuthor(self): + self._author = "David Boddie" + + # Define the author property. This will look like a C++ property to Qt + # Designer and a Python property to Python. + author = pyqtProperty(str, getAuthor, setAuthor, resetAuthor) + + +# This is the class that implements the custom widget. +class PyDemo(PyTextViewer): + + # Define the Qt signals as a sequence of C++ function signatures excluding + # the return type. These may be connected to other signals or slots in Qt + # Designer. + zoomChanged = pyqtSignal(int) + + # Initialise the instance. + def __init__(self, parent=None): + super().__init__(parent) + + self.setWindowTitle("PyQt Demonstration Widget") + self.setText(_demo_text) + + # Initialise the zoom property. We don't just call the resetter + # because it assumes that this has already been initialised. + self._zoom = 0 + + # The getter for the zoom property. + def getZoom(self): + return self._zoom + + # The setter for the zoom property. We also make define this as a Qt slot + # which can be connected to Qt signals in Qt Designer. + @pyqtSlot(int) + def setZoom(self, zoom): + # Don't do anything if nothing has changed. + if self._zoom == zoom: + return + + # Zoom in or out according to the relative zoom levels. + if self._zoom < zoom: + self.zoomIn(zoom - self._zoom) + elif self._zoom > zoom: + self.zoomOut(self._zoom - zoom) + + # Remember the new zoom level. + self._zoom = zoom + + # Emit the Qt signal to say that the zoom level has changed. + self.zoomChanged.emit(zoom) + + # The resetter for the zoom property. + def resetZoom(self): + self.setZoom(0) + + # Define the zoom property. Changing the value of this in Qt Designer's + # property editor causes the zoom level to change dynamically. + zoom = pyqtProperty(int, getZoom, setZoom, resetZoom) + + +# The text displayed in the custom widget. +_demo_text = """

PyQt Demonstration Widget

+

This simple example demonstrates the following features.

+
    +
  • The definition of properties that behave as C++ properties to Qt and + Python properties to Python.
  • +
  • The definition of new Qt signals that can be connected to other signals + and Qt slots in Designer.
  • +
  • The definition of new Qt slots that can be connected to signals in + Designer.
  • +
+""" + + +# Display the custom widget if the script is being run directly from the +# command line. +if __name__ == "__main__": + + import sys + + app = QApplication(sys.argv) + + demo = PyDemo() + demo.show() + + sys.exit(app.exec()) diff --git a/examples/designer/plugins/widgets/pythonconsolewidget.py b/examples/designer/plugins/widgets/pythonconsolewidget.py new file mode 100644 index 0000000..56fa5fb --- /dev/null +++ b/examples/designer/plugins/widgets/pythonconsolewidget.py @@ -0,0 +1,96 @@ +""" +pythonconsolewidget.py + +A Python console custom widget for Qt Designer. + +Copyright (C) 2006 David Boddie +Copyright (C) 2005-2006 Trolltech ASA. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" + +from PyQt6.QtCore import pyqtSignal, QEvent, Qt +from PyQt6.QtWidgets import QApplication, QLineEdit + + +class PythonConsoleWidget(QLineEdit): + """PythonConsoleWidget(QLineEdit) + + Provides a custom widget to accept Python expressions and emit output + to other components via a custom signal. + """ + + pythonOutput = pyqtSignal(str) + + def __init__(self, parent=None): + + super().__init__(parent) + + self.history = [] + self.current = -1 + + self.returnPressed.connect(self.execute) + + def keyReleaseEvent(self, event): + + if event.type() == QEvent.Type.KeyRelease: + + if event.key() == Qt.Key.Key_Up: + current = max(0, self.current - 1) + if 0 <= current < len(self.history): + self.setText(self.history[current]) + self.current = current + + event.accept() + + elif event.key() == Qt.Key.Key_Down: + current = min(len(self.history), self.current + 1) + if 0 <= current < len(self.history): + self.setText(self.history[current]) + else: + self.clear() + self.current = current + + event.accept() + + def execute(self): + + # Define this here to give users something to look at. + qApp = QApplication.instance() + + self.expression = self.text() + try: + result = str(eval(str(self.expression))) + + # Emit the result of the evaluated expression. + self.pythonOutput.emit(result) + + # Clear the line edit, append the successful expression to the + # history, and update the current command index. + self.clear() + self.history.append(self.expression) + self.current = len(self.history) + except: + pass + + +if __name__ == "__main__": + + import sys + + app = QApplication(sys.argv) + widget = PythonConsoleWidget() + widget.show() + sys.exit(app.exec()) diff --git a/examples/desktop/screenshot.py b/examples/desktop/screenshot.py new file mode 100644 index 0000000..fbef286 --- /dev/null +++ b/examples/desktop/screenshot.py @@ -0,0 +1,172 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import QDir, Qt, QTimer +from PyQt6.QtGui import QPixmap +from PyQt6.QtWidgets import (QApplication, QCheckBox, QFileDialog, QGridLayout, + QGroupBox, QHBoxLayout, QLabel, QPushButton, QSizePolicy, QSpinBox, + QVBoxLayout, QWidget) + + +class Screenshot(QWidget): + def __init__(self): + super().__init__() + + self.screenshotLabel = QLabel() + self.screenshotLabel.setSizePolicy(QSizePolicy.Policy.Expanding, + QSizePolicy.Policy.Expanding) + self.screenshotLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) + self.screenshotLabel.setMinimumSize(240, 160) + + self.createOptionsGroupBox() + self.createButtonsLayout() + + mainLayout = QVBoxLayout() + mainLayout.addWidget(self.screenshotLabel) + mainLayout.addWidget(self.optionsGroupBox) + mainLayout.addLayout(self.buttonsLayout) + self.setLayout(mainLayout) + + self.shootScreen() + self.delaySpinBox.setValue(5) + + self.setWindowTitle("Screenshot") + self.resize(300, 200) + + def resizeEvent(self, event): + scaledSize = self.originalPixmap.size() + scaledSize.scale(self.screenshotLabel.size(), + Qt.AspectRatioMode.KeepAspectRatio) + if not self.screenshotLabel.pixmap() or scaledSize != self.screenshotLabel.pixmap().size(): + self.updateScreenshotLabel() + + def newScreenshot(self): + if self.hideThisWindowCheckBox.isChecked(): + self.hide() + self.newScreenshotButton.setDisabled(True) + + QTimer.singleShot(self.delaySpinBox.value() * 1000, + self.shootScreen) + + def saveScreenshot(self): + format = 'png' + initialPath = QDir.currentPath() + "/untitled." + format + + fileName, _ = QFileDialog.getSaveFileName(self, "Save As", initialPath, + "%s Files (*.%s);;All Files (*)" % (format.upper(), format)) + if fileName: + self.originalPixmap.save(fileName, format) + + def shootScreen(self): + if self.delaySpinBox.value() != 0: + QApplication.instance().beep() + + screen = QApplication.primaryScreen() + if screen is not None: + self.originalPixmap = screen.grabWindow(0) + else: + self.originalPixmap = QPixmap() + + self.updateScreenshotLabel() + + self.newScreenshotButton.setDisabled(False) + if self.hideThisWindowCheckBox.isChecked(): + self.show() + + def updateCheckBox(self): + if self.delaySpinBox.value() == 0: + self.hideThisWindowCheckBox.setDisabled(True) + else: + self.hideThisWindowCheckBox.setDisabled(False) + + def createOptionsGroupBox(self): + self.optionsGroupBox = QGroupBox("Options") + + self.delaySpinBox = QSpinBox() + self.delaySpinBox.setSuffix(" s") + self.delaySpinBox.setMaximum(60) + self.delaySpinBox.valueChanged.connect(self.updateCheckBox) + + self.delaySpinBoxLabel = QLabel("Screenshot Delay:") + + self.hideThisWindowCheckBox = QCheckBox("Hide This Window") + + optionsGroupBoxLayout = QGridLayout() + optionsGroupBoxLayout.addWidget(self.delaySpinBoxLabel, 0, 0) + optionsGroupBoxLayout.addWidget(self.delaySpinBox, 0, 1) + optionsGroupBoxLayout.addWidget(self.hideThisWindowCheckBox, 1, 0, 1, 2) + self.optionsGroupBox.setLayout(optionsGroupBoxLayout) + + def createButtonsLayout(self): + self.newScreenshotButton = self.createButton("New Screenshot", + self.newScreenshot) + + self.saveScreenshotButton = self.createButton("Save Screenshot", + self.saveScreenshot) + + self.quitScreenshotButton = self.createButton("Quit", self.close) + + self.buttonsLayout = QHBoxLayout() + self.buttonsLayout.addStretch() + self.buttonsLayout.addWidget(self.newScreenshotButton) + self.buttonsLayout.addWidget(self.saveScreenshotButton) + self.buttonsLayout.addWidget(self.quitScreenshotButton) + + def createButton(self, text, member): + button = QPushButton(text) + button.clicked.connect(member) + return button + + def updateScreenshotLabel(self): + self.screenshotLabel.setPixmap(self.originalPixmap.scaled( + self.screenshotLabel.size(), + Qt.AspectRatioMode.KeepAspectRatio, + Qt.TransformationMode.SmoothTransformation)) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + screenshot = Screenshot() + screenshot.show() + sys.exit(app.exec()) diff --git a/examples/desktop/systray/images/bad.png b/examples/desktop/systray/images/bad.png new file mode 100644 index 0000000000000000000000000000000000000000..c8701a241a458d257e2e71c3d1af06007927fb86 GIT binary patch literal 2496 zcmZ`*cQ_S_8-A@EBxGb|ud^)M5P!1g#**la`B%_oOp(0tiX^3klA>AVs zHx<>vEpci1xqscie(&>s@B4h?&+mJl@2riL87I3iI{;4d0g~OO7jH%bfoW3{+MRSa zjUmL&%ouggMCUgXHtGS_kj>#g{|yFXg)0%8Mb=QVr3vdK6B}VCktAnz17IArv2ZZi zZ2dnlFo2N(OpIV=1Pc?kY?2wQ%pkCUjRovmz`=^Gtl%VI8v$Hw;ARI8JGOIxmjirT z!OsZ+PVCqQ!EF%Yf-pBkxFO1eojefR4sl*c@IsOgQhbo+hl~JZ1t7Nr@;jg)h+RV1 zEd)hjC<#MZ1S+CX6$No8)OO-GF{q0}LmZkC(2{_*By^;pD+N7i?2*P^8R*NxKoM8c^E5TzXC|RV6qFQyJ4mXvJws|!CV;@DzH?6l`5=NVMBzi8tl|y{~H|D;j94{ zO}J{pO$&##;jWFtIyj;O4_$cb!AlR`dvHu2eg^P2!0~-JVTb@jP>c|0gdk&_+z;x0 z1d|YAf>2Y0nIhZ_r_B&aMid#*2NAPLbHth>&I0ikNU%hrC6cU=Y>gCaq}m|O7U_04 zXO9efWIN)#6LOq!(FJ*~xa5j_HxwR1kvocy;OY@v^FWCQNo-kKZ=T@sPx7S zA5{6^rY~;$q1GRFj-&nr?w&wH02%|(L_u>PS_07;g!@#qQSl%c4}L9V=)|ykvNRT<3&8i67Vtse|gGVB035pznTaAxwH;v&L}L+>ErO*}CWeY_TJgj2t3f(TmqS@*MfPYj67s20GZZ zGyieMgyjimpUrTuyBmLVmrTFLfX2YV!TymKcAKivuzj%K;;zI60?FQR#d3wgw8-oI z)p*I5h3^h8oLV53JQx}(UX3e?e6xD(YjH@G$3B(+;5@eTbX)p*M*CFFDW0jWnV?;* zKHeoa4Fy!XMyhtdrHW>EK6z4fSg?*bYxY-VSmsQ>vBN9-6pHJkJ%t^PDJ>g=7t~3V z9jUh*t_XEFo(T(zTX@V~HKQDN?L>&wX%vBk3*xKU5_33%5mVax$U|ZgEMb096 zaa!P9V_-d1TRixH%fk_#@n=!AGz0IHlz>B`XD~c8e|L)(gcr~$o zo-0@iMeH z!D>EXS4);vv7}g{mPekl?R8PTnqtNv`P|=msFo>o5zd4DE<$RPDx^=c_3erD^exI7 ztqI%<-ag(6_0O~E0h}lNZ47uO<23IF@;mr+hPxz-318T}Pwr&PO7`YQk&i+<*}e@u zN!@d<*>KNc-C?uWYf?kqDdsP#iJEuI_bjVx230SobJzS`RtYS+&^9WNI-+qnHFV>gAX*=9Cmea&M0{XLsw9m-z?88 zYs@>lT{CH7FPZqpveb*}&#uWbhm-d6F}2W~B&4fm;;1c^TZkODeT9h=rdC#Dsn6GhfyzA7aY~i)p9$F&T-L2;O8l@-ZF41c#g)y>f&Nlv@^=!XdJ6 zYsQ_f6g6vP^w>7k@(OAtXC&9qj_?<@41evmsSo59rN}l?u3Ej~L1qlm##U_Pw7n>AA_r%SmXesH8o|t4Y z^;!Axy~H!k*XwmiN7MtBnBSsLe&QmYOtbi0-q96WZJI7@*OHj+=$Ri`9=aq)?BOT#_4cb?XLvIzpySaynx&erVUQ9=yQCR@ zJc5!i*=?`n?ay|nw;`6r)*)U#wobBw^s<`oWq+$~n&;1_8R_)cGN~Q?`|4u#cl)-P(H*>5nTy~<}eaLe1o8P+2;WsCI4!L$8t9~mo zYneOnkRI|WCy-g__Ibi>{=%k$y5+5=PrJPvb)~pZ`o1Vs{4Csicjvh2^-n?_=hf8$ zjthikx(yDyE{&~|ds!Ra=r6}KZJ`~hBKVC+8q|!Qrb+&zAq_$mLcS!S@aW@iO$WLsmeVj2D{ww*m`+wNj|C6Jr(ml>B*wgsm Omx^p+MXEFQO!^xC;V-$kf%K1|ZNK^z9!J0r1Jg z7oc~*KR8|ns*0f6afU76Kg8~8rd|N^-0dHZB2TVA@FAhMy0$Xm5-u?j(-Vi+3qim~ z1h$&0P|(foZ&7zeDhTxIi8@r_ng6fde8M)P!S>$MHw@&c$x)nV0qNx|-SITa@|5~C zrT8>7GztpPs%Kj$hnZ@wA&wRVRJ)k#K_FbT!4H4IsbYynJ7Gxdl>S5`!Z@n=WWi~+ zrg`=B?Fy>>H1y_FWuoAGv(@c)1QU+{pupgzy6j|*E1m2{j8LKf+P;| z?VUaGxk3FZS-Qy&*uN0~g;g17*Bs1d>|gxM4Y~OFVG2of+PlAZJ+at%Bb|6!?R0)A zi39pV;25`zNJZcyA2ujnhWjUt|r?-oZ9Ck~e$+(7bsBy_%;U4MD! zEAIn%H=+T_;1O+>=}OHES*5z+31N`8z{Z=UhOl2NUiO$}K956n_*ABvL?#o1Kvjy3 z(125imNv_-1&g3-nlDI58grZw%rCAJL4u%0YzB3KQj`v!wL*sBv~k8TIa(`-T%4YT z20Xcw{(;kAHnIVZ5lR3&fAO(E?LcBjS@GcP={vOpg37Fm@J=<$RJEJCMWI8r1MZ;u zh!{9#s#O_z49C=Y-h2)3DD^uF<+K#kxz`z|OiBm}^H0rGyBVwU8|-E8;RwmVjW00n zrLm%Q^H%DVC9xW*$0164fn@P$@Q*(eY)124YX+?>Yh`h@*nI_op!C7S8im12JhD0L z(s~MKE&k2^<^FgBcZ)Qd)Ji8{p%eLLGjuoC%b&LBmmf^jg@Qnk5@~95V?yp=1@&$c z;Tj6r2*>D7VokJsVi>mRN8Q7euE}$UgT8AqE%v zOlgW@@`#mSQ3!qYmGSPfUWgIfGC}$a>tw4otF-6w7Ial0(85L*6pOw~`?0u${dt@c z_2nPZL#2bX9m1j7dpDWqO!uvP1_HQaghBGJ(X{)R350oRoa)6B#@XZZ$)_=5P@1di z$$DtV@!D$ET#E7OySZdupH~jJAcnjQI7Ycp-1Mn!b;y*vHrti6gglLe#uD4U-SyD( z;8*{UcobYXpi9Cl%E50)8Dha_8#xs4)Ir;F9Fv$3TzNU`lP5<{DrS~@U3E*7g*=i8 zK%P`r&c`uO?3O(wX6Zy1?!7bQt3^VT?TWldoK$bkc39wF=}-6L4hWef8~W7X(k^1z z^XXrw^3!*uv?!uE-2SwCx%Nfr1%?mmmAy10R=SYbwYat z!Bys&%b|NYGbjqaBG5LzEK?-$(nNZD6`U)=*ry!&W}Sy5rc!pL@?bpeF(b|wjt;c> z+CD@tVTwRby;SI0^i{wnKUVYC@qVV*Cf={#a)?B@_b>}6?90atwN}n`Fh$e(^sHk; z!dA}X8Nc4V;QljJ&8uz+Gk)uiJMt~}3)N1`%ja!rmiTnkOPPlw{EM0Cq*N~-uQReE z4-hZ2J3#Nqyq!K<8JdU`%W^RdJV|0y8lDWUOl!j@8 zv)e^}Nc}^H{Ad*^7a`b|HaDYw>Wc?rno_;92@5R?WBRpiE8S2hp^_(P$zsW6$-DA! zWgW|RNIZu^7*imRkORnxK{JFC!Uaj?ks&dDH8FFuaD2wlg{Ad)9`RC0AIfY$B_tk# zkdSSA)MkX+&@CaK$1)Ddgf9*{E$4W)o_#cPB7YuVuu$i^+-W7#sote%&L>DSL8D7~ z0sAy)D@#%*g@l$%fEY+Cx8SinSys((31}W`t^2?~Ap|XSm}(VrKwC#^++jsS0FOO9 zXZ%V?b=k$h*%3b>;(FuMGq3gZc^+>q*p0HxzuHfrN>l1`l{3Vw3!2A8PDB6iK9ky2 z7Ub#&&Tl>%_$c+($|p%P7ALsOU?no((ASUf8@$b}&5Fl2&TH^`zt<^AC?=prh&n#| zde-2fWx>}&KL|$XRpg-8veib&RtRfyfJMO6RkVI+yM)El7yM;{!SB?pg2wH!xbn=0 zgXa7(So`^JNb%#@EHKQlsF@gZ)dU zq{rlY4^J~Whx<&cM<<3$7YgvD zkD3;|6re+uLZ=@>;Y0rhWxCH8*L|hh=dRk*@C5?51<7eUd!Y!4nw`e2_l5q46D(M_ z?nmGsjhpzc_NnQvr(BNeCo@*=`!o}@oe1gD8<~`Sd3=z_AK^n|4}MG4_W0FCeiM~Y zUrSVrNBow479q9wGvPika=?RL4vQXf_oxoM|31fNXn2_{hy0Li8%q`zkVY1ECaiF| zDsiuh+?6#XPnp*{6m_B~D-{y|q2Td44|BMP<)v3%NZ-zmrF&3%2W3YuWP;iZQ7714 zsMcFb0s@!k_}iJ^HB>r%iizZxoyBIg@mSg`_0sTBo6n4Jm3dTY3M@a~(0zRK>6oe2 zDrnEYJE==bL0TnDtvIwGl#RU8AaZFq+_!NOy6yb2=c|u-&@b`r;lvSMKBMx;Gsl_X zNY_}2*}e7e7MTtfL30NRm^fX%n{1QJ&vz&pV_=~$&oy4ZKpeTgVyd^t<4F9&d81Xn zlaj7i39{4wY-apMGk=teLS)e`%b)14IxrdYiU00ci(^r>iEzxszZ8D4;Wp{Iz>>>( z6`KzlKWjf3Xy-nxa53BP-YI{7h2^zJ5N#yTXZlWaY-knK2q_Mfp%%9m$Bc?s(l1C^$`|W2N2@lHhm}Js^)MR^VXw+QNZ`XTu z1xE1}zdVVxB^w!MonqwPPeR()Bsb*oU%#i!rQRls+F8;rCL%oMquT1U2U!!lAdHKj zYk3FCUgaGHi_z{&`K0}*{L!;~Ff*2Y5#e4{-0x3R_nuz-A?otzN9W1a1z&|SNqW`u z?{U2c1Fl4IXvt%H>L%N#bl9%*T>T64>h`+lo?DOoes=#~ATc9ScS=ZR;{bj9%Ym0;wyZ{TT+g~M?}QmuuN zhEl_KKCQe$|^fa z$c$?)Hq3PW-q3+(oq&aV&k^lNv*fY&xONwqxLeq>(>yVC!+X z_`@t9`{uL6CaS`WWjwni&!UrPR4nS4L}iQX=2p;Hk?E!_d(` z?gxKEPSMZswx=K4;@aMm|M`Y*zvaq)ojG^6r`QVpbb}^+`l_3F(6?&hV#ip&(_1|> z<*qfu5?4!{N@wG&NR6hDUhUG4Gh+d7Vb_bX; zb7N`qHhqO+u<^dqzT=Sx50w2NO@jxpjmv&QNcidXTN#h@rH!@|9zT0DnyIl$Wj}xQv^B)%$w=J=8Kqpk&)nr5!SLefZL2KZX6aJy zL2`s(n9>ik%gG`5(mYi6C`UB?u}y?$iwpbM&~n_}^gLM$N$s3hKBQM)_m?qpa0@n* zOaeG_gHuvg_8iP-_mk$q@Gc#bJj?KlnkC6O#ut{vpTmG;$#B)rolLw@j%DRtHk8p^ z-_q{%`xH{Bwkl-vqbSbLdi?bq1N)yw+tAK~5e6Mn+%qZF_|RsT=~+k}`DceM-yrUS zEZIUWz3(o3d`236A#dh|tL^1?ezntWUvR3b{4p7obG{TkP{or?D8jBae?RF#6-f_? zawp+jWgaR8mi0mN+4G!rxM@)&LhfR$#VKIRH&)i(;tYNcwXmA4GuAm+*%I*(q?yy%d65i<5(WD&K!4 zXh#52elvKuwZv;5ZH}0>B-$ zjLhMyi|uJPTlznDXn#H0!eqDZEeHw^4sM~A_#P6a&~1r9B|1!+H=JI77 zSIC>3K$SaZS?42ApH1Z-h#HJ5(}KyTavHaEs-NFaMsY8>s$}rT)W!MSsnNue#dM2Z zcKXs3awo7dO{yXwCo^SpxV4&~As!u*X`RC?XFtcS6${BsD;*xh7fTv#m-(W+jZq`d zHN}lFAQe6y*Q-2SPk-#X)Z;2x31&}w9MtAXKzde(OIY>nc>8|x4((pRTg(bn*k#;1 zch27V%x{+-O2~`Is_gyJ(pVw5oUZ0qf(v`H+G3-4Jn_2o(bebmG+sQlnjEv1-N3eo zqJb@*-slYLJ%+cX8e)#m%EI!=R_m*m7qFo1_xBjhRNx0xJ(M!7v3t(C7B3XKB6+-8 z$f&pQPAiXUXy627X!PV-)tYUb((Vp@`Wi^lCoah1OI?7)g}+cgO0yAAaI zsC2E?jG!&{TcskL|FN*~%9aTV&Q^l!4irEuUU`9cXW;At{(psQ7oE0+L$)hNwti{? zndsxIkdRlj1Izog<|L4T-uV2_dO$uZjJ`T}9La=&-M?s&KqPfwKFp`I5$YHBoLSDN zs`mD`a+?W7Br$1cLM}V7B#R67e78xV$;GTp@S#{NW_{0u)QU#4S}*ef{2=z~K!g(( zJ4NX==C}Kn?EGy5K?6l`SkI)7+kEP4trp*Lry0HRuD5vlTGhR!Ta5o2UZ(%(X!d05 zlHM0DP5%5+L^(O%U8%QQt%{AIhId-Sh!zGR(MVQj3P z>=3!ayo%6fAtV^t81^@H^La_;(D+MG(sR z)YB}TJ0w?ZWT7kDJ*R}L)m2;Wvcw8KmSW*q7ykjDw&|L+uWU|(9 zdGDj<9xU9Ny&2IukjE0dG|FyN@K+|VT-uHDnb+vv;*Sqqnwj2w+K?W%-Qr2U%fY|x zP;4T;(5cNy)cJ%ITdqYZ)Yb{DMrB4sXg>UW$w)aX2zov{l#c%LA^LfMQLFtT46Xu4R zi3>k#Hyn*3#+x-K-jMd?L5)2&(qOi;wHf`2LJagDC_UX~@pK2h3;_8yG1!#kklH5vQ-d)>CgopwMj zZiDcnrVApuAB%G2?fH5pPdZ3A_+o9gtb6}ZDr|D{)95~h6V)@?gR1RUf;@WTW7$!2 z64lHUIih^akd#5booz`IXX72^;3m$dj5s^wRRRe@uUmnis8w)T4H_kEN;&&G(~V$z zyGqA480@}pe#bdaD7e5gPD9M$OT@i;P^VyRXRu}P8JmJJt#DLN_GPRvK>%)Rv_bj{UY%^kkBO;Xn>-aBFCnb) zK?XIcN^9n=IYICV#wo|+!Mz7-KZ(zi-hI>wiYhv{p~LO^SjA}OEm0_yE>BNOD`4>L z^>-70{$sHQVM1U4$Y@5%zV6rGJr*K)2#$E=Z$h$GW|W_YCBo|y!w#E@xjxgmxgPm8 zVc*xVG$=_qDSjl$?)hdWw=ixQmO_d56EQbHH~(^p#Noc~$Ok3jRu2jLTIt4Tb>nQ* z;L|uITZVD&!~5(iz%f-?vCG7k!uLej}Ixbn7Wz~6_4}1J35CW z@PUV<{Ax8a(i_|nGpfriQTk-47Rek@1d+lOF_ZTXM&WV}2I@a*z5T$q@#UPUD2dz=9O!kl6smif2a(^ z>pypw7xazk2e2(?`d~sw5idSTd1-LI%C~ z$uwk1-4_2P>`RO109-1j`WZKWhp-M z5?Kvme4xn?eKjQ`VI?L>gtC`Uf7bcT-WAE)(X=`EC&_{gkv(WJ7d1}~ z0Bf$TK6UW?>+-GMDZXSvlsak;^Cy)UWnw3ESER^o?I0OO_*e1h82#Lq*C8N>!C!!C zYpx?m_x)4}abHW79DSU`>pte=*e31^;JY# zX7$W?KAsIdqjbidBvT&?BAlxS*ZVMk%FNt4O=);VyY}PL+?*7gIkA+rb>^c@a1=2r zi+vxG%Q+^ik@n{x2?mdpvwU?n*WDZ646ke-eUZ9KRQJ8~lkHqBAoe0JnO=2j=*yC8 zy%}?|)I}Te_ zpqin})K)B2n_Mbpe3qHtq9jgC`s-Z^LZp^oOv32NX3DD1rP+%q=5kk+GkZ9Tp?ScO3=ifHq$c;$4qq~u<}kA8+sPPLPR}8TP3tE z$7Vo_Y2Tn(5-IY|Dc_<=esrUGCmkk7fr8ce@2N6^)cloLQ7BIa*vu=|sGPvKy_0&= z>CO{}qT9}VsHM$0+q25JLii<5Cwc>CrtJA{0lRHX&wJtP4)g+IcBx1{Xm#dG2Tv-o zu-)Ac^N_huhLuu2JR@{DwA}upG~hkYn1!%w{wYy$IvYnlBU&qr^xx6ZbVGdw;g&v^ z#oJj7%}dhY)++vZpURXo!BAspO+<3s`D>*Bd!*B4`_xQWPRh40g<^@;&Ps(|=kL?D zXW)tn&;4~EJJV&CGGGys0tc}oH;$g6T-(DsE&{`XGuT95f%A-ml`sd38RevEQYolJ zRF)fJ_d)O{mDTzI9A^5L`!y~$7dr3n^}e$22}fjKL7r^ByR*8qazK8Gi_UjN3#r0h zcDC13Isgt`Tj!wjp2~1Xm0HaD^F`ln|=936|TUWlh5QctG!X$IyG~#c)m!btDjh$0_YpUO2(YS*m%7%+%V! zqq(S42Tjv#jlFpVdGa4XbG|zn9ufaMurRQ9&`o<9HCMQH5DUYR=-U+xkV86Owtb)3 zm{h$YcMoPwdB;$@KBVs;LPh?)NKpIFK@1G%oV^hznA=0lG7WYkEaD$<&bXwk{IK~A zHIC$1l0ZCd^{WusXbAh7zgydzM{}rP~NeSvX?1fQjRq z$uPF~l+U@zIo|xCLQv9qlJEP)%*r*16!*9Yw41d8NQKN))W{95@Zrcf@KFG>&zAjV zH>HSm;n%+*S}~T20Ovs#-IIYU^6d-(;;%MRUR=@l*e_B&11Ur+#Y6d^O@A}HA7Y6b z#F(1IjvGhGdvOCsXcRrwxaMk&bkvEJ@3HSdC`7lUFY_s<-eqQypbO)gVXag4;cy&7 zi=crCYeB*1>cQ99^$bZCod$X$)7z~Oayd2a?XguNFc~&s;iVuoymbmi%SAAHC`;(+ z_*-7l(?q9GM`X~XZIeZG>+ZEI%we8s^A5HdvFKpvT-9w`wi;ejn8wYY>$k45k(Obg zCIZ>E+S_I*Vqz@#dy^x=W@}_&BUp66g;dF1<06O)DLe3yi)?#i7~yGhvZVwbG->|} z5`7~ON(&|JW3z#*f(M!k|isQWaSrUL;ytJSc z;V{c3K_9`}r#3{WBmWrmq9%;%xP)_kFMKy<>U0kgCQ|mj0ZnPWglsWrQvmTN#FB%7 z#U%p4a^76nw^)pCBS{K`yt}P)@T`oZ@#ukvG!(%f*w`Lcz_G28+QUVlwhqNkQBFkq z_2cz_elu62ucHr+rhd5x^+Uz=;T_`6r^Wa*MWiws08CVX}Gi zP5>t$=u#FPuFuk=ataCjRP(GdLx48}27?gm zfBXl4{K3SPt0wvy`(_K93%v!#q;qk^HdUsc+5t|12)3{DK}YPZ0wAy&}! z-w{P^(-YQ=!ePIiJx_zCIqq_>vDvECKBAozVgqDYWz*5j9kXW{g2Vn58HkC`WDjGhYcA36-wTI{U&nWf^jNQLtH%#iN}xi z7F#%<&@aj8&eo`VK%r35g`U@UuobqV$hs>Ad$yvwe~;C4CBlC@k2JjGjRQ=9NK7n= zWa=QSE=2xCpj|=;wt!O2Ua1qM^M+R$P%(9j^(|lAAE`QNY01iN<3r$$TD&7PGLivAyutZ~Cew-y09mLn#7S zNKYQi$C9!>%|!=>0CA=SfE?X*;411>zHH8o;R?~n-m!Nd&r=T*`>>y;#0rp`MpD1~ zc=ECkENZ$@<8=2Af6=P7(DWz&6)#jybgKdF>4loirH?BK>rY}-Q;5@d&Cn8f#(||ybp{2laUGp?GxMjZgWNq$l;H@ zH94b37&+DxU8+ta4}j2Iep#D3`Ve4PqQ`*HYxdSa0|F!eH9%ehy2ar9_%Y5E0YL5o zV?Yw$hQqW3OaTnj@q)#FSpm9hC_rbmt*i!X3sv?zl*qq!RnMvj3$8%oOt+5G6(6_4VzUNbE^?H2kM+cpisoug?=r0D{Y3B zUu$QR)Fjg!U5!G*SQ+_O>ZI%u)fMTH#&w6>j^mv^cB3Bkv#4*hov)N8h5@ z6b76f03cYR#SqGk?#S;>M+-AX(ORmd0Dev=dI>m@nKE{7eXU6D?5!oCEzmt|u`tNw zu-&3l;LagNw}Jt(xI*Y()LTZ_Kn%D%vW=xGnOy(Rt$frLu&MF^H~Gt=DMA|N!XzTEBY- z@GddnT_Ds6d#88g%{$Vp^R=Dk%KsDn7SPRpYa1tETl-vioAZ4@HwBIUJn-~ZWI+){ z0L@zwfW|A0-jq3bdY2wZhKT$(TtzqU0gp}GdhA4sQm6xFoiCs(8QmWPIK*S(3H4;? z?W$KqUjG*Q`|EXzX7Pek!+afcG#MByg47YCo;~#ROmkfD7hYO_9J|03Nb{jL& zv%q>J0@8c$Vk2*3rXWv3JcXWafW$bLY9$Ffx10{|ZB zE&%U<1E3}X;@P_hFka)V=Jo?5f<+$ze-3>~0*tl;jBa}b7#21c25g%(DSDk;75&?Y z3;#Zbhv5Xs^9&fm(55-fV#5lm+Qv2X6pbhVkIrO5OTJJOFzy~8eXolgp`J=Kw@~k9 z^`G*Z*IY%qoPctCfUMoka6~%as?(3IR4$Ndr9WI#?(Z zy4b{OZTyo{lgAMNAmUyL1gvUteLfA`ia-YB`}Tgq#s=Q*!yKto^Z!I#W&j*i`tz38 z4=^AT06|6u)#vJM%+`PYkr>yKzYzs8_zF<~Xzb__9dPagwffiExQaZ*|2!-M1avOE z@8qA!B<^pHqs$}ham~>z1KYAiS&qr7Xp1+yIEy|q3X%CVF$V{P6mH!t$`;a4m zp$uSXXG7ym&g>MK*N45cNY^Z8SJAr-T=xBS;+Ha$y6gmtqtiu%^5Jd6qeXdA=|vXz zl4Uaf3n4dA+Q|z_;2iP>&Y}B4k)9X_MPDP|NkWS9`u{DI3*cvJ;E*7FBto?RPnae3 z3JY$k{@v62Ul31QS_7VB+XRlXvS@f%NP4EiLIb-(=fjhIZJXOTYP-!`;_xrNC05i| zZ0K`mAbd>RJq*GHCj~7PBQnW&b1VJf@vY z<^sskTm*xO-k!wcKnT0vDsS%0cE2WOG%p@(0I&~Q61*8sirUjM@6P#OzMdi}{t2MB zhjmRA_rSwsXGi5fS>)E|!_8Xs{&!@cC%!Yfwa0v=mpQ?c5q|NO;bUbYJ%G&Hv(hqO z@iyg)7-y59z2Kcw>$OFMDg|esGs8mm+wu0b_=PGaZ=+{y3Wy#zq${Rv4DtJ{AhR!^ zpBRAPyjt+z^Yq!os6sd=Vi_$m1(laejxX+8=oF8>wOdiv)%Elezu5K38zRSCJN}29iRr1zFp(DIqhMx zsUPVr_C-Y0_KzMpRA{lfUo0!gp%~&AZ)4=?7?3DbfsUdY=qQdY3HH8(N4fUazEEzs zU0_&p76~fUT~|XMdf(2rC=YG-dpiSQ2z~zS<0~6hWeNc4omyZCLbVWyVm^aHkxV@Q zn2S#W?sx6Xf;+aNfe@zCR0S#!T1tXnF(Kftu{}Ekgr#yx4bb^@#Zp z7D9R`hBbGyt*`m}DD2{d)BD0_UidCEP$X@v*a+s`DDktcs1!65@mqV6%EF|B)rIEX>7lW6~CFXp&ehtMk16}4(7wMnzeBxzqPX)jciPdA#M;uoZ z>w~1!xD|<+;pWfMR_<~62Z}9pOXCA^JY^6FK$xR`v#zXZDA#>CG-_QSp8R`n7^vFA zfN+FhKbu$!78NR#CNjI_(mmbjB1N+*5iN&2y>N~Ls_x=wS8>|$>1{Acl?F#TSKkCSB2_f9>*WZIt)x^J1j_rxje9FVde zTi%1SvTpZVw?OOcIaTrvUD8(dYq77nb)% zEbm6s`F1A!h9l&)Bce_4MvTfY;k^qJm0k&D#8x zqc8-P{8lnPWXS{XP-&r-5&s^L3`u(UX8}*&ut2C4)~uhXl@?}+KH||meq=hYEQb-4 z8a4+uS|c*(s1xM`FZ>-%uT3_>cBn2yy?M4yj3hJ+4WG(%u3M|+A3 zs{2<_E_IcmA|U%oS=sGCLE+NccUR2=a6(Ol*Y|@0EA3r8xu=fHg4mDxQGX+w&44lo zd29Oz-L`CmwZz=PL=%T+1hbClIhkk7TqBxZoNB07{fb0MAFK=kaO3KV_6COVc~D;( z@a&6;s>KhYy0loNIvAE}EqFfzaAdnz_XO=FicVQv6}j@Fnp1WU@0PlG;Tn?2|?WdSeAEjVVIANiNorAzAvc@#kHXa5;Pnms>_1g15 zXnnjZtwlahY{`}C%H3v*AAXt3@H8vpmZh(B{%4RxXq-Q>QCWK6==|5B?|u{EjE;(B zQa)_3&{SG0ttr5K%A3lr`Jn0@&g5JE_0vm3f~oCV?!zgX*%1= z=ET=xF~^$d*uaa{6W&33wTj`Q^VRowsBp33DdAL%1BzH+UKONL3q1G}~A zc@2ry2|M^ZY?QDyviNjh@S&4zj_@^4%83G!<5g}_x!+W4pyZ}OXUpwfs5EA@-Bd|Z zF%df(8`BpsfQy1tN0D;L#*<~o%f>A*+d(Oo>MO;c2z(kFU`t8=dMK-v5LG0haXI}b zOm=nj)#!w-pCD^m=+6<2bmtkEZ2}C|wmLXD@ICfOXo(b`lFl!eVMY`ItW3xAPbc^W z5$8A3@vZ=K`_mxl2C&xD?3Idx zb66|2Uto4rBmwyAO)n~6)k6h}$n$+Ev35COYhlZt^+&p#5Nl`2Wn)?3xjDg|cJ!GC zaJ{S*7eqOYT1~Fu>5+juzrCE2D7)b~|q!Id`6uE;pB=$rCC$VHvdBi7;zwhdA~< zXVlS^QpfeQVgmq+;gGXI0RRRTNzNj&`8<#LBBvDuthn=vdD+8;QG!S&q10xNmm8BmH+owf z6mV3bhOD0lZGs(BRny&Qua1 za-qB(S|ul{n=ihY^Xk={0+w@RvWyNg*uI{4YvjIES}{<{rJM@3cABZ-TmfH&fJT3? z(Rx3NT(so!@@UZbWd6-=ii|$Z@EOztu;XhLv!L^RONpENDHO#+6a!iO_JR2`pI#h} ze3aduu4Be$0!sfK#NYmNLfgkkCTL;Q77nDs%oa-s)ey&v1E0^CnS83PjAI)X zn3qW((7-0(V4&Zh%2i)s-d`m=Mke4kF!?Tbj706_)6DLcl|%Qa^Y82mx0| zij~{xCo=`@Xc@uaPZ*;H)3#1jBg~W1xR%Jtb`SFcZ+q6LQaji4wBMmZhaV5nm#*&N z-?nyH0hNF~wnHx3TYkYnw%n?t-M?cnxMUZyq@b9UY#y8e!RxiyqgaGuG2NH&`z*lS8@!)Fi9P!zjhdc2vr7xg%u;F5ctAO@UkUJ~%|{Ut zxVvY>O6p&}ls5d|h3iyX8LA(&%q=8b4-MUQBv=7~ycP9rENr$zvgvBQ zn*e91VU708ov#T$ZFH=&+qc1T(WGU5(IPs)F6>uWjpmeroE|)Y9hvDlr zAE8fUB~#2gu1vdW3SNcucy5j-hN=O#dZG!y;NbJ5dFe~{>oSP~e|$Zk2ONsK$+dgj zJv+@r_aG1LuP^-xF~FR-$#F0u5(X<+Vkf7N%i}xEd<*(YC4)#F$eZDY9Rv!f{H*2! z;&PpFnpWuf?X?OD;0(T;v-5b*xOPb{QmBUi&Vnmerd`*UB(b9S8E|0F*1&z#bbSxT zk$_x6pB#V>zafDKpOVx#TIL(=`ButGDO|(l7tQLs9!Ddr8U+dE?XkY$8+FtR+k@+Y z`t*5ZX--~QZB)po0~Z8_5)a9?*j4I@SlN(s<}Xzx=7wKhP#1zCQ0|8mHacf_4yELx zx9bOPzoqarx!rlW>h{7`0wwrR&Qb{S3p{C0nF|^dfnFMCrS_Oy!V4pO5a5ya%YXj+ z#kvJ!5m7MM#braM$_vVIamq~4*kj(5eftN${s>VY92>U1Xn8i?;&MoWzISir&9Ag* zVz9_?w;_K6dtRvS82dw4eTMT!F_ii+`xf(!rD*^SU+bg z%0?yckIqy%Anl}U0$ZIJewFflR+%roPCG5__c}!pI;K!~FLwbvzDi9`oeb))fL?0P zD}Sgyiz$ql{gmtJyBB99ulotOLK1NY!Usq;fLQy`?a|=;20ft-W%l)u5KIXfpZBtn z#yX@=qgvOS;(?bPBoH>+q_c?m*(CStY>7AtJZomv_#2{5wS<57rwwrlA69&RB#UEl z8YIMPv!)15XrGAxv`d6)GQ_LTBSzBN(8f^@o?g*(yi8K}Q-qJ|Xa3N6c?j?|2*DZm zh;R8|pivhdx{A2KE1E7Q8Kl>e@(tT$F@8K9FeMIFemY&?em#H(z+?+A_}KbOPh#_2 zAjsqHmSzSIw@~sRDOg0Mhxeq3J5P=?0~`n{R`NOYpuhW-p>R-Wp*t|>f7!tSn3?MP zJ>0R;l?b)0(O$xVF=-F_x$tm|UP1axl9N*Sh^GfeGr_714!RO^P619xGI`7v+qLL!@q6ytQ!_eg zzohH<5^TT2Xa>J0FzQ;CWOlygd~0k=CLbhWdHG})X~1H+)++D2U7E)zUCcP0DQKh< zA{);L$enQuNNDB;8Y~8dJRBHv1s6X$rJztjO?QyB^r)YQ&9>BcJQ-lvF;*O=dI>^~ zDvQzNvK>C?W$kvFb71yc=rWZwr&ESDtt`Va)$_!GPh-#SP=<=l>$zh*GWSB10&cIJ ze&+08y&8LLdPxZuIPhATt99>5o4@mp9vz!d+x+1#I=+Pd5;Do2qz9aF#ep`!HCqTU z=g=H@%iP(24q+pachzTEan)2iU0yB&%BUJMTHt63YWKW**94eE2n0rb%(Pg$l=4#| z19>LoARmj-6kn1ibxLe(Op$FV#eN26Dld>`z*h(Q&%13!ZSTtO8(0MmX5?d3kSRz!5pFIQgrS}axmkY0f<`v}Ed#Vlo7c|}Z7};PG;El4GP0;i>415iu6(mZ^z-wHyZ_)wT1CC#ZT zWh5lrY_?xyg<2Z<@_HX;P)mcp@LeH#7Yz`vVd`?xCRRNRGE!2VXs5Z`mnir&U=bE( zFvTr1hZu(|D9kE}TCSxmOB;NO6&O*9DYZICP}GwP7QkJGT!)cvN9ZL78389$~9uzI=(*~@4Np@=dC0O zKbvigB|8Lg>y7cQP68;bsBOOdU2UO5$aniS9Wlq!JW;3J73Db!!7ZI9{7o=e&ypZy z9^mHjWtRoXPntUzsvRI@pRVmFlt}qJGblW5X+O5@4dHJAdf^!%Jrp20RLGZ03>3x- z;o_G{T^SD!>o*n=5`13iHQpdz>b6?@p6o$AnvE^suVQCJ`}6At2`_TcW;SPtji$&9 zh2GQ6){nH1sy~>mlNij=`1(f@pjlmFFL1PynEOPNOHB=8;on?nN?m~l&AWxq;hdGG z?sh+sa%YJbW<%o49N6YLTS;Udkix|fxFDk3Z^ZG~(j7wHkoW2h%u+Ms#;QIyzDXS{ zY$1blgV!g~N8*F*Fno|TNyRUk>1z1gYXeN+$+IL^F9$Op>VN3YX?yBNy!V6T39#5SNecJKxN5s1=A zhf1!YvYwo371OEq2UR`urecA58a06e+&;9zX!`+B&eT9KDh-0>uOa1}AJ(hFh3x(n zO=XFkL}4tuO}>CdT53Ioux5~PH`;j9SsWHY4DF4h;Rl!XmYsjy?r7jzS)KP)nEpTv z{~s6~-*NQy+Y@}Ry+m8qQArRYv1Cy0*E4texYO6a_<~0>{wj6!e90-C0NSbsy;X3I zgT2H}OV-3Aa*#(^*;$5mbSt7e>QA7^n`tQLTrHVgX);}3e-hAvi8d7GuLTinii7^# z(Wcrmo~z;gg8ezAeV?D_qN9@E;(@FDYO|)~_uR%W?6$9hRh-?dgl`OF|yT0X82fxG$CRsd?Dxt6TnD*fY;iqfra>|E#>se64Dd4_ zGxCmL^GGf7@WY*(al_WS7ULfn*%^jk$tTFJ(c^PERWdE1=(Qo?XD#kNmY7ZPmh|tG zKQILbm%Tb(jZ~tUE;9^AKaaMIL4G|l+)~Lj2jEfjh>p7S*`KPe%i%np;|72~$O(6; zvAEVw#rxliV$eqRYLk&`RV*cRMz3KXji8HGa}CuKq`P}e>b1qR8|k+m`QMe`g>!GP znbu09SCx&NY?LUV$0d3Du?RZN*ZWV5*y=~j7w`GTyiTu}QT>Z&7GjVrQ^lHol1Jx% zdrk}8PaDx`G|sf7(|Y?^_6fDPt<8J1ZFPSvajt`w6(lo`jNwxpShDD@Q|TG#2Fg1l zur`kF$=&zb^|&r^bw`0~#^==DY)%)U*~HFXO0W^gXPTMjzy>FC+VWCB?Ol!5dbJrp z175dWYI&a6v$D*#jy(Ge;S=nCV0cc z(Vo@7X*^CKZw15Uf%@V)--`Nyc5m((w03u=t92t|1}EOV&MH9< z7d)X|CVf=K4>OuY=y*K@@^W13ANdbrKyG&-EJ@yv5TtXj_rA`mQ%PJvT`T1N`(8fTCFm)^wX0jy z2|%4c?mt5$n>I9gE(S{)*LuD7e)(#hu+&JS{DAry7d|MY#OBE&9mG9L&qDT^;k{$` zMKvR?_JQ`|$Gb0orMGzJ`uFyp6-!W@_m><5re=>xZ~n$%GzW)OC1^|=w-%>4YL_t=N} zFu4?lC+rqDM!hMHes$JC=R`{An>~0>?e$Z&x6nGwJovuiF>#HW2*|pE!3O4s3{H!N z@QXmYH1mF<#t`%-O6!-KlfL@wuf^?OBFOgGwK(ES5z7x@fm-L`MiFQVug_fRWDm)2R>eB9+Evj5U5sIuI2o<$DvR5< zdD=XZ>$PKmS5bl&j@!TU02%INE@t&gLogdhd}@~#PlUB5?yyz}-Ov(e(^*}t|+sJudT(D*&q zO)4Gh1Zq)v2>KmQnlGpm^9XzUEB(8ceQS%q)yMZ?Aga(%Y_y~QN;6F2!dI`+|8*1` z362CsjilZchg2fy&>JsX_%m)c)!b1`X0uc+%=e|FI6Dl-T^g*BMn{R~b&Y^QSl(2Z zMmERMWrw7%E5fz4@bmNa+9SRx|Vi`24ScL+Q zEM0koxk;|l8D5>_2+g&JKoiA9`5=hl%(Z0LOx=DUL;m+angzoJWpx=XAsE0m(&{F# zy|=^2)z|lg(q&$RptH{-=kvYn&g?Akwe~tcfXROFxOh30(@;T+ek%N@)kn6c0byt= zC|WX&1y_xb6lIQj^_>z|T>|pp-Xj%|%P~G@(B3}urn92!P*lZ&g;GfEa`m!fN$yNC zVj~rxtUzupO}CsQFH+*5+RpUuL48sjFoWJRr(kY=gRcCkI)xRvlw_&Uq4&l){f?aW zbw)*x;@P#B-!Wcl2>4Y+Dv%f%UAPKCT6&vI$eDIdQCY<&aw#Al7$fbxjw3FQ(wZbt zG+CqF@f8Op^LH}OK+vZ+6~Ek69%RbCw_s&j#od>-`mh_(3~}t~O_hG5WYXrz66tC<;cu*Pr|4m^!Xz-Sa16~N41&D=Dr`~B zunj+)=ZnEtI$3oU}y^oVrfj+1O7 zsKGbZVIIHRh>UENJjiL8_Dl0TDm_?xLR6BIFb)7+1wYf}Stk3cZ^^dCz=yb_c$$NK zwAkn6zg$on0Ajs{k$1TQLH;o<8||*+@SmCySf9^J;AweNP$=EfHd$i4_=@lx#@+Mw>&;S2{zHFItk z1Cd@Dru$u8Cx#8|YC3wF3f`qvBXa6K&M!k`={ z>+~nS{nji%_E^_>@34(rGZid+fF;#Tc4K`b4S9cEW`iJZ{4m}8K%Ll+@lNvA6}4Ue#+(EEQYAB;a1ZbXWU$>hy3D*QKa_NwmyeZke}~>#Rkgny_*o`N z@ed~)arpQkiPK=6`b0jMbwZ&>h(>cr-wyQ2d69$IgT z8X#p(%^VCaF+Aca@kM+t@lSgkxNOPY`M_&@PtgEmFR-TC(*lJmBNj)^AaaccES9f% zWuCuPr5d0yqzC!GJrMl`azb!gu=Il+AphMm+>)KqBALw_Mm9F->zjtsE>qDkE#0uH z2-@_sk&DN%*jYFLPb&o?p9BO?bNT+q{7>ff75-M`O2ne!Is|PHJKZ3r+M+K2?$mo7 zf;7g55$rw~1V;VmCaCQqwZx;Pl%*@VBDj7Yzb81dDGqwo$P{7_LD&(mB()Nm?|Y1! zW49M+aJL*A?|_>Qv8pNP@Gj|fdc1t%xKIIrfBn>3*VUS~FRiYeBJ0VeRA`!``@2K` zphaN{EKkuPH853(()q)_M2?n5X-G!C1|N@V=yw4c^$n?z8(%N-&3XHM1PO+~A`|cd zSNQ;Y!17;GXIaG4NBH|ZxrPPo6gbBCsZ0GkPOkXdpr{$tACR(7lk+%cWADrNLBFgj zsYOw{pnrx1ja2lS3}VDUOeJ#e9=TEO_4Zky_FMy9)?##L4;yVlE-1-*ydQfmK+`Of z{lO|#Bf;w6%OtkN_asK)Rn;k0t+8?|pe~N6=-sC{*kgYo$nVj%vlh=?R_x3SSQXLT zqN_kDCbh-3)WEWodI!^)el7X9_WP0^xUPN`zN98r_elcX7d)rq+RF_=(a0q$53-Y; zK1{qNCoY!=0%-r~T0VZbo0^bZmBguM(mJ354l?UYY+UomVWLmid99rlVb}F(s?B$m zj)P$GNv%P!zg1q|s)9d?*1+U-o*X1TDwFkW*O91SjVsY8RIdMM8}K{5qN&B#o#lL3 z>ttJtZ)ClVK`CfBfsMHng*eA*-<75E^xfFkpb>n(86d0Y7^(K~K+oF`2H>&=z?*Bx zaAfP(19s?MO+eHAkaPOr#Po&Q5C1pmYGE=IOjJAKm`sqb&Lk3%%wRbaZXi2bCt0MF z5?XgIzv%6=^yqk6`9Ip6xTKlhsqtk7n@a%ow!#Ggn1M-_<18xt;m(| zw=y_r3f!C-$YvChEStUlXFzobDAU%;IJlDqAT7g^=Lb(VwBJN-zwkT%{ z{R!o)`jGQ?a+O6~Cn_rAi6_UjIZHES3^=&N8a@%S0IfE}Zxlpi81pobsXqKIY!kRz zY|hH+*evsbd@fc-E1szOv7^Vr81c{cy|k%FqFCAmW4xty2& zey27GfdOP!i~O^V&tS`h(rupW*ZWuVzF!)8R5bBM)?;j9Mxp``-Orh{gmm5UM`9T2 zBA~L+uIpXiU$X7l>5*|0ZL$yACxS-?l?=fZvskmEY~26GYG5p+36Q?rfRU&Z1|cJ@ zy;6ed>+PL%wTJXEEUojwV34LsJ3^|bs2fj{V1Td@`4U@s6tUQ!cRU{LU|WiIO5=Go zujT{PTb=hu@gIPUzVu&GRJFi2mWJ|w7dYCJl3rB%&RJ`d(l~qFXVKBw3n$-NE@{D- zJk31-y6s|Pj*irWVH1*x#DkAvfuPa|Y22`2b)xJJh?&N(?&xB&0dbk8LlOff20^$Q z=DkUlk>HTC&fkHBFPVrR#{a)KCWI zpM9(}@AQmr*}hSzW9K29}wwF{3CNq(A@B(mK&<)MfkbGmFU!%zd%-14i3-iOhNilrwh(Ab; zkDk^Ftx{jHiU7v0>lo5BP@LYfdRtRmVso`JHSZA#e zEl%GtEh*kVs57ftm}qTT+1;qB{eK8knRJcl$CugIV575(oRzU0DJdEOSm zpgPcb@##FG5lgwmz`8Snzi1A7;?IQ*R zS?7ZoA|YU)QTGLF?w#)9=z<33sLmJ3li%Ceu6x#stgp-cl=@ruQ1rL+RHmdR^H-ZF z9`A4ZW}30H0jZY@avoli6mr9O2-{?wWgK z#>vTE7S(7m?eG4*fypvL5+PUZ1k%7(3<{u&dp03;`6m+NFf{Rr?J*l0RdvBW(j)TTEPb>=P7Z#v*RT}PL67Xk zzXqDD^>t9sf3WPyU#ohU>Xz5Gjxz4OhE=y3gLP9wLz!|tX@3|T3@@XSVNxs-%{3fL z^*Dzgnc}R2%%7BZ zs$!``f^w%KG;}Lc9gKb|L~HTQUV&-8!w*`^KmhSjSNF4|sr>4fw(_enp zmjw&1G9*vewuhwzz4t3K6ZDG=_Nqb&Kts#3md@M8B+HI2=fLNNd_y!JZ1xI<%{G@O zrz7T%S|(*+dQf!Z-a{sLm(3fRQ;xr8=k*Gls#c;zB1Q5QqJ-o|dl;bKAyep#7Q}mv z%Dn5OygixLTbt`U1;e91UmkQGbYK+KK%)6%=CyW>CEk}je%ntm;Gu2P!Cx@L$cEos zb9H!TJT9eqtmguBKSbF-p}rJDrG4}7eAlAJ&cAn#vm55Bp?5;^M|L|Kw-X2@@MPpq z2r@Bd!-1N&$D_9~4gN0DLwoBYG>uKv`?rGLY+cN!pPkuXW$8oq1EBrRnI824o)Om` zF81q6pw>`mSs$YQB~<|a+!oKSL~7JO=YM&T>On0icBpOnCW%u~hh&S9pl8d=xRzBb zW|xgC+}q7Oj+7xiM#{;lqZG)SlV!*n(6Zys(5t3^1Y%Yf7fe(GKPchZ6eP>nOtP|n zK_+u0iw*K&qb?sB!-S#e;hf7&^6~nPoQFT|^N_Z)vT9pe!2CnrD)^`*xLI=fo!nbX zRWpDfrxKFjG0Z=KxPx(}p&L1WB|F9;_n-gn6epSco%|nWyw5fxCBz;+>U8lB!}7!h zwjz6AG6Wz@YuBQ|SHqZ?NNp~^NSUB=)CH(*|Fzi|tS?XH#G6ahi0>Os9l}#L%+yr% zr?Mz^Z!zGRz%RQ-L8jXRGR*Z|QX&e4YHFGJoWgOp?rnAfq<{$s}f;jPBoGx)pH} zXMc!PxJ4#Mu9my3-<0rJRZwSH#qwb{C04GH!Cu}b0$11PjKg=H5Mu9_bJ@uFcAOvZ z87YIM*SVwBnZu2NWX31GV02J)%@5X{_#yt(4$CLG&suyR*dBh<18Y<1@GCQ>MG>W- zepR`r2jo!~D^bTPf&3@B3p0NfD0jaQdZ$m0cQh&^RT|yQ?79wi!C0Fx-Y~!xe7VP{ z{9K7GYSVeIz`DNK==BJj-wCGMT`tj)0PC@8IHG{IA0eK7m2Zra`F6ZiTW**0ti{i% zujilyUcDV+uyp0#E(C?n0S2lZo;4g9;4m}hpXpWcW0nz1g8Tj&ldmAT9x z{RI=8?N)DtAUDl%ZBH%}&X=uR;k%QQ>l+ogc!!%n0Sr42)Vqs|QDAfuLAF#-O&v8x zyOi&Eo4H_bJ~^kp@uSVNKr}36;1&#T+QZg>rhuk9swRWY^+>x;9l_gws)CMpb~HBE z#XRlpZMzScFEjs`FkDn1UjhyUWMkJ*lWy|lSp zbA5adD508?iJm-D4)k~jQVr>Kw$j$(BC)<%tVv^YU_tNgrvDUx)X$C$H;C@;V~wg3GD9dA*M^`p%iL!t_j>h_7LOI8l!9UwSSX-xW0{?A@6JknjhW3* z!>U`4MSY?J9&$QM%BG}KO-<7;QtzV(0v#n%HzYs z&jEtaX)A9P)o*cBH}xoB$^1w(j(OGJodWW0oV}`?ecf#^;g`IwUu4w6pdmZnF?qoM z76o+UF3gC%c5!~vsUU@L4c<4>eXy5Avaq9o?vH)QuvdE~H8Rn20mVBcUqm)r5)kKu zpl-c%-YW`Ure+1+4mw3PC*$ZnQ)=Rp=c01Q?wiw1&(`z2QPY_HMIO<|r~>pZB& zjDrroPTt7^yhG_dhC|#P&4{nGdj&qmSMWGg?)r0(?9`Sq>u!;c*=v#rQ7GeEdwU9( zn?rPS%CX!8Hynu!Zy68(AD9$(sX6i=4ZF1~M7@7cb_29amA}=R@3WJHj>LOA z&g0U}JAkuUX`dWa;>YHrje--ZtJ=~5N@RRJ3;14R{~(Q~4;y-9 zcyi}K0LF3_YzNc78g3rzWi`-{jAsEcqI7cuU!ZKx2+V~rY_xC`1@CJH>CmHWX}II} z8$-C2ati2;MPN_l3o|rsQ4IVs+ANTvKo0V%s0Z0X()=c{mEm_M+(1y={mH5sH-kOnH<*wigKR39D+G{V_|X%!Z)5cSd56Ic{Fb7f9bFBzj+ z>+&*-6>QkJSxI`L-4`^-B$US2g-~glXzQqM8HsB^0UZM8dk4>zfP`2>t}cyt$cL~E zSmMcSmP4btF)-Y3-BoaBQ;u>IgzdTu*gLieyNqW@;u4p@|F$-n@?gnj|LfE!VMVxr zs_S2U-Mu9jaBh%T{g$01T+q}EvW^>DClTqVcKY;G?F480C*RKR+u8jHu?3>ZeR=cv z)?3Rrn>%2}8ey;$WWoEWf(sDDFDDihlXaSm{QvzEePNqULpio5*Oq?tbSAfMn&?z$ H-GBUl5R*?B literal 0 HcmV?d00001 diff --git a/examples/desktop/systray/images/trash.png b/examples/desktop/systray/images/trash.png new file mode 100644 index 0000000000000000000000000000000000000000..4c24db926d6fedc7cfe2b92a9b62c8aecd25f8be GIT binary patch literal 12128 zcmbtaWmFqco5o#Af#6ao?oF}cUR(1o?#11U@ATWZY)!cKV=-#D40s0$*Z_+V@i zd3?sDQmVST1PnB9Tv{F761w=S2mt8rF{B)c71zdGb^;7q*tFI?4 zqX80DdR(n=>sj55^@&ihw+BeO31BEANpHaDVwJTk3Cu zQ=SPaEv&xZl}!DGCAY5xET9F9I<^JZg!kyod1T|gnKMp7=w{3|X*1aQBCl*6?Nwef z#mOTdz1heoiWlyZ(r;*bgV5c}u8AjsK){5ufH+byUHtLu{UA47!1kE&l6ACmj76P* zvF6POi@X+^Y%DmDt#AEfNhW_u>Z8Y$rt<1rw$gBX@Zl6uE3OsnYd zUpG6ok>QA?8az~wQ8|n;6;LOe(szPsE!J!6_~6cv^Ye*Neoh({*@;mml{`(7NM0gE zBf~lTc4Jk7T?IkY-Wf5ffFbXXdX#%9f^*+)Q)=o+>2In%0M zNRwjycx#T%1&n5n{ibnPsExo0sTj`$58;7|q@~!qDKa-I6!#7+lllS6lp8@;{2H@N z6btmh3~xrIhiqCO4!UVu-si*W_%rCPH9R}&FPbKk5h+B#8QRYa;_17WIodjquNcEK&Ld89(JcKR6k;OpHYW>zSBV~+8LHo?(4}20WAoH@5JfCu~ut<+k^8s<+A?4-Yj(vtUQe!y`i*Rd1jR$IeunW(I6=4#1T3~8{a zxR&Tp)csL(V;BEjk5Kb~0RDUYXFX2iJ5EXe!9-7=L8&u|)PDJw>#>&7&!mHYhH1U^ z;CbN&vd5Xl+#&dEWF`G2i!40{2ak3Yg!$lQ5rxCPNe_$WKg%E>ZhlB+RZ05||B|m8=PVM{p8z-iIGSD?bO34aD>b7`t9c_kTZ$_8*&;$E-I0 zc~M^#cMWj~hGQ!jCD>P9{IP&r*bu(QnnXAI$HCIG<90%dss+vJb?W4?W*ZSsVnete z)r>Biz^AdKg-Q0ul!f@lWj_X9QS@hlWh9R=z6dl7@qxfjNs(Wl|8y#@)eGOy1>%Xh z_k9xeEldtQSv36fg*d76y{8s=qDA{#%T9`cmk@P4iFNk8v5CN|1RgGCW2KwK33L3| zpc?$8wkKIpknjXZ`Hil15 z(jv*`;yYcog&tOi3J=KWa~sYw@^cQ#eMv`^x~8aLJ18Qk%NUlHC7muk_S?^3HJ+mS z$@R9wSRs?GFO`gRWkc!63~B=-M65P|`pd`m8-KDBbU3ihp88i%|GONyo_9 zNc7R#d4ruk7FyO2l1gmeoICl%+>%7$)--j3?bz0z%}KdT-G}{dn3Ace-E0CGW|9s- z`%F*^LP=jOrS1(*qJ@A(pX91Za*S6Ct0iTN6iHZcg<;u!e*}RshF-K{p)all;#ZoR zA7FFnuru%ZgQ_}cEy%k**;DiyXRO zU<2a$muSMVh`gnB3sBfSRVx7(ej=f`yZ%n{gfzN6s#YTn7ovYLvK2Z#(;wMWha5BO zM(i~qBBu|#YEcQ2hon0eowz1joMQO{(+238TDuO7MH44%{6){kI#fT(4Z?!{I<#bN z3r9q9r)8U@5X}?LVZb(#xci)SR{paE*rIr<%5aLD@pKt&*+O@+%kzLU=K0a1Z-iHb& zW)rmKiEx()JPsLdjIoYK*?YQ*uPpQ(zst%9J-doj6(MI0?lbu;;$$<4 zzfAG^!kTN<73PN5zX?Au(m&!R9_T&M?cljix1k?|G+D*pGuyQ>pUPUPfo~Yfok)Hu zMtwkgyK85!VRHdHG`!4w?VB(1vV7@dp1gestIAN@-dAVFeYCrw9(h73I<^-HlfS1a z)x>Mtyb#}_a#&qFYi|2a9b0aXl(+43Zc4Dz5k8E=$g`@WF^H@LYr#n@_beDvrLs-8 z_4p!uh8xNdJ+mft{X@^;Z$qCPvBlvRNVv&s&(gyZk+M=2wjqN`&2$$+LSp5;6e`Xx zp`BH^;Ejw`!(XF=Zy}vEQ3u7s&?AZ`+mvSL>bjm>#n7}(0abU0y*57ut@k77WI;Tu z;S7&H{!|KC<)_Df-#p&2C6iISGPIQ|RY(>jv5~{ZwfNJ1u0W!OpRm@8?t6t+{tydC zNHiCMt6Phkm*L1p*r$zuM1*~DxlsqkhnYCwv%>9O_T8pHrxGq5{iq}eeQLd6ROwn= zgo}lkW5!cTE}fgHR=E6Dy-&}s#UUN6)UIdr< zZ{N|UlTS&J1G1gME;S*u>APtnUbLV#gzJVn-+r+6Q*BTcO z%SZP3IK|XEdOTrRz@1t^!|`m_7Wlg?;1 z4Gb6J(gM30&OcXQQ3oB7t#B3^7S8E_hcBjUCrc`OGR_M`Wqq#=__8urjsfV2;CGnm zZX(KxrGAj!f`;*W*PG`us&pyFPjDcupFDEN4H*o^ZcI`U{peT?Z`i--$RGo4{)pvT z+l%`7s@6f}(_Gf9zqsz?Fzx<5yX1NU!ny@kZ&_Hm={bQ0PDXEZ<8@gjbKQnyq1V&Nc7v`yc)9x5vUOpl=I2rnw}zp! zt$CAOpEn9b_l6k>dR>5_{Tv`X@D-h7e5Huj6>H@p_AoKQt;ny+eb+tfuvyM8*1(58H~?RBmwFUlS{w!sZMQP^+a9+r~$~Ypd^4(9P4Z^z5fl zN{Q;$;zAX6b_S-nCvg96N6-ucc(XvO|PeuQ>JFW4fRpX8Uesq1CO%B13vA9-Rw?3LuHtL5?( z#PeF#9@Iss)2dSMbnvBnn2PrR64-pxC|#dr*p2{yr8FJqr8{9@A9G`5U1P4}IR2q7 zDbwl2c#gaZX4n+6om2}!`rYoVb00Z~IgOpd4$?M%q|&}3E z-Ascgcq&QQ>Jb-F}#NvnvP3wJuv>cU^P*%f7eSQK%ufnPPNPsn<+o`!o0(cbXO zieF220IvCUyki;KtJ&P|?N7L4HvD`a)~#ja1!P!wX^W~NrnoIzA_u#RP3v%Mnv>W{ zV@W(BZ+;V^>0Mq5l%6VYS{Tcm8vc-6(aSlY8yVJ%Y}T&Ck25=`ag$>P1OScIXcxtR z{H&N*ziKBfCriEOn{8VAk(9}mM<>O_jON!x>{$8}gwixtiiZ=$4*S`!Jp$}|R4H^* zHYJ+f$!sdDc@1$KQ$*~nkjX=WJ{&b82|AmalW9{5#*Vh&e zW>9`KojzFN9_@VO0R}thH0PUw{PwsPtz7gbGV`-vFpo^VW~hV$@$vRop&HS;F+x|$ zyvz?BdY#4ZA`{*F%e9n_fB76Sa>p{1flz0w%Al%2OZ6&UJj6Zsbi+pK8%i}G778-K z)vpul`i4k_mw}w5%>FWwIJbj!qfX?N)TYuBsVbvtR1x7v}DrJ;zLcd8cKuNE7Z4OCE-4jt@W8&>pb`sLlo zlNRs#O;OSx_RZ8d=T3}H zo$Rj1Sj8oe@?gVXjJeR>va1X$B|ppvT9^8^bbMS?U-S*EniCGj+#^6Ma?Irk8@TNb_`bQxCe zA4_7DPM?yXCD+`rkn%=!_3&1;bLP$PV8urJ?g15x(p^~x)p1qB(8Wxwj9XdcXB!Pq z<)CNhqzWe?fVm0D+$e)l-&b;D%m~s+yeWLM)yZ6uT5T#G>S84W@JK}w#Mt4FnuRxX z2V4c&OwHr@*&MNS+2NBo$$qP-V9%y@m%d9u^vlQkl8)G+twgWnna?B4g`+v$G2(!JlZ)wM*h z(k)Z-ApU}=gz|j0IUz#Ehf5`>`?h$gde%mt9n%+&{HMK6R%cG;FqX@5NLsGHoz{VA zKg4jHnlE9+rR<24*CMk|)=d_3sw<~ql`Dv~Bd}Z4?ZHSk^tWdqyEyg9E*0&^THP~Z zu}7qyz@xVnqr>>}&OE^QoJ>M!d{x>FH_5;8A-HvP7i+7!>CLw+8Fu8j!7nP4hxe%~ z=B=4ml}QO)1#aS)jk9I=epw}JTemV*`)fOq4wI%vb=TZWQ5KmdyJDq9EtA@+ChJ35BHG)JUA!Y=awSVfw<1n1hTE5zRQOzPDPq(a_z>mBaP zuw)#+X~*$M<(Fsyl*p&DC!85FPTCy}sY3;9L$1;#YtA{Zp}I{j@$dSmJ|kg~jvu1W z#s(Y|D_mrg)hgl;fAhvs(d9Jy$R7r z%^Jf99|UjGyvC>2etSxz_#B~8u^nDFUxhB9#}^Ck5zczO`VG;f%O zFx&9kS?z_oQ94%04lND7t`u)}8I8F6zO|qiYh!Pv$5I>huDjjFIKpOU;6yKNOgp9V^8+Ge;*H~i?uD6n_TYo^KGWDr_H9Qw$> zxU6CI4MtEwa@y&c*@6{Eu|(or(!e8p{J$Vqym>z9x(C#TODQ|)0Dcwvh=ud)%+{cG zr;?LyPE8cyglxs95B>6RW#=@Us0Z=pZa%k3W?y*6`sRF4OwDPohj&s*$L7E+;u}Hq zVpQ~_F>K}ne=9--r7}*-=ur6v3IsVQDqvu1j+1u#2Q$v%d$WB#y}q%2w-9Pf?$7T) z4uS+AY~}e_fVcP$yVckS?+~Y@tbW*rGE}=;uweRnVoDzMm^(@a^XYglUwM>Jtc-7K z$7?_EE6hxBXn#I1?F26Yo{k6R51?2$N@e=IaVSOF_igbo0~Ee-RnB{5`d$)Wtn6U- zti_ck;%C|$C;LG!{sWr#Y9Z1--3=B?nkR0E4)7#(f3aH%Md$YeBPVZkqVn`|_>*;Qd2(qj3ecB@H=D5AzZwD#Br% zc|U#YQn*k%p?PtdSZN8CuvAY8<0c~_uMGH>o92ZY%&_K6eFcCoU6c_} z_o_4)xhZ^fgNaY<(lAKkK0(()#9rrUb?J&?&U6JRJ|oS3^u2FTS&)8iV&w!)S?f>{ z6rJP!a{^dsBow0c|EwY}$6W&?S8pq|x464Ez7%cT4#qPUrD5am*Tz(`Be%5NP%qaVHbKVKhiPL zRI@HK+~E$`RtLW46iP^bX>s;R|gPxvZ*VtvaSW(E{>$%(9 zaK?6Nai|s&?ukAR=*n(jargbkmNo-L&+phmWY@@G(ncE?qC$4@71oeM3X>nh6mFv4`FsWlFdlya zy(#&y8Z>S?Y5%N=@zc*l8i=j+yWlpn-Jyf$BG7;Wl2fx5%|= zuM59NOW$7$0cM2t1<4e)Jq@Y1BZg8e}luLK9z=q>fkHq?b{XJ#PKAlGBa13#* z!AtSl>bc5-@wL0EP^Qnoul7wWUz};Fzn{&uLa(1<`;=M;-lT-DV*~J@H-%YYqf~jE zM6GT@a5AV6vg6k1YavyZKYqS3%fz|3$ZQBEck3&U2=+iT0LaLCmO+AZL3a~z_1M}@ zs=Ho7bKAoBMe0CIfEky5RlSc#z`HE9c^)rAktSq_MnvW>$voiA3K3kwdv3HOYtYy72RW) zOjIN{3NFk2oeR=P$P2T!<*@jhZzOKGn}ERu*qcA5?3ic4co{?G*IMySm4&CfE4H`% zfEkM;AYsRFMETRd`i=nbNps}<)>6{ZG=lTF$K}gSzK3BXJLiV3gI3+I ziX^G$*Ow7Y^<0hPsT}v^oozc^VOejS?V(OM29B-8sK=Bl{zM;)(V1^|%Na2%{gDzI z=I;KaJ4E~T?v6v>yVLHloic+T9 z3XP3c6Y0F<9UED04se8lbv7yzyx~1knX)5+bkJXt^MC>{z$4k5+Vxu*^nYt*{{;f2 z3smh~`rskyeOG%-I^Q$A8XC=mf52!HeuAYD4885$5cWT5-@&=wcUFVYl&&~;Ii5v< z8Ry~ z=BTY!pShg@w(VvdiQ^=F-iKO?AH8KfU=7Q4H+*KRiQ@Qg6%Cpq4uAplJZ3{E7BrmG z*iNXq$oBIeY2>v-sCXLwLf>n-M4NtJY&MJh8q=D8x%oN#-7ovVlK0fV`G&vnroWD+ zMKPl}V*8~gpmc1%=;P&oS)?g)xznq!m(J#kAJop{M96xhm8j{vFBRIdMf*@`Y4N&9?7BnNmEz=xN$3sfVy6=eQgDS*O z#MQa+o4TakFzx{ab)1&=FmFDGrTh4UZ)p^8($TG=V=9A7F?il)-h`^}@b8fO~nhGe@KqyKAgPhC^gW-<3_i{MD;%>CKrk zeSBykPw#1g*So|>QK_-h9Nv-I%g6>QW@RnUC!BvN=fjXes?1Fb0{ddaNXYHcD<4BG z+XnpU(cZoDF28#TVeeJI;ng)!YA%V-NI2{0tle%a<^{HUQ6uZ~B97g-HG}wZm6-3y zUg*rAOzRj)v1iFqZ)Tw~jLD!2wOIyMzi{IE1FHk+WFJ{cirg$*Ruq$Pnt{s(8=Q`Y zn9^aLekVyq*x5fKPh27odg$TqlycQucZojK&P9^{GTZl=EZ~5USm;LNC}ZkiH!HPu zQtdL*ZT^#Gh3+HeV5QPLKcX=mR%5d#?Ca*}qNrxQAl`Sy_`pV<0FvX+I+>B8{f5u) zoddRarUz)*92n*3M2)SF$Te`-mwFeLtIDf*X0dfk2K#_y(D95O7lL z6kPawGMl(FPi)tMDnJ!Y}t`@`ybm3ogrjX0H4r#6u!i* zZYZ26`7)QWe3oh6;6b#4W$YyWdt5~&H`7uGvY>zjv37~i{r3i{l510LY4T1P07fTM<^u7gqrmb`d*-TvWk?dMc*{-Wsg*K+9;_yTGQxF zl&#oloI)3=EgSi`prGThzS%dh#|U#U-WMf;vh1ep!WH3;xca@j#?%kK`A;FEwu6jQefJb(jzc78UuG626<-eE|dx z200W5s2yzSk#*EI++gP@QuCbha_gIRp`@!e{V$NNAj}N!WZu|f^mi^&jKJh+tSLx3 z+O*FFeXz*losK{>F3-c$3G@uL3q*YEHlzg1&+uM4)=Xg+_?>EJw0f7%Ta320@|Vqd zXX;x`5AWE~_~Uk{D9i8}mhLdQJ&^WZ96Cywt z!H?)wlHQeObyEM=Z`Yiv1844%28WAxPRyD{+~FRcu+fyb696VWJpP6*SOM*MkR`PSi0%d!!7Z&rSxs$ zwmU0U1Xe4ly(MyAEE>inf|}j6Ecn-8XPtKF2W+Gkx?nI~9M9qBiy_SGC2iKsYHwxn z#8X-1K@#6C^=Vf!cFSs)I^JqwC+WMEVU|iDf8cV-s?B^hYRnC7kkoz=SN84CpcxC% z5XhRk2s&t??q(Zly7-YVD3fd^1GGT}3TA=jy$8RB(a}YL;*AeA{rNP#)5cTZw6Ipb zVxY8)u0@ z52@7@>6a%!>Vi8q(-yp3NBzlscS{prMu#SPNK$Epkcdo&9S!R?%`$u)nQko}etzTf z86P?r&+NdpC9hHgA_XjpR`z z%xplIf@GlBpaWpwhEZcC7e;BYOvX4|X=tdel@; zANPA&vtt5|Hz~6$3em<+-=!zrlZ`s@+6kJg?3e7C%LChD zinwb&Fs;-E$uFSE(M=#^T85%avl)BzTTR(8{)a0(A%0sKO>wK0Q3B0*zfcU~Xmeju z&+X&1QJ$DdAkg$@Hd7Pbd4HqZwcDAsjeQnPHdK9~#dG~t*FN!F^mio5>s0x2G-y0S zng868&fAjlv2X2Dua4T;f_=;qsl8QZ+U3H3Q-nli#i_i;$^x9_uPH z(I#4{E=CCt*>jrXKkYPY3uGo4*6C>KxAb4kn~FrG)PVLTg$M45Nhps74&h1P*4H2! z!J~L#3;#@^2;Ig`Znrw7bhNAdh&VzIu&$cgO`G$8Pe{*PVWy{xN~lds2bq1*+ce)I z(f0VL1G$r!6u;Sj0=&*ik?(4FFn_~Fcx%#1R>Q269RQ{AQyEltcNN|i>^#;`@8+(K z!O^S$YnfYTODF)+SQJwLl|QHsA1Ia9{s3eOYB_-MxOe;oWL7=9)b?=hDc7XEjF<}V zI_}t>mJZ@!piLKO1PtkDUBo{cq5o-OVeeMgna69aI8+b+oHGq1sKl>ChA?B$o>}ye z-(O5rEmbSQJcy%_gF3oMKzT?n6!r)iMNiWYex-^TquTFZO`F&qQAca_N{Ke+Kg%rs zh#cGu%(IXK?G`u?pZ$wWzc5Wovc5%wOj=2l_i-yAHeHZwk>@LxO=)Yq(omjJ`s_i; z4)2prdQ-+zuVmyT_IsS!`Inl13*s5S-L^fi6}~Mhhy*Fp+KLwkt5_n&qm^gE!n9tj zgIV;ei4{dRcECAc3uZ;}q3pK2a@cLWdP1P;4cJE-GU4ziq6w!?WM?K&nV_%oTHkfn zGe!i_nrW%t>RL+vbk#oYehCRP(9Wc^@UzoHdj~~fi^C3}b8qdXSVUS0mcpoi!BbdP zOg^it2sGa(n7V#9>e$sA6iU20;U{%TTuH(y7NF~qb>L~TAy^T?QmA;N!Rq!ievusLkTvE;c#xR$H8;+a#{<`&y}?h$qsH{D zhl6+5Bb>eEwX|VP>OrGM{3LgYwXYZ8y~rfi<<6w`wgE(KXi1{NqwsH|_A(>p;b`nh z=)SEqew~0D<3`tj1!uJ?)3nWrRo1T-VjdXvo3Iis0JN_0;}rxO8$Ylv5xLt6=%vF- zDDGJ_kqgfk#cnR0cxJ>c@C@ol2&j!CYRZm=w!A)j6YH(|i2rZ8(HMyJWoRFy-0RVz zhTKmP3xek)No94bVcTUS564^3q069e=?$*wsY30}RXFl3_oE$UWADKWu8zYcLA|W-uH{D;PkT(dc3ARHM`9b8IUn zvJ&K~go9J0qFE>_UJPWqUYH48HONh;j8jq zQLBloM5?H8+QC3yB`RZ&|J;Z*-0|~!-z|+0WXsBwPug{}a6)rFiiYh3`>v_1*SHDo zPqC|rJxFkz@<4a?H$T5a&#nf(B&_r?f#w$yznfi8xoUU}R0tgi@?od-Ir#tR$mZUn wswL~X0Xnkfv(5MUUt#}0dc@)2V%A^aIWqJ1k2vGL{aZ*@N=dRt+$iY301Z%}p8x;= literal 0 HcmV?d00001 diff --git a/examples/desktop/systray/systray.py b/examples/desktop/systray/systray.py new file mode 100644 index 0000000..867c517 --- /dev/null +++ b/examples/desktop/systray/systray.py @@ -0,0 +1,239 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import os + +from PyQt6.QtGui import QAction, QIcon +from PyQt6.QtWidgets import (QApplication, QCheckBox, QComboBox, QDialog, + QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit, QMessageBox, + QMenu, QPushButton, QSpinBox, QStyle, QSystemTrayIcon, QTextEdit, + QVBoxLayout) + + +class Window(QDialog): + def __init__(self): + super().__init__() + + self.createIconGroupBox() + self.createMessageGroupBox() + + self.iconLabel.setMinimumWidth(self.durationLabel.sizeHint().width()) + + self.createActions() + self.createTrayIcon() + + self.showMessageButton.clicked.connect(self.showMessage) + self.showIconCheckBox.toggled.connect(self.trayIcon.setVisible) + self.iconComboBox.currentIndexChanged.connect(self.setIcon) + self.trayIcon.messageClicked.connect(self.messageClicked) + self.trayIcon.activated.connect(self.iconActivated) + + mainLayout = QVBoxLayout() + mainLayout.addWidget(self.iconGroupBox) + mainLayout.addWidget(self.messageGroupBox) + self.setLayout(mainLayout) + + self.iconComboBox.setCurrentIndex(1) + self.trayIcon.show() + + self.setWindowTitle("Systray") + self.resize(400, 300) + + def setVisible(self, visible): + self.minimizeAction.setEnabled(visible) + self.maximizeAction.setEnabled(not self.isMaximized()) + self.restoreAction.setEnabled(self.isMaximized() or not visible) + super().setVisible(visible) + + def closeEvent(self, event): + if self.trayIcon.isVisible(): + QMessageBox.information(self, "Systray", + "The program will keep running in the system tray. To " + "terminate the program, choose Quit in the " + "context menu of the system tray entry.") + self.hide() + event.ignore() + + def setIcon(self, index): + icon = self.iconComboBox.itemIcon(index) + self.trayIcon.setIcon(icon) + self.setWindowIcon(icon) + + self.trayIcon.setToolTip(self.iconComboBox.itemText(index)) + + def iconActivated(self, reason): + if reason in (QSystemTrayIcon.ActivationReason.Trigger, QSystemTrayIcon.ActivationReason.DoubleClick): + self.iconComboBox.setCurrentIndex( + (self.iconComboBox.currentIndex() + 1) + % self.iconComboBox.count()) + elif reason == QSystemTrayIcon.ActivationReason.MiddleClick: + self.showMessage() + + def showMessage(self): + icon = QSystemTrayIcon.MessageIcon( + self.typeComboBox.itemData(self.typeComboBox.currentIndex())) + self.trayIcon.showMessage(self.titleEdit.text(), + self.bodyEdit.toPlainText(), icon, + self.durationSpinBox.value() * 1000) + + def messageClicked(self): + QMessageBox.information(None, "Systray", + "Sorry, I already gave what help I could.\nMaybe you should " + "try asking a human?") + + def createIconGroupBox(self): + self.iconGroupBox = QGroupBox("Tray Icon") + + self.iconLabel = QLabel("Icon:") + + image_dir = os.path.join(os.path.dirname(__file__), 'images') + + self.iconComboBox = QComboBox() + self.iconComboBox.addItem(QIcon(os.path.join(image_dir, 'bad.png')), + "Bad") + self.iconComboBox.addItem(QIcon(os.path.join(image_dir, 'heart.png')), + "Heart") + self.iconComboBox.addItem(QIcon(os.path.join(image_dir, 'trash.png')), + "Trash") + + self.showIconCheckBox = QCheckBox("Show icon") + self.showIconCheckBox.setChecked(True) + + iconLayout = QHBoxLayout() + iconLayout.addWidget(self.iconLabel) + iconLayout.addWidget(self.iconComboBox) + iconLayout.addStretch() + iconLayout.addWidget(self.showIconCheckBox) + self.iconGroupBox.setLayout(iconLayout) + + def createMessageGroupBox(self): + self.messageGroupBox = QGroupBox("Balloon Message") + + typeLabel = QLabel("Type:") + + self.typeComboBox = QComboBox() + self.typeComboBox.addItem("None", QSystemTrayIcon.MessageIcon.NoIcon) + self.typeComboBox.addItem(self.style().standardIcon( + QStyle.StandardPixmap.SP_MessageBoxInformation), "Information", + QSystemTrayIcon.MessageIcon.Information) + self.typeComboBox.addItem(self.style().standardIcon( + QStyle.StandardPixmap.SP_MessageBoxWarning), "Warning", + QSystemTrayIcon.MessageIcon.Warning) + self.typeComboBox.addItem(self.style().standardIcon( + QStyle.StandardPixmap.SP_MessageBoxCritical), "Critical", + QSystemTrayIcon.MessageIcon.Critical) + self.typeComboBox.setCurrentIndex(1) + + self.durationLabel = QLabel("Duration:") + + self.durationSpinBox = QSpinBox() + self.durationSpinBox.setRange(5, 60) + self.durationSpinBox.setSuffix(" s") + self.durationSpinBox.setValue(15) + + durationWarningLabel = QLabel("(some systems might ignore this hint)") + durationWarningLabel.setIndent(10) + + titleLabel = QLabel("Title:") + + self.titleEdit = QLineEdit("Cannot connect to network") + + bodyLabel = QLabel("Body:") + + self.bodyEdit = QTextEdit() + self.bodyEdit.setPlainText("Don't believe me. Honestly, I don't have " + "a clue.\nClick this balloon for details.") + + self.showMessageButton = QPushButton("Show Message") + self.showMessageButton.setDefault(True) + + messageLayout = QGridLayout() + messageLayout.addWidget(typeLabel, 0, 0) + messageLayout.addWidget(self.typeComboBox, 0, 1, 1, 2) + messageLayout.addWidget(self.durationLabel, 1, 0) + messageLayout.addWidget(self.durationSpinBox, 1, 1) + messageLayout.addWidget(durationWarningLabel, 1, 2, 1, 3) + messageLayout.addWidget(titleLabel, 2, 0) + messageLayout.addWidget(self.titleEdit, 2, 1, 1, 4) + messageLayout.addWidget(bodyLabel, 3, 0) + messageLayout.addWidget(self.bodyEdit, 3, 1, 2, 4) + messageLayout.addWidget(self.showMessageButton, 5, 4) + messageLayout.setColumnStretch(3, 1) + messageLayout.setRowStretch(4, 1) + self.messageGroupBox.setLayout(messageLayout) + + def createActions(self): + self.minimizeAction = QAction("Mi&nimize", self, triggered=self.hide) + self.maximizeAction = QAction("Ma&ximize", self, + triggered=self.showMaximized) + self.restoreAction = QAction("&Restore", self, + triggered=self.showNormal) + self.quitAction = QAction("&Quit", self, + triggered=QApplication.instance().quit) + + def createTrayIcon(self): + self.trayIconMenu = QMenu(self) + self.trayIconMenu.addAction(self.minimizeAction) + self.trayIconMenu.addAction(self.maximizeAction) + self.trayIconMenu.addAction(self.restoreAction) + self.trayIconMenu.addSeparator() + self.trayIconMenu.addAction(self.quitAction) + + self.trayIcon = QSystemTrayIcon(self) + self.trayIcon.setContextMenu(self.trayIconMenu) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + + if not QSystemTrayIcon.isSystemTrayAvailable(): + QMessageBox.critical(None, "Systray", + "I couldn't detect any system tray on this system.") + sys.exit(1) + + QApplication.setQuitOnLastWindowClosed(False) + + window = Window() + window.show() + sys.exit(app.exec()) diff --git a/examples/dialogs/classwizard/classwizard.py b/examples/dialogs/classwizard/classwizard.py new file mode 100644 index 0000000..b2e4fd0 --- /dev/null +++ b/examples/dialogs/classwizard/classwizard.py @@ -0,0 +1,410 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import os + +from PyQt6.QtCore import QDir, QFile, QRegularExpression +from PyQt6.QtGui import QPixmap +from PyQt6.QtWidgets import (QApplication, QCheckBox, QGridLayout, QGroupBox, + QLabel, QLineEdit, QMessageBox, QRadioButton, QVBoxLayout, QWizard, + QWizardPage) + + +class ClassWizard(QWizard): + def __init__(self, parent=None): + super().__init__(parent) + + self.addPage(IntroPage()) + self.addPage(ClassInfoPage()) + self.addPage(CodeStylePage()) + self.addPage(OutputFilesPage()) + self.addPage(ConclusionPage()) + + self.setPixmap(QWizard.WizardPixmap.BannerPixmap, + pixmapFromFile('banner.png')) + self.setPixmap(QWizard.WizardPixmap.BackgroundPixmap, + pixmapFromFile('background.png')) + + self.setWindowTitle("Class Wizard") + + def accept(self): + className = self.field('className') + baseClass = self.field('baseClass') + macroName = self.field('macroName') + baseInclude = self.field('baseInclude') + + outputDir = self.field('outputDir') + header = self.field('header') + implementation = self.field('implementation') + + block = '' + + if self.field('comment'): + block += '/*\n' + block += ' ' + header + '\n' + block += '*/\n' + block += '\n' + + if self.field('protect'): + block += '#ifndef ' + macroName + '\n' + block += '#define ' + macroName + '\n' + block += '\n' + + if self.field('includeBase'): + block += '#include ' + baseInclude + '\n' + block += '\n' + + block += 'class ' + className + if baseClass: + block += ' : public ' + baseClass + + block += '\n' + block += '{\n' + + if self.field('qobjectMacro'): + block += ' Q_OBJECT\n' + block += '\n' + + block += 'public:\n' + + if self.field('qobjectCtor'): + block += ' ' + className + '(QObject *parent = 0);\n' + elif self.field('qwidgetCtor'): + block += ' ' + className + '(QWidget *parent = 0);\n' + elif self.field('defaultCtor'): + block += ' ' + className + '();\n' + + if self.field('copyCtor'): + block += ' ' + className + '(const ' + className + ' &other);\n' + block += '\n' + block += ' ' + className + ' &operator=' + '(const ' + className + ' &other);\n' + + block += '};\n' + + if self.field('protect'): + block += '\n' + block += '#endif\n' + + headerFile = QFile(outputDir + '/' + header) + + if not headerFile.open(QFile.WriteOnly | QFile.Text): + QMessageBox.warning(None, "Class Wizard", + "Cannot write file %s:\n%s" % (headerFile.fileName(), headerFile.errorString())) + return + + headerFile.write(block) + + block = '' + + if self.field('comment'): + block += '/*\n' + block += ' ' + implementation + '\n' + block += '*/\n' + block += '\n' + + block += '#include "' + header + '"\n' + block += '\n' + + if self.field('qobjectCtor'): + block += className + '::' + className + '(QObject *parent)\n' + block += ' : ' + baseClass + '(parent)\n' + block += '{\n' + block += '}\n' + elif self.field('qwidgetCtor'): + block += className + '::' + className + '(QWidget *parent)\n' + block += ' : ' + baseClass + '(parent)\n' + block += '{\n' + block += '}\n' + elif self.field('defaultCtor'): + block += className + '::' + className + '()\n' + block += '{\n' + block += ' // missing code\n' + block += '}\n' + + if self.field('copyCtor'): + block += '\n' + block += className + '::' + className + '(const ' + className + ' &other)\n' + block += '{\n' + block += ' *this = other;\n' + block += '}\n' + block += '\n' + block += className + ' &' + className + '::operator=(const ' + className + ' &other)\n' + block += '{\n' + + if baseClass: + block += ' ' + baseClass + '::operator=(other);\n' + + block += ' // missing code\n' + block += ' return *this;\n' + block += '}\n' + + implementationFile = QFile(outputDir + '/' + implementation) + + if not implementationFile.open(QFile.WriteOnly | QFile.Text): + QMessageBox.warning(None, "Class Wizard", + "Cannot write file %s:\n%s" % (implementationFile.fileName(), implementationFile.errorString())) + return + + implementationFile.write(block) + + super().accept() + + +class IntroPage(QWizardPage): + def __init__(self, parent=None): + super().__init__(parent) + + self.setTitle("Introduction") + self.setPixmap(QWizard.WizardPixmap.WatermarkPixmap, + pixmapFromFile('watermark1.png')) + + label = QLabel("This wizard will generate a skeleton C++ class " + "definition, including a few functions. You simply need to " + "specify the class name and set a few options to produce a " + "header file and an implementation file for your new C++ " + "class.") + label.setWordWrap(True) + + layout = QVBoxLayout() + layout.addWidget(label) + self.setLayout(layout) + + +class ClassInfoPage(QWizardPage): + def __init__(self, parent=None): + super().__init__(parent) + + self.setTitle("Class Information") + self.setSubTitle("Specify basic information about the class for " + "which you want to generate skeleton source code files.") + self.setPixmap(QWizard.WizardPixmap.LogoPixmap, + pixmapFromFile('logo1.png')) + + classNameLabel = QLabel("&Class name:") + classNameLineEdit = QLineEdit() + classNameLabel.setBuddy(classNameLineEdit) + + baseClassLabel = QLabel("B&ase class:") + baseClassLineEdit = QLineEdit() + baseClassLabel.setBuddy(baseClassLineEdit) + + qobjectMacroCheckBox = QCheckBox("Generate Q_OBJECT ¯o") + + groupBox = QGroupBox("C&onstructor") + + qobjectCtorRadioButton = QRadioButton("&QObject-style constructor") + qwidgetCtorRadioButton = QRadioButton("Q&Widget-style constructor") + defaultCtorRadioButton = QRadioButton("&Default constructor") + copyCtorCheckBox = QCheckBox("&Generate copy constructor and operator=") + + defaultCtorRadioButton.setChecked(True) + + defaultCtorRadioButton.toggled.connect(copyCtorCheckBox.setEnabled) + + self.registerField('className*', classNameLineEdit) + self.registerField('baseClass', baseClassLineEdit) + self.registerField('qobjectMacro', qobjectMacroCheckBox) + self.registerField('qobjectCtor', qobjectCtorRadioButton) + self.registerField('qwidgetCtor', qwidgetCtorRadioButton) + self.registerField('defaultCtor', defaultCtorRadioButton) + self.registerField('copyCtor', copyCtorCheckBox) + + groupBoxLayout = QVBoxLayout() + groupBoxLayout.addWidget(qobjectCtorRadioButton) + groupBoxLayout.addWidget(qwidgetCtorRadioButton) + groupBoxLayout.addWidget(defaultCtorRadioButton) + groupBoxLayout.addWidget(copyCtorCheckBox) + groupBox.setLayout(groupBoxLayout) + + layout = QGridLayout() + layout.addWidget(classNameLabel, 0, 0) + layout.addWidget(classNameLineEdit, 0, 1) + layout.addWidget(baseClassLabel, 1, 0) + layout.addWidget(baseClassLineEdit, 1, 1) + layout.addWidget(qobjectMacroCheckBox, 2, 0, 1, 2) + layout.addWidget(groupBox, 3, 0, 1, 2) + self.setLayout(layout) + + +class CodeStylePage(QWizardPage): + def __init__(self, parent=None): + super().__init__(parent) + + self.setTitle("Code Style Options") + self.setSubTitle("Choose the formatting of the generated code.") + self.setPixmap(QWizard.WizardPixmap.LogoPixmap, + pixmapFromFile('logo2.png')) + + commentCheckBox = QCheckBox("&Start generated files with a comment") + commentCheckBox.setChecked(True) + + protectCheckBox = QCheckBox("&Protect header file against multiple " + "inclusions") + protectCheckBox.setChecked(True) + + macroNameLabel = QLabel("&Macro name:") + self.macroNameLineEdit = QLineEdit() + macroNameLabel.setBuddy(self.macroNameLineEdit) + + self.includeBaseCheckBox = QCheckBox("&Include base class definition") + self.baseIncludeLabel = QLabel("Base class include:") + self.baseIncludeLineEdit = QLineEdit() + self.baseIncludeLabel.setBuddy(self.baseIncludeLineEdit) + + protectCheckBox.toggled.connect(macroNameLabel.setEnabled) + protectCheckBox.toggled.connect(self.macroNameLineEdit.setEnabled) + self.includeBaseCheckBox.toggled.connect(self.baseIncludeLabel.setEnabled) + self.includeBaseCheckBox.toggled.connect(self.baseIncludeLineEdit.setEnabled) + + self.registerField('comment', commentCheckBox) + self.registerField('protect', protectCheckBox) + self.registerField('macroName', self.macroNameLineEdit) + self.registerField('includeBase', self.includeBaseCheckBox) + self.registerField('baseInclude', self.baseIncludeLineEdit) + + layout = QGridLayout() + layout.setColumnMinimumWidth(0, 20) + layout.addWidget(commentCheckBox, 0, 0, 1, 3) + layout.addWidget(protectCheckBox, 1, 0, 1, 3) + layout.addWidget(macroNameLabel, 2, 1) + layout.addWidget(self.macroNameLineEdit, 2, 2) + layout.addWidget(self.includeBaseCheckBox, 3, 0, 1, 3) + layout.addWidget(self.baseIncludeLabel, 4, 1) + layout.addWidget(self.baseIncludeLineEdit, 4, 2) + self.setLayout(layout) + + def initializePage(self): + className = self.field('className') + self.macroNameLineEdit.setText(className.upper() + "_H") + + baseClass = self.field('baseClass') + is_baseClass = bool(baseClass) + + self.includeBaseCheckBox.setChecked(is_baseClass) + self.includeBaseCheckBox.setEnabled(is_baseClass) + self.baseIncludeLabel.setEnabled(is_baseClass) + self.baseIncludeLineEdit.setEnabled(is_baseClass) + + if not is_baseClass: + self.baseIncludeLineEdit.clear() + elif QRegularExpression('Q[A-Z].*').exactMatch(baseClass): + self.baseIncludeLineEdit.setText('<' + baseClass + '>') + else: + self.baseIncludeLineEdit.setText('"' + baseClass.lower() + '.h"') + + +class OutputFilesPage(QWizardPage): + def __init__(self, parent=None): + super().__init__(parent) + + self.setTitle("Output Files") + self.setSubTitle("Specify where you want the wizard to put the " + "generated skeleton code.") + self.setPixmap(QWizard.WizardPixmap.LogoPixmap, + pixmapFromFile('logo3.png')) + + outputDirLabel = QLabel("&Output directory:") + self.outputDirLineEdit = QLineEdit() + outputDirLabel.setBuddy(self.outputDirLineEdit) + + headerLabel = QLabel("&Header file name:") + self.headerLineEdit = QLineEdit() + headerLabel.setBuddy(self.headerLineEdit) + + implementationLabel = QLabel("&Implementation file name:") + self.implementationLineEdit = QLineEdit() + implementationLabel.setBuddy(self.implementationLineEdit) + + self.registerField('outputDir*', self.outputDirLineEdit) + self.registerField('header*', self.headerLineEdit) + self.registerField('implementation*', self.implementationLineEdit) + + layout = QGridLayout() + layout.addWidget(outputDirLabel, 0, 0) + layout.addWidget(self.outputDirLineEdit, 0, 1) + layout.addWidget(headerLabel, 1, 0) + layout.addWidget(self.headerLineEdit, 1, 1) + layout.addWidget(implementationLabel, 2, 0) + layout.addWidget(self.implementationLineEdit, 2, 1) + self.setLayout(layout) + + def initializePage(self): + className = self.field('className') + self.headerLineEdit.setText(className.lower() + '.h') + self.implementationLineEdit.setText(className.lower() + '.cpp') + self.outputDirLineEdit.setText(QDir.toNativeSeparators(QDir.tempPath())) + + +class ConclusionPage(QWizardPage): + def __init__(self, parent=None): + super().__init__(parent) + + self.setTitle("Conclusion") + self.setPixmap(QWizard.WizardPixmap.WatermarkPixmap, + pixmapFromFile('watermark2.png')) + + self.label = QLabel() + self.label.setWordWrap(True) + + layout = QVBoxLayout() + layout.addWidget(self.label) + self.setLayout(layout) + + def initializePage(self): + finishText = self.wizard().buttonText(QWizard.FinishButton) + finishText.replace('&', '') + self.label.setText("Click %s to generate the class skeleton." % finishText) + + +def pixmapFromFile(fname): + """ Return the QPixmap from a file in the images directory. """ + + return QPixmap(os.path.join(os.path.dirname(__file__), 'images', fname)) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + wizard = ClassWizard() + wizard.show() + sys.exit(app.exec()) diff --git a/examples/dialogs/classwizard/images/background.png b/examples/dialogs/classwizard/images/background.png new file mode 100644 index 0000000000000000000000000000000000000000..44c7badb8568ff756804d2a5a651f8fff9961a1f GIT binary patch literal 22578 zcmaHyQ*-YDiQ$_1Ox=CoUEie__z)M0qKhX2mV&bwy*{Pq4OdqDW>UZe7*rv z(6YfBy4h-5I!i`QHpSqtqEuBy_=5CPn;b|bi-E~xr-msW2($4+y0ZqLTF^`zPUifR z+^{jO5+RX$qR|=dn^_0}kNWy>P~Bg<_}hECAdF5~J)2)5*9R}izd9oucwaHWr~Th2 z=svPV!V7}U4>K!i5w6T+_M$X5SIPt(kEljp-P?LL=TEZ(vAl|+AZtU?AtctZ3u|MN zT#o`jkqRaCX-CJ~4+Dcg^6h6`bNP^XYdBZ&R$bWG{)#cNf4Cd^jMH)810>WbWQp-l z{A3up`F!6!7srEIHW;2Q;-ogoYn)rKo&@%Z=l((Z#bAY_-kIG<37#YVO{w%4g8Z!Z&_=QKorn9A~G@lS~T1QE?NrbY7+X zYg883uTTTGy!;a>!Kk{bYin!X)f}+ZO~Ro-%W|y;5!;ojh9xuuMTCcc!o1daGLUJ= z{Ik2WlUmR4-TP{LJGW5WG5M)Sn^96|OLzHH(A8Z?0KS|^U* zR|sHaqdMgOTlxR*@mYp6AZi|`Q0G_QC?1K~t3$1KUx+_tRk)NI^|uXV^~jX3tgU3& zpVY}e@YB3M-(?v|{?Ki7zHH66yHTlOJ;2#mb!fI2MA*_nv8(gT8YNKlq;^{A?*`59 zuOtr+icByXuJ!oS%0AXbB`v7K_*!4l=a!GIK6d8^tq=pEvdyD6Huz4{%$Js>IL)%2Xi$tYaAxm^Piv1^!doFHE+1iZ)fzjcE^cboKAyqD-7V* z*JeMk4c3HONgJwvESwe7FDxy6epay=!>`*@NUDGU$Gs6ZU$sLGW|tdZ5~sxso0^QQ zw94l*xr*e2^;4M)2;q_&yS*RaS)1v;zrNa!JU6#k@5H_xdM>J(XWFpTe?f82@WrIi zargVM6LCA)%_z~WtMx5X=po)eZEst8yvRJ1l-&QqA4bjb-7fp)w&)`2Xo~nte!&D= z(l^JEgr97trk5sPzg9II4BwQ!6)Tb8`KPoC_tR}|TD*BdBP8x&oT zJnnX^>LGYWrE`7D>25updxvKLg#+s1$bRXS)5GjBuLWU4xp*@g@@@~NFvYa8Fnkj2 zPh`Oj?p0!Sba~yGG+b{P;}O9T^o8$A4qBSjY#OZ}CBx}N4jTS?yI>u3jti_})OD&D z`ZpLl$D|by`6P4NOP~F-n-!WN;}e^j)5h^Ox)lw!P(#Z!#fcQ+rU_So|<>LuVmD@%x3#TMb9? z`~8v}cx#RTV`9Cshu-3C4AxN2)))(bQ>`F~%ce{o+oRS*iF(3(~-vJ5XOp3~_}I>&+}P7ufx$jr(eG2^%KIL2bN`?rsYcCn~0 z@F(syM=SoiB%46ih1tf@lt)n%mJ>#r%H9V70Evi2hndNw+ukxyoM(S=4)H#Z>7+${ zThcoal!mIp{{adzi4VU$JY8*C16WW47*wtL$c>AOAL8itYASz>-5vVf?cD4wu-5AV z9yFUr8cw=U7b-+jLNe;>W#j28B5=6!ezGsm2OWAIB3`DkNJ4@D?{oI}MaqG6!>g@C zFS`TsNc6xWe~h6i&)a7GWaf_$?e8$7C8pz|g;1V)LRfp8WAWcos!K{#wt^aKaa&bZ zH_GM?B5`oKxMoM46XKcXmYzV5{KG%@Wub4-LEH9)pa>|~Npi(n4Trw=pcQ{I#|os% zKS^<{SLr23{LY2GXD)xYzs#T5ZFKltozBZ$2!hg?ktUP-8MwJ)ZabGuy8Uq(j4^mw z`S{wl)&c^!?t8xBMY-zIg#bA~5hB-CtPlqORz}aeop#3WsHsD*C(U@ZsuMs=6Db#W z0|#Rs=5`r}UQ>BqcQd*Re@}?-=u?+vgFV zIC`Piw)bRr{v^Z zXqTBkG4W88f1bhPXl2Q;BU`ek5sNquJ)Bi#3lLu`3*GRLNuZS6`1q?`_5*6~O3CU~ zp)5SN$)7DHTC5 zyJNMbM_M_Vs#fAFxwkFex>^*CAt%q4jA>Gs)s%L;>FDTvB4D)4W-ew&kLISO7f`!{ z4Ie5Z{L}2)sK3L-#fnQ(oap#vVpY6a*u9-L^jV0|FF_J=7&kIMrSLB-I~M7g?o%v4 zP>2rpJ9HK$W$i{(er1XdBxDG|mF3V2OH6b6{>%F(1RoG2ovOrfH`wj4VcwVk>UC$r z$d6;3&XzKFs)yO$K+KJ3&f9;0x!O*LCZgApTI~g}=6HEFN=}||pjwTk% zAR+tb9|*?-+*3u@S?Y_v|>%cO!0@>hWCR$ z1N}@P8dJs081UiA{p_$PuPTAj_G%UZ4j5gtKjd*W?z>dAmY$ZTOA5CDsmM27G9{M> zNvUv^9MrrN6Gh;5yAq5X-R}_y0u(SnJi_?DN+9@EdaCix&CoCYab^dBc>AR0JkQ^r zG@-ao{QzWDA$xVJ#GnV-Y7M6emRUGBVBp<`Iu&z?9J;wVE}lW=jre|U66=X>IPBhm zK%oCz=E&$63S5;#A(6J@{;+-G<$B$Tg=JHPT_SZ36s>NzuPh-)1A|2@Rq(SCl_YLg z7T?#7Dw8XA5yAELmGc!Dt(AJM@w^fbUalhRTc;o|SRhC>N<1n~IX?5uc9Do^`&@9e z-LMUQ-flmq;SNVVHs$JK0Ou~!awOsEc%_^|3hi5kW$oB>-qGUh`Nm z`s!-VstrqsAk4?)8Y|jFw;2Uji52f$^aSOgR%>W5itl8(y=e_vM<-%n0#X4X`~zGd z@{>`OlVnt;vI)gUW(D+{+5^~{67aMK^`KZeSgp%oCe;El?v9^tsCNGWLEEa3ybxKa zF%Wk)LQ@y~c4>t8#CUar{-4>x+S=b^H`ck$+&X?A`R)6>ENPeDX9?yMb_IDP0(`Yy zf`@5lVZgV&e#Xt`Eqi*nlL?g$mLaD^G38S(=K*e-cYl=yCWo)V)F_!gb{~Jns1P3o zj?l>7=`oZ>MSG9Y<9?phpRv!6S!yxX;#HO}3hE5+AAS~6{N{$vQkB7t3GF|%a921W zdC?PnkXx_WwitHMJ{IH9M_@6B70H>Mxp^oX%gZIpwn{F;;O>A3JP;H|GKw|CZO;r3 z17lHWh6e;8prFjtq{HJIdqP4R#@fbS+5hR(4f}KR_R(FZVa|#dr+ejXcDtXbT_nGu zlM$PSF!Lw?yzMBu@zx+SDnx<|;Q0vqm*S_;l_=1*XMA)ve` zQrdu5fH@S4@f0Ejdn>TW+xu<)Z*zw`U)*)PtNyTB|zXbuD0ge9f zTM+hRMi+9U-zS9QGYr<6uGM1rcS*>@pX+L!Y8*o}py};x^?65UR)5N4=~ic^@N>eE zQIZN=$lOdi*|y0he$qP!*I}3BTww6OV!Z7@Yh|FryqPMLF+s0UgyBVmGRzeNt zbJKHjGun|vO(8#}_CE!J0$paO6rnT(QyG62|GE%|Ix$P7C4W7LCWQWUF_6c@Zu4>s z@(7l<46xj?_m3qx(8R0RY;o*=x~DQ{Makq^tNtV6p9YbW!)N|`3|kev!a{t)-Ihhl z+107`%dFz>xTXemyKV=fwoh{^9<}X$;)Dtr;}7mf>y2ELMFaBqV%> zClP>e5YIAnR(riHW`ePbwnF_tYuCYRs4uN5vX2@YfKH?vNyT_@kIvcO6Wq2PKsM+_$ z$|NB%RT>7i>Tkl9WQSl_BMP0Al~=d#m?U_|E~tP~jzvap=zXxdF@b6-89+(}m|NW6 zu7;p?42R7}C=EpR_;~KiTHzT$*9Hh4H}{w0gd8bUJFIC#t>T>R_4OT%RWsYb0xeh1 z0^9!CIv9|i7QWn{uRLI6u9P?+%oL7fyCpNgU!KhrWHc)hG^e*Dt4H@0NTX5$vHa0d z;GjXn=0}GUE;n0s=9o=Q1KPJYM^k@rL2)=Gi`Cq8%nnF$mMn8iv0b%4wA|vqv*H=L zv*CtVDYXBtZ&I^oMKArL9{_!TuD>%p5qV_vPag95U&TE;UT5m$+x79x>=mi7Ve}hF ze{goyZen|Tby=uBVlbQ|przGzIKg>w6CmuV2@czIU?^RN8umyeogxjo|#1hAJdD*0_Dc2iXbEP!XmO&{qiOCDCIzYioROf=QDVk+-~TAL-XC~$ic zs;Y^7-=wn=ClhLH88olul@vn+la?cd1ojw!|rW=P&@laA!&R)35dK2V*<}YG@ zhvf+>Ro!ji>7`(9b6ZBt4X!p##RdL-o-7eE{IADJhVt+6Kb}4`BIfseU0qvR2%9>9 z->RlnB|Fz}<;*@A1b)ra^9M#@fbOsCb|=CASb!=4R_%`-N<;o+JqQXO5Q}QT__Azf zT(Z2G>GQPuDYaoNbjs8v8^$iK0|E^D4iZox*A=^-v}r0S!+E&gThriWTH=gkD85qrCWPKwtin*(0=-Wlgq~qIV<#qcvyaYHtCJ=cs#F5FrLCn@Dr`tRLm}C zwPM{y%#yftXN8Ua3gyx4=%^y{&1EYS%h9dBZWcO@8uj}cFH$!ZgH{=k#deMhr_`H-RBpOI%*LS@nwfYJrcfnu0zhy_in~><(x%Bi zPd5{p2izecc@Z;J71|S0$E?1UmBriRI1>FRl0Ie}ZE5AQ^M_S2DaLsj!M&+8;x_mtTaDXehl+oIG59@NoT`+B2FoW^u5|1OZ z2Ql|Kqh`M^hCJDx0^f4aKiE+Va#W>j4to|A7$x_pqwb}QrNcQklhlH<7}3X~IM z#E^D0Vts9D!IHR!U}4-W+EA0{XOt)1#$h@4xAZrf3V)ER0;xGGEi`nX5Ps5wzV>AAD-HMGf)lK# z9SQvTg|Z%1W<~?|>+9&Negu)cU2ce<;$>sC1Q%Pmck*z`+_z^D~ z686Kv-{PGn*tp|6@F^0BIN+R42&b~K%(SnZwVhHk5ne>t&l@ZI>_10HX-%<=^02Tj zzbVm5&^rgJKrl8ANI39v?X}0st?SEz7q!;mafJAIQy1lVV@6|@PX2JSPCga#UamrQ`l)x_ zyRh&}Vj?4UQ^>PcwQt)wfAu}8K4EWcK;ZS^ES=Ibvg*n99A**$ZjaOfq%S2Yi6wfy zEWCfJWl)s^0cB7-VWCN`Q$4Oxh~~t#ywq?cM-UpyO7ZyNqY;HYy)&hE2bTXGJAPWB z7-3ErMxl0Fj7UkysOP84KSl5fVd6Fw`jDkwrfb2%l*4ksyPZ!DkMWXU)nFJ~IfQDq ztlq?hNI9&4^VjC`Gsdry=-EN}!44F+nd4qq7G@)T&790O)-?aQ*wP_&biF_A6krkG!|T#E-9UI7Y~L4&#*itP55=B&mq zFG?*n22YS#=yevV@~iVgR!2;(n|&YF1QKY63Y8?G+exiq9wNKM5m!yqGuT3zgXK8k zXIAN{UXeu11Xl;p72)GhK(QkZCny`q1fT4vNLR|b?8amRHh%(OJk{0N<_2+0$O?u_ z6OE93f8Qk{@lc}6(f75b3XfD_=z*)sv19}J*)s}cux6WsMg`Xx8Kwe?xu?Zk{1GW=~?IF#kDVR+zTb)sE^l45y!{wOoGXqq^Objc*zm|@}Y+YpQysWaoxMbgoGaW z#>|ix&~SICB zw=z^Z7n@E4l?DRS^gxhC$>+z=KuGWe6_4+9FtWY>_9!xR<*b-%cXIMcl4zCsEqm&A zg0X=WSPvciPQ%+nK0Jh<_Fj&ibRHhpt=tHc7)>eZZQJ$xPn#@9lq=ZAjm*eXEAU_u zuwv#jXi>hCl{pVuSj#4MNb5A}2vbB?VLyxKpo#dT-7GDbF{1?1m)>0fN6M zL&?mIRd%|fBuy*$a-I;L+@)h-NiI@bZh|g+MD@m^MzN z1ricE{lA`TVbF>o+IEc;b=)}N%>8SOMfNiP1*+S6c)#952L=Xi-9zkVH#on!-5p=` z{9{fmRzM>DU56p9{>DDgEFOF`+=*|S!L&v}#Rq{nZKaxer2Mr1(SLM|atIu~H`a^a zzFMxzd~F!n^!i7Hf|j+1{xc&rJ^iZ|zN~qBIp@_hoCV41`Q`cxeOKu0pSkwxRyXI< zd2HUAkVHt(+K*@gP&t}X=4QKtW6#}1mk$FbLHGbZ7Yv=5OOh&3E1iAr#7`gdBrEcd zK%m+-#j1DYJp}MAupqfMd@PQfB&=tkl3C4cnrCyu#;7=obl^Ittz&JsJ2%F^x&6LP z6>dMI{P#%fRIukhRAE1pVLZ#0urtz&0Kdb~^OQK$+So4(r#K(hqB|z-5qnn_9e160 zV}KI^LDi)th5ee!Qirm3?l7@_k4yn`ccNFyDaHwBmcDKz~jaoLo zA>U8$jArsTLt6|BY4A{vqbu2`k{QHTwE55p_T|V!<_S0{+@CTw1COpKs|`Tk`CE6B2h;7F zhyDgLmspK2%dA--#nQ4#;bF@0P;RX@jfoMgTG!Tp5tX6vO#07aQ7!t3eq<~XP0euP zoMU+%v4k=CrQxH?N5e*i-HXFi)u7Sx+(|@NZAV|DeEusvWI}t!h3oXObI?VvNG}B? z4LUV&Xg_5|#(^ukQFxEm`;yy!^(SxU_X3_AzF@s;pBC#1BzMdc2=JRJcD;nVxoLZn zX%vE)VoMFz*BZohyB{8~|KhBVFJ5EP5*W(*Mfz3xm^UUG|8DN}$HIG(*80nmiO{B? zpT1ynR5D>9_Uq2bS99M_p=UcWYVr5_GKUR1yx91)D<+EUUO*oMx-w-R>2Z-N8*MoL z1pHGxW;=`ScEr&JhynoX$!Vf`VdU!Sib?#>u&wte7IW|EyEefldmbb^BSA?mlw>y6 zUg7C0;;@dr5`zHZqxhg72NmA7-p>7(2Fu!BHE8?-_TI&tV8$akQSrv`gy7gZZqDus z4H}cEg?YuMAYc)9&cPCBY5~Ji^lmCMjmX>e{aLr_V&CDwB_Z^yX|Pi}I47^wH*M8g3uU$co3OsP9&l({3ap4j3q2O%i#u{QIn1!YH(_mlVh9o%TsdI zdkTjlRu&!%UFZX)Q!Gd4#hOFfs~x~9PxCn4K>of6gZ!D`vfC+7Xb_jSEh@}@V&TCq zD{?IL%G2|nc3{7lY^y%cOp^A{PbPc{uZF%6qCim6*l2cheWv~Zm0dj&3idSI6$XgP z!g6|bn4QLZQ&^KtoD5YqY{a~Ap|hx6dM)eCx51*X8gT4JFEIP8ljU0;!*2FUi;w zDy~TF<@o8QZEIL-me7uN_AAOD*fybt~gwU^ZB1SGI!sj|=^t&lEt39Zzr>SOE--oXLGkk_<#tVM9DF+5V>U&g36V5c2 zN=+?0VjJSVu|HKM2>ZQ$i)K*#ns7b#!wR`dn?UR*O*HlyQ_!cQ+-i{an8x<+3bEQU7;W1~ zR8**P`N(E~Vo%Sc>2wZ06#Yr|z-}ocN1)lk&xm`0Q3h2nuIOu|;XL{YNrQQ9DJCz1 zA>)JAEYY8!lDphps`afNe+lBzsdE_yoI;{Yd8H}q1K;9)8a8+2fsVTWT#l;YkDc;Z zjvY(({zz@@18}(&JJEFO^`$@+4coDj;tveV@$C8yV}^_cU`ZGV(Lp2fusu?SA8y=o zBH^u#RA)elSqf8m#31NJ^2io!)}=GBuH1L)t($+~V$gPmlPFRyn4MD)Jv-o;-$`D7 zAaJu&v1Hh-R4Wunw2ZW)0VTV*(+s39wbyCR-&O|kSX|d z5IU=1WuGJdS24S?07fymg?(QL@%7Nn6=?f&E4`gz8LN8gwhE>^JJD}d!1QwOC`Ze7ZDUrvib&k6V2Cz;asmSe|D%z_yJ|2j zCqZmAZfaO_n_2fI6_W73Q`m>px+RUDAO-%NEs4`i3-Q5rLs0*1*Pt8Kk~c5QmYfAc zpmqTBjD0g=+v@nOg4tWGC|JEIAOhto>}X0SK@+B1)_rW@mWh|&NEjC=c6nFZ+k1eJ z^hQB>O;p4-kdT<@qZTY~Xt9q{X(vX&ei8f|21y+F)7V>#0oDr<(@wkDr5o^*I6il( zW=6L^K-==|k3Sk23p1797-JHvAXxL#&K>ZNof9*#^Y&jQEqsQAV@yc#2Y{q?P>7gy zepBmi=m3AtlT!MdO(Q(xz1jDVA zjbJg9lS!jBmlroSP+eP~J%N0eqdW9){PsVqsgIA_xZ3k=?#zX4`C1;hBKsHp!3Ja@ z$vZ{W)%hzs=$J1UjxiEfq-N&V86Q2~Bjw=0j88EJ6uSnJsn}N|wT*V4YXGS%?{7Ki zH8-c;0L0RIRYG!lCWrHjMWqwux|G4m@eDVtSGKO|Y7-G+?57k@ny|st?^D7itavA0 zI1#Z?S)rVDE>6Od#3X#q`Ejb+5I@?Yyqjdfh^a{Un4NhMh7qpp`?!+*q!0r_@DjdOSO%$B7IhASjP>d(|o5pxIP7X6Cn1Nj8uf*;wvNw#J*hzQchOPln2@R5z{&n zJdF356Vsz9J37w%J*&%HlP>(bke8hHdBGb?tx=#Dw%SeE2OJL`;t=V9Y88<)R(=2F z5~Ty`2%oiPDOx%*`;RZ)sXahs(cmU)L00G@>|+!cs@F*CCzv#I+c?wQ9*lkR^6=%| zz}qNu1I?*oa^%R@*7eROD#7^1DzML#)kiK()*g_}ZvOb?S2~tGWe^ zjWGxmerE0aCFo6N`30jvuF!YYT5A5en&#(U&eN)B)>*8wRV2t2OJ#YYnyRQ=7z>0p zgw)?~IxJ8fu^XM7k^LG8byTRsf&k|M{X=4fR+i{da~L%p zU@KWel$p&X?CvS4DE~1g-ZVUgdPC~^;@+EnFHf+^A5Q{cweYotur6QuV^}trf)=Wx znJM#>#0^_RgFQ?=#xY$3_&Gb>?-Q|f%~;LlDoR!5f81ot?Nqr=Jrt23bINbludKh( zD4+L3j!(RZONZ1I+FRb6G052!_Y*_wbQbMP2o~ATMWl<&@yns#f0? z2d2md4PGr8yHdTo?gXr=Z(8>v-`wn(wPq7(vwgVqs!6%EwzS>0?iv5dWBnI=XYP+dRkHK3B{O zBf{euKXs)q$AizbDGakuV5lSX9uF@d2Llr=)9>Sv5k-*yo7R<9N# zj!pD~Y%eOVm9lS%1Kq$(l_<~!57yg-l(%BHh4ulY@}PNN->$gg9K8+n+TtG%aPYAt z%coK3nZ&C9I18uIuoK$(R!LMFHzk`@dCv~t78lnBA1wsqEP@|9(UpYJU!DpeJAMq_ zKb`}N?&yLESN~47aH@6-6CP`h;Uo>PhRc}5;vTUdS8uX{5~&~$2LWO>cBpi}VB3Sf zjl{(z`zxLJREx4H_MaISU~p$?%j&}x?GR7LPdy-y@TnT!rgywe`vaW57R_|S`Gk`a zgC*$eu$e!i^uW*%VFV*IFbH&3q2m!u?w9hn$wb`O*RJqy%3}vZFBYvFX>OX4xa++l z;kSZR&hN!FTiP<(*XsbC+RSI=?JMUHy9Mk}b+X&r?=r20<5{1f?>+IV_v+Jufl&LpYI- zexyR?bzGDT%Qk39Me2|83n7&yVTpVJD7vxztciQL&e`uN6G_)B(Jz7Fq$0H_->I9? zk_ZF5!XifkOJ#iEj~30Dri#3=Df{NJ>ZOKva38oEwHR3Pg44zKN9h-s^piy$owW7U z+mqOHU0jYxioGSSk2nSg4=|KpXf?L0->nVOu%glD#g&T@qfPVwkbm8+mAE?;o|ho_ zN(8i$C>4}=V-%~Pd?Fc(BY|Q9ct+;3)kifa>z?py1k$AKE;m=P3`!%23M3B9^;@)b zvY_b4E9MApb-_$DP{gtc(w5S7rfO1MhEB~Gy~8H4lhMs41rP|BuM?&njd1)PoHl-; zRv)PRRoIOIb;2jCsg2G>^Ce`2d5q;RSv(FFE{OyA1M_z^FF5+-Q=t_D~-j}Q^SIvtUH!aMLWP5IS-yi}o*j?m|F=8MaqV|$#N++%Od$1OU3#_%6DEbY9 z>eMsxp-~iwdnC|o0E&u=Y)H3T9zXGaH`q}W4bB{;hR=!!D=VkhM`3xNjE98d!5wP8 zN&~3@FPehcL)I_of^I*cb96BAkwQ4Lnzt!N$0*}R{z+i9?Of zGZ9;z>Jvy*T%v`l^;?#H5I|5)SG0eu{C{D~I_T%i!PYpS?y zzdT>>J=&BESk`PGFh$Mm?2PpIHRo1V^w9DDoib(Z)A6H!ms&wjGx_#mPiBqe^*21C z8)-KRgh%+{m^EBZ+oF4HZrNld@o=hBJ8t4i!f8Fvv)%={4AuV|j2nZZv@H1W+>;q% zQ`ymJoF+nq54+SHOMC;pD=V}r2qx;X`p`HpryEb0tP?%WJrWt4WbJx`_;U#hJT^9e z5fXWweku0b=L%Sf{Q8d9IlF4e-{Q6Rk@calUIZ^>(Os7$QGU-@*=Cw5+;D2_<>p7(rscKnoG zex<#4ZdAn^;+bx|eK(HTNrIyg+LNXe8m);bLx=0i5}dvZj$NgERjm6#ru4?E7{P*wqY zocPv&I_N!mC7RLr_-|9Q+ER2qy~~eHEQ$IhG%VPPo2V`Bx^>EJj8Zy36szSWoO8@}c+?E!tnHdCT0xuc$ zD#zp0Ts--u^O7X1ce03FZg#TdO1uXy-g>&6@rn3YzE2M1@oIp+3N+;sVMx_*G>wG( zp1hiR(FQKuNmqfNHJ7N&8bf$`ba^=5dxMq4Oa_|)GhjH&&Z#&2;6ffubMpNcWI;qI zcfnjVlK~O>$77~I(Ip_Ny5q!;AhpVo1IM@97XNLh@5|{O&c|&L-z73K>b8?|&M02i zh>0o%8!^07ii>o39Df_$e7pc~huIeL(ZK34X>_JutdcH2{e_Gva z#w4;SI_V@8P-8YcCYn$txW+5EKb%fOTAt0T-wiRD1nic=&Wvr420CJUk1UI$s{^G-f=^jp zEuA4{k3QzqZl+sSzm(=zLx{!%TdTTZitxaCU|g@L&@hW?=wgqJlg2?c<)vuPujYt7 z*ld%jS!TG7j8J&*CkMKEw5Zb3QgLv)-@9_So$ujF1fIzew?JU*Cp}G|VlP6x);7yv z-mkS56|v`#=HD?`c>lhdGbnP!$1$QywB$NvsL*ZkkSwu0n{_cvg?vaZ2E}9GF5xEl zrRFYT(PUGZs$y?KdT=SJev3~Azb;TQ9{B7Q%!dcmBWpIJ=^Dn2gNj^Z0m4!;nPP^| zMCA&*Hi`v$dn&mxzma(_O3}k-#g!<#=BLqY`Dw8gC~W_5|%PfAKlM`-1ZmD*|} zR57ci>NwQKHpE&V%$N6uTr98dj2$#eNS1yqmYQ#eGoiX`A<=1^Q1=bL<~Rw}=_?KL zWoFoMVv2^;6J!JRVt|Uu}B0qFJ)yfxxP}(4MM( zv5QN`6K~DjLaAT0FUQRH&hq=K9{I1Wh~v zId!KDZxT>Qy4iTu;`@;gO zHG}4R9Ej#rcUN@k0EK_X4; z@w~Z(LVsZ$2L=#yy;@7ok{k^VW8Xyt?d!uPVwSE%grgv)N5B2p)}apwu49&_sOGCK ztg?x|Vep?Z0>{1Lp5g_Qrq^_yIz!;^=uyI=Y_sidu%x_S=XJse}c z&C1+**+Hw$>|5RHfP7c7edmM)YqwEF6OtmiILBSL+e-b@!iI=e`I2n2TdGj~5LrbR z>!8^*p@6GOivv9N2euvCMgC@2MI$)eVTDoq5yda$$jK8*=&T??iB5HXb0bZQwQ)rQ2WBaar71pPL5 z{SNLAk0Z?p7Ny_E3|OpqL8w!4k}7frq(7YC!qMzzYr&Fl&%WET#3?>36G zRdi2E`_2qjI%|u4{qayHh@~GDmJ4JS1aX*M<&1;_K!845^bC3WCjIiguhe$VncNq= zgHd_R+Fy^FbWbegx;?J9aiTmHN)?ZTkAAvNa*U;egGWA3a64XZ@%(rw)dx_hAUgtc z``(pYOq8;a`d#8byfdigd!j-Uo3?=t4rj-TVHYPZEE;o-<=|Npl<2_(sh{6F+Ka@1 zKI~WZxzkY2EG>y*#zr0PJUL6a{}8|_z^yQrk&*q8O8N@a*B~QUGM(N+R4&`ip}Uc7 zlfi>R^ALXcg)e16Ah5F#LU8GC!Yaj0)fUEKc*~(O<>pzUPG8sax^32J1uaUy|?u zt^!D(-cmN%W(X#lHd32`uleM$cfwS{B5ocgD(uenO>+PzeBSg`j>txEtiJR9fhn?C z5#;=a7vQoce2u>$(Rz#&b-@D`v&*PVC8Gj{WB>bMzl>y*XbV0%rOZ}d#7}lwtkyva zTo=BPpuJxV(e`f#smSQDq+62C+p^e^LmjcK-Tk@<-)^p;fz4bL1-(kAZ$Rpnr^^jE zbM;hM;^VcYh~@;@uo!72V^$$}p8&sgT*l>+y4`_Hgd3JK?!Lj4=w|+0T$}62C@8|5 z8C(B zbKZ*L8+e=ojz|eBz%u;H)5x)QD(#HKC8sm}4os0gWEKO5MhL){Lc8-&q&b4S#tF5o zG=UmFgBUbhm5m7SWHRDM+yQ#x5nEOYLO_GCD%6XNsi-K&3m^oDSgKeb#m4HK$G}k) z@e+_M(`JD@=3iwM6&5)NxL~A#IiFdKy9DuM#n}mn>$bM&vXf0Qnb=jGla)CEm5~HC z`s7hr2>bEz$;0WTCosqJi}Aks3o9W-?{>OB<8fsidiwF2J(a>_a6v?mtyTF?w(D+r zo7Gf8Q=GG6z9{k!gflihR-^(^R3&EhrzbaZk0fHdJB1KvP`V?mMR(;9=6vmleSf(Q z`XYs?Bew3mh|FOgu-oJfglQJ{2|H;J@UzU==%5=RIVpU zFebQ5Qu>$8MI~=IlXn=3vPx|h1a{AJii;S3|5 zOw^8ux~hdV%Ym~u|GDP<+tm`kSn!;ENM>qGYNqEU^e83i)baXKjWOu424TItR>bnJ za30F$< zS1}vEPx#@cMn|mo-Td5poX#2A6{g!^~LhMbLa1QDx`}}*$y`z zDwFYWkV0~LpqMS{NdN~_?^R`?kK7bW^4s@4hSC#VHE$|PDk?54g6T_t_#s6$BHVnZ z?@zPQEK=1+1TWxpA&HTM(TQOmxjO-zR(Wsc+f(Y`zJAKXgknuenafKgbHm$z9AsS|2kl9`17+LU5U|%H80uAznf=%An?OHL^Xg_~3db+&u zeoCpVbUv3BL5X*y!^Ere5|11o?^OWTdcdDO)2uzT`^ybyw|EM9%tIsAJ)=~v$DmH{w7vpsmB2hAS@p2w$Z0^)|#IAESQ z;MW4bf&$q`^7tk~apY@!MHJR0r1#AggCX-0!B$J|Hl5-)SRQvx%F z7gRok3%A5iyunlzH-~R#U)>kIheu^hbtot&GI)4<5I0L2F1(vB?4U}7&t^6S2n~1c zYPaOj1GXfN;`W`sPS$?YBOO|I8>srx<=Y9WXrBveF;ZY!?M)T54ax4c|8iNX6& z2r?ZS%w)LdW91~W zqoX=833WXIQS3q+Xq4@eF8+K%;(^Ee_=f{L5xpEZhRR!@ z#vLhs^NT9SU<;Cd{$CAe*%j6Mw&9_M8oGv-6ozm>x>JyrZiYs>Q>0621f&}gq!gqi zhLVu(?(UEh_&uBdTF(cVH+#*#_kEq$c^p0^SRF$*Cn`!T!kI{fT_pah#vH?jzl&>N ze8-JK_eB|dpc_{gZ-=N>$AsLXI=V-Nvijv^RlmoI+y8)xn@m&FdV9(8zLowfRiYhL zm2Ep0d2_4hR?h@XWpnnS;tTV|F&s-po85QSMxs2>Me(|~GAglWPa%+|Ne&;I^3fr= zotN=P0DQ@hB`59nAGld&FeU-U>&xtQzo34%GuE1=ttX=q(&8Y;1kAP z?Yvx<{PndLGWY85zPLu{K0!Q9?QeamADU2zz%NbS1@oA7{g8K{y}h7TpVbc60u;r- zJjO6ts&PCRE%6E-80g(pCrUZ5u<>$EPGG?5jT@`OxOofMKHpzHu60dWW%tT_>bemb zC0Q6nYy3&_7GTHDQ36`LTE1C*4`V=xEz#48-|^*McLd7MiE?3>DwiB{U>`Dj5<_%N zr{74ei`tZBEhOg}HHhf$jcsV>TJ#jcvpFya{6+K)?^bQqN5Lm#b|MaGgUKU#m8{Fn z);V8%&)9T+I&#Cif2>L+vBIIh#`)2IiwOrzlgEtg!_e!Fy%H;Ph@E0%L(ksDdzMdL zFV&c*>gLQ4KhZdjzH?*6??rT;p_{ac8G?jHdWuq16pf9I4H(R|YAt+t`Pg(@eSknI zJN@gP_E{hT4$PsB1m0vF&E-1c#pN{^Rr1oZqglOGv$KauI>XGgqoBb>fA)V3AeD+u z!7!xn6MSTy^;+A1URw1q=@afqWbN9Acl3MZeb*A1SYuiMb;x(Sz>8AP?X1G0n?E%ZU`;6PdqWAp>Ho;01&6Y7uyeoUo>eW z&mNfTr2I0!dyxXLUav0nUZs3EdLr(9z_qj4j#-dSh1|)}{8W?`8lRDr(_rEQc!ES^-5lbnODnVu~eNtosha^_o=u4hOQVtnVyO-8ls%=DSya)(^tw; zuFOFAZ7L2A6hfSX5fFTVY(n4_VDurmzG%bQ9XCDg=lLdp?$S4D?(M$_mlGYO7yRLb z-u;^SBbp^QgjHKlNUtk()fYOt>0OwA%DT6ec4OOnzoU7+cz zE|C;^-W(nknMSgL0lXL0G_xj3KW21>{SabSb7&=fZv<|gyUDbN}3J{%E^XoWCm+2U6z28W4rs-V<#C$n`{$- z&S!cQz35o9Fr=HftF))x?uV>}2A7WyrwmIiA-qtSMks@&`xX+0Ak}TDSpN+QLyFJx zuHnWZ5gN~Er7xbtMI_-&^7a5D>L--+>Wb>VuJUzCo?LGzFw(RJ1+4=~PqMiS2QxGl zl8j~hsq9S`W%}K!SJEQ@bu(+@&RfZJz6?WKi6vzqU+2|&fvHW!OAY~d1tLRB%j6ot z*io_5omQum@nhy&0|AYPC`CO4C;;CX^1N2ew7b6GW+p_sIgUh;N^KV%>ZhD`se?VH zRHmIfiQV_Vu?IyKr%0l^{$rmzeDptOrlFY9My|#av*g-NAz`n5Y{dwLL2QX8{pbNk z<&Jz)A9$6}N8=`m+#KXJk3- za@RYAreONB-Op_<}bg8f*M%jNoxoIt28F6^P&?v72@Y6BF4P?`=jIx$c>=ku;t!|~l?sjHut+OvsVF7u# zC2p_Z0qh_~jfz=Nb#|75Bm$dIRP}#NoycivMg3F`!H>Oy)8B5PLFl!b&?)vnaT~}v ze%EMkFz#DA`~;{Q_x6#IWtRJvOo?>s?;nUcqG;`&J6w>_A5}hYtI4tlXpw-4YKMRf z+PMBsFm3p7a1xi<-Z%rTZsmFJkabBK$M)9XEf@ng^5J;nN6`3E3pE~)Mh%u~;z@nF zUnBNsG3j7q2~Sdrj$6ffBD&`@v&{PS3cK$@hKJKqMZC_(fM?2Xd%TD$nMc33=ckB8 zRHG41%%E3|FMqSDdOehNg5VU8$MP_4MHnmepE2sGiiD}7E%DecggXbH{h9Ef)ot*X zK~1q#t)RZVJ25k9a3-9Lp4qr%+mQ|vdrN}{Ka^_@S!=K!BsO9yqNuY#ic+G6!6I+_ zFdp$UmAJu1uVoD}OBZK<%@JARp`QZ$HTf^qd*3(P8*u}~6-epf{$&4*S9dhF z$flD`hpWn`Kal`QvD8}}H@i|XWARS3Ep2(Q6XECjtn7=U17X9zXeW(lv3#$qA~(8y z!p?kt1_~Y?DLnZbICc)$KZ8nrGctt7(hC;9PWF6Wx7LMXO%oXq^fJAuE(D4*q93;} zVm6bEa|KTxf$gVWH#+wj@D=5Q?D^nTZ~MZny~YYhWP###!OPyKTY7b+K98ca>@}j( z;RBFLSQqS=nhw^Y34i3P(c+^JYVTo|Q_yM;KRl;7mcMAMki|6fe76*ouby|Ik)~Gq zLNPX-l-SUtnT;fcRzHF0P?d_NuCpI5RaalIreu6F(IgGxWAG&pA#Y=FTU#T)$&p4- z*0^ii?S8Tr_FyeH`bW-b#~Cac-uKx9ZA8z_Rl6)NZx4uoTx7qo?akhtq45X~!Odjf z;sd*qz+fMh%_=LJyLH+Ew?T`ZX&kN&!iGVeQ;hdPiG6&ha%mX9mw>uF%0fTFS`_u@ zfdpC|{ZHb%Y}w16qq+uJeM(8rk@Od=cT*L6zAwJ0d{~yUl}jR8z10jUl8}FuX~~jR z-W0L8)O4XE_L7)5K|S|gzW1UEhwEwNlChojxTL}Vf%~+)(Wl7$A^b_|qm%NpU&a?a zHo@2#D5bzX#+$wMd0nvmPQBGP-)S|lNowr1tMQjmO0Cm@3mr60Ppivayjjy%N$Hex zvS*uK(~7hQuRTI4%WPpDxp+HXF7|e)U5mm0h#4=Cn7%cwu_*kcpr1@=Z^wV~JN$g0 zZlA!SX@A_wQ=Uj8Jw8ZuIG8yJUAT+mYXjMPzTm|XvsIM@F5a>37UsUS@O&R$27k2A z;h$<|5%hUeRtOn1zUTG{Hvg{bVE7aUIJw=S1NJ|y?{8?*Sd`mRUjJn37OVjPRacX! zWe@M=+Q-z-kK?bsVF&g8XhD#br`b18jljfmQl+y~_Cn`$U5ABrgM_GR4>Vk!Y`S z1{$iA$mnUaL|<9i*@?r7i}$V1Z8Y<}st9kxxkG<^%w*~AhSF0CpK~gOJ2&D}rx~iF zll?46-#euBKcXr*r^LxYvu(S67jRv*bw$qQJPwOO-w6ST=8II!Lkw;d>OqqM|53Tp z^9LB(w(0kEV+ACM0nWWRFS8X(m58$|q~u#v@YErcGUJmEmPzh&^(V(k=_aRg505VS z$q>d+nH9&uV6ZP^MVNI@0($O`tDU$wf&z$QV4H03s8Mx^^6!#DzUe%iPxavrE(0IJ z`GS$F7bXsdQ`unr%T7PB*Q_F(qxy3LVQ0SN5#4)Bq=vz~9ey~%t5BlwYt@P6=LyJF zUxy&~G)Je!8`flM0bFbrVUyC2su(T7Ox&L{X!G3)RZEoq$^)}v%^GFshBOJh9Yok} zr1UDnVzw#MpM80H+Uf0Lo2hvD?*r~OY6v(TWs8g$e<(A_Jg`UjBxXA!E}Iqe-}QHgzwj<7-n4# zUi2qF2$S~v&x^|~J`2O%M{3!b5`lk##o~t*hNe7f8a%@eJKGJzH}|*&#QzaOBE=S_ zzz4x*$O~BNz8{qcrk5^uEgEMf&pnHLwA)~~E9oBKi^=Mr?D}v;RNK-`Lh_uh_zyE| zMJDM2^DF15%DqEk56cCh2jd|T7Z)FM_#NLWet7hNlg8mw?%)1CU_LYBhzyq6XHr)d zlXzqM))E4)cAk3^L#P^BKbxk8ifa!8&q66NjMCVMKDd$XS%)Uw`35c`1u+&6v5lrh@)@=YCZ3Wq=%n-9xrg)Y&peL{H1DxGch9Y-62R zCs*pP6Yf&W{Z$rbEPS-UTG@W3#8A%Z>X8okMeI?salQXrsFBY&KZ}7pTfD*1@j`=8 z=s_(I;QY#0^6I-aSiR#|&cJ?;(x4H*{j|0LvxkIO7Nomtd0QxT|AoZ;D+p zki02;XMRZFALYM0_uu`6n3%d0_fDyJj%fP#3hjRNH`i%O6A&;{Dwn0pmWqv0tp&VU z&@Z29qJHc4!fXyOT&azZGn-80=RZT+e}lrZmk`kGEiPMtI@j8NGF741G?p|&P_d$i zz9c^U!bmqg!l53CP^6IbRBCW8H@apJOUb;SKO)}8l z>}IJ7Y=Pd*l_dkg3b+~RmXAGar1;dN$xo>NYuaS}4d-=K#d!buR&(ovnktzc(7z>l z({n&s`@`~gTTsF25TYhm2^J{?;#5#0{N{URr4a?j6G^CLpAQ@x%T5-{dox@3O48G# zf~$=ln00S%&TvO>E_!#0nKvd49WrbN1ri|Vf4&(gSf`ujbQ07zSi}9D=hh>YaeTon zQs$p5zY-U69H+CIhbZ6PO$pIcg?Q`N4^UgCKia6cl5_VU$!ui0?ZhnL(9A;lS&R50 zDPbtVMoYwj-lfblmRkS$`aIq%AJUVY-(E3=J*XqQ{(i@}D0tn1z~OL~T2g~L-juJAM2sX}#|@Ff2{}J}URG&d87oiyXLc+4Ic257`&Aeee0_M!k14AO+A4@Xz9L|UmXXQ%=~n6_Cy!GJgAm@Q%T#4hiov5m~~+2raikxBH*SN=+MHB zzwwczE4Ixt*h@|4D>xqam5)*s>4sffD;l9leYd>4zerPvU0*ATrV*X4b zzq_kl*C zpN_$?bAD2@yLdlyd3@6^wY8y=ScXY_qPgM;@BeH24g!J0q*3K|-2?{%hB5;eGWnXK zQD?g9th;XzfYqU+codli#w)w=q9V?}F4{V$ZW@Age@+7Z!GpxJ_qH@R=;d|K&fcvD z0rr)#twfl`%Z>;HwFV2H>rDUN%v8^Zh%p?jFEN<0{fwOO(ZwevC2+W2vk#c3b8$T% z6)lsy;lw*>2EIxE%aP13PIpFjPL7tBejA%f8vAotj(PhL?N#*6XhU11YFoY>A0NC) za>egdIQtH+&UxBN3p9(Z)&SbaKUK5y$8L@jy+?&jejL27zOpUlLC&OB+9==x=!bah zlFBo{TP7~yR#>9+4hV|`eswlZVmO4U=U2NM`mo002t}0{{R3vEzlT0000&P)t-s)z$y@ z_y5}4|L^br-{Ak}=l|;J|LW`i>+ApD-~adb|N8s?^Yj1L*Z=?j|K{ia+uQ%+uwqrYphk-IJl==C}1(rN7YRfzc z9@9gfaU36v*W)#^DOMS9!>|r)Yg!XO&*yVxODR3mE!}P(>_0y6Fn*MPjvbza^^N)8 zm2L3?5>wv6ymFo?Gr;?=naLK`^CFm)a>o3ao%B&z2kk+mVI z=~bk!Yy(Ii*j8QBm3V$Yx-$Nh7-uN!x1T1xV~5)bJ2+X@g?RvLItKP}Z29mtJvg6r zc8^G(MtR1^3#?a>&YX(}@!(wNcTDdo-IVuWou3~jpi{ofAf4Vh-f1)J6l;3y-X+>& zO*hQN?j6vnT}}3JIs{bke8bJIhaP;6!H_-DBL9VYQj_)Si^A9?X=hEDnj>my^FjDcl!J6-n=qSe#1kp?G9yKBQ;IKcIwG& zLpCl}IGoez@ZCFMk5m?0EHh)IGtcZndYsc8tJ=VJ?%tESbmrcTc^uhVWaK(DEn~TN z>`$%cLL0-+>7IKRPfWdI4&nuK1o~Lz-UD7`Q*+`|bFq-7vJBSVE4t1E>>vMXU zd$;pX&J?_BjcqPSe@Jqs&b>d%L@Zb@&*@A!B3+5+qdL$c_ujF)C-EEGztqzg9$y)Q z@#`%QJI`}O`U7cLvDfSOZ%fRqFQ;mhGLK~x8)2+&;$vAaDn~hx0y+@Q=&T0Fuo=zFLcj3Iwy@U6tr;omS zH^zTQ#YG0ns)|&v>HH|;pT+$C*^2ZY>d3u+Urz_`$a+MqOMolmSkx!S=uH$4#qToI zZFoIBz0w-%xkdUKt9ldCJL$x>>0qvXj;ErYPDKv0p51wPE&UAi$2@VQv+1(VDEJgh_muICNT=^eY5*|2xl^fGDwaf9u7BhAf_OzpIwkHU6xQx;4b>FkYk zpWq)#IubK5!C*%=g|6yePe)lbCEv-V6v>$hn3n~q*a?=!X7&6#=hMh?vIoCOa!EQ> zsXxSLHuk!5Ws*Wm-r1dRDonb__}NfwfoUz;|HlFJUrR21lKF24(gRsdlLXPXRbruR zbzrNt$qOJc^){2i)1|)VQy(Li3NChh^+v~wkn(c z490<|wpp72$QF{px-F0mE9;$f&^}{!&t_g@iy3~wypCV;+iGkXvphSitqJR>vF&-= zNIZi`9I9+$%(ec)?9R_FZ+R*C^j9(7t8Bgd9e>UCH}1QdgESH{k*tXtCA2K(K5iCo zJ2@9SsAE`iMpLl-0I_vXD}am~60yj=CvA+x)*b$*3FzlF6kSZwga=uK-|MfpicqqsqOn>Y~`9r}U6DnY1aj%Ds2^9u&LMZI8~#sHYpg>wB-YY$&fH$ko*f z7l>QfqMjaFHeo-Zz9wi`W$S(KLOdR1<1T&gVE)?ozU2I;ZrI1?zoiGiyr9oG%Z`% z_uhu|9_m_U({su9^>pwaeeXr*@q!U~SYaHI{^A!~5Dv%oO+Ed_Kca`CS)_N;BiH2X zxq;|F{@pmwSsgLMk$ZQ+LovOBbc=LN#eT0(PqjWB%~Br;;`CN)dSB5=O%u%bO9RPDn``M z4+M1yA=$NT#D>dR#NamxlHFdJr^0dUz4BHmy5#18|09BXXmiI zJHL5Y-@9+-kdBk|y9=AdT9Dooa_Z0sb_eS~+4EkX(}7=}d(ZXdfzkJV*}V_LONQp+ z;vPAOTR^(&Ta5Kqr1!peyIpGAk(`U%yYc>ZPQUcM&&!-^S(6JGg?Fe{9jlMHbB6PA zNW&^_xM-+#m96LAH$SJN``L5vzQZZb={Y!$zIXNtP|jw3?>x%F>gvgN$9a!jI`5ph z-PpI&vUTh*a+M2dj8_VmO3x-+V)|3x`;3HKTr}iWHc7!&wDSXfI;^gzL%b-Qt3q9( zy~~=Ku#S6EILg^!O~7JL!o{s293F z89FLA)n_XKW2c4aC=lyGs5;TwIr6At+z$NN)QZ`2ssNk;|2?|Wyewaxnk z@>VBILEwnanR+AV-LR#k$@S@V>r6_eKK)&(+-f7&r}nt-olMKNZR+=Yh@lUfwE3CD zglLWQNeNdq+dP%Y88#$mt_pSGJ$Vmwtmy)~lzOBQD} zHoHrXGG$cR7HHUxgV-bYv~O(4!i(MQzyH*-ZKUZd&%3kR?X=4t?}q5P_o=A4RJr## zmmnV5RZXt3rXxV1WV4egyqw&2%sEUIE#?8Zp3 zgRaeCqUnv1z3&}2ncH6Vl6yBq|54TVe$}##)*1OaFAr1<=FkM| zVP4%XWy)2wMYfLg-uKR2yKR@;JEC2;MZ)=|?>)b(R!2d6mW@3KAIeCNdODC);)214 z^>)dbo}3ZT?s-_+-*WFUzf%^YYJQ*JwQS=g4tNOTnuzsK|BXfp<9&#FI!J$7)68f3 zOl{Zn{^cIKN3K-2sFhJp#y3V@sNnpfWg9Khc|@RxmBf0xyUy>vrjO^1k@7^KU(^oQdOEI>`{Ym;-#*fNc@>gn4Bx$1 zTDE+6v{(1Nm)~V$s>SmgyZ6wi1FMay%4SV+$i7RYGwZkX*)r1meedX#vm4W@-8+UM z`*6(FciFD@y}vZl^8zj=uu6H(V6yTDB6dx`&pHFs}j8FNPFle3$J` zAYY>cG;jY`?!C*JE?TyC-b2eq^4r_?1yp^P4O+J2)Uxe}alqEP9c9(HF_K4U*-W|G zl=)8jTz!{~ZDQxuHmj{wTDHZ%x@p|!_%0i?Y+GpAauMz1zx=ywh;Wkl51O~XCDMD9 ztqa-MVct?nTP$ysk$aEtvgv*Agkp7Q+2XrwQE`Em4Ig*79@)xza&N|I>HbMr9pUHjDJ}B5QiZ1^?=kXXGGQg=-b*J@p=a z@7urT-s5XcYLGOk1L@V59papR`C1cOfLV_!TiFBs@l4G!a$UIld$vx%bG) zp|o1w4Lf6a>-)($JKQ2?qlA9O<0WoQY8a@jYRRRLr#FlA9_?uG)C7cQqUzlHA%@gD zKa869#Xr$yV8Y#8G&3(bN)=$F(r9-mA9mps?|=o7&I>Ik$D2^0CP>sxCi?} zgk!N_uGjR?ve~!UOup!>uW&AK84&4D9;=e>gxB3t{{RkN3{I<*9Wnp_002ovPDHLk FV1kZVGdKVM literal 0 HcmV?d00001 diff --git a/examples/dialogs/classwizard/images/logo1.png b/examples/dialogs/classwizard/images/logo1.png new file mode 100644 index 0000000000000000000000000000000000000000..f9b594aafcd6f944f6d950aeaab01017ddaef68a GIT binary patch literal 1619 zcmZ8h3s6#N7`>pZfT2z*q_$bEuguKR)L46{qhYg#$l6w>j^>Dtj{+Z)t&hMoH>Idd zS1lizrQ#zX7A(`KC|k{4r`7PCwyh#*Vw$9g?w@yT+WqHpIN$ltcfOxH_i~;>CgHHA zSO|h}2YkJ$;M?Q#2dxFLRLq)$AmlrWU!V^t!CF~eXI2Sq6#-{J5UeDwDZrHs#P#a| zIR!x}YmKMZ3_q_CU`SotUCmxegCKC-B$40}B!d#p2MSEm*V+|5J+Q5K*DhFu%P$=G zzx2ZG8UGyzN>~9lF`fR|k3_->j8EBYH~~gjgr~sD{p4gI)&v9qoEjX2r+nQ4n*sI; z1n@3EUU-R5bJ}2qkc2TJ94D{=uuvHIPdsz z0gWb%iMf}Q1a5dsYHDjnhJ?jx<8b~cEBmv&ysNUZo6GH~tCR6~y?lP3P?&|m47aw9 zN~PmnT@&5i;8B?x7pM-pp*{#&0*7Z?Uwpv9a4`zujSn zldCJyefJ&@Pj4UJAN&rI{V9Qghk}AbLc+o$BBP?BW8>oD>5Rmbv9h8Z7oDA5FS}*EeFKAoL&GDZ zZ~qw^mrqP6rj^Q>+1Zct^D33<)8e8UtfeK52Hfci{z@)*al;RIdj_V24#^JD4FinY zM*pJP_Iu5|2^~CUYcM!8G=%lZ6*i^Pw}x6$D&&1tc1_LA&F{X;-*f7H#~7_BpK$x3 zY-Q|P`t$3>*+$ewDluenfoUr(@U(VyG^jP{OJTN=ji$Km$b_4dVOE8_O_65KbmpQf zrguM79ZG1ekVl&oQqtSsMXx>F6%?Gn9d<=OSWw5YM>x2WsinN2sv)g$I zx06$u?qsOETM=!iFVC`g5d15OUBFDT<&iNysl~frNoI7W1DNeGXfEcuOe&WULcVHb4dX)_%1@N zT>8BPS!iMGE-OVDc`6>@A^Qp!>dD&({UYB8!A~rmsv$B#9gkK*XZjn>9dL?vL!}+{ zbPV~-20gOEL(+$K6nT`NnA%>io%RlO(rRSh@9&cG;i=ipl&eH^Bu8zgvR+KEvEX1g zum#f$+y(Up^@pk0QDG0VQdd+e zT-Pb)Yn$DX#g-OD?p3L^HL|W|hFZw7G52rpxsLyN_w0F|-}8Ikot^i+NFkHVuy$Ao zg3R`Wg;2qF;L-xO0_^`YaMdzSy?zbH1lza6ZLnPK z1O&9fCP1*bJc7+-2ap#u8o)**63)Pj(!xSuf-r2ZT!;NvIXS?578wcTj7$b6;Sr4R zjQ}b*9DuM1R=@@L%EFg)IxO1=1bC#KnUUn@!wqdtPJpyJH~^fMNC39j*@4)~5|}@a ziCLQ3+jFqkCL<$Y0trqN5($uHKtTEu6PJDl0t<$Pr_IrE{Lv$@*c%-!y>tm~00?|gDDd*?3JX)Vw0u*kv}(0(YHCrh2lwp`4+p=Q zWo*oMap4mPY!pi1?Je~2>Gb#S+__T}62e}!s>Rm!X+*>`Dz#_-{@w!zdJi7#OGx

CtmcOF9N`t?Ah?5<1wUiAG4q`(KxUHvXo8p`(l}bsqTPvT>AOF61$MH|SisYNc z_u2=SW~rBVyt$K;VLQ#a`E-FthJS#V04qMCz(CS%s(gMol9BklkB}| z46QHb?QZCP9KNGcnPOW?$?f@+f^6g&#g*rxSyzzBp_uIn3gk(Y<=if#qaFxn(pDnN zZQE6|ZADeNURLVn$`m&X<$1@4F*i_!C5)T^Q{|SttYlpL@4~?`tWdmZ*w=JZ+G#)3 z)hmqZg)5`(y&lrh%?^D#D^t8N`PP2V`0qPN>S*IHzKgOBQa!{$?v*~&WA_jiH^UM+Kj)cL50de^473_LD{XY}FjMtd zsokh2Q^{x7nv+$5LJ8WF7g%w0a!bAO>2cIC=i%A#f6FR{CZ{)0t`pHoMLK(pi#C(s zScF|$$oWh+yR2KQo0?2JPPyK7j&nrbl{Ngwd#1@D&f;TDr%wZq-c%!q4kl4}xKO_} zyU($CvttRZEq0#HW5Um)QVJ>JuMko3E-9l}>Oi#0T1=Y%wai>x*!$(B?n(J@edgoj q2vtlUiJe?Fowk=wt3}psaMs{4ZA7Aqosa`w7ido?IixW-{@j1hPFq_5 literal 0 HcmV?d00001 diff --git a/examples/dialogs/classwizard/images/logo3.png b/examples/dialogs/classwizard/images/logo3.png new file mode 100644 index 0000000000000000000000000000000000000000..9fd3ea23589d5cd1e36995fb7930fbb65537e2c9 GIT binary patch literal 1619 zcmZ8g3s6#N7`>n*VyKe}scn|4VrJ%OYOFof!LV6FWNj-`M{*>`M}d#2rYvl0-PEGi zbjwOz*C`)mLaw%JJ}S#rbH-_HO%w%u@lr7q5(M^_J2_2v{(Cs*eCPZA|1$Spp;E|L zj1vZeAng7K5)J%@tlVfbfcIMR6cB`zQzK)-fi!|;x;jkctqI28Ip#SRVzjmDtU8JCyEIGh-dXUt|M zg4ew{n@0HoLLkh{%~5EyB?e<Z9d!m z0t1P`yLN|!lENdtk32w$qQ=A=jE#$rPoyU$A3vUwmY$x$WM!Q`cb=X1)1`vKqN1xe zic3mLN^jl1d#}9u{(}cKHMMmQA3bV(@}#My^;uh6=ku=DJ-u)H`ug7u41O3I9vKmg z3Plr>Q_~WuR5qtn&Z|_5YPCkA`J~nAz_q-r*BcCmO0Ka0e7N-eq|lht34+0cOuK0N zZqdIqPkz|EIAP?dr|pP9Ai#tdG(A1b+>+o%t&|K^dp&J!ZIyppy!+H_?-b)!G5&tX zpmFL>?wh-}FWb|!G-AAViS5}{66z7?Yg_9$bei2wv7f2yL1zA;NOUi4+?ed_&tz)@ zEkEpo9wgw~D*%V|$vsprUF1qm=k`ZpXlRkw!gR))PYj(m1;ZEL8Z1mc3 z9lL{5mFs7xd{UX>Wh1%d`Yi4@R8a{#XP1>^TV56em-uU^K#J)c+#(FL+LCrI2zC7$ zyIOy3+Pl|>KfTqZZ%<{4zh%CC&_AtX?PP966YFxw`!M9O*ct=_R7t_+}^ypOQC6_LdIG0&n}K*8%W&`Rh6zrn=^E9z?Yq1F%gg@I&i>NU|H#Jv!^8gE+y215{etw> zU|{Up+q06puZp#sN?h^do(b&`Vwve)$S9saR+NWS}r;yQ` zWRcy^;*BswjyO``#KgIaqvXrWsf)vlCpqTf^qpXZkS;sw9wot z$&{3#ZkVo_)Sg&#)x6BVp~J4J^_x|5uXvKdtJJ}_?1vd6wwueOa-FJdgSUH!s&b9Q zsmYQ(Q>vKUv68{Zk&>i(tGbo7=-T7DoWsho%(|=MlsinCT!OBZ&6PPuqFHUvyVtaZ zp`Bxlyrt2ZPi>}nqmd*epKqat6dH~xH4TR zZ5tnL+qR8k+qP}%+O}=|iklheSy53vPIhHh?Uy~~2xmlOu3nxGa*Qlb!y0B9fBfhu zbuDSit1Ll5qP09UlK?cVG)ha>0Fs~zLFutHC89d4J)i_VnV4C4;-XkBV6fgWpQ#y1 zo6M*=qbQM6nI2}~J5jUGC;^qYZ*WG|$6o_!ghhx6ErHDqM1={00w_a`6C9_7$tk=K z3@4&8T7roo5EUgT+NDidCW@3BLPDAN#h42NQ>B#X8I=lL=SfHdIAOohCDtP#H584U z2h@x?Pa>)WO))%a3!!Tb#ivn{bk=|gZ5oQ4hQWHTtY4{bkyWS?$*7_P>s3mf=Br^! zDgp`re8z_aMLd<>`z-plmLC$%~ z)O1PmO6>sK`P(C9wP)j08>03byl>#72@6V7;ez#~Nk*BJsH*i@8z!I{f)X-yqBR-) zx&>1_6H}D14n0kw^WKgEW+omfV^xxoGuOd(URs7U0YSwxu?%3ac>+0U_6^hFLg_Is zRIz5t{b)!TC3x>`6MtE#Ny%Do;lbRq3nid})sF6%gelr0sW|$KMK$w4OT&7&P?&vH zCZcf*t9VhRC_fFZ%PUOp>lta7P<#9=M2M&pQsut5PhfPeDcXCc=l|?_k`WSCi*nd4 zql2cDW^v5)DN|)C!V_j{)IBYXDv1GwG8q?2KPKqzkN?_}=k|Kv&Mor=D%cO!E91fY zj7G{Z+oOPQBCv=@F_fxMdyBQa_|JMe?oBk*Q;US?*~X(xO@Pe=YMyEUoy|ZN?3HW? zWg#XB&p=6niO5OTVR?G5G0v(8rlTk=p7qAv^JoA}!F#ZtK|+}lOkzJ1w089TrJfo4 zCIE^+lt4NcDkO!73SCJ+t-UW4DT0!gE~&5*%L%C^>AQM%Ts1MI)Hi*$DB30{WHjQ; zG82y!*e?}@3!NFHE+nOKef^W5s^Gij<{kH4_eA(uKZOqkNbBy^;17TmTCa8#GzII! zpjSa~4cJ;i(woE5D|@}aE+rnlm0+&jKN-})rarvytmTnG31S*g57q-^gc&E{MBH2` zQV#S9tH3N2CA%dhX;Pnd&a1!BTSp8Y3-@;s&Ph&YG|W67CV&Z|dd)W!Wya?Mlp)fZ zK|}?pVr8H(OJM%3|IowuT**LhCk1-bl}n$v{fhT&-hTTz?@FLcf^lw8V(q9J(nw7a z)21dB!g@yOqdY-c?~X7r4vZ2SYML;DF-4n^A#iqbFlWGlnUwZ#vMd$k>OLO=n*qCP}c=$ukUM(@kd` zcp`pWvp8hl-|CTGSBu(1XuwlpY zsH)Oe+|yhC)Hso``(v9J-`BsnVFP{KFgDcG=jZL~!z7w&*c`rIw{$n#W<*igkrZit z_N^Cw<0Rr=y~zEY8;PC_$zqtv>mc@pwEM<%5)vPD|)Kc1&(xuP~wa zYDXFB((}rr$4#0{bn5zFR~Eh?Bn=cLn{;FK(rIt~)+0-&FI{;W5>CUk4zkK4*&T77 zK|qIg-{dT*GfzZML{IsLAxt+9Ku!_Wzi0~EYiIobR9g;z6rl2WeecsxYJ7h#yZdR~ zRC#4QO~om!cb-W{5YGbua^{#6zmTCYF?OW9uj^8oAG5pvM z=7t#qTM^~ExKV)3F8b+?J(DpJ_Nj~l6CHwJ)0X|q(&o;>eA{Eog)#RFjI&eg0hDM7pu~E{nQmku4G1yHrPm(V zzZ}5-{UhJozK&3jX}6rzb)02Ua+LoZVVaU}`c;xE82+A^fC&p#)W!a${MNh z&16YQhZtpe(!8pQ@)5F{Y`dql2MNn*yOsh(LY%zw`w`X?lYo;f(xw9kUUTLpL7+yd z$&>{7TrhiOA3a%h0?IgLyq$zJXMK;8Bj-yme3_zDA+4jY|KDEk9hXyhf9=;qxyPdS zNB2*nWh=<4g6HxwGU{C@&@$_Rl?H?q6eU}FsD~j!N*3zB2-~{to1cG`5c{*!f|6u? zwfvIDZ>Gj0MG-y&ucs(Y)NTvuM}kvYxhh?Ri55W zLdu!^w_2G0eeX2av?Jr}D@j?Eg!Pb75EQJpHKu1bV~4nyA@`K6B6pv$^WC)amM2nDO6gZAVvhmK!p)7X;ELl z(3x?Taa7YmM?UkJ>)u9QZ#m6?l!cTCN+Vsvu6}cHN*F)e`_Qz|@{J^*3`WU2YEjH` z-pHso_;KdhL5eVLo-U3CdAjx6k$zKnrXo9=BDsojl8cJaF*Y6P-E_$V({WXzAV%b@ zfs&snqXIH~0VX|NyQXd1wjlxWRZ`)nrUS9{!S8);+St=`z_&VDQVsQtx!?QrxENQN z)mXQ5wc!pZDmgy;WJ<)E#=c z!aNpK$5ieJWDV8}R@HWWX!1ZD%F~5;Vwos+wLEBf(69(p;q+~qQphPVIq$%RZ{G5b z?<=sD6m_Nnsr)M^tw2u#{jCw_`MXR8b`oIHHoqEG zgH&swre>eWuSroU*`vw~#v`Qzw0^rxK<^vnxglxzEFwV<@s1heh6g4EXCG2zbEI}7 zle43M$zGmNiZa2HqR`~nj!X$h&Tk@}9yM_0`DNQzT^ds)huE!R+;rpeBrgf69X0=$ z>+S3~lqq0lOA5WWy!ZMv%i;e53Env3Q~A6s<}-GN&+Sc+w`_T6Iv!=5B4MN{gGBoS zm=DD#O;XlV^fadqt}to(65}9(IJnqgJR6^<^CJ7vjFJK5WR$BVEy?9udNM)9;sYhA z5tON~+MbwtSa^Wdhk0BFe}U73x*7RfMz?92r|D%e7CLt1ZzhYQoO2Kg)7QWg$vTsD za>j{x&s=xPBrwHBc{{41=tkZa{@vCryX>oPKPX$>6VoUJmwxo*WE?@pco|NVxNm5R ze6v_6S7s7BuOL;Ke15dMK`V|`s?g2&X_|LcMZkN>l%mE&U!+J%(Gq?Mel&s-A+WVj zNGWi_GtskE+ziIP;BG8RNspESk`{%jZzgAi44eX0tIPVc)C62>@_qT{V>T6hcsiE7 zy&a_pslkb&m{yltwQy8I6(xsJ#*7*f1yENN`RrAS@{XVEnT`hrWMnegcM?@$z7bHy z85aGK<_qgl24|Ym;>{C-?9_VGSMVE`TyxFdpX>waV!nwiOmFTZJ;8TceB8{F7l#uhos)KSIp+*TTd0w%*8{9J_NeL*e8viG}Hr5+pE!86&VK!MX|oNWzUp=vj-*Lig1reaCa?8Y)GR0Tmx>q2=FaTPF> z-n9{mGI2x#w6pS}*6gh*)rnRjDcpmq$;{bclT?%oLP%C|rlN=0yV& zPt88s9f8tsMD(k(*x(!9;>ayda9w~}oaiZukEQ3Z57tY9gcg^EP=E$2GR|lslqZ#{ zt%*uXei_ymX1grCPY6l87o{J48ta6<7q_ox&*au%eFQ{<&HXgMD{mq$|QIIuN zbg9v!8m38BYnia0cNqP?-uwD4v~g+qQ0wSPR9%+Dk<_&g!-mpg70DlLn6FH#_@Jl@ zN{YDpZcKHdf)YUOkmw0DCP3|Ocw5okKT04~^P%+!ObV{v(9YR}_=&O}vz>QhmUCf* z)IM>($t0VHHZ|_J&a1cf2$^wOAjPg;l}Y1K$f@na$6+QzO?l+yb5HU_XqjNmRHrC} zc4%8|&KPP#Yg!d-oP-fL0oDwoMtFOQrn*MyR2cU++84G2^;S zOIJkqZf}R}2tZof1jV1%0pSPX;zd)eZh6&-M#h-2H!_(_(pmql(plD^KR5_2p znPCEHiNM)0UfEugeL`3YqRQfOB|xiuZ)<&P2uhs5aFLTDEnu8{>ak2fQiBqa6JpUs zAo^Mupt`n92FehvZz_2fW)~{12|iS%6xot?fCo9XfwPa7J3SN3J-<@jh`L-!fs+l! z)f-WTS8_^E;LxYh(x$mUE4y2k?I#R=ZmlQ>C6H6pnG#-@<2<|L=2^j^rTAVneSVY{ zFQ9`!#5Inz=>U`xO!7;=o9k+7&>oblI}kI%J4lE zj1W_wBXb*jdDXD^n$k(I_J#SjUT-j(%AKdEX?BDv=_3nLxy_#$FrZPX%;p{yF<-Aw zIuxoi_cX95@tXk#RMq?$N}qlbU+-+FV72vn2UDPeoX~nJqIfAaH-`H7s$7G6b1>8@ zz4&z4pHcEG;F*kws%g@xST*g4f*8VQ zsFHX2VxB56AB-2YTQ_q#eB2aLK`GNlq{cl#<>%Gwz1F)LBYZvd2?SND9_145W20s^ z5B`%T2JEOT^uXA=dcA%_kB}Jmt;61h!qKmyj^X7A_M%QoO&kh4Do>O3eP6G~093Hv zHfZ@Y37lveJ4>!w9w|(e>y@yUny{ma)(l^-hf0C(`nFmxMG?CdfzHQXgM$-yV?j~C z;#;&cJF0qA`t$XOp8(Po8hp{#h^H@yI${;jtte> zQePDT>lx|ql5wgm>rr1WoQ(2YpSt^eJ3~zdOAHZM)QlbjzUI#%&b3s z=`ew_qV--$ftt)X_DpT00yTekY@?qx8+Ca2L>>^El#VMlwZi7a+0gDzGF!5RY0_x) z6cJK_2%LrbC<_>;tK*BmktWd()awX+~YG-uwLr*UQ(r_Kt;eR{*b1&WIEOZpASlmv4XPFyqxt20Ci3tiHg-^^0F@-bw2?ssTt-LDC^ES| zY6k0#2c_*YQ2P6cj>=gKb@otrD0^xnXO&PGQMb2uzTPKtegA0H(E8LB9KNbO;)67W z#v@-sAWh&5h~C`~Rg-M4gqD>~OtByytt{(dM^ib^|EdYJzDOy0av}PSTHc$zC_o}4A*7H{@9R+)X@iA~4qS$e zW|nOfch8LH2(KCCrKYg}?Ss71G)9!=6ZLwRCILnhI0xR-?5Hja-ZxNFHtUigRgJ}>qJqbMp&h@ibfdByKpfQXop$IJeNkF|-`OKDm42xx1gQQh}FSzl^`dvgebUT$;O zK~rS&GI94us#KWI+SC!;*QkLqOrOi+V8n)bzHHllWuhyHWz?skiTn&PDZ!LlQ|Bf$ zVTzLLl*xw%kQXDMic}LO81qky^xA!7sT>N{)~q-mjWH=3C^YBsyRb^HF$t%1^yH1b zObIv%sgq8tPrkbByGkNe3F;{jQc-tW4MlwyAulyOF3QK{m zUH_&-B%Y>pi*#-x6Gbt5_!8Y0u>X4EzR5T%8VP)(Of6kP{N$p1n5Qny_wgtw+8sH&wkL7* z^JNqTMqO!kbrH@jh|P~jbDJbfd9_-PK?H??@~UJ!J#X*8{UOq0P`pl9PVp`HatgolZLJETN z0Lzghqp;6k_vFG+$&^&qJQ=>5eq4(31*xlos|UrQ790q!QLp#D-mrguJnDN&;O}h< zA!_xuUT?b~piZSfW~~wm=KBI8u1oa^2)F$t=?v3#;`36tzC6gMMo*&k^Ul{BU+??y z0n!?L45++tzi3~V2^po;l))jLxZlwSPWpK6gZCJ&#~A}Sq4g}Ere0t2;*U0%45@SV zO4UY!TtNb3E0fCwvAj)CZ0_Vrogy>$dIDk5D%Trt?_d(Mks}QVX|ZO>*O`2E8Jffk zL*yxsvR*28u2;j=>m|~|&^~N7PVwzH|H0F*um%eCdJH8beZ(&aDT}DqnT*z}61jSP zz-{=BGPpNTLe5XqWhZ6VHS^)I6|pR9wGttXt92${52MA^>#cN})Ho=sw4^s(xA=qH z(A3uJffe0ZdYq}qROxYI#P*f&om6w{^}vhNxWcq4vMVCcZ{DT)w8EPwm{Mguh?)hI zapFew&bG|Dl_H0PA|_Fa5@>Jm`8vG|#vQ)iIwnSn1B~SFH8rkLv-aTwW`ei)``URX z0jhV*^W$Q@6}@A}_mA&#eNTh={f@YP6w1UTMIXMcg7V6_ai{O7h6&P(cYVHjExOjh zlPc}2F@@F-n(CA?G4++T!sgWOLJ^dJnrcgHxvT;=l?bz0K6eL@@nXeeqrPv$A9g1o zs=VuPgWQ@2l7gZLo;xcd1W|9+@Ck^1T&~@$r_RTg@wyGU`1a?oNNi7u7toYX1k;2% zv5X490&4G|>L7@&zn$3MxIAyao*DolFFuDaxEmW6iYzXMA_Yj0RBl#)-s7NOFVXFW6qg`yUKg$X>I*2- ziR(w*z8(o3#>|W-r<4_iZ5xJj!VtI;l)U&NMS4h%3Qmdc-b+H7TAlx`v+sR;vAU3j zbYTV+%`ax)%w;Ax#eYgkq%3f%4P2LOGgI`PtAd^U{@57(zED&RKHa=EY68{g<5Yc5 z=gFw;e$WDra6UuaEVU*#5?%w&>-7R)MEO!>iU1SwpzCnaJTo52Q3$D(QHwQI7YZ2_ zrMHxn)HpEKx(#_$fW9whn2M7?l2S$A`R{5;q51qhvzf#o+wjVj|y zUzY1*CNpJviLhyiN4z&es!*AtAB2$3?FD0Rozh{i#6Wie z-iEbX4&QbLeI6-<^%3x=$dba@)1|H-{8H<(@>BPW7^tf>wUh~#30XXB@{GN&)AGty zyO^Y(SD33GTduM);j6DUjamDNszylpI^RG4f<<}NHCInY!|r-L!*r?f!WKh~)+hY= zPQG=1LRZnP5u8V+1F@viQ)I;2}YwO&7% z)0pXt4WMQd@R~=Si?5}|U%d!GMM(GDkFexFV<*it!5`)#D|A3)^8Jyb+nymxJ~iRJ z==|Qi6hQr6L_5iF!Cz5c``f`#zK{o?FDlUW6QU^n`;KXf*y$XKREYO+4u?j$x8x)N z8^`0F0i?f^3;|S@f%y#8ZtM$1i5vcwUd7PH0ca5l<~QvlA?4j2dC@7tJl@tlmG)`8 zcUMchPgZP07Zw&ew#&{sDK+Vbm%#re&OvAYkF&-Cf$1eMTtsk zDwvP!L@nutk#3lHpL~2AO_KpR9u;Er$v1_iLCtNrRl{fSfi<%_f3$fy_aBo0d~$Ly z!dcXibh}tm71G|`QUX2Z_VOT_`z4a!vtIf1;wVj;mGA|kD1dhUr4~hpR#zCPL(gtM z_2~Ilu5RHC$#xRbA}R4VFz!uhuPk>jKD#@4>Giuy@zfs1!L<)eCSSaI9|3qE0)3A4N28J$f4*&z4AiymTJY&kiS!eH2_=rS zxFZAICmRGLJk!x0#@gv(MV9|N6ogk%_fO?Z`xz+#?JWnGZ$*+x7_oLbBAg6QHhCDG z7kzDWNiuby`UBF-uY&iOR)vhsL@C#u+cXwqxqOCVj@c0o#F<_JbR!bh>*+yqcnFXNCcRj*WBM3fs9BBUF3mSvGFHPUg95*=6X zSWc6&sFR`kC!r{XdO+%~%fv7;>d)WI%+pqS6MuJ%;6Y0Q8trF6!npp~Yft(89>zm= zEp6HH)Z!?sO;U%3wCU&rklig>+o)Bev(%J2gTKT;$&V66-%Nj{VH}0@4|+|ru!UfM zW;tCGG_8@#qlE`?-q)5bK5Iw)Fo!l!d$DjZm_Ta_QFEQPV`20Ife6N()Xl7;3r{1Oye9^pa6J zpg;UacHiX4cs6CU_IH(_<4uNs7-IUfBJlK<_rQozkV_wv6~$fSwzjMZQXII0Z?bkY z&OT6T;t^D}jjkQqltN4`+9F!g8zuz}MVeZujS^#N8BeRiMCfGL?@8%zBDCi$oog!N z@-PMUxu7iF9o}5HQ?Sr_dxlXhJ&<}A>Y^vm)5lLc2s`;%pIC? z{V_%qaG+0K>r*Vket$s?3+bJwta`Jso>1D$iInwa=b;vDe(Cb{@SUEbwsBZjrK7yj ztAix+)r{1ST88uYO*`6mXKxH%P}AJr?()t2={b+QV%*CGpib=*b)ukT*G+^7L%k(+ z*U_OPm!~uO&e^XqDZ)uh>l4s3tmqx@@Sw7?b%HASOJ9bqFt2i1T-AJ&cxupd-{Iw* z4Al1M_-j&?{X=`?k{(A>JjfwPSfY9;CBG?*BJ-Hm$ZDMHs%(t80I(z1CURySd&IPzPQ? zNkDWUIEbJD5hsbDMDc5qAQ>rwA8}v?jvP4fCpc3y88{05fQTN~Ovk&>OQD;R-Mk6f_Jqg_!e)q@q$6q!QqG?A-CTPXgZ zp*ylFnT|+nqAB$(#6R|s_Hrs!h2raDk{V^n?Q{5E%qp6ire5P$Ow%kX1=>!!9l4`K z^+?J9xplfBVhR@o_KADSX8M^8OhV|l6mAUxu(F(>!j?H!2!?5rH=_<&Up|Uk2hkL= z{)8+5W=FA4^453nCk^9~K6!z;p-SdV0zw%R`9|E1iUkkN6LNC+#CCzrN2|y@IsWcp zmi&V#yo^1P!iee<(iVL$q6*rw0SU%_2^b+EAO+Q+I|^GtuT6c9%-V&aBg_0eFn9cR z{%FILnevaS)^kbSHAP&vR!JEo)sE%@!pf7c4k?KT_4BfYpeIxw2Vbe2O_|uyo|lTF zS7Iu_;EXwR>b^;osy>OYgzC(O3LG$9Dv}N!XNw_~XDOM1k#FgBeEp8e4Khy#!x}-~s6(V3lN})u*j<2`uy_9ULlr-c9 zF%zKh?usHWmNelX<*qJ(tV4V~XiLfI6-_e3A3XKo>XqorWt_!2Au1otQ;e@C0A)*8 zWHne3=^Gy!#ZRM=HC*DG@{fAP0>o4>V`rawtjHLmm$9RfDxpZC_Zk0ag0H86FzkRZ zT{6h!F-NTpl~oE!aur&ujiMuqkg`C=n~jP?5N0yeTtntpV;YkbPHcEY||CS z#{E=nQbVd!q;T?5{!!i0*gTPTI_PT;f4^EMukO&lEGR!Q(>DL8GHBgo_JWmeU zpnHj-QoRQg9`lbbf(yNlug7b~dE#BN-@3Cr_M-P_QOZA>l^An;J+Bk2!yv(dF!t7o z4}vlpI?t74{G-?L^$FX!G8PPOM-kG$O(1PaLpd39{?XGld_4;a(h(0z)g7fz>bAu8 zI`l{p%y{@$@b%?`uw%F-=OR*JGl><)^gRe>wjs!5s#l0E8Vy)KMVoUP#y+#fx%6`cc*?|7h;!vEU@z zqxD!*VkRwx>Tt_Z!+PY*IC3NY(SQJ=+ELq6goJz2xJujzRxOC;M~_0;Qog4If^q7$ zbH9iC0oa2RLCogZqcquow1Elr;_@2_m48(6 z^=k6%==-zx6PmPeM_4cB$@D0w-wb(UCQ+z~nd0mBx}A)=(*e=0Yzx2|bUo3Xy8zNj z7`#k3F}@zBMD`VGPh~5>ccMMZXPi0sgyAi@qxgAZ^Vw2AZaassGJaF-=-kW@qiZ}3 zMOaUbub1b^#LOVUSEG#Ev@VykMBIno)GA zE-YxrL`V>tu(#*4DD)IYc5?IxiLf;;U$6N3y|{Xg%2jo$YJFc3CF$s1d&LF<3XXO( z$JeV%LTGQ_?q#|}BRHn*!XKSGe>9Kq)WcUa8)9yoC%E&>hQi~lVRBr&Aw_1N?RtHy z^?o)u-Y8zaj9s2+&f*D`MR2DJpJdtO!*8`-4XJzUHRX(lKeWkG6_9WlOPb7Vxb67x z!%+ykHj#UTesol|XGtbcl*wW4bX1ETJX#;)>*I1LZ<8`;k-TRwH9Jncq(vqHI0zqp zjIU1`UzmA>-(3B?D&pjzmSRX37z;KB8Y>@uj<1)*a}k!Gc>YOM{N6g@Ez{nP@`Gx~ zwVvhi^(YesJ5ms}ASPtv`1mfZx2$hH-cyu$lKs5ZdcET7^^U?i9Vq_P2F!X#fiy5G z7?t;7Xn*+B>tlR<7%Dfpr=yp0nD9o>rl`)C16Z>u!Q1$HTk1VgV06Q|q;+@<%o7M! zpL`;TFG?@&Zea#o@qN(jjvj?VngXD(Pqa0(-OU+GQVEy^@mjzwDo$AVfA}z?K+W+NNO*>KYE6;v8VHpmBERe@_M}mccSx1 zd-T0JT4%B=%Fzp01ccatlmJ-KCuV~O(d|XW zOd?Q!3EX23=Ejb_$f`Ta;{<-0QW)unWY`(?db~Uu#}(TkbM8ox7$m$Wt1#09ol0y) z@u8IdL(#T?SUpaNq*FeZ?NSSwc$&ai_jOPamOCot8;O^2OXTeBS8GKP)!zAuaA^gF z0}f=4&>X(?7<`4TH+zcGXLTl>8>nwR=5)e7VMfc>{AQhU$DZo^dZZ*+3J`arCUqLj z-N3Hm=uN$pGwCs%Y^mT2!PonRxi2XR)`&8t6YhMxJn=#?+cM^Wcs6J%+Tz0(3QEo4 zbM(EBH^DlLu@9kawz+Wxx+uOrjO#J?htP43wSH=@s0oTXq4nzzh+xf)%MubwA*Vs} zM>hpQl-|TFqB2~fi0VOij&->d5*qj`BnRGWeEd|?FqccD#8FxJ@8e#LzFcI5U=>-Cz^`^AOb@ljDF zzoXAolHrrtPE)9ESJQ&nA!D2laV@@HzlzEw{o426`g9$zGsw)VAKf!%_cmr4;-c+# zl1!5iwhmP8$T%}R(E0d>kHX_@nq-|X|Ek=DXV?3nZ)haw_4)Ps-1{6pCy&AZ+l6d= z=mNZt7gD1_KV4Wdhh9dXD`8!qU*E^|S`b4_Ybh8jr|av-qD#J4RK!mnSS@PGF-y! zJv&OE94ixB>S2t`LeR)Q>~hA@d&XYUKkaax%bGv@;s?~aU)mQsO7_!X!$M#SP`1e6 zhj=E}UD9J%hw3(e;#0<;`=~Rdf2_>?`o|I8)FN^cB-f59iC$ za3o?ZKPEf+p!cqI$!(CA&+>*-U|LTK_ka9^I%0vxCSTdSPYoYYv z`)o7f7K`+D5%kbSp>uTu&WD*T9k$3{G`RCSYSb?ry@0QdVV}mZ-qZK$b8jv_>%Vtn zbE=UqA&Cncs*OjDA_weBnnoH{z!=eVLMQ)fyOR*g8}45)2yvVsTpAnSzi zsraP-Is4pr2}ECeu#VwmLlH5EMQ&YV0b*iF!*|IZBg^4aUmoo6tt9&QVlj6edD`tS z-#PDX3@39XaPIAQ#y^?>uXdnqCFRV1c8`tS)p>g8 zPoCMkXno4&t6k%f5&;mA`&s10zv~pr5Dk^-`SA%c-2fEEtqYzBtca9vLL4KNTg~L^ zoI4^Wv!?If$@%k-wV(kz`XcAz%~RNzDWeb$U3f>2jzfcw8jDa7-K~`dt1dtPt9M?1 zbQ(r)oR$@OWrA|@E>sTVdN?SR2*5Ve2O|L4G*YJBai}JX<-iT@j>-zGli5*BDG7Xp z?Q-|PS?rGr3hst2^$8vJlrU6x)f;>r7fKA81|s&uJIc{3ZhdUgBI_+(>e)N`QK{B1 zv3UY^w+9W5qz=)Ft}UaysKg{@;qJ@D$F1xCeN zPQ0K%np%3Qbu`yjy`D~@B?Sy9Bv^|#m{Od)b^*PSMncpHe7$UIm5&RcLwYnz;>i_I zc(qTB<#gS7GDZsDX~^pJOHvNCw?4(!v#Bw@UVsvwHvQ3je!aq1JBW2e`O_Y}96qR<*@>xHXT76XD8<(+qe=$5 zV=GZ5e$lGo;njj?%CI7bcoEqXFKa8diK;Em&^?JMb(b^7Gf`vivUw+Spmx#xdeoi` z6)?CH5hz>mG7U71XXc)_e%mP_NlF)CTCevDDV66-N6G+c+J+1eF2_^Z4jP7Py%))mO!Po3lFd`hI-nMbLKV%z|9bRQZhX8Vo!0B~{HT&pp1iE~iM$e5uh&;; zkdt=}Ce*nhlDM<02 zLRyWM&y_tzSV+-(I|@`lZzyEG9J#zsI3=S1#OyCZcK*`_CpsjQ!kreaew;BP>d|BF z6S6PIjf_skyy(L$2(j&1jEJe0bmw70pcvUonZT+%71vyw*JV*{>#h$ySx9uzW&3*{?gL_*w_Eu+y1k&{^H{Pu&(~l&i?D` z{`2$x{QLgh1_;_BEZhwew~x`_-u~)ZTHOf?-5DPI?CjnE0Pyeq;S&?Tq29Z)^y4EV zXB{A7FL)k)7*=>W`8zsth zp4u@z+EQfO8Y0_;owBL*+|%{UX^qT;t;~zGyQAaHN@?9tUbnFK-!M1LT6@i*&Egsw z&T*8^!0+U$z0WyR&p=zxy64bee&|I-=uAw|t=Q>rbiRti(N=Nl=KIomn#8N)(uu3= zc6idu_r-&>?vIi0fr0RZg!s$L(?neHlatd^ZPYbM)JtO2X@vCR>GiX-;0p`X!t3_f z-1o!7)na@3)YQnm^VOxu)+aZz1*R|NqtlGt()$OCI&ARH&Rd&W)hRBk^*;#Gytg*kV<tm+C5CStMb}&iS)+H%50O^c#_m`jl;6+?2?!4)8qEu8_%}w_ZPf24Vt#|?E5k> z$2p&VJ8F`qSrd&$vmw+oPf?i1UgieEpBx_ZuIs{F_Sb&Zd0q=um3fu+D$TE=w!Ptj zyWPeY(FES+GPivcHJVKewaG{gOu-2sM7c#*)D|j$bZ>@P*;k2o2`J$^ptgX7hu#9V zYmu5ulLcu}Hi@H*6rlDBCIDzIi#Inf;3gtvtQ8<5r2G<;0#%_DsBm>XgwyVaP%=&j z)ne?KhXpT$IGqaQnxR!y0$<@m%uFJBdMTJ)fC&7=Z}ZjlL~kz-DGIznQtuH{b5K!4 zS=WG-7+U2PXyvX-F*KrfJ2OP`&w#6lvv^Ceu(G7vX>Wgb7X3}p^r0VGg2FeXFDP!WF76Qgf1NBIRDHE*Dt-WAHfG#sT% z5sN(oj0qj>b^$ON6CoxYO}Qr{Z}@P+7oLi9s@-o6mk~V~lbAhnQp3$yQ`@nU5=Y?y z2h|mWYLeue$~{?@x<^R7DE_kC^V|s?SxPYBx2nXD7@^@RP&?B|yX2i>9R(-KXvOG3 zKLM*oikv0B76xU790mQf@Eq7$m?;?f+k$M{o7vhG(+80Bnob#0Pkg-v3t|@?Wn{wZUYW=w5m`CYh4LA#M3C9Fb# z7f4~vdA%2z!w;HMRXeLEu<#vI8!-Y$1tmIsL>k2<%94no5|(Jnk)QUBzBCuXqx5+V z4V)AC(2R*CFSdj_+75(2jmD&-5*Ty5g5lFaN#8#UC{=++&t1 zX5!B@>!^yKdO#TF5lqDD3m*e#g%y{4Av7k!>ezYfWqU@8jt(pR5D#&(BaP!xp&mlD zFkQ6gq2!p9Jifq0?^FdaD*;(%?mmD0qR`Dv;HLy76yhh`Q{eKMql{3X;w?)kt@gxF zXZr{e-kP#<`BRHNtr@7OS&TknDOeIi?IBMKT=RQy8LWU1L(xJkNoOP0moi6TQBpc; zpQoo3&e8s1D#A~%^_rmt@)Y$GZHXyITcUJ?*;y&cD~>*WmPr3_hi`Vvj>EPdFke?0 zpc!GDPzfG6e6*(~#rJ|0km3@GFhxnl=1KCk$4_&)AfLmgs(kz6=o>W}{m%gA=7mA4 zGU|HfnoYw#0wu7BHcs!@=4A~v7#&9?C;@;`vJ9_WSv^Mh5If)arMo^iHGlNfXtb)2 zEIr=>-8^h$NR0-;oWMtPG~lXBmKD? zpsWAx*5|)^)Y+H4c<s?Ske;XwyTNps2U(3+N?3^16boBGb` zSL_Lqj#lUGjK!{FyiiA@6%=$7b9!w~l-q&Bhg%m*NccxPiLad9y!k5Y-#7Nr>TjJ} z3~77q`=+t+C`Kd#6x~z6&i6lm*A+del3*B`=aAWJxf9Nd0Oz_L!+x`oKfHSJs(l2s zyz!*{mdATmu3EEh7M$vZeF55KRb|oz2<4mD>Tv~q|F$F78xE}+NTmdj=2+Fa;JJ&Q zz37)uIF9BP?THq^?ZcTI{8M>LzvI?JhU#f}_#dPZb1bN>V!1s+~_ z%2`=)^0zXI^rr*Uz>B%5ryvB^@XH-sOM4WB0KC8Vh8hM+ph2=;02+ z{y$$B^soP^{d_#fAiq3L{t*v3kF>dAW&a0(7oFNZY#>Yy@Po>;h#u}{;7KXD>p4gI z3X9{x7QiIB!U}Hog<-#8V1K{@*wU&hgqpwcgIl)mxbu+*2L1Q^4X}GqS~^+bylVFV z{5>cja0bMm$a2CcF!Kur$XC1Xm(qfwLxX^6whb=+gDkOu~(kG0V<%slfK%%S-q zRiMr~|J59kejRM?z!1FCS$h`eZ#%eo(``F;@9GqiF^fTQ@br=nzreK~RTQFUxbL?> z_VpY@5&sikQnK7x)KDh-fbrzlJOKget;aay-rdi@k?y@@VF2+LmT|d~+XdN+ex^mQ zq7qE&RCV;bsHDJ8mj3q)AfN7Tx%%h{pn)ge^SY;SIT+nG%rlD=h_^jI)_x?SZkD$Wc#8Rp4w; zE1=Pq*u_s?@V<);uI&ak!ek`{m_%zQ!ToIBJ?yj^#a-rm{m>cGa*cE4ox>ikOzuHx z17G2r&7RjK^Z8PF{Vkt7#t92x^@O9Kq@#tx2YR{%vFedw!{$m)fG!?1_SL*Z zqoZ{X?&{~1-C4rj21Tr;6XZyRwCJ0Lmk%GeUYSONtX@1RA+61A89KjvVE?1~jY+^| zqpZ^mS5G(QbJgno``6vPbzxVlrs@-Ll|&CWn-bupT@iZHd42O$K~%eS#!r>elZtz~ z(Pe5jdall#5`BEMVT6Cf%{zz9R;SbIQiKjA`@jMIF}S|97^lMd(n&08ORVe6Gp zZyEX=eGHVeCr1AUr^#PCV#+h`^_zAMb4Z&Zt5-;UyQfXYOlv6DN29f#-Dqza7|_R#@>s^_?J%_&D%&^R z2q?$*M;aJYJBJn~tWLMQ?}1&qg71_xU;eUZCg)Frz0gnmXwl(Zw(+oGt9AvQs&ubX zpb9e?CSapqUX{A&@VfvQN!RedHD@?8JG450WIxp2GAQZnyn}XI1Ja_p8M&g}ihj7j9U~cMRO-GE!l0X6d`0WpxA{KxbOCI?YB; zDtdKE!bi3$i}!azGk8eux(Py{>OwB6=$#!GKPjXD@`h*Tb!M@%pW|+rYSyquR0~Rt zv?QQl^NcX_!chRJvZgS?e-b#_fg(Q9a0+DM_CpWQm__aL#)3tc0#zhy;) zAS+f<6ul@wX!PA6YZ9ZP!qazPrS8kNNUyls81;!A*3=PoBjeZ{g)-5{+OPvOIQ9?@G6smC7 zj=-u#l#B`Bk=4f=_K}88bA%86=^-dveE(a$#&=$I93~hKy)d-q^r1JJWU|x1{e}Rk zdrBfA@EC#gZ@nMS~O3hiZ)Z1mk&Id#bIJLv4l}WVIl1l42!jC(3 z{1Vy66wKAzO=&@MQ)Nt+B7RagQB4{OIK`IG-)Ewx@fIU5PUCm(KDnPzt~zM!y9ouo zkf)N@<0UYGD&!~|Qx#cLmeDE?{AJN2+~jV9&Ow`RzI)@wO$T?FYEqLr%9sSClD&{L zzCi6Ef(bXUQLa*3lazFl#-yktDrxNmydhJ^uS|NM33ZhB!gMV>Q2`-zOz#BWr~xcqzP(9o1wCMM}PEv?W z1u9?B=FK$fsH!>wH3B8A@kJcv9_KIpiYJr ze8EY-1eiz_AlNxo;_ih|H`S`d(pT$KDqR*5lS*>b_ow`!p#qU^)-g)?NJ$+KrZaoY z?bzL0h^VEAR*2Vn_a?HS(dbFubP5AFE9f#$?8-Nle%Diqq0`}hJ&PYM;H-{C!I|QU zB=)4@65ovKwBX^2&Ik!mS=y2T}Co*n6-+uMbo z+LkaP3EJC52ROK=S1Q8K+Ft0K4n^q|5UuoR>ZqQ86aR;yh98fzm(sdg;){5RcTgG+ z+*3(*AA^mWu?45NCx?+BHY9Ksq{7ldyHXK7tWLsAy@cxZQ#^grl}?N3V?CuvPxX#U zEGkenP7i5?qOY}b@~^^s$VQ#Wlu*{pQJ)-A5_=kEa7d_1vjGE({yoMcU2a#wq6kysP^{E(#) zr8(+MUQP?)<&ngrF)u~*2o#?9fS71!;sEP73S&{<;}>$?l9x{Wz$h=mE21ayhk{2h zn$GRhQlI8jM56_m5}0VJmGI+5NnVJy^2OgKti(=!Po#m4Uzz0WO;2a_5;RF(FH30b zMe7tx+Z^R5t?3XPg%_=n_ZOk_+kN6CGSRXWrt*e;9OjAO70lS^(|%NgC8X|k zi&xBxFzP}{DR(LwmGkv@OWe%iF|a z!cM^|Aa%x^^HQG*N-7AL2qz#`2E}662?>&7Df}i6wFpFo6i_16TuORA%pkif$)Y&9 zs}k|Oz@(S*rDKa^Op+^;%O~N>fh+J(xn%YM(IQVD8YDj|bdF^oyHwh^(>ltB1JRI} z5FeKwg{NRh!qGA&0;r>rIBJGh%IbLuErhE*j7YRGNiI+RDb!I6pNOZz;C5h4p>IlW zill=Q0gEUdL$}SJd{U#x)d?|@I(&sS=kzIC5jkt9Xgp}fV+yP#D7SZqGDdL{XG%+bi43IGbu=~%ZN-p4{NpSdHnz8fw1 z2CK)e4G$@=^MW?A`ZUgI4oZZ202Vp=kBgSh+ug?$6oC4>B22kxAymdPff<%=3p@cuyKLvuvVh(SHon*Jf zcXgzQU!zIYDK{$4Uid0(RmP4puUHyceG4A}DiNvcEZjaQ#5Vz^F+j7>@Bp#j#^*0QMR z(<1;ndp!VUZsKuZ^7@+6g(qL`DVVa(CmA{od3}_J76kW|b2z2L^H0pwkey=a{3ES8 zq?<@&M$vN5ER8qBViK^$e>sAXzyEYxu->x+!H)18LiNo zSmGk~q-QE4caN9Dn{Iv)kc^W1bdJU4KI(Nfm*yqj;_>4;E`nslA?Xts@%WE)dDL+g zmwN*+ZpGFHB{_&xAk!{X^HWGIN)bmRh-6Hz^7IvVtc@nBXsl60s`kUuEm{h*fMua4 znsTQTezZqr9j=etWA#gq^(A6z()dyG(J~G%m_hAs&9D{b)f96}VteH!b1;zz%01 zvfGd+61>=tvZafXhHL$V0xP698`9hMR2qNG0lj$u!VkLhlx_-JOVZSUus4s6v;Dg9 zXfvUp;-Yvq5uABgy}J)q4=99rmSnCCN@8X?{~wvX>UfO%M`PkKN{Xklb0<4vB7RQgC5}qky>L`_JL<}K zx-C2y3=sG&b0)nQZuPjY&D%0so;V|H&X5dW1I$pC)7{S?ZvYjw-=tJXHf=X4*k@y|FLpm8qFtn{-zJS-n4ST0B(T zNr)h$aTV!lzWx~J>9<@O!^(dil~Z36I4t6-OiC{}!C~?kD2WXtM#=dWuMU2vdS5uH;27D%!8FJ(!uVrER!M zu_PM#vcbma=MCG*K>&K3FB3A9fvRoroL5l26(&c5Yd&So!IP(-K(a2;6z}dkkKVX_ zVbC$3@n{7NlQwOEm3lxjFHF3G3RInv0KTw5#tsVT)N7BrHjMHBYctQ1hpaVHDm?TG z7Q1dIl0z8UH&tH#K@KY13}v9_ZaDuROqKX2GYC@FrZ#(fU2)d#o@P7p^bh6k(Uu6T z?jqB@8VFLKykh;_aPMe@!>>H6cX!vye8U$GKf6?-Z)syHh@k~u!qS|l`N}ylKpdWD zDrx3VTqQxMzb!Kn7RroUARISO-Eh?5BdBx=L*L1b1>x{CB5g__d3AVMQ$;62X^MMX z%LA*wYmw=}hL(Nz3p~W@FUzlys#CCObOl;l!RCT=(v&&nf+h6>9}*|y|Lq? z>~??V4e;u9z+!&J;(}<@*?B zp*EV>o|Jd@5Gte1RbxRe z9Mv4GKI3|^HYEZ$ub{c1*DhJ z*xZJX6JsYv`f{hFnR58>bT5TICe;CvOh%~gs8tkLDmn^CnVWDENAJU_!>{ismmkbW zz81Ew$&ixEws|;&{cQKPnzMzWPnUY}a#YQBmhf zH+8hjha$;mAajzT+!Kl3QPxq#Qq@!fZXWeitRC&22YtyXmcgoxmn^l~5IDzOgyFzx?VrHc1JbBfW5b7!HcXq_Rl{13 zW9+sJ(d}pV!Rnr)=u7gXJ>(}`By-3`ZJO7jzNe;VPlbd}q@yuUfvYOBL%5%Q3ZdQE z1C|~EI5z=KSef=(k*?`@IXy1--3>3l?9vUefSyg9-1MNGyG@JJm{K17#vC=En4<+r zzS^+Y0)5#CfgYTxN>pp!MTw5yDJOS5Z{Ufl1u zdWq7wK#W@66jTJM+cm0JF9T@n`qt#{-*e%WtF2>qN(!EI^-xBqxwLMf=NM`tL1o=@ z3oWUaq-Tx$4qw(LW%aopM#sj4JX|&e|5Wrl-*8F_)rZ4jm|-PjJuL%A!@|H^e)imG zq^$dng+U2!G#*!xUP6lkAMHn_?dj*QICI-YuK<|&TH?v$1v=6{8-bFFC%rQ-iB`

~pmFwck7jhkKr6uo?q0+;sEMYfP3VosyR1 zN!N8aY=%7f<4d+SzMlU2gatX6DP)AZRPfX7L|XJH_=ZYD4Z#F#q|s}v{MY`)U?nIi zMo+c1?73mZO1ikI#z612PDvWpgTCD+0OwspAYtsN;Oz1rw@jb86B{BO6}f-trh6v8 za`k$|h#BqLIyc~6i%RMu(lb~|VYxT7=CAjbD?Wd|oA-Rj(1m&%KKR*v{Z3Kp0;$WK zATZTX#gw%810B8m{z;2&6O}RcAkx`}?bg^PN@}3)1to1&hIqLjv3YMCwlYVC$^O91 zE-I*_WCui?)N@3Nw06=D5pI8c*Wf*G{viN(#QOYCB$d=q`P^ba2Zl2|yPpS>WvrgO z7n<%QYYI+f`333d1)d|heb{g1mW~7A&se0#gOY;T=T$igp47nn{9PjrbN-HDhYPsj z3~xk>2;<(oRw#D40I0pz9?dxK9?s-QUxO-v1xiX<+3N~m_2wJCPJfN*q18Bl)6M{< zl&Ksy*3(|yczAzU887sK0iw&#dDHE#pgHWwUqWyPNsN}h+I}6@1DqcvE?)S3)X#_Z zo%ZhAwmYPj`{w92K30J_8kne$G@wP~5k&e;pvb z>5TgcCUnXD%MZ5fFfOQ3qrdk`B_#C>f7z2FOJf~vdC9W2{4gjv1%P&>CHI@4vjFtR zDs#Bo!o121f3Na97?esRM_NQpCy1pJDfguNiN?pHW~w~6!5N93jsRoo)RtZpoKufK zaKvU){+!WmnVEmdpX(4EMXYdj4;_>gDzR68eAkL~?h!6L9%)hi=dPY>efb#0Li0O@ zdEIOzYva+MurJ5WA5CxHj6Jrl2jWA=$&I#^PaTrhq8}3O8D50^wi;b$T?p1yI0(l=c+u)!naflSJTH=<=~ZODPQCL zXfkJNL`rHs>730dN0)%)a}Ol)l~IbvmrW+NdjId=#LbR@J*7u0L<4^W>=WB$ZJO<; zjx$AK*C(1X_N8o2k=>7 zo++{=z1^T{WY2RzGFr2JI72v##DKpFr?>}gneEU=z2yASLyr1N>t}AV`_TxhT00g7 z*Z1=1D4R4oqHY35LlUGwzwZ1|*kp?P@X13lOLKeObmY2CCdcT@-{<@pO-&Yi=+YuahT<@>X z8)XKwmJt=bm|^9RHGv3gtnpjOK4?uakKIdRou!1R}a-@b)B4grlN*f(;c%0Yf?G9i2^du0|qY z-T(j*d79%T#!SArJ~ld1jkpEt=Go-6DsGHE%N!_baKlbg<`|&R*O9h0I7+Wni zrOeZWYUZw^zRb3V5&66Xq6B7&kMWb9XT#0AlwB%1Gn)nk127d5dh$e#n{_6iAWAy+ z_(S!So@C`O^CpDWk6)8_+8i0OqfMvJ5k~z*h9U~pHwSk&)w&Lee4M${qnoKWEoWN{ zol5+urA<@8OcHN}}w z{rE_W8po%ccJc@m1SYn+#fPy+j7L0t*?IGwFeqdg-fhY-B?JMHgTJn6EZFX8qLO3l zH6H#YhQXz!vY~H29GF*gW%Pbys1ZrWnE((XHR;ova^scI6)qJsVP|BsrDst1AqJ(F zhh(1g6aZD=It}sg^PCX23AGk)X(RfuQurFY!jp3NEQ#4QrDZC*2)R{c(l-iH_DC1U zds>C}1mkp(Z9dO_Xg_bzn`c@SrMrZoG)=gp`S_O#?@6*GV#l@6u^v?#7c~)Y)o>aU z+`3@r4Q z@VKlSwcLBd5+h;zfj?Q`;m>nfvW*lsVJu)d z?ClRS`<$=$DkE9yS~OBw15*JeH;|g7o~tE9V*Fc8mQvG`N6b8UMol-WF0*P2p*OKt zTBp%AiKBk{z#vR1M`TA)4zJOP+;wJfCut9WKb@nNAzgf4JuW+27r@MSB8fJR1}zX; zL?hl?!2L`iR))2Aq37s2inf#}eW;#J^>T@Qqrrd*@`6bdB zB4v7eV{GI^A?;|Z@$i$zCj>;4c~--Ajjq7WJMq*VA~ywglTO}Zr_oYAr>~nTdiQ?p zAXj>{-hIQ|)6vu@A!=$YoilNaJc9HAR<%mdPB_sOa+@rHTT2`{Kmv z+mfxnu$oA*)s}lriHA?Y_uOMN@}g2P6OUal=JOJ@vF9zdJvo)*ln&HrVC@lcJ>dN& zWFYjim63EwqorSv#i!^S9zMkh!lbV|B}$P+r^GqBI)*c0ys^z1aXqAoBu0>2qNTQ! z(h-r+rM_{UTbi7sH1oWlgiK7`sIP-A^SZW2jqCN6jOAdsa;psH9N+VRe~! z_|=x+{s$*726tmCnrb3kX>0N{+_nz4gw8!f64|9F_uOaPf+%JE#LzBnxYREa5QM@9 zrLye}yR0X&bkT1RdRA>s>9c$T6I%JB`h!_=G`gG^_e5?C@#-eRNG-Mr^)H?w`e<2S zZox8Hh0)$CYM~7)8_b598HIWRGr5ZqZLTKunXS!SzG=>#533#gC^Zh#MB}M9^LZS* zN)V*uYOMlb?W;jo){zB(VW5pID7yxhg5R^xMD@l@(YBFyjNc5icamXLX_B6qVHpPmb zWynnCp7JF%GE0BdlMjsUL}}Pz4nvQ<@Olv#ol-wK`^q2Hk^66YBuE~NFs4uS+6DP$ zuoC5)p(1r)6|3Fo-^8JGhDPsx&BBz_JrzE&<}WIzWCq?-8fKf~!pP)1FGi_A9Yw33 zKO?;0=3(bH9&9z$7sZ=MEd5d6YwBT>s&^}i%(s+jN03S|Ul%79ZYA_WPs=)Vw$)tO zHnrlCrYt^LTC@{Y3;CGIb;+0PPcx9_^LB}1iV@koXzBGXJ$#m#&R;tBL73RZD9bjzJp*sSh*RG&pJ0XEb;Pu@^(*u^*#Ric#nw2#swojgt+c_Dn1-z4G{M z(5feG?S>8l<`jpL%vi*+9%q{jbJ^d+|Id(A74 z^6*VR{eviF4yv$B*wrDK0z3UJiw}A773-@;F6rY-ihu#(@r+E&9RwfDtZYSI1y5V9Z%Hv+J?X!zV+sbs~T#dK!5MTga6a$&o`4EvRxZiM?Ag#(wtckUpAXS$;)swC3 z07MNuXZTLRgtAqm#!h2D5w}RqyIJrE0w6#Y3!&mc2Bc)n#>#feXy!^aJcq_Q`UCbU1>EAmql)ZLer_w?u$C90ZeCqOT#E5 zo~jahgYpf!bc#ZgvXAW4`O1$TKYs1y#pIsAc?y;cD--F_f}^7GWE28LiHJI)kYu(8 z9Z2=jpCtKWt0~dn{OyM?x^e#szLt8T%Mp|Exo0f- z7p}X`-;vp=6saN>Of>~nm%(j+y+uyg5UjtZE6`c%#L9E}>{$)HHS6G`y%(uYCo8sO zDg9AVIvcS?xa`|kouhHUzC%EM`y`!Ta8zr8Df8^hBw~S2HWayW|Fdv8T~fKtzwajK z@h>-4+JXVCXL@q~{MyI_j#BA8BYj_n%PlH<=c=>R<^D|}!Tn=WFk+-W`PJj+?)~}l z>_B%q+2vYJHi)Iwb|#P-6)A!ysr)xSw>c-Dy0c4?Jn8Vs*Jna?`cV0P@Y&_NRgN&C zU4w>cYEVwwHGS}C!|=X}j^5eN>$^OzS3%Df`O%?qV#ixJN8}bS21-v{tXei+oC-qI;aZ$=8zw)5nZjcxb3xNA-ttH zl>J!_I{Zh!q|53G|LNX|4_vp6%mdmoRk8O=N+d#ma$t`pLhi2*&Da5An~L)lG}ag{lfTEH6u#i1d}Q-khb_ zU!V6Gduwz1V&BxWyQItgpT2TEi^xM4eb}UW<___aA3Yh0{q?}0R3`V!ePh%lEG19l zo{pP8>d@FUptX9!B^@qejAnE)^E73JzoBQn-1o74;}es}46~NedTuh&YMvR<#>mhz)ysEFJMU7qgUz5AYrclI+ahYJgtl`f%!S0Sj; zyLWjiyWW~Djm-2K?#CM+dF7?6lg+T^+MNj#jA*>5;3!ii=zW2oms|7Z>^g6i+iA8w zXFghcgy#0F?HSisXiw;P)6ru@ELr=wz*^;S%n5B5l&T4#9n=%O(en%S`pN3`!?;P8 zbm?y^fJ>381}Zz>-yYntf0T``CrCV2-;A^PdhMcmflv~p#GA3LQ48KZ`bQDhyCT(_ zFc7NIyUYWxLdq%jla0t+q?bC6E97C`Q6CCTG>Wf$nzM5d(>H9`@1{TFWCD~5Q;fTM z{f&C_C{FT4I?*UJSO(w3DSP-C?l*}tn`cf*(LXANwvZrY zht^WCbR34BP`zEsT69uU$?*!}(EG@3Bk;g8dfpi>+z>h(jXL@}Mu*H7#p zji_Xv=f?V#CY`OjF=9-9KjfoS$L#Y2KW8- zY|Ip?0G!^rh%p!TEP=}oM)Q6RvQ4xCIBl$sZSA;gose7#Bv2cvBW&z)WR;g zW0E;4;?z+lwu;ttMTa1SF8I%cr9-4ABp^(R=2rKQwiV+7)S|kmm|`SPeX%J;iE(|4 zfSv@+3*hp)0-OpJ9=aUoaS=RDUvX7zc0}vlA}zxy4KXvr+?A?#^hZZV)bD3ex%0E9 zVbUkD)$gcNx}>k1C$SX%Xf~gPB4v^ckq9hP!p-wLng(szKf3Juu@efRLMHg5<*Ha3 zCL6m00{zXX=`lDGpT|hlKu_%jBLm^j!{!ww(xfy-DlpkH{ z{?QAlrz)t|@y7rZ^)Olc4F2Jx;QF}OXN)&c$^0nMGFiX@KZ)u|P%`}qI*pGTC(hit z3B}{{s~iSr80xrr`eJ9p8lHw$vO`8nrJq+nUTWaF4t8e++&m(9V}V={XBgsQI3OmDxIUY^oXDu{-M4vIr?A0D%haKQIiM&0000P)Zrf1&5f9JAksHb_o z^Jcn#{pIiL)@hom?_2$rXswMg^ofQpzM#gP{8_JalVg3V{k}YPDKlUthIaBWxKg`&WD_`)Rb&{F5TG^{(Xt(og6W z#d}IuE4n}WEMIx8==oOPnV`DWva70++K{q`9^4C>l-8|M7! zwEOP5dfhjh8Y&g-r=0=mF>pX+qslG~U1itwMPLThPjJ@BC8y1RSuOmJC6`v!h%ZEYPp zrgLC$q*AGn0H>E5aV>#MZNK}gaXnZ8TqgH zCpkU}WRUC3qwD^Z5hqPMVJs55b~M9;nck38}<5 zp^_$Uw%Wa)Nsd2_xR#$`;kDqFMzAlqcCfFnp`oEfp9WBj*LEHvQU-pS*~AkCD*Mn(Py zGy)p9zi_-#Mcd~}EHSDtgusY8Rk2^%2dQOqeO7&&$+ zoxb!Ot=PaQs6diIawchNT3cJ*|KOwF{r(Tj@BinMJ8j^%%zX@cW(bD>9yi6n`WA~jGTD& ztjE5mSDX-K)Dw|zrHLn9-ay@^__($LV+-tOg5Y9Z4Z^Egdx z0(asSA*$kZjHy+tt!-@+CQL9+^Fj6-p!4y^AFo)k;>$0;j2!5Q1R{I4u4h}{~ zIwHwdTWz)Ho_p@R^Uj!W@O5fgM8Y`6u{NZ$_Of9&G7`#@e%p+#Cy&5vYHCax z8=E^i)^6IoXz{#dKRa@GU~{D*@lz)ikdc!WM9#L(YcZ{fe!)zZ2pz|Qa9)4?^<$4c zcE*euW5$fZSI}+6HoC~-Cia@RfG((?dlKKs?_<}Y7>l5nrunvZ?OKTB^Ugc(fCCNy zMnp$=>K9+EQKo9GtspwQplR5!xqD$-*D(tg^)$D%bage19XodV^cUZJ=biQM(oZOm zrc#U; z9imx@P8CGm+B$98vCpxH`IBJMqUF?$m^mIrpQ)9pn>KC20C0_wOq@6o>x9lRonxj>omv~ILXo(Uv#xe= zKJpJ#_+Kao&rD8&Th1{-_p`Gad@&287S^2xbV;)0lt30|WFG{pe|LZ_jSi4Z$9^K8*|k=wc&bER7z`nozoTI;eT0 z42Md{ewD#(nvawtm^sG!;)^eKb#)C64&p01Crz5P&p!L~_xCsWCZVBE+(tx1*AWFV z-9;oukh$53=tSzmD8^4ZAsffi4f&XkGyF8YG2{JI%b6J&IFpgAO;(h_mI+S25%^lfh@g>3 zMG#1Uh_k|yTYE zZ&;fE4p1_$AwEY&Mj$mYfs;-;33~0b&punYaN+FPvoF5*Vps!DJ@pi@BQzyvMY^xF zflrw|BaUW6F^tXqt7*I}gGgRjwc`YhTyq~-Gwk_Ov__~V7v;^S9JClkEVK{K`35lz z&Ij)R4jLc8LWKX>XP*T$KI`gc|LC8Z_vhzU2h}A?rtIsMdSTt3i<{aM5=_D0@vfl zjRSK%|NQfq)jjvzbIK{FK*i9XkT97$cP=||k(#fEPSJEIr6cA+5yrBSR3Ck08`g6| zKA_?vJ<7Rg9!JlegtGI+0*i3~Q@JQud6tq@4~0ZdKmByj%hgw3y=2Lf{r20B)->WsZn{eqf+8biQzIpQBr}Idd{3VQ0jyZPX^`*nTw2R zJ&c%fgfCg+ulzu1Jr&dNaYP}@FL_Bz^9`v4@2cw{O_=qF9NDmRGAQy9Sv-%zWf(U= zfeeDU!39}BJb6HaKS9|;w3FoG^)F&n>a|45OB$A@3?3JjG(IJ0oSLqi=hZH#$ogIf z%RmdkZvEt3xWh&vO%yWCd*K)*M9+c+3m$&>VQ8z#lP3caC@lDE_{23V>7`4TKJv&T zP-IYZ(&YPAj3VNSepntG@Z7}#4Ilhwxgw_Hg*2x?lt;%WHYmNPSsx}Qm)6ka-x^)I zRIWh=BN%ezkw@Nf#~rV{@(R2p=y*^KA|d2(K`O!RzV5o~Hf-1c)T9wCC(Kwh+7{sw z{ee z`e~2}1@16OAad1JSHT6DKY#wY=bj54cf$=gAeIEwNb5(9VTy!ZJ#V%YAjx9+q7LKJ z1F;{bz3m<4=1GTZF^ni^@00t&P?h86A!4>b0T{u_Ko8k?a5Yw~T6M)0SKNH_&CqL5 zaA3ykufP79Yp#LHqf)jgLdMio^uN9{`IJKAJCzAJ3ZL%MA#ZA;2yY5+!)1m{EQ1`s zlKd~r?a0v(*MQd`j0b#!Q?}P$d(E6V^Q^PZf(HxMgOR<*9(%z50CuGnJ%kGxqLEH0 z{ThoQ;wM8&VV~0Fguo(Dm`t<3D z{vm3EuK;Ve-FCa^qKjaBM<}pIiUzEUFh#|5B^2b=)1^=I_bbCzjt;JqvmJ#D(E=T3 z1FA5`q^vB9ey<`*j)YOMYLP4##74n)prA9)JQF$&@vRFkxM0?-S)ilw`z z7?1$szjC~-R21gCRUh5(TAN{VYfT`ssuKALC!cbWkX%~CGD;*2g(fRs$*2ypI0wS$ zgcDAHU^@HkvmvLzdY4{$DN;0-Uw%0-Vq#&!srnXS6wz7RtHVRvn>L%)>se-xg zy6dhdpL`PT2s#lzdhD^sU|~WYfvl>9#(Ir0q6|l=j?+QD)+s;dU{79jNg~SGI=*x^ zt`8#n$OVLS2^>5=x{$G}v`&LC0@Z+afDs~%5ZebHcp&=kzWeTDjyVQj7cE)@5l$KH zQuQw-Q8^L$wTw~xw%NSpYSJ1Cy?D8BqGgC@IG&dMW zAQOmZSlE|cb{T^n{`u#_`^Wqtr=j(4z4cb&GFyc)LXm$q9gCtm(qft-KWPYTgfOa>+CNt| z$axSBlJLHjyiuT%s6I$LOHtReeTu3#k`z*QaKmiz1h5j4YlxE|S=7_h1FG3>yX_#1 zF1+wUupvYhX2U=Uzk&Wqpv(f%u?w zS_X}jLEOWil1ZNF0Xy1MJ1xCmnA)*F20NLJq?@c@fssWcl z%|SvTDgcbwaVy#U!~wJXsNISi!zw<%RlrDE5l(p69}z5JbkxQ&C=wh+ z2LkiQ8-WoB2PwvzZn_B?4Ri$VLkJ0A;rgquzJhE*G7@eI`S70cik$+ZQh)l={UkQ6;EbQmVyKT$+S0z`mH6;ARP=-hbYji`q_=%9n3=9ojd zlq=6@G8CONk(J{wt@2SZS9{=+6oq}mE~TO3`XC?R>YV7+C_mO=C& zI|6hTFJ25QoE}mxgL0;?P~Ns?th2d!LVG)kTwBJBL6vJ`SJyb?slJKr9}(vdX`i@8 z(I{X2A!5>gCt{T)MR5ycDQ8I*le8lfkO-tf*+28lGlw2}DD)aS5w1lsG&(^(@Mc%9 zUX8GkG`I>f$mJk(evdPab9iX@xeq_wR7nPshDuvo($dl~Vf-JyT04EG30C=~#^~5! z$k!+)(oocHpGSzF(8LfhMIM=oSnD|xk>-jbszt3&4Je>q@44rmLlg~he!LM;k+y0Cvm`r2vveb22e6bAgyMoUfyf zItn32;DT3x%g~P?NkR`*5xMhss<@0_W@?u~oyzA@jrxvIm!uy;~aAqe6O?SzJ_Kx<8{> zn80gLQfuJ>q7rqmBvp=D1of7l9td^p`579nY7Y826DTE*VR&%x=gSVd`Ik=~ee}=6mX0v4-SqEhiy|dB{upd%Uxw7 za96Hei5Lh{*zC390vsBJqKywF5{SJ$y?gAr>!b-y_uRX@G3npuNAtIA>B%Icif8J7 zt)*b9n5cBd5F;e~W71;KHE;x+o=(VueP;T&1U<6f@d%8xq;5iiAzX zh}5dJKiPiUN<&4ZL#jastH=p$H%}=0V}HKn;Gg{Mqrbi$n-mgO7gXK;s_G~2Qj zCw_PfxepT=Tg^1I;|??a;qTA=!4G!q>mLBEdqh&fL&g^X8!f7oauG$cwz5M!S}Jg+ zclxtgQcfcZ0pj0w+ijygn9*#D+c2XtO;-Hhx}h$AW=0i+%);L7@y_<-6GExl zS0{Q$6?WUwC5!v|`%}t)IP1v?E#9-8Js|akvC*bpqeHlQ?3ni9p`j?RMyeV-|E&N; zDXNHqMnB)D6d+fL;tR=LR8y($?#+OX^aB^oTLT${;U>!#&X%6uB=M&zP|{uHBavSA z$jC`WI>mS-N@#~`X3FI8FTJ+nKbc zDj3Cq1C^o(=;`U*_eb*|f9B@9es$l$2Op4CMrHMf73-Iz6ojmIx|FZV(WU1d`NIy# zEl&A?{8%N9^^s6JyxEmk^y(xDc~LFW6v7{cHf~sR)uktOcC-%+3_3BF-Jj;%4om$U zG>zZ66@*d13hop*e!Jyy&*cgCpz&+=g;?0 z^$tVgqY!+hlQQ{Zfc%*r6zZEev8%DEvAwNrT-Uh4fgw0t36qbA<)}L4423dSA7^D7 z%2_&M-+ag`hR|#R_j&!sZZH=j5_st3$&>i_7vpwY1s{=*l<|L6eDVfgDA^O8d?ush z`TaTa9-7fet(pbFux1-J!&@MeFY(z_K3B;X6S~SLB_fBKH@27{n}w>+mC{$_fkuJw z>Ldjp>zQwt;^0LNOZBLG<*%) zk4&Ygsf3?gb-`EP*9Ys53;H^9m#@QkTq4m-_;wap0ng} zU5fidEZFm0qD?phDj>oSF{W@VTR1b1jlKL{WR*Xlh|Y_O_N#Xs-wMa{N#zG*R>QkenXMOC<&)@xzlA>RO@ggkQRq#@$r7f9Uc~j zTIQOGev|(i5`fC69AX8{XG~76nL@EgNcxZ+Vsu+8Rl)^3h;t?{ytL}#i*JP5V&@=jNIrT?zK3A+_CFU~isfp$xKRKA002ovPDHLkV1nU{eiQ%z literal 0 HcmV?d00001 diff --git a/examples/dialogs/configdialog/images/query.png b/examples/dialogs/configdialog/images/query.png new file mode 100644 index 0000000000000000000000000000000000000000..d4b66d120cab2abf48c991eb749f10a75e8b3436 GIT binary patch literal 2269 zcmV<32qO21P)!zW-EDPtRp%c6Opmf^3q7M4x0$G&|#kKptEn4*>&-AP6B|Fw-0GvZ8TD z5Q6w1C`2C&m>5C~F0KR&gghiKF&IS5OjMS{`wbH_yVEHpAV<1x~seTvXl5T zGkxm(_4U;G&;R|GQ>I*!L`gP~l5m|Q$y?IPAjo^~y_dYQf%gj6QmQ?W9*~KmnVFe$ z=CXmA3)jwtxr6CVG>SXt*EcpcHrCfS);H3@#>RTMUSAJ$2hqQLew#8R_{pg+uhi@H z`ssSTUSCC>lI>MJYtgXqtkdJ>62*t+xCb5Fhfa_-qXx56G+yuUY| zG@H$4vpMF?d;778Mi9*RDeMr_38uf<)=`P~USztp1$`MFgh>KN2tcZ}d#Ta5)Mzvs zjZ53jnB+(tAsI=H5?Z{owS77EB1!qUwR@@2!f2pK1AyYApz}8jO*@UtG9#JZY=-uB zBXOl`=->gsdcVF~EZo`Lx(uU)TqK#rjXeV_+%?d+mfk;PmAl&_rSL$=RxA-ayM%_J z0T_f~n*}27{rdEO2yS=JprH$p2@(Ma02n?=Ae%FYB2ojX>wziQ?!G}7gr@`}NoDpH zGm9EYnvw7x4442V2oj_yVi)P%Wq6Ss&4a{KqVg~dC^eTT+rRAIA`ci#r03+!-2CDB znF)%_{fXdZ$&cj0&^>MwQf*;wW^!U;a^~px`8EgP(c!@$UxwIDAWq4rcBj|OjPGzx^aJ6@c~CSGI#EpIzMzSU(#KPh z#O+$7oYq7Vyrl#WYghR5XOgSw6^(WHcBJg`h|h^e^G&m!Es&u@_!^ zp9lzlJU=N>HP>zY0v>rj7(*(Xzrq9WZftJu-So_jVd>{5L|>Wq!*iN(EYZ|&{&~Z# z7b;QYE*!ZR1c)t@aL8#mGUNlLwm>gUa&ty6;of;~1gfv!2oDGq(a%oHf@S*gArXdr zFsj0VyY#u|@7jqZxn^@e1juU>KQrftV5uG+fF+E}o@V-k^D!xlH>8X~O9%TgrA_JHEQ!((+f^BigeZ4>0gR#oC|fYX$&V+%nq& z>+{{kX_<8JRNw)MO~il|v=S!o#KimC#^Dh<#|y~&1E{Bb2@_p2Xv_9)c}MHTiWf@s z{dna4LFTTZeK1QYNh-9K!R86sUi|b8lkGA+OYnhUV`emx2Dz=zzH~>^@k%7EuBlFB z1wa@;SXa2-j()UFxBte!&hx{!PVTuvytEUmq zNE%&iL=+$)+G@ByeJMWglQnV$*1F&zLZo1uZPR!w$apZ4$=r^aW^T&jU1EGD7piMZ zpTffGI!<>v6vzzz&}2d1se_96PF;ji#i`=_pcVw<@rv0_J{aY8g^d)zaox027o{tO zrALjO$}*5RQul%B1dICIQoZ;-9t@P}jvoM=9nVB#=L0A?H0hb02qe=}9#@tRI^hnb zTrjw!@M%~}+|iO-%J4#8KCr$~`srt`VJrYXo;Ws%KK(%axcPv|-1Q6Qy{{}@S4+lh zi8{p+hE~f#eD&(bI|6jdr=K8hxsIg2I+>U;4uH<|Ka_R-rYgVnmv~FIO00000NkvXXu0mjfY4Kvr literal 0 HcmV?d00001 diff --git a/examples/dialogs/configdialog/images/update.png b/examples/dialogs/configdialog/images/update.png new file mode 100644 index 0000000000000000000000000000000000000000..ea3f5979e9bdb5835f5c48e3b78c29e0d7982b11 GIT binary patch literal 8296 zcmV-uAeY~XP)WYVE9NJ&TX=ta%RkomSdT;^ zER)GVG|u}=u0_ZT8ZrUSc?vb4 z-qG9b?{<6#8k5dsDl5xxz2%lDG^(ekySpcK?RD4n_osw{F$aPY$1s=SZ%!3u-U+ze zguV2>q@>Jfv-r-PkyX z%gf99`}64j;<0EX7U!94CX;5C0m5Cm@&x*%>IBe392Sem(`l$9qz{i4@r23Db*LMV zx{GU-x0>q)g5%Q-vs@bVZjVm_ipTRxii@!=N~1#(nREuOIvR;WB1ewYH@7qu7nKwg z6l6)d>I5uw0;S}c^iW%STSY}>RaJFhSQ+; zVtjEwoI@H|gn*3e#(=mbeEs4V?k+1WYHMpPE-o%CEP|5?2Lc+6bMwg{+{VU++S-v2 z?y8SoHEr4qVX#8`yi3%2&GZ)*2s+Ff+%sg^qJ>jS1dE@tB zd@%y&QCp-4`*7GZXU>GyJoeaQyLaz~UeH5u^HQc{vg zB=Y4#D|vZ&^ob=Nk4K}ziwzDA!X7to-u%idJI9O}C1Gd8l8@&#Nb!YtaOt6Q`&Sc@ ztc}d*1G9Y)^Hkt%j2{r@Ul`wh_EEhiN7XhC|1@&s$f~NUSS*&W7ZOmyzZe0*ozI&$ zud}mbY~2`X#$23L#uX7-7`H&IL=jmoQ3RfoD;=2t^w{ny$KfixqWp=86!LgxzU3I7 z^ogmM&uv}Ppoklb%sIY87cYe?e2{d~p4@P)gdQO#+&`!9*(}$Ku_-K2A{;_+9EU)l z#<+YYCe%_46phB9d9hd=0RfmmnmNyAvaxtfm~JEj;bEMCfqtkVF4B!M%bR-EW5Ykc zRWZiAoq{G7*vWWw-}qV-BKmXEAcY%L*i#}4Ux5?YLgSD_qOVGfS{3o5xcy89JHau< zqp^<8j)MmdA3AiPq2XvpS0{Fa(xv)Rzy|~UDFnfqs+!Sb>LyN_QeIJk0h7sI$cq7) zXszJ%ytPmWD--f_vslUEuh2y(rsKG@kG4o$pwv`s!4-L)3)*bP)X^!VCqufF)=3(ajU?Hz5!W#uEP zYbH#cf^nvlm6unJfI@Y5b+t4#9%wweW6v(0PLHk~Idl5V6X!3et{s`|?MbEjpnZDQ1oAeVDQM+-YO3{9Bc!PE(2mwBZDL`G7+WLJ z;K4$7gg6+(I*bt;VLODIXasn%j*j-Pe&tKgKKm4O2clSX=DCw5OoCW(!$;nD1Gw}k z=Phk5rIl3^rcRwcd(J79=kz6$%}tHXjSa8t*}Y}!52sI_a^CqD9yeuLXJ=<7Js1&U z3PmyN<}8B@8e{knf6NP*n8ra|dIBLYF5Q|X6cPs(vtmReMagLeTL2M^-eIM*q_jWP z57B)4+ur~xU9n=-!i8sy8a)Q4l*mhnhaGk43V^xmj~qVm=Y5CXI`qg7pRXKUH)p}A zlc!EAC@h{hWm;Ef$7_3bZ`!*(z(}lbS`iF)F@n2tGQs)Iy#F5C@@e`&@od$>1(%iUX$Io8e^8J?*`5#%as=T}c z7k|p4v*&*3wC(@>-1RqHyYj-7=Pz5)-QA572_!*@jy5;f6Tvf(U!)B?|=94UBBFU%dL01k-WZSFYMZ9FOF?p%y?!e6vj-d!5rrJ{f{LL$G9}5 zW_ncx^|ZAN>19wa19E{-QmGU^dwa#@9z1yPnrp5ZKW^fGe($*@OU_4x>h9_m&jG#~ z5gT?v4vzqg;V2lw6qYE?+S%To>`PvH`IQfU`J24G<(pr)SLj$Q4wsZDC|I-pbF89r z?b<6FkJgu0R3bJ=#AJdr;|lEf#|9wzahhxkMuDoh(w6E>h*fqN4jB{K^GqocZwG8=IS( z^9qW<(KIzSp1XYIiHpzs)Tgi8`SMGZBdTz9?7ducvKlfm!iqWtV}`PokS|MjZd^6s z;!7{R^w2{OJ@CMTGiT0t>gg?{HS$4a)kDszI4iyYu(%ScaDTR)b+WE-pRrgJXK89U zdifQr$BY?!&lf*`{*~8`96hEV0j{xW+N={sjUBi7fxG{$FLmzH^IMvmVc_p*d;#=f zJ%pKz2gikG8T~8|bret(eu{g(+eGx70usl_#W)}`M(E3uB}?$FqoYG=4V{r7JUs&q zSjeFo62Vq#k^Y;Y0x`v#n;K4EbXH~6h;{4NUASgl?Wj>u*UpZPqN3t8H*I|I-c6BM zWYJlR+uK@!lDHV)?T#cY=3LFF?tEaa&7R&p@hTA^>r3d!x{srP) zCi5=a8hLV;@}H8BI;f7=^O94|L%sPNAmLvxxlFJczlcMckGN+0S1vd zQHt;Sl2sxJ!x|J&BD0Pi2pPx$xu*l>iMR%<+Z%jQLU<7G0je*!xOgny-qv!;!bNMZ zxa#>Qz7b0l;K^}OZs@5TQN3WvvQ3+A2K_=izti!>K8~d})-?*4CjZ!K1r-pogGRuc zKm>iE#cT}xiWm<%gpv>63AMtqz=aH}+QD^P5ByP6W5dO(J~nG?-HThd6qb}hw;eaq z-rhd<I z#63Vn!DRy_o^Zkm`}gmQ#-fBsI5XIuYl6mSXkiK!XII%V^N1Zy&O5DbEjNDl*2_P3 z$-W7b$4{Ju7$1v9+ge(dUv|Y;?!4tkTb?~<@p%BHh!S*>!&R*;B9iI4n7BKIT^+6} zSr%ze!|{T`LMQ^F=DKz3)~;O(&!d1m_wEW&F3b<(Sk#Vi;GR8upiKt;gpx@+QM8jw zM`m`cq_~W^5oIfy{?e%lD5P|8Nx_5neR0FaTk6(aPly(NG}V{9?7ABs`P!G}pR{1q zsL_H;Vmi|ZVLvsVS7R360saOD2K!Qdo(;--mUS^Yxf_Aon>TO%kAJjf)22-bOf@w% z<>lpMGU1YjB^rlF#eMtsjT$v-@7{f@*L)I=N~M$<3yIh%m{4xetV)*%xMZ^kSU76i z_HB&~^(a9(j#W01Bq{}E+&om3Cwq2o|DQ!mm#2EWU2)(*WmWa;)6Tg0a~sY+cS(C& zn}Q%gPFfd!r1)^UxbR$Jy`-#c>Xd2IrcFnvF;=H=5Mcr$KA{4)-FD|&Z@t;jP>)n> zn1Z!>x<*o@Uy~;vUtL}M@sE!hF`^0%97u@(ztCQ-3RF&vsFcxFRR)|l8tv`vx%qSJ z7c7{6{EXux(TJ(Qa8n9YSWHOs&bw~E*rNQz~oB zCv3x1XEQ7~x9SJtN@c!I>^jkQ`YV&wYe#)L%ElbYJ$7`oEnj}Qp$!ab*Uy6o`dU_9 zdg)WoK6ha6pT>=!fJ!J%3VwFR2WRj4`S$NW^Yn^~Rw~r$KT11qPOKg|5F*q;3Qw9e z;jP1O9)JAI-rgi96H`x^$tdRN{+bAk!qrZI`Q>9AJo8ae-fcJrqbdKPxo+u)9QDan zX+gW=3;>qQ;38D>Macx8@b>}hpcMjK*Ia$&9S=P``BNJPk^+T6Mtwa!OILpMiSIso z*4gI_*BnIb6=jQ}geO@YdL#f-(!oohz`4Kl94JK$Qxyntn=H)a`x#MxmCj$9&;=5J z(#)YlhvZcXi$f9Vg%@6UmOqr-hY>sxR0M6+?CF`s=U9I3^FL-95@x0|Fi{>Ed@fw0H$G{hB2@CBA|UL z76rzasC}ret_~>`U43I?IZbaqIZCh7fbxnV7 zmvH}Xq_4O4jE|i6{9_OQ%XQZg@eq~~(Ks0MzWeTb^wCFexZwtPm7uPX$1t_*VbNx2 zfkVvdN{9zSo!s~|H;fJaAf8oB+zH$QZvOD$!>EN!o;;ZtA|ek+QnZ3Su^SBV)YDGu zYpri zd)cyz$`8$(^Xr#iEI_7pP4Sy(2dAhts~2M=~OH+RaEM^^x(gXel()kbuY#4t@N2rzGa#|iu+B0;zk zRCti?*jRix`Vlpvg$oxp?0+51w}J0KVbiA1=*u|&`|7Vt%SxdsMn<+ik|x?!KgU!( zD7~R%mCP-0ZXDUuGtk?MLWLvs+0Bbb4;<`74qIO4ruv6WfP42C7;cKXxCi)Y6FmZo zW5N?5__1ThA2)8y8^8SxSXz}f$&%8Er=I?kpZ*lx1Z0m!KsF0VfZL4e(;z7miV>Xo zR7?DXx>Yhcbl@P`sAAyT^9$mrq$B?*DRu{kczP(q72z$D2iNh+2tv(;P*vV0jY&7~ z3DQ#pE%BGT{_3`*Nqi+abKOk09R@^3-UPLz6X(v^`tt5mKD>xhZn$b>XCIt1_ggz& zXlrdLDlQ?Rm_aD6oAzF>fNTYHqRCvl7sfVtB-JBpi;Ii$m;;EB>gw!F_H`E(xtT1` zhBG)MyhA)5F$E=4Er7td%Y2bQk)P7wnAKk42MLy*`#^(HD_c@F`iHBYGk5MlS9@!7 z6M75Dw`D||>WJzw<96=ciD*Sl&o)G`gBp20g={^lPmUirz3rlqRM*y)ruv0rP9!4v z3D*$(Jez*~^_I@ge#l7rsdvH9=u!>f46BT}RAT1L0(V|eSTtem=)HgV9oPu*90Ztm z(Kb2jgt^;a_&JUx&QH*6{>3xwkcrU+xw?N!xAUlfOrq6nRaId@LH^(%^aa=C5TOaP zfdd^H>V5r^UtRos#4)f*t`Vn}TT0z6?8bkTyjP zW8wOOylSnE$KA?`qWbziKy%eRsyp`c^P~CsysNXTxj8xW_?pVf0-V=atJgT7oHb7m$COivskh!7#SXd8p_x=7i?aj@V=$nxa4m-m~)J>Rl z(@i&?bn*fm1pzHxx|Grj&&MNi-FGRB9kcTW_Xe&Wf&8&2zSEA!G;Z2JVP(3cCR18->9yGqFRafEXV0F;Hu;-rLe+ST{P-|h6Ih@%AHU*?x%1}! z*R#*pU3A&PFhzjfEHdGVR=eEX{p#pAId^gl>4Fe1eh(WwP?@9FLWo%-VTZPTVs z6*B>3yBB@>1(fyY6ei3o^2}jgXO)1_M;p33yHY4DGdI5ymR(WN+bc*Ccxz;i5Hd~y zBti9Oriw?Vdcn<#Nq!OU+S;-M1Dx1#|89yl%xPk#9mj-Z+&Y?Iic3mwzkO3;py#2x zZo>~Ch|%E|k;0KOV)CDhsu4`G{;fA>&z=n^XF4z;BijdMvqo1`UyN?zRJUj2AfY~` zrHT3T#w8NKpE52)8Nl@6`j$isF=nEDyA`(PH?sthFFcp&o~u#5A0ry|DcY8*jSonopiM|738lk!ZxuPT`gR z^!gtQ^Yg&6Bc@RjMs&9oo0|vMa7i3R0Ozq#MFOg$0GL?%6$k`t%{GHHJ&f?SuUO!F4pvPn0X^l1Lu_ zM$yeF)lPs5`AFc5rc9}-sjiHP$`{Qd(J86y1(3&zAWKKVZML?duVL^={ZMOby0}Po zunB*!Ko=Re`p0vdSoSY1xD5E+s_NR!ciq*v|BrXy`dK7g2=Joo7+F{}ivFAfd-u+o zITQH+Bx1Xvum+jyG10@}s&J@7m=K#6{$0DgC8XxengvxY!pM%PCOfXOTrvg`N5Jej z#l>!EX*3?=pdtzjva-JD^d+-hUBbsfOuCUtcQFkk8q-&6Ftpu2NvZ@w8ac=M4WBuF z^7zkQzxL391Gq}aps29$&-?bFhEP*miyiEaClZqnC^AnDRO^gtsRd0eK%x3eCtMUQ z7-PApRl8FgyOx(n8XLeis99N1`FJeT)RgV&j#QKboUmhd)MTN6SIETQSfFRSi}&ab?)Q|p3jwYJr!FEP+nNTySvlv9U0e(n*q0DyBoWm)K;AEg1do? zCQO`o`^Jqg{p81Y-gYzEr1t;mjp;LH^oZ8atR3TXnV3gr5$JdA%+>0GuxLP=B6U;) zme|g9do?*Qxh23HMkB&cqnkPsHNlSeCRzVrbi(+=*t!^JCNFoxCT27!Af}u$qI-sp zU_iuj?056cHy7qbFZjsffm9z#z9^X*`!b&a0r~O@?)6C@)5L<)hWzs*JZ$VMR5-HG z4u{p*nT|(!s$a}p$%{Lv$HnuaOh0!$NuYum4x4?k?G;aGjrJV#Z-ZpUEW+!}*kybQujn33AVR678Ca9dkuZ~*=| z2DT*Cp9K$z>lX|kbA~cnC_c_Cx0Cj_)G(UG7A|-Z>0`6>4Gj&TiZBAI$uut@EFd3Y zW>3>J-5msBLK+lmKlaUf^d>ed)5~&eo{el+$TARYQ>G*!DFiQsi$jNaUn*T%=5k#I z@y2yo*!$QfW@HpDx7nhxr9*TY=rQ?=k=#Jr>v=g2+oX$7{f`kPbB5u3BK9ipSrq9|%4qpe6S8aywq1%utDxdip zQwUTYLxaLj$Ec5yQJ_GWvmef1vBuBxoXn4ndVE!XOIXJ5P?0O3KH*0m zK23he%?z$}}x$jZcHSihs!l1Z4Z>a8S2>GfBsYDLf}M?1l_&W@`|UH?A%y+c=2( z2hBYlQ)UnDQ7BPD6f%ivEi8;QHfAu*siHE1iZpj}gd67X3Spr+Y<6ADHnFgQ1p2v2 zeT>@*%v=w@2FF-gE)#Q@<~L+Qp*2W5C!J$6KFq5YM6Y&!LQHEK7zFTh<LOPiCK^>2V70Zd6O=1xaUV#{IzhEkm z?ge-iOB6cQurd_K_ga@w7dE5=%L1>A7!T1yKnQ0@9YCLzl}0E5a9w8Ij@PMbm7-bB z@#V`J6w85%AU?a*K#0c6e=|rP6iNbIoIlx2!@`Ow*l%{fL)F^OZ zPF|jPK8M~MOeewNlU8PPl1RZR#-Z0`5Fv$$hM1j)7p$PdH-7wh$mrEqUqzLM!Z}K# zF;UrxkgqW-ZfFU6=zx<(;%anr$BrGVSFg5dGwUeFyqdz{Uf&}3npu%ASZ@zv0uBn@ zDa(`ekL=(WKR))y*9YTyC?#;!R&5!C06z2*Ay>af!k(Ti$9H7w6m%0w6KIO+>S{bv zlt9rO_w>_GV=4wE87(a>0h0-XqcGJM?&HK)ltUnEbo^o1tFOL#@#4ieuNV6nHH~qr zs=?Kd7VYDBc*gEEag=D(YYei2Ih{NyE<=HFZelhY(=Dv7Zg!^^A8Bvo8=tOh>eQ)f zvXFepm~+2={d(hr!tJi%$Q^$9UATFeZV&>Zmug^(Xd9RI=nbXdnE{ILh;sG6*9c}_ zP~cLLT3E9E4wf8q{X^9cOBW;^ktW|vO)WGl!1MtP=YYa*`y1}9fp()S=3USZ1}I=1 z)?JA39GJ68>cp*ll_}E-kk0lbewCXDmn`Rbs(FSq?J=ucL}k|$^Sxq)l*TtcUCOMP zvz~kIxjA#@+TE6R40$^O^0$le;bOeq%1H?g95$xmboca(88r$il&lvSpval#TzxEr zdTWl8OGM1-0Ctr+8al}INs(Br?YarwKR%uz=uh-r{PLH(?zrO)R3r4;ARILMqMIDNXyXT&J8k?F9zx5Vkj4OLFk2W+o7Sa#DfQmcz3;%Mwe2e9>06IH*iy#^> z{Iou4(j>rKJSyD`YJegmeh0}KnG-P-JF}sgfaANdvcD*XIno9`vb!@iEBI zV7jKdrnaW$Z}Q$vBsOS5lg*T3S|1rnRK2N1GX{U#SA)tK6o0cND&}A*2^7h$YvF@r z8&)x98E)LT(VGd$eJ=tGWb@(oVT9(6KH>ev_cq{TAglk+?~^v{Gk;%Gj" \ + "

Click a button to close the message box. Pressing the Esc " \ + "button will activate the detected escape button (if any).

" + + def __init__(self, parent=None): + super().__init__(parent) + + self.openFilesPath = '' + + self.errorMessageDialog = QErrorMessage(self) + + frameStyle = QFrame.Shadow.Sunken | QFrame.Shape.Panel + + self.integerLabel = QLabel() + self.integerLabel.setFrameStyle(frameStyle) + self.integerButton = QPushButton("QInputDialog.get&Int()") + + self.doubleLabel = QLabel() + self.doubleLabel.setFrameStyle(frameStyle) + self.doubleButton = QPushButton("QInputDialog.get&Double()") + + self.itemLabel = QLabel() + self.itemLabel.setFrameStyle(frameStyle) + self.itemButton = QPushButton("QInputDialog.getIte&m()") + + self.textLabel = QLabel() + self.textLabel.setFrameStyle(frameStyle) + self.textButton = QPushButton("QInputDialog.get&Text()") + + self.colorLabel = QLabel() + self.colorLabel.setFrameStyle(frameStyle) + self.colorButton = QPushButton("QColorDialog.get&Color()") + + self.fontLabel = QLabel() + self.fontLabel.setFrameStyle(frameStyle) + self.fontButton = QPushButton("QFontDialog.get&Font()") + + self.directoryLabel = QLabel() + self.directoryLabel.setFrameStyle(frameStyle) + self.directoryButton = QPushButton("QFileDialog.getE&xistingDirectory()") + + self.openFileNameLabel = QLabel() + self.openFileNameLabel.setFrameStyle(frameStyle) + self.openFileNameButton = QPushButton("QFileDialog.get&OpenFileName()") + + self.openFileNamesLabel = QLabel() + self.openFileNamesLabel.setFrameStyle(frameStyle) + self.openFileNamesButton = QPushButton("QFileDialog.&getOpenFileNames()") + + self.saveFileNameLabel = QLabel() + self.saveFileNameLabel.setFrameStyle(frameStyle) + self.saveFileNameButton = QPushButton("QFileDialog.get&SaveFileName()") + + self.criticalLabel = QLabel() + self.criticalLabel.setFrameStyle(frameStyle) + self.criticalButton = QPushButton("QMessageBox.critica&l()") + + self.informationLabel = QLabel() + self.informationLabel.setFrameStyle(frameStyle) + self.informationButton = QPushButton("QMessageBox.i&nformation()") + + self.questionLabel = QLabel() + self.questionLabel.setFrameStyle(frameStyle) + self.questionButton = QPushButton("QMessageBox.&question()") + + self.warningLabel = QLabel() + self.warningLabel.setFrameStyle(frameStyle) + self.warningButton = QPushButton("QMessageBox.&warning()") + + self.errorLabel = QLabel() + self.errorLabel.setFrameStyle(frameStyle) + self.errorButton = QPushButton("QErrorMessage.show&M&essage()") + + self.integerButton.clicked.connect(self.setInteger) + self.doubleButton.clicked.connect(self.setDouble) + self.itemButton.clicked.connect(self.setItem) + self.textButton.clicked.connect(self.setText) + self.colorButton.clicked.connect(self.setColor) + self.fontButton.clicked.connect(self.setFont) + self.directoryButton.clicked.connect(self.setExistingDirectory) + self.openFileNameButton.clicked.connect(self.setOpenFileName) + self.openFileNamesButton.clicked.connect(self.setOpenFileNames) + self.saveFileNameButton.clicked.connect(self.setSaveFileName) + self.criticalButton.clicked.connect(self.criticalMessage) + self.informationButton.clicked.connect(self.informationMessage) + self.questionButton.clicked.connect(self.questionMessage) + self.warningButton.clicked.connect(self.warningMessage) + self.errorButton.clicked.connect(self.errorMessage) + + self.native = QCheckBox() + self.native.setText("Use native file dialog.") + self.native.setChecked(True) + if sys.platform not in ("win32", "darwin"): + self.native.hide() + + layout = QGridLayout() + layout.setColumnStretch(1, 1) + layout.setColumnMinimumWidth(1, 250) + layout.addWidget(self.integerButton, 0, 0) + layout.addWidget(self.integerLabel, 0, 1) + layout.addWidget(self.doubleButton, 1, 0) + layout.addWidget(self.doubleLabel, 1, 1) + layout.addWidget(self.itemButton, 2, 0) + layout.addWidget(self.itemLabel, 2, 1) + layout.addWidget(self.textButton, 3, 0) + layout.addWidget(self.textLabel, 3, 1) + layout.addWidget(self.colorButton, 4, 0) + layout.addWidget(self.colorLabel, 4, 1) + layout.addWidget(self.fontButton, 5, 0) + layout.addWidget(self.fontLabel, 5, 1) + layout.addWidget(self.directoryButton, 6, 0) + layout.addWidget(self.directoryLabel, 6, 1) + layout.addWidget(self.openFileNameButton, 7, 0) + layout.addWidget(self.openFileNameLabel, 7, 1) + layout.addWidget(self.openFileNamesButton, 8, 0) + layout.addWidget(self.openFileNamesLabel, 8, 1) + layout.addWidget(self.saveFileNameButton, 9, 0) + layout.addWidget(self.saveFileNameLabel, 9, 1) + layout.addWidget(self.criticalButton, 10, 0) + layout.addWidget(self.criticalLabel, 10, 1) + layout.addWidget(self.informationButton, 11, 0) + layout.addWidget(self.informationLabel, 11, 1) + layout.addWidget(self.questionButton, 12, 0) + layout.addWidget(self.questionLabel, 12, 1) + layout.addWidget(self.warningButton, 13, 0) + layout.addWidget(self.warningLabel, 13, 1) + layout.addWidget(self.errorButton, 14, 0) + layout.addWidget(self.errorLabel, 14, 1) + layout.addWidget(self.native, 15, 0) + self.setLayout(layout) + + self.setWindowTitle("Standard Dialogs") + + def setInteger(self): + i, ok = QInputDialog.getInt(self, "QInputDialog.getInt()", + "Percentage:", 25, 0, 100, 1) + if ok: + self.integerLabel.setText("%d%%" % i) + + def setDouble(self): + d, ok = QInputDialog.getDouble(self, "QInputDialog.getDouble()", + "Amount:", 37.56, -10000, 10000, 2) + if ok: + self.doubleLabel.setText("$%g" % d) + + def setItem(self): + items = ("Spring", "Summer", "Fall", "Winter") + + item, ok = QInputDialog.getItem(self, "QInputDialog.getItem()", + "Season:", items, 0, False) + if ok and item: + self.itemLabel.setText(item) + + def setText(self): + text, ok = QInputDialog.getText(self, "QInputDialog.getText()", + "User name:", QLineEdit.Normal, QDir.home().dirName()) + if ok and text != '': + self.textLabel.setText(text) + + def setColor(self): + color = QColorDialog.getColor(Qt.GlobalColor.green, self) + if color.isValid(): + self.colorLabel.setText(color.name()) + self.colorLabel.setPalette(QPalette(color)) + self.colorLabel.setAutoFillBackground(True) + + def setFont(self): + font, ok = QFontDialog.getFont(QFont(self.fontLabel.text()), self) + if ok: + self.fontLabel.setText(font.key()) + self.fontLabel.setFont(font) + + def setExistingDirectory(self): + options = QFileDialog.DontResolveSymlinks | QFileDialog.ShowDirsOnly + directory = QFileDialog.getExistingDirectory(self, + "QFileDialog.getExistingDirectory()", + self.directoryLabel.text(), options=options) + if directory: + self.directoryLabel.setText(directory) + + def setOpenFileName(self): + options = QFileDialog.Options() + if not self.native.isChecked(): + options |= QFileDialog.DontUseNativeDialog + fileName, _ = QFileDialog.getOpenFileName(self, + "QFileDialog.getOpenFileName()", self.openFileNameLabel.text(), + "All Files (*);;Text Files (*.txt)", options=options) + if fileName: + self.openFileNameLabel.setText(fileName) + + def setOpenFileNames(self): + options = QFileDialog.Options() + if not self.native.isChecked(): + options |= QFileDialog.DontUseNativeDialog + files, _ = QFileDialog.getOpenFileNames(self, + "QFileDialog.getOpenFileNames()", self.openFilesPath, + "All Files (*);;Text Files (*.txt)", options=options) + if files: + self.openFilesPath = files[0] + self.openFileNamesLabel.setText("[%s]" % ', '.join(files)) + + def setSaveFileName(self): + options = QFileDialog.Options() + if not self.native.isChecked(): + options |= QFileDialog.DontUseNativeDialog + fileName, _ = QFileDialog.getSaveFileName(self, + "QFileDialog.getSaveFileName()", + self.saveFileNameLabel.text(), + "All Files (*);;Text Files (*.txt)", options=options) + if fileName: + self.saveFileNameLabel.setText(fileName) + + def criticalMessage(self): + reply = QMessageBox.critical(self, "QMessageBox.critical()", + Dialog.MESSAGE, + QMessageBox.StandardButton.Abort | QMessageBox.StandardButton.Retry | QMessageBox.StandardButton.Ignore) + if reply == QMessageBox.StandardButton.Abort: + self.criticalLabel.setText("Abort") + elif reply == QMessageBox.StandardButton.Retry: + self.criticalLabel.setText("Retry") + else: + self.criticalLabel.setText("Ignore") + + def informationMessage(self): + reply = QMessageBox.information(self, + "QMessageBox.information()", Dialog.MESSAGE) + if reply == QMessageBox.StandardButton.Ok: + self.informationLabel.setText("OK") + else: + self.informationLabel.setText("Escape") + + def questionMessage(self): + reply = QMessageBox.question(self, "QMessageBox.question()", + Dialog.MESSAGE, + QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No | QMessageBox.StandardButton.Cancel) + if reply == QMessageBox.StandardButton.Yes: + self.questionLabel.setText("Yes") + elif reply == QMessageBox.StandardButton.No: + self.questionLabel.setText("No") + else: + self.questionLabel.setText("Cancel") + + def warningMessage(self): + msgBox = QMessageBox(QMessageBox.Icon.Warning, "QMessageBox.warning()", + Dialog.MESSAGE, QMessageBox.StandardButton.NoButton, self) + msgBox.addButton("Save &Again", QMessageBox.ButtonRole.AcceptRole) + msgBox.addButton("&Continue", QMessageBox.ButtonRole.RejectRole) + if msgBox.exec() == QMessageBox.ButtonRole.AcceptRole: + self.warningLabel.setText("Save Again") + else: + self.warningLabel.setText("Continue") + + def errorMessage(self): + self.errorMessageDialog.showMessage("This dialog shows and remembers " + "error messages. If the checkbox is checked (as it is by " + "default), the shown message will be shown again, but if the " + "user unchecks the box the message will not appear again if " + "QErrorMessage.showMessage() is called with the same message.") + self.errorLabel.setText("If the box is unchecked, the message won't " + "appear again.") + + +if __name__ == '__main__': + app = QApplication(sys.argv) + dialog = Dialog() + dialog.show() + sys.exit(app.exec()) diff --git a/examples/dialogs/tabdialog.py b/examples/dialogs/tabdialog.py new file mode 100644 index 0000000..01e8dcf --- /dev/null +++ b/examples/dialogs/tabdialog.py @@ -0,0 +1,207 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import QFileInfo +from PyQt6.QtWidgets import (QApplication, QCheckBox, QDialog, + QDialogButtonBox, QFrame, QGroupBox, QLabel, QLineEdit, QListWidget, + QTabWidget, QVBoxLayout, QWidget) + + +class TabDialog(QDialog): + def __init__(self, fileName, parent=None): + super().__init__(parent) + + fileInfo = QFileInfo(fileName) + + tabWidget = QTabWidget() + tabWidget.addTab(GeneralTab(fileInfo), "General") + tabWidget.addTab(PermissionsTab(fileInfo), "Permissions") + tabWidget.addTab(ApplicationsTab(fileInfo), "Applications") + + buttonBox = QDialogButtonBox( + QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel) + + buttonBox.accepted.connect(self.accept) + buttonBox.rejected.connect(self.reject) + + mainLayout = QVBoxLayout() + mainLayout.addWidget(tabWidget) + mainLayout.addWidget(buttonBox) + self.setLayout(mainLayout) + + self.setWindowTitle("Tab Dialog") + + +class GeneralTab(QWidget): + def __init__(self, fileInfo, parent=None): + super().__init__(parent) + + fileNameLabel = QLabel("File Name:") + fileNameEdit = QLineEdit(fileInfo.fileName()) + + pathLabel = QLabel("Path:") + pathValueLabel = QLabel(fileInfo.absoluteFilePath()) + pathValueLabel.setFrameStyle(QFrame.Shape.Panel | QFrame.Shadow.Sunken) + + sizeLabel = QLabel("Size:") + size = fileInfo.size() // 1024 + sizeValueLabel = QLabel("%d K" % size) + sizeValueLabel.setFrameStyle(QFrame.Shape.Panel | QFrame.Shadow.Sunken) + + lastReadLabel = QLabel("Last Read:") + lastReadValueLabel = QLabel(fileInfo.lastRead().toString()) + lastReadValueLabel.setFrameStyle( + QFrame.Shape.Panel | QFrame.Shadow.Sunken) + + lastModLabel = QLabel("Last Modified:") + lastModValueLabel = QLabel(fileInfo.lastModified().toString()) + lastModValueLabel.setFrameStyle( + QFrame.Shape.Panel | QFrame.Shadow.Sunken) + + mainLayout = QVBoxLayout() + mainLayout.addWidget(fileNameLabel) + mainLayout.addWidget(fileNameEdit) + mainLayout.addWidget(pathLabel) + mainLayout.addWidget(pathValueLabel) + mainLayout.addWidget(sizeLabel) + mainLayout.addWidget(sizeValueLabel) + mainLayout.addWidget(lastReadLabel) + mainLayout.addWidget(lastReadValueLabel) + mainLayout.addWidget(lastModLabel) + mainLayout.addWidget(lastModValueLabel) + mainLayout.addStretch(1) + self.setLayout(mainLayout) + + +class PermissionsTab(QWidget): + def __init__(self, fileInfo, parent=None): + super().__init__(parent) + + permissionsGroup = QGroupBox("Permissions") + + readable = QCheckBox("Readable") + if fileInfo.isReadable(): + readable.setChecked(True) + + writable = QCheckBox("Writable") + if fileInfo.isWritable(): + writable.setChecked(True) + + executable = QCheckBox("Executable") + if fileInfo.isExecutable(): + executable.setChecked(True) + + ownerGroup = QGroupBox("Ownership") + + ownerLabel = QLabel("Owner") + ownerValueLabel = QLabel(fileInfo.owner()) + ownerValueLabel.setFrameStyle( + QFrame.Shape.Panel | QFrame.Shadow.Sunken) + + groupLabel = QLabel("Group") + groupValueLabel = QLabel(fileInfo.group()) + groupValueLabel.setFrameStyle( + QFrame.Shape.Panel | QFrame.Shadow.Sunken) + + permissionsLayout = QVBoxLayout() + permissionsLayout.addWidget(readable) + permissionsLayout.addWidget(writable) + permissionsLayout.addWidget(executable) + permissionsGroup.setLayout(permissionsLayout) + + ownerLayout = QVBoxLayout() + ownerLayout.addWidget(ownerLabel) + ownerLayout.addWidget(ownerValueLabel) + ownerLayout.addWidget(groupLabel) + ownerLayout.addWidget(groupValueLabel) + ownerGroup.setLayout(ownerLayout) + + mainLayout = QVBoxLayout() + mainLayout.addWidget(permissionsGroup) + mainLayout.addWidget(ownerGroup) + mainLayout.addStretch(1) + self.setLayout(mainLayout) + + +class ApplicationsTab(QWidget): + def __init__(self, fileInfo, parent=None): + super().__init__(parent) + + topLabel = QLabel("Open with:") + + applicationsListBox = QListWidget() + applications = [] + + for i in range(1, 31): + applications.append("Application %d" % i) + + applicationsListBox.insertItems(0, applications) + + alwaysCheckBox = QCheckBox() + + if fileInfo.suffix(): + alwaysCheckBox = QCheckBox("Always use this application to open " + "files with the extension '%s'" % fileInfo.suffix()) + else: + alwaysCheckBox = QCheckBox("Always use this application to open " + "this type of file") + + layout = QVBoxLayout() + layout.addWidget(topLabel) + layout.addWidget(applicationsListBox) + layout.addWidget(alwaysCheckBox) + self.setLayout(layout) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + + if len(sys.argv) >= 2: + fileName = sys.argv[1] + else: + fileName = "." + + tabdialog = TabDialog(fileName) + tabdialog.show() + sys.exit(app.exec()) diff --git a/examples/dialogs/trivialwizard.py b/examples/dialogs/trivialwizard.py new file mode 100644 index 0000000..a03b80c --- /dev/null +++ b/examples/dialogs/trivialwizard.py @@ -0,0 +1,111 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtWidgets import (QApplication, QGridLayout, QLabel, QLineEdit, + QVBoxLayout, QWizard, QWizardPage) + + +def createIntroPage(): + page = QWizardPage() + page.setTitle("Introduction") + + label = QLabel( + "This wizard will help you register your copy of Super Product " + "Two.") + label.setWordWrap(True) + + layout = QVBoxLayout() + layout.addWidget(label) + page.setLayout(layout) + + return page + + +def createRegistrationPage(): + page = QWizardPage() + page.setTitle("Registration") + page.setSubTitle("Please fill both fields.") + + nameLabel = QLabel("Name:") + nameLineEdit = QLineEdit() + + emailLabel = QLabel("Email address:") + emailLineEdit = QLineEdit() + + layout = QGridLayout() + layout.addWidget(nameLabel, 0, 0) + layout.addWidget(nameLineEdit, 0, 1) + layout.addWidget(emailLabel, 1, 0) + layout.addWidget(emailLineEdit, 1, 1) + page.setLayout(layout) + + return page + + +def createConclusionPage(): + page = QWizardPage() + page.setTitle("Conclusion") + + label = QLabel("You are now successfully registered. Have a nice day!") + label.setWordWrap(True) + + layout = QVBoxLayout() + layout.addWidget(label) + page.setLayout(layout) + + return page + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + + wizard = QWizard() + wizard.addPage(createIntroPage()) + wizard.addPage(createRegistrationPage()) + wizard.addPage(createConclusionPage()) + + wizard.setWindowTitle("Trivial Wizard") + wizard.show() + + sys.exit(app.exec()) diff --git a/examples/draganddrop/delayedencoding/delayedencoding.py b/examples/draganddrop/delayedencoding/delayedencoding.py new file mode 100644 index 0000000..ab26633 --- /dev/null +++ b/examples/draganddrop/delayedencoding/delayedencoding.py @@ -0,0 +1,135 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited +## Copyright (C) 2010 Hans-Peter Jansen . +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import os + +from PyQt6.QtCore import (pyqtSignal, QBuffer, QByteArray, QFile, QIODevice, + QMimeData, Qt) +from PyQt6.QtGui import QDrag, QIcon, QImage, QPainter, QPixmap +from PyQt6.QtWidgets import (QApplication, QGridLayout, QLabel, QPushButton, + QScrollArea, QWidget) +from PyQt6.QtSvgWidgets import QSvgWidget + + +class MimeData(QMimeData): + + dataRequested = pyqtSignal(str) + + def formats(self): + formats = super().formats() + formats.append('image/png') + + return formats + + def retrieveData(self, mimeType, qvtype): + self.dataRequested.emit(mimeType) + + return super().retrieveData(mimeType, qvtype) + + +class SourceWidget(QWidget): + def __init__(self, parent=None): + super().__init__(parent) + + self.images_dir = os.path.join(os.path.dirname(__file__), 'images') + self.mimeData = None + + imageFile = QFile(os.path.join(self.images_dir, 'example.svg')) + imageFile.open(QIODevice.OpenModeFlag.ReadOnly) + self.imageData = imageFile.readAll() + imageFile.close() + + imageArea = QScrollArea() + self.imageLabel = QSvgWidget() + self.imageLabel.renderer().load(self.imageData) + imageArea.setWidget(self.imageLabel) + + instructTopLabel = QLabel("This is an SVG drawing:") + instructBottomLabel = QLabel("Drag the icon to copy the drawing as a PNG file:") + dragIcon = QPushButton("Export") + dragIcon.setIcon(QIcon(os.path.join(self.images_dir, 'drag.png'))) + dragIcon.pressed.connect(self.startDrag) + + layout = QGridLayout() + layout.addWidget(instructTopLabel, 0, 0, 1, 2) + layout.addWidget(imageArea, 1, 0, 2, 2) + layout.addWidget(instructBottomLabel, 3, 0) + layout.addWidget(dragIcon, 3, 1) + self.setLayout(layout) + self.setWindowTitle("Delayed Encoding") + + def createData(self, mimeType): + if mimeType != 'image/png': + return + + image = QImage(self.imageLabel.size(), QImage.Format.Format_RGB32) + painter = QPainter() + painter.begin(image) + self.imageLabel.renderer().render(painter) + painter.end() + + data = QByteArray() + buffer = QBuffer(data) + buffer.open(QIODevice.OpenModeFlag.WriteOnly) + image.save(buffer, 'PNG') + buffer.close() + self.mimeData.setData('image/png', data) + + def startDrag(self): + self.mimeData = MimeData() + self.mimeData.dataRequested.connect(self.createData, + Qt.ConnectionType.DirectConnection) + + drag = QDrag(self) + drag.setMimeData(self.mimeData) + drag.setPixmap(QPixmap(os.path.join(self.images_dir, 'drag.png'))) + drag.exec(Qt.DropAction.CopyAction) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + window = SourceWidget() + window.show() + sys.exit(app.exec()) diff --git a/examples/draganddrop/delayedencoding/images/drag.png b/examples/draganddrop/delayedencoding/images/drag.png new file mode 100644 index 0000000000000000000000000000000000000000..dd795cfffc5c1ce273b3afedb5ed01da3fc5668c GIT binary patch literal 977 zcmV;?11|iDP)bWCsWYp)^2+5pE&16P)J5wbOa;T^94~jGe@$^;8|{N*-xE=iGD7yYG#t zD);gVxW`xYe;#`OHF@&p7Liq?Fv=6g5~?BqQNT@!pB*cZ>hN`{7r7 z0@PL2_61PYzIFCAKdP##I$yS{oLX(QZfdoPWw^&}T5r!d$9(p=D`Njv29iHLkmyYoqFd-sx$01C;)-KSr9NW?hA@p%q*ht6 zmBq{Ur!PNBt}Oo0xOA02fK^~?NCng%Kounf3J6mu2dGt6?ZW)I`_c{m0&2h#@Q*)+)q%|+6*xkz zvTPUT&+i3#9k}X2>%fKw-O>SHJ_8A?H#zstslxR28`z&KEbRfh;$?0CiQdK+@4!zp z5h(%3fWyEo4>%O)?GhLPrv1^{dTECO&0hZj`DhT15m$C300000NkvXXu0mjfIXk#o literal 0 HcmV?d00001 diff --git a/examples/draganddrop/delayedencoding/images/example.svg b/examples/draganddrop/delayedencoding/images/example.svg new file mode 100644 index 0000000..8bc147d --- /dev/null +++ b/examples/draganddrop/delayedencoding/images/example.svg @@ -0,0 +1,59 @@ + + + + Sphere + A gradient filled sphere. + + + + + + + + + + + + diff --git a/examples/draganddrop/draggableicons/draggableicons.py b/examples/draganddrop/draggableicons/draggableicons.py new file mode 100644 index 0000000..a1a98ef --- /dev/null +++ b/examples/draganddrop/draggableicons/draggableicons.py @@ -0,0 +1,163 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import os + +from PyQt6.QtCore import (QByteArray, QDataStream, QIODevice, QMimeData, + QPoint, Qt) +from PyQt6.QtGui import QColor, QDrag, QPainter, QPixmap +from PyQt6.QtWidgets import QApplication, QFrame, QHBoxLayout, QLabel, QWidget + + +class DragWidget(QFrame): + def __init__(self, parent=None): + super().__init__(parent) + + images_dir = os.path.join(os.path.dirname(__file__), 'images') + self._images_dir = images_dir + + self.setMinimumSize(200, 200) + self.setFrameStyle(QFrame.Shadow.Sunken | QFrame.Shape.StyledPanel) + self.setAcceptDrops(True) + + boatIcon = QLabel(self) + boatIcon.setPixmap(QPixmap(os.path.join(images_dir, 'boat.png'))) + boatIcon.move(10, 10) + boatIcon.show() + boatIcon.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) + + carIcon = QLabel(self) + carIcon.setPixmap(QPixmap(os.path.join(images_dir, 'car.png'))) + carIcon.move(100, 10) + carIcon.show() + carIcon.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) + + houseIcon = QLabel(self) + houseIcon.setPixmap(QPixmap(os.path.join(images_dir, 'house.png'))) + houseIcon.move(10, 80) + houseIcon.show() + houseIcon.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) + + def dragEnterEvent(self, event): + if event.mimeData().hasFormat('application/x-dnditemdata'): + if event.source() is self: + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + else: + event.acceptProposedAction() + else: + event.ignore() + + dragMoveEvent = dragEnterEvent + + def dropEvent(self, event): + if event.mimeData().hasFormat('application/x-dnditemdata'): + itemData = event.mimeData().data('application/x-dnditemdata') + dataStream = QDataStream(itemData, QIODevice.OpenModeFlag.ReadOnly) + + pixmap = QPixmap() + offset = QPoint() + dataStream >> pixmap >> offset + + newIcon = QLabel(self) + newIcon.setPixmap(pixmap) + newIcon.move(event.position().toPoint() - offset) + newIcon.show() + newIcon.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) + + if event.source() is self: + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + else: + event.acceptProposedAction() + else: + event.ignore() + + def mousePressEvent(self, event): + child = self.childAt(event.position().toPoint()) + if not child: + return + + pixmap = child.pixmap() + + itemData = QByteArray() + dataStream = QDataStream(itemData, QIODevice.OpenModeFlag.WriteOnly) + dataStream << pixmap << QPoint(event.position().toPoint() - child.pos()) + + mimeData = QMimeData() + mimeData.setData('application/x-dnditemdata', itemData) + + drag = QDrag(self) + drag.setMimeData(mimeData) + drag.setPixmap(pixmap) + drag.setHotSpot(event.position().toPoint() - child.pos()) + + tempPixmap = QPixmap(pixmap) + painter = QPainter() + painter.begin(tempPixmap) + painter.fillRect(pixmap.rect(), QColor(127, 127, 127, 127)) + painter.end() + + child.setPixmap(tempPixmap) + + if drag.exec(Qt.DropAction.CopyAction | Qt.DropAction.MoveAction, Qt.DropAction.CopyAction) == Qt.DropAction.MoveAction: + child.close() + else: + child.show() + child.setPixmap(pixmap) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + + mainWidget = QWidget() + horizontalLayout = QHBoxLayout() + horizontalLayout.addWidget(DragWidget()) + horizontalLayout.addWidget(DragWidget()) + + mainWidget.setLayout(horizontalLayout) + mainWidget.setWindowTitle("Draggable Icons") + mainWidget.show() + + sys.exit(app.exec()) diff --git a/examples/draganddrop/draggableicons/images/boat.png b/examples/draganddrop/draggableicons/images/boat.png new file mode 100644 index 0000000000000000000000000000000000000000..46c894f06bce2aabfb7968c9fdfbec0098bf77c5 GIT binary patch literal 2772 zcmYk6c{~&TAIInTV$3nEh+JU}6{04JuwjPDnR2EUC1vj9$Tdx_$vw%PgvwRR5QZFc zHb==>xf{t`<43>m@A3G39*@uG^Uvq`K3|{rV{0|0olPzYTsw{K&aeCAd|N86MQ7>{5pW#9X3u>CD&;%Z<+p~FT(>e|xiuzwJ2 z5s^m?C66vtSzqgW!!=j}hP1e0iL|xDIi_XoO>gUT5r{xoUVKICQ!mcLMoag8J@&8R zYg)#+5Fh^Truox0X-w80lN3aw{48IKJGsZ2B&e&qKf4&zT7grDl2HuR0J(hLUt?os zJAQtC*F~MebzL;nE7y<_&~*QfM3F8=K zeMlnv&s=f$>!oFzR=ZPH`d(55Rr^})z?+G-*H})YxA!0tl_s(ypS3Ws@Inu98Tk^>x4M<*tts`e3^!lUps2xV^U)g%>4MF9k`09w$tRyigXq&00M(=d7?j^=q4`?$Ap22 zYlQr1b&)irSob<52whsLCFu`pB`ESMUVMXd_848eR^+nNA#X~4W#B;PzKn)NN8RCn z`XtqE`qYfpMRZDvc`w?;grw<9sI73iF|kvM9C1TDPphcNDUJ2Eun-oIkdT-!&xz>l zjdaA}&NTbxSNk@%I&p7O0!>4CsLul^g;CIB_nSAjKlVm`+xoMB7nE|ev5A(bgq{vq zAz@iEkci_c>XTt#CX%d@bAc4!1^US7sExI?DsY58O^3R%f6XG`%s~XJ{zwi_4MAa) zdtz#8WF)7SmR7G$$j-a!>J+4_=~wPE%@Hszq@sHh8=N$kmuTg6+4>g9)IeEVJ7lIk zX(D88wy!%2es7FSP4-*dUdaqQA4fj+uXAylPj3FatU`(Q11~SHe1kalm1ewPg;PVw z_WF`I+|$QTJI=0heGI^i&ig+vdWPguEh6#i8hM6$c6fNWFW)etx~#0Mun-9Xb3VHe zctFj4nrG8?=~X=gK+sJx&Wuc$!uW>^5yB#^jjmD{SDJexpV^d3X!&^{k^j_M z1_xi9?uDTTyx;E&cgRWS%6mmkm@};~{N&$aDtHj9|}jQ1*MaI-Nnrl$P1tSM@&F9lfU?>R1z5OWir6=tEJxefsnY!1)@*^+k8KA*E` zxxkAwF{nv;qqmyBnXm8Jq3!UK)fAw>SKCoW%A?(7k=6BlQAi0SIEWz3&ux(y<0Drc zUT|Y~#%lJI1KDS)<#AzQ;j2R@AK1_RemhuqiQ#ewG+?0j3JO0&eQs1Z`>hnFx*`Lf zGcvyID)&-VU4VS!6A_gRO?moMCH7sFM{f!X=;;xV>jG{CDOjK^8^%zN#1CErt{~p# z*u69{^NQWx-o`w;@c!Mq^i6$jx~3|YbmO~NPcY^y-%9|dE5-xef zCJG8;!_=i+J%>(Foe|2MRf#$_FuKEooteWljN|y^bci-{bQRMw=G1UNl z_5}zk4{>hfkTYikc{KW8+2mUje+Hj* zzv%27lrmL1|IE=3=Rfz@!ENO6n10bX_QHGdznTGXUAV+<-PKiZBNkPFt5YHro3WZd zeQ&dbJ{f6{&3(VoyEzaPn^2sVGa5m}h(?qdAGhEDi0-$uG3>+!4Brk_x~Z&HZ_z9d z?v%z4G>nt)4x?+l$M0*g0&lxsHkRItb3a%LJ?GfzaM@`;IWAyk<`1P4r8RdpLBPLsUu3WI4BNCVa3G{&1=Q6sh zJLhF~VG=~{xCDwi9((e^x3`OO9RdB{KKQ3Gef(sWcq^uogJ?P3?R(oaZ>NU^TB(i! z>ipE#Mk$V*G7vT(`u@Sl!kTrmWe19fo`58$GW&ZHwY;=5?wcw#w|zlsw>R@fzQ7GUjd@2%$H?;MyG*DV zr+o^vba{}Mrrq8D)ZRv=q>1d#%1TCPD6g&r1})oTFc@XQgg{A2N9@7{a&OY|RD<|x z6a7462!6PJI_n`pOj;VOOVtrVDb}ZF)IIjQ27B2MC`b)G)WEl@6Zx}#((9x6{v-qd NP)IXGxt??Qe*naBHSYib literal 0 HcmV?d00001 diff --git a/examples/draganddrop/draggableicons/images/car.png b/examples/draganddrop/draggableicons/images/car.png new file mode 100644 index 0000000000000000000000000000000000000000..3cb35e56cb9b18e4a43eb0a44b728207dd9baf4a GIT binary patch literal 2963 zcmV;E3vBd>P)001@!0ssI20Fd*d000YGNkl(J24Msl{olG zUU7miOi<}b;J`&T;VEP#l|<7_)NHdbC< z&bIJb2uF5!O95KL}XT)rRGXwjt(^s8uJ2yK!1Nf>Ty3OM}g{B ziG0(Pvt(LF%dlv}G!3h%m~7>8xjH*L>+0(4M)DN^uj*ZjdO5mcUR70^NvbfGU?ks;jt-9Z?%lgZsj6Oqg-aZp*_TqKDB-^s7N>N2@18w~ z4h;=4qz+SXVeEat9z17yn9!nSYth>t0N-DkI!r|~AgM*qktdPh;oH>2E|IVG3mX@C0-gqn~ z;Ak#~BVjo+tJug7epy>m@@Qm)B^@Ip*zo7f%wyB+=;@gW1VEK(OjQ7(WyYzUA={ zZ9#=FRSG+&r>BV_9N^0u2=+-+gf?yZy{l{e`t@vx32LFK2-LjEiHV(6RSl_B)4_w$ zWK!M{5=H?EFaiRbrd|h4eM`$vwY8NSHgK;w5VPdxAS{{W{5<*gd3!sf9~v6skqAqm zgvXWK?#}`kLBDYBDVUr z{QE#P0vOnU#{>+Km;uRQuR@=kIPuQZ)b~E$cqn8r#=@7|bi?KCynOZ8172VQ9uqKx zp_CX0bNaLog~JV7ws7_`f7l?TDUsU*ija#+=1htF(qa&F6?`F#h5s!9j|mte9GYo= zd{Ad2$)v6k=O|&%KqzgR%sM4qI1ss+C$q{>$qcO=1)#cAk&UB90tFL{;$kgMnHXvb zRu|g|dr5;Zq&o9&TI-StGKLDXe_obL8 zAlbISG*N*f)S(m_0O*kCjwn-{|Nru4Jg3f+PLs!gmC!{l*RA2T7`*@+_5q4d~|8*RhGz%VUH>UYf_c^(UqeGbK9 zd?ra?KZLB|{Q>`2YwH*H?{7GAq}lJk*xr8T(xtH-JNCD>o*x+Sx?JP~@sz7o(_WK* zk>jmXwzEVMx=oY6jvlA;+`W4rw6&oEMW{n5ssR8Dz~o!N6uRsH9}^%{S0;uGQt9;2 z)KszcuoRBC#9@`$k6K!0%FF*A9K3k`{D=GZ*Hly-JAC-&l`FsAy!qq!_;+{jIt*iI zX2#%ugBU5LOEXU^Azc$prvw0LSy=en=x8XNzA!Lw;mH#=M+J&dhf-7n02qJ)Ql11{ zyki|vz+(c2=Q@faq_jETM}Zyqs`I0Y$!yD+8@cxl0;9|=N`=+vyL z&R`g1G68jytc_JlKwM-Kf*7qUH`+zVmZTFx#6(S~P#2ORLKcaLX$`4KC++md9CCAc zkLpleO?tSC^X@(8fBxs)d*6d|FPaGNzQ3>U#_HYm6gvsHEgvDmD4&kx^WXyG)Ay^PstP$z0MaEiV2s zoj#LH)&v6IJ%0Sd_&DH%qfR3c(IEg0$n;K4ec6Uro(QB=SpR<9s;$Yg5z1aCq;|owrgcsTw(I>{J}+|2h^sX_}Xh9))nSt}Yvo z|JK_2A{t$bMqkh(k=54LOgw(Bx|)WQ;tt3u(`=5#fCZcoxpwiLKEpo!-&^z-s$+fn&C(X_4vDo0TW97jhKJGIK!9sa3 zKW}=yFWcI#*fw*1tG+(l(UDCgvKKDUP_pOGXD?ptIDD9f!lN3ZVT=ooxB~(dfWQj4 z`{aXx1Hs^R+lC$_p(^P?9!ipk*zeGtRg(8+W(>oy4dWBP|8vUy%}E83@o$(oFLU)2!RSpD`K=kMz^T24nHU9T1=Zbf3&1iUyQE z^mw2LN!#y-FtqjbL_B(Z8l4I(b8;jUnx3Bi>CPSbRouRLbM@&{-Aq?hX~X05HD0>3 z+vjW8wTs^0Ga2`}#p&FK?hn2MTBq#Tuc*`Iy#8EY|F*juz<>KyitqE~d=(Z%F4qaloy@2tdwY91_X>qV?d|PdU0sn#q_VOy7z}bqq~dMy zrh=X%uz(YSK!hVGp&>xpVxzXz1}8I{%%MIi?{Z~jWnf?+nv+B#LDf_hd zshgOXAdo~PGz27^%59@L%>Sl>Sj#qWh}wJGds9Kyyqmh7UOqP!@;yJ)*^nn9pIJ!g zF}CYIjr)_XM27M|KYR~vn-mqa{C{(=Af)i`2p9f7Ed1M-{{Z`Iz&EiFAB+G1002ov JPDHLkV1ij+#9aUY literal 0 HcmV?d00001 diff --git a/examples/draganddrop/draggableicons/images/house.png b/examples/draganddrop/draggableicons/images/house.png new file mode 100644 index 0000000000000000000000000000000000000000..ee9d5b11598b8021af04ecad1651541b97e7239c GIT binary patch literal 3292 zcmV<23?uW2P)001@!0ssI20Fd*d000c5Nklr zR`0&8U$0wt&lWKzjfn`R`3)Dj{nYQ7PNmpO>8ej`oNALMxR_=vBc&8Vz|$CGX?~`Q z)Y7klBEPI<;<=c>RMCbx_d<27#|-Gf&hgh1|47>g zRlytx?}Jrq)~{|;MkR>6Muc< zx<%I$13t*<%|6kT8BNe!6^3Cpo4xqK1%TJrKKb0^1Nr=TWQ=m!MPNvZEJH$Ifshn= zSgNGgw!7t71B+5V|M|pPj{u9UFykRkeoZc);ZlfZ0S4f%QfpT6rcdmDB|Hh7J@1vXYqZ1_@ z*nqUruq~0MO(8?7A}|b`DEwK7%m>9@)Q#5W#_dlZJajp85WhCaOW zXU_t>flmF4hc{jwMtC$UFzt7tg0rUdnE11<#P(%7WT6^68d)QOgsJyFyz!g658u3| z4?r$nvV=j-B3d|j=gyu1<@{WS+4CU5ld3FU#Zaulq8OAFW=czeaKL3Eju38(mG#+0 z5hWFZoP74djSuZP)VsD1)U|ubQs41Zi_n+e*)ssI@2*a{d;2DUCxl{n9uv$o{5bko zOvx>&0i$PxWX9fdNNSw`xo7*PhxZ=pT>~JGE?JrYIYT_8I!7roW@6fb@-JJV*t6dr-vA3 zo17{h`tSw^-@j#T-#s0frytlbG%^95R7pIV7SwkjOnOkLS(-=ISIH(wwC%0g>(Wc! z_rQo6U4Q_Ve*VCQN1s2uYVGas9zWXCv&>0yx_HR&-hU6I_l3^fQ`_#mGCC=w^_(0s z85bLrzxhmSsTCp1(BQ*u_oQU6$_kRwaVJS5+L{}_^}_3a{IGZeKrUPEOOkzQT6*ul zclwrfeVaS#pWJ%q(C`GjCwMG7hFHd&jBnhAKqTbM5*C$K$I34g66W_5oRqW4q2bA= zwr<$*+t*8yJa%;1@)ZswB(_5z-sw}PZn?exiyig5?!RMb43tyyrh(&=NG0aP-wAo_ zRaV(9R$!@v<+M}4gW3aW+UGPr_TrJ3E`R*)TW_vdxsre|LU&>ag5bT=r*7-JW81=} zU0>QTG&)Yw(?&yUrBYf-vPi~l!59QrGC~$2=_ZvVZ&w)!>4P0XRxFU#C4?kNNbSu{ zkNy7e3zx>}edlzn?tWw{f617jM7ura%4dl(edx&1QliS14*J+2R-A4_R1H4_XC`mfjbj1DCcynsUj>_v^-!UPPnhc^l5K|B|0_CR0Ki+ zP^DyNXWN3-`C9Arr7bzChK4$TQtoc8)o2+g6J(UP>6g5FL%ejx)*8k!&>rJ4ts*ir zEyJ_1Lt1lQPt5QjZ%of5LR*E0S^#KrLv>=@_QYq!XVL}Syl7=dcIfF_%dDB&TDmglEPsZfQ*$jF~-6 zbuvUu3ML>3xWW>PqN>F0v4f?J;LV_gh^#4;V7W?QU&_QNz*a!lHXiy~N^4974hc3M zvhcBrw_1kv+R`Z77&CGNPwI``(A;9_O^rJO*3z1K8iQJj%4Y3QOQEHbBEaJYJg53I zZJ?l|r`1mD(8G$zh!`mU1nK+@RtZ*ea;BD6<gLAa zN8ewV&!2?e$Opss&lX$z8&}^vZ)_|K&^?xtb~_{_bW(-{iJ}TM)3zDm*T~F&zz)k9 zhnBH6nLysVp(T@Pv-cLl9b)~djE=`AqA+xqxpo{PP=-)vZ@8QT_wA6oxMIyCK4j(8 z3?Pw17#YD$G2eN!dXV%9h6<>?H<~7$mleL0nmau+6ZNGk%(pp`ERgU!EhUaqo(8Ke_gDqA=GnQss47+|V-v^jOPTw&D`Xx&$fwOL|H= zDMMq0<7ufdijVv>qe;t9kxkUn4tWkbb#sMsF~FiiWY`Q5Cjb1&2+2ibW-U#!9TTK9 z!W!OUV8K%_k-Em#-gO||sku!uiI8dx?{6UEkGYo|>xiIv5eb_};_QuUSDT$Tp2m{r zmxTV(OTI!fnnfbhxL52QS_2-aTd z5+1(vwl~1B7GWsyd|={G$B{Nx8YFWPxiSK(fPi@^(@4-An9(&o zX2qSX_@YI)!yVsBB$rko!q$1&rp9b8BU&38V_k}ucIEhTI~%AlQrT=Ue{K$DFNA1_ z*d2<%611!h!c0b-;;(Dkh`Eiy+b2gajmUk+|8cDt zDbIG?<$s{$wL)}lyzug0F0{-EBHV>j_xa5^UsGO|5L;v}u$b~;H#RaWZ(6= 195: + x = 5 + y += wordLabel.height() + 2 + + newPalette = self.palette() + newPalette.setColor(QPalette.ColorRole.Window, Qt.GlobalColor.white) + self.setPalette(newPalette) + + self.setAcceptDrops(True) + self.setMinimumSize(400, max(200, y)) + self.setWindowTitle("Draggable Text") + + def dragEnterEvent(self, event): + if event.mimeData().hasText(): + if event.source() in self.children(): + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + else: + event.acceptProposedAction() + else: + event.ignore() + + def dropEvent(self, event): + if event.mimeData().hasText(): + mime = event.mimeData() + pieces = mime.text().split() + position = event.position().toPoint() + hotSpot = QPoint() + + hotSpotPos = mime.data('application/x-hotspot').split(b' ') + if len(hotSpotPos) == 2: + hotSpot.setX(hotSpotPos[0].toInt()[0]) + hotSpot.setY(hotSpotPos[1].toInt()[0]) + + for piece in pieces: + newLabel = DragLabel(piece, self) + newLabel.move(position - hotSpot) + newLabel.show() + + position += QPoint(newLabel.width(), 0) + + if event.source() in self.children(): + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + else: + event.acceptProposedAction() + else: + event.ignore() + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + window = DragWidget() + window.show() + sys.exit(app.exec()) diff --git a/examples/draganddrop/draggabletext/words.txt b/examples/draganddrop/draggabletext/words.txt new file mode 100644 index 0000000..19b8b03 --- /dev/null +++ b/examples/draganddrop/draggabletext/words.txt @@ -0,0 +1,41 @@ +Qt +Quarterly +is +a +paper +based +newsletter +exclusively +available +to +Qt +customers +Every +quarter +we +mail +out +an +issue +that +we +hope +will +bring +added +insight +and +pleasure +to +your +Qt +programming +with +high +quality +technical +articles +written +by +Qt +experts diff --git a/examples/draganddrop/dropsite.py b/examples/draganddrop/dropsite.py new file mode 100644 index 0000000..44ea964 --- /dev/null +++ b/examples/draganddrop/dropsite.py @@ -0,0 +1,180 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited +## Copyright (C) 2010 Hans-Peter Jansen . +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import pyqtSignal, QMimeData, Qt +from PyQt6.QtGui import QPalette, QPixmap +from PyQt6.QtWidgets import (QAbstractItemView, QApplication, QDialogButtonBox, + QFrame, QLabel, QPushButton, QTableWidget, QTableWidgetItem, + QVBoxLayout, QWidget) + + +class DropArea(QLabel): + + changed = pyqtSignal(QMimeData) + + def __init__(self, parent = None): + super().__init__(parent) + + self.setMinimumSize(200, 200) + self.setFrameStyle(QFrame.Shadow.Sunken | QFrame.Shape.StyledPanel) + self.setAlignment(Qt.AlignmentFlag.AlignCenter) + self.setAcceptDrops(True) + self.setAutoFillBackground(True) + self.clear() + + def dragEnterEvent(self, event): + self.setText("") + self.setBackgroundRole(QPalette.ColorRole.Highlight) + event.acceptProposedAction() + self.changed.emit(event.mimeData()) + + def dragMoveEvent(self, event): + event.acceptProposedAction() + + def dropEvent(self, event): + mimeData = event.mimeData() + if mimeData.hasImage(): + self.setPixmap(QPixmap(mimeData.imageData())) + elif mimeData.hasHtml(): + self.setText(mimeData.html()) + self.setTextFormat(Qt.TextFormat.RichText) + elif mimeData.hasText(): + self.setText(mimeData.text()) + self.setTextFormat(Qt.TextFormat.PlainText) + elif mimeData.hasUrls(): + self.setText("\n".join([url.path() for url in mimeData.urls()])) + else: + self.setText("Cannot display data") + + self.setBackgroundRole(QPalette.ColorRole.Dark) + event.acceptProposedAction() + + def dragLeaveEvent(self, event): + self.clear() + event.accept() + + def clear(self): + self.setText("") + self.setBackgroundRole(QPalette.ColorRole.Dark) + self.changed.emit(None) + + +class DropSiteWindow(QWidget): + + def __init__(self): + super().__init__() + + self.abstractLabel = QLabel( + "This example accepts drags from other applications and " + "displays the MIME types provided by the drag object.") + self.abstractLabel.setWordWrap(True) + self.abstractLabel.adjustSize() + + self.dropArea = DropArea() + self.dropArea.changed.connect(self.updateFormatsTable) + + self.formatsTable = QTableWidget() + self.formatsTable.setColumnCount(2) + self.formatsTable.setEditTriggers( + QAbstractItemView.EditTrigger.NoEditTriggers) + self.formatsTable.setHorizontalHeaderLabels(["Format", "Content"]) + self.formatsTable.horizontalHeader().setStretchLastSection(True) + + self.clearButton = QPushButton("Clear") + self.quitButton = QPushButton("Quit") + + self.buttonBox = QDialogButtonBox() + self.buttonBox.addButton(self.clearButton, + QDialogButtonBox.ButtonRole.ActionRole) + self.buttonBox.addButton(self.quitButton, + QDialogButtonBox.ButtonRole.RejectRole) + + self.quitButton.pressed.connect(self.close) + self.clearButton.pressed.connect(self.dropArea.clear) + + mainLayout = QVBoxLayout() + mainLayout.addWidget(self.abstractLabel) + mainLayout.addWidget(self.dropArea) + mainLayout.addWidget(self.formatsTable) + mainLayout.addWidget(self.buttonBox) + self.setLayout(mainLayout) + + self.setWindowTitle("Drop Site") + self.setMinimumSize(350, 500) + + def updateFormatsTable(self, mimeData=None): + self.formatsTable.setRowCount(0) + + if mimeData is None: + return + + for format in mimeData.formats(): + formatItem = QTableWidgetItem(format) + formatItem.setFlags(Qt.ItemFlag.ItemIsEnabled) + formatItem.setTextAlignment( + Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignLeft) + + if format == 'text/plain': + text = mimeData.text().strip() + elif format == 'text/html': + text = mimeData.html().strip() + elif format == 'text/uri-list': + text = " ".join([url.toString() for url in mimeData.urls()]) + else: + text = " ".join(["%02X" % ord(datum) for datum in mimeData.data(format)]) + + row = self.formatsTable.rowCount() + self.formatsTable.insertRow(row) + self.formatsTable.setItem(row, 0, QTableWidgetItem(format)) + self.formatsTable.setItem(row, 1, QTableWidgetItem(text)) + + self.formatsTable.resizeColumnToContents(0) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + window = DropSiteWindow() + window.show() + sys.exit(app.exec()) diff --git a/examples/draganddrop/fridgemagnets/fridgemagnets.py b/examples/draganddrop/fridgemagnets/fridgemagnets.py new file mode 100644 index 0000000..cc674f6 --- /dev/null +++ b/examples/draganddrop/fridgemagnets/fridgemagnets.py @@ -0,0 +1,190 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import os + +from PyQt6.QtCore import (QByteArray, QDataStream, QFile, QIODevice, QMimeData, + QPoint, QRect, QRectF, Qt, QTextStream) +from PyQt6.QtGui import (QDrag, QFont, QFontMetrics, QImage, QPainter, + QPalette, QPixmap, qRgba) +from PyQt6.QtWidgets import QApplication, QLabel, QWidget + + +class DragLabel(QLabel): + def __init__(self, text, parent): + super().__init__(parent) + + metric = QFontMetrics(self.font()) + size = metric.size(Qt.TextFlag.TextSingleLine, text) + + image = QImage(size.width() + 12, size.height() + 12, + QImage.Format.Format_ARGB32_Premultiplied) + image.fill(qRgba(0, 0, 0, 0)) + + font = QFont() + font.setStyleStrategy(QFont.StyleStrategy.ForceOutline) + + painter = QPainter() + painter.begin(image) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) + painter.setBrush(Qt.GlobalColor.white) + painter.drawRoundedRect( + QRectF(0.5, 0.5, image.width()-1, image.height()-1), + 25, 25, Qt.SizeMode.RelativeSize) + + painter.setFont(font) + painter.setBrush(Qt.GlobalColor.black) + painter.drawText(QRect(QPoint(6, 6), size), + Qt.AlignmentFlag.AlignCenter, text) + painter.end() + + self.setPixmap(QPixmap.fromImage(image)) + self.labelText = text + + def mousePressEvent(self, event): + itemData = QByteArray() + dataStream = QDataStream(itemData, QIODevice.OpenModeFlag.WriteOnly) + dataStream << QByteArray(self.labelText.encode('utf8')) << QPoint(event.position().toPoint() - self.rect().topLeft()) + + mimeData = QMimeData() + mimeData.setData('application/x-fridgemagnet', itemData) + mimeData.setText(self.labelText) + + drag = QDrag(self) + drag.setMimeData(mimeData) + drag.setHotSpot(event.position().toPoint() - self.rect().topLeft()) + drag.setPixmap(self.pixmap()) + + self.hide() + + if drag.exec(Qt.DropAction.MoveAction | Qt.DropAction.CopyAction, Qt.DropAction.CopyAction) == Qt.DropAction.MoveAction: + self.close() + else: + self.show() + + +class DragWidget(QWidget): + def __init__(self, parent=None): + super().__init__(parent) + + dictionaryFile = QFile( + os.path.join(os.path.dirname(__file__), 'words.txt')) + dictionaryFile.open(QFile.OpenModeFlag.ReadOnly) + + x = 5 + y = 5 + + for word in QTextStream(dictionaryFile).readAll().split(): + wordLabel = DragLabel(word, self) + wordLabel.move(x, y) + wordLabel.show() + x += wordLabel.width() + 2 + if x >= 245: + x = 5 + y += wordLabel.height() + 2 + + newPalette = self.palette() + newPalette.setColor(QPalette.ColorRole.Window, Qt.GlobalColor.white) + self.setPalette(newPalette) + + self.setMinimumSize(400, max(200, y)) + self.setWindowTitle("Fridge Magnets") + self.setAcceptDrops(True) + + def dragEnterEvent(self, event): + if event.mimeData().hasFormat('application/x-fridgemagnet'): + if event.source() in self.children(): + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + else: + event.acceptProposedAction() + elif event.mimeData().hasText(): + event.acceptProposedAction() + else: + event.ignore() + + dragMoveEvent = dragEnterEvent + + def dropEvent(self, event): + if event.mimeData().hasFormat('application/x-fridgemagnet'): + mime = event.mimeData() + itemData = mime.data('application/x-fridgemagnet') + dataStream = QDataStream(itemData, QIODevice.OpenModeFlag.ReadOnly) + + text = QByteArray() + offset = QPoint() + dataStream >> text >> offset + + text = str(text, encoding='utf8') + + newLabel = DragLabel(text, self) + newLabel.move(event.position().toPoint() - offset) + newLabel.show() + + if event.source() in self.children(): + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + else: + event.acceptProposedAction() + elif event.mimeData().hasText(): + pieces = event.mimeData().text().split() + position = event.position().toPoint() + + for piece in pieces: + newLabel = DragLabel(piece, self) + newLabel.move(position) + newLabel.show() + + position += QPoint(newLabel.width(), 0) + + event.acceptProposedAction() + else: + event.ignore() + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + window = DragWidget() + window.show() + sys.exit(app.exec()) diff --git a/examples/draganddrop/fridgemagnets/words.txt b/examples/draganddrop/fridgemagnets/words.txt new file mode 100644 index 0000000..a7e1632 --- /dev/null +++ b/examples/draganddrop/fridgemagnets/words.txt @@ -0,0 +1,48 @@ +Colorless +green +ideas +sleep +furiously +A +colorless +green +idea +is +a +new +untried +idea +that +is +without +vividness +dull +and +unexciting +To +sleep +furiously +may +seem +a +puzzling +turn +of +phrase +but +the +mind +in +sleep +often +indeed +moves +furiously +with +ideas +and +images +flickering +in +and +out diff --git a/examples/draganddrop/puzzle/example.jpg b/examples/draganddrop/puzzle/example.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e09fb7075700b457d90e845fef814158bc2641d1 GIT binary patch literal 42654 zcmdSAWl&sA6fHUg3naJ%cRm;hB)CIx7<_O|umFP&8XyoHf-?*d+y)t7@WI_BK!OJg z76=~P;c@@m_v*g7x9a_T`_$^HQ(b58-Bo@1?6Z3HQ>%B2rQk zA`%iZO1f8M|7bdH?_e3-f6d|F>a1rT7f&{(sK${x%?VR0kBo~&wp%!BJ$Sm zo?aoay85-_SHij;@Pb^fM-uJ|DQoIF`oU8xKEuzB!Fj6H_vc! z|7TuLF-fpUnfb_Mv00u1=KuR2A-jLBQLxq=%Ym(|*&Y`FFEO8-l3IXag(FC_8qyJnH9;kG5(M6h^XCTC~Z0yJ}MFH zYd8>Yr7cTfKEfbuXWlF=k{`zhXN42uxC!JaQS|Qy*4p}KH3>0&u^k%1d<4{Enzd=E zt^GR}b#K3o<=?>vX+S*LDb!^5=zme&Iv0>V0`7{Co!c$BdFRn1tIup}{c#^&7j?-* zJ?IPGSmVl^HpYz((khva@bvDoRTUBK##Vx9aQh|tz0i1$QztEZzz+1c7JHwjmV!>GhrRNWv}N9XM661PMiyiF}wGr zU@3S%SsT)LNw~@_iqec3#pP9l){32y8IX^f)lm0~E*2F>u^u>ba^0|tGWO(OvW=*K z3l}n>c*Dmuj=p!QV-Ddy(jQH}*HHHA z0l?kEoY^EvQ}cdqDC-3M6nZ+4p>R{b5NE3|EUuj5#A=Fv2NEFQoFG9lJCi+Rtg6Z= zbnp-OV|->i@Qg#NwozveePC3Tff)D`l8DFiZU3OfAf){4bpxIx;&*nX5>M zT|q?}k8QbG^@72)cYb|ZrGUAti4mx-22X|6eI`Un1@O%GKzr!@(eU*98;I5e^Fl|b zqG&LUsgBuf!s7Q%>5y76o_aVl>)*Fk-{-!?lTzg*Wt3K?t)6~^fKX0V&RVbX&LkRr z1nZ@AIBw(?*?;4$CpSTJIaP2O^5|ku_4~(X#Fr~p9gGRAJV!&A5utDdC&i~+ARcY0 z!Z6X>ula=@Sn(W0a7~`!9yw_bl~SNlq@-myV_d0(r~c@z-3_r=?!dX;OorcVd7? zK%8ep^dn$tk>j3`@!>#7^E`FiHK~-{G^0+4!Nvz>mXXF^GBDmRN_8lu1!<}`eAxOW z^Y`izaOqHfrolPcKNChjdAl!zjg3DQP5-wb`pi!I=>-S;@4!t_%BGDDi=86OYgcaU z^SWG7b8dhYA(b(h{4!`&&4UV#ygt%$nZ~m-v$7=zVS5}I`EBD&PbF52r}IyHv#V?p zm0Zu*&E+(-`vu%eh5z~QEj#C!l(4HtX}#0Wkc_`BxZLri7X%c69kbLQTrJkqsKx<$od9w#~16b2Hw5y_HJQnU{jRBnX$K&5V}H(S)G}Rj zwgE{E+TfL?&xF&dwjIBL#>w=Aq{1*|tj{w7)9*LckeViKwksE%ZP= zH%jD`PrpYLa&BHSea};By|lq>59M0of9sI}Ye4lhzdAFR75kP#PafVZvmha`6xk!?g>D;zht_%-O&16*EtJczxyQ5#BpPY9Va18 zxwI}#SM;x~Q05eyRWc2sqVr%eVIpkFQ?LSIb&2K+dmFNt-|D zmx^?~kPIiA|5)ajQ_$2oJum(TPwu0vmnC1;uw1%{q>xC?>cIfTp+M+DE)D!f_-&ES z;n6?Aorq|Sl>?ce&ay|qQMmUbVC!iZ-9n%LR^5-)e))O)2soV5Q)-!^JOI@XTWbz9 zj+wxkN#%N$Jn*_S5AqHe*A}V*C>{aL4O%zSGWQD(0px41&5h*@wccmahC;oH*AKrP zDUur&iUfD^^Ah3K;--q$?DaXpzi*#y_RPWistXii>hPdVez` zqHDHX|7*q6dv-3k{t;jjFwuFX7jxFS>pwC2@YTeYK1%Exf^p?x_=@rSogt6tnuUrn zC+<+1RP-8kd!+`HyUw2dIp&N$}1G zkKSxvoR!y@j{m7BrQ1y2GiyQXtz^Y(f` z2lcm1Qk9zzOihEH4|mhwPQmu&yqCW*$qjO2{u_gM#rQn})^Nvhk4tbigkw3V20vd` zgne|E#Y~9RYibDDkV}uiz*xFHH8FQCApF^qvlK&XDXkOlKWVFM2{-^NZ>Yi5fGN`vwU$c>p&=?nO;f5dQUD-69cDt2DHk{cyB2@(VI)B&81d@)UoQqtWeKgaKmz8! zXEd3nblpE2UlpAvH~7P1eL0y4kji+THc3}=PJd&flCcY0vpmd7=HfV;waI+KD8EAa zRh2(u4g?&JX>=-%=XD0uN2PI`it`e$NzF=8n78)C99`2v2ugg{sw-riZX&fS~ ze=asugq{?@Cf9lQzk*JU8r?YSQo!B^#9Fc8#D3}a-ZS(nglGfIwd3CrHQDI6P-Xan zo5+lE!NhbC4y!MbkPBksratr-ByYjVsgWI=-~UI=dI{_C3H&tX`~AJ#bf000`tX0y zM}T@}@}9kRHc#7bI}e`sm<--t9LfbXyUxqM^b)9$f-{{(3@gl{i%pLG*qHsI;)v{b zMmg6vetO-QW6IPX&{vLdx{Zv#pLI;$%OA58nv}yVUL4vRVXYU62`7P!Z)APkWRymVTSa6&-P%TGe({)9tJ1C8*^%_>8e5=smt<VC5FHhPx-J`TnZlL6uJbMBgJcOnDT~+9-4s^ z4P;6Ho?WB9Z8S+=A*W-WWrCU|?P3iIh{=@%qQ4`ay~Fwvhk=D{L(I1~re82B4}$rV zlM=abo93|KfI)$9*rj_6wnpv7-($E4vHm3(M^(CatNeD*L{PuQXFl#wpfWUWtehvy zXS+s5ebScg+x!%~LE-wG><<)h7wzgxC6QQoBDK@-AG%gk&9<2U$!q<>xoch1-=?JI zW(ujRrUIsXo8QIIFvM@xk-wMR z9z^^nX3l-s`5*ovk`f{ABaLi^Y=JQ*sNd7;y+Sss4OQJ($L+Q5$q8%bI`)YSmTZim z{k5$>v{FBN>SCbQDdakuZ2z-NM}aqMNCjXvEve~FwvIZh_!VBMtsP>nzI&`H4f1p> zHeoKNxj@y`K(X?v60Z0meUqPvDwe5&<~c2TV{cwiX2qNCYP?bK^bZ*(LOu-E&my$fH0csASUEj(ACofcCR%x5N zw7Vf4haVY_DFk{!B;S7-S)Gn@DQratL2&4z(kPcN&fs}Ix5keEuF9NNi-$=$FZNAr zvV@D7jq92G(5#f9RAD~vnjdg|%c7MuUIE9zOK)%_{v!Y)`QY_B(;liFQ?bI^ZR*a) z{p7;z-$|(I>6@3J3}>FN^c2Qh>yh~SzAf}6xfey=NaqH|1?I@O$&DTf~0(dnj2%v$l0q&TkoP3wba35a$nGc_<#Qf>b8`;og@-LLwYX1*T>0XXCc)A@(Ob zgjnWRzBZwIrP!LDAcf|}fkNRxnDM%4rLp(v{kUZ8HprLL?7C*t)Zz<$ll z&rrpI9$0MU>8J^zYUlhp^*eBezQ0|VDAvrR8ipqI7~Z^h%#?qj*}hv+^gC&$DjH5x zVmtbM%-nYeUqy9hoLEY+LH3Dl{ zj2)O#Bn3A#lr?2G%vK*LBGP^==pQ_<@3bBPdT0mWo1ERaVk1kj8@BDMX;!0$xOOR1mo)1|)c8Nr zbxRe?wmb4R#P+{@OIH7p2gUY|(bqixI;a2q)kS0P%EQ=~x7toe@UXc|)3Hv&2mud5 z?32Q@Ee7bF?QJwOzHX%;x!elqlL4{+y)x4!g>c%9n3&6FmC2UodePjs>ZVQ3AMV)u zN@Om|ISB*xd^C24#k?cQl~ zItgVV3pWP5(w2;#khY2M74q9jsQum`e1}`85mo=EWW6QLgmq1oji$|^36Ty%D+0xy zEgFyi9HI+7un<*=FG%W9wgP@`stkESkUYrdPSjOQ+tzUK_I9AosPte=o)1&jU;?v@SMev4BUPwf*!|@QU zUJB+dlYeqNA>UrIfoARA$JBe9O#+hQN}8?BO5$QuT^)~PSPuTuO%U#w!9s?znU~3E zEmPlAjh>u>gulJ~*FmR~5{&KXgd&cxjdF)i*;MN+>jkU7tC9d3vwuBPkC$1nC- zUO(RtroY)aM1Jg^j-Ye*cqVXdxh<&^B70JPCqr{ck5Otp9x|DcI5o`Vn`xwd*Z+AY z-O3j&o%`}r(vLJlv}tvSoLn$NW)x#oIqsQ5wzu8;p@^8atDiI2{T2K-$ywwZSFP(@xd|=3KHrvOefg~gXXc-Xw0kQ1Ro|fWUlubu*?aLUI-ysw5 zCtGbP`42~UQoSgQ)h1tUEsmPB>f{8t;2$Wyz+ahscO2)6BWhOp65{OAik~G@eh{si zn6)Z->6V-Kv_`t^5>(QS;`fdfaoW7Z7!Z8~jN}D~dTF-a4C24hfNhksHjg}I`Uog> z*Bj6D0%D=MgK#Syeirp+@qAZ+96OAS&RJ@Jn&CAU_5k*pq(q5FKqU~>*K`HeJNasK zkTb(x{dagun;xd7YM@FVr)u)!ZKx#|xHmG$WAFE!qd&~_+qCI?CC^WTksl`A7RO0@ zr-sR7bm2uNL_`a4!biY{j)YQ5j8p4ZGCFQ2_h+rq-Yp~gJ=z}yd>tg&Fb4C>G{qLo zVtO?3I{fjRYs|96fOs74-8%H0bC$YxSuW({Z|AA;2LFt))+s}N5sP2)mb!=*FUxz7 z{4yQq9uNF0v$vy?vOB(%coq2l%~;ZyokVV(a0R!R1s6+={z?`AUXzma2d{lNlo70L;toKK#} zr+&~`(KI(n)@|=0OafmY0)bX92+^@aZ*>-9-f-!@hraixsMAoN*Qc-xf64J*mQesd z&1)4gRXQ5W=6CK`3Dj-Knvp>GH_79*3FwqDdtXG~7d=^bp6(g(&>Fkg2fg1EDW#ST zdP<+xi^~$ne)n3*J)2HmiuO*x;U)-+h>-9uZfPd{jwVOiIrslHl&abks@rw60wNTgZX14J};B{R|18RhzyT?TJc+g@cET^Ue~eap`0{h+b+G`#03M& z!dQ&#Ujy95;)eY0GD=b;yo=n17CT=2^E3$l(P+>5lVL;88#p4$1g&aSO}x!I0m{USZsAf=-y?Nw6>Y2p1JQfR#D zRb}2i<(ZQdPw`=aB!gfeVJ??^vb~;#=`_NyQ-!hEbypPa1?bOm|1T!lck9^VcNC!xUvHtVLZe3ZJ3Hrfc)V>;E1b8(jb;^&;$a1QBTrl-I*h zf&#|4e&P?nwAFL;pR z(Ly(eQ<@7eTzYdE?V$~eUTD@nZ~~Vl{(M1-t;%iJ+JA}XFA7aUwH(`lZ$PFzhExNK zG_)1Ya@5JpMXz1Jgru^ry(03WMnF8dp-&o=nyP0NGIqR75nN5?DD; zA(`b>A98tX+$1NLXh?4@DvLia7s={A$h2x7!KLY-YJd0gVdA+iybyfgYID(X1C#l= zp}bUdX6ut)P2qYAUhzs14N7K)RW!7{^P*aD)$A6(hZbvGi5lHM*15yOOm;`A&t6zbz^8~)}a>G)6xJkoA!1PNFiPJ2|CRe z144{mX!0$Qothf8^NNSM2lFH+5XUQDM{l2?tUehWQcH*hiKUmYwqB9@LqCX!=wpU=UB2iVYM2f~I1cy7svWR+QL_tbW%g7b+`U?LbHQ&&aL+r+3JCRd2>GI zTAJW4D#(mZ9*NfNlDw>tSAF`db1(&bx-l>~ zY85PUP844SQ8cak-F~UGN1UKWzc3!)evq~a&HAYkNw`qszW!dp;GX#dfefi*B%Z9B z`=qmk)`2xe}EG>h2|0<-GbE*A6UQKuQwyr)Z0$#T6>-7Nd2uEB-lN2LDzcf z0O$OA@=bq(zNQf{`qNjH>$4-HmU2^RWdll&iOh`eyki^$;m%8Zxe2aC`W;(B+#bp@ zzu&ZE{3$x5kzVwK|G9&R5wofs|R_O&o zTtHa{!6RNn#?k+IDRs~LpiJkV)t`Rh@XeRRC5Bz&Qbc)0ODTmlnUSI$jg{Rg?GB}j z${LFeRF43g7L#mW=kafibS4=NqJ(1A$#JV8VjN-sLd)87^DXQ-)8#P1@kY6pt9V>? zBsU131m2L1a1+}sX&0BV>|~LSz7LASNQQ zsoiqc4R-eS;850`4?Il@-v_yMzQF}b)v3p_rB(LC4Ik~vj+V~N?Tgc_`Gv`P6~m0V zr~xQdkfxNI9)ZG!xe#Gmv;9}F5Y}F%c%-9%5j+opUBL>;?4oruOz7R5ehB=ggqQ^H zdl2@id=R8p8SjrJFUO_s228)vG^%Qp&NKGBsKB!nSIld&Ej@H@`oP9MK^#};GHqig zhP(X=`FW_K3aX`b)KYv@<;5*Rb^M*P7S{V!ZS($HSScX5-US~x%)uCE92=5S)W;2p zw367$J9HS+Ddf%Qc?955E{4%YrwJ7YLBXHjrR=|Zr}>;)8|&~OBi$sn&L!TiC`qJO zD`73Pv2QTbl_PeW?xI|`y<$|kEq&f)$QRG@4{@iQCh(ryU~&q%5;~wVW^kp=+(*ah z&ANg}mG}#i=l>_|p^wzODb(O<_!-ZCuxq)-&vKV{673!e99(3q(Uywy$E%m@tS5_z zJg)ei6GmUNFwx9XH==27YW}n@;Wt++9P%Jj&ScGzanAeldQw?*(+4q}%V`}PzYZ4> zdLhC1PBQ@MLTVN<0R8;E<1gpoFY;lZD1>nR#z>{246-I}NKCGEHZ6m&0qpNblcCSw znq-h;YxRom!@lV13AY$ECmo&Ny`$&fy*SQWvat`xJ^V6^CVxvjGG-cu@(x^O=%#(N z*-&X_tjS#^$1uzfm*>SOy~MHRz(11O7dC})GOBOsrmLysC^tgHdWd15iKq&qHGO!= z^t1y1x*Vw4#2*V|p5(sr5s>Z4bFr7dHWVR zpg)Zif%{%JPZCvvFLtzNVdcfLXY&~?Wx$B1^P$j~hqgLRZS*VYZX`l_kC}T&*M3Rm zC}AyO01kN(-g6&7n&XtuZ442>qZ17Jq;hwSs1W~V!ooLX$TfV0%SEN=|59=)&Q!VO7z85_trH0zU2sMMHCfNv6l zhas~tNU@2Bx_V!}Y$6|5dY=utpCP*>s+Jn8xtVpwrGJ4>#k3ll6l#*JdEghSA? zn}EZ6rude}P-Xl%M(r=#l+~9xdI9~4+rQ4$UM;H6m+b3cZL3GFL@lK*IXi%LZ`uE; z40T-|j9G+?2j04}j)jK5oII=EU34ZA9z{A>_F;Pr?K{+$X>xt%{#PckFvrCZ7qwvU z2dcj!GTeImnaYG;!eDhB(ffx^tIw*At?KZ@`Q6_&&%0E?w{|XFU~;Q4E^!VvS(GP|C;Izv4mPqq?T750hSworYaY$Fi$w&SRZL_dXpFylavo=uf&Yyo zm>Cvt&gWfwkzBfE%as|8uCCn@pMG6X($dDf0CoYpMp|j&w9pFHCIi!&Elr2KEC&f~ z;UwsiyRXKBW#&8&xa)|9T1oyi00)+}SZSjk>QHrx-^kgO9a|zYtRRK-xdFe_KhYcA zGT{P5GsFf_C7D+1_nCU5wn}R>1xNoveFzAgU!+5x;Ni0?Y}&ZL705X^J6G0_acfgb zFFvdN@h!@=_tuelR&U3X;;JnLo(K??On{_$-W>y<E?r2- z8v8btJkQJ)&p;0zn+WsJ^82+nn>@oShTzEv_tRkp@^Nr>$i1Ux$|@x?Bil2l=DBvX zRZS-6EN^(#F2>MyfdKzFLjW2sNP^rGK;|F+w9rQ)X+R@K8&_0k1P5{QRxvE3BR}e2 zmLf_LT;7$9o&{CoI?u&~EW9wXCB(+KPl=aq5^`L0R;`sbBo3=aAMtzuko#{e?q~!k z1(WW5OvAUzk|!fsVs6cG_)V{iF!3mJbZ|H8m&J&% zMk<+5x9pAE`85Rj8vtGD4s{G9Ze}M{#J1-RgRUny;sG36Y5qJoCP%thO?&t&3(=7- z{u$gtYog4`|L6iZ3x*HBYM|2bcdF(6gkKzOTYXk1dg5ow+%koBz5<;U8@e`dw+a_1 zW`-scO;6by?$n8;J}Z97mSF}Cict;UKuz;0Y<`XD?jquziOXUuL#3_{OsB&bxp1Td z$|(SZ(}%20s8TS<-)@>HP->@0QP_7E@-F)HE2qaH$GuN!L@l?*FIDx#;?%@?1SbQL zl~i}>rP@YUwoj)yuewrFDOJaigQjFq$u~Lu2v~?ONccmnn|r`+o!)c48}1@r?DmKa zE^d*pAaG+PmkqfyxHSwbtOOH42z*sv$KC`rjaElzU^s^?1glD$`90`yTy%5FHNHI1 z!DWpnFsMWEZ9<&2N}Rx^XxS7y>w#NQJm+)}R90FiNQ4OhjSU68zA*HnDE5k%>KJrr zGpXGj&BnPIuUaZy7;K;D z*XY(%Ke^d&bW0ZRUTkqIu4Y@e%*FkD^FtO9B%b4~`%gjBmn$2iGo+rAEEO`OFTm4> zN;B9Q&(nsE_wBl);=+uJEJ^o} z=+qQu;|VMnp={Tf&``vJmvnjKeZ(-Oz=F&HVJ|v%kTCp>Ra6)D2lCV4fhp}Wsi<*v zmzIGU(tf9w{zrh*D`n%4WEv<=ZrxCKcRi&axExaL$OmdO_`n;X3!i0750H_L>NzzX z!+pQr)awhly+s=1OtsbmukiZL%e)PRgeiSHuGH@4| zct9H&9qe29O+i!qV$(@KEI3cnfa0~khrDXGlxp;a=B(P$kI8NrA502LXEjMtaAk6v zJ$F^v?$`5Dg`x#IJ0rAJ7PCASGscT-98wJZ7bnH}UdT<7FTfBv{TwU}wK=eBHAcoYM0l~Pu4`ge*_axLEO1OBVbW#$t?YN9CvAmEA)qNQkIY2@SrEd>SSGL zcr3B+1tOnIyL+pBsrccN^%}fcIjHyxV&C3JB(Tm#7k|!(IRaL;25)({jU*2|FYOF??CSrapfA2w?x-voh?}JBW!^yougXw<9J5P_37w77O?4mMqSeTNJk; zs#mpY$~6tajV$TTSht{Z71Q)U#h%SuRj4!8{t`ci4%dH)UOtGi<+c7+wzj^!kb(`+ z3aX=v;Sr#PM9OG90$d&1YG0uz>e#L6RuKn6_P>nvdj=``h4C-q`bwnrIdHFNPK;Wd zXUAUI4P7>Y+9cU@XC>!)58d97CU)Ic4M1T1SQ zDg8;`LeCG(fzykMiC)a!^L*07)I)Y2$x_p7<;_x{t966s>B zozK#F4*uh*eC_#f@wIT6M;8bTxU11@7ze|^@1$M)iBNVibFvf`AAkKBcy@yPUg-ao z%9P`Q+~1(pr66Ks{dI|g&*{DHAY|%zVuk#Ka6J#E>CdPhV4nnO9JB7pBuHn<0<2^7 z^U0Qcs*QGo)z1z2H*g7{iqzy_ZzUJqLmvS~U*e?Y6Ugj=(Bw0g@-0t_tk-3%myVFu zP{P%9oWS&cUPmQWl@YI0)V!4R3ehnTMUt)9_PI|p?iE_?Q&pYKh`J3ih%f9!g^mb$ zpdHgu9`scSCnr{jVwuApBKG|w(M7JO?>pQ}+5g~D1^XW`KP7v&f4E-^?;h0F8o|JO zAm5?>J3B9prBbu5H5kR293)Q7v&eEjC+On2ZKU4U(q_ z|64I=tHMc!iR>2YmW%mMtc|w*8CrhMgI$kx{T5GbJHyZ`q@;jHk}kdvT+RxeE&hR~ z@Cd0qJ9ST>%eQxyK$gMaE_NyEwJOC2H}0gH<>wzh{_>7phc6CkrL6krckd<#pAbIZ zLi`iLkdJEoovz;j1vnc&iP7LW<3veYms%+1&b91!I#jL_?ps7mH+lsFn-T{|Hy3C+ zob2+)o~5dcc7P*~;8eXuhf>)jINFP1F5|ZHCXeIE6(K>7LIP1WO>Lzp{aX6WV z)i+z58$hVHv7_?f*|IS;N)AH^ZeER*2Zc#B z?gs2J2wN*A{o;kVA@X9-kQ$$wQho6xC*K4f$Q;&Pq@}_f zOXxj5D+#QpCTU4=&FLOl!=i7M1>!4nT?2y8x{Cu|ch)b>072YN#G@S5Og=(>4&&Mu zjUrodym5Vc0jbxB_{^R1KSN^`!GlivD2jK2DX(L#8z6|CCa`7w6IF=H^n7Q!w8q8u zq>QK211bt^le^Z6d>R@O!@47i9u}1h4f0+62!9@nlJQu@2i;lI9XhRvZTf@t3YL?K z2Gk5bcIXEG#tPs>7`_PQds48woH4+4^FbQVvyC{A*gv?OQS`X19NhZ>BIOyr{CWk# zf?8Au8O}Q??OHo3TGCa(W6_B_t1|mjOYm9&s>SmlY3|*SWx!XY(Ox z@a6~v-qjxw2ze{|pm+KoE0Lfa>{&vk6c^AfD@J11vO6pHjnF3zEh`ROOqca~b{j zXu_1Xk%lgwg>@|mO)(xeAqD$IPn3$L@Zrh*{)r|ZSgiq(X_xdFN}0;eXDJV9dc_`* zB{9|NsJh@ojtHkqTEaM{UjJ4x1TzstBjohFOqf_`Bi+}F#W5i=zyTsAKRyMF+*N~pI|;8{q|re%&QH&R>Z?kyzl z5*BF&{h8XIon>$tpHgc|7O-jrO28u`rdlDInkpAZx*5!##uv5&!5Dn3gAQ;eXE|CG zJj{8Ft~+4yaDK&4G{v0u$X6Pt+pw@9(C^rAUOo^wi`j?`vz`%U;IeD@I%7`%H(SeT zb-@CQ%5zXHq0ff>K7JEpiW-X-;f`xYjMu}+cUArmQvB2q9WO2(fWhRjoLe3_p^|bS z1l9lao!y-84*H%>)ao3yQA_>L!b=^292js5C*{{2UOgU0QO2+rJm+dO`5^DauJYVU zocNi3NPgEUDUNc#;YCi~vdhHIN+vhO4CNtCcuj6YO9;dPaG(dVAvQD)9TdorNJ^(<_4CoH?}dJ=H8pZ*e3+ax zi3$r7=f@1f=((15xy#TJ9(304Z?1KA%Ym;*iV-SULAni?fL*m9)P4AEjo8aUif14?UztC45YRguQCgqRs z;8Sw^!VM4WRV1ubFP2o7#D>Qqo#CEsVqZe-k{x0w7ST1M;nnx`O*msE)+@5r*OQ-H zBcT)So+h`*!vzL{l@r#MuMXe^Xc1|xq+$rUa8T9Jqax_jiVpjHSQ)_g4LrV#w~VEp=)wp(JmQhEq3ddn@sZvAZ5uk z?{+~)wh4wa0a-ubX|pqtWSu_kO6#2Co>ScFbO+9FM!Zf{Fvm}~F!MyJVN(qNXg#uS zXN_kZe$gODG7ZyE4}C?@-}W|~rG$5eC4{VyCL!~^WxKMCvj_`hL!FhSCRMS-PhKuK zrb`o?6wiUxjZ5X6ic69hquL7XW`>i~R3M=1d#p>*&r>rzfDgmlpk8%{u!4`kHzM|# zJR>|+mQo3f6i+&CEb$XP-!Yq!>MNZa8uyHe*h%k8oQiE&L6Uv1lnBX-xCm6fRJ;@f zwTtD}R7F9kVfsqFSd?l2SIEp!xHl;!xa-K|?Xu0$cTHwvgpRny)_tbVX#B6i=*cdI z)%Y**1fHo$uh9r*iF*3)?C*P;BYg39!#FvaKGo2Hl`k8uuMOoKnqhR4|0btEz67L6194x6qhLobV9lEhnrPuXeob!es}er?XXgAszL2jY+Rke3HjbWX;|S1EPG{> zTa+&Avp&1C*PHKg1gk&vY>IfBJ8@mspW$98>Bk2;#^|suNMXO8ETSHrW6e9en|nV+ zIrv+SSlyFZmP3r0^@?t~_D6eCmq{>g{EYd$h0nR!r~XEfcpv0vBF&Y%Knkh)H+^9S z@Nj~X1Tz|xnEAJIg}^8u`gzTbZp;SYh)9Iyav!G;-qH1xq%DtAk-b)mDyGBggY@+N zVkt-j1^@(7RK6VfaX@Qtu&x^m1-<_){8O8HJ(EQg2E(oDXKh#K32XSVw6g|esDEII ze$_k1O|6zn!Nkf|aiLPdtIl)l_;X{UA2{OfpD{&U-z)2Tjy?3Ai*;(%9}G8B-*V(Q4nqZMGVrPM1Z+AS}jM&H%M%g#K1Le4WaLxKD0Cq75P zbI9xWwZbOHPQn0+B9%ip8l%F`Jpo5k0z)O0RXMP*>E0D`&V zs+sfUd;a3TxnOk3-nRyeg83MaQxXukT9*a!wF{tGZ?OMg~zHnp1i-zYGa_|0Airig&e{wRh!_)ewLGd~jujPyM^ zJ@nV_pQ6_w+@tio_2rdUd!V5QGKmEbYx+k=$yS>d$gBHO&K9$CSP^fq_Tp0SE6Iq% z=MVW_v=8r(+v`~nlT@Fo0r^u^kE&w(~A{Kz`{W@KWIu&|Z3&*>G*CkC=~d~Upz z6sCkHiS%DZMIMnixE2d%^Z#O;lntY`gZNL9le5UONMeu2A+BDx6i4Pm_a#vZCA9LN zPE+!k0Q?fMu_V87qY*r>90Ci(F;$`ZePC->vL$z~?;wxZ6^<;O}Z!jL0A!%R8kA*WUQ%&HM8zs}Z%9|Dn zRsc=!{R4mMZIqm|tP8Vtkb}kWg+Bdk<87p%nXUCFt0kPuVnoTKUmBfM0Z^z#-@!3n znz&}Wo@hMn)t~f5K-+$jb?)YVemI?%Eo4khLBG))7in1X#?Na0KA*BYeBwM*v%?@Q zV-)!bUC$OGQWEYmgj-W`EpFjtZuhCZ#%9W}*yVvNo@Fo z4K7JD&D>tEo7Zcq**>iK;<7=H7V<^LsCg$Ucu!e=?Hd|YVxy5yx`+l!_`%a;y<`g# z-N-sM_*0_2$a7P`6Rj}a$ZM+RRSbv1nGmE}mLpTKm)rD6rD_Gi?}qURR^SM{lJ7J_ zozf(pu8~nx$!(qI2&uhv7G3pb7q03p@%Bi#>Bq*E1G^KdpnzOANH|2dOF9zG+-l^S z{9mKrG~v5tmj;!O0y^YHpW;OmDc9IpUGbWc5UziiPcEy<(s8ul)5E|EPr{%0#2 zq2sKe^SOB7lp~S6ZX%k+Wtw z_^_wLLNLIBUKTOli0Zz>$Z4^Qp%i^-MeMw1QM}m|SM*fsIx2>ZlXUGLOwOY|INUl% z%ft5V-p3zmAY3{+kI;uWg?fghouw>4w9fc9LtjK^k>V$R0dJ z4~x#ECwg~XC_c5VOu_Zpl%pT*&I)SRr1t|kK@;$VVbc$4bT+89d=~%pW3TsH^N$PR zIBbegN8M6x@K-QC&Qypfw((Z+4i<+LGFfg{bfHRhaQfxjO#=(v;rZQQ;J+nPo8(1m z*{AdM7e3s*akr0vf;RL{bISljJF$UPK*J@Wd4oc+K}3$8r=TwuHaRIQEBHhpI%83A ztK89O8SU9^&0k_l9kImLv76!4P^-E9;zKEM(fsd`9EEU2Qy^ z0Hq})@sHgU#6c$~lj~2`#g`+GTvS%1p%l@4Gg+UnTZyG4wIL*W_NRE~ET`6y&1=MO zJ&5(CQ2`96=}D<9(MGy!EZEbjZBa- z0rej>)L){PSS`264e1?4F_^dLsY`Lx^P5E0(l(3}-Cz#g&(AgIt7|;mk5_|(h8)xdsk?u?Mxgk0ZMHRuWFTqD2RI^}V3HCNw2nRd9M-g8y@jgGGwJv){iOx=N$SEN@&to zO<%39^KDS0s?eCNHu9ATQC}1l(Tv>Ht+RH75pdrH1kkVC* zm3PlHsg=P~p_b(iGsb)VH3PDA!(7R_${K@OE-DB0ViOJF#GhVAA5Lk`(bBy~`tEBI zb+e0x*h!8=RF$0PJNphe?OGvOJrrNBh`N-pk-h7uW!V12m8N`Ep9$vH8vqcOGsbh8 zMRADQom7|C9U%jOxTGKa>7HjybzkdtSdFM)I~8rK#c|lmONqx|HmjW0shuFdrc8gc zYP6P=vX@d?QBX+-?&Oi*-iI{Ty8d61vGzpn>o1cR2W{b$CAXU`o-kFyxcB$@ruXfP zcwy-33Iiu7865Zj06f!V{+jFOZ!gDzsajMvng_;pl=8B8PS87Is)&6+yjbs!TCb@Q zrMBTn2`6g%$>Iq#If@mxzX0H1|TO zYDiYqaC4jrh3dJWMRcnH2}vbK(-kkgEu<;ZwBV$7S7Vy2dXqFm(-WOq!d6mCWS>=V z2=qLfP9jd$D@9&NtGaCbOP&2w{56)MCEKHqsX0kl-H%Rq$owmtEvrkH^{;vTql$1I z-Ofc^8mm{rwrM%qcSmC?F+0!)fJ9BiqusKFzHjw_AKR(q+vDY8+llP>k@Dk3pRA$3FF9^q%1)+*fpx zmu@%NK12j^BeoA==%2>7RmD}MML~M}9%6U}c~ssg>+4kIK8Dyz&Q3GW0;YEK2AWQC zPB|v3zMXFl4;|F4&gXAo^s7EAsm4k49r>>8GfIqZa_MOG7D`tM0}@Fvd~4)}A^{xMXl zP~3!!zVq_$lM+)xye z#&gGdl}pmmX1LUw-Kq?y80DuPj+Lpu`6P}z`c{0p>QPdY*2Qn3VY74UR)&?SVMKmo zx=l{WRF;xdw^QL^O33A7lkv?+`pa?6S#Ib zP$M-lq|}^-H)v!;FQL*UGp8=>wChTb8u>An5Xz5&hQjg^-}gD=;M8X48Ow|-w@#v| z#64}e&%81lCn;~i4#)gFX(Nwc59?P9XmMg8NQ)Vm>2QLyw%AB2z!^CB0B7J*tvhPB zrgV#vVaF34KyAqZr1*+R?2@kJ4{Efj^-^UNFJw{r+T@K}pmlbxZ00=UYlOiEkc2qO z)(5xkUT}R;OSP0GY3)&}qUng}fKH4Od?={c3yFDX@cjE@H)K|t)r-0lGO@69hv7+wJmXs1w2=yke%SEc$Xp-!!Rk9Q(o*=rY>?N|{{_z8!#+S#lY5Rq# zyA#$6S+}+QR6`L3ly~fmZ5_{H>S;5g;@r6ojB{Cf<@Ou;V``mX(D5x7DUqeQ9J-d= zj^dVp(Q!ox3Rfp+AwTtMpwLaVBE!=t7i6K^9J`I%$7SwWb@aOFVJjVvJIDuuK(2_3 zr=vrNh9Wf7b{pZgnm|etJ^WbL?$}`K2#B|Wkfzwm+3}FxcuE44p@G236?&!=NGNTH zEHN570ZJNW0Vq#AfCmGb+aA$rRhZe;Y=UjYI}Ad?JQ6dUY{uMY;<9oKND!Hc1}hOG zG&Z)=ErcNh*d%Z&)cUg_QnI;@)R9hBbA%{*Q+iY78K)aUcvVej)MKcwx)sVHEff4} zd~kdO=j)nHF!@4#%_~ZOU=lduu}j@X*!#?g>qf5A5#d_oM~BW9`=~40Ke|2swNdpp z*!SvpBd$!T>e_cJAqro>AYfJPb!4tFZ6g`vnuKa=VjPB{vpiPFt|cs}!&VPH&!2rn zv`Av$^XAzuI!dvJ-AjrY`2ZhEg*cTJ0p~);Ax9&h_3K?l)+;-yhdC((<&`Nsb}1W& z@~&T5khch1iy=zD%D5HGl^IfYk=CbOR)x~l7A}YD$5ga>T8|S@xp0Ws!ed;}Bp?r9 zrFp>k3KcECb?JRXfgaJR^!pJm33UQA*lwsHCve@l3d!s^!Ky++8rYRKq@Fv0+~d}h z?^8<(ZC)C;0uQQ4 zyiYjKwm-_avW7~zPSr{AAf&b>PzuVH7E-li00Y{WMp6*5`(5FD;QV`2Tq4rlDJUsM z&;}ELLFWVc(w9n`Q+^v;lB2XQJX4W{tw}2*#EetOBLq_=`Ii*YODAg5t>_+u-j~}X z0NQc1k~zWq)wXg%)U2nrKBk##tCfRskw#AGwSwKR@0z<)wL0kz=NVokWwabiJYt1Y){mDOy7&4$cUhoCkSg(1?g0U*y*6hmJ#h;1GDlE}v$*hRP?vx7}MHD2Lf9 zLc96{#xYNgB(+|=%@~Xh4ZN_?_^+z^loKDNM_Miy_HQvQ7DE;@D@vgv3x$QHSo5s! z-;s_8P#m5PYev2OA^N$m^wYXw7MoS9$$6#yqS%+)k`#r7q#;Gax6F~q8LQbgdy<%O zsI0-XLp&|0Q9uMAec7h>^u#3sTQd~ma1t8{PEWWXaB5s#y?x73=)5Jm?ccetwx2Sz z(VwLTy3^AIgIe2Pxy)N>ZPm2O1K~h!Yax))<(iW9@UvU9XEkD^RK4I_eQ~0f+4JDRaC>^(YjC$5g zu!OF@>*3k_1h{xgt zNzQ(06lCsk185Ebj(Z^d1Q4NxV<$e8w`<(x)~PAIcVuT&KBo>6KrSpGeLL`K zqwDO*$kOk`Q-uu|8bVZ_PYT>mz`#G1SrTQX$!;hhDYg=#l=sQ^ABUw-U!<+q!i^D- z>QWT>Qq(yI01n@XHHKYzq`9+A6_wrcDLqjEwQ4K7VT2XQmI_EfJ`zImt-jef$GU1! z8s6ls1T>t75~t@%QsMZ30J#GRM%DTQl&7A=9Pnx`+@|C+HT0!uF1e6L03E8re?7mI zNGIGJclA_c1i2k)LfiLBf=DVKP>y~soAD8s=sM&MS)8{pBM+g>A*srx%`EoSZzBcyQ%w7v6;GO}-myktTRk zXdIn~_zr5!v-N7rH^XTYQnwtyWrmVmb$;Gd=VDv{CMKhtttOlyPEW;RdUYxY2& zk~uZdS|3hXEKpF*lFt$fRg9^$4eI)+@_#z4F?gqF(~CJ6s#sVyp(e@pmy;??VDqh( z!np}O=%*W7c#g^k2l>%myw1x$;_1Ptm5q_G)shp0XCcG?0QVJJq@eCV;DB;zd5YR(+HJov0eWFR?AqMwdJU|lm#@6m{;|U zletOmeX~zj-l9o@y-RJ>c9tMNXSSl`RT5c!4z#_)Zb}h_g(q)p9D~I-z0-@_uAA#C zBXX_Dm44JIxsIL<(arEyD+z*shM6j3II}@ zb0|&~wC5ur^UoQk`!`W0Nzu$|X*L$)$C{=iz--JL$>uL7}}91(z=;C8xW*`+P3mQ$S2pY7^cFD&aWYm9I=nKu~`hJK{z(~|FpfwZ4TE~W1&hq9Ga1MCJ zesNT&+m3~;B$HmWVyE>*>5Wk~$8fSkiE#Z?ZgF-@Q>~PRY$$N}X(>=q9f24;cBUOA zt?y0fJvlb+%o&#((}-pl`$23hkfkkdotQ#W6Z@fFf~QvvD=y*GkLeoTj)+FU<*=i1 z@k6S4E8UD^ZUObqeLZRv*Guoo(prAiEZHBEr=$hO3tHV`TX<4bml9Am5|s>Neh8>j zkWLd$=vyPHE;D2={-#UU7Vn9&yAhdTNmHs$P^2t@l&F+)K*mqCIDbv9u&yq_YR_(Z z=>pmM#^BQKMYhl~t*th%4DVUmPaz}R^GWVn8tZa}WscRl!)IJe>|2Y?L{hvpHqx@J z5ZZSy&}ATYVECLc@?{TW?H6L&evWi43kf7M>CiQn0Pr`^m?#tP#>i z`Eez`C-i@U6QK3Xw)CEaiEp&KHcp{#N*NPwDp72-N{MmOl2kT@9PQ5l0ZxnRL(f@C zT(Y(=iPQ?P2xyc`Dv*#ARvg)o-p@96WOl}BCW`6R>dc;D%(uMl1I_WAXw?8sF$co@;u!Rr^3sOMJLa;XxoO)H_-|VA+tZoCG3awdP zSkr{N)tX-O$VkTk(&Z>286;woMoCkAsdW7)s$`pH3ecNh6h$FRVqO!`uDoX1zD1NM4+3;L-&7mVX$-pDjR~}vMOvRl# z8;eOw7lbSkf;*)D00G*&kErc3{8tiE6_7?ToYx`sO^bVXBHL;}kiw2o$_JGvoG6c6 z`cisE>Pe00*{&mxXVAExGIN~%HI_RY zDtp!}K89XZ2T(5FovC&7p9N~{k^#@=KRzq5^xVZti5+-Kmdjxdf_N&%PjB_ba22)J z<6Wc4hNUIYpr+4byS^)~`e&)c%S;Q5WW4_XiVKc{2bpO}&(NOO_^w7eo=U1~W_9pW z;!w%XCCwI6Qc&n1AQSxWIJ020V_%g$C&p6 z;Bik%c_~YoK~srO3C>7Y_P(C~02HXpK$_HbgD4^7sY^fy7$>%Ug*&em28=jl(8WbI)E1iPQUQ^#;Sfl~?cDJZq5;G`=Dk-HcbpoJvz zGmcI>W|W|nB_Uo@j=@0gta$Td81=<9J1|b>rkrakQpV7c=G;9#D;3Cw*+^1B;{cv= zK22Apc_D$7lkf}DL1<60vp$hy?n0XBd)Nnk< zocdP8;RBycn$0pBGmf&`foV=i9OK%NYI}(Akr@R$lmJKv*T3i9lDl+Ah@h7++JQ<( zVtC~9?NPXMMZxnXM&&lbiELzpo<}0HRH>#^OksC-$lG(0h)|q3*x}r@4}w4Ru0{PL z?#@l>3s6w%6wG+&Qjmj?m8&F!_+b7bx+_`g2+(4`CPbw(8MGH%SRjrEWAWP`Q(R+o zxUT7bnRa;ZT&W9igU1B$KLN+#Ou$1uS3XPmBNZ%^)OpMJCOSo!GOe%2ePOi{l8p9O z1A=`9c+br$vAG#;i&KsGGGnNgQnASj+s=J)gZY|aur0+k6-_MeTc2ks03FA=PveYK z?@C&&_nE0g=2Vr(`)*~&Rcf4X?%1&OmYZs1RDzIHML(xT zzQl}zpo2@a7M-08AhUCFQU)-W8wpSu;AD5Jb|shXaKKqk;5*l*!^)N}nv~Q8ZAtyp%@xe5n~~9_D5QxDGwy%k%P@Np*CSzwWRm*`cqZJ+4^RiI`@CP8+f)^ABP%4$19N~&7q|Gf$C2+%<9uGw5gKs8m2tZ ze8x0lq8(5?41fl6Sn*i?9F$h%P{S(Ma+Q%Y>W@|xaBbMuL`&LuT#dm1doC++0S(o?N|&EoPOuf7!#hY4Ipzhl&D}o=*dw-k7UJh-$d#dsWr7lsn7s>iZZ=zzHrw)FuUv_)TDRt$o(6;zWLF1j?-r4o3BU0N|cPDBJ zRkRb|Xu;fmJu9BHmZNn^TuBP>B?awxE4DM7gYA$_Te@=k#E8$tTGHZG4eu&SE9vIBGs#aeI6uuL>*1M(=zKesyg2X`?1f=*u=k z%S*^`;iixPX`rlIESm zc*rVw4g`cG4&WSTKR(s2I_iw=TShE(#}pJ2q^le&J;i8ZFm!^am5xZyHMN(~u@1Vl zuWHIlM|6?LKJ~sT+5u=FxrJxUFh{jM1gYtviehi`r8|nV_~ZE+O(H6tT98tNryIFB zCkL8a9l%1CmedY+1QW>zy(fKRYibGvl=>cUdylWhS=gM-F|&r=a3ucC1t)Mk5_tar zL*}%|xh19?eM?4L$siw5?kjcK^u}S?Eyzj;wq~WcK1WB2lmg%&U}O>L=y=6L zFLxI%H&z*rgsHYp^{p8D`2hYLpT?2volLt#1v3vWPg6)k47NE|4&oK;FgZSz&y#Li z8zW0ZiqrIq)q!#2>A1;4Tzv_4R@Hftg&ZXQK-DhC-1445$*iu^l(#@GI0dv_@0gct{_|{{Tw#Sb7SDB_4lMgNU!ks^!UT;62(_p=Noe$vfO_NGa}} zr1CyMKgOq8A5=yAQz)GO0NJD$KY2fYwh2Cm6j~VR-@Wbis=8@UFv^y#M~3}+x!d|m?9*|WbP%L1AcZ948j(lV@m#;LV79!O zHwO|NTP>a53x2CvA9vs$Ng}wvPU)>YisjI5EWl^M!6Y=dYf_Gx%+Irnnm=hS$Lr;=42Sw<9(PzMIJXxK&WpIam&%(RCI z1K0M7r72eA`MZw%*2+^;iH1;cNI^0bd0|d4LKlOS(@bXPH!MU$YCFBVREbO^fVBB> z>rR?p2wR2sM(iAOR;e`zxiEwrA9K4KKKB{VYL3R~hl6gl#5c_SgH(Yy%h;c6bU3RB_QB|!6W9JbiR+DZ`O15UE2DKlNQ_`K&F_ zw;WP}8wpC&gy9(~$vof>T0^I`^y}RIpDCz}M`KXOxS7qIsZF~ZYH)>nZ{6r}F;d-6 zqUJxT-_-hg_AOTl5R(p2b|8JH5S0}nVLOsTiQI5n!O9H@=i1YrC2rtut=#mbdP$*)_lrO0lm)cT_BW@S;XOk0%CP{ouM zm_BAvAO`n&hI@I3Wdn{Xd(=km(Yi&b){BZiSTSah;^iTopp>+tqLl9Pk^unZ;E;L7 zDXo1lU+NWFxuAWm&+^cJBOYu5K${WvS7euYSU_>HC*hh|_v9!TO3Mw{+uIiIZHn z9ljd2w$cMgT6ZfT?par1+a{E^)O|^Cwds~^aBXp~7fYneM6mc;*k$H7WyIixDL6*p zoQ&rg9qLd01CLadLN9;mIl%ao8FQX6rI3@agq*2Xt(svECHni zd%LPODe@=2C6d zOTk|C;H@rswKGN;bUjLTirUD=R<6~p2`f+o(v>=p87UN*K0~6pjkB<~3X{(j9Mp2% zjRE3;xqD90?rK1#6qAoikLnf|C8ZBjS~AJT(K6I`)gL{z{m)(NtzjfN4qS(kllFF! zpoS6-FhKS^5`Ag1E}hjDiEO)Zwm#EAVL08vC-JV3>kLM;;$OVSZMI|;e$hY#mvTpx zpL0~r^7@PRoq705Qe-mXR;JdhEhHarQS`1gNzUy}SmNw2w`P3F zcOd{LD^UX^ck~&kGumqN;$ar2&Q8z|2RxsDgI6Whamxsn?8aJYVJ|k~-3i)A&PGqM zs?ShrbrtQl1tm${z3$^A5s~;4kF7S08mF53uQJOMD$Pa5Vk;ejRW5Y*rGOfCA{Pw zKX?*<40~5T+b$;EHMwmzks>fdt*CzLlAxjd1`pP{7xZe9QdRAY$@sc1lMI*!$6gOa2By|L?CXIxPz#cFCYqHH5sdTS zpRHOIB@r{iMn(SsZPjqnLy3M9jkrRV8E`9lNx&!A_vhlI2)ZRsHe_ zMRTiy_|pq>`b8m!RzuCS_6P^JIQS--E|)z;A@*USLK2LR4dr%G!68`e6mgtYmNBv) zM|YOiuhy~Vza^;85B64@S=@NuO1qzPwElHo>V0W020wqt=_Wl;$|(f}tFh19%~T+MN`S;|)^ z!ac!ksU-+W-H%)mpXE+kg(5gp4XGX(4JiS$k$~ELehF9OnswK9mz2~C(+xbR*B1W( z+18_yq5#Mv*kl3prav6XxwNH_5|=p``>EkS$bTC3l&Y$bQapWHTso46YtzA=w3eD_ zn45<8h*HQucb*61-}0waSmb??nP@}%2IAmJ2N}Tw;P&{eWLhLR6DS}CUH!9*1O-P< za5L?|{#9c@x5<>mS!}-JI~h`vJEcSn5U*lD2R*s0xQs?boK5&lDwArW+hQ-HSelu@ z{;z6iP~lSE;T-oHR5|?XsCrV%&o-4h+Cs)M5-kbBf>53yUr$$Diq!``InAYuG}zBxe|>gM)<9W}vC0c#Mxu)v!C2 z1CBu%uGHF_x;e2<3e1qOkd{&hwG=X-rc$olQCzpV)LRgam0h5@qOH*jm|8=Cf`8)` zP8X;KJEitVkoUz`ohr9KD$j3ODnc^69RC1)RdS{}OiJKSAkIZ8{V70C@W1nlARYBdof}$_eBTN>Qd}BxX9)0<*w0%I#F8c$J`?I<}FV zty`zsvp02a>kY_GJK!PYxHc)x{vN=6_l>ysriZnqv-QGlD!p5qxTt`bijsioC$QU` zChisWkMv!_oR3lI#(UF3wKa}I)4x*QZMO*# z8&ch7Jd`-3VBmi^tswby|4RjwL{0oo%5p_N5!|1ZwY+B7hK{|f!%kQZpBu8`>9T@sJ z58+jl%*#-zDARIpYkvv9Pjgvu()-t}MrC$6Qo+8&HIm6NriQ9~9*rt3eaQ&Pw}#P5p`O$Eo(Xm+dao zGvFId<+*BlW3PmURLUD6Aoj^C#y*(uRvn7%Z@pVuxLW4Nn-$TNJi~!#SI~|spPM?> zdFp3M=3C`Op2A{W%3Wz;X$le9>_@22;ZOYmA-FolBg)%)y5^Lmc1ZCD1K3q2u7^;o zE+$s)zX+Eo5l!EA5e)4wbJBM;Rflf)uI0KrXHCCp&YKz5> z?Q+Qw;{k%@@jsQlA!2u<;2DwVY)7 z(q|^)yX1v=aac$@QeOV`QEwauSsJNbOr+KrK`A z%VoBsBPs5<)Nga(sAiH$bgi}U{gWsH`>lF?Y+5_=_Hi6@>tDpb^O z6!m_zBZtGZ=0t8r8I>V$yky03#TG-ns3Uh9kEzBp^IZwhE8I!)VLKjIi!j1&J;9X> zDGF=KgYpV}eZ^9m;&fRGj3KtmNM$}7X>A|?kOn@#TATigk00sP!KIXd^i>_dsi z^T*>z#?xFZ&ylMGQM#!vXIp~OBL{;;Yrq~++n(pw98(sgwlsod#$}+vPl&W3u%Nu2 zN=fWJ!1ws693iowpn^$9<67m$Tgi2_I$K{VZzl=K?hnBqg>o%)b>l3ot`TL2aYIRc zw_R|zxmZpzoS$5F!9SIIbkJFXme`T|EuaN4$xcV89rNponid0c))3zIQgZSX6PCU3 zJyK38M`BDby3$g%@JY{e?mlrXbYakVqc69-X~;uAVTX$S5T(07gPb?;oG_n$bT<*(S$ZA7Vo!9O1G+ z=e|d;trEgZc(TyxG`;k5bIOu(5f}s|!L>mo?ie}9^*Q4`t87VEBp|5UA4{G%@W5XO z0FE)v278~3RoQjX0k+53T=1|C20tPH0F_5)X~i+UOOBLon=qhUn7_ zRVl3s#mM)kTJT;BBX}!x07^y_GBd_F_BDd^^G?aki7vXLwFbAVY6ebm#|MB1@~PCj zYS?9IOmg~Hl&CE@0OusA`+Yts6VcmKOH6W-Re+*Bzw-B_IZ142RTJ2bILmQg`!sf1 zXgEiRro5#p&TxOVlj~WrZYq2`GCS+tl7?GAQnEjIobjA`)RCAdEO?08^W_034X4YI z>Q8ENwcCVqlp(Yd3Bm`jr!>7;S5YK4S?#Jr3PXXd{{Zk!1bxDNGwOb8&2wulXp6JX zAe6Te&JVWU)iktQUs(?A1cBw;FbSmHPGt(xQ=zFTQeI_9aV13{r0_;ZBadoyXxcfM zl2!WYBa(EDmHkVjX23<=#_krxhu}hWB|+pA`GaS=RGbs+N7A8FV@QL1buYBGo>H>r zQrB0>Nyk)BR*vRP9s|4G#k8jA)q+4t^A#Eg~Xd7KhQl&5>cvj@LTxr1U7Zu5AS@SZlbmNhqY*$Nk z&8FhC%69@oX$Ky>a%;2EQj}VZd7e|IB%NhDS@SOVD?*SGaac=$hdk{ZDv{g3EQ6jq z(~J5$C1jwFd;NZqxU<`gW~-GU{CW&ba=IT&LKs zqD8n)W>usqC}n%FwiXnnWPy{M`)9uwqgBauw(qB>7e)o~Go5__`t#{hfrOT<)`h6WBRpX}XL)l)R=YkJwYr&cRfixZ88 zR2xDEDtBpCcmR(6ovGKVeOSHdo1}>>Y8@kWj}~fKe$2xz8BMZOc~gPHkmv)DKp!6W zsW+vB!x2qI$?RL{4K7oW8kWlBGy!p-uvU0--d^xt!;)>q^T(h3m8}{<$k#ADiV9L(#68|iq`fo zCf{Myl{E4kNKr{BP#_R+M;@U1R%uY%!Oe4ah3XuQJJH{@TWpqwuQzQ{<+d|zHnd0a zmJ^qjHxudDD0*XoQW>2{)tY`zveTELX_I-f*-hFExU8)WJdObiZAv&HN&|z)sY>Xo z#zM)m>2w9;r@ds^DsOMCQdSP8YZIvSD(>;@>a}Yo-7K*kw*%33r6dxvtSdXgBWU#= znJ%BBv3Xjfsopx=J|3x%5*A6qcdr0v(yZN(LlGIxCC}}0$GFAbl9dki5x!YaT2a}O zdsT?y66#OAG~8naB!Vf_s#tAET;dPXS)FnAfoy?glABVFRP=CHo?>Ls~o^n{_hOyz5?fx96^VQ|x)$U@1$`r@P=8)aH&sBzZ0NqI6EQwsnT z_aNkF&=4x#zT2W9vaT?D9QUXKp)#FE4an>#$1(zUgyCC#Mt>?rdNEXGc`b)v@pGOc zF5J$cu{vFhgsgzH;0&DPf2`8inO5`9?D77&rtKVn^|6rn!-yC>f3L!%B?SsCyN#!S zzeDj}elfZ|6s2hhLjmM$aQV^-N{HtlQQwbB@rde*#@9>8StAl!8R8_5^<~)&(c>e%GuNAJPT(ms5$#g4j1IftqC!G9|+*A7xwp#MzaL2ED zWs=Ny78IsN{{Tg&%Axp<^^++pKy0nm1I9|T#WhO8B^31*$$3gv)CFfb$v701=B z0CofBqI&J078;`@m8sPv6(_!T4&MT%vcF`7B?D`J~s4 z<76_7tn)LE`kAG!`g5p~9+cDbVqD&GL}?7Lf7%wKkiiM;LbJzXNTf@Z32*NQ#8Shu zBJg%Nc=D0)fJfzBb91v9(B6nhN{UVw?0v`2dZ0S1qubLm7k#-n)O&MCCAjS*g-Lrj z2+#5S4L=Q4xg^%MvKNVOCs%9TuF@XVH|DayQ*u)4gL0DNWE5lA`x<+<*yW*UD`{sO zZUdYjO4*?G4YKOz+7Th9RDcVNyx>ZZeS7yGHFoK^_Unvf02?Io3P>RSHR$m4C{CV9 zy-zV;6IL}GwqXo@gM};4Muld(P=x8zGFxhbBKvQM1$lGtFuz}x# zDt~9S#g5WSz$YHHzYm0`g^RZ{B}&yR&orIb`xx(KDsS$J#rx4@_-(h_y=2^m+HVOQ z3Xfc5pBZZj7#@{0=_$9FXj-LL1=V_z+g;5P@Dw(y*wIlqkE|d#m2Fqnilp#qyT#bG zJZnnQS0SAZ=ym%!WY{T-<$l?M!_$N@M7#DL_s~hzURZ#Z$}A zB&h5;H1yn+k(!!OiflosN>JiLSA?HT(hFqeMv|8rSt$q1Ggw_6@nm3}?G%ZoTxCkY zI6UOjlG4mumbXI#`Y}s~uOhd3IMwf$RIjrC0J(Wl#y9!?_kS%pTr`4j+AmFMW!ztj zJ5MGut@kz?8`^b*B_VqWBL^AVp7`gAaAn7foR2L^v~*Q1)ks<}K4}#xQ-oWwYH@Rx zUf=9*yXc#iqR^LZIj%J#Z!JzjJU3%o(-5#ycLf2tSv!JHCmdrO(|(Jw>U%aCyz18P zF&bmRX}{H}VR^{Hl(4h7fC%g}oSLxijt1eVcl4%4kXEE4J?l0dbz3#pgjChHA)QXq zH^*eL)C~y#0EMfqu@xP*6ojd{jVSVkZsTwYQ3uq3J+RYk>0}$1L*LT!9=Y1)-QN3j z=@VH&d`jL4DneDXr^)~UU5;~-YU^ltQNZniOn0|QPBL;%X;kCHnKfv_3paMgy)A2& zjWBH2`26E*A-mT7~7Dww;=xjY0cSM1_zXF zh(?#LrunK7zslmXVe0G+>zn;2bnntM6?DV#= zTSe(f4)pQUed9)-E4G>z%apd74mOxGLp zO!ipM#WN+fVJgWBCLyd6yi*0q_^sz9HCOd_u3CRbEm0g=t`{t4>~YpVXa4}qUu1nb zKNZdTv#)yk{OZwfeVase9upBBa6VS7pTuIQ@p*mJ6zEm0?xU!BfvjwrX56WFSXu)E>Ccn{X^?b_;D|XnH~dl&_GU$^3KpRatPAKH}?>u9DEbn}sS%|GBHIlqe&F&C-cE3qf%M#X`U6>O;-uB)&Yl~g^}N}Zgz4_G z>I&6=yIf^4Y}`-U7D-d5)HV+o`R(nUI1dc_CkwZ_@2G% zhrFX3?xH->9?~@22GO-I8~Z2p8Clthz7NYcB0im+_hpVLMIsTM)G3nv#1d>U+HBWfEBgVPIQ4Jn+wp$) z`+w<*fqVmBL;==7R?}Vy{HB^2z5EpTx+dOfkRJkysCzigOSp6_2Sbq7V=%bu&7Jx# z?>J$w5_%fl7Hz*OKfQjrh>2_;)uZt3UZ-~o8r>9;b zzrrnN1_c7geBaKTL7SX`Oqjmp7YIL^n(Lhc0<9Y*kR+P*%@cjJWMCNVHuL3aTp9|v z`By1})ASLi3;323chp!PoN3UE$du9%q2;z$a$sGikL!QS4*bKj8Yz>j#rDn?)BMdH zuTpEX!UF}rVRg@EeiJCM{e3N98^zZ(kon#q$CSIvQR6zQ%Bwfr0c8a&Gssmm^m|U) zdMJBGm3oJ8$5v@!#2Q+i7B{LcJ@h6WL7#}^r+Qsw!|u=t7_5Anpd(4o;I^Fh#2&}h zB;3Sc!a_P$UOsHihh|uC+ose_N%8coZ_8}w?Ubm!zABtCq#-hcmU@Hhy9qe zMn{={S$DrP-)&o5{7yPJV5W8nk@=DMAu(=Jiy92iDjeC6;@9&HTSX4> z_nr9O>tTJXvK{A{)0dg=)%UsqbR!p@J&%pDf?xbHpsQd*B&_eV(PS_)-UsGPEzC4u~x+Ww?^!7HAPTSYNF$e zrdnp2OV{L%+R-mYf+9!d0#Riy72=w%KiqPa&GQ8A=j9@x?w}yJ^aLBY16AFA6GE#F=*lske zZ{!$Qy4SK0Cq=7Za&V+S)Qd`_Lm^#RizhGBH@d-cMYE(w)6>(;+B#{d-OL3ud z1Q^M`xD?H+!(zHKXwdNU;9$FPT+6Mt{sxan9V1ghg?xaTr4#(yZkwXH`*v39?mxWn zPlF)`aQWxc^i|jB3ap@oxl?XA>vIadF6k-x_U(`%fSLG{T0I{21(?{P_F6T;pd!KK zNztH=&cV{&+iSLL(Tp!SjkGsCec2}(XH!fER<5DQ%W9v< zqSSb9bj0Z7u93_B{$yT0J&^MYD#JuU9i#!Skv>_J&+!V`apmVZSV&*WOP1h^rNbJS z==I7G{S_Ul;@~uwaE4WKQ%J*w{{m$0m{DvZ)ka7mTdDNCkzaJSYIqzYR0Y8_)WbXt zuK3SV4Q4~SW-dAFuFl?A6Rd3{eT;RlTM;|#VkW*U`RZH-rV)!rm>b?ZNa(G52jV7( zC+h1nQQHcQJQ-lNhSuSb%N+vLK zBq@2fFlJJu1_&)F1bKltWe#&?Cm@Gqn0o){=(@6_yNaoI9b%IuEDA_&;UkxAbo4Hr0jyxs#b7@u zKP!^YqXg3W~q$Nw%%K)38$&u0P!$(E#oE{)0{dj_|ml;4~^SkS~ft^41`Sjvv_{u zhnKfzj>As-T|liZHmkbnv*pH|*Wi=4HKnj-6z^TJ$%R?Wvc})R5GqHwJLpa0!jc}n zpOt7A#Dl6Y z@KyaTMZ+hW=+(a;3P_C*A#)?=T1oBqC-%alQ8?GdJ9(wVqY83do=1|_ zQGw6ObS6`XLj;g-ep98kSTlxcw*3X5lnnBvC%}>fZUgFl_;q&FI8Mp5Us3!a&?cDK zEbAi9YYA?`8}OUWRNsV~L~pcFaMx54pegBA5~>pj-r_5wqQE5G+vEriM9EUE6>b@xuD_%qD76TpEvGWJ;NhqfchnGbir3)VwZ5rS`9dGEK}*D_(VLa-<)`R?O6_r-&RkQ^ni za$hs+6hHcJx1VJJelc8!aVJK5Mjnm!XEKi2sXlh^_DZdiN-R4qMsz(vA={dZtt(X7 z!7VKzSS_5SqJrVQjSi?LI2;_VA#-of$glj!K|YIB?77dbAMp8W7Yon77^|xpr|E!L zXmoOL>j6`)v*+y|$#muo^yA{${#n6`(?-_5IWUz59c~cpI~ViABsJUTB_3D$6`Cl& zn^WHtoAz;^xq#S^DZWHXXGs%eQS>t8kQNb`2#kLVSb6@4gK~QLRl^MmmB+#V$7dd)X{Lb${XUzGDgAbi=|4I14@f0QN5rE)b!V9s~)XSK+d%8wW zTIvJ0bIseSV++5Frlc=}J6l7rxXswjluSV@JX|mJ&%bP6P0CGp@QyEJ^i{a}-~JG3 z(-4-b08`N9DEnOD2=$(~JAnp{9Pu~_T>h4ScyP(T-t@|d!dy+J^rY-4aQ#fjRPL|V zGA=}4hNw@GGfj@755ZqQ+^Sx~4j*h0d;!s$kzr{d0|?%A_LMvrL(2wJBl3AQn=p5b zE<$d@0`C`j4wUDX*9Lrgp#KdqL(-7|3=bY$`ch$wLU#&1+#-#?j=wh6C5--QJS(i# zxW5?HZB%s>$mU# znZDc8bkkpM=9&$&_z<2|E2@zbYiTttjQnLLB&K(+coogs9+TcUULWGLXxVCT|<5gvR6Q>HKt8D(!Ax*+X;1T2$sY%1#Aj4k8`ddL5l@z~ zD0_O77WrJd#|i*AruL>ie3~bkGZ+(W<90$FWOzG7X%?eT8&PoS>4z8c7wRtu|AU}J z(dI+BL7mGIYs{z?_^Me^k+-*YnU!^2Oj3b=&~R>-WHE29p{VonZrr(($0PLq{^#!@ zgAm=VxDQg|bh76s*4Cjt1M|BlH;i=bU@Lmpp5)RhXEDHlN5EL>RRsXhjx85O=oDf0 zD!039*Og%#y&+pvgeO&Q&DvkxLwcHDr3%_?sch3!g*?;2rz)UsxVJiciac-ST$n0d zjgDRjdSXAD75t3$;O0DPmI^&vmnOk-M>t zfrHS(2yA7$1CQ#&8G^8R#l5fN%_BU#s+G{OI*LaOxfbyA^>Xma?;fq>HYVvWjCF-( z*-1P5nC=)?!41^aOaT=Q-qDFE2a)2<_uOOyCxAB>-+W>$$F!}kgy3PJX%UQZzzi2& zh_Xc$pbY=!T6k|t>)c5?r?CC{dJ!EHy~`JxOIqQ-_4|s5eRwtEV;P6VW@eV4i_iR$ zUYTpyrgzuq#jvA~76x2*I$%sVyn@R~8*6tP%QkV#SbpqA$ZxxT6YPz-*p_6tF-&V)t~p^~AbfIkSusk9qY*q>XUd+9knB6DR+2u1$f=jL zK;{wH(ga9>oHih9SAl`|xS;Z@hDuY*bgTU*pqm7f^FO==5ey9AQ5ZRC_k{o}Ol*wj z@(=G+q($e6kTlnvad?@pn4gccfY2(D4%)ya`XMKli3%u|I4`s}92HPWO8(O(w>wXU zY_&Ii-er~^u)*pKrgrZl1~P}`zIG%Dn6~pCujr}QQmwIE_`=C!?)#u$Ie|1qh7A@OUYI&?ffZ>z znxc;w=N~mcZzs|2Jsy7-)I*(qxXF9;2MPhEpjubYgUI6vxm9O4t`IH4_q>!DU4qlwFo5_HmJxy zW?$RN;K?}{bf|X(DP~DascrNW5VEBrGAgyKZ-jyeboPxp6HT0zkQ>=cqo0{Yl2q%g z8V@3~ABe$9ZJ4e`gp=V9RJk0Bt6wSMYKF9X=X3g#bYF27NR1ga9k>Q*L(^O&ft!>| z7szLx1}`TKSat1{mA`t2L##){jh_+mEJ-@OB_x8ZpjiTE62t&g5LEk>uj?5DW^4rM z6mYouTT?`(?!l<`N>(SH$R*Oo}rsSDLP|F;OWRJv0ibz2jT z`w5DJV8wG5H&w;V-KyH1JHDw!mu4I`NxN(ZS8frq=DbD6CRr-#!pho3U@7YNxE8}K zy`4-BZHDT&WQE59*e$Ta2Hn;wy`SyJl7S*0b6xd}W|SM-r zC8ZE+1=|#{yn!ol!OtyCga)^kwzZ%coheScQWeG5o~kS72Mwd4&X>B3=lc$`VsfFF zlcYH&mz!8Tni)om)_U@CEs6n4SyeY`a z<>_54Ygm5PD$$jIB0%+sP$><1kP(MUt1)6+J`VBQD-7-A>LQzVpW$y6JJ;-Y57MlZ zrTQyz(QPxi-fv4vw16)5N2W-EX3Fo#$s7dsV4kZIJo%TUkE$smxe0htCRTL$9CZ1krytOZ@UsNO;x# zel~IRLclq6A+_|fdMD5K+LiHD`Zp8wzNF@4_8+T;o2y>xg-qr>((&;e_Q@OXd_CLU zPv6^m+lT_=mdNB95=rbc9;}a`FQq-dFFc?t$@lIa%Xu-?VLi1>k(gh&NRL_+@9Grg zn0|Gm1Rm#oZG_SoDv77uI_O`dXmB_nM|@K?=h7E2<9vL5K0Kq{q1}1C=rB)J~OG@6P(XXtdz-PV#syigwKbC%W=CEqnzxQ_Ix;Lx2`ozi5G;x`lI#H0|ZsX@W_E> zvW{)>IWanNO1dRCuN>zm17XAZ*Nj+Nenc9Z6U5(nAat{dB+k|*Z=F~sEXj{~(YOPW zTZjXmt7D6h>RC@agUXkhFY&$2}#keoY)qkxG$#F`_0M~s0qQTSQ8vJjYd zQ9-iS6#Q_D8_!>2fL)Zb9s5bwanGp8o4QyZ#kVm_`QmGfs9yl3d(mmq21RP~W@=LY zfJCpO!zA);9@45nc4NAX&HPA!AEz$-SV}FjTdfU!wsMlhW+~ysv4b5!)bXDB>i_VHIDUDWs{1g{?_(Ydl=4?u8o3%``+Rr@UmvmWYM>*x zhel+DJS?eGeEGR$Wp*ods=Q_}9m0%KzNHXx#yeBi9*K`B?VNB8jS*Gfd^~%+)H$DO z(ZuhO`kZK^IH{T`k;`er2%t66XUNA=V#7f&%_nx2$_{aE2-pZOFkjqg%EYs z$ubAA_hO88}vfY1OFfx~?cK>JD3r-6o?m1b^mpCN0#^Od2ZR$t`L8$)qdVbsUT>!8_K zj`S4d)>Qljx4ur$BWA$+!JQ`EgQlxz#OVL;&`bZ@p*OS7()(Pwr#!~-+_)@&*td)F z^XI1`d$c{Rm(fe34DF{Ei4;i-FBB9AB9_j~Q6VM`Bdsq3)7y5PwR(%}*sOWBnNH7D zSBP%@hi6~bhZ;HvnQbL1@5+z+s$r?n1#eabQtW>l%@Ody#n1#;-7AX)dh)3ts+vHT{qqO3A^5LLJ zbBfyzuA>(BTTEj$m*IKI0?n$ay_Ho{RHBRWD)y?nRb4h-dYj%IvY zHP}v#N~lZOEPg!DpBDapykx5hrX`PV&lNmpijgtM)eTXX9!VX`%+>jZi&>x;!?H>X z!1Km8-&hNxklfsmLk);H+4f2#`WLXIzu`RRNL%#|(25L%I znl!DLr?iYU<^#$IUDE2SrW`A8T0p$inlYOdpjE2W zPJ7m1!)p6-Gv^;3epywalQv0t;YjNH-9R6bsqI_elBPiKa}HbcjM|h)1gn}1l>%Wx zcXmM6jO4R&I@>*BvEy-`URrXXlTONevHU&D z=f6{H9sbM&I$BO%R?oh-nD?NX*&;OKPxDXfrAZQ8oMdolAY~v6`E1_t5>uQ!>y+c) zeqQimI`!Qjon`BlTximc>$}%C5<22sgKiMT1!1@+!>rjM8Dea~Si83H0ODKu9F*Zg z8FOHlg11!lP)HS>QdycJm~E(0rIJs_QO?o=4*u<#Xkda=v_Q+7&C#PLQx!GwJIb4s z8BDjT2%4mS@;WJG;Hbrsc#=4ZzuJk25%!wKYeBUNlO3cDO2iGMO%74f)=79MFxM%d zvzaBY$pb*Ob3+Dd?{rHHjqDPV=l);LyeUn5@QgQxKccNOL}1{@9oOI6Z(L7!Gf%h} zj2-li?nrPgT7d!PqL9^$&5cQnEO(OoqeM?jgbH(h$nMq^`9#Rk(5c(C4xwmmo*}ZY zrfR96`dZ-bDp>hE@#ge4+hVZs_@Oq`-BgbWH4iglR#;w*-MZpB&;8F!oB4%$GfsgB zxS(a33Q1n&(a+P{m|gkHtt&ZSr?OS+#=#Vtd(isCvb7MYe9AN_M8Nh;XRp5HD}Kti z8`DRg`H^`wnAw(-{c!hC&+}?3z)??7R6&D{_z9{bG0{Gr!CL0*b@-#B-_zZ&RCLMPWec1C z+{R~9c3lB>y3@MB!Z`cFXc9^nwSEApb&~EyMR)2yJl=%ADD2<31ZIB$>R`2g);4-w z*AEwk;lygkvU__6G;VD_76KEKfcIe8H)lt$w@g^51p`83%O>EyV!TS*p9h@;h zM(z~1%PTy8#uIpNEf^N02)K9{C-LUw$>s+f`Ka7!43?T3EW7ugb#MAF640B35^IU4 zm0+0`iJqXaf&@AN%B2q>3^t_kzH~kBO73-g_Dytl>8p{(d<=@|H~&DNHhkPuN7^z% zz4gk6W}RzC*f>!=L}fUz;!#D@SRpHI#P7Wh6&R*HanKdV@SozGo1fP yahI3uL*Ebwe7#c}81|KIb!<{yy%oBuDuZzQ|` literal 0 HcmV?d00001 diff --git a/examples/draganddrop/puzzle/puzzle.py b/examples/draganddrop/puzzle/puzzle.py new file mode 100644 index 0000000..086fe46 --- /dev/null +++ b/examples/draganddrop/puzzle/puzzle.py @@ -0,0 +1,371 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import random + +from PyQt6.QtCore import (pyqtSignal, QByteArray, QDataStream, QIODevice, + QMimeData, QPoint, QRect, QSize, Qt) +from PyQt6.QtGui import QDrag, QColor, QCursor, QIcon, QPainter, QPixmap +from PyQt6.QtWidgets import (QApplication, QFileDialog, QFrame, QHBoxLayout, + QListView, QListWidget, QListWidgetItem, QMainWindow, QMessageBox, + QSizePolicy, QWidget) + + +class PuzzleWidget(QWidget): + + puzzleCompleted = pyqtSignal() + + def __init__(self, parent=None): + super().__init__(parent) + + self.piecePixmaps = [] + self.pieceRects = [] + self.pieceLocations = [] + self.highlightedRect = QRect() + self.inPlace = 0 + + self.setAcceptDrops(True) + self.setMinimumSize(400, 400) + self.setMaximumSize(400, 400) + + def clear(self): + self.pieceLocations = [] + self.piecePixmaps = [] + self.pieceRects = [] + self.highlightedRect = QRect() + self.inPlace = 0 + self.update() + + def dragEnterEvent(self, event): + if event.mimeData().hasFormat('image/x-puzzle-piece'): + event.accept() + else: + event.ignore() + + def dragLeaveEvent(self, event): + updateRect = self.highlightedRect + self.highlightedRect = QRect() + self.update(updateRect) + event.accept() + + def dragMoveEvent(self, event): + updateRect = self.highlightedRect.united( + self.targetSquare(event.position().toPoint())) + + if event.mimeData().hasFormat('image/x-puzzle-piece') and self.findPiece(self.targetSquare(event.position().toPoint())) == -1: + self.highlightedRect = self.targetSquare( + event.position().toPoint()) + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + else: + self.highlightedRect = QRect() + event.ignore() + + self.update(updateRect) + + def dropEvent(self, event): + if event.mimeData().hasFormat('image/x-puzzle-piece') and self.findPiece(self.targetSquare(event.position().toPoint())) == -1: + pieceData = event.mimeData().data('image/x-puzzle-piece') + dataStream = QDataStream(pieceData, + QIODevice.OpenModeFlag.ReadOnly) + square = self.targetSquare(event.position().toPoint()) + pixmap = QPixmap() + location = QPoint() + dataStream >> pixmap >> location + + self.pieceLocations.append(location) + self.piecePixmaps.append(pixmap) + self.pieceRects.append(square) + + self.hightlightedRect = QRect() + self.update(square) + + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + + if location == QPoint(square.x() / 80, square.y() / 80): + self.inPlace += 1 + if self.inPlace == 25: + self.puzzleCompleted.emit() + else: + self.highlightedRect = QRect() + event.ignore() + + def findPiece(self, pieceRect): + try: + return self.pieceRects.index(pieceRect) + except ValueError: + return -1 + + def mousePressEvent(self, event): + square = self.targetSquare(event.position().toPoint()) + found = self.findPiece(square) + + if found == -1: + return + + location = self.pieceLocations[found] + pixmap = self.piecePixmaps[found] + del self.pieceLocations[found] + del self.piecePixmaps[found] + del self.pieceRects[found] + + if location == QPoint(square.x() / 80, square.y() / 80): + self.inPlace -= 1 + + self.update(square) + + itemData = QByteArray() + dataStream = QDataStream(itemData, QIODevice.OpenModeFlag.WriteOnly) + + dataStream << pixmap << location + + mimeData = QMimeData() + mimeData.setData('image/x-puzzle-piece', itemData) + + drag = QDrag(self) + drag.setMimeData(mimeData) + drag.setHotSpot(event.position().toPoint() - square.topLeft()) + drag.setPixmap(pixmap) + + if drag.exec(Qt.DropAction.MoveAction) != Qt.DropAction.MoveAction: + self.pieceLocations.insert(found, location) + self.piecePixmaps.insert(found, pixmap) + self.pieceRects.insert(found, square) + self.update(self.targetSquare(event.position().toPoint())) + + if location == QPoint(square.x() / 80, square.y() / 80): + self.inPlace += 1 + + def paintEvent(self, event): + painter = QPainter() + painter.begin(self) + painter.fillRect(event.rect(), Qt.GlobalColor.white) + + if self.highlightedRect.isValid(): + painter.setBrush(QColor("#ffcccc")) + painter.setPen(Qt.PenStyle.NoPen) + painter.drawRect(self.highlightedRect.adjusted(0, 0, -1, -1)) + + for rect, pixmap in zip(self.pieceRects, self.piecePixmaps): + painter.drawPixmap(rect, pixmap) + + painter.end() + + def targetSquare(self, position): + return QRect(position.x() // 80 * 80, position.y() // 80 * 80, 80, 80) + + +class PiecesList(QListWidget): + def __init__(self, parent=None): + super().__init__(parent) + + self.setDragEnabled(True) + self.setViewMode(QListView.ViewMode.IconMode) + self.setIconSize(QSize(60, 60)) + self.setSpacing(10) + self.setAcceptDrops(True) + self.setDropIndicatorShown(True) + + def dragEnterEvent(self, event): + if event.mimeData().hasFormat('image/x-puzzle-piece'): + event.accept() + else: + event.ignore() + + def dragMoveEvent(self, event): + if event.mimeData().hasFormat('image/x-puzzle-piece'): + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + else: + event.ignore() + + def dropEvent(self, event): + if event.mimeData().hasFormat('image/x-puzzle-piece'): + pieceData = event.mimeData().data('image/x-puzzle-piece') + dataStream = QDataStream(pieceData, + QIODevice.OpenModeFlag.ReadOnly) + pixmap = QPixmap() + location = QPoint() + dataStream >> pixmap >> location + + self.addPiece(pixmap, location) + + event.setDropAction(Qt.DropAction.MoveAction) + event.accept() + else: + event.ignore() + + def addPiece(self, pixmap, location): + pieceItem = QListWidgetItem(self) + pieceItem.setIcon(QIcon(pixmap)) + pieceItem.setData(Qt.ItemDataRole.UserRole, pixmap) + pieceItem.setData(Qt.ItemDataRole.UserRole+1, location) + pieceItem.setFlags(Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsDragEnabled) + + def startDrag(self, supportedActions): + item = self.currentItem() + + itemData = QByteArray() + dataStream = QDataStream(itemData, QIODevice.OpenModeFlag.WriteOnly) + pixmap = QPixmap(item.data(Qt.ItemDataRole.UserRole)) + location = item.data(Qt.ItemDataRole.UserRole+1) + + dataStream << pixmap << location + + mimeData = QMimeData() + mimeData.setData('image/x-puzzle-piece', itemData) + + drag = QDrag(self) + drag.setMimeData(mimeData) + drag.setHotSpot(QPoint(pixmap.width() // 2, pixmap.height() // 2)) + drag.setPixmap(pixmap) + + if drag.exec(Qt.DropAction.MoveAction) == Qt.DropAction.MoveAction: + if self.currentItem() is not None: + self.takeItem(self.row(item)) + + +class MainWindow(QMainWindow): + def __init__(self, parent=None): + super().__init__(parent) + + self.puzzleImage = QPixmap() + + self.setupMenus() + self.setupWidgets() + + self.setSizePolicy( + QSizePolicy(QSizePolicy.Policy.Fixed, + QSizePolicy.Policy.Fixed)) + self.setWindowTitle("Puzzle") + + def openImage(self, path=None): + if not path: + path, _ = QFileDialog.getOpenFileName(self, "Open Image", '', + "Image Files (*.png *.jpg *.bmp)") + + if path: + newImage = QPixmap() + if not newImage.load(path): + QMessageBox.warning(self, "Open Image", + "The image file could not be loaded.", + QMessageBox.Cancel) + return + + self.puzzleImage = newImage + self.setupPuzzle() + + def setCompleted(self): + QMessageBox.information(self, "Puzzle Completed", + "Congratulations! You have completed the puzzle!\nClick OK " + "to start again.", + QMessageBox.Ok) + + self.setupPuzzle() + + def setupPuzzle(self): + size = min(self.puzzleImage.width(), self.puzzleImage.height()) + self.puzzleImage = self.puzzleImage.copy( + (self.puzzleImage.width() - size) // 2, + (self.puzzleImage.height() - size) // 2, size, size).scaled(400, + 400, Qt.AspectRatioMode.IgnoreAspectRatio, + Qt.TransformationMode.SmoothTransformation) + + self.piecesList.clear() + + for y in range(5): + for x in range(5): + pieceImage = self.puzzleImage.copy(x*80, y*80, 80, 80) + self.piecesList.addPiece(pieceImage, QPoint(x,y)) + + random.seed(QCursor.pos().x() ^ QCursor.pos().y()) + + for i in range(self.piecesList.count()): + if random.random() < 0.5: + item = self.piecesList.takeItem(i) + self.piecesList.insertItem(0, item) + + self.puzzleWidget.clear() + + def setupMenus(self): + fileMenu = self.menuBar().addMenu("&File") + + openAction = fileMenu.addAction("&Open...") + openAction.setShortcut("Ctrl+O") + + exitAction = fileMenu.addAction("E&xit") + exitAction.setShortcut("Ctrl+Q") + + gameMenu = self.menuBar().addMenu("&Game") + + restartAction = gameMenu.addAction("&Restart") + + openAction.triggered.connect(self.openImage) + exitAction.triggered.connect(QApplication.instance().quit) + restartAction.triggered.connect(self.setupPuzzle) + + def setupWidgets(self): + frame = QFrame() + frameLayout = QHBoxLayout(frame) + + self.piecesList = PiecesList() + + self.puzzleWidget = PuzzleWidget() + + self.puzzleWidget.puzzleCompleted.connect(self.setCompleted, + Qt.ConnectionType.QueuedConnection) + + frameLayout.addWidget(self.piecesList) + frameLayout.addWidget(self.puzzleWidget) + self.setCentralWidget(frame) + + +if __name__ == '__main__': + + import os + import sys + + app = QApplication(sys.argv) + window = MainWindow() + window.openImage(os.path.join(os.path.dirname(__file__), 'example.jpg')) + window.show() + sys.exit(app.exec()) diff --git a/examples/multimedia/audiodevices/audiodevices.py b/examples/multimedia/audiodevices/audiodevices.py new file mode 100644 index 0000000..480b212 --- /dev/null +++ b/examples/multimedia/audiodevices/audiodevices.py @@ -0,0 +1,207 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2017 The Qt Company Ltd. +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtMultimedia import (QAudio, QAudioDevice, QAudioFormat, + QMediaDevices) +from PyQt6.QtWidgets import QApplication, QTableWidgetItem, QMainWindow + +from ui_audiodevicesbase import Ui_AudioDevicesBase + + +class AudioDevicesBase(QMainWindow, Ui_AudioDevicesBase): + + def __init__(self, parent=None): + super().__init__(parent) + + self.setupUi(self) + + +class AudioTest(AudioDevicesBase): + + def __init__(self, parent=None): + super().__init__(parent) + + self.devices = QMediaDevices(self) + self.deviceInfo = QAudioDevice() + self.settings = QAudioFormat() + self.mode = QAudioDevice.Mode.Input + + self.testButton.clicked.connect(self.test) + self.modeBox.activated.connect(self.modeChanged) + self.deviceBox.activated.connect(self.deviceChanged) + self.sampleRateSpinBox.valueChanged.connect(self.sampleRateChanged) + self.channelsSpinBox.valueChanged.connect(self.channelChanged) + self.sampleFormatBox.activated.connect(self.sampleFormatChanged) + self.populateTableButton.clicked.connect(self.populateTable) + + self.devices.audioInputsChanged.connect(self.updateAudioDevices) + self.devices.audioOutputsChanged.connect(self.updateAudioDevices) + + self.modeBox.setCurrentIndex(0) + self.modeChanged(0) + self.deviceBox.setCurrentIndex(0) + self.deviceChanged(0) + + def test(self): + self.testResult.clear() + + if not self.deviceInfo.isNull(): + if self.deviceInfo.isFormatSupported(self.settings): + self.testResult.setText("Success") + self.nearestSampleRate.setText("") + self.nearestChannel.setText("") + self.nearestSampleFormat.setText("") + else: + nearest = self.deviceInfo.preferredFormat() + self.testResult.setText("Failed") + self.nearestSampleRate.setText(str(nearest.sampleRate())) + self.nearestChannel.setText(str(nearest.channelCount())) + self.nearestSampleFormat.setText( + self.sampleFormatToString(nearest.sampleFormat())) + else: + self.testResult.setText("No Device") + + sampleFormatMap = { + QAudioFormat.SampleFormat.UInt8: "Unsigned 8 bit", + QAudioFormat.SampleFormat.Int16: "Signed 16 bit", + QAudioFormat.SampleFormat.Int32: "Signed 32 bit", + QAudioFormat.SampleFormat.Float: "Float" + } + + @classmethod + def sampleFormatToString(cls, sampleFormat): + return cls.sampleFormatMap.get(sampleFormat, "Unknown") + + def updateAudioDevices(self): + self.deviceBox.clear() + + devs = self.devices.audioInputs() if self.mode is QAudioDevice.Mode.Input else self.devices.audioOutputs() + + for deviceInfo in devs: + self.deviceBox.addItem(deviceInfo.description(), deviceInfo) + + def modeChanged(self, idx): + self.testResult.clear() + + self.mode = QAudioDevice.Mode.Input if idx == 0 else QAudioDevice.Mode.Output + self.updateAudioDevices() + self.deviceBox.setCurrentIndex(0) + self.deviceChanged(0) + + def deviceChanged(self, idx): + self.testResult.clear() + + if self.deviceBox.count() == 0: + return + + self.deviceInfo = self.deviceBox.itemData(idx) + + minSampleRate = self.deviceInfo.minimumSampleRate() + maxSampleRate = self.deviceInfo.maximumSampleRate() + + self.sampleRateSpinBox.clear() + self.sampleRateSpinBox.setMinimum(minSampleRate) + self.sampleRateSpinBox.setMaximum(maxSampleRate) + sampleValue = max(minSampleRate, min(48000, maxSampleRate)) + self.settings.setSampleRate(sampleValue) + + minChannelCount = self.deviceInfo.minimumChannelCount() + maxChannelCount = self.deviceInfo.maximumChannelCount() + + self.channelsSpinBox.clear() + self.channelsSpinBox.setMinimum(minChannelCount) + self.channelsSpinBox.setMaximum(maxChannelCount) + channelValue = max(minChannelCount, min(2, maxChannelCount)) + self.settings.setChannelCount(channelValue) + + self.sampleFormatBox.clear() + sampleFormats = self.deviceInfo.supportedSampleFormats() + self.sampleFormatBox.addItems( + [self.sampleFormatToString(st) for st in sampleFormats]) + if len(sampleFormats) != 0: + self.settings.setSampleFormat(sampleFormats[0]) + + self.allFormatsTable.clearContents() + + def populateTable(self): + row = 0 + + for sampleFormat in self.deviceInfo.supportedSampleFormats(): + self.allFormatsTable.setRowCount(row + 1) + + sampleTypeItem = QTableWidgetItem( + self.sampleFormatToString(sampleFormat)) + self.allFormatsTable.setItem(row, 0, sampleTypeItem) + + sampleRateItem = QTableWidgetItem( + "{0} - {1}".format(self.deviceInfo.minimumSampleRate(), + self.deviceInfo.maximumSampleRate())) + self.allFormatsTable.setItem(row, 1, sampleRateItem) + + channelsItem = QTableWidgetItem( + "{0} - {1}".format(self.deviceInfo.minimumChannelCount(), + self.deviceInfo.maximumChannelCount())) + self.allFormatsTable.setItem(row, 2, channelsItem) + + row += 1 + + def sampleRateChanged(self, value): + self.settings.setSampleRate(value) + + def channelChanged(self, value): + self.settings.setChannelCount(value) + + def sampleFormatChanged(self, idx): + formats = self.deviceInfo.supportedSampleFormats() + self.settings.setSampleFormat(formats[idx]) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + app.setApplicationName("Audio Device Test") + + audio = AudioTest() + audio.show() + + sys.exit(app.exec()) diff --git a/examples/multimedia/audiodevices/audiodevicesbase.ui b/examples/multimedia/audiodevices/audiodevicesbase.ui new file mode 100644 index 0000000..33a7cd2 --- /dev/null +++ b/examples/multimedia/audiodevices/audiodevicesbase.ui @@ -0,0 +1,311 @@ + + + AudioDevicesBase + + + + 0 + 0 + 646 + 528 + + + + Audio Devices + + + + + + + + 0 + 0 + + + + true + + + + + 0 + 0 + 626 + 480 + + + + + + + + + Mode + + + + + + + Device + + + + + + + + Input + + + + + Output + + + + + + + + + + + 0 + + + + Test format + + + + + + Test + + + + + + + + + + + + + + Channels + + + + + + + false + + + + + + + false + + + + + + + Sample Format + + + + + + + false + + + + + + + + + + Frequency (Hz) + + + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + + <i>Actual Settings</i> + + + Qt::RichText + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Nearest Settings</span></p></body></html> + + + Qt::RichText + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + All formats + + + + + + Populate table + + + + + + + QAbstractItemView::NoEditTriggers + + + false + + + QAbstractItemView::NoSelection + + + QAbstractItemView::SelectItems + + + Qt::ElideNone + + + false + + + false + + + false + + + 3 + + + false + + + true + + + false + + + false + + + + Sample Format + + + AlignCenter + + + + + Frequency (Hz) + + + AlignCenter + + + + + Channels + + + AlignCenter + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/multimedia/audiodevices/ui_audiodevicesbase.py b/examples/multimedia/audiodevices/ui_audiodevicesbase.py new file mode 100644 index 0000000..9515a6d --- /dev/null +++ b/examples/multimedia/audiodevices/ui_audiodevicesbase.py @@ -0,0 +1,191 @@ +# Form implementation generated from reading ui file 'audiodevicesbase.ui' +# +# Created by: PyQt6 UI code generator 6.2.0.dev2107180056 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_AudioDevicesBase(object): + def setupUi(self, AudioDevicesBase): + AudioDevicesBase.setObjectName("AudioDevicesBase") + AudioDevicesBase.resize(646, 528) + self.centralwidget = QtWidgets.QWidget(AudioDevicesBase) + self.centralwidget.setObjectName("centralwidget") + self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) + self.verticalLayout.setObjectName("verticalLayout") + self.scrollArea = QtWidgets.QScrollArea(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth()) + self.scrollArea.setSizePolicy(sizePolicy) + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents = QtWidgets.QWidget() + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 626, 480)) + self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") + self.gridLayout_4 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents) + self.gridLayout_4.setObjectName("gridLayout_4") + self.gridLayout_2 = QtWidgets.QGridLayout() + self.gridLayout_2.setObjectName("gridLayout_2") + self.modeLabel = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.modeLabel.setObjectName("modeLabel") + self.gridLayout_2.addWidget(self.modeLabel, 0, 0, 1, 1) + self.deviceLabel = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.deviceLabel.setObjectName("deviceLabel") + self.gridLayout_2.addWidget(self.deviceLabel, 0, 1, 1, 1) + self.modeBox = QtWidgets.QComboBox(self.scrollAreaWidgetContents) + self.modeBox.setObjectName("modeBox") + self.modeBox.addItem("") + self.modeBox.addItem("") + self.gridLayout_2.addWidget(self.modeBox, 1, 0, 1, 1) + self.deviceBox = QtWidgets.QComboBox(self.scrollAreaWidgetContents) + self.deviceBox.setObjectName("deviceBox") + self.gridLayout_2.addWidget(self.deviceBox, 1, 1, 1, 1) + self.tabWidget = QtWidgets.QTabWidget(self.scrollAreaWidgetContents) + self.tabWidget.setObjectName("tabWidget") + self.testFormatTab = QtWidgets.QWidget() + self.testFormatTab.setObjectName("testFormatTab") + self.gridLayout = QtWidgets.QGridLayout(self.testFormatTab) + self.gridLayout.setObjectName("gridLayout") + self.testButton = QtWidgets.QPushButton(self.testFormatTab) + self.testButton.setObjectName("testButton") + self.gridLayout.addWidget(self.testButton, 12, 1, 1, 1) + self.testResult = QtWidgets.QLabel(self.testFormatTab) + self.testResult.setText("") + self.testResult.setObjectName("testResult") + self.gridLayout.addWidget(self.testResult, 12, 2, 1, 1) + self.actualChannelLabel = QtWidgets.QLabel(self.testFormatTab) + self.actualChannelLabel.setObjectName("actualChannelLabel") + self.gridLayout.addWidget(self.actualChannelLabel, 4, 0, 1, 1) + self.nearestSampleRate = QtWidgets.QLineEdit(self.testFormatTab) + self.nearestSampleRate.setEnabled(False) + self.nearestSampleRate.setObjectName("nearestSampleRate") + self.gridLayout.addWidget(self.nearestSampleRate, 2, 2, 1, 1) + self.nearestSampleFormat = QtWidgets.QLineEdit(self.testFormatTab) + self.nearestSampleFormat.setEnabled(False) + self.nearestSampleFormat.setObjectName("nearestSampleFormat") + self.gridLayout.addWidget(self.nearestSampleFormat, 5, 2, 1, 1) + self.actualSampleTypeLabel = QtWidgets.QLabel(self.testFormatTab) + self.actualSampleTypeLabel.setObjectName("actualSampleTypeLabel") + self.gridLayout.addWidget(self.actualSampleTypeLabel, 5, 0, 1, 1) + self.nearestChannel = QtWidgets.QLineEdit(self.testFormatTab) + self.nearestChannel.setEnabled(False) + self.nearestChannel.setObjectName("nearestChannel") + self.gridLayout.addWidget(self.nearestChannel, 4, 2, 1, 1) + self.sampleFormatBox = QtWidgets.QComboBox(self.testFormatTab) + self.sampleFormatBox.setObjectName("sampleFormatBox") + self.gridLayout.addWidget(self.sampleFormatBox, 5, 1, 1, 1) + self.actualFreqLabel = QtWidgets.QLabel(self.testFormatTab) + self.actualFreqLabel.setObjectName("actualFreqLabel") + self.gridLayout.addWidget(self.actualFreqLabel, 2, 0, 1, 1) + self.actualLabel = QtWidgets.QLabel(self.testFormatTab) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.actualLabel.sizePolicy().hasHeightForWidth()) + self.actualLabel.setSizePolicy(sizePolicy) + self.actualLabel.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) + self.actualLabel.setFrameShadow(QtWidgets.QFrame.Shadow.Plain) + self.actualLabel.setTextFormat(QtCore.Qt.TextFormat.RichText) + self.actualLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.actualLabel.setObjectName("actualLabel") + self.gridLayout.addWidget(self.actualLabel, 0, 1, 1, 1) + self.nearestLabel = QtWidgets.QLabel(self.testFormatTab) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.nearestLabel.sizePolicy().hasHeightForWidth()) + self.nearestLabel.setSizePolicy(sizePolicy) + self.nearestLabel.setFrameShape(QtWidgets.QFrame.Shape.NoFrame) + self.nearestLabel.setFrameShadow(QtWidgets.QFrame.Shadow.Plain) + self.nearestLabel.setTextFormat(QtCore.Qt.TextFormat.RichText) + self.nearestLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.nearestLabel.setObjectName("nearestLabel") + self.gridLayout.addWidget(self.nearestLabel, 0, 2, 1, 1) + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.gridLayout.addItem(spacerItem, 13, 1, 1, 1) + self.sampleRateSpinBox = QtWidgets.QSpinBox(self.testFormatTab) + self.sampleRateSpinBox.setObjectName("sampleRateSpinBox") + self.gridLayout.addWidget(self.sampleRateSpinBox, 2, 1, 1, 1) + self.channelsSpinBox = QtWidgets.QSpinBox(self.testFormatTab) + self.channelsSpinBox.setObjectName("channelsSpinBox") + self.gridLayout.addWidget(self.channelsSpinBox, 4, 1, 1, 1) + self.tabWidget.addTab(self.testFormatTab, "") + self.tab = QtWidgets.QWidget() + self.tab.setObjectName("tab") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.tab) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.populateTableButton = QtWidgets.QPushButton(self.tab) + self.populateTableButton.setObjectName("populateTableButton") + self.verticalLayout_2.addWidget(self.populateTableButton) + self.allFormatsTable = QtWidgets.QTableWidget(self.tab) + self.allFormatsTable.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers) + self.allFormatsTable.setDragDropOverwriteMode(False) + self.allFormatsTable.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.NoSelection) + self.allFormatsTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectItems) + self.allFormatsTable.setTextElideMode(QtCore.Qt.TextElideMode.ElideNone) + self.allFormatsTable.setWordWrap(False) + self.allFormatsTable.setCornerButtonEnabled(False) + self.allFormatsTable.setColumnCount(3) + self.allFormatsTable.setObjectName("allFormatsTable") + self.allFormatsTable.setRowCount(0) + item = QtWidgets.QTableWidgetItem() + item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.allFormatsTable.setHorizontalHeaderItem(0, item) + item = QtWidgets.QTableWidgetItem() + item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.allFormatsTable.setHorizontalHeaderItem(1, item) + item = QtWidgets.QTableWidgetItem() + item.setTextAlignment(QtCore.Qt.AlignmentFlag.AlignCenter) + self.allFormatsTable.setHorizontalHeaderItem(2, item) + self.allFormatsTable.horizontalHeader().setHighlightSections(False) + self.allFormatsTable.horizontalHeader().setStretchLastSection(True) + self.allFormatsTable.verticalHeader().setVisible(False) + self.allFormatsTable.verticalHeader().setHighlightSections(False) + self.verticalLayout_2.addWidget(self.allFormatsTable) + self.tabWidget.addTab(self.tab, "") + self.gridLayout_2.addWidget(self.tabWidget, 2, 0, 1, 2) + self.gridLayout_4.addLayout(self.gridLayout_2, 0, 0, 1, 1) + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + self.verticalLayout.addWidget(self.scrollArea) + AudioDevicesBase.setCentralWidget(self.centralwidget) + self.statusbar = QtWidgets.QStatusBar(AudioDevicesBase) + self.statusbar.setObjectName("statusbar") + AudioDevicesBase.setStatusBar(self.statusbar) + + self.retranslateUi(AudioDevicesBase) + self.tabWidget.setCurrentIndex(0) + QtCore.QMetaObject.connectSlotsByName(AudioDevicesBase) + + def retranslateUi(self, AudioDevicesBase): + _translate = QtCore.QCoreApplication.translate + AudioDevicesBase.setWindowTitle(_translate("AudioDevicesBase", "Audio Devices")) + self.modeLabel.setText(_translate("AudioDevicesBase", "Mode")) + self.deviceLabel.setText(_translate("AudioDevicesBase", "Device")) + self.modeBox.setItemText(0, _translate("AudioDevicesBase", "Input")) + self.modeBox.setItemText(1, _translate("AudioDevicesBase", "Output")) + self.testButton.setText(_translate("AudioDevicesBase", "Test")) + self.actualChannelLabel.setText(_translate("AudioDevicesBase", "Channels")) + self.actualSampleTypeLabel.setText(_translate("AudioDevicesBase", "Sample Format")) + self.actualFreqLabel.setText(_translate("AudioDevicesBase", "Frequency (Hz)")) + self.actualLabel.setText(_translate("AudioDevicesBase", "Actual Settings")) + self.nearestLabel.setText(_translate("AudioDevicesBase", "\n" +"\n" +"

Nearest Settings

")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.testFormatTab), _translate("AudioDevicesBase", "Test format")) + self.populateTableButton.setText(_translate("AudioDevicesBase", "Populate table")) + self.allFormatsTable.setSortingEnabled(False) + item = self.allFormatsTable.horizontalHeaderItem(0) + item.setText(_translate("AudioDevicesBase", "Sample Format")) + item = self.allFormatsTable.horizontalHeaderItem(1) + item.setText(_translate("AudioDevicesBase", "Frequency (Hz)")) + item = self.allFormatsTable.horizontalHeaderItem(2) + item.setText(_translate("AudioDevicesBase", "Channels")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("AudioDevicesBase", "All formats")) diff --git a/examples/multimedia/audiooutput.py b/examples/multimedia/audiooutput.py new file mode 100644 index 0000000..743389d --- /dev/null +++ b/examples/multimedia/audiooutput.py @@ -0,0 +1,267 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2017 The Qt Company Ltd. +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from math import pi, sin +from struct import pack + +from PyQt6.QtCore import QByteArray, QIODevice, Qt, QTimer, qWarning +from PyQt6.QtMultimedia import (QAudio, QAudioDevice, QAudioFormat, QAudioSink, + QMediaDevices) +from PyQt6.QtWidgets import (QApplication, QComboBox, QHBoxLayout, QLabel, + QMainWindow, QPushButton, QSlider, QVBoxLayout, QWidget) + + +class Generator(QIODevice): + + def __init__(self, format, durationUs, sampleRate): + super().__init__() + + self.m_pos = 0 + self.m_buffer = QByteArray() + + if format.isValid(): + self.generateData(format, durationUs, sampleRate) + + def start(self): + self.open(QIODevice.OpenModeFlag.ReadOnly) + + def stop(self): + self.m_pos = 0 + self.close() + + def generateData(self, format, durationUs, sampleRate): + packFormat = '' + + sampleFormat = format.sampleFormat() + + if sampleFormat is QAudioFormat.SampleFormat.UInt8: + scaler = lambda x: ((1.0 + x) / 2 * 255) + packFormat = 'B' + elif sampleFormat is QAudioFormat.SampleFormat.Int16: + scaler = lambda x: x * 32767 + packFormat = 'h' + elif sampleFormat is QAudioFormat.SampleFormat.Int32: + scaler = lambda x: x * 2147483647 + packFormat = 'i' + elif sampleFormat is QAudioFormat.SampleFormat.Float: + scaler = lambda x: x + packFormat = 'f' + + assert(packFormat != '') + + channelBytes = format.bytesPerSample() + sampleBytes = format.channelCount() * channelBytes + length = format.bytesForDuration(durationUs) + + assert(length % sampleBytes == 0) + + self.m_buffer.clear() + sampleIndex = 0 + factor = 2 * pi * sampleRate / format.sampleRate() + + while length != 0: + x = sin((sampleIndex % format.sampleRate()) * factor) + packed = pack(packFormat, int(scaler(x))) + + for _ in range(format.channelCount()): + self.m_buffer.append(packed) + length -= channelBytes + + sampleIndex += 1 + + def readData(self, maxlen): + data = QByteArray() + total = 0 + + while maxlen > total: + chunk = min(self.m_buffer.size() - self.m_pos, maxlen - total) + data.append(self.m_buffer.mid(self.m_pos, chunk)) + self.m_pos = (self.m_pos + chunk) % self.m_buffer.size() + total += chunk + + return data.data() + + def writeData(self, data): + return 0 + + def bytesAvailable(self): + return self.m_buffer.size() + super().bytesAvailable() + + +class AudioTest(QMainWindow): + + DurationSeconds = 1 + ToneSampleRateHz = 600 + + def __init__(self): + super().__init__() + + self.m_devices = QMediaDevices(self) + self.m_pushTimer = QTimer(self) + self.m_pullMode = True + self.m_generator = None + self.m_audioOutput = None + + self.initializeWindow() + self.initializeAudio(self.m_devices.defaultAudioOutput()) + + def initializeWindow(self): + layout = QVBoxLayout() + + self.m_deviceBox = QComboBox(activated=self.deviceChanged) + defaultDeviceInfo = self.m_devices.defaultAudioOutput() + self.m_deviceBox.addItem(defaultDeviceInfo.description(), + defaultDeviceInfo) + + for deviceInfo in self.m_devices.audioOutputs(): + if deviceInfo != defaultDeviceInfo: + self.m_deviceBox.addItem(deviceInfo.description(), deviceInfo) + + layout.addWidget(self.m_deviceBox) + + self.m_modeButton = QPushButton(clicked=self.toggleMode) + layout.addWidget(self.m_modeButton) + + self.m_suspendResumeButton = QPushButton( + clicked=self.toggleSuspendResume) + layout.addWidget(self.m_suspendResumeButton) + + volumeBox = QHBoxLayout() + volumeLabel = QLabel("Volume:") + self.m_volumeSlider = QSlider(Qt.Orientation.Horizontal, minimum=0, + maximum=100, singleStep=10, valueChanged=self.volumeChanged) + volumeBox.addWidget(volumeLabel) + volumeBox.addWidget(self.m_volumeSlider) + + layout.addLayout(volumeBox) + + window = QWidget() + window.setLayout(layout) + + self.setCentralWidget(window) + + def initializeAudio(self, deviceInfo): + format = deviceInfo.preferredFormat() + + self.m_generator = Generator(format, self.DurationSeconds * 1000000, + self.ToneSampleRateHz) + + self.m_audioOutput = QAudioSink(deviceInfo, format) + + self.m_generator.start() + + initialVolume = QAudio.convertVolume(self.m_audioOutput.volume(), + QAudio.VolumeScale.LinearVolumeScale, + QAudio.VolumeScale.LogarithmicVolumeScale) + self.m_volumeSlider.setValue(int(initialVolume * 100)) + + self.toggleMode() + + def deviceChanged(self, index): + self.m_generator.stop() + self.m_audioOutput.stop() + + try: + # This will raise an exception if the are no connections. + self.m_audioOutput.disconnect() + except: + pass + + self.initializeAudio(self.m_deviceBox.itemData(index)) + + def volumeChanged(self, value): + linearVolume = QAudio.convertVolume(value / 100.0, + QAudio.VolumeScale.LinearVolumeScale, + QAudio.VolumeScale.LogarithmicVolumeScale) + + self.m_audioOutput.setVolume(linearVolume) + + def toggleMode(self): + self.m_pushTimer.stop() + self.m_audioOutput.stop() + self.toggleSuspendResume() + + if self.m_pullMode: + self.m_modeButton.setText("Enable push mode") + self.m_audioOutput.start(self.m_generator) + else: + self.m_modeButton.setText("Enable pull mode") + io = self.m_audioOutput.start() + + try: + # This will raise an exception if the are no connections. + self.m_pushTimer.timeout.disconnect() + except: + pass + + self.m_pushTimer.timeout.connect(lambda: self.handlePushTimer(io)) + self.m_pushTimer.start(10) + + self.m_pullMode = not self.m_pullMode + + def handlePushTimer(self, io): + if self.m_audioOutput.state() is QAudio.State.StoppedState: + return + + buffer = self.m_generator.read(self.m_audioOutput.bytesFree()) + if buffer: + io.write(buffer) + + def toggleSuspendResume(self): + if self.m_audioOutput.state() in (QAudio.State.SuspendedState, QAudio.State.StoppedState): + self.m_audioOutput.resume() + self.m_suspendResumeButton.setText("Suspend playback") + elif self.m_audioOutput.state() is QAudio.State.ActiveState: + self.m_audioOutput.suspend() + self.m_suspendResumeButton.setText("Resume playback") + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + app.setApplicationName("Audio Output Test") + + audio = AudioTest() + audio.show() + + sys.exit(app.exec()) diff --git a/examples/multimediawidgets/camera/camera.py b/examples/multimediawidgets/camera/camera.py new file mode 100644 index 0000000..a68bc6b --- /dev/null +++ b/examples/multimediawidgets/camera/camera.py @@ -0,0 +1,573 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2020 The Qt Company Ltd. +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import os + +from PyQt6.QtCore import QDateTime, QDir, qFuzzyCompare, Qt, QTimer +from PyQt6.QtGui import QAction, QActionGroup, QIcon, QImage, QPixmap +from PyQt6.QtMultimedia import (QAudioInput, QCamera, QImageCapture, + QMediaFormat, QMediaDevices, QMediaCaptureSession, QMediaMetaData, + QMediaRecorder) +from PyQt6.QtWidgets import (QApplication, QDialog, QDialogButtonBox, + QFormLayout, QHBoxLayout, QLineEdit, QMainWindow, QMessageBox, + QPushButton, QScrollArea, QVBoxLayout, QWidget) + +from ui_camera import Ui_Camera +from ui_imagesettings import Ui_ImageSettingsUi +from ui_videosettings import Ui_VideoSettingsUi + + +class ImageSettings(QDialog): + + def __init__(self, imageCapture, parent=None): + super().__init__(parent) + + self.ui = Ui_ImageSettingsUi() + self.imagecapture = imageCapture + + self.ui.setupUi(self) + + self.ui.imageCodecBox.addItem("Default image format", "") + for f in self.imagecapture.supportedFormats(): + description = QImageCapture.fileFormatDescription(f) + self.ui.imageCodecBox.addItem( + QImageCapture.fileFormatName(f) + ": " + description, f) + + self.ui.imageQualitySlider.setRange( + QImageCapture.Quality.VeryLowQuality.value, + QImageCapture.Quality.VeryHighQuality.value) + + self.ui.imageResolutionBox.addItem("Default resolution") + supportedResolutions = self.imagecapture.captureSession().camera().cameraDevice().photoResolutions() + for resolution in supportedResolutions: + self.ui.imageResolutionBox.addItem( + "%dx%d" % (resolution.width(), resolution.height()), + resolution) + + self.selectComboBoxItem(self.ui.imageCodecBox, + self.imagecapture.fileFormat()) + self.selectComboBoxItem(self.ui.imageResolutionBox, + self.imagecapture.resolution()) + self.ui.imageQualitySlider.setValue(self.imagecapture.quality().value) + + def applyImageSettings(self): + self.imagecapture.setFileFormat(self.boxValue(self.ui.imageCodecBox)) + self.imagecapture.setQuality( + QImageCapture.Quality(self.ui.imageQualitySlider.value())) + self.imagecapture.setResolution( + self.boxValue(self.ui.imageResolutionBox)) + + @staticmethod + def boxValue(box): + idx = box.currentIndex() + if idx == -1: + return None + + return box.itemData(idx) + + @staticmethod + def selectComboBoxItem(box, value): + for i in range(box.count()): + if box.itemData(i) == value: + box.setCurrentIndex(i) + break + + +class VideoSettings(QDialog): + + def __init__(self, mediaRecorder, parent=None): + super().__init__(parent) + + self.ui = Ui_VideoSettingsUi() + self.mediaRecorder = mediaRecorder + + self.ui.setupUi(self) + + self.ui.audioCodecBox.addItem("Default audio codec", + QMediaFormat.AudioCodec.Unspecified) + for ac in QMediaFormat().supportedAudioCodecs(QMediaFormat.ConversionMode.Encode): + description = QMediaFormat.audioCodecDescription(ac) + self.ui.audioCodecBox.addItem( + QMediaFormat.audioCodecName(ac) + ": " + description, ac) + + audioDevice = self.mediaRecorder.captureSession().audioInput().device() + self.ui.audioSampleRateBox.setRange(audioDevice.minimumSampleRate(), + audioDevice.maximumSampleRate()) + + self.ui.videoCodecBox.addItem("Default video codec", + QMediaFormat.VideoCodec.Unspecified) + for vc in QMediaFormat().supportedVideoCodecs(QMediaFormat.ConversionMode.Encode): + description = QMediaFormat.videoCodecDescription(vc) + self.ui.videoCodecBox.addItem( + QMediaFormat.videoCodecName(vc) + ": " + description, vc) + + self.ui.videoResolutionBox.addItem("Default") + supportedResolutions = self.mediaRecorder.captureSession().camera().cameraDevice().photoResolutions() + for resolution in supportedResolutions: + self.ui.videoResolutionBox.addItem( + "%dx%d" % (resolution.width(), resolution.height()), + resolution) + + self.ui.videoFramerateBox.addItem("Default") + #supportedFrameRates, _ = self.mediaRecorder.supportedFrameRates() + #for rate in supportedFrameRates: + # self.ui.videoFramerateBox.addItem("%0.2f" % rate, rate) + + self.ui.containerFormatBox.addItem("Default container", + QMediaFormat.FileFormat.UnspecifiedFormat) + for fmt in QMediaFormat().supportedFileFormats(QMediaFormat.ConversionMode.Encode): + description = QMediaFormat.fileFormatDescription(fmt) + self.ui.containerFormatBox.addItem( + QMediaFormat.fileFormatName(fmt) + ": " + description, fmt) + + self.ui.qualitySlider.setRange( + QMediaRecorder.Quality.VeryLowQuality.value, + QMediaRecorder.Quality.VeryHighQuality.value) + + mediaFormat = self.mediaRecorder.mediaFormat() + self.selectComboBoxItem(self.ui.containerFormatBox, + mediaFormat.fileFormat()) + self.selectComboBoxItem(self.ui.audioCodecBox, + mediaFormat.audioCodec()) + self.selectComboBoxItem(self.ui.videoCodecBox, + mediaFormat.videoCodec()) + + self.ui.qualitySlider.setValue(self.mediaRecorder.quality().value) + self.ui.audioSampleRateBox.setValue( + self.mediaRecorder.audioSampleRate()) + self.selectComboBoxItem(self.ui.videoResolutionBox, + self.mediaRecorder.videoResolution()) + + for i in range(1, self.ui.videoFramerateBox.count()): + itemRate = self.ui.videoFramerateBox.itemData(i) + if qFuzzyCompare(itemRate, self.mediaRecorder.videoFrameRate()): + self.ui.videoFramerateBox.setCurrentIndex(i) + break + + def applySettings(self): + mediaFormat = QMediaFormat() + mediaFormat.setFileFormat(self.boxValue(self.ui.containerFormatBox)) + mediaFormat.setAudioCodec(self.boxValue(self.ui.audioCodecBox)) + mediaFormat.setVideoCodec(self.boxValue(self.ui.videoCodecBox)) + + self.mediaRecorder.setMediaFormat(mediaFormat) + self.mediaRecorder.setQuality( + QMediaRecorder.Quality(self.ui.qualitySlider.value())) + self.mediaRecorder.setAudioSampleRate( + self.ui.audioSampleRateBox.value()) + self.mediaRecorder.setVideoResolution( + boxValue(self.ui.videoResolutionBox)) + self.mediaRecorder.setVideoFrameRate( + boxValue(self.ui.videoFramerateBox)) + + @staticmethod + def boxValue(box): + idx = box.currentIndex() + if idx == -1: + return None + + return box.itemData(idx) + + @staticmethod + def selectComboBoxItem(box, value): + for i in range(box.count()): + if box.itemData(i) == value: + box.setCurrentIndex(i) + break + + +class MetaDataDialog(QDialog): + + def __init__(self, parent=None): + super().__init__(parent) + + self.metaDataFields = {} + + metaDataLayout = QFormLayout() + + for key in QMediaMetaData.Key: + label = QMediaMetaData.metaDataKeyToString(key) + field = QLineEdit() + self.metaDataFields[key] = field + + if key is QMediaMetaData.Key.ThumbnailImage: + openThumbnail = QPushButton("Open", + clicked=self.openThumbnailImage) + layout = QHBoxLayout() + layout.addWidget(field) + layout.addWidget(openThumbnail) + metaDataLayout.addRow(label, layout) + + elif key is QMediaMetaData.Key.CoverArtImage: + openCoverArt = QPushButton("Open", + clicked=self.openCoverArtImage) + layout = QHBoxLayout() + layout.addWidget(field) + layout.addWidget(openCoverArt) + metaDataLayout.addRow(label, layout) + + else: + if key is QMediaMetaData.Key.Title: + field.setText("PyQt Camera Example") + elif key is QMediaMetaData.Key.Author: + field.setText("Riverbank Computing") + elif key is QMediaMetaData.Key.Date: + field.setText(QDateTime.currentDateTime().toString()) + + metaDataLayout.addRow(label, field) + + viewport = QWidget() + viewport.setLayout(metaDataLayout) + scrollArea = QScrollArea() + scrollArea.setWidget(viewport) + dialogLayout = QVBoxLayout() + dialogLayout.addWidget(scrollArea) + + buttonBox = QDialogButtonBox( + QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel) + dialogLayout.addWidget(buttonBox) + self.setLayout(dialogLayout) + + self.setWindowTitle("Set Metadata") + self.resize(400, 300) + + buttonBox.accepted.connect(self.accept) + buttonBox.rejected.connect(self.reject) + + def openThumbnailImage(self): + fileName, _ = QFileDialog.getOpenFileName(self, "Open Image", + QDir.currentPath(), "Image Files (*.png *.jpg *.bmp)") + + if fileName: + self.metaDataFields[QMediaMetaData.Key.ThumbnailImage].setText( + fileName) + + def openCoverArtImage(self): + fileName, _ = QFileDialog.getOpenFileName(self, "Open Image", + QDir.currentPath(), "Image Files (*.png *.jpg *.bmp)") + + if fileName: + self.metaDataFields[QMediaMetaData.Key.CoverArtImage].setText( + fileName) + + +class Camera(QMainWindow): + + def __init__(self, parent=None): + super().__init__(parent) + + self.ui = Ui_Camera() + + self.devices = QMediaDevices() + self.captureSession = QMediaCaptureSession() + self.camera = None + self.imageCapture = None + self.mediaRecorder = None + self.isCapturingImage = False + self.applicationExiting = False + self.doImageCapture = True + self.metaDataDialog = None + + self.ui.setupUi(self) + + self.ui.takeImageButton.setIcon( + QIcon( + os.path.join(os.path.dirname(__file__), 'images', + 'shutter.svg'))) + + self.audioInput = QAudioInput() + self.captureSession.setAudioInput(self.audioInput) + + self.videoDevicesGroup = QActionGroup(self) + self.videoDevicesGroup.setExclusive(True) + + self.updateCameras() + self.devices.videoInputsChanged.connect(self.updateCameras) + + self.videoDevicesGroup.triggered.connect(self.updateCameraDevice) + self.ui.captureWidget.currentChanged.connect(self.updateCaptureMode) + + self.ui.metaDataButton.clicked.connect(self.showMetaDataDialog) + + self.setCamera(QMediaDevices.defaultVideoInput()) + + def setCamera(self, cameraDevice): + self.camera = QCamera(cameraDevice) + self.captureSession.setCamera(self.camera) + + self.camera.activeChanged.connect(self.updateCameraActive) + self.camera.errorOccurred.connect(self.displayCameraError) + + self.mediaRecorder = QMediaRecorder() + self.captureSession.setRecorder(self.mediaRecorder) + self.mediaRecorder.recorderStateChanged.connect( + self.updateRecorderState) + + self.imageCapture = QImageCapture() + self.captureSession.setImageCapture(self.imageCapture) + + self.mediaRecorder.durationChanged.connect(self.updateRecordTime) + self.mediaRecorder.errorChanged.connect(self.displayRecorderError) + + self.ui.exposureCompensation.valueChanged.connect( + self.setExposureCompensation) + + self.captureSession.setVideoOutput(self.ui.viewfinder) + + self.updateCameraActive(self.camera.isActive()) + self.updateRecorderState(self.mediaRecorder.recorderState()) + + self.imageCapture.readyForCaptureChanged.connect(self.readyForCapture) + self.imageCapture.imageCaptured.connect(self.processCapturedImage) + self.imageCapture.imageSaved.connect(self.imageSaved) + self.imageCapture.errorOccurred.connect(self.displayCaptureError) + self.readyForCapture(self.imageCapture.isReadyForCapture()) + + self.updateCaptureMode() + self.camera.start() + + def keyPressEvent(self, event): + if event.isAutoRepeat(): + return + + if event.key() is Qt.Key.Key_CameraFocus: + self.displayViewfinder() + self.camera.searchAndLock() + event.accept() + elif event.key() is Qt.Key.Key_Camera: + if self.doImageCapture: + self.takeImage() + elif self.mediaRecorder.recorderState() is QMediaRecorder.RecorderState.RecordingState: + self.stop() + else: + self.record() + + event.accept() + else: + super().keyPressEvent(event) + + def updateRecordTime(self): + msg = "Recorded %d sec" % (self.mediaRecorder.duration() // 1000) + self.ui.statusbar.showMessage(msg) + + def processCapturedImage(self, requestId, img): + scaledImage = img.scaled(self.ui.viewfinder.size(), + Qt.AspectRatioMode.KeepAspectRatio, + Qt.TransformationMode.SmoothTransformation) + + self.ui.lastImagePreviewLabel.setPixmap(QPixmap.fromImage(scaledImage)) + + self.displayCapturedImage() + QTimer.singleShot(4000, self.displayViewfinder) + + def configureCaptureSettings(self): + if self.doImageCapture: + self.configureImageSettings() + else: + self.configureVideoSettings() + + def configureVideoSettings(self): + settingsDialog = VideoSettings(self.mediaRecorder) + settingsDialog.setWindowFlags( + settingsDialog.windowFlags() & ~Qt.WindowType.WindowContextHelpButtonHint) + + if settingsDialog.exec(): + settingsDialog.applySettings() + + def configureImageSettings(self): + settingsDialog = ImageSettings(self.imageCapture) + settingsDialog.setWindowFlags( + settingsDialog.windowFlags() & ~Qt.WindowType.WindowContextHelpButtonHint) + + if settingsDialog.exec(): + settingsDialog.applyImageSettings() + + def record(self): + self.mediaRecorder.record() + self.updateRecordTime() + + def pause(self): + self.mediaRecorder.pause() + + def stop(self): + self.mediaRecorder.stop() + + def setMuted(self, muted): + self.captureSession.audioInput().setMuted(muted) + + def takeImage(self): + self.isCapturingImage = True + self.imageCapture.captureToFile() + + def displayCaptureError(self, id, error, errorString): + QMessageBox.warning(self, "Image Capture Error", errorString) + self.isCapturingImage = False + + def startCamera(self): + self.camera.start() + + def stopCamera(self): + self.camera.stop() + + def updateCaptureMode(self): + tabIndex = self.ui.captureWidget.currentIndex() + self.doImageCapture = (tabIndex == 0) + + def updateCameraActive(self, active): + if active: + self.ui.actionStartCamera.setEnabled(False) + self.ui.actionStopCamera.setEnabled(True) + self.ui.captureWidget.setEnabled(True) + self.ui.actionSettings.setEnabled(True) + else: + self.ui.actionStartCamera.setEnabled(True) + self.ui.actionStopCamera.setEnabled(False) + self.ui.captureWidget.setEnabled(False) + self.ui.actionSettings.setEnabled(False) + + def updateRecorderState(self, state): + if state is QMediaRecorder.RecorderState.StoppedState: + self.ui.recordButton.setEnabled(True) + self.ui.pauseButton.setEnabled(True) + self.ui.stopButton.setEnabled(False) + self.ui.metaDataButton.setEnabled(True) + elif state is QMediaRecorder.RecorderState.PausedState: + self.ui.recordButton.setEnabled(True) + self.ui.pauseButton.setEnabled(False) + self.ui.stopButton.setEnabled(True) + self.ui.metaDataButton.setEnabled(False) + elif state is QMediaRecorder.RecorderState.RecordingState: + self.ui.recordButton.setEnabled(False) + self.ui.pauseButton.setEnabled(True) + self.ui.stopButton.setEnabled(True) + self.ui.metaDataButton.setEnabled(False) + + def setExposureCompensation(self, index): + self.camera.setExposureCompensation(index * 0.5) + + def displayRecorderError(self): + if self.mediaRecorder.error() is not QMediaRecorder.Error.NoError: + QMessageBox.warning(self, "Capture Error", + self.mediaRecorder.errorString()) + + def displayCameraError(self): + if self.camera.error() is not QCamers.Error.NoError: + QMessageBox.warning(self, "Camera Error", + self.camera.errorString()) + + def updateCameraDevice(self, action): + self.setCamera(action.data()) + + def displayViewfinder(self): + self.ui.stackedWidget.setCurrentIndex(0) + + def displayCapturedImage(self): + self.ui.stackedWidget.setCurrentIndex(1) + + def readyForCapture(self, ready): + self.ui.takeImageButton.setEnabled(ready) + + def imageSaved(self, id, fileName): + self.ui.statusbar.showMessage( + "Captured \"%s\"" % QDir.toNativeSeparators(fileName)) + self.isCapturingImage = False + + if self.applicationExiting: + self.close() + + def closeEvent(self, event): + if self.isCapturingImage: + self.setEnabled(False) + self.applicationExiting = True + event.ignore() + else: + event.accept() + + def updateCameras(self): + self.ui.menuDevices.clear() + + for cameraDevice in QMediaDevices.videoInputs(): + videoDeviceAction = QAction(cameraDevice.description(), + self.videoDevicesGroup) + videoDeviceAction.setCheckable(True) + videoDeviceAction.setData(cameraDevice) + + if cameraDevice == QMediaDevices.defaultVideoInput(): + videoDeviceAction.setChecked(True) + + self.ui.menuDevices.addAction(videoDeviceAction) + + def showMetaDataDialog(self): + if self.metaDataDialog is None: + self.metaDataDialog = MetaDataDialog(self) + + self.metaDataDialog.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, + False) + + if self.metaDataDialog.exec() is QDialog.DialogCode.Accepted: + self.saveMetaData() + + def saveMetaData(self): + data = QMediaMetaData() + + for key in QMediaMetaData.Key: + val = self.metaDataDialog.metaDataFields[key].text() + if val: + if key in (QMediaMetaData.Key.CoverArtImage, QMediaMetaData.Key.ThumbnailImage): + val = QImage(val) + elif key is QMediaMetaData.Key.Date: + val = QDateTime.fromString(val) + + data.insert(key, val) + + self.mediaRecorder.setMetaData(data) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + + camera = Camera() + camera.show() + + sys.exit(app.exec()) diff --git a/examples/multimediawidgets/camera/camera.ui b/examples/multimediawidgets/camera/camera.ui new file mode 100644 index 0000000..73f95c2 --- /dev/null +++ b/examples/multimediawidgets/camera/camera.ui @@ -0,0 +1,482 @@ + + + Camera + + + + 0 + 0 + 668 + 429 + + + + Camera + + + + + + + 0 + + + + Image + + + + + + Qt::Vertical + + + + 20 + 161 + + + + + + + + false + + + Capture Photo + + + + + + + -4 + + + 4 + + + 2 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + + + Exposure Compensation: + + + + + + + + Video + + + + + + Record + + + + + + + Pause + + + + + + + Stop + + + + + + + Qt::Vertical + + + + 20 + 76 + + + + + + + + Mute + + + true + + + + + + + Set metadata + + + true + + + + + + + + + + + + 1 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + 145 + 145 + 145 + + + + + + + + + 255 + 255 + 255 + + + + + + + 145 + 145 + 145 + + + + + + + + + 145 + 145 + 145 + + + + + + + 145 + 145 + 145 + + + + + + + + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + QFrame::Box + + + + + + + + + + + + + + + + 0 + 0 + 668 + 28 + + + + + File + + + + + + + + + + + Devices + + + + + + + + + Close + + + + + Start Camera + + + + + Stop Camera + + + + + Change Settings + + + + + + QVideoWidget + QWidget +
PyQt6.QtMultimediaWidgets
+ 1 +
+
+ + + + recordButton + clicked() + Camera + record() + + + 647 + 149 + + + 61 + 238 + + + + + stopButton + clicked() + Camera + stop() + + + 647 + 225 + + + 140 + 236 + + + + + pauseButton + clicked() + Camera + pause() + + + 647 + 187 + + + 234 + 237 + + + + + actionExit + triggered() + Camera + close() + + + -1 + -1 + + + 154 + 130 + + + + + takeImageButton + clicked() + Camera + takeImage() + + + 625 + 132 + + + 603 + 169 + + + + + muteButton + toggled(bool) + Camera + setMuted(bool) + + + 647 + 377 + + + 5 + 280 + + + + + exposureCompensation + valueChanged(int) + Camera + setExposureCompensation(int) + + + 559 + 367 + + + 665 + 365 + + + + + actionSettings + triggered() + Camera + configureCaptureSettings() + + + -1 + -1 + + + 333 + 210 + + + + + actionStartCamera + triggered() + Camera + startCamera() + + + -1 + -1 + + + 333 + 210 + + + + + actionStopCamera + triggered() + Camera + stopCamera() + + + -1 + -1 + + + 333 + 210 + + + + + + record() + pause() + stop() + enablePreview(bool) + configureCaptureSettings() + takeImage() + startCamera() + toggleLock() + setMuted(bool) + stopCamera() + setExposureCompensation(int) + +
diff --git a/examples/multimediawidgets/camera/images/shutter.svg b/examples/multimediawidgets/camera/images/shutter.svg new file mode 100644 index 0000000..67da2c2 --- /dev/null +++ b/examples/multimediawidgets/camera/images/shutter.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + diff --git a/examples/multimediawidgets/camera/imagesettings.ui b/examples/multimediawidgets/camera/imagesettings.ui new file mode 100644 index 0000000..c9a4d94 --- /dev/null +++ b/examples/multimediawidgets/camera/imagesettings.ui @@ -0,0 +1,123 @@ + + + ImageSettingsUi + + + + 0 + 0 + 332 + 270 + + + + Image Settings + + + + + + Image + + + + + + Resolution: + + + + + + + + + + Image Format: + + + + + + + + + + Quality: + + + + + + + 4 + + + Qt::Horizontal + + + + + + + + + + Qt::Vertical + + + + 20 + 14 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + ImageSettingsUi + accept() + + + 322 + 272 + + + 44 + 230 + + + + + buttonBox + rejected() + ImageSettingsUi + reject() + + + 405 + 262 + + + 364 + 227 + + + + + diff --git a/examples/multimediawidgets/camera/ui_camera.py b/examples/multimediawidgets/camera/ui_camera.py new file mode 100644 index 0000000..8ce7f1e --- /dev/null +++ b/examples/multimediawidgets/camera/ui_camera.py @@ -0,0 +1,182 @@ +# Form implementation generated from reading ui file 'camera.ui' +# +# Created by: PyQt6 UI code generator 6.2.0.dev2107311659 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_Camera(object): + def setupUi(self, Camera): + Camera.setObjectName("Camera") + Camera.resize(668, 429) + self.centralwidget = QtWidgets.QWidget(Camera) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout_3 = QtWidgets.QGridLayout(self.centralwidget) + self.gridLayout_3.setObjectName("gridLayout_3") + self.captureWidget = QtWidgets.QTabWidget(self.centralwidget) + self.captureWidget.setObjectName("captureWidget") + self.tab_2 = QtWidgets.QWidget() + self.tab_2.setObjectName("tab_2") + self.gridLayout = QtWidgets.QGridLayout(self.tab_2) + self.gridLayout.setObjectName("gridLayout") + spacerItem = QtWidgets.QSpacerItem(20, 161, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.gridLayout.addItem(spacerItem, 3, 0, 1, 1) + self.takeImageButton = QtWidgets.QPushButton(self.tab_2) + self.takeImageButton.setEnabled(False) + self.takeImageButton.setObjectName("takeImageButton") + self.gridLayout.addWidget(self.takeImageButton, 0, 0, 1, 1) + self.exposureCompensation = QtWidgets.QSlider(self.tab_2) + self.exposureCompensation.setMinimum(-4) + self.exposureCompensation.setMaximum(4) + self.exposureCompensation.setPageStep(2) + self.exposureCompensation.setOrientation(QtCore.Qt.Orientation.Horizontal) + self.exposureCompensation.setTickPosition(QtWidgets.QSlider.TickPosition.TicksAbove) + self.exposureCompensation.setObjectName("exposureCompensation") + self.gridLayout.addWidget(self.exposureCompensation, 5, 0, 1, 1) + self.label = QtWidgets.QLabel(self.tab_2) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 4, 0, 1, 1) + self.captureWidget.addTab(self.tab_2, "") + self.tab = QtWidgets.QWidget() + self.tab.setObjectName("tab") + self.gridLayout_2 = QtWidgets.QGridLayout(self.tab) + self.gridLayout_2.setObjectName("gridLayout_2") + self.recordButton = QtWidgets.QPushButton(self.tab) + self.recordButton.setObjectName("recordButton") + self.gridLayout_2.addWidget(self.recordButton, 0, 0, 1, 1) + self.pauseButton = QtWidgets.QPushButton(self.tab) + self.pauseButton.setObjectName("pauseButton") + self.gridLayout_2.addWidget(self.pauseButton, 1, 0, 1, 1) + self.stopButton = QtWidgets.QPushButton(self.tab) + self.stopButton.setObjectName("stopButton") + self.gridLayout_2.addWidget(self.stopButton, 2, 0, 1, 1) + spacerItem1 = QtWidgets.QSpacerItem(20, 76, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.gridLayout_2.addItem(spacerItem1, 3, 0, 1, 1) + self.muteButton = QtWidgets.QPushButton(self.tab) + self.muteButton.setCheckable(True) + self.muteButton.setObjectName("muteButton") + self.gridLayout_2.addWidget(self.muteButton, 4, 0, 1, 1) + self.metaDataButton = QtWidgets.QPushButton(self.tab) + self.metaDataButton.setCheckable(True) + self.metaDataButton.setObjectName("metaDataButton") + self.gridLayout_2.addWidget(self.metaDataButton, 5, 0, 1, 1) + self.captureWidget.addTab(self.tab, "") + self.gridLayout_3.addWidget(self.captureWidget, 1, 1, 1, 2) + self.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) + sizePolicy.setHorizontalStretch(1) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.stackedWidget.sizePolicy().hasHeightForWidth()) + self.stackedWidget.setSizePolicy(sizePolicy) + palette = QtGui.QPalette() + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern) + palette.setBrush(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) + brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern) + palette.setBrush(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(255, 255, 255)) + brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern) + palette.setBrush(QtGui.QPalette.ColorGroup.Inactive, QtGui.QPalette.ColorRole.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) + brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern) + palette.setBrush(QtGui.QPalette.ColorGroup.Inactive, QtGui.QPalette.ColorRole.Window, brush) + brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) + brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern) + palette.setBrush(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.Base, brush) + brush = QtGui.QBrush(QtGui.QColor(145, 145, 145)) + brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern) + palette.setBrush(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.Window, brush) + self.stackedWidget.setPalette(palette) + self.stackedWidget.setObjectName("stackedWidget") + self.viewfinderPage = QtWidgets.QWidget() + self.viewfinderPage.setObjectName("viewfinderPage") + self.gridLayout_5 = QtWidgets.QGridLayout(self.viewfinderPage) + self.gridLayout_5.setObjectName("gridLayout_5") + self.viewfinder = QVideoWidget(self.viewfinderPage) + self.viewfinder.setObjectName("viewfinder") + self.gridLayout_5.addWidget(self.viewfinder, 0, 0, 1, 1) + self.stackedWidget.addWidget(self.viewfinderPage) + self.previewPage = QtWidgets.QWidget() + self.previewPage.setObjectName("previewPage") + self.gridLayout_4 = QtWidgets.QGridLayout(self.previewPage) + self.gridLayout_4.setObjectName("gridLayout_4") + self.lastImagePreviewLabel = QtWidgets.QLabel(self.previewPage) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.MinimumExpanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lastImagePreviewLabel.sizePolicy().hasHeightForWidth()) + self.lastImagePreviewLabel.setSizePolicy(sizePolicy) + self.lastImagePreviewLabel.setFrameShape(QtWidgets.QFrame.Shape.Box) + self.lastImagePreviewLabel.setText("") + self.lastImagePreviewLabel.setObjectName("lastImagePreviewLabel") + self.gridLayout_4.addWidget(self.lastImagePreviewLabel, 0, 0, 1, 1) + self.stackedWidget.addWidget(self.previewPage) + self.gridLayout_3.addWidget(self.stackedWidget, 0, 0, 2, 1) + Camera.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(Camera) + self.menubar.setGeometry(QtCore.QRect(0, 0, 668, 28)) + self.menubar.setObjectName("menubar") + self.menuFile = QtWidgets.QMenu(self.menubar) + self.menuFile.setObjectName("menuFile") + self.menuDevices = QtWidgets.QMenu(self.menubar) + self.menuDevices.setObjectName("menuDevices") + Camera.setMenuBar(self.menubar) + self.statusbar = QtWidgets.QStatusBar(Camera) + self.statusbar.setObjectName("statusbar") + Camera.setStatusBar(self.statusbar) + self.actionExit = QtGui.QAction(Camera) + self.actionExit.setObjectName("actionExit") + self.actionStartCamera = QtGui.QAction(Camera) + self.actionStartCamera.setObjectName("actionStartCamera") + self.actionStopCamera = QtGui.QAction(Camera) + self.actionStopCamera.setObjectName("actionStopCamera") + self.actionSettings = QtGui.QAction(Camera) + self.actionSettings.setObjectName("actionSettings") + self.menuFile.addAction(self.actionStartCamera) + self.menuFile.addAction(self.actionStopCamera) + self.menuFile.addSeparator() + self.menuFile.addAction(self.actionSettings) + self.menuFile.addSeparator() + self.menuFile.addAction(self.actionExit) + self.menubar.addAction(self.menuFile.menuAction()) + self.menubar.addAction(self.menuDevices.menuAction()) + + self.retranslateUi(Camera) + self.captureWidget.setCurrentIndex(0) + self.stackedWidget.setCurrentIndex(0) + self.recordButton.clicked.connect(Camera.record) + self.stopButton.clicked.connect(Camera.stop) + self.pauseButton.clicked.connect(Camera.pause) + self.actionExit.triggered.connect(Camera.close) + self.takeImageButton.clicked.connect(Camera.takeImage) + self.muteButton.toggled['bool'].connect(Camera.setMuted) + self.exposureCompensation.valueChanged['int'].connect(Camera.setExposureCompensation) + self.actionSettings.triggered.connect(Camera.configureCaptureSettings) + self.actionStartCamera.triggered.connect(Camera.startCamera) + self.actionStopCamera.triggered.connect(Camera.stopCamera) + QtCore.QMetaObject.connectSlotsByName(Camera) + + def retranslateUi(self, Camera): + _translate = QtCore.QCoreApplication.translate + Camera.setWindowTitle(_translate("Camera", "Camera")) + self.takeImageButton.setText(_translate("Camera", "Capture Photo")) + self.label.setText(_translate("Camera", "Exposure Compensation:")) + self.captureWidget.setTabText(self.captureWidget.indexOf(self.tab_2), _translate("Camera", "Image")) + self.recordButton.setText(_translate("Camera", "Record")) + self.pauseButton.setText(_translate("Camera", "Pause")) + self.stopButton.setText(_translate("Camera", "Stop")) + self.muteButton.setText(_translate("Camera", "Mute")) + self.metaDataButton.setText(_translate("Camera", "Set metadata")) + self.captureWidget.setTabText(self.captureWidget.indexOf(self.tab), _translate("Camera", "Video")) + self.menuFile.setTitle(_translate("Camera", "File")) + self.menuDevices.setTitle(_translate("Camera", "Devices")) + self.actionExit.setText(_translate("Camera", "Close")) + self.actionStartCamera.setText(_translate("Camera", "Start Camera")) + self.actionStopCamera.setText(_translate("Camera", "Stop Camera")) + self.actionSettings.setText(_translate("Camera", "Change Settings")) +from PyQt6.QtMultimediaWidgets import QVideoWidget diff --git a/examples/multimediawidgets/camera/ui_imagesettings.py b/examples/multimediawidgets/camera/ui_imagesettings.py new file mode 100644 index 0000000..9bcde3d --- /dev/null +++ b/examples/multimediawidgets/camera/ui_imagesettings.py @@ -0,0 +1,62 @@ +# Form implementation generated from reading ui file 'imagesettings.ui' +# +# Created by: PyQt6 UI code generator 6.2.0.dev2107180056 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_ImageSettingsUi(object): + def setupUi(self, ImageSettingsUi): + ImageSettingsUi.setObjectName("ImageSettingsUi") + ImageSettingsUi.resize(332, 270) + self.gridLayout = QtWidgets.QGridLayout(ImageSettingsUi) + self.gridLayout.setObjectName("gridLayout") + self.groupBox_2 = QtWidgets.QGroupBox(ImageSettingsUi) + self.groupBox_2.setObjectName("groupBox_2") + self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_2) + self.gridLayout_2.setObjectName("gridLayout_2") + self.label_8 = QtWidgets.QLabel(self.groupBox_2) + self.label_8.setObjectName("label_8") + self.gridLayout_2.addWidget(self.label_8, 0, 0, 1, 2) + self.imageResolutionBox = QtWidgets.QComboBox(self.groupBox_2) + self.imageResolutionBox.setObjectName("imageResolutionBox") + self.gridLayout_2.addWidget(self.imageResolutionBox, 1, 0, 1, 2) + self.label_6 = QtWidgets.QLabel(self.groupBox_2) + self.label_6.setObjectName("label_6") + self.gridLayout_2.addWidget(self.label_6, 2, 0, 1, 2) + self.imageCodecBox = QtWidgets.QComboBox(self.groupBox_2) + self.imageCodecBox.setObjectName("imageCodecBox") + self.gridLayout_2.addWidget(self.imageCodecBox, 3, 0, 1, 2) + self.label_7 = QtWidgets.QLabel(self.groupBox_2) + self.label_7.setObjectName("label_7") + self.gridLayout_2.addWidget(self.label_7, 4, 0, 1, 1) + self.imageQualitySlider = QtWidgets.QSlider(self.groupBox_2) + self.imageQualitySlider.setMaximum(4) + self.imageQualitySlider.setOrientation(QtCore.Qt.Orientation.Horizontal) + self.imageQualitySlider.setObjectName("imageQualitySlider") + self.gridLayout_2.addWidget(self.imageQualitySlider, 4, 1, 1, 1) + self.gridLayout.addWidget(self.groupBox_2, 0, 0, 1, 1) + spacerItem = QtWidgets.QSpacerItem(20, 14, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.gridLayout.addItem(spacerItem, 1, 0, 1, 1) + self.buttonBox = QtWidgets.QDialogButtonBox(ImageSettingsUi) + self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1) + + self.retranslateUi(ImageSettingsUi) + self.buttonBox.accepted.connect(ImageSettingsUi.accept) + self.buttonBox.rejected.connect(ImageSettingsUi.reject) + QtCore.QMetaObject.connectSlotsByName(ImageSettingsUi) + + def retranslateUi(self, ImageSettingsUi): + _translate = QtCore.QCoreApplication.translate + ImageSettingsUi.setWindowTitle(_translate("ImageSettingsUi", "Image Settings")) + self.groupBox_2.setTitle(_translate("ImageSettingsUi", "Image")) + self.label_8.setText(_translate("ImageSettingsUi", "Resolution:")) + self.label_6.setText(_translate("ImageSettingsUi", "Image Format:")) + self.label_7.setText(_translate("ImageSettingsUi", "Quality:")) diff --git a/examples/multimediawidgets/camera/ui_videosettings.py b/examples/multimediawidgets/camera/ui_videosettings.py new file mode 100644 index 0000000..aeff681 --- /dev/null +++ b/examples/multimediawidgets/camera/ui_videosettings.py @@ -0,0 +1,112 @@ +# Form implementation generated from reading ui file 'videosettings.ui' +# +# Created by: PyQt6 UI code generator 6.2.0.dev2107180056 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_VideoSettingsUi(object): + def setupUi(self, VideoSettingsUi): + VideoSettingsUi.setObjectName("VideoSettingsUi") + VideoSettingsUi.resize(686, 499) + self.gridLayout_3 = QtWidgets.QGridLayout(VideoSettingsUi) + self.gridLayout_3.setObjectName("gridLayout_3") + self.buttonBox = QtWidgets.QDialogButtonBox(VideoSettingsUi) + self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout_3.addWidget(self.buttonBox, 4, 1, 1, 1) + self.groupBox_2 = QtWidgets.QGroupBox(VideoSettingsUi) + self.groupBox_2.setObjectName("groupBox_2") + self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_2) + self.gridLayout_2.setObjectName("gridLayout_2") + self.videoResolutionBox = QtWidgets.QComboBox(self.groupBox_2) + self.videoResolutionBox.setObjectName("videoResolutionBox") + self.gridLayout_2.addWidget(self.videoResolutionBox, 1, 0, 1, 2) + self.label_6 = QtWidgets.QLabel(self.groupBox_2) + self.label_6.setObjectName("label_6") + self.gridLayout_2.addWidget(self.label_6, 4, 0, 1, 2) + self.videoFramerateBox = QtWidgets.QComboBox(self.groupBox_2) + self.videoFramerateBox.setObjectName("videoFramerateBox") + self.gridLayout_2.addWidget(self.videoFramerateBox, 3, 0, 1, 2) + self.label_9 = QtWidgets.QLabel(self.groupBox_2) + self.label_9.setObjectName("label_9") + self.gridLayout_2.addWidget(self.label_9, 2, 0, 1, 2) + self.label_8 = QtWidgets.QLabel(self.groupBox_2) + self.label_8.setObjectName("label_8") + self.gridLayout_2.addWidget(self.label_8, 0, 0, 1, 2) + self.videoCodecBox = QtWidgets.QComboBox(self.groupBox_2) + self.videoCodecBox.setObjectName("videoCodecBox") + self.gridLayout_2.addWidget(self.videoCodecBox, 5, 0, 1, 2) + self.gridLayout_3.addWidget(self.groupBox_2, 2, 1, 1, 1) + self.widget = QtWidgets.QWidget(VideoSettingsUi) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.widget.sizePolicy().hasHeightForWidth()) + self.widget.setSizePolicy(sizePolicy) + self.widget.setObjectName("widget") + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.widget) + self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.groupBox_3 = QtWidgets.QGroupBox(self.widget) + self.groupBox_3.setObjectName("groupBox_3") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_3) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.label_2 = QtWidgets.QLabel(self.groupBox_3) + self.label_2.setObjectName("label_2") + self.verticalLayout_2.addWidget(self.label_2) + self.audioCodecBox = QtWidgets.QComboBox(self.groupBox_3) + self.audioCodecBox.setObjectName("audioCodecBox") + self.verticalLayout_2.addWidget(self.audioCodecBox) + self.label_5 = QtWidgets.QLabel(self.groupBox_3) + self.label_5.setObjectName("label_5") + self.verticalLayout_2.addWidget(self.label_5) + self.audioSampleRateBox = QtWidgets.QSpinBox(self.groupBox_3) + self.audioSampleRateBox.setObjectName("audioSampleRateBox") + self.verticalLayout_2.addWidget(self.audioSampleRateBox) + self.verticalLayout_3.addWidget(self.groupBox_3) + self.groupBox = QtWidgets.QGroupBox(self.widget) + self.groupBox.setObjectName("groupBox") + self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox) + self.verticalLayout.setObjectName("verticalLayout") + self.label_3 = QtWidgets.QLabel(self.groupBox) + self.label_3.setObjectName("label_3") + self.verticalLayout.addWidget(self.label_3) + self.qualitySlider = QtWidgets.QSlider(self.groupBox) + self.qualitySlider.setMaximum(4) + self.qualitySlider.setOrientation(QtCore.Qt.Orientation.Horizontal) + self.qualitySlider.setObjectName("qualitySlider") + self.verticalLayout.addWidget(self.qualitySlider) + self.label_4 = QtWidgets.QLabel(self.groupBox) + self.label_4.setObjectName("label_4") + self.verticalLayout.addWidget(self.label_4) + self.containerFormatBox = QtWidgets.QComboBox(self.groupBox) + self.containerFormatBox.setObjectName("containerFormatBox") + self.verticalLayout.addWidget(self.containerFormatBox) + self.verticalLayout_3.addWidget(self.groupBox) + self.gridLayout_3.addWidget(self.widget, 2, 0, 1, 1) + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding) + self.gridLayout_3.addItem(spacerItem, 3, 0, 1, 1) + + self.retranslateUi(VideoSettingsUi) + self.buttonBox.accepted.connect(VideoSettingsUi.accept) + self.buttonBox.rejected.connect(VideoSettingsUi.reject) + QtCore.QMetaObject.connectSlotsByName(VideoSettingsUi) + + def retranslateUi(self, VideoSettingsUi): + _translate = QtCore.QCoreApplication.translate + VideoSettingsUi.setWindowTitle(_translate("VideoSettingsUi", "Video Settings")) + self.groupBox_2.setTitle(_translate("VideoSettingsUi", "Video")) + self.label_6.setText(_translate("VideoSettingsUi", "Video Codec:")) + self.label_9.setText(_translate("VideoSettingsUi", "Framerate:")) + self.label_8.setText(_translate("VideoSettingsUi", "Resolution:")) + self.groupBox_3.setTitle(_translate("VideoSettingsUi", "Audio")) + self.label_2.setText(_translate("VideoSettingsUi", "Audio Codec:")) + self.label_5.setText(_translate("VideoSettingsUi", "Sample Rate:")) + self.label_3.setText(_translate("VideoSettingsUi", "Quality:")) + self.label_4.setText(_translate("VideoSettingsUi", "File Format:")) diff --git a/examples/multimediawidgets/camera/videosettings.ui b/examples/multimediawidgets/camera/videosettings.ui new file mode 100644 index 0000000..e4309d2 --- /dev/null +++ b/examples/multimediawidgets/camera/videosettings.ui @@ -0,0 +1,202 @@ + + + VideoSettingsUi + + + + 0 + 0 + 686 + 499 + + + + Video Settings + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + Video + + + + + + + + + Video Codec: + + + + + + + + + + Framerate: + + + + + + + Resolution: + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Audio + + + + + + Audio Codec: + + + + + + + + + + Sample Rate: + + + + + + + + + + + + + + + + Quality: + + + + + + + 4 + + + Qt::Horizontal + + + + + + + File Format: + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + buttonBox + accepted() + VideoSettingsUi + accept() + + + 322 + 272 + + + 44 + 230 + + + + + buttonBox + rejected() + VideoSettingsUi + reject() + + + 405 + 262 + + + 364 + 227 + + + + + diff --git a/examples/multimediawidgets/videographicsitem.py b/examples/multimediawidgets/videographicsitem.py new file mode 100644 index 0000000..7770a13 --- /dev/null +++ b/examples/multimediawidgets/videographicsitem.py @@ -0,0 +1,169 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2017 The Qt Company Ltd. +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import QDir, QSizeF, QStandardPaths, Qt, QUrl +from PyQt6.QtGui import QTransform +from PyQt6.QtMultimedia import QMediaPlayer +from PyQt6.QtMultimediaWidgets import QGraphicsVideoItem +from PyQt6.QtWidgets import (QApplication, QFileDialog, QGraphicsScene, + QGraphicsView, QHBoxLayout, QPushButton, QSlider, QStyle, QVBoxLayout, + QWidget) + + +class VideoPlayer(QWidget): + + def __init__(self, parent=None): + super().__init__(parent) + + self.mediaPlayer = QMediaPlayer(self) + + screenGeometry = self.screen().availableSize() + self.videoItem = QGraphicsVideoItem() + self.videoItem.setSize( + QSizeF(screenGeometry.width() / 3, screenGeometry.height() / 2)) + + scene = QGraphicsScene(self) + graphicsView = QGraphicsView(scene) + + scene.addItem(self.videoItem) + + rotateSlider = QSlider(Qt.Orientation.Horizontal) + rotateSlider.setToolTip("Rotate Video") + rotateSlider.setRange(-180, 180) + rotateSlider.setValue(0) + rotateSlider.valueChanged.connect(self.rotateVideo) + + openButton = QPushButton("Open...") + openButton.clicked.connect(self.openFile) + + self.playButton = QPushButton() + self.playButton.setEnabled(False) + self.playButton.setIcon( + self.style().standardIcon(QStyle.StandardPixmap.SP_MediaPlay)) + self.playButton.clicked.connect(self.play) + + self.positionSlider = QSlider(Qt.Orientation.Horizontal) + self.positionSlider.setRange(0, 0) + self.positionSlider.sliderMoved.connect(self.setPosition) + + controlLayout = QHBoxLayout() + controlLayout.setContentsMargins(0, 0, 0, 0) + controlLayout.addWidget(openButton) + controlLayout.addWidget(self.playButton) + controlLayout.addWidget(self.positionSlider) + + layout = QVBoxLayout(self) + layout.addWidget(graphicsView) + layout.addWidget(rotateSlider) + layout.addLayout(controlLayout) + + self.mediaPlayer.setVideoOutput(self.videoItem) + self.mediaPlayer.playbackStateChanged.connect(self.mediaStateChanged) + self.mediaPlayer.positionChanged.connect(self.positionChanged) + self.mediaPlayer.durationChanged.connect(self.durationChanged) + + def sizeHint(self): + return ((self.videoItem.size() * 3.0) / 2.0).toSize() + + def isPlayerAvailable(self): + return self.mediaPlayer.isAvailable() + + def openFile(self): + fileDialog = QFileDialog(self) + fileDialog.setAcceptMode(QFileDialog.AcceptMode.AcceptOpen) + fileDialog.setWindowTitle("Open Movie") + + try: + location = QStandardPaths.standardLocations( + QStandardPaths.StandardLocation.MoviesLocation)[0] + except IndexError: + location = QDir.homePath() + + fileDialog.setDirectory(location) + + if fileDialog.exec() == QFileDialog.DialogCode.Accepted: + self.load(fileDialog.selectedUrls()[0]) + + def load(self, url): + self.mediaPlayer.setSource(url) + self.playButton.setEnabled(True) + + def play(self): + if self.mediaPlayer.playbackState() is QMediaPlayer.PlaybackState.PlayingState: + self.mediaPlayer.pause() + else: + self.mediaPlayer.play() + + def mediaStateChanged(self, state): + if state is QMediaPlayer.PlaybackState.PlayingState: + icon = QStyle.StandardPixmap.SP_MediaPause + else: + icon = QStyle.StandardPixmap.SP_MediaPlay + + self.playButton.setIcon(self.style().standardIcon(icon)) + + def positionChanged(self, position): + self.positionSlider.setValue(position) + + def durationChanged(self, duration): + self.positionSlider.setRange(0, duration) + + def setPosition(self, position): + self.mediaPlayer.setPosition(position) + + def rotateVideo(self, angle): + x = self.videoItem.boundingRect().width() / 2.0 + y = self.videoItem.boundingRect().height() / 2.0 + + self.videoItem.setTransform( + QTransform().translate(x, y).rotate(angle).translate(-x, -y)) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + + player = VideoPlayer() + player.show() + + sys.exit(app.exec()) diff --git a/examples/multimediawidgets/videowidget.py b/examples/multimediawidgets/videowidget.py new file mode 100644 index 0000000..c64393e --- /dev/null +++ b/examples/multimediawidgets/videowidget.py @@ -0,0 +1,156 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2017 The Qt Company Ltd. +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import QDir, QStandardPaths, Qt, QUrl +from PyQt6.QtMultimedia import QMediaPlayer +from PyQt6.QtMultimediaWidgets import QVideoWidget +from PyQt6.QtWidgets import (QApplication, QFileDialog, QHBoxLayout, QLabel, + QPushButton, QSizePolicy, QSlider, QStyle, QVBoxLayout, QWidget) + + +class VideoPlayer(QWidget): + + def __init__(self, parent=None): + super().__init__(parent) + + self.mediaPlayer = QMediaPlayer(self) + videoWidget = QVideoWidget() + + openButton = QPushButton("Open...") + openButton.clicked.connect(self.openFile) + + self.playButton = QPushButton() + self.playButton.setEnabled(False) + self.playButton.setIcon( + self.style().standardIcon(QStyle.StandardPixmap.SP_MediaPlay)) + self.playButton.clicked.connect(self.play) + + self.positionSlider = QSlider(Qt.Orientation.Horizontal) + self.positionSlider.setRange(0, 0) + self.positionSlider.sliderMoved.connect(self.setPosition) + + self.errorLabel = QLabel() + self.errorLabel.setSizePolicy(QSizePolicy.Policy.Preferred, + QSizePolicy.Policy.Maximum) + + controlLayout = QHBoxLayout() + controlLayout.setContentsMargins(0, 0, 0, 0) + controlLayout.addWidget(openButton) + controlLayout.addWidget(self.playButton) + controlLayout.addWidget(self.positionSlider) + + layout = QVBoxLayout() + layout.addWidget(videoWidget) + layout.addLayout(controlLayout) + layout.addWidget(self.errorLabel) + + self.setLayout(layout) + + self.mediaPlayer.setVideoOutput(videoWidget) + self.mediaPlayer.playbackStateChanged.connect(self.mediaStateChanged) + self.mediaPlayer.positionChanged.connect(self.positionChanged) + self.mediaPlayer.durationChanged.connect(self.durationChanged) + self.mediaPlayer.errorChanged.connect(self.handleError) + + def openFile(self): + fileDialog = QFileDialog(self) + fileDialog.setAcceptMode(QFileDialog.AcceptMode.AcceptOpen) + fileDialog.setWindowTitle("Open Movie") + + try: + location = QStandardPaths.standardLocations( + QStandardPaths.StandardLocation.MoviesLocation)[0] + except IndexError: + location = QDir.homePath() + + fileDialog.setDirectory(location) + + if fileDialog.exec() == QFileDialog.DialogCode.Accepted: + self.setUrl(fileDialog.selectedUrls()[0]) + + def setUrl(self, url): + self.errorLabel.setText('') + self.setWindowFilePath(url.toLocalFile() if url.isLocalFile() else '') + self.mediaPlayer.setSource(url) + self.playButton.setEnabled(True) + + def play(self): + if self.mediaPlayer.playbackState() is QMediaPlayer.PlaybackState.PlayingState: + self.mediaPlayer.pause() + else: + self.mediaPlayer.play() + + def mediaStateChanged(self, state): + if state is QMediaPlayer.PlaybackState.PlayingState: + icon = QStyle.StandardPixmap.SP_MediaPause + else: + icon = QStyle.StandardPixmap.SP_MediaPlay + + self.playButton.setIcon(self.style().standardIcon(icon)) + + def positionChanged(self, position): + self.positionSlider.setValue(position) + + def durationChanged(self, duration): + self.positionSlider.setRange(0, duration) + + def setPosition(self, position): + self.mediaPlayer.setPosition(position) + + def handleError(self): + if self.mediaPlayer.error() is QMediaPlayer.Error.NoError: + return + + self.playButton.setEnabled(False) + self.errorLabel.setText("Error: " + self.mediaPlayer.errorString()) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + + player = VideoPlayer() + player.resize(320, 240) + player.show() + + sys.exit(app.exec()) diff --git a/examples/qml/referenceexamples/adding.py b/examples/qml/referenceexamples/adding.py new file mode 100755 index 0000000..c764055 --- /dev/null +++ b/examples/qml/referenceexamples/adding.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import pyqtProperty, QCoreApplication, QObject, QUrl +from PyQt6.QtQml import qmlRegisterType, QQmlComponent, QQmlEngine + + +QML = b''' +import People 1.0 + +Person { + name: "Bob Jones" + shoeSize: 12 +} +''' + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoeSize = 0 + + @pyqtProperty(str) + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @pyqtProperty(int) + def shoeSize(self): + return self._shoeSize + + @shoeSize.setter + def shoeSize(self, shoeSize): + self._shoeSize = shoeSize + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(Person, 'People', 1, 0) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +person = component.create() + +if person is not None: + print("The person's name is \"{name}\"".format(name=person.name)) + print("They wear a {size} sized shoe".format(size=person.shoeSize)) +else: + print("Unable to create component instance") + for e in component.errors(): + print("Error:", e.toString()); diff --git a/examples/qml/referenceexamples/attached.py b/examples/qml/referenceexamples/attached.py new file mode 100755 index 0000000..65554c9 --- /dev/null +++ b/examples/qml/referenceexamples/attached.py @@ -0,0 +1,225 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import (pyqtClassInfo, pyqtProperty, QCoreApplication, QDate, + QObject, QUrl) +from PyQt6.QtGui import QColor +from PyQt6.QtQml import (qmlAttachedPropertiesObject, qmlRegisterType, + QQmlComponent, QQmlEngine, QQmlListProperty) + + +QML = b''' +import People 1.0 +import QtQuick 2.0 + +BirthdayParty { + Boy { + name: "Robert Campbell" + BirthdayParty.rsvp: "2009-07-01" + } + + Boy { + name: "Leo Hodges" + shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 } + BirthdayParty.rsvp: "2009-07-06" + } + + host: Boy { + name: "Jack Smith" + shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 } + } +} +''' + + +class ShoeDescription(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._size = 0 + self._color = QColor() + self._brand = '' + self._price = 0.0 + + @pyqtProperty(int) + def size(self): + return self._size + + @size.setter + def size(self, size): + self._size = size + + @pyqtProperty(QColor) + def color(self): + return self._color + + @color.setter + def color(self, color): + self._color = color + + @pyqtProperty(str) + def brand(self): + return self._brand + + @brand.setter + def brand(self, brand): + self._brand = brand + + @pyqtProperty(float) + def price(self): + return self._price + + @price.setter + def price(self, price): + self._price = price + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoe = ShoeDescription() + + @pyqtProperty(str) + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @pyqtProperty(ShoeDescription) + def shoe(self): + return self._shoe + + +class Boy(Person): + pass + + +class Girl(Person): + pass + + +class BirthdayPartyAttached(QObject): + def __init__(self, parent): + super().__init__(parent) + + self._rsvp = QDate() + + @pyqtProperty(QDate) + def rsvp(self): + return self._rsvp + + @rsvp.setter + def rsvp(self, rsvp): + self._rsvp = rsvp + + +@pyqtClassInfo('DefaultProperty', 'guests') +class BirthdayParty(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._host = None + self._guests = [] + + @pyqtProperty(Person) + def host(self): + return self._host + + @host.setter + def host(self, host): + self._host = host + + @pyqtProperty(QQmlListProperty) + def guests(self): + return QQmlListProperty(Person, self, self._guests) + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(ShoeDescription, 'People', 1, 0) +qmlRegisterType(Person, 'People', 1, 0) +qmlRegisterType(Boy, 'People', 1, 0) +qmlRegisterType(Girl, 'People', 1, 0) +qmlRegisterType(BirthdayPartyAttached, 'People', 1, 0) +qmlRegisterType(BirthdayParty, 'People', 1, 0, + attachedProperties=BirthdayPartyAttached) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +party = component.create() + +if party is not None and party.host is not None: + print("\"{name}\" is having a birthday!".format(name=party.host.name)) + + if isinstance(party.host, Boy): + print("He is inviting:") + else: + print("She is inviting:") + + for guest in party.guests: + attached = qmlAttachedPropertiesObject(BirthdayParty, guest, False) + + if attached is not None: + rsvpDate = attached.property('rsvp') + else: + rsvpDate = QDate() + + if rsvpDate.isNull(): + print(" \"{name}\" RSVP date: Hasn't RSVP'd".format( + name=guest.name)) + else: + print(" \"{name}\" RSVP date: {date}".format(name=guest.name, + date=rsvpDate.toString())) +else: + for e in component.errors(): + print("Error:", e.toString()); diff --git a/examples/qml/referenceexamples/binding.py b/examples/qml/referenceexamples/binding.py new file mode 100755 index 0000000..a781d1c --- /dev/null +++ b/examples/qml/referenceexamples/binding.py @@ -0,0 +1,328 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import (pyqtClassInfo, pyqtProperty, pyqtSignal, pyqtSlot, + QCoreApplication, QDate, QObject, QTime, QTimer, QUrl) +from PyQt6.QtGui import QColor +from PyQt6.QtQml import (qmlAttachedPropertiesObject, qmlRegisterType, + QQmlComponent, QQmlEngine, QQmlListProperty, QQmlProperty, + QQmlPropertyValueSource) + + +QML = b''' +import People 1.0 +import QtQuick 2.0 + +BirthdayParty { + id: theParty + + HappyBirthdaySong on announcement { name: theParty.host.name } + + host: Boy { + name: "Bob Jones" + shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 } + } + + onPartyStarted: console.log("This party started rockin' at " + time); + + Boy { + name: "Leo Hodges" + BirthdayParty.rsvp: "2009-07-06" + shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 } + } + + Boy { + name: "Jack Smith" + shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 } + } + + Girl { + name: "Anne Brown" + BirthdayParty.rsvp: "2009-07-01" + shoe.size: 7 + shoe.color: "red" + shoe.brand: "Marc Jacobs" + shoe.price: 699.99 + } +} +''' + + +class ShoeDescription(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._size = 0 + self._color = QColor() + self._brand = '' + self._price = 0.0 + + shoeChanged = pyqtSignal() + + @pyqtProperty(int, notify=shoeChanged) + def size(self): + return self._size + + @size.setter + def size(self, size): + if self._size != size: + self._size = size + self.shoeChanged.emit() + + @pyqtProperty(QColor, notify=shoeChanged) + def color(self): + return self._color + + @color.setter + def color(self, color): + if self._color != color: + self._color = color + self.shoeChanged.emit() + + @pyqtProperty(str, notify=shoeChanged) + def brand(self): + return self._brand + + @brand.setter + def brand(self, brand): + if self._brand != brand: + self._brand = brand + self.shoeChanged.emit() + + @pyqtProperty(float, notify=shoeChanged) + def price(self): + return self._price + + @price.setter + def price(self, price): + if self._price != price: + self._price = price + self.shoeChanged.emit() + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoe = ShoeDescription() + + nameChanged = pyqtSignal() + + @pyqtProperty(str, notify=nameChanged) + def name(self): + return self._name + + @name.setter + def name(self, name): + if self._name != name: + self._name = name + self.nameChanged.emit() + + @pyqtProperty(ShoeDescription) + def shoe(self): + return self._shoe + + +class Boy(Person): + pass + + +class Girl(Person): + pass + + +class BirthdayPartyAttached(QObject): + def __init__(self, parent): + super().__init__(parent) + + self._rsvp = QDate() + + rsvpChanged = pyqtSignal() + + @pyqtProperty(QDate, notify=rsvpChanged) + def rsvp(self): + return self._rsvp + + @rsvp.setter + def rsvp(self, rsvp): + if self._rsvp != rsvp: + self._rsvp = rsvp + self.rsvpChanged.emit() + + +@pyqtClassInfo('DefaultProperty', 'guests') +class BirthdayParty(QObject): + partyStarted = pyqtSignal(QTime, arguments=['time']) + + def __init__(self, parent=None): + super().__init__(parent) + + self._host = None + self._guests = [] + + hostChanged = pyqtSignal() + + @pyqtProperty(Person, notify=hostChanged) + def host(self): + return self._host + + @host.setter + def host(self, host): + if self._host != host: + self._host = host + self.hostChanged.emit() + + @pyqtProperty(QQmlListProperty) + def guests(self): + return QQmlListProperty(Person, self, self._guests) + + @pyqtProperty(str) + def announcement(self): + return '' + + @announcement.setter + def announcement(self, announcement): + print(announcement) + + def startParty(self): + self.partyStarted.emit(QTime.currentTime()) + + +class HappyBirthdaySong(QObject, QQmlPropertyValueSource): + def __init__(self, parent=None): + super().__init__(parent) + + self._line = -1 + self._lyrics = [] + self._target = QQmlProperty() + self._name = '' + + timer = QTimer(self) + timer.timeout.connect(self.advance) + timer.start(1000) + + nameChanged = pyqtSignal() + + @pyqtProperty(str, notify=nameChanged) + def name(self): + return self._name + + @name.setter + def name(self, name): + if self._name != name: + self._name = name + + self._lyrics = [ + "", + "Happy birthday to you,", + "Happy birthday to you,", + "Happy birthday dear {name},".format(name=self._name), + "Happy birthday to you!" + ] + + self.nameChanged.emit() + + def setTarget(self, target): + self._target = target + + @pyqtSlot() + def advance(self): + self._line += 1 + + if self._line < len(self._lyrics): + self._target.write(self._lyrics[self._line]) + else: + QCoreApplication.instance().quit() + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(ShoeDescription, 'People', 1, 0) +qmlRegisterType(Person, 'People', 1, 0) +qmlRegisterType(Boy, 'People', 1, 0) +qmlRegisterType(Girl, 'People', 1, 0) +qmlRegisterType(BirthdayPartyAttached, 'People', 1, 0) +qmlRegisterType(BirthdayParty, 'People', 1, 0, + attachedProperties=BirthdayPartyAttached) +qmlRegisterType(HappyBirthdaySong, 'People', 1, 0) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +party = component.create() + +if party is not None and party.host is not None: + print("\"{name}\" is having a birthday!".format(name=party.host.name)) + + if isinstance(party.host, Boy): + print("He is inviting:") + else: + print("She is inviting:") + + for guest in party.guests: + attached = qmlAttachedPropertiesObject(BirthdayParty, guest, False) + + if attached is not None: + rsvpDate = attached.property('rsvp') + else: + rsvpDate = QDate() + + if rsvpDate.isNull(): + print(" \"{name}\" RSVP date: Hasn't RSVP'd".format( + name=guest.name)) + else: + print(" \"{name}\" RSVP date: {date}".format(name=guest.name, + date=rsvpDate.toString())) + + party.startParty() +else: + for e in component.errors(): + print("Error:", e.toString()); + +sys.exit(app.exec()) diff --git a/examples/qml/referenceexamples/coercion.py b/examples/qml/referenceexamples/coercion.py new file mode 100755 index 0000000..b21abe0 --- /dev/null +++ b/examples/qml/referenceexamples/coercion.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import pyqtProperty, QCoreApplication, QObject, QUrl +from PyQt6.QtQml import (qmlRegisterType, QQmlComponent, QQmlEngine, + QQmlListProperty) + + +QML = b''' +import People 1.0 + +BirthdayParty { + host: Boy { + name: "Bob Jones" + shoeSize: 12 + } + + guests: [ + Boy { name: "Leo Hodges" }, + Boy { name: "Jack Smith" }, + Girl { name: "Anne Brown" } + ] +} +''' + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoeSize = 0 + + @pyqtProperty(str) + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @pyqtProperty(int) + def shoeSize(self): + return self._shoeSize + + @shoeSize.setter + def shoeSize(self, shoeSize): + self._shoeSize = shoeSize + + +class Boy(Person): + pass + + +class Girl(Person): + pass + + +class BirthdayParty(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._host = None + self._guests = [] + + @pyqtProperty(Person) + def host(self): + return self._host + + @host.setter + def host(self, host): + self._host = host + + @pyqtProperty(QQmlListProperty) + def guests(self): + return QQmlListProperty(Person, self, self._guests) + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(Person, 'People', 1, 0) +qmlRegisterType(Boy, 'People', 1, 0) +qmlRegisterType(Girl, 'People', 1, 0) +qmlRegisterType(BirthdayParty, 'People', 1, 0) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +party = component.create() + +if party is not None and party.host is not None: + print("\"{name}\" is having a birthday!".format(name=party.host.name)) + + if isinstance(party.host, Boy): + print("He is inviting:") + else: + print("She is inviting:") + + for guest in party.guests: + print(" \"{name}\"".format(name=guest.name)) +else: + for e in component.errors(): + print("Error:", e.toString()); diff --git a/examples/qml/referenceexamples/default.py b/examples/qml/referenceexamples/default.py new file mode 100755 index 0000000..4741ca9 --- /dev/null +++ b/examples/qml/referenceexamples/default.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import (pyqtClassInfo, pyqtProperty, QCoreApplication, + QObject, QUrl) +from PyQt6.QtQml import (qmlRegisterType, QQmlComponent, QQmlEngine, + QQmlListProperty) + + +QML = b''' +import People 1.0 + +BirthdayParty { + host: Boy { + name: "Bob Jones" + shoeSize: 12 + } + + Boy { name: "Leo Hodges" } + Boy { name: "Jack Smith" } + Girl { name: "Anne Brown" } +} +''' + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoeSize = 0 + + @pyqtProperty(str) + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @pyqtProperty(int) + def shoeSize(self): + return self._shoeSize + + @shoeSize.setter + def shoeSize(self, shoeSize): + self._shoeSize = shoeSize + + +class Boy(Person): + pass + + +class Girl(Person): + pass + + +@pyqtClassInfo('DefaultProperty', 'guests') +class BirthdayParty(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._host = None + self._guests = [] + + @pyqtProperty(Person) + def host(self): + return self._host + + @host.setter + def host(self, host): + self._host = host + + @pyqtProperty(QQmlListProperty) + def guests(self): + return QQmlListProperty(Person, self, self._guests) + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(Person, 'People', 1, 0) +qmlRegisterType(Boy, 'People', 1, 0) +qmlRegisterType(Girl, 'People', 1, 0) +qmlRegisterType(BirthdayParty, 'People', 1, 0) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +party = component.create() + +if party is not None and party.host is not None: + print("\"{name}\" is having a birthday!".format(name=party.host.name)) + + if isinstance(party.host, Boy): + print("He is inviting:") + else: + print("She is inviting:") + + for guest in party.guests: + print(" \"{name}\"".format(name=guest.name)) +else: + for e in component.errors(): + print("Error:", e.toString()); diff --git a/examples/qml/referenceexamples/grouped.py b/examples/qml/referenceexamples/grouped.py new file mode 100755 index 0000000..6560bf7 --- /dev/null +++ b/examples/qml/referenceexamples/grouped.py @@ -0,0 +1,217 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import (pyqtClassInfo, pyqtProperty, QCoreApplication, + QObject, QUrl) +from PyQt6.QtGui import QColor +from PyQt6.QtQml import (qmlRegisterType, QQmlComponent, QQmlEngine, + QQmlListProperty) + + +QML = b''' +import People 1.0 +import QtQuick 2.0 + +BirthdayParty { + host: Boy { + name: "Bob Jones" + shoe { size: 12; color: "white"; brand: "Bikey"; price: 90.0 } + } + + Boy { + name: "Leo Hodges" + shoe { size: 10; color: "black"; brand: "Thebok"; price: 59.95 } + } + + Boy { + name: "Jack Smith" + shoe { + size: 8 + color: "blue" + brand: "Luma" + price: 19.95 + } + } + + Girl { + name: "Anne Brown" + shoe.size: 7 + shoe.color: "red" + shoe.brand: "Job Macobs" + shoe.price: 699.99 + } +} +''' + + +class ShoeDescription(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._size = 0 + self._color = QColor() + self._brand = '' + self._price = 0.0 + + @pyqtProperty(int) + def size(self): + return self._size + + @size.setter + def size(self, size): + self._size = size + + @pyqtProperty(QColor) + def color(self): + return self._color + + @color.setter + def color(self, color): + self._color = color + + @pyqtProperty(str) + def brand(self): + return self._brand + + @brand.setter + def brand(self, brand): + self._brand = brand + + @pyqtProperty(float) + def price(self): + return self._price + + @price.setter + def price(self, price): + self._price = price + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoe = ShoeDescription() + + @pyqtProperty(str) + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @pyqtProperty(ShoeDescription) + def shoe(self): + return self._shoe + + +class Boy(Person): + pass + + +class Girl(Person): + pass + + +@pyqtClassInfo('DefaultProperty', 'guests') +class BirthdayParty(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._host = None + self._guests = [] + + @pyqtProperty(Person) + def host(self): + return self._host + + @host.setter + def host(self, host): + self._host = host + + @pyqtProperty(QQmlListProperty) + def guests(self): + return QQmlListProperty(Person, self, self._guests) + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(ShoeDescription, 'People', 1, 0) +qmlRegisterType(Person, 'People', 1, 0) +qmlRegisterType(Boy, 'People', 1, 0) +qmlRegisterType(Girl, 'People', 1, 0) +qmlRegisterType(BirthdayParty, 'People', 1, 0) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +party = component.create() + +if party is not None and party.host is not None: + print("\"{name}\" is having a birthday!".format(name=party.host.name)) + + if isinstance(party.host, Boy): + print("He is inviting:") + else: + print("She is inviting:") + + bestShoe = None + + for guest in party.guests: + print(" \"{name}\"".format(name=guest.name)) + + if bestShoe is None or bestShoe.shoe.price < guest.shoe.price: + bestShoe = guest + + if bestShoe is not None: + print("\"{name}\" is wearing the best shoes!".format( + name=bestShoe.name)) +else: + for e in component.errors(): + print("Error:", e.toString()); diff --git a/examples/qml/referenceexamples/methods.py b/examples/qml/referenceexamples/methods.py new file mode 100755 index 0000000..13ba2a6 --- /dev/null +++ b/examples/qml/referenceexamples/methods.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import (pyqtProperty, pyqtSlot, QCoreApplication, QObject, + QUrl) +from PyQt6.QtQml import (qmlRegisterType, QQmlComponent, QQmlEngine, + QQmlListProperty) + + +QML = b''' +import QtQuick 2.0 +import People 1.0 + +BirthdayParty { + host: Person { + name: "Bob Jones" + shoeSize: 12 + } + + guests: [ + Person { name: "Leo Hodges" }, + Person { name: "Jack Smith" }, + Person { name: "Anne Brown" } + ] + + Component.onCompleted: invite("William Green") +} +''' + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoeSize = 0 + + @pyqtProperty(str) + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @pyqtProperty(int) + def shoeSize(self): + return self._shoeSize + + @shoeSize.setter + def shoeSize(self, shoeSize): + self._shoeSize = shoeSize + + +class BirthdayParty(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._host = None + self._guests = [] + + @pyqtProperty(Person) + def host(self): + return self._host + + @host.setter + def host(self, host): + self._host = host + + @pyqtProperty(QQmlListProperty) + def guests(self): + return QQmlListProperty(Person, self, self._guests) + + @pyqtSlot(str) + def invite(self, name): + person = Person(self) + person.name = name + self._guests.append(person) + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(Person, 'People', 1, 0) +qmlRegisterType(BirthdayParty, 'People', 1, 0) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +party = component.create() + +if party is not None and party.host is not None: + print("\"{name}\" is having a birthday!".format(name=party.host.name)) + print("They are inviting:") + + for guest in party.guests: + print(" \"{name}\"".format(name=guest.name)) +else: + for e in component.errors(): + print("Error:", e.toString()) diff --git a/examples/qml/referenceexamples/properties.py b/examples/qml/referenceexamples/properties.py new file mode 100755 index 0000000..b62b2fc --- /dev/null +++ b/examples/qml/referenceexamples/properties.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import pyqtProperty, QCoreApplication, QObject, QUrl +from PyQt6.QtQml import (qmlRegisterType, QQmlComponent, QQmlEngine, + QQmlListProperty) + + +QML = b''' +import QtQuick 2.0 +import People 1.0 + +BirthdayParty { + host: Person { + name: "Bob Jones" + shoeSize: 12 + } + + guests: [ + Person { name: "Leo Hodges" }, + Person { name: "Jack Smith" }, + Person { name: "Anne Brown" } + ] +} +''' + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoeSize = 0 + + @pyqtProperty(str) + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @pyqtProperty(int) + def shoeSize(self): + return self._shoeSize + + @shoeSize.setter + def shoeSize(self, shoeSize): + self._shoeSize = shoeSize + + +class BirthdayParty(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._host = None + self._guests = [] + + @pyqtProperty(Person) + def host(self): + return self._host + + @host.setter + def host(self, host): + self._host = host + + @pyqtProperty(QQmlListProperty) + def guests(self): + return QQmlListProperty(Person, self, self._guests) + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(Person, 'People', 1, 0) +qmlRegisterType(BirthdayParty, 'People', 1, 0) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +party = component.create() + +if party is not None and party.host is not None: + print("\"{name}\" is having a birthday!".format(name=party.host.name)) + print("They are inviting:") + + for guest in party.guests: + print(" \"{name}\"".format(name=guest.name)) +else: + for e in component.errors(): + print("Error:", e.toString()); diff --git a/examples/qml/referenceexamples/signal.py b/examples/qml/referenceexamples/signal.py new file mode 100755 index 0000000..449df5f --- /dev/null +++ b/examples/qml/referenceexamples/signal.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import (pyqtClassInfo, pyqtProperty, pyqtSignal, + QCoreApplication, QDate, QObject, QTime, QUrl) +from PyQt6.QtGui import QColor +from PyQt6.QtQml import (qmlAttachedPropertiesObject, qmlRegisterType, + QQmlComponent, QQmlEngine, QQmlListProperty) + + +QML = b''' +import People 1.0 +import QtQuick 2.0 + +BirthdayParty { + onPartyStarted: console.log("This party started rockin' at " + time); + + host: Boy { + name: "Bob Jones" + shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 } + } + + Boy { + name: "Leo Hodges" + BirthdayParty.rsvp: "2009-07-06" + shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 } + } + + Boy { + name: "Jack Smith" + shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 } + } + + Girl { + name: "Anne Brown" + BirthdayParty.rsvp: "2009-07-01" + shoe.size: 7 + shoe.color: "red" + shoe.brand: "Marc Jacobs" + shoe.price: 699.99 + } +} +''' + + +class ShoeDescription(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._size = 0 + self._color = QColor() + self._brand = '' + self._price = 0.0 + + @pyqtProperty(int) + def size(self): + return self._size + + @size.setter + def size(self, size): + self._size = size + + @pyqtProperty(QColor) + def color(self): + return self._color + + @color.setter + def color(self, color): + self._color = color + + @pyqtProperty(str) + def brand(self): + return self._brand + + @brand.setter + def brand(self, brand): + self._brand = brand + + @pyqtProperty(float) + def price(self): + return self._price + + @price.setter + def price(self, price): + self._price = price + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoe = ShoeDescription() + + @pyqtProperty(str) + def name(self): + return self._name + + @name.setter + def name(self, name): + self._name = name + + @pyqtProperty(ShoeDescription) + def shoe(self): + return self._shoe + + +class Boy(Person): + pass + + +class Girl(Person): + pass + + +class BirthdayPartyAttached(QObject): + def __init__(self, parent): + super().__init__(parent) + + self._rsvp = QDate() + + @pyqtProperty(QDate) + def rsvp(self): + return self._rsvp + + @rsvp.setter + def rsvp(self, rsvp): + self._rsvp = rsvp + + +@pyqtClassInfo('DefaultProperty', 'guests') +class BirthdayParty(QObject): + partyStarted = pyqtSignal(QTime, arguments=['time']) + + def __init__(self, parent=None): + super().__init__(parent) + + self._host = None + self._guests = [] + + @pyqtProperty(Person) + def host(self): + return self._host + + @host.setter + def host(self, host): + self._host = host + + @pyqtProperty(QQmlListProperty) + def guests(self): + return QQmlListProperty(Person, self, self._guests) + + def startParty(self): + self.partyStarted.emit(QTime.currentTime()) + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(ShoeDescription, 'People', 1, 0) +qmlRegisterType(Person, 'People', 1, 0) +qmlRegisterType(Boy, 'People', 1, 0) +qmlRegisterType(Girl, 'People', 1, 0) +qmlRegisterType(BirthdayPartyAttached, 'People', 1, 0) +qmlRegisterType(BirthdayParty, 'People', 1, 0, + attachedProperties=BirthdayPartyAttached) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +party = component.create() + +if party is not None and party.host is not None: + print("\"{name}\" is having a birthday!".format(name=party.host.name)) + + if isinstance(party.host, Boy): + print("He is inviting:") + else: + print("She is inviting:") + + for guest in party.guests: + attached = qmlAttachedPropertiesObject(BirthdayParty, guest, False) + + if attached is not None: + rsvpDate = attached.property('rsvp') + else: + rsvpDate = QDate() + + if rsvpDate.isNull(): + print(" \"{name}\" RSVP date: Hasn't RSVP'd".format( + name=guest.name)) + else: + print(" \"{name}\" RSVP date: {date}".format(name=guest.name, + date=rsvpDate.toString())) + + party.startParty() +else: + for e in component.errors(): + print("Error:", e.toString()); diff --git a/examples/qml/referenceexamples/valuesource.py b/examples/qml/referenceexamples/valuesource.py new file mode 100755 index 0000000..f5b5657 --- /dev/null +++ b/examples/qml/referenceexamples/valuesource.py @@ -0,0 +1,326 @@ +#!/usr/bin/env python + + +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import sys + +from PyQt6.QtCore import (pyqtClassInfo, pyqtProperty, pyqtSignal, pyqtSlot, + QCoreApplication, QDate, QObject, QTime, QTimer, QUrl) +from PyQt6.QtGui import QColor +from PyQt6.QtQml import (qmlAttachedPropertiesObject, qmlRegisterType, + QQmlComponent, QQmlEngine, QQmlListProperty, QQmlProperty, + QQmlPropertyValueSource) + + +QML = b''' +import People 1.0 +import QtQuick 2.0 + +BirthdayParty { + HappyBirthdaySong on announcement { name: "Bob Jones" } + + onPartyStarted: console.log("This party started rockin' at " + time); + + host: Boy { + name: "Bob Jones" + shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 } + } + + Boy { + name: "Leo Hodges" + BirthdayParty.rsvp: "2009-07-06" + shoe { size: 10; color: "black"; brand: "Reebok"; price: 59.95 } + } + + Boy { + name: "Jack Smith" + shoe { size: 8; color: "blue"; brand: "Puma"; price: 19.95 } + } + + Girl { + name: "Anne Brown" + BirthdayParty.rsvp: "2009-07-01" + shoe.size: 7 + shoe.color: "red" + shoe.brand: "Marc Jacobs" + shoe.price: 699.99 + } +} +''' + + +class ShoeDescription(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._size = 0 + self._color = QColor() + self._brand = '' + self._price = 0.0 + + shoeChanged = pyqtSignal() + + @pyqtProperty(int, notify=shoeChanged) + def size(self): + return self._size + + @size.setter + def size(self, size): + if self._size != size: + self._size = size + self.shoeChanged.emit() + + @pyqtProperty(QColor, notify=shoeChanged) + def color(self): + return self._color + + @color.setter + def color(self, color): + if self._color != color: + self._color = color + self.shoeChanged.emit() + + @pyqtProperty(str, notify=shoeChanged) + def brand(self): + return self._brand + + @brand.setter + def brand(self, brand): + if self._brand != brand: + self._brand = brand + self.shoeChanged.emit() + + @pyqtProperty(float, notify=shoeChanged) + def price(self): + return self._price + + @price.setter + def price(self, price): + if self._price != price: + self._price = price + self.shoeChanged.emit() + + +class Person(QObject): + def __init__(self, parent=None): + super().__init__(parent) + + self._name = '' + self._shoe = ShoeDescription() + + nameChanged = pyqtSignal() + + @pyqtProperty(str, notify=nameChanged) + def name(self): + return self._name + + @name.setter + def name(self, name): + if self._name != name: + self._name = name + self.nameChanged.emit() + + @pyqtProperty(ShoeDescription) + def shoe(self): + return self._shoe + + +class Boy(Person): + pass + + +class Girl(Person): + pass + + +class BirthdayPartyAttached(QObject): + def __init__(self, parent): + super().__init__(parent) + + self._rsvp = QDate() + + rsvpChanged = pyqtSignal() + + @pyqtProperty(QDate, notify=rsvpChanged) + def rsvp(self): + return self._rsvp + + @rsvp.setter + def rsvp(self, rsvp): + if self._rsvp != rsvp: + self._rsvp = rsvp + self.rsvpChanged.emit() + + +@pyqtClassInfo('DefaultProperty', 'guests') +class BirthdayParty(QObject): + partyStarted = pyqtSignal(QTime, arguments=['time']) + + def __init__(self, parent=None): + super().__init__(parent) + + self._host = None + self._guests = [] + + hostChanged = pyqtSignal() + + @pyqtProperty(Person, notify=hostChanged) + def host(self): + return self._host + + @host.setter + def host(self, host): + if self._host != host: + self._host = host + self.hostChanged.emit() + + @pyqtProperty(QQmlListProperty) + def guests(self): + return QQmlListProperty(Person, self, self._guests) + + @pyqtProperty(str) + def announcement(self): + return '' + + @announcement.setter + def announcement(self, announcement): + print(announcement) + + def startParty(self): + self.partyStarted.emit(QTime.currentTime()) + + +class HappyBirthdaySong(QObject, QQmlPropertyValueSource): + def __init__(self, parent=None): + super(HappyBirthdaySong, self).__init__(parent) + + self._line = -1 + self._lyrics = [] + self._target = QQmlProperty() + self._name = '' + + timer = QTimer(self) + timer.timeout.connect(self.advance) + timer.start(1000) + + nameChanged = pyqtSignal() + + @pyqtProperty(str, notify=nameChanged) + def name(self): + return self._name + + @name.setter + def name(self, name): + if self._name != name: + self._name = name + + self._lyrics = [ + "", + "Happy birthday to you,", + "Happy birthday to you,", + "Happy birthday dear {name},".format(name=self._name), + "Happy birthday to you!" + ] + + self.nameChanged.emit() + + def setTarget(self, target): + self._target = target + + @pyqtSlot() + def advance(self): + self._line += 1 + + if self._line < len(self._lyrics): + self._target.write(self._lyrics[self._line]) + else: + QCoreApplication.instance().quit() + + +app = QCoreApplication(sys.argv) + +qmlRegisterType(ShoeDescription, 'People', 1, 0) +qmlRegisterType(Person, 'People', 1, 0) +qmlRegisterType(Boy, 'People', 1, 0) +qmlRegisterType(Girl, 'People', 1, 0) +qmlRegisterType(BirthdayPartyAttached, 'People', 1, 0) +qmlRegisterType(BirthdayParty, 'People', 1, 0, + attachedProperties=BirthdayPartyAttached) +qmlRegisterType(HappyBirthdaySong, 'People', 1, 0) + +engine = QQmlEngine() + +component = QQmlComponent(engine) +component.setData(QML, QUrl()) + +party = component.create() + +if party is not None and party.host is not None: + print("\"{name}\" is having a birthday!".format(name=party.host.name)) + + if isinstance(party.host, Boy): + print("He is inviting:") + else: + print("She is inviting:") + + for guest in party.guests: + attached = qmlAttachedPropertiesObject(BirthdayParty, guest, False) + + if attached is not None: + rsvpDate = attached.property('rsvp') + else: + rsvpDate = QDate() + + if rsvpDate.isNull(): + print(" \"{name}\" RSVP date: Hasn't RSVP'd".format( + name=guest.name)) + else: + print(" \"{name}\" RSVP date: {date}".format(name=guest.name, + date=rsvpDate.toString())) + + party.startParty() +else: + for e in component.errors(): + print("Error:", e.toString()); + +sys.exit(app.exec()) diff --git a/examples/quick/animation/animation.py b/examples/quick/animation/animation.py new file mode 100644 index 0000000..7c979b4 --- /dev/null +++ b/examples/quick/animation/animation.py @@ -0,0 +1,60 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +## of its contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import os +import sys + +from PyQt6.QtCore import QUrl +from PyQt6.QtGui import QGuiApplication +from PyQt6.QtQuick import QQuickView + + +os.chdir(os.path.dirname(os.path.abspath(__file__))) + +app = QGuiApplication(sys.argv) + +view = QQuickView() +view.engine().quit.connect(app.quit) + +view.setSource(QUrl.fromLocalFile('animation.qml')) +view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) +view.show() + +sys.exit(app.exec()) diff --git a/examples/quick/animation/animation.qml b/examples/quick/animation/animation.qml new file mode 100644 index 0000000..2bf5a05 --- /dev/null +++ b/examples/quick/animation/animation.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../shared" as Examples + +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("ColorAnimation", "Interpolates between colors", Qt.resolvedUrl("basics/color-animation.qml")); + addExample("PropertyAnimation", "Interpolates between numbers", Qt.resolvedUrl("basics/property-animation.qml")); + addExample("Behaviors", "Animates procedural movement", Qt.resolvedUrl("behaviors/behavior-example.qml")); + addExample("Wiggly Text", "Text that wiggles as you drag it", Qt.resolvedUrl("behaviors/wigglytext.qml")); + addExample("Tv Tennis", "Paddles that follow a ball", Qt.resolvedUrl("behaviors/tvtennis.qml")); + addExample("Easing Curves", "Compare available easing curves", Qt.resolvedUrl("easing/easing.qml")); + addExample("States", "Simple states", Qt.resolvedUrl("states/states.qml")); + addExample("Transitions", "Simple states with animated transitions", Qt.resolvedUrl("states/transitions.qml")); + addExample("PathAnimation", "Animate along a path", Qt.resolvedUrl("pathanimation/pathanimation.qml")); + addExample("PathInterpolator", "Interpolates along a path", Qt.resolvedUrl("pathinterpolator/pathinterpolator.qml")); + } + } +} diff --git a/examples/quick/animation/basics/color-animation.qml b/examples/quick/animation/basics/color-animation.qml new file mode 100644 index 0000000..0de4177 --- /dev/null +++ b/examples/quick/animation/basics/color-animation.qml @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Particles 2.0 + +Item { + id: window + width: 320; height: 480 + + // Let's draw the sky... + Rectangle { + anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter } + //! [0] + gradient: Gradient { + GradientStop { + position: 0.0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { from: "DeepSkyBlue"; to: "#0E1533"; duration: 5000 } + ColorAnimation { from: "#0E1533"; to: "DeepSkyBlue"; duration: 5000 } + } + } + GradientStop { + position: 1.0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { from: "SkyBlue"; to: "#437284"; duration: 5000 } + ColorAnimation { from: "#437284"; to: "SkyBlue"; duration: 5000 } + } + } + } + //! [0] + } + + // the sun, moon, and stars + Item { + width: parent.width; height: 2 * parent.height + NumberAnimation on rotation { from: 0; to: 360; duration: 10000; loops: Animation.Infinite } + Image { + source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter + rotation: -3 * parent.rotation + } + Image { + source: "images/moon.png"; y: parent.height - 74; anchors.horizontalCenter: parent.horizontalCenter + rotation: -parent.rotation + } + ParticleSystem { + id: particlesystem + x: 0; y: parent.height/2 + width: parent.width; height: parent.height/2 + ImageParticle { + source: "images/star.png" + groups: ["star"] + color: "#00333333" + SequentialAnimation on opacity { + loops: Animation.Infinite + NumberAnimation { from: 0; to: 1; duration: 5000 } + NumberAnimation { from: 1; to: 0; duration: 5000 } + } + } + Emitter { + group: "star" + anchors.fill: parent + emitRate: parent.width / 50 + lifeSpan: 5000 + } + } + } + + // ...and the ground. + Rectangle { + anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom } + gradient: Gradient { + GradientStop { + position: 0.0 + SequentialAnimation on color { + loops: Animation.Infinite + ColorAnimation { from: "ForestGreen"; to: "#001600"; duration: 5000 } + ColorAnimation { from: "#001600"; to: "ForestGreen"; duration: 5000 } + } + } + GradientStop { position: 1.0; color: "DarkGreen" } + } + } +} diff --git a/examples/quick/animation/basics/images/face-smile.png b/examples/quick/animation/basics/images/face-smile.png new file mode 100644 index 0000000000000000000000000000000000000000..3d66d725781730c7a9376a25113164f8882d9795 GIT binary patch literal 15408 zcmYMbb95%Y6E|Ahwrv|vZF6g5>!-GD+qP|Q+pV|l*0$~T?)P`^eczljnVe+)NHU*H zCNn3I%8F8maCmSaARve`(&DQBIN(1*f%;d!z1HUbW3Z0WKb-%KFaJlN2@ak)|8=@K zidg<9`9C_le=+*kfHIMj694{Rfz^KA00H5Tl@S+F_gK5|aaY$^Y5Niibv_~Fmk==p z9gMDuJY++PoKeDz83)Z#h@j-W!-*=Sk#x*rK=eNb?Z96DrGgE5W)$&Af_=f4 z^2-$--`@Yc@q6X*(Gx-zs{f`L5RN%f4PK0be_JbeY1vOqq>eHa#1dp?AX0wVnUB-?vc{F*MRr)e&iAX}*`2Q) zka~xcYr0qDO6uz~WMgC&KKLkXNaFO&3lZ|X9o%*76}d_(Sbm3#o)wg>|Hj#(pV(Bj zkY#D{aU9FC_?cNy{HB4p@qp6 z0;gZ6fT@dy96XI8;lY3pasU;8#lqgB=LqHA`sqO9phs|R>p9--xJ6FfUxX+H$4*oS zTh;7Pabnwv-Sjeym)^P6obAhJQg!@0Y&pU%_uV@m!Mj{6e}{Cd&JMjO-P_Z1Ix6PG zY1F##xlqx%_x#Ld%Z9)9dK1A>zC`YMHV4a#vLzP>6K?j$@S5u!H1cf%er_zzW@rBt z1Mzs-l$3mG*^y9)?$AVV6&cj8{4C9m|b~Qj?dIluTkV| z=SRSob`=omsy5IO*dgS2=G7dRMM=(I(`yuZ*v_+-9zhQ*z$ui`Qn$-sEn z>uk6_@0(x3HqVT&O@dYPTafSqU}ydqXB)=V@$To=`hD&O`*};o+aUaZHzM2UrGgmo z;@S~1cEEf2I0(6T(Td%EMbYw1CWK|tx)$`(vUpAk4rS0{0k*@o#f zMF#N%;BfBSUYXx5wU#IERDDQ&Onr)d_Ds-B>EF$81vL2OAOff%V>?8y-hdLdK{}#9 zT?C8}sL~;xL5T?4-iy*BYrE$c@k*L^m2RlcQ+`CuFs|4n$>TR^2YCm|*OptH^((7< zIg&179Y*|B&=JoTr&=cwzy|iCZp<4&asBp42M|!3Zuz`j@chFb815T@mtKu(jgy*N z#@P?|61!i;eZ-a{zEaNBEjybF6Au~VP9Ht;Y~T&ISzXY7*f+Z`V0?srwnQihGNy~G z$7v5v^DC{vm7H%#Hm&8g@|jiS=I6Zp%H(W$>@9z}A^s(P?mL^XAxuVgU$e{f{UDKI zB$^?$A$K}>I(+(Ke-7A(E4KfcoVG2!2+TX|$zAC86|4y!w9K-0Lj;OiG@QHXK4^44 z^d|dC=FO?Ion@gRAR4ya*Pf#fBk>~d5^wFzCx72)Ubx+Zw+KAym;bFYi9G-KyUc81 zhq3b}Dk>7WuSpC-iGUvQ-eOqVQ??BaNJT&~`YvNQW5_m7PkEbbHY~mC&v*3j$e-(u ziH<$RuFVCFCA!+rmL?;ixv45WHVRHm`+z?fLXOe`W9(vHowV=;`ai{Nh&MwCfyMH>W~0 zR4?nu5063oBv{*mLn`KlBplZdcj?E5ou4eP$CHbc_h(~uRr{=kPjzF?LC+nzur?^E z&}1*2qbs-h0Y=>`+eFz&=ynG}ZNr-K#WBx#apQ!Y_RW@DsIFTqF<}N}pJCIaaU^1H z)B^PRW!0EKKI15kG!{J}v6DdQ6?9k!+4Ixh@jJvJav+GV9^9ux(@`Z~ofFfHSpWDv z!_3qzaE>9Pyxm(}O1rYI>gwZfDMnD+*!ZxJu~UZb3U1I&W0hh*irP)yS#PP>nW47E z@zO;Q*)wml{}FH(xCh(^9sobnH3GiND-As>My7TWV)F<6#cJ+tY6{fOQI;P^=Qq-~ z5~KAFAmlXl>t)<~i-Y1?aV#z_IVk_Mmc!m37DRy>IdyRh+PgIjtUKV5e;T6h_IJim z3|^zLX_$<<(gi+&heTag$<|zg8i(|DdTmQy!|pzzhXlG|r)n?vSu>NySgZ^;3ZJ?2 zpVzY+C)DP>^-X7P`b&F=2c;G{%&G4Pv>NhU1J*gY9+3f~j~(+)m|<~H{LnFD8zrMp zdGr9(HEzC@i>k(UwzaJagK!!5=!aKGp~z^xj+~B-4uVd-&YW*Z!GX$Nmcg(fhza0!9!5r-JwMLvXok>-2mj zOX02JVvz7aMvcS%TSVHL!i+L(o4iB{`ZTeMx9xO#NF*m@2rlP4Of$nh46^Q1HH1z! zdR%iJ$?q0dGK7}zBD4vXC81cy;8@zYR-#?pbMqnmqk5|kgyzgO8BXWbm&6dc>1U7t z-E+Sz_YfesGlG7@l!&%gk6LrWdc#a?AAK?U0K0(0Mltr>`IDTq&lI?5!mWNduj`bT z0$o@3d#B;|VeS7}uQ>)l#f=EM15yRq`TROj^cS!<)jg$LH2mljj`^VNIZ_8WXT|EH zy^dq;biOu6FF@FQkKVv1(=kDA(|$Mcv0hDN_M;V98^>bvMs2xG5d!)>?H;3#p%`Q&FEcy%fSKGJDHd4 z|c~0(#pcLP0F?nAiD&Vw+=GwtJ%L zkgHx()jy#Q@Qsy>6kn9<6hq^9-p-GU?V$vN-yeR z8@vVP6D^jtn`be=dD|3jZ>5XJAy<9h<1t66er}T5&1;f?!>cP&`Z+Y0WW8x;BG-K<5o;ZS*QQKvzy2N31<^Ufy6hew=27d9C(n(Eq48;b% z!AF=+T}4G2>gOgDbbEJv0bAH^)Rj;_JNy(Fk+%4%#oin=fvV*+LY6Q|dcCV0=$R>D z1yCz|QO=7M7CS<5W5E*pE6W2NU?K|cLYs;EF7GVXB6jB=SBKN)Z5(SH9e44?R~CT# zHE+fTjMH0N9k@~9L>3G#Y#oYvG(Xw#AA<1n{ezJzu7kV7pTcO$NuD^yQLVwU6_2KA zo9U zIuC+pigsW`vxjBx7~8mGzg9pgnFY6V`ojL9dcbp6;1gY7U@=>p0u^Erh0d5s74YGz znflx3DLQ+6{qiCEk$ppcP$*8#Hy>Iryz=9Sn?f7f!IowD$qS)Fu3MK_bV9k*o=Z_h ztx_Upkpdo89g~>44pJZ*Yew%veMp-kBqC1{XC~s-=n{~(Ydy z)6LM=pplRL;#b{@xy+8}^0s;z&iaq+$8oU;UySbU_-Q#p>bPlYEX-(N_>s5^uTED& zX-IT&WD$(H;KZQZJL3*dtmHH3uhX2TH1M!V`C<6_TfiK2pF^naP*m|Ykw5H(Z%SY0 zyX9cl!V@I=#{IVaxaUrfW8RnXKi860zL@9@tQJrSY6a{zj&1a`-2&c4nI5Ybk3721KXL$B# zmk`JS-)Po2FN-jGB0m`XBZC^f$HZo4F4O#VBS?w`>>VwwGGvlhlfL!7Mk|Bt1F*8l z5O84J#)du9{7J0+E~J)V5wcqI4P5pwa9t-p7Lm47HFMp9-8s$LUo0T`1c`^qL<<2) zLYSmhysvHKo;V~NCkw!#VfjQ@!54{pK%JboF1hyBetkF%w2W1p7GUe)h6`d`PC4uH zmxehGydU!1>-hv10JLM_WbV#;vPgRucDo>(%x-C=1-0u1@0rHz$28|ycExkz2qgWq z3xu6@(>)Hy`w({^+e^0|KY!#k{q~NIp1C{%F!OL*e-4nF;l+2`IuYwKVRdya zMaA#_Q$CNwHwdKT3m7@t@&O52Zc9IkJG=vQ$||smn5X`dee|}&nY!JE<rGIQ~@?&k%71^_U5og`}-q;8cgYf!UN1GC)$0wvTtU zW5KZEfVR6zP+a`z4wYTnDynEJT#yf79;@Ino+flo`OR?H%Xia|)!R55U@y~}3 zr6_~>#46eEphL&10uAYNdi{>#Yx_3A=F!o*! zHrvGw{2d;*vW6R6l82)(!&;!mZ3QDqH0yV4Bw5OAQYu z#ML=xPXIAlEM4Nt6eQPWn84e6w(^Fq^E7Aak?%P2e$4X&o@gg_)dL9C){CPji*DV4 zkm_!jeE4M3yMK~l7S3;UI=pkGHvT$8Dc$pBN12nT5Bt>d`cXx!4vQ(N_42P>^d;nqUW7uCP#Ww8cpId z9ED7ien1M8rkfbX=$^@%SPi2iAh@BPvE((PuoMxbiL(6;ZUCb4@Vq>Lwtxglx^!5U zlGtwDsZY(&$f9&t454({pbS;f)g*~mDTjMz-%uIE8H%WMNVIR1-Nr`DyOO2j3T#y( zhK>_k72wf^{pDdW&^qUP)Z5j4+-_Hxhj%l~_c}D*yJ5!l>zU1YXZ0%Jsmss{hCP zVH}lSLO1$&BQu@4zW>{~rP$ahe0P}?*DGrdobz8FR(zRO1~*(@((e^X&=f0_+BAy{ ziyJM=kOC$ZrO*<8`W-4*cY6FA4LM%IY7YgRws_+GML=_=PNH*N?|fda6U*$)XT~xM znYx%cDn&Yg72WtKiEq>Sq-MzWZc=~fDQ5a#`Y7~UIOd4$1lB1>m|T|xtw zYoE)&hL}EYe>6qpmad>2rY%9r2MlMHR)OilrA-Qgqe@`mmq5rG7rgq~tzRk|(sbQ5 zN#OojxaR2eejSAA5YiB+C?Makch~ehmm+W6wZbHG}=~o$n(XY9rBZ>r9 z4ULdSvqTDM$rt!A3#tLR3k;Mt86osujxI}WHrFXvaBO`wISNiTU!!t^>H87N2+%7~ zP(No@DV3zmDWxjhsyHoEl9;+m6+tCLq35`yC^%Fc!VHabB$@@^iTtY?cToz0O9{i*3{x$mzth5== zeF31scL?;~xXLLH4{Np$#Kb1EIrkMcU<=O=cTUF|`(pc`Cv*nBpXrONj1*c2S-~kF zcOXF=ZB@{_dz0!9AbS)4Mkdf!()PwEWO62cengg$R-6LF8PQ;{mn_xJ_r>f^dla$YT@_*FU$sxJ`m>zP^x@qX>)QiHRd2MrcoCP&%`g zE~=lK;5Jo6J1x)z+cC!RyUcHPq%-3C{Rb2;%5x3z)!j)itD&8!4sm z1yH$aQqTh0yV_Ko4bbD=jg!;K4T`~}vQ`mJND1qB!|Z-=ksI$W{QW6xD<`LLa<_26 zUKW{Rwh0nVp6*~T3&#QjDVnw!P1uZwbE{A>jY$!OiW5KtSd@*c3%T4{sDp1u1P}7{ zyE8<~g>3W$OzR;_b8Yo^{53~B@pr`kR$JbUIeGpeoZpl%EZ1_mbiPEd5mXgExdqjYgrrD%+}a{mYw|gQHf?iAKcfK+^DY7hFmfl{zg~#FyW$}_9kkDE5tMh z=W$%?>8+yh&b2vnE|=;-+rY%B#LfuBGc3CSz^f|BN9FVixpqw&O~hc%@ZwO&cMZ zLw!N6qkPL9mh%D1t6hB`b=>1b#9Qw#3aZmT&T+`1d3~`dF-Np76%?OTLCb*`sx%!=pl!puYOL4@M@4oD7(X`LfYSzK4t!N6LNst#i}Ml6Z`e9JApwZ?u$HL=(mQ} zrQxEst|4Tr=Vd@Q>^b*-t@_SFws{=olE{*??25j;lyTq$#gKD`WQ2mjSA%5>E>tji zpzU2L+rkkbDk(&tN{j`a1X`OO;6djUJNmvuUqs6>i?%@M_1|@zv(n#QHwm#)nB$j zGpGnL1#1F+2O+b-ndHEWhb7@n@luvhMsq-VmkQuuNbrv1L-IUec;Qa-Q&Fa+38Fr} zWKIdP@hT(~8^;?EFi!yUqLPV%Y3z^wYp7DNl@8~Aqb{7l!KxKW8taC=!&sutu9({Z z0#j~?D+=Kmp-w3$h%_21u&%yCLKHMK**T>!&#sN79req!gvNAf-*6H$f(MJAmX-o^ z);x_rvVkCpi42A@8|FRb#}0}lgnl}YiZ};tP$WIXFr8aJ>-n+1W51z&owh6xmO=~-V4vv%mnHl3 zhI9An!NHMm;F08>rW{B^s9IqJK}15(pcko}RQYi)Zw)EH`ahit7lLpv@44(cu)wKw zE5T2Mv}W!x{7t1_MwjJ6NR{WjZ-f&{rDUWWTBP7kwIcDsWu!?}Rvxn!DkMVZ*q$?1 z%z=Uf2rG1SNrR=gP2R1V$>ZfSd2eaj%X|%s@yau?{Ia(sc3~jXn-%($H4A5mT!su$ zsew43!6^H!7mcd=3*!VaOft)Vq z1p|CeF^^?jC<$XbScpU>K!6CN@1%O~@`Z2!I-46?yI`ALMR*%ktZ^s!j&#U0ME?YK zVAh^wN^zb9t^lQyhL~3$Jsg;lo+N6UK*=FMDc4C#0n&$JPlH`U&Et?GHFKV?9ALo} zLw{C2zTo=u3q}>AS*4G$hq1k;CPgiU0gpz3PK~hdpv*cn3q}g__)onjXQtV!OaM&) z1t@kJXkehwS;+a#M)nk+4q?^pxXNQ&aj{N*N~SHXXx5>?boR*$05ypwBqTWCghl2j z0EgyDE0H!L+&3$V3)?N@PMPs`O|ilGgC4=(j3=m94d<1PQ@iG?uIMlq@WTX!^n;Wx~LwO+%lxC1F&loVY-!TjO+mH{D~BY!UC*je5=XPXV2GUUJ>lrhR+^fL-1 zKo~N6%ph{e)JF_)m`r$NCA{Io9y6tOFPR8dA7^SVC+qK@aq2V@V~N@F~< zQawH-5=-mtNK0mhS_mr<=h<^szV6Vrb)Af#+F!)d-;iyP7e8gM6ZHnpia}2~lpi5P zqX0nlq=vn63c2u>O_)#4=GzdFG*)pCX2wKp>%b%ZO8ZmLf6fo8=VvmJkt)R*sY@&3 z7ZRVD31;P_)Uu7_#1^FYAv?eqX#*nu{^l@3oqRh>Z4zmM<;)O|f0;6o51Z$MiEelguN5 z1k8z-;$;>Wbp;0$des#Zv*TN8&w_PU&FE6O4&WaQjeA9cfc9;nH&=PyCchA)-K71djkH?D16t0HRLk`Qrv)p6hnoo z$ZqCcBzO%=(->lUGm3ukBr7O^-JAwYToit2=+HyRUI7(M)#A$Dd9T zNwV2}T5{{dU_1-(OeGRgJ2OyQ!**T5KEI`Dnje6-6vJvCul*VrVc;F2w_llH1R&BH z0;Os=c6M5r8OO_&?_q^O4;?HP7Ke=5 z1gfEqfR+zO4irkYh~=^BZrUW%mY3)w-Jv(W6lWBVAjyG*ejmvRs$hy1r8(YJp)U6L zf3c5)o-e}n0X&D_9*7ei=`~DqJuWUSu|1!m9`b%9{+5hbN^-#m9P-Qutm3w1JZkPD zg4@gBbgX+iwTcP`ElMiEgXkWl#r4b_9;wPg?NgE!DP z=D7KDCkIl&1vjzvv@SB_r^q|Yh4E#R*l?#v&XXtX|AjkvklgU%EAy`Ezz_Z&Nn@`z zhCAL^yPuPl_WPP&(Vn)X(2M;9joP6qF9?+jf5@IIDg|ZXP<$!$Lt-?dWh@Yd{c}Yn z0VBSLi4hRSz#BmuM&=`Syi-m$0EXre!$&gM!tGU`MGXJR|LnYG!4SmIC3d?a{c@*( zzt<43Ai3R6^yOkZq}$9@w9{XeoEkK-nVdm=JTF>0UsU}kR6v<`^rTswqtGL1SImtN zR=7xr`dtp1_0{L;s9BKABc|rA*t@YPGo{yx(f)c(;)yu4PLR`6zYfw37jlXDXd>J= zZ#tI`Zx_MXc|E>-G)O7~m2ZfQi)6}I{Z(9p26zb@V1Tm^%E=>q1UnPtmGb1uIY zY4@b~0;%rG*`-&G&VnpmTU12m9V%iETsXYhmBALNpXz4tJ1hOlDop4z1?lQSy?t%D zBDdY-RzWhu$;*oUNhkpg6Anl+h=(H01A64ofQ{jJnYJ;9{tQ;RTEO`bmp_9OKmg;v zu0OS{bYJ~15#U7hZ4WtTMfI%FEIG`FV_#4m&rX419tb2J2TtAJQLg#xsBlgh2p= zZQmwr`XRQbKBSNO7;l~J#Y4- zKW+Cuca=W$t-8H7@l4teXV4S15I3wg0O)64>YwU37$(VIXCaF>!V5qlQ9}!0f}pc2 zREi{vBR$3|eiY06p&_b3(TjhSnjR@*3OM`-CF}-~FM|tuOsV9|@n~f+Qhr_|I1YgfNQzZf=>wL(( zy%@Wrt&)6W8s+-FrV@;&%VOwBs4P-7Kcba*xzUeDZnx@-bc5E{n;9U!1 zThg)3iL9P!?US<2cyKxV%zT1mip$I|(e!d@v@+P&6a{>KJq$gJJUro-gj%K-d;<3w zb~@G_ylvfrB~nl1^qB_@He=~^AN?c?Rf>rnQt&2O;g>tsGXh_44`9J)6cY|vg21rn zpU_XuHp7^pY5(AwJLfX^3;8>ilj=3b4FYgV1JUEoDya63f~BO(dBcha0}lE0WkAM` zDGb63sGoN`!*bDf^o(S(cOZX{fjfvZK*KQ!*E7mrBUVS)c$&_51<^ALd`~Hf83VcQ zPwsqK!hdu>IZhJcoO5T+UcG<{EC$Z6l9n66NN;MJb|S&?3ed895ZY=ou6EKPDzQF) zPVB#RI`h;f{pK~1#IBE~DZTu04>x(Vi4e%bgzE?o`HMs*4LZV`>||H^_OzuhfA+cj z4ln!NMcP+9oo(-w+?)9f;7wR$ZJ!!*3?&~o_L#9|K`{4)Gs}8HAKN(w_vvAW?HA{E zl3FXzEUzT*@a+J;18h$a3oD*r(^KTh!SX?J)B0oADVKCOX&U)p;N9cqV&8GA;SHzQ z7t{UF%t~bs$2G(0FW-2E^8UE2fRw(K^4c_57!csenQNK9*eO3Uppku#O~2LW`ro&r#?9AtXCa$N0-Xi^DEaOn)z!@lH2 zd{AeN-l?^8nzXs+oG+?ElHY8hY)$rf{*M#W?m6|edrUlQf{j2)e!(a1joZ6vjG64h zTD)u&#?TV6 zfU$*u3%`Nx0C+yZVUD*?UNoCqi4wtP2t@=`ZS%C<1Y_VF%$y^_F}?tZnCoyD5EYo!#^7j_X>$o}CNU55se*AD#16l`Wac@}yg@4M&lUcx1Fb zeo|bxR){oyfv#6zz#@Sqns!RK^+2Flw?#s=77Vz|?cmdt^excRvO3)HTyq0Ojygrx40uU^?G`Kt42f5?D}Ne> zBQ63(7)FxhwlCwXH0g{H$${6PsXXau&$vng^s3p9rO4vStqFA@I7eB__^}Dvt$q;9 z)yk9o3L~}=hO=Ex8t75drjrCqnn@XN(rie)qAO=zU7cmx3;V^RRq1k+H9_B_wgf+= z2OLRHbj~^^9PMCpqCP0H;#&1q#N5uS7&P@NrA4L1>fhdHsc$$-n;5kFxu=1rp{J+r zKEeaPjY`6^ry+0GDTP+N0sW|t%}VaS+1g5}Ruq>;s?v@bI2e|g=e>X!VeTBlvfM^q zt@de2(V6}h)VdpEuDf)b<%_3(tsO>_jbrXML?B)}LX*QCfg9o@3WbGWnr>~PI+8@# zze$2`4&TvtSA8hhP%%>F;AF_bcN2zcqI6)Sp-ee301qUqC%iD^jaxH7H+{qn>|q21 z0O;ew9cG>y0u0n(c32n`Fa}h}c@Xxid|wD}UD!EWa@OhTBcv;3 zU3VM3%Wb%D)`Y1+0{gn)e&m@FhpNgyp%yx<-(D91mLe*PHS1b^i5LD-$Ti2VMq0tV zhh31R_hW`R!YD7`EegRhQ{O=>e%I<9a^^NvVl!G`Gydb#PAq-{wY#dAqkF0gr|YL_ zYN*j*dx{$VY*0mbD-ojx#>5%ri5%I*^)jNfh6lAb(s)*9;ueQ>i?&yR2p});T@dgW z!)Z&rf4g-XQ5t%7Ld?xMd<4 z&7+>+Tdl9ayr~m!injG6izqA~iJlart^UFvt(cx{0)H5X1`n`>?1x1j4E-;Tfwa z&29DXR=;XegZokfjEa?ZzLm;?!FGFak-pOuSYIx4hY(P^UPGMTem2UR`?smPrgaF(5-#P#4Vbl+n-Q+=8Lnl z$SMtO*G2;(AKre|kuQuwLI=2-p6iRx`+`VG;;lqnCn_D^j)n>fzg+|0I*UE+XJ(dx z1i`0v5{w9yA8;xAt^$_uv>C@up^BGS-Svgr<)XbOd*06;Ffd}V?c6GJ>(n6!I+yJU zTQ~Fd_54TY>wgnAf+5J5!7uN(M;UyZf7CnJ3@6J)iQBgOh3gqaQs+=rTu+b`P-)Ue zYeO>3aamH5d?V56?Gi`vDxxvD;Uz1yN6x3 z4d1IX7p3A&T76e=mrW*;b9;nB7W7KEK(}#a%PJjZ9D-@ghPB=F?UNIO59Xe}! zB{cQ&jQ3iQG&;{EY+E?-Fs zMKHZYz&PB9^8^AjR{iOvG9U=z?u7b3CQDCTyI<)Y0owSQ^E*ya2 z(%X++G~H2fAE0Y%@${YINI;sp_{hA=C$0m@4v6w6n43ka6HU~u1h*6^Vx1xz$u zw7jb)Zr6ge5z0u?pt&cet{tfc=DYKW6Z3bh`wRu}%{tMn;`pq5%2^ST{ z^lxk9+4@F9TkiIZ&rPXEP>lEOzJF?15dI3q_ z>k~X8if&<)bw;SeE<4A$Q%$=|4F*$D9^bSpr)S8!fip<7t>x<*7+p8R6EjrJr79MR z)Qg)D?Idi*2+CBqDDS5qc-`>3+uO>%dtqzdXOKg0+Fru&HTZ0ydFhR%9yty|#)Gx3 z7L!%L`$NC9TQ5og=`2_$eF5QXEO!)e=RG#9ijU>b(LvhZH1M;VkLe=fQW3u}fUb&3%FEC3NnPWBcUi6@h{}&3b zPMjET-E;h|tK*t6^45xqkw;8t;1PM(qDR?0hZd@uKk|FYg99aBf*5t*Hw=PUy5X_k zx6rS0%v>)t#BKZ%?730;u2v}SDFx?zUm7BM8+wM{!b{pr*cVOiSiJ99W0x~V0xSkN zN-^AH`~IKbkdB@7NMJ8__jIO#WAQ!&xkiWuaKwTP>flpZeqv?NH#~d$y}Dl6g6mxl zFnz8~d~!`R*2m7pFCpp%R4KEm?haX2dR5V>c!t7|*j|P{T?HU8+Xnc_-k6S7j};fk zfF3(WW+~VxPu-SJ5%(N@ZYY7yh^cA|v0ILTei?Sz5r9*-i@i1eZj&l0Jv4*ERn*Gq z_X5hTI@05BEd42m;l=S*d)~T-oYYk;kFR!4YM_7U^~xwEq{RTc>N^}uNgC!|ox;{w z>8x8+4+ZjMNPAUv4`onEF5~g<6&Fl=NrW#F0Q@Dv$lA1rQ4dSrm((|FNLwbhZaX#g z!x$sxasEaqpxyE0hd)V?(^Chp7@4tA{6+n<^T7?87H8cG_Gw>4_pQH;!FIB}G{O|G zuCGWF@3*6n%WCL$i zRq|2*mBTxJcaUz4$H^P03ur53ngAfKiH4K~Gr;L_vYYzmt?S`~VxWG6XjZq-PpNW+ z9(H64>DTj~vmrDWlQmOv{4YYi$4E2juc`CZdT5z#1q2&}dFs=kJ^Kc?2De7HCO38> z9A^KhZ-loMQj-uu#xw$A#^H}#1E22Mz@ztKAT$7?zs@6w7wk`>1|}1X^f3m3Bm2rK z0c(Y+TpnHa8-01boD9E?TiL7aLL9<6ob%$Z8ac?mR_`o9y5Ol`ye^KsWXmXVh3jbS zcE+UIWQZl+>|gV zLMA2-EG~^MO)kwYEd)MJzd2*3He-~B5B)*{mo#_7#+_NNOWWO%g;20ro-Ut>b`PxX zlHCVLu^EW}r2vexQ}m5rKZ|%nx4#uSru{N+f9t4hD%f>AEk{+9SC!SLaysSxOZ1x_ zj@fA~=A|MfV_e8dC#LvpKhRhYWp3<6j5SV7fp(MUF}J4~^68wB%50`5?CM=Ir`vbG zJ*Y0Sm}}-(ZerD#RfFq4}?^cavS9`#I5ljLH~NrWVKtqsV_Kwm5+)FsQeq+c|A+$ zgLW65)<;eV!VmNAGog*f`$I+cdgkcvQ5bu3rMh}M?{9}9g z_g0AA7`4q_^}`$Pq!3Xh&bg&w#&0kowfX$7Zw-+qvp14AQ*!Xc<59lYwh~0rq9TLz(iF2SGziyUC~XwA SNxgs4ATkn);&q}%LH`e8$k9yz literal 0 HcmV?d00001 diff --git a/examples/quick/animation/basics/images/moon.png b/examples/quick/animation/basics/images/moon.png new file mode 100644 index 0000000000000000000000000000000000000000..9407b2b4f012de17999fb3695ddc14fb5787289e GIT binary patch literal 2433 zcmV-{34Zp8P)Px#32;bRa{vGvuK)lWuK`{fksJU300(qQO+^RT2NVkw8~1$KVgLXD0%A)?L;(MX zkIcUS00{+2L_t(&-tE|F$ff652k_thY-fGXyUt{pOvqU4l8PpwVhOc1)R=;_9|WyZ zLM+ira0?<9W5h3Q6)l1vgo?IG)nXN?A!$i1)j~*dr5Y0rW^pnz$;@Ql{k&&+c0bH9 zQk_ZOi79@W>*0KP4)=ZipX>VH%m2^SxEfdEYWzP(cs+yKi{rxAylP+HWZ?=E6V>s# z^8@BP@r**r9t&l0^#@8gdjd+HBvJdsN@Dnago1GTwE ztyC(sA_t}-joMtHHF2PndD9^L&M)0AeKjIPmuLP{qlZ2^xFu7VqqbwuOsz((QmGWE za zEYnpBT9KY(?|a~TrR^0}AnbJ?`N__;b5o_r8X~1!xqwkC95HfKY-T35uTd$@&AlX* zX#{h%9 z3TI`8-~C6&KR8w$t_AU*9qZnfixy8(0TmbP0}8w1ugMoZ(ojA78QuJA{~9PYQgQ;#DN22U-hqE@RHLSrN)MJJ?wbd zIa^A{6iR!dcV6gRstK2`NhGd0Q_$bgtJ+Gb7RfEdU4Xv>=^5BU#{IbFJex^mL5vBT^$W zbiuM)_4U&yjvTTA^CTWJUl8!(WZM#@b%|Og5!C1_>=>x^t!vE^Dm(NSpZ%B|T@N)2#UY*}B>SW{TBsn%FA(MWBXiA07rvqSC! zNt4Ygt-gsywmADEjm%u5BNIv8U@DVpwNkmD<65guc|ql7bGy!{G@fgL1M{uHYFk*>?&mj`nF|SsYbA-)f!7wA|0iG%uwybw)QY2Y&)f$QfkT2 znvRaqVzRMDWNM;SIjfc1lSyqDiN#hFHVq9#60NRQ(2<%I-+AG10CdXuxzb$idILSz zxzRDL%v>gu$_@4O&=aXlP0a;;y9PG&WO`N&b+r1fk%>+pJvd|q2Ia~>j2&pzI+i55 zQp-9LBkTIu6;$@kq&oVxM2iiF4eNqaw)OQaS+*wDK6}mdPyhn;osUhbj#w(SV$GJh z3LTlLMk+|vhL#QV1*;OwHTpJ0#&T1!8(fQhQyyQ+57`3ET`y)|&GifoB@Vn`SFkKK zGt?D}q=t@LM%Suct)RtNs!?bS9B9S5YV+z_z7WcA$O}nx-K6*MzFZ>F*EKNL*iovL z5ibLbmUDDM38V)K+ObBWBF%z;Q>Drm$K ziAdkvH3s@d5<#xj)6=@fH%O&AR`d+@KCwPIG=M<;qo?|x-nX|9U^hAHhz&uH| zpk06{%;e@Ojanr&GPPrN>Xrvb`te)^uz^ro-dAGqidl-VDD(_j5oxZ_5N){@kko~~t$pv10XA=z4upfy(+pSk}2 zyC3b%{!b3cMF^6AUjNMx_3pdAvnnyyml_zNkh9Rs7uUi?@xIv(9=Z9!yZ${ZUfU}> zoJ$s;?tkjL_I@$FV=Z(AvA!FWUeX96g<6YRD^)((|Jb`9IkvAljA?mjpRi7z9{uS% z+V`h-4Tp)yH8Q&*UBRv#Lv>kyIs3!!`Qr7vN%02yg#YcCh&Ov*I)3twmdPx#0%A)?L;(MXkIcUS000SaNLh0L01egv01egwkZ*aM00007bV*G`2iXc00xlLP z#V}X^00AvYL_t(2&sCDmNl}EMEjCrA2w=vc5!OUM!FuD-_qwCu z^ZIk5D1g1};DjS(oC+vrU?eAsfYNG&Q)L-!!IU*zr^u&;}%JHDzo8btuQ^bBfVmTJZVFZXTRuy2CrP* zT!PphT5-)`(2H-=@k)Vt<;gk3%#kNYmKlWzY$75$v}x%FIigLAuX-!tj^E%PUE_#&1J>;Bn(m#0}>+tzhKNaRv)bo>$a@~7Ni*txp8b$W75xsJQ)&K2Nfd>P4e_{{OW z(~I@y#8eivb^SXekx4GghgWPVlaP+9 zNOe3isi&#jPHSy0`-1#=FN)3@_pe!NQI(jQonrCMFf2u6*?}!tHM6v??l8Obck?;Z rp!JTQUY&A`>woHd{mlRRh4lbP0l+XkKyuFM8 literal 0 HcmV?d00001 diff --git a/examples/quick/animation/basics/images/sun.png b/examples/quick/animation/basics/images/sun.png new file mode 100644 index 0000000000000000000000000000000000000000..7713ca5ce7d1223430594e4d79632a70257dce05 GIT binary patch literal 8153 zcmV;~A12_5P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iOM@ z5+^2qR+x?e03TUNL_t(|+U%LxlO@M>-oKMeRo%LK-+Q~KyJtmX8w?hL08COc1&gAM zut6)R2+EG|1H%uF@S7g&(6i}3!45z9$uD+eiCWarIqh0fr!GQVN8^r~8YOT{Tfz`J2phPG;f%+o!~S@AoG9i1DAD6!&;--lRg z-5&@aKy*3?s#Wmc3LrS&(|r9DvcCY!eh~5ZI)s_=9{^sU+E{^FUIzGImwKZum}mF@ z^tVLeWe7k5pJE`)5X_&n$4-EBMXmfc;57xH2NdR3e?}77YQ;k%1Msyc3HG$cYoDFI z=SrcaR&`|XM4w_HSTEIw=0660E|{?jvE2z70E|?q1`+1g=qhG}2%ymfP?ZF(Y2+dJ zphcDkHBv>u0rGqQL%#7T1F{Ma35|0I@L!%2<<$R(@xLkcKLF2;nZ`AI^ARaT0Mv`x zodBB#AQu%mBp8HYGX%l_XW#M3TTg0V9aSyC$qW`Vk&e2Q}P;#H+D}^DSaq#}SZA5b#+YWCQ%9 zqpHvgRNJg*%?Z`PnA5Yz;FGwM2Z-I#eIxlc?Q>BT@Zg`KYX1eqb2|kLJ_mAPP1qgGg8z0Rk^x~V&3Gaf( zyIov3?FnYc-CMEObZT+?bW;l#z*p-fB*9LsvBx5*ahpYYoGD*|cdJBn9MT?#N_s%r zlestsVasc27nHQvs5Jz`MYXRpH?|rflsC`T1h|3pM;ZSo5Ch*0Q%fB2f@b1(ekwrL*WCsUn!6Yfc>_IIMiTP z%*gP)Re|cs3VuhW$oF=9(K;s%Pp-T8Y9{MD8vW`+KCcQXOw5{`(1%q(o(7G(B+z7- z1nj$|1c*Z~5E0ZWyx(OuB|PqvcXeprBg-2=-V~CREKby%bv+SZyNMbU-dOY)pQ@sf zX8zjpqF0ENb~|ZyQR$U>ti&*-Gw{DMApF|XgnpCF`RkO8Pow_a<)|oU%~D zK3zq8D*?oasqq;xSlQ&(&4O#&ZIQ%ZV4dv|%a~PCVH=+<@+>rCaUxH0@4Rali9gF; zgi;r*D>9JEMPX$ubu9K(AQB>1Ctqwac$Iu;*hUY@VCxN5gTUu8%ludsVP0U|jRc`5 zIKO~O8tZ1#5|r)Z)n^R9n-G!@2!Ay8^o?H($UK$avE8m1x9e*65{iY`dR+Xhq}3}8 z(b~?EerD@vw2`)2qOzUAbV8)@-vu=`sNN?oBI@La&V6!~y}ZFu97h1?kgEihWI_;p*cMl^Q@EfCGr{>Utllw$KfZI_y zLIR5_3L=1i{FMM+oB-Kf(7^N2%Ixet1X~m+0?pQTNGF;^(e^fccCepx_pXi~48#*l zjdNck)m{XsC}k!h;bu_yL!Aq7De|iH8t?&Ze+Pq$f9M^*cXMIQe5cmX>*SgNd%Z

b<3iL|%8C*7t4{PmZnxpJ}Z9PFOkp z6d-M>3?ybC#H@Fsd*6g{XG7!x_5?Up`T%S+vi0*kyz#C5)@gITwHRF{ALk(RI?yDp zkBC+Nj@&9`9U99xXO&4>ZsH(?Bn+g5(%bdFee!5O5?SkN^O> z_bvEN$L#rzcYwDVFd@wDCI*+knO2S^7rH0IR|QoD962VUOLW*|#e=mePL%&3pneS7Q1e=jUi_aXKLa04=yJ+g!AsV!b!oyPDV2_p{~N$d{lk3$@vc*0xZnU_*%@AoY*cQ(Z-^-o| zbVUWLCqQbi)EFcRKo~%pY5Y(YP^FhMiMgM*=d!okn774|3Xse}!2sd%3IYnl{ddv_ zvm~i;eJkU7{uqy%kI>EIEVf$%Y4!{b0Q}({2%`~1Q6MN`RDuAJ_fQ`{L%!T5^urKK zpC|rt#p3;d7x(m~W1x?6+0xmDk}HhknnHyl#GwFyTr z39-8)g4`gr0v!nR8=z!_AWaZPN(5X)E=Zb2lNq;KyO!wVfP8J;<9s_uwiLrq565+g z{^tg$ZZX?>hcZ6HDrs_fK$N@j{x#RaZqZS7K(-`E=Ti_97=9{s)Fyz$owz|_4rA(h z?&rl21A@Vrws``ily{R%CA5QTDX2qGy6M-FEp@fFFnE6p>R_ zY&@Vuw(3z-4lt5q`qH=T&yOMhw$yXynO;0U;=lUB7)iC^6s-vEw1I?J?G7NgM@93q z)+bB-3kOeyl7(ynqLKn41BsyY9&{wh6A!u*KR}p)AsjgdO<6Dl6V2Mbl<-qH(%%Nc zrGNqy=1@%_Or6@kl$@wME1No`<38{;j*t^-X&LKMv42Vk(@5dOEnGR=qJQzf{U;Bq zCqZbhNdECD4M&Xj_Sjd`>mt`9Wcnd?wFe1lkJVs&u$lE_-*sdgkad7m3iv)Cnjonr zFd%p~a53}KY%{Mzcs4`$!!u--^XI{J4w!{4y#r%V`UIi|$WngaJ)9Tv8C4CI8tkv!u%|4zSI@I>6GcS3VkY} zLz$*N)<#!Ix*AlHlFD`%t_7!#k9Xag5=^27hzfzE1KV{FMIbSSLFA?|1eKcmDVRG( z0P#J`hvz`RATB)}!I&;Vw)vzVlx-0aWR(#NS&wdokHm6;*##-l_$><4%bwK%$#xxb zvBws`K8&iSeenJm*VhSe{EQhw^a}I$zv^9$jTB4}aRt^kBB`3*=N-0onW0x;(k`h{ z#oD1Rwu@#|0b~qNK$E};48U$3pp{u^E@m@gl78=`Tl$#Va2_{A>6s@W;HOZC4B$5> z{g4!s_#|Qr6*9)VMa>-_?I^8pk*`&psh(nA?UJh`9AJ|Qe+bVGtUVVC$}ct`fAc!= z*Wu}bt6qJiD#bThVqzH)GXCio_o#0wLZl5QaX{=m;Hu2(Og7YKG4^$80V2W_#^eQQ z3dJ*sI{;N?Fyw4j%wosK0AcV93MMe-*##~GyFCCSK+!B%J5T_K5by)jC{pxf6dACN zg~z)0&agEDwz46#3gMAJ_yovPChZU`l`wwn?-xU8cC09mJbRE${#>YKNbHdzQ{VNu zeOEvvurf~)vmlut6Cpqvw~H>4M7sRDZ=oy;O(_L=TB#~mSs=k38OdeucopOqopp7h84N|h492`Xr}=(`G5`k5 z3SbQ)HSL<@?Ldop!8&^dh6Bif*#K-ouwa@U6^J{1k+`cr%@ejoo@~Vn_HB55NqBjk ze7wmj=wsCI2&!^F%PcJ$zf!{Z*epXdIk9HE_yrQXpde__WH3B-sCvVN4Ls#FQd!+o z)^WM(2+Bbc0AU^*?u`+IyV@Q^1wa;r`L%g%GS4(T3!-<`AMms1&$1HDo-byisYn4r zF!D4TLl#?5*l@&~Qpi1vWTdMoa1MTzz@K<8Lz83tA9;MfQ@F36EQ+T?T}cGP6xz#t z2goZznuy?pGlzkJu$uQ3fYFM z^Z?ZtLg%ou(A6S^GyiXAs#J>q)gH^WL#hWnKpC;8?On2tu1e9)Uj`7isS9 zG(Wt7!(Gtk>3Duq_$d_P`M_t!cS`+v5qF=M%mfZAl{T5?Ik>n3TRG)8+@QlVTPXCF zxDgDC@1jtG3lEnOd}ifA5xfFJzyFF?w?7uY{+==e8xi@6KITJ9#yiYiQIHZ znjTZW44E!NWs6Z|x0g{4c)mL#Vs1a{Jc>xp;zuwq@n`pVT7id5r+HfnUW6F5AxBG)#VL~c^PaK776gBH+0FNIVV_Sb)Jk(8rc^#tF$2zb0l@9Pn5Qt_Hvi~!FQ zaVfAbC8iIY9~`3sPy{*>!U-He0W9yT-Q6^;mSWPgSDdDBFzx{0SwG(2ZnFWPrPV=v z0zMkT2iCbTBNvQ`P#~*D_RMOoMmC4PVV-^tmd=7d5<_@;NggRp5h#U-JVL1<*#V9w zNF>R^pin6}JwhQyQ7DE~OA?&Lc(5%S#oAW{<5t3GYslD2{7N7>Pj#a9OcNxyTs};`N}4|N>F8E#r{}E1NKoO8IS}7p5R!)rDK@Lz$o0=aJq@+ z{lEJepbCm_L^^J`&^cOSr&a`8&BzS28Bmy++N$X9Unf=xlWa05@bK1wO0ko(iZuXp z0OANV145_(2xoIj6J%DD*?mjH#AX0aXjNs5Rm zc#Lh_E8$#((HD@0xAMy?J`P=`^w8q)hQV)cdZM3`c8?Mce%KIbkwRA0Hmqqi6itCV zKrl$Tv2y~HhMWaeDx$4M9pl}4zU)SM8BrJ_bYN3T%|&1@L98cGfN%nX5l;Y3myVnz z41aqjFvP4tv+%3|p2iw>Gy&j^1J9Lt*dd@h!ObwNjxmk{VtIf{@&R`b5<=xPvc_U{ z+&%D0pcbMqsormmof%>8bC{m#fc=1vPqUd21_vm0@#5uo4`tThH zepIXQ;nsuUo5Q!v^Q!Nah&@O-_)?G#LIcn0uH1`ee^P(e0ke4sv@fi z>MwVZbt|M@A6t)S%*QR!AM<_AL%syO7Dz9~+O7VirmXC7*67miazaV{qC@hkP)R^S zuEJH1lRCHtk>{PoxH@R&x6EOFf?_7p7MOi@@XCPn5hMmnnhcDD26I^Y7&L*R0nn`W z$YzgMqW1Mer1>^`2HAoSIsS3c_ape)NLiuxNNzP3eb+2yX1ccUH(FX5IgQ)L^4` zG936kd^o)}d}ed0!lIF1(}-x8H3#bY>zaAH>J-9aN|B)a!{%d zpB3;&Fm@SfqDIX#tq+=wW(!3oNRQW{F`#(+(4}oF2NmN{4%`K&eNk)k!Tu#whGUAp z=>ZhD*Z8hV6(4K-#up_rQ)Q{FAKkhsg;C(;7KjW~|B4rVDNW;1VVfs=r?RViLIk55 zgA>@YfwB&0CSbn}IG$t(7z>IDupWcd5RefF1ZD%c@eIZxd|oQsD=+Q9k4pY|1~-~4 z6J&)tsGq97-d@I=u&TrP(sMA`bqYow7|w^TIWVfdHJ0BUTKDwYh867EqltYf;5(*#Kl+K*kY7REG#_AXNd$01#rj({%;B9fR{Be5uJ2Nf>4TWSPoj zQ@+)EFnl$RI#pt|4&Z$tGEDBLly)Crt5-?#%aAxv*WT{aKi^?|$oOV0fV3LzEJp}S z^veQa0DpN}!acmkg?!HI!Ff{RX|C?|P`PzMjy1DYCm6otkp;tD`Qq;7(J~KhFABX> z@hrJS1kw^vv%_ca!G2b36@X6xGX}C;I@ML1i>JH8xRL!&lIDHbIymdD67f5bdJ`PS zB**V@-du*2O$KfXVXxpzKS=3kjRDi@j|lwB0eSr?f&S_mNUS*CdxwR7QndDZ6z{&z zecGeE{s3fFAvF%Xk3IwKpYU06b6kucKDZ{A%z-=MlAd!`I|~zF~)_kLh51lObcWl@_#a zkWara168ZFXk1g>6V}>mws4WjeLGG6Z#CD}BFAxszf)b+mzkc~*_*VhMG20Lk)3;N z2SKjnA;!VrK#1{U@=x-ZH|ICRF9wqkgo6_$;DAFg39%9)Yop6*rPa)ic4u~Hdiq-3 zRdu`!$Yx}t6dX>Uugj#VTx1%S%10SRii1!Ize^;Q-I2D#khWl< zy5Pg#I!P~5wW>IrOc6|XP{kv*eoQ*MOJOe+LM@`vLyBYu>o1sUu`BQ3;9>POg#QEl z!Ar!oI>Q#82(o=Bv+OztYl5mNCiyPR`N%ezB+vRRN+DGD2dwfA<@OqSvuCLYE%L>u z;Tf>yHk0U*Ot%0QmYIdH8ZPX>sR#-y@bx{B#W_0_ATn*B{5`jDfey}f3B_*^XQO5k zHmY9xJOX`ytq)+|ZHLa#94@=)uoeBZLmiX@3oan7bINH7aGlB_X2$5Gse`xDT zfTe!q;{GlycA)QD9EB(xXJqn3h{Z+t#$%0lt?5i{tj8`}1B0%@wh!Rcb(nC6IoJXF z+a9T#?Bp%DU<=mYhVw_@UJ4h2LeZ3r^7a#7EE{%hhB|Pi-+S z!r{ubT7;tp-dW|sW`oK83spU!g(N4>4M{I(Ah-jL_Q35CvD$A0?;T|{gCXQG}5>9NCT;^V}0ke7Q$yeW6Eg#dZwnFG443MLUOhel%YXeAp_gwUEDm^I-0<=? zyDx1ky8cYTf^HMqHNbaaTM=ZF3W^Ks>Vj&?!goiAEtsdoh~V3lRa7z4E}3BJLc7X& zH&jc5O(*=GkT)IgB@cN%M|K*zw8&LdKr>2YVHvIMrgzo|L<$VDA?vW63yyrRx zp*J(1s(I^~F1L#oqSgU8^WQdb3tn59(fBPvO zfL^?9=~Bw4LZ;fZ$FcJd%V;4R6JZXku`F+Vm65w!uq-LW3@+ACG$AbuVWh?@n;M-P z8jG%ip&aR&CSV4K#%qlx2pI5fBYR7g3-r`ACI$epHW}E~6zC4)Q>WWyhVaki(v#T; zozww9nnD;W1avn?L^;BOQ670AJwT=C*#b}C@U-x$mfzI6-{Tqfnx)b z23J4FbujMRz%4KUqQapyz3o=|%coJu>|r5EX}$QkDvW$c)dV$6lc81&ZW+Wnx5^2l zni3gUyHY>+ri_=3gV$&bh6GWST%%Ohdh@Q3%uCD_GrI@u7s#)#d-I2i!^#H9q~3Wl zI!!`m0B{h_94nD6A~{^ikxeuD(K|pV(MUWC67ZzZke0dFGsmW;&({W}V~}Y$^ztee z66;lsU*Few#*!bgah*xh_TxDr)CGhqQ?Ii}I4xkF+i_n3vJE=?;TP#+->)!V+bcim z@|D*-esftcpS%~p_Z8y1=ayaO_dba&&96`Pf`F?)9lP%kf_ZMI6Fh_96#j{^|GW}0 z{{s9!NVem+Rb?Xn#CPn^65a`9(y1jx>-h`QiOF93v3$rq= page.height - 20) { + y = 0; + } + } + } + + // Place bats to the left and right of the view, following the y + // coordinates of the ball. + Rectangle { + id: leftBat + color: "Lime" + x: 2; width: 20; height: 90 + // ![0] + y: ball.direction == 'left' ? ball.y - 45 : page.height/2 -45; + Behavior on y { SpringAnimation{ velocity: 300 } } + // ![0] + } + Rectangle { + id: rightBat + color: "Lime" + x: page.width - 22; width: 20; height: 90 + y: ball.direction == 'right' ? ball.y - 45 : page.height/2 -45; + Behavior on y { SpringAnimation{ velocity: 300 } } + } + + // The rest, to make it look realistic, if neither ever scores... + Rectangle { color: "Lime"; x: page.width/2-80; y: 0; width: 40; height: 60 } + Rectangle { color: "Black"; x: page.width/2-70; y: 10; width: 20; height: 40 } + Rectangle { color: "Lime"; x: page.width/2+40; y: 0; width: 40; height: 60 } + Rectangle { color: "Black"; x: page.width/2+50; y: 10; width: 20; height: 40 } + Repeater { + model: page.height / 20 + Rectangle { color: "Lime"; x: page.width/2-5; y: index * 20; width: 10; height: 10 } + } +} diff --git a/examples/quick/animation/behaviors/wigglytext.qml b/examples/quick/animation/behaviors/wigglytext.qml new file mode 100644 index 0000000..72f4872 --- /dev/null +++ b/examples/quick/animation/behaviors/wigglytext.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: container + + property string text: "Drag me!" + property bool animated: true + + width: 320; height: 480; color: "#474747"; focus: true + + Keys.onPressed: { + if (event.key == Qt.Key_Delete || event.key == Qt.Key_Backspace) + container.remove() + else if (event.text != "") { + container.append(event.text) + } + } + + function append(text) { + container.animated = false + var lastLetter = container.children[container.children.length - 1] + var newLetter = letterComponent.createObject(container) + newLetter.text = text + newLetter.follow = lastLetter + container.animated = true + } + + function remove() { + if (container.children.length) + container.children[container.children.length - 1].destroy() + } + + function doLayout() { + var follow = null + for (var i = 0; i < container.text.length; ++i) { + var newLetter = letterComponent.createObject(container) + newLetter.text = container.text[i] + newLetter.follow = follow + follow = newLetter + } + } + + Component { + id: letterComponent + Text { + id: letter + property variant follow + +//! [0] + x: follow ? follow.x + follow.width : container.width / 6 + y: follow ? follow.y : container.height / 2 +//! [0] + + font.pixelSize: 40; font.bold: true + color: "#999999"; styleColor: "#222222"; style: Text.Raised + + MouseArea { + anchors.fill: parent + drag.target: letter; drag.axis: Drag.XAndYAxis + onPressed: letter.color = "#dddddd" + onReleased: letter.color = "#999999" + } + +//! [1] + Behavior on x { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } } + Behavior on y { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } } +//! [1] + } + } + + Component.onCompleted: doLayout() +} diff --git a/examples/quick/animation/easing/easing.qml b/examples/quick/animation/easing/easing.qml new file mode 100644 index 0000000..23c6b0e --- /dev/null +++ b/examples/quick/animation/easing/easing.qml @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: window + width: 320; height: 480; color: "#232323" + + property var easingCurve: [ 0.2, 0.2, 0.13, 0.65, 0.2, 0.8, + 0.624, 0.98, 0.93, 0.95, 1, 1 ] + + ListModel { + id: easingTypes + ListElement { name: "Easing.Linear"; type: Easing.Linear; ballColor: "DarkRed" } + ListElement { name: "Easing.InQuad"; type: Easing.InQuad; ballColor: "IndianRed" } + ListElement { name: "Easing.OutQuad"; type: Easing.OutQuad; ballColor: "Salmon" } + ListElement { name: "Easing.InOutQuad"; type: Easing.InOutQuad; ballColor: "Tomato" } + ListElement { name: "Easing.OutInQuad"; type: Easing.OutInQuad; ballColor: "DarkOrange" } + ListElement { name: "Easing.InCubic"; type: Easing.InCubic; ballColor: "Gold" } + ListElement { name: "Easing.OutCubic"; type: Easing.OutCubic; ballColor: "Yellow" } + ListElement { name: "Easing.InOutCubic"; type: Easing.InOutCubic; ballColor: "PeachPuff" } + ListElement { name: "Easing.OutInCubic"; type: Easing.OutInCubic; ballColor: "Thistle" } + ListElement { name: "Easing.InQuart"; type: Easing.InQuart; ballColor: "Orchid" } + ListElement { name: "Easing.OutQuart"; type: Easing.OutQuart; ballColor: "Purple" } + ListElement { name: "Easing.InOutQuart"; type: Easing.InOutQuart; ballColor: "SlateBlue" } + ListElement { name: "Easing.OutInQuart"; type: Easing.OutInQuart; ballColor: "Chartreuse" } + ListElement { name: "Easing.InQuint"; type: Easing.InQuint; ballColor: "LimeGreen" } + ListElement { name: "Easing.OutQuint"; type: Easing.OutQuint; ballColor: "SeaGreen" } + ListElement { name: "Easing.InOutQuint"; type: Easing.InOutQuint; ballColor: "DarkGreen" } + ListElement { name: "Easing.OutInQuint"; type: Easing.OutInQuint; ballColor: "Olive" } + ListElement { name: "Easing.InSine"; type: Easing.InSine; ballColor: "DarkSeaGreen" } + ListElement { name: "Easing.OutSine"; type: Easing.OutSine; ballColor: "Teal" } + ListElement { name: "Easing.InOutSine"; type: Easing.InOutSine; ballColor: "Turquoise" } + ListElement { name: "Easing.OutInSine"; type: Easing.OutInSine; ballColor: "SteelBlue" } + ListElement { name: "Easing.InExpo"; type: Easing.InExpo; ballColor: "SkyBlue" } + ListElement { name: "Easing.OutExpo"; type: Easing.OutExpo; ballColor: "RoyalBlue" } + ListElement { name: "Easing.InOutExpo"; type: Easing.InOutExpo; ballColor: "MediumBlue" } + ListElement { name: "Easing.OutInExpo"; type: Easing.OutInExpo; ballColor: "MidnightBlue" } + ListElement { name: "Easing.InCirc"; type: Easing.InCirc; ballColor: "CornSilk" } + ListElement { name: "Easing.OutCirc"; type: Easing.OutCirc; ballColor: "Bisque" } + ListElement { name: "Easing.InOutCirc"; type: Easing.InOutCirc; ballColor: "RosyBrown" } + ListElement { name: "Easing.OutInCirc"; type: Easing.OutInCirc; ballColor: "SandyBrown" } + ListElement { name: "Easing.InElastic"; type: Easing.InElastic; ballColor: "DarkGoldenRod" } + ListElement { name: "Easing.OutElastic"; type: Easing.OutElastic; ballColor: "Chocolate" } + ListElement { name: "Easing.InOutElastic"; type: Easing.InOutElastic; ballColor: "SaddleBrown" } + ListElement { name: "Easing.OutInElastic"; type: Easing.OutInElastic; ballColor: "Brown" } + ListElement { name: "Easing.InBack"; type: Easing.InBack; ballColor: "Maroon" } + ListElement { name: "Easing.OutBack"; type: Easing.OutBack; ballColor: "LavenderBlush" } + ListElement { name: "Easing.InOutBack"; type: Easing.InOutBack; ballColor: "MistyRose" } + ListElement { name: "Easing.OutInBack"; type: Easing.OutInBack; ballColor: "Gainsboro" } + ListElement { name: "Easing.OutBounce"; type: Easing.OutBounce; ballColor: "Silver" } + ListElement { name: "Easing.InBounce"; type: Easing.InBounce; ballColor: "DimGray" } + ListElement { name: "Easing.InOutBounce"; type: Easing.InOutBounce; ballColor: "SlateGray" } + ListElement { name: "Easing.OutInBounce"; type: Easing.OutInBounce; ballColor: "DarkSlateGray" } + ListElement { name: "Easing.Bezier"; type: Easing.Bezier; ballColor: "Chartreuse"; } + } + + Component { + id: delegate + + Item { + height: 56; width: window.width + + Text { text: name; anchors.centerIn: parent; color: "White" } + + Rectangle { + id: slot1; color: "#121212"; x: 30; height: 46; width: 46 + border.color: "#343434"; border.width: 1; radius: 12; antialiasing: true + anchors.verticalCenter: parent.verticalCenter + } + + Rectangle { + id: slot2; color: "#121212"; x: window.width - 76; height: 46; width: 46 + border.color: "#343434"; border.width: 1; radius: 12; antialiasing: true + anchors.verticalCenter: parent.verticalCenter + } + + Rectangle { + id: rect; x: 30; color: "#454545" + border.color: "White"; border.width: 2 + height: 46; width: 46; radius: 12; antialiasing: true + anchors.verticalCenter: parent.verticalCenter + + MouseArea { + onClicked: if (rect.state == '') rect.state = "right"; else rect.state = '' + anchors.fill: parent + anchors.margins: -5 // Make MouseArea bigger than the rectangle, itself + } + + states : State { + name: "right" + PropertyChanges { target: rect; x: window.width - 76; color: ballColor } + } + + transitions: Transition { + NumberAnimation { properties: "x"; easing.type: type; easing.bezierCurve: getBezierCurve(name); duration: 1000 } + ColorAnimation { properties: "color"; easing.type: type; easing.bezierCurve: getBezierCurve(name); duration: 1000 } + } + } + } + } + + Flickable { + anchors.fill: parent + contentHeight: layout.height + Column { + id: layout + Repeater { model: easingTypes; delegate: delegate } + } + } + + function getBezierCurve(name) + { + if (name === "Easing.Bezier") + return easingCurve; + return []; + } +} diff --git a/examples/quick/animation/pathanimation/pathanimation.qml b/examples/quick/animation/pathanimation/pathanimation.qml new file mode 100644 index 0000000..979d8f6 --- /dev/null +++ b/examples/quick/animation/pathanimation/pathanimation.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: window + width: 320 + height: 480 + + Canvas { + id: canvas + anchors.fill: parent + antialiasing: true + + onPaint: { + var context = canvas.getContext("2d") + context.clearRect(0, 0, width, height) + context.strokeStyle = "black" + context.path = pathAnim.path + context.stroke() + } + } + + SequentialAnimation { + running: true + loops: -1 + + PauseAnimation { duration: 1000 } + //! [0] + PathAnimation { + id: pathAnim + + duration: 2000 + easing.type: Easing.InQuad + + target: box + orientation: PathAnimation.RightFirst + anchorPoint: Qt.point(box.width/2, box.height/2) + path: Path { + startX: 50; startY: 50 + + PathCubic { + x: window.width - 50 + y: window.height - 50 + + control1X: x; control1Y: 50 + control2X: 50; control2Y: y + } + + onChanged: canvas.requestPaint() + } + } + //! [0] + } + + Rectangle { + id: box + + x: 25; y: 25 + width: 50; height: 50 + border.width: 1 + antialiasing: true + + Text { + anchors.centerIn: parent + text: "Box" + } + } +} diff --git a/examples/quick/animation/pathinterpolator/pathinterpolator.qml b/examples/quick/animation/pathinterpolator/pathinterpolator.qml new file mode 100644 index 0000000..723dc34 --- /dev/null +++ b/examples/quick/animation/pathinterpolator/pathinterpolator.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: window + width: 320 + height: 480 + + Canvas { + id: canvas + anchors.fill: parent + antialiasing: true + + onPaint: { + var context = canvas.getContext("2d") + context.clearRect(0, 0, width, height) + context.strokeStyle = "black" + context.path = motionPath.path + context.stroke() + } + } + + //! [0] + PathInterpolator { + id: motionPath + + path: Path { + startX: 50; startY: 50 + + PathCubic { + x: window.width - 50 + y: window.height - 50 + + control1X: x; control1Y: 50 + control2X: 50; control2Y: y + } + + onChanged: canvas.requestPaint() + } + + SequentialAnimation on progress { + running: true + loops: -1 + PauseAnimation { duration: 1000 } + NumberAnimation { + id: progressAnim + running: false + from: 0; to: 1 + duration: 2000 + easing.type: Easing.InQuad + } + } + } + //! [0] + + Rectangle { + id: box + + width: 50; height: 50 + border.width: 1 + antialiasing: true + + //bind our attributes to follow the path as progress changes + x: motionPath.x + y: motionPath.y + rotation: motionPath.angle + transform: Translate { x: -box.width/2; y: -box.height/2 } + + Text { + anchors.centerIn: parent + text: "Box" + } + } +} diff --git a/examples/quick/animation/states/qt-logo.png b/examples/quick/animation/states/qt-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..14ddf2a0289e64c686b34712b8754bc4baac2726 GIT binary patch literal 5149 zcmXX~3p~^78^_ooKetr2QZ7;CHd{%^P$?%wB#sWlE=Q-dlhP`g>rmu!N<$&1)9p}{ zB4Nu$ZdoUtI47Bj@}o*F=KPcmj>6qGCAev)eP6c0F1K!*~v#PA@JlX2R~Y=}_`S*&(e=hq9+< z#S_)cTQm5iz-KI3k1<}Nki###+S zwV$Fid8zK0>jZVsn`K$XxPUOD>b?u%sW1HVfK@b ziIKy5`gw;a@31}oNCrIzg5YA5awwM-jq^`1=rD`{16zZs#Zn)M5W)f&@(IW5IMZEQ1l#uUU8qMk{bN zm`B)}$5eQXVw7aoV|g|*2Y9jS;mB#N4H=V_ZrC#!J1onnH775$jo*Z+`_Zst^tAq> z5623dSF~bQd9xhW(BB}<(%L=Sex`o8`TcTbyV@*M3$aU9c*L-=uCY^n zcLLp|EaQJ8nUDV3A7pZy#!@HeBPhNViWT>`^gLqaZj0=FYj1AB*kbIf8VZCm3peuE zOe3|_DR?p=qWbF)JZptva^>er@4s6)e`4<(jXs_w-TAgH!KElIQBRIIO0IOR`g7Xj}I2X2NKW&`d(CzV`n=DisAGZCefL+t9JgcksQzk!9P&6ks?-xhC z%5s~HtHRBWTKH+H-rw#o`~~yKPCZc8;$9`3!iyJIHUAeN;)tPAvA9I(LZ;wb=S%3| zk^eyvo7|!H`wXa3%^bi5L6J!p2(-D04V)+ao6!$iTwaL2i#H?VLfo%krVxpQ8=M}DS(QP-)I5HSm1PD`P@nu1y#{)) zAA>(mUoMZVC(R<~1Cz@RWmF+|$;FM6E9Fg=tTcR#AJ$qD;*z=4dpa*8OK9$$CF z&S@#CoVRAWtseRwf8%k_PwOC6b%RoOZws}!y)xHSpiYb9sy0Be`kIiB6sc-tL|mVNd@DM`VG^O2|u@?V!th35wGiX3Pq#)MyMYi5BO$39eek| zvFw^{zm0F}hv~P4l$5}Sm2+#0X*;=NGU9-VO5)U34v`7Thi4Y^+uV2rHY0t{wJ|}f zr*qM=>YZpMg)?v3VM2*W!nLnx$ULMKYRjHiVr2t(YhCK8cIq|J|+ajr$0pa;SlOgl$} zbYzsH6B7A}4&8ZhBSy3}K4Tn#1j8>7$2gO>fDUe}LvJ1X2c=L*wNE=+tg$0Cqiu<9 zi}94vTX?T)9Mm|+m$JLnWCR4tWTMeSEcq+8D6iNva?hm{ z9mx2VQTh+K^nuj=ko#lkXOmg00oN_%QFDmYBYNJjo zEE#tmmUDKkMJifp|LetDo< zD_f;=ow2bkB*fEGC+GEaeEbvq8Ch0#jJLf+q+zTPgA=qJ3#3cAz=VTGlD)}{sqIGC zFOAKqp6TI*s`rG+YD*y`UiAZni`rd2zbh+1%nIL}IvbAMhXLCol$S|4wbXP;M}*j{&P(QqZLmt_RV(B zE~b0>H9+SWXjf$YgVHt_K3u&D`XovFnp!qd5eF=@a45Aa^+e5Hv@zvPq@ zRqJmkGhKLo)&T(oH%*RasfEwY&`!Q{g{s3)g~ zc;~leM<%J>-bezj*g-g@!0E4=N55EK}Q&P8ryf-aZK6vtsZg?f4hy3a4IVSZ!`1}sXV5CQ^5 zD9-0UVmW^t&b#@u(?00}AAo+n$_@I_%LQU75cE!m@mO{-&rOW z_nqLhOAgF^Z^OXIq|$3C#Zx96-U(mm&SiIk=II%7!0&-k5;5S*jTUgU4?Hvftw_J+nj86=!{yLRo+$$M!wr}jQ71?DpOpIwwmTL)4i$ z+wMRu!F*KnazR0gK+J=ol~`No-B&DhHRwIccUvy%*l9a-5@MvidY0X7~~=A zL*Tv7TFr+AqnYS1l)F6fC1(7X9ccep;9znFQxq>vE!umA*IISIuDxICc_j3T8F#2W zr5MzZQiYe(fuxiOTsZfD=o?Br-_GvpVZ1r0zUWZ&=ybl6*U`ZiO^(x%VS5sg^&W!= zDGXXaDiwpf?lMy(_%zRg_Ww%8(ZXE3x=#PHRw0H>I53=F_=8iKWc1^4#>Aa2R9RAE zH@mY7VIq^kzWISE<#-tEag8Hr2yvim1i!sDYuD)c!OK+g z>r8qlD>$;~MU@V-h9P7X=@A^{=<) z?c9P!qXW+Eq`k+0rgS+KfAv<2`x_6s?;JYn?KX9EuW@r1bz*2Wa;N3`j%0(n1f92C zF=G&JFUsUYOPk^%EZz6v;~&Fw)Kfs#GBtX9|QY z7Pv9VPqH<#;T!$tU;DE12)6zeaqwD6_qnQ6s1Bwq*IG)|Imv;mTGV~B3wRFC1e_e$ zN3wAuDb1l@B8DAi0rDt1EPW*z=bM0w6VqQK226EjTi9lB=#}tKPc0s{p7x1o`>U{N z#r8c7w>F4=(`+UKq(E!NR+7ag5wF0!D@P5JS#C2dvQ#gqF#>`gFrNw)2n=drmR5N~YR zwt=C3(#*H1_^<@>SC*0}V$QgIq~B_@w~Ey_NY%%MMd^;NxnSO97ayK_SkMS=SGIxM zl~VJ;H{$sn=@EjH!=P7W!kieBMpR0{G~TetEPUDYzkRG1_P6Zg`r2%+oeE?AsqjJu zfh!$H^AJ_J9L}8PMRu$J$$HbQgWJn~)h_<|$}ZiNscskhEzYif=p*Xl>yH&Z+N9ySX6ArZnx{E2fbaytHcOt#{$I9(^MZ&*WXYa54{u6w#kOvYQ zRy=@e2tA7jl47TUpr~czi$AEl3J(iPobzOUfpPbKkbP;TtU k$RPHf;lDR%sY}KXDsCH$Zlgx;mMQ=H?D60Iz>ARjf1dU2GXMYp literal 0 HcmV?d00001 diff --git a/examples/quick/animation/states/states.qml b/examples/quick/animation/states/states.qml new file mode 100644 index 0000000..26acaf7 --- /dev/null +++ b/examples/quick/animation/states/states.qml @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + id: page + width: 640; height: 480 + color: "#343434" + + Image { + id: userIcon + x: topLeftRect.x; y: topLeftRect.y + source: "qt-logo.png" + } + + Rectangle { + id: topLeftRect + + anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to the default state, returning the image to + // its initial position + MouseArea { anchors.fill: parent; onClicked: page.state = '' } + } + + Rectangle { + id: middleRightRect + + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'middleRight' + MouseArea { anchors.fill: parent; onClicked: page.state = 'middleRight' } + } + + Rectangle { + id: bottomLeftRect + + anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'bottomLeft' + MouseArea { anchors.fill: parent; onClicked: page.state = 'bottomLeft' } + } + + states: [ + // ![0] + // In state 'middleRight', move the image to middleRightRect + State { + name: "middleRight" + PropertyChanges { target: userIcon; x: middleRightRect.x; y: middleRightRect.y } + }, + + // In state 'bottomLeft', move the image to bottomLeftRect + State { + name: "bottomLeft" + PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y } + } + // ![0] + ] +} diff --git a/examples/quick/animation/states/transitions.qml b/examples/quick/animation/states/transitions.qml new file mode 100644 index 0000000..8216182 --- /dev/null +++ b/examples/quick/animation/states/transitions.qml @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +/* + This is exactly the same as states.qml, except that we have appended + a set of transitions to apply animations when the item changes + between each state. +*/ + +Rectangle { + id: page + width: 640; height: 480 + color: "#343434" + + Image { + id: userIcon + x: topLeftRect.x; y: topLeftRect.y + source: "qt-logo.png" + } + + Rectangle { + id: topLeftRect + + anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to the default state, returning the image to + // its initial position + MouseArea { anchors.fill: parent; onClicked: page.state = '' } + } + + Rectangle { + id: middleRightRect + + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'middleRight' + MouseArea { anchors.fill: parent; onClicked: page.state = 'middleRight' } + } + + Rectangle { + id: bottomLeftRect + + anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 } + width: 46; height: 54 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'bottomLeft' + MouseArea { anchors.fill: parent; onClicked: page.state = 'bottomLeft' } + } + + states: [ + // In state 'middleRight', move the image to middleRightRect + State { + name: "middleRight" + PropertyChanges { target: userIcon; x: middleRightRect.x; y: middleRightRect.y } + }, + + // In state 'bottomLeft', move the image to bottomLeftRect + State { + name: "bottomLeft" + PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y } + } + ] + + // ![0] + // Transitions define how the properties change when the item moves between each state + transitions: [ + + // When transitioning to 'middleRight' move x,y over a duration of 1 second, + // with OutBounce easing function. + Transition { + from: "*"; to: "middleRight" + NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce; duration: 1000 } + }, + + // When transitioning to 'bottomLeft' move x,y over a duration of 2 seconds, + // with InOutQuad easing function. + Transition { + from: "*"; to: "bottomLeft" + NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad; duration: 2000 } + }, + + // For any other state changes move x,y linearly over duration of 200ms. + Transition { + NumberAnimation { properties: "x,y"; duration: 200 } + } + // ![0] + ] +} diff --git a/examples/quick/canvas/bezierCurve/bezierCurve.qml b/examples/quick/canvas/bezierCurve/bezierCurve.qml new file mode 100644 index 0000000..386d1d7 --- /dev/null +++ b/examples/quick/canvas/bezierCurve/bezierCurve.qml @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../contents" +Item { + id:container + width:320 + height:480 + + Column { + spacing:5 + anchors.fill:parent + Text { font.pointSize:15; text:"Bezier Curve"; anchors.horizontalCenter:parent.horizontalCenter} + + Canvas { + id:canvas + width:320 + height:280 + property string strokeStyle:"red" + property string fillStyle:"red" + property int lineWidth:lineWidthCtrl.value + property bool fill:true + property bool stroke:true + property real alpha:alphaCtrl.value + property real scaleX : scaleXCtrl.value + property real scaleY : scaleYCtrl.value + property real rotate : rotateCtrl.value + antialiasing: true + + Behavior on scaleX { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite } } + Behavior on scaleY { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} } + Behavior on rotate { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} } + + onLineWidthChanged:requestPaint(); + onFillChanged:requestPaint(); + onStrokeChanged:requestPaint(); + onAlphaChanged:requestPaint(); + onScaleXChanged:requestPaint(); + onScaleYChanged:requestPaint(); + onRotateChanged:requestPaint(); + + onPaint: { + var ctx = canvas.getContext('2d'); + ctx.save(); + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.globalAlpha = canvas.alpha; + ctx.strokeStyle = canvas.strokeStyle; + ctx.fillStyle = canvas.fillStyle; + ctx.lineWidth = canvas.lineWidth; + ctx.scale(canvas.scaleX, canvas.scaleY); + ctx.rotate(canvas.rotate); + //! [0] + ctx.beginPath(); + ctx.moveTo(75,40); + ctx.bezierCurveTo(75,37,70,25,50,25); + ctx.bezierCurveTo(20,25,20,62.5,20,62.5); + ctx.bezierCurveTo(20,80,40,102,75,120); + ctx.bezierCurveTo(110,102,130,80,130,62.5); + ctx.bezierCurveTo(130,62.5,130,25,100,25); + ctx.bezierCurveTo(85,25,75,37,75,40); + ctx.closePath(); + //! [0] + if (canvas.fill) + ctx.fill(); + if (canvas.stroke) + ctx.stroke(); + ctx.restore(); + } + } + + Rectangle { + id:controls + width:320 + height:150 + Column { + spacing:3 + Slider {id:lineWidthCtrl; width:300; height:20; min:1; max:10; init:2; name:"Line width"} + Slider {id:scaleXCtrl; width:300; height:20; min:0.1; max:10; init:1; name:"ScaleX"} + Slider {id:scaleYCtrl; width:300; height:20; min:0.1; max:10; init:1; name:"ScaleY"} + Slider {id:rotateCtrl; width:300; height:20; min:0; max:Math.PI*2; init:0; name:"Rotate"} + Slider {id:alphaCtrl; width:300; height:20; min:0; max:1; init:1; name:"Alpha"} + } + } + } +} diff --git a/examples/quick/canvas/canvas.py b/examples/quick/canvas/canvas.py new file mode 100644 index 0000000..cbdf1c6 --- /dev/null +++ b/examples/quick/canvas/canvas.py @@ -0,0 +1,60 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +## of its contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import os +import sys + +from PyQt6.QtCore import QUrl +from PyQt6.QtGui import QGuiApplication +from PyQt6.QtQuick import QQuickView + + +os.chdir(os.path.dirname(os.path.abspath(__file__))) + +app = QGuiApplication(sys.argv) + +view = QQuickView() +view.engine().quit.connect(app.quit) + +view.setSource(QUrl.fromLocalFile('canvas.qml')) +view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) +view.show() + +sys.exit(app.exec()) diff --git a/examples/quick/canvas/canvas.qml b/examples/quick/canvas/canvas.qml new file mode 100644 index 0000000..ffa9a2c --- /dev/null +++ b/examples/quick/canvas/canvas.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../shared" as Examples + +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("Red heart", "Draws a red heart with bezier curves", Qt.resolvedUrl("bezierCurve/bezierCurve.qml")); + addExample("Talk bubble", "Draws a talk bubble with quadratic curves", Qt.resolvedUrl("quadraticCurveTo/quadraticCurveTo.qml")); + addExample("Squircle", "Draws a smooth squircle with simple lines", Qt.resolvedUrl("squircle/squircle.qml")); + addExample("Rounded rectangle", "Draws a rounded rectangle with lines and arcs", Qt.resolvedUrl("roundedrect/roundedrect.qml")); + addExample("Smile face", "Draws a smile face with complex paths", Qt.resolvedUrl("smile/smile.qml")); + addExample("Clip", "Shows the canvas clip feature", Qt.resolvedUrl("clip/clip.qml")); + addExample("Tiger", "Draw a tiger with a collection of SVG paths", Qt.resolvedUrl("tiger/tiger.qml")); + } + } +} diff --git a/examples/quick/canvas/clip/clip.qml b/examples/quick/canvas/clip/clip.qml new file mode 100644 index 0000000..1e9728f --- /dev/null +++ b/examples/quick/canvas/clip/clip.qml @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../contents" +Item { + id:container + width:320 + height:480 + + Column { + spacing:5 + anchors.fill:parent + Text { font.pointSize:15; text:"Makes squircle icon with clip"; anchors.horizontalCenter:parent.horizontalCenter} + Canvas { + id:canvas + width:320 + height:280 + property string strokeStyle:"blue" + property string fillStyle:"steelblue" + property int lineWidth:2 + property int nSize:nCtrl.value + property real radius:rCtrl.value + property bool fill:true + property bool stroke:false + property real px:xCtrl.value + property real py:yCtrl.value + property real alpha:alphaCtrl.value + property string imagefile:"../contents/qt-logo.png" + antialiasing: true + Component.onCompleted:loadImage(canvas.imagefile); + + onAlphaChanged:requestPaint(); + onRadiusChanged:requestPaint(); + onLineWidthChanged:requestPaint(); + onNSizeChanged:requestPaint(); + onFillChanged:requestPaint(); + onStrokeChanged:requestPaint(); + onPxChanged:requestPaint(); + onPyChanged:requestPaint(); + + onImageLoaded : requestPaint(); + + onPaint: squcirle(); + + function squcirle() { + var ctx = canvas.getContext("2d"); + var N = canvas.nSize; + var R = canvas.radius; + + N=Math.abs(N); + var M=N; + if (N>100) M=100; + if (N<0.00000000001) M=0.00000000001; + + ctx.save(); + ctx.globalAlpha =canvas.alpha; + ctx.fillStyle = "gray"; + ctx.fillRect(0, 0, canvas.width, canvas.height); + + ctx.strokeStyle = canvas.strokeStyle; + ctx.fillStyle = canvas.fillStyle; + ctx.lineWidth = canvas.lineWidth; + + ctx.beginPath(); + var i = 0, x, y; + for (i=0; i<(2*R+1); i++){ + x = Math.round(i-R) + canvas.px; + y = Math.round(Math.pow(Math.abs(Math.pow(R,M)-Math.pow(Math.abs(i-R),M)),1/M)) + canvas.py; + + if (i == 0) + ctx.moveTo(x, y); + else + ctx.lineTo(x, y); + } + + for (i=(2*R); i<(4*R+1); i++){ + x =Math.round(3*R-i)+canvas.px; + y = Math.round(-Math.pow(Math.abs(Math.pow(R,M)-Math.pow(Math.abs(3*R-i),M)),1/M)) + canvas.py; + ctx.lineTo(x, y); + } + ctx.closePath(); + if (canvas.stroke) { + ctx.stroke(); + } + + if (canvas.fill) { + ctx.fill(); + } + //! [0] + ctx.clip(); + + ctx.drawImage(canvas.imagefile, 0, 0); + //! [0] + ctx.restore(); + } + } + + Rectangle { + id:controls + width:320 + height:150 + Column { + spacing:3 + Slider {id:nCtrl; width:300; height:20; min:1; max:10; init:4; name:"N"} + Slider {id:rCtrl; width:300; height:20; min:30; max:180; init:100; name:"Radius"} + Slider {id:xCtrl; width:300; height:20; min:50; max:300; init:180; name:"X"} + Slider {id:yCtrl; width:300; height:20; min:30; max:300; init:220; name:"Y"} + Slider {id:alphaCtrl; width:300; height:20; min:0; max:1; init:1; name:"Alpha"} + } + } + } +} diff --git a/examples/quick/canvas/contents/Button.qml b/examples/quick/canvas/contents/Button.qml new file mode 100644 index 0000000..efdf4ea --- /dev/null +++ b/examples/quick/canvas/contents/Button.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: container + + signal clicked + + property string text + width: buttonText.width + 28 + height: buttonText.height + 14 + + BorderImage { + id: buttonImage + source: "images/toolbutton.sci" + width: container.width - 10 + height: container.height + } + BorderImage { + id: pressed + opacity: 0 + source: "images/toolbutton.sci" + width: container.width - 10 + height: container.height + } + MouseArea { + id: mouseRegion + anchors.fill: buttonImage + onClicked: { container.clicked(); } + } + Text { + id: buttonText + color: "white" + anchors.centerIn: buttonImage + font.bold: true + font.pointSize: 15 + text: container.text + style: Text.Raised + styleColor: "black" + } + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: pressed; opacity: 1 } + } + ] +} diff --git a/examples/quick/canvas/contents/ScrollBar.qml b/examples/quick/canvas/contents/ScrollBar.qml new file mode 100644 index 0000000..2c51e0f --- /dev/null +++ b/examples/quick/canvas/contents/ScrollBar.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Mobility Components. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: scrollBar + // The properties that define the scrollbar's state. + // position and pageSize are in the range 0.0 - 1.0. They are relative to the + // height of the page, i.e. a pageSize of 0.5 means that you can see 50% + // of the height of the view. + // orientation can be either 'Vertical' or 'Horizontal' + property real position + property real pageSize + property string orientation : "Vertical" + property alias bgColor: background.color + property alias fgColor: thumb.color + + // A light, semi-transparent background + Rectangle { + id: background + radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) + color: "white"; opacity: 0.3 + anchors.fill: parent + } + // Size the bar to the required size, depending upon the orientation. + Rectangle { + id: thumb + opacity: 0.7 + color: "black" + radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) + x: orientation == 'Vertical' ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) + y: orientation == 'Vertical' ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 + width: orientation == 'Vertical' ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2)) + height: orientation == 'Vertical' ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) + } +} diff --git a/examples/quick/canvas/contents/Slider.qml b/examples/quick/canvas/contents/Slider.qml new file mode 100644 index 0000000..e0fed95 --- /dev/null +++ b/examples/quick/canvas/contents/Slider.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id:slider + property real min:0 + property real max:1 + property real value: min + (max - min) * (bar.x / (foo.width - bar.width)) + property real init:min+(max-min)/2 + property string name:"Slider" + + Component.onCompleted: setValue(init) + function setValue(v) { + if (min < max) + bar.x = v/(max - min) * (foo.width - bar.width); + } + Rectangle { + id:sliderName + anchors.left:parent.left + height: childrenRect.height + width:childrenRect.width + anchors.verticalCenter:parent.verticalCenter + Text { + text:slider.name + font.pointSize:12 + } + } + Item { + id: foo + height: 6 + width: parent.width - 4 - sliderName.width + anchors.verticalCenter:parent.verticalCenter + anchors.left:sliderName.right + anchors.leftMargin:5 + Rectangle { + height: parent.height + anchors.left: parent.left + anchors.right: bar.horizontalCenter + color: "blue" + radius: 3 + } + Rectangle { + height: parent.height + anchors.left: bar.horizontalCenter + anchors.right: parent.right + color: "gray" + radius: 3 + } + Rectangle { + anchors.fill: parent + color: "transparent" + radius: 3 + border.width: 2 + border.color: "black" + } + + Rectangle { + id: bar + y: -7 + width: 20 + height: 20 + radius: 15 + color: "white" + border.width: 2 + border.color: "black" + MouseArea { + anchors.fill: parent + drag.target: parent + drag.axis: Drag.XAxis + drag.minimumX: 0 + drag.maximumX: foo.width - parent.width + } + } + } +} diff --git a/examples/quick/canvas/contents/TitleBar.qml b/examples/quick/canvas/contents/TitleBar.qml new file mode 100644 index 0000000..1698a2a --- /dev/null +++ b/examples/quick/canvas/contents/TitleBar.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: titleBar + property string title: "" + + BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 } + + Image { + id: quitButton + anchors.left: parent.left//; anchors.leftMargin: 0 + anchors.verticalCenter: parent.verticalCenter + source: "images/quit.png" + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + } + + Text { + id: categoryText + anchors { + left: quitButton.right; right: parent.right; //leftMargin: 10; rightMargin: 10 + verticalCenter: parent.verticalCenter + } + elide: Text.ElideLeft + text: title + font.bold: true; font.pointSize: 20; color: "White"; style: Text.Raised; styleColor: "Black" + } +} diff --git a/examples/quick/canvas/contents/ToolBar.qml b/examples/quick/canvas/contents/ToolBar.qml new file mode 100644 index 0000000..005a6b1 --- /dev/null +++ b/examples/quick/canvas/contents/ToolBar.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: toolbar + + property variant labels + signal buttonClicked(int index) + + BorderImage { + source: "images/titlebar.sci" + width: parent.width + height: parent.height + 14 + y: -7 + } + + Row { + y: 3 + anchors.horizontalCenter: parent.horizontalCenter + Repeater { + model: toolbar.labels + delegate: + Button { + text: modelData + onClicked: toolbar.buttonClicked(model.index) + } + } + } + +} diff --git a/examples/quick/canvas/contents/images/button-pressed.png b/examples/quick/canvas/contents/images/button-pressed.png new file mode 100644 index 0000000000000000000000000000000000000000..e434d327f21e98e82676485da0d7b93aa672cf96 GIT binary patch literal 571 zcmV-B0>u4^P)Px#0%A)?L;(MXkIcUS000SaNLh0L01pxX01pxYA)E3u00007bV*G`2iXG>7A_$h zki;_p000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0004+Nkl8S{5C!0G?%wPst7rwG;Y}jM8;}<9n5k$&foORFdL#-$!OsS5vVXo5>;1D5L=p;n zDqD9(KIiz1XB?M`D?j}5Wh2d*qp8=iZuHs%mcSj)@DL`7G1-&cxKR^`==xws7IKN`@;_ON*9*ZA!U7 zHkTw=witTT$RRAv>vzz4o7~-pNk=2P48FEa7$~)ix)BEsww@oZFFK?6p;%+?t6KcE zxea`OYn#5(Df4FoX{~&_JGc5^&wn z1&`^6ctCbYilUOJe^EnH31J}1%$<5)v)lrYN2~ommf_eazpH=p!o;!MH+Lrc=vNEi z-nGlGfEO&CIQ7amBXMa=InwLQn5xW7h^I0mH*wvueRAj!e*leMdaFm*MwkEq002ov JPDHLkV1m>V_W1w+ literal 0 HcmV?d00001 diff --git a/examples/quick/canvas/contents/images/button.png b/examples/quick/canvas/contents/images/button.png new file mode 100644 index 0000000000000000000000000000000000000000..56a63ce64168c8e9068da449c584f52bf221f052 GIT binary patch literal 564 zcmV-40?Yl0P)Px#0%A)?L;(MXkIcUS000SaNLh0L01pxX01pxYA)E3u00007bV*G`2iXG>1uYVh z4eQSU000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}0004#Nkl%$cz^@kX$p1UjTX3V7)P{s;fxK}M~>(~$41h+s~uIsh708A@FoAHt! z-hQW>v+g-5p*Mr7+qY9Kq0pK2^Y%L}JH}=Uc5xwHp<9RZ`mO|8%f?;!-KIgv$yj*= zUFlx~t>&jmM^Ry7GbI%R>(YyyeaztkIh^7I?pQ)K)03ax+pP2a8~u*cQ_kOIR~N0Qdgr`>IzdelzWHK7UKhr$TS&|?hx`KQ(d_C%`_IAv0000 + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + weather-clear + January 2006 + + + Ryan Collier (pseudo) + + + + + http://www.tango-project.org + + + http://www.pseudocode.org + + + weather + applet + notification + + + + + + Garrett LeSage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/quick/canvas/contents/images/gloss.png b/examples/quick/canvas/contents/images/gloss.png new file mode 100644 index 0000000000000000000000000000000000000000..5d370cd93d62ed8c17f43a5d5dc7ed20b4edb5a1 GIT binary patch literal 1236 zcmV;_1S|WAP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iXV} z1RN8~lD~8S00dM?L_t(|+U;D~QX4T4Y^|4I%x&WY2)X$GFUv=G^5Ah$39VMg=va`d zC|s_Uy=qPO^vntr5k28JNc(~Dd+K$Gc~DBB#W4cV?@SptZ+lM}i&GQx%xh!kfrzL@ z07n4B%%VsG*ail9fPugbdiNd?H5ZBF1TYj4iBs382}&wQ#5p&F7|Gfo>XGL|IoG0; z1uP$``hsYsb4?IO?WU#{5*!)YwFid`gn;j)_=(b`K|DnsEHq1Al=0ai^Fno!0I1TD zXlC0`VV|R1%Dh+^C>Dukw$*P~l5(k3MGBpBMdRqutrW_s0#uy?Kf71-G085oJGaoo zl<|!K!#7DyZiqCUb=rnTi_b!b8Qm%w!H}l2En!IPddta1%qyCjC*kj;!SFHHF?3GW zL|b{5>hDw}RZ}xI1#a3q5JTx~mS;*x?^2TuGH7rRus(DiJprT05-z9S#kRxXXkY}@ z&n}Zpjt)twNR()YDS=J1+MF?hs>pD|Su2f%dCvOTWs+&4?v2%voC{6W(y02`q-~C7 zW{#vG-qwowKGUiIvWB!)<}EVMv?@N)vZP8Q$EN+qz-5wa>DC-|LUb!u?|hsE*~+t0 zyB-_CQ;W(m&nZ_^**5gyO=*jf(hd`Q);t3E3t;a7VvVLiEam3fVIs1lh)6MbKLMN@ z7aWXka_Vsl{j(+K&D~Sz_j$cmTIq2C;5UG+<--xN&>Ux7a)BQ;PZ_n_DGGmSQJ8Dj zOCJ~#2T@J*`PU5K1MJ5zN>C?PLA+aN1{K@v;OA{xR=#Ht zuN`fxTA4Rjato*Jj2>G}LSB}Ju z2c1zmS|sO*pSxlZN7lq=O%ro0Dkg%(bUEAUKTQ*F8N|DpNNk1T-XIn^f672!vf18p z-P{6IlfW-}0-8ZQXQRDmKvf|y#QkKIGx(Y=UITb!eOwjltkg5fnSfk#BtCE%I5b)Z z%b4U$Kn`rScbYcVY=YLwwgS<3#+iE0nR;lges1$`G3~V8@z14&)>SH$=E1Yj`iiwt zr*#$kvMBH@wBB;I-Z-k5Y#r}Kf@kS5UIX~X+IUu|(!k=uGeBHx2K-#uT<2*?HAv|% zoLn9mP=ySAzYhnVCBZx}h-N8Ruamqm5cL+>r4*e%1$ah_Y>Q*Z`{Ki!-g?-{3-p=OCn(Gdpz3e-k%^A>ICwUPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXW1 z1sp18KZTY6000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}000EyNkl^_M)OMqYwHdLJ>s}eN&%{;FDDU1^oxa z7nPzff|n{76#7tuptM>qwY6%kY0}0t>Ez5g`}=&DOiXMwNlBU%`@!bG%sywZNPmU@yB5~XvhKv!26k>*eX&bbw5aXw&G#TbLC zA|i}k8f7#)N6$bH1z+HgV`usG{a=Q?E!s!7KC!vxy=C(31Wd&|ecvMJ3*;m7aD5HC*jIC@bW7P5Ig-Q0^y^q_fw-J0m zj6kelw5houE82_#qG*u0YpWrOL||gWgF7E!_uyWV$r+*^k1tf(Nzyug%&@zEC#Vp+ z-0V1`zZa3St15$kvK(nl2r0Q-Ol?bzPe1yE_Wn-16qKwXbQZd~X=oG9`UMY4vl+b0 zEnCN`x?~q=^<8j}D4GBshPtXa^+Ya*&qxsw>eJKYeXeO|nvjp$2uVtm%P$GQ)!16A z-IodyiE^a&f9@ zg^NzDgk`h4nq^mljWq?lp1@rd!^XPn3-G$v@IS#B>(;l1*FD3=7z6=p7QBqiqj*h# z&EKk9S5?Jwoz)G%Hvs=H0AE)=yzUq_#^Q+=c-?wn*BH}0|MpiYT>j7{ndOr+G4IzOEFes*|GuptD@Dn(UGS#&L;j-B|1 zsH2&U*y-tMthY=|O)&E12&puhdPbUwrL2)l&@_WansDUHBbW#pjRtn=iwR<%r@Xbo z>xbXq$gvR+AQ*y%t9FW(r2eak2q6SQ2y>BZ>oaQ{Si`}O4l?}XFokNK^g@Dj-o4ke zx%6ClbA{3AKREpPVMralr3&30T?m4~tjYp3#x%Xv+RLJ=pMU$6*WP`Vw?2HE(vDvG zH&!`)=oDr{dBY=Z1JVB4{)cKwd%}h9#u+~`PH(A~qAgOS0~=d(nRpiqz_Tp7ET(F) ztO{e7&NJ@D=)I{#d25;Rqi31?qW*%Z4h)(!4G(v0E53Nwle=ndLj^P#M$e4Wn3_Q* zQyOG=?^iU63Yz`vea1jnUk`=u9Qi_#^Iu=!_@Se(6#5Gc0r98Q=HtI=(yw9^-MaUwHRW)2O7;H&o=HewTo|>XD7CtH6S$fJB{J3#O{sI^e VqK)QbrHcRn002ovPDHLkV1mrKo*@7L literal 0 HcmV?d00001 diff --git a/examples/quick/canvas/contents/images/lineedit.sci b/examples/quick/canvas/contents/images/lineedit.sci new file mode 100644 index 0000000..054bff7 --- /dev/null +++ b/examples/quick/canvas/contents/images/lineedit.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 10 +border.bottom: 10 +border.right: 10 +source: lineedit.png diff --git a/examples/quick/canvas/contents/images/quit.png b/examples/quick/canvas/contents/images/quit.png new file mode 100644 index 0000000000000000000000000000000000000000..5bda1b6e0d0effbabf53172040f0ed2eea78e34a GIT binary patch literal 2369 zcmV-H3BLA;P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2igQ1 z1TP_CX>@2HM@dakSAh-}000P_NklFL*uH1CJrwk1E-B6u%Z2w7N>!@``FU=ke2KVZxrvgh1F zVsZ{SIN(5XGUSre9`+I=EU&CUVpy%D(TwM*d9|jyr@N=SDu*78?Zwu^tK<+|(2STz z)rVjG>h~)IydUq!`|&>?1b}pb^F;t~7mi$5T>Lzf&9b$%AKbZs`C^Gg!kU|#`(hM; zQ-|*?$fd=lyOY7m-(9(K1=VV`kk99e^?H5#U6Hf-{MW0itBPrwA4`&~b~>Gn?+Yc1 z3k!FH!NC1%S62~cWV6{~qtQ4QRuF_#Dv{j0cI|39H#-Yal+bRs*Ck0h z73({3yXWWc27|%-tE*QL3h~f14U2%fwK~Q_W-o{y> zTsD*a)#T*lZ?0Zl1<&*7AN9c)1Hix-dx?!sqg*~2ySBFWLseD3TwY$5(&;o*RfXfY zV2puM3fr>43t>o-gl@OH&hxycs_NsjKoy_Q_m{Vhh9&G>$o6bpd;vbfp8ep z(I`sgav_~g7Y`2)U&DU*;fJ3d9v=Q}X=#biWHL~@UAT@5#sJ3H_;on6p(qLnAt;qf zHx0x10|4tZ=)g412gBj;wvTXPEH(qvG~v1~DD{wxF;HNPjYgv=m&=7@GFfc3TH63{ z>(;G8qtSS@u&@xwX0zyYI&d5ZU<{1W5!8FaqJVzCk7v)GRT_=P#{gcusffR|jHHsu zua}mV)A@WJ-F6#8>VgmgLI^0O<1fmx48t(6y}ga8si|Lt!(sLC@bJ<6{5*2G96Fs2 zT-OE0Kky9Jpr5=M}7%&V2 zj^l!k-akG(0D+a2_V&UvBGb;H9_O2tej16|kQIF1)R>XjZ! z85pHt%mt$i%%xBi@33t@+qNfszMs}=wZEVDj(P4O2twBH_ZJ00;6D23Bkb+%VdyyE z*vs!6cQSxOBpN}jRzsyyMJP1+^HRC|@Vslj)5TSim%77lxBJz*tao-0Rl+1wq=@{r*$k9MmCj&R^O0z!P_u0_a* zJNlba3SHMRKQ|B8rD3h#|7wKNb2 zcpYnu_8vwVbX~{X>?{~#qHWu^4Z}Dy_Ds;(+1a02w)Nn~^&5l_^Jur)m!Eko$iO@_Y^QmpyfBxWu4<>k?N2k>Wz(5G# z^ZCXR^ZWfsrc&77+ef|Lpt`1$cq|54kzrZpYbiho0b?!<(?mX>2V)S2L;JR_>nCF0 z3QZ=HpHNEwdh_PZ5YO}IcDo>WHHuz@{C+>;$prTIcCov+S2=7QF2`f>e^qPMLNpqM zBuOwW3m^pG2ngq;3Ii}0n8@X_;5bgS?US)@gvMgAA8{P_Xl-px;CUXsUJr~h5W>O7 zz066!-;a1Aj^h44cK7xw&1Q2AK(pKHZpY*C;)`mf5RFD5N)jx~`cC!sO1Np7$YjzW zWMYKX-iUn@RGOTe+`M$@vXD-v(P{TU+3~&eW!VV?1Bk_A9&&fD(r7f+05p#$>2x~V ziCCgodGVqUiAEucB8I~uIF1820v|UqN&^PVvaq-~58JlIe!u@q%d-9mU~n4LRw9Z$ zFb1FSQz1yQ1j{r>J}<}oem`brW^izDfSqr@t<)R!*O0GbG?9XMp;)}{C4MY*PZG*r=Mj{IO{XU*Qe-6iS?o}$4-+mW);$b>E zI@$;eg4*qN*CknkEX#0R7g6t@5BTPrZz{D~?L_49Xm{G%i9}+zQmGWCr>BW1if|kk ziXubPG(3O)9K)e~uUszw{!PeJ%hS=3x*>!GwcG8i%d(6_B7yz={c|D5*mnD$ilS^* ztJT8H^h_W+9fhhMjgZ58<#Oq*$TJmu^+??i1VQa|I_s8YVP|KjQmt0cg*+a;UT;Sf zgpGQ=R+yOZ2X}XOF&qx>l}ZOEBF}Zp%49NMD2mbs5c|H9Wzy-7XJ%&9TrT(dyWWXU nySqj%a6ak3fqXyy@5X-sx(=UtGtDhU00000NkvXXu0mjfre}bX literal 0 HcmV?d00001 diff --git a/examples/quick/canvas/contents/images/stripes.png b/examples/quick/canvas/contents/images/stripes.png new file mode 100644 index 0000000000000000000000000000000000000000..9f36727ea424cd0da94bd5a7cee4082447275eeb GIT binary patch literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqjKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgga4pBxq@gGdLS%5-~o-U3d5|`(m z-N<{$K*aT;^vADLPxXoJET5>DG2xP-Q1*siVN6aag0$kQzm$|0%E+I; z#Y!4I)=g1)z4*}Q$iB}`v_QR literal 0 HcmV?d00001 diff --git a/examples/quick/canvas/contents/images/titlebar.png b/examples/quick/canvas/contents/images/titlebar.png new file mode 100644 index 0000000000000000000000000000000000000000..51c90082d052a94af34488ca9a13842122f7d7a4 GIT binary patch literal 1436 zcmV;N1!MY&P)00001b5ch_0Itp) z=>Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXW1 z0xv7!9LBW(000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}000E{NklLiq!w7*fp`1oo9~;MC5Hkm0Ga8f)%S;LHn|^l4>W+QI@MK<0LU%? zTCN^g=1tdNq`Dpph=PESv9&Y_yal)K%ETFKXCtR`vY67D3wB9@+&cbGgIArTN6+wSAX zkGy^RmUr*o{T4#Fkk#tskC!ih`Tfb0Cxj5Vy1F8SK-YDE!#OZB%*L~eNSa)23&d?U zSw1i0>gRr9IT1mtHP62Lmb0@nE-o&3^XAQ;^5Vq{d;a`6A3l8G`uZB@98Hs4A;w4} zZZ8P$T;_Us-Wa3LiY3JoBbsA{322^IDj+WNr!^z_J?9)<*YWV-LmoYP#Ov3u@#p8~ zTwPspd3nidwF01RTNaB2BC@r4CKHDcwm?9#oSA`>USgwAW7e}#gkM0Yvk41^nr1^7 z&N;5HuQ@q6;px+-_|@_O@8ADLBaYYwR2A=iy0?Jz0cyTE=eGiSB!O3eXvr9oHkkl) zJria&VhTXjdXO$lOS6-T2wfXkEEZf|Uh??yV|9$6 z$kf}E2}3pUBO*h1vm}>TF;RnPvP?}ajZsZ(s`c^F`G#o9X1&4r25)A>7;$dUeu#sd zH0nr`HO-^wWQOLC8t2no3_(Fez${xkBmh=yunfEn^?XuQ?3Ij+Zzn(@H!pav#Pqq_?!|nMq-S~Ct{2l-QZ~b zHR{$P`zF6tD!u{4zWIxhQbJa`7!wn!ntVca%bFsRXx#Sb;tV@Ca^rcTGS~=!F~4Rd zD^=}7d=H{l@KpDMcDE-MbeynXOK|hy7X0?B$O;vFv(d|Qf^dRaKe_z@t5t}6@ZhHA%GI8viucfZ4DLUOJ z%g-f2H+QV4licii=|7xc|4$k9K5-Z1_4nOT1!U>l1aAsHe zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00~}6L_t(&-kn;@Ze&RjJrQ}U z%I)@yx>vMhM)Vd??@(_*@_Yb7zz49M58wmf14gXj57@F~Rl)u9qI_Ld^LrWu%xs>-#eH7mxJ+t3r+Iu8>W-a$yaW&t9&L`W+wBlS zfLl#pt~TpGtyZfqA$po-jn!)P$DjWACx19QJHykbPjPf~R4mp`GJ`_tnt(B$NSb8* zzQ_XH0$@3QS~Nt>JtdI!X60wP2}Fdu54Tva*SNgA#6MqugMWPW6^@UOzjlnD5dfT= zoc#X9ix;2&_Se6`#l;1#uCB2Ehi68#3$>GQ&EiUM!f+9^cl;4}c5EU-m|w1^6+#F& zK0e0jCqKliSFiB*FTTLXA3grv1OS`O=JT_&Gn}8F-8ETgyHgg=*R!L*lAJU z{d}G_7_K?rx!~xVyW<`}gnh^5si>^ZGTuyS(`M1OQK- zJi%tO!GCt&#n|)yL5pugLm^OmbDx@NlF)fEk><<7FboZW0t6@k(*1ymcxVtz(*#lg z>~M2)joaHB{OI{7`1arb`fLJ#^?IFS*aF2~Q>LCE71Q5IL$F-wUE-g~UqYuw-8W91xn+bx`P@ZMvZCNMK50N8G~P*pH9 zL^DqZ&ENt)LYaKi!;NQmGju%+0H$cKFZvjcX1 z3lfFb0OuH6e~;a63r9c*Ap$T>6TJ5j5$txmIfa;AP=S|S+yPBAj$oxZdvWW^Iga8uDf^wmPB@BB2s9<3e0NHtnC{zg|fO9SapsENVl)F#7d{_lx z-pvfaKzx?e2qF=uH4{adCkVLNp4_%?~t) zssKzS1E{~dcBd==y(}PTb9-<6EPnMkiUV1u74Wpq1j3YavSEM~xjDL{X3rBWDBq-> z<#R!#$?=6sL)*oQ4jItoebN65fQA9dSR|Tcb;siL5&)1=rR%hnCY8XlW7Txs2S9yq z0>A>#1BT^|;r6*U%nJZ|3@{&s&I^ZKU`=15OjQd~&kxk8G&4!G%Nngd3jkWw5uHpE zTE8-6K)Mh@i0G<9c`0x*wPo3Hi)5_megz#P>d zGxL=RL<$L!9Z94{MURcu-u1mZwpfV5?^^&0uOC9kjvofVUN1CY7d*fO<_XGa!O?dX zf~O3E191T9VoOx!Qh2aqDbFv(5YJLB(Cq5i_6u~3_ zwbCyDnC{Q~z#ImH9Be7Nq`|V2l%*Shs$cX-%JG%P28av*JeS*c9o7gn09Yqz84w3| zb2gJQ?adRETCugS_ytATwLZdBc$unVohIe{UT2{?1jH|FOJI8M;l1ytLGS$x0D06;<&KZf=^ zKY%!<#cH>~WXj~R2rdiYS@o08_Vcb{k)!l zS%IomIEvfYl$2q$^oEvSqYJt8Ub;xAvQZ7f=$f^{T^~S1nApJ)gE(4Rs=Ri5z0j3J zn$D49XHcjugx68ww7}X05jM&teE*hOT_2dK$1M0UOh0GN9i%v`kmmx6Dg0nD7!gpI3_$P_2Y zXj^4Hpb~@jABRyBv#xkv7@Q)ZX^GWhn9R`BTRahgC%42QakQgUs;|?9;zFSmM@zL% zV}$49@j^}607?MEnUtDLmgEhg>NvdsL1X{l?miLb6QL>F?fCeFO zsI4~A0h=mq2wEVgUjNPZ_SA?HcRhSr0ghPFZG_VDS?VlMl^)zw?WNM5^V=(e&bbVP zRz3Tk4%(EbBtv=*8={Q8u2YKVQik-7Z#x$-NEQ+htR;Wx&Yp9`fu<B652VFZWs1RLPz+Io`c{_x1PR z|MypJ{*KUJFE1~D@&5Yy`QyirvDs{LOy>%5{%%hECFmYHFNM)una#u=iB$nYl{xCd z>`+x%o@f%LY03<`ySu}iH*fIv?OUwZ>tEj9e)yIE;PmwL*>=1AaDTV`n{)0{=Nx!) z-Lt<3#d3W%kV<5&zUl_us};i&=sgCA%~?Pyr_&~;w%^s&Ri4EE09*nYhh&1)L;wH) M07*qoM6N<$g3{N*E&u=k literal 0 HcmV?d00001 diff --git a/examples/quick/canvas/contents/images/toolbutton.sci b/examples/quick/canvas/contents/images/toolbutton.sci new file mode 100644 index 0000000..9e4f965 --- /dev/null +++ b/examples/quick/canvas/contents/images/toolbutton.sci @@ -0,0 +1,5 @@ +border.left: 15 +border.top: 4 +border.bottom: 4 +border.right: 15 +source: toolbutton.png diff --git a/examples/quick/canvas/contents/qt-logo.png b/examples/quick/canvas/contents/qt-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..5ab3a1b0c4618ccce8321db7253b8dcdc86cfa98 GIT binary patch literal 23519 zcmV)VK(D`vP)FvFqxwoocch#+PZq<9QT9(bdpGw`YySn=Jt$ViL*^r394L96) zVULVk0yo@ngzknLZa6}B!wokap}XOR8;;Q3aKjBp=x(^-MoJ?WcLM&>R?C|R5cJL= za}EXG^IUn@eC|EXtH*+RmQ~M}smDHb3`322p+SR?%M7d>F7&P#$gkYCuGF)2U1@o5 zcc!mFFr+Tf@FxH>>NuhP-lrb-`UmRAQ|g!tPXrggQb9K)V(9hhIfCvIs+TeFo5?$` zT5Ui+*Zj?a@7Jf!&NZM|$b>HEeNXE;6!-`ReuMB^TIVA~ZcOM}fw@rN2BCa28)~(u zX6i7|mjw!bra9kAr2*M2dPi_B*$l$S=^7OB2t)l@Xw)h26OdWs`L&|<^@G0$F}y~> zwNS7B-b=sbsCqGkp3*3(W1Bi|QpaWL*r1LT>K+ZM$02o}devh=5qMrd4iDwwl8xPP z*@iAyIh2F$ViqzPf?8c|IARzHhBuvhoKk;|s6Te9H+DCV9qQPlj&XHNxm)jsBlPsf z&5GdOq=@lV>QDrZ*^rcQwsnWMC`_o6QTc# z+VSsIj{_krh{JapJ|VsIrUAI?+J0q!E1kOBhyYe?@Wn#IXcBu6lp;a82S6wce$Kom z7FrrWNNeyIz)^J^S0CM#%i^<54B&8+DU7aUTe{r_~+{@296-!T9;p09+iiTqP)@4r6mMg!KvqX9QfK(Bx4a*xQh6sMNmO$^au z_%ULm8-&($fs>hBx91@>KQiUHuL&jdWl z|4fqs9Dp_u*l^p?jq{PvyIMqUqt76X)Cumqc^GcIq}wO*u$pYB1DMdx4t#E&c##At zPlEk#5IK>d836D1od*LYEJ8i;KZ2S8tWkfjQ7>JqU({bwEMQGNJFDJ5+SCB_p*;e- znhao~X(qVgMyCl~RDJ(aZQ9pI=nWWY?kTkdS6$o-cU;>C6{W5d`yFT@XkzSj5(p55 z_fhyvP-8HIPHZ3_2M|&qsKc0xfjJ{XS`9W>TG_RsP)p;@{ph0Tgox z1_Qa_MrS1YyVddb&>ptg+7+c?s zjKYBO*SDriN)p3F<2RUU0YcUfCPH=4RmLPHnkxUk=Hreg1DFQ^XWX`SBMm~o zS{;96J%iDP@4jIW`g<}^wzA+*sh(L>K;05jIr79b+z2-{-9*v`WM(FO@T z81Tb+1n2mKsts{cW;vVC&$%5*v0JtF;G%A2&9DzzGyqP@~VRoh# zfefJq{+0ku(Y}YMswA2;oJPQCEUcMAN&|qc>bZ^vye)A4j5_s%dU~vB`v+Ztjsg4_ zNc20@2Drf{bfab^!Zq7^ya1V6gJRGvCN&c|wZcHdQIfm6c|kuU7TN|ZuR$t{(-l)Y_<%{^mb>*)O3zEiGN2E3z$z3 zng$mQ{DP3^Z;$K|X%9DJ*?ar)uyt+GOHv7aPy)Y9v^t`BlK`Z}(78?Hj(pktb%lsL z$y2}u>9pugK=@e(g<)HtV;E?2`$=v?fKZ?i8CXD2BjGWKZbj@mKx&;@o16VPc;{<3 z-*`3y2i3=RHF1DF%}1>TOp>2~=*IH^j9ckRbU|oHYWtS8CFtwUdVcdTF-w%pfoK6@ z=G0x})b{z$fl!Dc=CyeuAco1H@Hvdb04V0WW0+njhJb|i<8TcVAjB~68JWN70Wq35Wqi-!34;%jvTldWEvP|&=_Fi{cQ>p0N_M(N+Y1@kxS{~HI^&14+QAZ$F+S-~mKxesVg$yv z4~Jfq&<-vs@%8Sqr|QP%{}c>*pPu!9nPty=sm0WAd1gsb=W(v^I zN+U~bVY|yw3P4r2%*;z=xY4pbi9@cLg4I3?Lms-w3+i8zlhj z<{y<|w!AL~g&a2b7!z3&8=OK`tSY)O(Jry1jb>G$E%P&rEfRAb8#6=6o|hO+6673> z#2!;^=LpcS$wNfUF$5H}pg8lx(BN83j|8R{Vs=C7i8{P!z}E)WbgU`qk2G!nuQd-h z7D4Db?|RT`lQT@auP5VGKdsan7NUe?pi(4@Oh{%i%SsV2Dkef=H(W#-QrOlH`nORC z&Jl?n87?X0_y(_mT=5LF{02w}{6P#e4BGyJW)Vd9=kxic3_wHy$ix^eA~c58`|2QF zkMM4F%~g)j`4L~&onTXIwJkXurjRHVGtJV!hPy~a^f(TJ@|R*z3K_&0k_ZrQ1Dn?; zDG&wuX^UztV;T?{(i6i{E}|jW{Q2fOFxRnS9>Jd;r{Qooi)p(D83$RWKo-r=1~y8Y zE>!%}jYSbUz;dhU%+ZV51YLz-{cjTmr|_mXH(Q7ph>`9HGUE|IBaRTrkeUR7gaiv= zp+!nV^!Eo{bfNm_z%Z!!c?wJt4RxBUi!P$47*O?t?+4bsbsr>Pj(bGj_O}u$cdg)e zQ{eZ-UB`{Z68fOXnMLmtK`w*QFi=id6=d*i0tEohz*)N%%wXBWRdFXfObV$&q0;APRFbh}o?F7yMjgxiM;< zIig<@p*JFXF4puzFYml9agkBoxD5anK^fN)QM{@gG!euk7aQnggp08dBZLC~US7qy0n}1A}ou zlB_)jk71c<5-re;g-diBVUtCBL&n|10b-$>X@r-u8wO(}t7*R)l9uAYoS=&+CUP#Q zf}+ij&oC*(*yyrw=qVEo$7x6{1|hi>$&MvN7?8#N2j=&HjH{RoohW8gp|Gy8H{XrK zgdS&dQ8L^qvO&z`49O)#D5zxul8$8AV5W8*mxc!xRYqV65$0x#QBR;+0~cv$MCXP0 zkd%BNF`gIDBpdFX4 zNnG`oU|Z%SQDtN?85oI4(hoM%a045YNRY%vVF|M2x)Z1QNVV`S`R#EUi78FZbwmMK zN3KW)1KvdVUclQy$P~)N7!ArH?dcJ^go7kzo@5vMBmiF&*aTdl1qvyyrqrQ0=?Q{O z$VIwwglRC1NRh|jZ?j25OO{%s&K&SfCrknfYAsd`Lqb*2&Tu&2cEs#wRPd0dU@~>d z#mQkdlE&r6;#BuIAT{zjLxdCq=0wnS;_dRdv`sXTU5dB;Lc~fu6AGP*c0xl5)s}2h z47Z0Ol5OUQ{mr?~IOYRF@QVacn)&Y-eLdu7CyS}WaR7laqI5noz@!woW6rnFVH;#K-wb-jLMCr+2~RiBn$W* z0jG!!38J8$Mv_Eg3SO|PJqn?;OWm8cXhBAGM~nJ}oOxon zLph8CIn^1WzuVM^LX4U-VFVy9Qm3CRniL2aiyL|*D-M~Y8nP6RB5f`?YDoeVi07}{lW|+(c znazSi5sXOsv1Kosm3Gmo?Mo+gNkxzCWK7l&Sw6)P6L1=eN>;RG+h77t)+S;dqMyy^ zs;7P~y)K-g3)nWi3Wp7-)@o3#SG`YVF{92?hk8Wy*=#23{f;^`fEv2>R0A4*3t4q; zPMw$Y3icqPg^-PA58Pa1i*|re+>#R5w6=VH+l>#R`$>w52wi%Ug(A^J1y+hDb?144IYoJ!Iz;tyS%C#w& zET4w6m6LF`JOX30N8$9`QT6&XRMa^c%&PCrE88g(m4svivw$}Fu^{PeO$;a1mqzGGJXEGFO@?G5k^??id)opIL`o|&#T3!P zHJbCtXT6T5Fg{g-U5CrC|L7bXI8}zTQx$;8X~h9@uxaf@@RqA?gS#%h1+L$G4Xo%L zgsxK8f)~2h&C z5`j#u`9zyVFuPjCF_B?P#CN_8O_%FdYi7*3v2a3{;umb*D-MW58-f>8AdyW^B);n@ z2hbR5vaWoiQOE-)EAYsUDcE&r7N!)jL%psjau)J^1MrhCeFMDhC2xe=FMla?6}pzb z(3yhL2v&K=wq>_?YW?WUA$WG|A=o~89~_z70X3S1LbgjyHxt8fNw9}OaLpkv!OiQ0 zD%6@%o&69G8mUIA3^S2&M|-(71JzJWP)@k zRXquRe@1QALOugWN2_q(6O-`NzG-vqz;>i-1SY`U_e3$KZJ zMb9ShxOLqzG^nD~Z(j3%n88z6i#N;LyhT^BKie#wH= zawbGj>+tsgN(o4&ghzw0kqqc6Y$^@XJK}>uEnf6)cNIUxMuTJ@Fze0-{G#SZa?QYK@V+>PWCouNAs zpk-AvVpKc@2K$mG6M} zz4YHKaK&cig|>c zhv(q)-#HDFlQo~f^{7^$CtrXM{)hL%J74~D=ht0PbH8rQYvH1y8{sQ^J_t{r{x;+@ zMfGwv-Ub$Hw+mfho2t53$dl>9QmIwE^R;`Cnyx~9M#gg!X4PZX#}rVEJYaZ)!AyvF z946vMmGA*4&eK8N0T!Or!seud-43(W{WpU`P_PRFp|&MO)Q|3-RYX3j)ONK=^VlNt zzG4@A=D++Oc-7UfIB##xKxrlX%;o+L)ckmz<1uaJYvMofcT@oHAkl z?V&Sp_}H9p$~3P>)mixCdwvIQzwAaBojw9nl`)v8oPx>f7|c}8!c0|}K(z^&shx#7 z)qDnkxu|pyJLFOn8))4_E+{Cj6}FS;OC$6oWuDFRY$drPp{7!wa)?(MBhUS7m+~3- z(e4@e+_y)eq1!@bo98GA)nDp{&-~{P!z-`89EDW8LDSHBq6^kZw>b-p5Py{Q})%m;OE!mAzhTRQV1ll4K;A zTk9ymQxkQM*gcI$6S^nW>#$|*M%c1uqc|sx9rPB4VYur8*f@A4Y#O@Oa~qOm&&9Tm zwt&HAGYGCGpBqacbX$QEvg!H3sw7DO081nkaVd>pq-y#@2f>^?Q-jYbBCl5({>GgL zf2wovr$6&s@S1DydS2eFZOd+jH*NbJFXXnaByKEtN`?evG#~A|9vQ9pYn2JS->Ad2 z7i?ALPx2T79TXHU+XYOvA29fg*-S!c1(jF}aAWBbJ%#~CDvKZ{)2KqV&1`spR3;g` z7R^<)|3Cl07)(x7eaSR``rI_U{pI(-dtUiV&+8j@>5ALnbr<~_G!&t0>DgWcBgJ+e z$Cyt`CDUcnX08WMmZQOniqKzv>5CV)G0Z}d80ViwCQaS|W=ZP&k~F8m5qdI$PMRA* z3)u*9HOL{XK3F|OBLTS~%d@cj~kCoxUrzYCyx_52^P>K4#{Mp}wq2A#a%#FM2 z!v6#p4c_2I(S-;>YO266V{M<0Pu1bfWZhTW=jo4nxmF|i>LX{vwx)i2ZU)}*(l^7MSKju5 zx^cN|5q@IJuR(XNPpR=W)|6pyOyC~sRNUjrKCkL9;GkyTsKM21w?JQ4-xAHa022?j z&o-F=$;fSWTqxq9U(ty@kz1oA`mJidi`LYMX~QhJQV~SVB^p2#1mz%s zYVSsJLgxtFnzm}m6X(Jt5u^RY*eWDuOCta8j5>FEwgLA&IT7ev-nPx(bLTI>hLj1+ z94Dvu!2^f?0UjUu4s4$}1rHyeg;Pgo{kde+WWN4)uzYAWyzRwrfdBUDcfp#WHK~2~ z%@@28o*Df%9GZLv@|hAN1%WNlpr4g11jkPsK%6#p@+G)_f@ww@>^E{BYz;kj>TM=F3*WufB03yz2G~Alu!eCfE(o)eECjXW;$+_E&J* zAHD^?`|S79WVkoKA*0`=y zAM73K*y24l@@4q!v%e3swJ9j&dOc#RR2tA|G~o7Y`ru73Uj`Y?e7wlKJV5sV>>fD) zul=*P!PlSsR%-LuI(!RUGJLC#!gK2!YR%Ntgp_@*iM%{l4dHUVd&8~*gXBBC7!=iuaM*@uu@ zQmF?0N-DkcW%qP!;SQaB3jS^PpL<`J!(3<|E9Dnvm0EoLwr+UMi-*JWFLuG%xf%F{ zkNgJgJi05j`MhM^TcMz&d)v1jASNc!MdOtRPn4tKu`pt6J9sKQ!@ohy@V z5d@LQNhi&hF41jq?zWOm64ENES|rpLk9-tcNc#_WPeH`TUYUcRy7m>YVMS+bb6xlC zOMCtt%8l7(TsN}#!<-`a7hl>7*Im-5CL8$O$_73$HUj_g8}bFXas5*4bEAod*uq&TosDR?W^J1gEP}v|g%LU> zkn(7`;S_V>V2C8!+skbC&HW0KNS=Uxl9^r5cHebDXbFS5M&Sd5&gu^0}ehM+Q=Lzh+*xg9aMvucTJy;cGEt;bmayw zSY}C^z>J{~nK@a^H;WXZnD^aSq>V0dZ>d$2+5g*?BP~TmAsH1?f*(PcQEKtChi2Om zUGtx2dMdIg&BJ`st55gxO z{z58q%V&#l#qvA+>^4hJwQLsPkoKR~jNp@61+KmDYQ;ozi>7h0tdoSEv%sBM36^-U z516JPZls{P+j_7?7z2h|<640h#RzS#=Azv~B6DvqPF*P-gS}a}`obPxst131wg4ad?iZk(lC6H(@|Qt(u3zz! zMwla08{5$HId-ZX1?ne3PV0@ZR`TQW4%DrD>_ zu?VE$K0ypL+6#ZDR@?U|+nlO_O-#N-x@65op6cF-acbreoS5G0OLG#cqp<#9@`UG= zo4XWU>rN2?29Yno(}#D!L%V*E${bhrZiWs0S1FpULRT>ZUF!S1$CCd@ScX#*ldyYa z(u+0F)poqvdHN`J!Hc%sutf9CX!=M-n<=TWLWd%5LqFJ)3S;&zTv3>qWU-N3nr!lq--w2<5x~*zsOl4Y zi$>>Nd;Yyf@_W$fQdt;8-cbT-A+i^e!bxr{mC&t39*lgl^;{;4L^p4~Z=WAHQHF|+ z=*k6Lcxuxw>t6;pZN8=>3stSpDYbo{w=sFdm#O4plv&n)tzTIL%w@uXYPkaJ8rcU2 zPalD8Yql(TuESmHVRi3%cs4)Qu6nE2H=9vbL#2HulufQnYYq1fdB;-6g@f0^JFodG z#XQPTZp?TEBwTKG+t*ik!ddW-Eg|wQmJ(`T%F+1sfvMm zgIBfmhV_^FhtGC>J0rmaS+wUYM>1 zeiJEBWK^pmh?bRhHhK!GyG`1IwBM0w+DBojPJ)Y#D3bZ4qenfrnrWY_&Af5NdKl{K z452p~HP1fRMJD+lYM2~sg%xc5hJl`}-|Ng^YBQBtIB@DvYV*Ec2Mz@>1w4;wJkp6b zm<7irwg3~H&%)LiV|g3)6C)?)GKBktoB=2U`9SFG#UB9-gYFjt-Q z{KV1j&%s6&#{3!kSQC0*PX-Ekrs{3I1_x6l^eZ>$5&Fg21>!6?BQa1YA zsSd}c&!#r-;qHF8U~r|UDV*1)xlk%B{93T4AhX#Vou{C>n*d2%DX<85M+-3WIgUYI zKkmu7x+m2`vu-pXU+RIi{hg}~H>Xthnhxnit~dfQcmsuBH?$*dpZAn9(Vv^i!r`&w zsm;4z5&D|pwK`I#<>e^k3g@?xPDXP-*0ke_U^=zkHWpUbT?%Hg2Fx^gwT#FB>$vjJ z?Ob$y+T=_VaW8}`$_#c7!mK$;?iq^=n&V7*Q|%{Zuhky%H&}Ck!NAk@<)A%-#g@ePp@K>%leiD7};~Ax+BP$ zX+gCTojsmDp+gLDb6zC^n|Oyv9yD?G?ELlGH+N#H5x&{YR>%WA1B=xxz9XBy_p+Zuor(glZ8rhW+epPc5c;ta>`7dw2&^8NE{) zuu@5;?qW~J7D>ltlT}?LBU(-bEPOj%&A&@)C1?P5iU7uECZJraq(wd>Rm;lmIAF4XEpbw9dcrrLmRD8OK;1kx!MP8RCmvO|2;LYrUkqn2qLHt0z;HIjE)xp7j@3 zc@<@9&02BfG0CitZnn~U^GfPwm;7CW{YAKFLsnf&UwF2ukd>8WKMTEeQu8?Gucu

qnYrU`|xSBz%R=rgBvGr-7v8p=NJ zETQ|w78%r$t#`-FpNte%^|!7`&#CU?n$SbF*_SqY@;K~jhbBno-1s#xFYMSQXr}@8wwdADDWJ+s`Y2+mO5(r(A*j!zAZvW3C>lko3p~;QS3y0MO z{qc%2E30PJ(&j1Jjnq*>Z_I$4!DDVTvuOcFRekV##zg~=5USM*92+~99-(Iyp=W#i zR8UK?mQ+Xtf$zN*bdezw>MRKg(=MbW(#MU(5xSI#$qC<(pFK%|eJP7A%;~ksSFJS^ zu~U?hG#apW_=1iu5{4plZ2jO&$tJ0#=oPq>!VJ=MbLF#LUhX#qx~R(9M`{aZ++!&K z1BCWU=3cOHqd*9itd!f#?=Yo?n~g zU1lX6h$h{HRCrYCIYD<<#;bo9wR7t*kx~Ym2f}0uUcGk^V3X8^BboNHl+S=M*WlE2 z=JkLE;WYQ95<2Hbi>(2`pzf^O1f#YrMKi;+M6b@*L=S2W`2q}=x;nQ)YA(8790pZR zG9$T&Cw5Fq7(pYw4riw)(!0T!g<`H(F_*f%N>FOj9EEbtoKz6nC$ll^F-;m=@>+)^ zdK_J&q23Y-lF+c>7*)Zu(G`(bYP>p}>F^>UGAXBI1nyYDMZST27~pF^&7>@vf>CyC zhy!+r;31|JGBL~mIiD@@01$=aEL;%HQV2b+$)d!hgLYXYS6JfC9D3S}bw`ZauIlqy z9SD-|Z~;VCFc}*SCE$XW;Mztn7I>Esro3Z&as%O6*@Ws+*NJsIT1r0=fSBiOHI+=5cw`$|2XU8PVBcLt0gGAM}n z-`(7h`a#F56moo!O07{(b^3WM@HiQELght9;@Y$xiy4C`uVc{cLyWik9icB$s>P~G z6z^vTQ_V*<9MrfhVo5fhw79SxN58Xr?LA}^?|1f%?d$vJFq!{ElG@Z8O{sn=j^ z`b?_7q0#OE6~PBn#pDpeU2~DI%^%i;kOz8fesw3kJ8Yv%Qk~5r#Do$)u9^k%fXg{5 zDpIM>dDUe+I~N1YD6|$F!b|}bA8Z^ioL}vAPD+19<^hD7~waOLqlZ`+abPj8ubpqoE<~FnniU{!vHQ=masY z*+?-Wd41hj456dNK4(KEyQibr3NZimF60TLYNIKgA56eM$AEgQ4+=7XbHG;l)iXEHwikadkcfaYNRQ$+}{+@ z21gOo);oKHbw0P(@l$LkwE&$sP@{f9(s#*1wh_I2Lg&V!v>z#&IbzE2+8SB`23uC3 zQ{B^-=!tDTDYA)C%`lkR)_%R=H9g2cCZCC@o#aV?M#mON`_KKJ=mupF0$-ONV@&|N zDVct{1N|a7$HFdugMZ=U1~ZRNlB(f z0%_#Hw*`!aSAktLpcAywh~F4!bjA#YO+r}GwJ;dnp|sKAWfEL{Ca4%JY8m=X3`%dR zw)3CQWMQzUud`^}IRXDn6AdGE1mr1FlxdO);-cK{%Z(+d?n$yRlh|*;=L7};@K8E= z9Y%chJvs;COEIS^pt$^MDK;A|*;Ls2={mQ5cD@E)d~e1jjXG7sGf32YW3iGP7)c!{ z1WIO3zmNvWrtqTN;K51v6bLnK@5p5{UeB_KkG@id({nQ&luif* zuZpS}xM2iwi0(8pf@<2-?8mfYXTdRTqu0h66QKi=y%h^UJdsAU7z>h%$TLvM7IcC= zB|^95q*#gHQmMlBKDBS`d|GEF!xKWS(b*<~gGuZ-inzBT$HQI6WTar2Zn-yRA!Z*(8nF6FP+enfN_$Oo};#VjdZ7 zF9SzMk9J;lM^3M%a7J5DRkfPR$R}{=M`fe;cJ-zu8}umE$BzcEJl4_w>?v8Y`vA*ZByK93B8K^UDl-C07<_5d!(kmkaCG4!lfCsFv< zQ>-wf`^M=50j-pso?NutXVK*<#Knh*8Y377pHtz+;#GGhLz5NKXwmmcN>??Rh{3r7 zH`nV|#;AkiDOOG8hAx@R&RN{&lKt7%RwUt*&E#OHH$917t(TisY%{>R*-};6K~UEb ztZB+pN~dyBw#FwDzg_-5n-2D1u z({l|!h(E+E35JT@P|W61oBLE{tjPq0IQve7zoJnXG6KE=@RJE>7;#M%F$u$UW8o5= zqgiQvLmo5YOaD+@kV8}z>+Q}&3yowlFflU;r#njMgJHXpB-Mr~bZ7!b=*!k}y}^{} zB4s9&l%1YUZSIrh(NN@|HMKq!i5^!x!zi#x0+zuRm=r)c2gs#B=qQ+=Tty%5Z!Ta0 zQE*d{s0M3Qx4V=BEM&qrR}uQu>~u#HTe@<+kjv!S1(PwM&(RF+oyQy0YhL&(MPpz4 zO5IS%r6-cMEN%(mWF6gP(d+dNV3e?K zz(CKS*L^0fF@PeE7XQV!-h|)N}7xSxi|}Q#Gbn9ZYu$2ZlYiY7fL(I zOjG4Kv<@!m=|U(KGd@~vAn!X4@9ZcTr-Nn)8X*S5Zt_-f1z^fN`w?;VI>5{vMTx9Y zhoRn~P_MM5O4o_XsJdPj#5CZv2T>FlBZ^`AjAS7$frwa>&Z+EagK=@(KZu03`YK{L zYKb^tP6A%SlBlSp`9M!L5Ma?h_rR&cos;Of91Xb&Ofk-V zrZ(wG^cJC$pg^T15Xn>*I5R9x9b`9&@EKgl#&m=pd-E`%G(h8qo3+{{#4ZB75F;JX z%U)YPl#R|!*|dj7kHFcfGaXx~fx-%irko=Gdx+c2?KP-2bihn4x-YXiST&Gdu*~@E zaV6E;2`wS7RHr05LbxOt=T8q2udS^z2@C`n|G$&&OIO{c^^EhMvy#ua!4Ve=ic z8}85RIMI-a0NE^zjGu%P9R%ctN^1nWkSXbkLWCUZa#%{z&eWmGG>p`lYiozsq&DZ1 z)BB;`3M8Ur_jIX5PGsrUf`VBSGYJ%g16!`jjdTbdL_sA;c{I9;GN20zom43d3)kxe z%lfiVDrLjptwjCI%oOY#+265+THd{}nXW4M6hprgm<}%O+IMHC>RwWd$?UTEB5YoD zVS0oE46*ya3LB#s!sgT;b%L>+544^-dh;t=GgN>~(WnTU$-&{Vjb2H{SOSJaPwht<1rLJHOYl z#ah>YxkWt;Y97RfmuhFhnX`46oUVt1Wzc6-*KNKgwYeUgc&aJQ&t;Q35=x6POc0n5 zVbhn3j5>~nx5n1q$&Cd{bWVkj-8%^~ClDE%jZy6bfR?81?ot*utt^5k-VN`{w|D)h zV~e%6_hK()wS{C;3>P$d!|S?t$IeusR<4H|RMhLRa&S3Zb-~4{%yYUr4o9bUC^IK- zg-t>@Vj7zXb7AHZ0pkK1Pz0Z`CAY+Ad-JKW&O}cEjFWhLqM)Xea-mK+KU& zHm1Maj8~8*iQtM)q$$yDHTI<{v1Y*uiX&nYRNrU;2d%yj4`gB8ih{4c2XAz}248&a zn;l!QOP0OFYo$yrkj=L7+7r*`5DuNF!1!6E4P*mhze>!Py8GZYSKpD!{A!IV>>Gbf zeMJG-s4*L;y2LS1Tm{{^0WS?VB7K8jjz;fvF!l@z8_=oe=RkF*1ZFn^FU8rCK|;1n z5RgO0l|p`*z`9r=4-`M^Tj8Au_VC4G#E0nFiwOK1&;)uL2`0+h6K($7A z-&f|~CEIR%$u=C)I z`U4~D_sh5aOf!OQ>0|q;`xFx@Low4EVLsYoD0vlnO!JrEbV~6D*RFmwJaOvl>e^K( z<_cc!{m7XrJhgWQb{(1VYSz!yDv(v*xqfH`y!raq!17fiFjC&(_o0ug?;f<*BPF7p z>Yf6j3#EJ@22&GjdUL+#!0QM?S5p6PU2<)?Qr|DUpaeVjOe;wqh?Q3A@IQY4OC2F} zJ+54N7ku~VKf!qUL=)LY5TR_+nmWQm+b5x-GuH9}C8|6FH*UKDUU%)?smyDpdKR7? zdq~Zx7+$aDI_jk?7BNZ}n$YLc>2`C`(2elAEx!hz{LzQt@%=~O*+X-1@`RG`74>C> z0`&I{!_Av+g4bN}GI-r}cf&=iH^Aq2z88+1coGV_C?;B}>LT)Zk0bIl2_2Fr2!$ku zOss7UVZI7Y5M9M^%O(aT)Pd@;=j_rnRDXGL^&}k5Ez2Ily zU-!H};KIUolfl4T3yQE0D%ZxX3b1K#Ic!^V5nQqUGFUmVB6NP( zi(z01t%N5o0Vcpuof^MHLgxgssV$M9nRAFL=My#K!qI^CDbO$>aIWq#zHMCz)+{f= z@l)kC$feZaIi-qz?EcTdAKmlY9a*>=*8U_sHTo^suWaICwmUHIHuK7=`BbU|U-|wx zRJD1L3%CPkrr@1-|0299B@j**#dvh&tL?H;O!eJ5>FmE8WYjzw!R)zg9*&G2hPm=A zl#1P{%;)B=e`trj*_+*$hIvq8ujxQ@BKXhc)C-V8}&rHJg zTd#*d{^|db+I)7Mei#lI#&-O&NdIldlO?@1s>4^;o^Xp@X$W>tCjk`Vp-8Q+~-eKQfg%M z2z=x_pX%7+t?Io9-h9db^qMeM>T@lomd}Al${5?SgW)DYJq#C<~pmG&*KN4d~SAO#1)58O%S94 zqqa&YZX_pkuI!Mlpli_fW=}vPy%2fM%@TH$VKlsY?+7otTuJqY@ukZ4{qVOw2`A5< z?AQWs9ljZU_Od_p5?*wVvuuvw%v2pd^R3hH@MC9vb3*5^muI}=CvW}<`1jxZB&=V) zKD9aQ9DP8U5RXAVQ!>E7@Y?EU+Re3obumg@^%{I*$HUL@cEo7i_Yko=mA&(-JAvF7 z)7JN%K{m|9`DoQ$Cv$Y%6tSYt(I_M);fMX{Q!ykU>FFU%37YB_rZ-r0&=l=trfA{|fs|Hr4_T9Q$ z>V1bkZX^I2fK{NpQ>{U8+4>S>N`^a6t<_hbx*w+Jrk-P3XEqWdZ?i`NbDZkFcrY$$ zg9bC)(d57sP}76JoB^=$zyLB}UXa<7=O4cF`T_Wdubl!4W|Ee=mHPfq@b;Iy8Lr-V zWycn>J3jy~-}DYx|C(38FI~SE4vZe~Uf-~69c){@8Mdyus3YI|{iC0S!;?FpnCk*- zT`z3ACD*Pfz~;3j*t36HiTKQX1A5qZd@ua-BVU1EeCb=B8ylT#nusWb#8S9-06A&D zG(u<0YF2$GM*N3THihH_O+6#V+9 z{}8_V>mOJ4bD^UPdeNE<-f=F*$*FyC|KWdte74AA8lfhS^Y*;IG`A>IXV0OTu>Fe} zc>mWw25-IP4XL^O7G|S!nq7=NZg@J}Sc>W{naQvS93;|h6Zj&Hyj4(~T@auR4DQb0 z?gSVJ?gWRB009DF@ZbzC3GNJ*;2~JBfq^i%+u-gVT!L%RK!D}{_hP@Q-P+psx~tE{ zdoKEPKmA~!yE9g-@1kA%gO4{`Qr|HG@q3Vd*^JE_tDL7{M1jXHW`bgf)sn9Cn?Pci z|c{1G5s(3GMaLuYk+%R0N+oUv4mc=f4dL`b#X`dY?$u z6W?-!RJFLtV3cQG!f^5iwm^>a^lZ!mrcwAl7&(x&G-$KmJ_rP2x1Vn}j1QiEgU8)F z7kFX|veaL_=*x{W4rDgbWiK*{%`x@4kiQob9#nM46-AY5aLL1vjXBPIm!jd7~TGDN$ZaJ ztpWJ%a`$aip~)a3_u@S17hEmq^4R^qOfc%gLz#zCp$+8zD;RVT%e>CLbFkta;{a&P(-fZS8! z6Rz;@{oUULOTyQH+w_&w8yXOYV_!7OkNkQ2UUSOT$6u+gv%MPe^Xk^0+o~~u*%`s} z0cYT|Re?Yho1L_FgE|$Agf}Ol_e75}{+H)ZXp8}yD`)G8LE+HS6M}STWUKoDOWs+F z31fXxn46u>tdVO%+>|W(oVamKIYdn#P_SKtGotgYWy}A;=MSm+>gALL*SLuJjdb%* z)hev^$AyNCY{vW3vzya9lxP1@cAlv4&+R4`6EF z;q2k{gL0X(y)o_uIUy`z;ZJqmBDX7V9=QECH!8Z8OfNBgk41bw@7G2s`omUCyhz8= z-gLn;!g9Vm4QzXhOL(C0Tu}>XiA8;q^Asol^Xq5?YTal=0M#}*C_kL3e)+tv^2po< z?I98U+tO4KnnB#4MPF{&ByVQ*V2SRH;hjsOSQX)zPAIm z8;PBO zN(oi}z-^?BD$PuIwqsbt+-8$WR}8s1#fY_VU^>|zcd*+|b3XFzt518x^|@AfJ*>%X z)(cK~NfSxDKORU{^2IA&j^?&I15aA*7lNAR*g|y~{r^t7AbFp*Z8xy|7-dc&W7eO@ zWgE7FI@7NMk*qyG(@8ZkL*!HB6=4KJ^#)~Iaj0qB&T1{|mpX)WUSJHon6LdwhT58B zRcRB(7y`8k{HGJ;u*9#ZZ;DPx>M6k{K9nk?5;w*g;rw3ml+>a2dYTb{B=Mc1ZK@gt zGtaI0%-}y@vFq;fHV5{fK!^Mh$>>jnQG zSi9GgPEo*v;r|=kzs1HQ{_FmyNPjd^T#6v^58``wad>Z`#9|7y0lJkN0MKy>;G!C} z9i89YW>Bt;ZraUvxAqaqIGQYkIqBb<=hFuFL#@qA0v^Tsg zT(GEcB!SK(JwYj8tv0ufaHR;p^;$X1^>~iqc2!vKY`fi_Yn<94|X}vp;GM^rb zhpz=|1W-Pn@2`cn*#_;wcO@Y*&)sak1&h8AEV9Uv?L4JmJZvo#{BpiAKg(5gy;rgK zf!r*bLbE0djxnWD=U25Pq~VEyr>-K-yduLtOkWF!f0PJQ32|2^%Je-di+-umr&_*~Wrto@Cxge+pfmxKLb zd-`RQN~UjhrL}5%eoXa<+NFf4Z1NNt`=4-JDC1O;$ct8En?rdU{_Rg>6W^k;6W{AIU}TGX8aU5R+GJaHeVe<$_IuIw)>Q4z#cAZ=_&n$E$L$7r>_X z34TWFKPHf7=<8%*kO~U8D&^qjapF|QfNcT#@rC4=qIM-N)I;<}pb4bF0Ndt-k>;4F zNVl!Xw5?I5*v|q;%VGGNW8BS$a!S7dc<>4570>K#bKEO=GTK z0}w?b)2oAXD)W?cxOnizrBe0MPTrBE3XfZG z@&dS$S~~x*{Wpn01(#BBiU5-6S_btQdalc?gxTW#JXk%t(!_H!6pCI-BVtn5Mhp=d zZGK}_%;m#&at&0>EL!(TVjhH&+R?ee6wjPF7t?<<3&>X|7oOy`-D9fTL*r<;-6_T% zSc*j4ubppOJiX_4^x5T-__?$^duOIqEq1HG@D=pV%gXNC4XPm@4%8AkOhRcJ2jz9w)u-^IG+TVDEwhaK*JM zbKZSzkV~EXC9~o~OLy+H*SI16?vDmBtcy{FhqdgGyGwNGM$Q$r=EM0`!n9QWv+CA` zI+jQ^sOF28cZvPKOiXyWBPCdsGPv`5wU`PJD3Nu-qGTjiz@%REiwyI{#7kXl@PVt- zifRvQX?Tc?7T$JuBg)eF^4rcN1Cx;0v)wv-*@^6k*QWh*kyQ@Vw>!c_u+OZXH|a~F z|5{b|0)2^aX-JgW`Di85Jj;P1_)wP#JHVXcq&u51OD*ar^6r7~wK>8XnSHg-+~JTz z-z;EWfqY0{G@5n~syZ4K69C+;3&hENUJSNOVbM;M=s6+Q*mTIDPQVo?+U7N2ICWH~%CZ<`73Y zs&TMxfoGt=pvjz>f^A0@?d_Eq-OcmTc6nFrJ7esyYB9PwJx43b2hO-eVyB;2y=-%8 zd(4qV&BQ)=BG()3bWX;4;m48!)6wIPmqhLOE&=DX)4y9Y=vv>w&z@T*FX(_lbcC;^ z0sUifzTEkrQ&L1h04xjZ&lS0&lu+}nKrvj>sXlad2u6Hoj&IyCgE~khI;}3|Z_dO+ zd>Q%?=q~J_qdTE6U1Lwn$k|a%WKou{NtLfBCW&THKL;erqW(Vk2QHS0m*mJpY3yh7 zd((m}-FEDolYb0Hvh7&)h{dG4`2837-4wj1XM`TlHK~~|#fR!nZG?fM=?|9_zFaH7 z;m9`22Ec@goQjaXi-OI96jWDVHh(RZq}{FZg=G(LwIC7zfo)TzL2#UvWXR;1uSi(5rSPc@C% zm3Emj?eOVXj6;=>m+X^=Rs^6gW{J%+fTHrkckIj7N%F|30jTi6YH#ZEvH_P%UU)`Tztdo@zHSnTJ&*rm%{xH<%C1m9_@`y zY!i!4wu6|EO+!b5#=Cq7FpCK4?B(~tUC?75 zjgP_fo)JZTNhmszc~!k64QG(9cpFL-aB;e^w@~H5IXw7olsjaIPajsL<_uX8Jdpw- zN1X;jMAPAk)pUoFSF2BkUZX}-Xf5Q5U-afd+CPY`GC>C-8nRxsC6rw@1X+Z;n1*e6l zGno=wyE+@%>1SW4s}9*elLFsR+5KPG321`mEsgTb%S@`n{8-F`uLnt$kLO|Kh+)-^ zoiqimgS76vRfx=)&rJ}e?9D)W4&acEInh}I-+(zHk3&Ph$2x`aanJ)lfNCOAy)MD^E%beVRllz3&%ZnLW!B0t#f4QPUJX)z3A~Ae6zMjktg88 z;e*EUx{n9sdHoLF2MJ- z+bY@|=}LOjzmI0YoJ6t#kV~JMtfacAj0}<}ogc|%nPaGyiR8K|8ET}XAxtXnN?Mr5 z!cSn;E_)KmzLJxjCN?rv^1bXsp5!^y&dfz@Dsivg6weyaDUQS_=%L$hj%gKGIZ)j> zNa#iNrkfT5$o%_cMV6I$Q_*oqP_|xAi<#FTbx7u4k6z5dxejK0c+q(HCXlfG&%(T3 zxmv*odL1Qz#bzfIuo!I-O^zY9s5@q-b1c!2Z4M*pw-%>UE(N0Bz&+L&5!~{Kkg$(@ zvU4l2_{65F=y}AeP~=X{D{AqYQX0iHg5sg5BwI98S*Os*4sP`}Q-tV`3SK}(^G9Mx z^G~9B#;lNREZdEq_k=JThqF=D(=Zp=M<$b|eRtmn5g#Pjuob`l=Q4H~mZ5@Zx)$2# zEJxdnKKSWjd1|?Ab!cjAHt!dU~nP(U4!bT#h8IObPhV771YV-8>I_E4a2 zBFpVLTrx}iLqtuo2r#pxGXwtW?7aU8^Z9*5R%!7(Bx?MlxFFt2V{nO&tZuhhXtbn% z-uX9&38B`+R2G+7t%5*exYKo@3cY;Jh~gQyFOr0kQ?D~8xI?_-m<-ueGUO=@g3T6Q0*l?{M|^-h0?(ba zK8Rh%m~^=?Go1vBzq6E)jLJ^Me6Cf&da-bDfEke+tfdgkP&E?MVl?G1eGqLOt< zTm7i+vMV4J|!{sM&(FPG+zwr5IOSi^&-k6Tedc}KD2)Rm&m%P9qLy9XR&@K z=O`ka2bMKD$3mK-AcF56fRn!?w1ZFl6<>(~W1UNp$z<53kJF_*oy;R`F0pvUn^=9mIUPfXv zN8e<6P}nL`Xt1Fq_@aq+ki7uE9?7va+5Ki7CuZo9)9BQKQXir|p`%h=KSGM*h@CzW zV<$c(!wSERA}9NzNF-_?<*P*h^nu>Y)%r66M}{zqtj>nCuuf+d{WVqM3nyK!IH0n9 zHxFxrj*i`KtmxU7zX5cX0tf=zC!x~17hAmf`q+8Mg_)S7e+=~-5i=O`?q9@PMM&{T zjPVE{c9qAbUaPw^TOFkZJ3>=q6nXu#F19!CD?`f$C#gB)kw1RY6}qr=#F>3d26CaO z+m#-O_Do`q;ZPW{*(lH0NdGLPRD2B$cM^$}N*tJ44mmopoHABg zTs$i=9&Ct)dtH*8qyI%R>nx6ScsF!{J95FuD;w(0O3boWNMkkN8lb0yo%AN98QUoZ zXzPPnhwIqFsO}u!P0=`3;sy&-c6qKq}7t5S<86B}tfr#oN?6R4rK0f{l%miL_!5aPcl4@6lT5Xe|PTlCP4Tq+mw& zyWTDaOC2h#YSxma!)uP!PWSn7LE9?rs>>tBpg&F&9Bbg0L)L81(?3U|_U-0Hp9Ypc zf)q$WV$8Pi55>PQEq-EiuA9#X-QUwR9J`6;k1mx_aw4{9WyUZ2!$M0yeOIv2VtSvi zyv)3V_jKBv*R;J-o9KqxZUoPy1XJ2HIux~535779UMiWXm!n4h!@d9=aSK?Qi~Jz_f6 z)ZcpB#R4{u$HzZ~ACgoTyPxXMuOU|F)o$#_UV6-|BgKauEdeUbf8vqyeUqyyT=ks+ zNyPdgCC>c(a0tE7D#~=ZZT_iS(N~E~bcw+Pp@e7t*+X{H!6&sCaws&=GSk#DbJ#zt zo(vh5Qv8CoE}lF^Lt?A(Y7?4mxvcdwl8GdR-TOPnx)VY?68P#RC%NS-9H8)h8uj^} z?sVuLy3Op?K5X>o!-SL!H$h{+YKsi{GJzN++homA;H&8K;$-CrRcdjeWTUs()zHGP zzpzcvhAcP7n`F(nvicX#N#aAP#w_&MdVrqXTO?P$wfkX#eVjJpKeU%B!f(T4X+2n9 zDCWlK?^>a|N)s}PxPN8i{}ZgwTLQ@F!lSGOJ1u2R@W~4X3&uGJ!QvVIY44OaSI)eALrf_?Vrb{DKm2+j?=fsw(lo1Le> z{qGaiM6%s}vs)ZF{u=X}^;?>i_?5$ey5^D~1=U4vEuY`?`#560 z2fK!6(?YV+!%wD>x$vjqgL47-(zjN4Uva!#Q9DmkW9Wqfy=&UPQAnf2dauWSPPY3} zcIfO<`s9C<>o-<~wbQhIFlXHGnv8%^Y;Vlx_E3bJWx(F$@l zBAim+?{2M;=}VpS3myow)2rpL7?j}L2j6Kw+>p4=96dXF7tUQ`v{p;(4s&NOK5igM zUZSZt;+BD+^odEDT<;RkSLb!#7i%&YxX5mi)um^-HGX=z{9Ngi+->&zkY}%yGk9fJ zysmb3VTM>2N`|Cth~z!aaHkm4oL*voZ(UC+IH2jD@k0!R&_XP;L8abEh-wz5T#0o>vCaKe?@V4a_1i6g@X2-4Mqd-Vr;KO#JTFD|V{COn1@v@a zvU|G#ef{~GaMJN5rM<-a-p p8}UE=)&EKOU&Hly+4&PX5QWInvX?L?{t4yzQ&-kjLMWPt{tw8XKA8Xj literal 0 HcmV?d00001 diff --git a/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml b/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml new file mode 100644 index 0000000..9e03c03 --- /dev/null +++ b/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../contents" +Item { + id:container + width:320 + height:480 + + Column { + spacing:5 + anchors.fill:parent + Text { font.pointSize:15; text:"Quadratic Curve"; anchors.horizontalCenter:parent.horizontalCenter} + + Canvas { + id:canvas + width:320 + height:280 + property string strokeStyle:"steelblue" + property string fillStyle:"yellow" + property int lineWidth:lineWidthCtrl.value + property bool fill:true + property bool stroke:true + property real alpha:alphaCtrl.value + property real scaleX : scaleXCtrl.value + property real scaleY : scaleYCtrl.value + property real rotate : rotateCtrl.value + antialiasing: true + + onLineWidthChanged:requestPaint(); + onFillChanged:requestPaint(); + onStrokeChanged:requestPaint(); + onAlphaChanged:requestPaint(); + onScaleXChanged:requestPaint(); + onScaleYChanged:requestPaint(); + onRotateChanged:requestPaint(); + Behavior on scaleX { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite } } + Behavior on scaleY { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} } + Behavior on rotate { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} } + + onPaint: { + var ctx = canvas.getContext('2d'); + ctx.save(); + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.globalAlpha = canvas.alpha; + ctx.strokeStyle = canvas.strokeStyle; + ctx.fillStyle = canvas.fillStyle; + ctx.lineWidth = canvas.lineWidth; + ctx.scale(canvas.scaleX, canvas.scaleY); + ctx.rotate(canvas.rotate); + // ![0] + ctx.beginPath(); + ctx.moveTo(75,25); + ctx.quadraticCurveTo(25,25,25,62.5); + ctx.quadraticCurveTo(25,100,50,100); + ctx.quadraticCurveTo(50,120,30,125); + ctx.quadraticCurveTo(60,120,65,100); + ctx.quadraticCurveTo(125,100,125,62.5); + ctx.quadraticCurveTo(125,25,75,25); + ctx.closePath(); + // ![0] + if (canvas.fill) + ctx.fill(); + if (canvas.stroke) + ctx.stroke(); + + + // ![1] + ctx.fillStyle="green"; + ctx.font = "Bold 15px"; + + ctx.fillText("QML酷毙了", 30, 60); + // ![1] + ctx.restore(); + } + } + + Rectangle { + id:controls + width:320 + height:150 + Column { + spacing:3 + Slider {id:lineWidthCtrl; width:300; height:20; min:1; max:10; init:2; name:"Line width"} + Slider {id:scaleXCtrl; width:300; height:20; min:0.1; max:10; init:1; name:"ScaleX"} + Slider {id:scaleYCtrl; width:300; height:20; min:0.1; max:10; init:1; name:"ScaleY"} + Slider {id:rotateCtrl; width:300; height:20; min:0; max:Math.PI*2; init:0; name:"Rotate"} + Slider {id:alphaCtrl; width:300; height:20; min:0; max:1; init:1; name:"Alpha"} + } + } + } +} diff --git a/examples/quick/canvas/roundedrect/roundedrect.qml b/examples/quick/canvas/roundedrect/roundedrect.qml new file mode 100644 index 0000000..42142ce --- /dev/null +++ b/examples/quick/canvas/roundedrect/roundedrect.qml @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../contents" +Item { + id:container + width:320 + height:480 + + Column { + spacing:5 + anchors.fill:parent + Text { font.pointSize:15; text:"Rounded rectangle"; anchors.horizontalCenter:parent.horizontalCenter} + Canvas { + id:canvas + width:320 + height:280 + antialiasing: true + + property int radius: rCtrl.value + property int rectx: rxCtrl.value + property int recty: ryCtrl.value + property int rectWidth: width - 2*rectx + property int rectHeight: height - 2*recty + property string strokeStyle:"blue" + property string fillStyle:"steelblue" + property int lineWidth:lineWidthCtrl.value + property bool fill:true + property bool stroke:true + property real alpha:alphaCtrl.value + + onLineWidthChanged:requestPaint(); + onFillChanged:requestPaint(); + onStrokeChanged:requestPaint(); + onRadiusChanged:requestPaint(); + onRectxChanged:requestPaint(); + onRectyChanged:requestPaint(); + onAlphaChanged:requestPaint(); + + onPaint: { + var ctx = getContext("2d"); + ctx.save(); + ctx.clearRect(0,0,canvas.width, canvas.height); + ctx.strokeStyle = canvas.strokeStyle; + ctx.lineWidth = canvas.lineWidth + ctx.fillStyle = canvas.fillStyle + ctx.globalAlpha = canvas.alpha + ctx.beginPath(); + ctx.moveTo(rectx+radius,recty); // top side + ctx.lineTo(rectx+rectWidth-radius,recty); + // draw top right corner + ctx.arcTo(rectx+rectWidth,recty,rectx+rectWidth,recty+radius,radius); + ctx.lineTo(rectx+rectWidth,recty+rectHeight-radius); // right side + // draw bottom right corner + ctx.arcTo(rectx+rectWidth,recty+rectHeight,rectx+rectWidth-radius,recty+rectHeight,radius); + ctx.lineTo(rectx+radius,recty+rectHeight); // bottom side + // draw bottom left corner + ctx.arcTo(rectx,recty+rectHeight,rectx,recty+rectHeight-radius,radius); + ctx.lineTo(rectx,recty+radius); // left side + // draw top left corner + ctx.arcTo(rectx,recty,rectx+radius,recty,radius); + ctx.closePath(); + if (canvas.fill) + ctx.fill(); + if (canvas.stroke) + ctx.stroke(); + ctx.restore(); + } + } + + Rectangle { + id:controls + width:320 + height:150 + Column { + spacing:3 + Slider {id:lineWidthCtrl; width:300; height:20; min:1; max:10; init:2; name:"Line width"} + Slider {id:rxCtrl; width:300; height:20; min:5; max:30; init:10; name:"rectx"} + Slider {id:ryCtrl; width:300; height:20; min:5; max:30; init:10; name:"recty"} + Slider {id:rCtrl; width:300; height:20; min:10; max:100; init:40; name:"Radius"} + Slider {id:alphaCtrl; width:300; height:20; min:0; max:1; init:1; name:"Alpha"} + } + } + } +} diff --git a/examples/quick/canvas/smile/smile.qml b/examples/quick/canvas/smile/smile.qml new file mode 100644 index 0000000..c8b01b3 --- /dev/null +++ b/examples/quick/canvas/smile/smile.qml @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../contents" +Item { + id:container + width:320 + height:480 + + Column { + spacing:5 + anchors.fill:parent + Text { font.pointSize:15; text:"Smile with arcs"; anchors.horizontalCenter:parent.horizontalCenter} + + Canvas { + id:canvas + width:320 + height:280 + antialiasing: true + + property string strokeStyle:"green" + property string fillStyle:"yellow" + property int lineWidth:lineWidthCtrl.value + property bool fill:true + property bool stroke:true + property real alpha:alphaCtrl.value + property real scaleX : scaleXCtrl.value + property real scaleY : scaleYCtrl.value + property real rotate : rotateCtrl.value + + onLineWidthChanged:requestPaint(); + onFillChanged:requestPaint(); + onStrokeChanged:requestPaint(); + onAlphaChanged:requestPaint(); + onScaleXChanged:requestPaint(); + onScaleYChanged:requestPaint(); + onRotateChanged:requestPaint(); + + Behavior on scaleX { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite } } + Behavior on scaleY { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} } + Behavior on rotate { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} } + + onPaint: { + var ctx = canvas.getContext('2d'); + ctx.save(); + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.globalAlpha = canvas.alpha; + ctx.strokeStyle = canvas.strokeStyle; + ctx.fillStyle = canvas.fillStyle; + ctx.lineWidth = canvas.lineWidth; + ctx.scale(canvas.scaleX, canvas.scaleY); + ctx.rotate(canvas.rotate); + ctx.beginPath(); + ctx.moveTo(75 + 50 * Math.cos(0), + 75 - 50 * Math.sin(Math.PI*2)); + ctx.arc(75,75,50,0,Math.PI*2,true); // Outer circle + ctx.moveTo(75,70); + ctx.arc(75,70,35,0,Math.PI,false); // Mouth (clockwise) + ctx.moveTo(60,65); + ctx.arc(60,65,5,0,Math.PI*2,true); // Left eye + ctx.moveTo(90 + 5 * Math.cos(0), + 65 - 5 * Math.sin(Math.PI*2)); + ctx.moveTo(90,65); + ctx.arc(90,65,5,0,Math.PI*2,true); // Right eye + ctx.closePath(); + if (canvas.fill) + ctx.fill(); + if (canvas.stroke) + ctx.stroke(); + ctx.restore(); + } + } + + Rectangle { + id:controls + width:320 + height:150 + Column { + spacing:3 + Slider {id:lineWidthCtrl; width:300; height:20; min:1; max:10; init:2; name:"Line width"} + Slider {id:scaleXCtrl; width:300; height:20; min:0.1; max:10; init:1; name:"ScaleX"} + Slider {id:scaleYCtrl; width:300; height:20; min:0.1; max:10; init:1; name:"ScaleY"} + Slider {id:rotateCtrl; width:300; height:20; min:0; max:Math.PI*2; init:0; name:"Rotate"} + Slider {id:alphaCtrl; width:300; height:20; min:0; max:1; init:1; name:"Alpha"} + } + } + } +} diff --git a/examples/quick/canvas/squircle/squircle.png b/examples/quick/canvas/squircle/squircle.png new file mode 100644 index 0000000000000000000000000000000000000000..86c69d945fadb453c22cdb56cd5cdd5301c28d36 GIT binary patch literal 771 zcmV+e1N{7nP)P|VECFfcGcKtQ&(wsdrKVq#*7ii#p4A{G`F=H}*}o}LU03LQ2Xo^(@ql@GneUXItw%ZKjTuF|+LmGhz9Mr7%eb1}qcoOh!Xo3gXVfHW>l<>GkD zv!s4t;sDd6a3YbK;NQB+$mD6p; zB9yQY>?B!sXoXnLklI>ot9KymAu2U4Cx8fBA4U~XN1bS{sThS-Wkd2_QnsK_B&Lsy zO16gT9SHJ8cv(`|);TmPQ&L|NZ|#DzN8}$zsV}514+ekqp^(%msCNJ+AE3CG(G_kG zlQAXrj6Pw7C6og}At=@`rM*M0C%EwIs0LhaU0s#EE9?`Ku?Q8s!mi9N)R7yB>m)4J zIHmoiBh(8$`Za71xtxF^_)D~8EW-2EeFTC6{KVs(5mN|@HBPbjxax56+W#fW35=Sk z(bClMf74y9J^0jh-a77dKdxAc&W-g%X}7y?v~R~V_nR))0uj6h`BKV46SJY{Xso9s zwmd100) M=100; + if (N<0.00000000001) M=0.00000000001; + + ctx.save(); + ctx.globalAlpha =canvas.alpha; + ctx.fillStyle = "gray"; + ctx.fillRect(0, 0, canvas.width, canvas.height); + + ctx.strokeStyle = canvas.strokeStyle; + ctx.fillStyle = canvas.fillStyle; + ctx.lineWidth = canvas.lineWidth; + + ctx.beginPath(); + var i = 0, x, y; + for (i=0; i<(2*R+1); i++){ + x = Math.round(i-R) + canvas.px; + y = Math.round(Math.pow(Math.abs(Math.pow(R,M)-Math.pow(Math.abs(i-R),M)),1/M)) + canvas.py; + + if (i == 0) + ctx.moveTo(x, y); + else + ctx.lineTo(x, y); + } + + for (i=(2*R); i<(4*R+1); i++){ + x =Math.round(3*R-i)+canvas.px; + y = Math.round(-Math.pow(Math.abs(Math.pow(R,M)-Math.pow(Math.abs(3*R-i),M)),1/M)) + canvas.py; + ctx.lineTo(x, y); + } + ctx.closePath(); + if (canvas.stroke) { + ctx.stroke(); + } + + if (canvas.fill) { + ctx.fill(); + } + + ctx.fillStyle = "yellow"; + ctx.font = "Helvetica 16px"; + ctx.fillText("|X-" + Math.round(canvas.px) + "|^" + N + " + |Y-"+Math.round(canvas.py)+"|^" + N + " = |" + Math.round(R) + "|^" + N, canvas.px - 125, canvas.py); + ctx.restore(); + } + } + + Rectangle { + id:controls + width:320 + height:150 + Column { + spacing:3 + Slider {id:nCtrl; width:300; height:20; min:1; max:10; init:4; name:"N"} + Slider {id:rCtrl; width:300; height:20; min:30; max:180; init:100; name:"Radius"} + Slider {id:xCtrl; width:300; height:20; min:50; max:300; init:180; name:"X"} + Slider {id:yCtrl; width:300; height:20; min:30; max:300; init:220; name:"Y"} + Slider {id:alphaCtrl; width:300; height:20; min:0; max:1; init:1; name:"Alpha"} + } + } + } +} diff --git a/examples/quick/canvas/tiger/tiger.js b/examples/quick/canvas/tiger/tiger.js new file mode 100644 index 0000000..4be0d26 --- /dev/null +++ b/examples/quick/canvas/tiger/tiger.js @@ -0,0 +1,721 @@ +var tiger = [ + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-122.304 84.285C-122.304 84.285 -122.203 86.179 -123.027 86.16C-123.851 86.141 -140.305 38.066 -160.833 40.309C-160.833 40.309 -143.05 32.956 -122.304 84.285z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-118.774 81.262C-118.774 81.262 -119.323 83.078 -120.092 82.779C-120.86 82.481 -119.977 31.675 -140.043 26.801C-140.043 26.801 -120.82 25.937 -118.774 81.262z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-91.284 123.59C-91.284 123.59 -89.648 124.55 -90.118 125.227C-90.589 125.904 -139.763 113.102 -149.218 131.459C-149.218 131.459 -145.539 112.572 -91.284 123.59z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-94.093 133.801C-94.093 133.801 -92.237 134.197 -92.471 134.988C-92.704 135.779 -143.407 139.121 -146.597 159.522C-146.597 159.522 -149.055 140.437 -94.093 133.801z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-98.304 128.276C-98.304 128.276 -96.526 128.939 -96.872 129.687C-97.218 130.435 -147.866 126.346 -153.998 146.064C-153.998 146.064 -153.646 126.825 -98.304 128.276z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-109.009 110.072C-109.009 110.072 -107.701 111.446 -108.34 111.967C-108.979 112.488 -152.722 86.634 -166.869 101.676C-166.869 101.676 -158.128 84.533 -109.009 110.072z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-116.554 114.263C-116.554 114.263 -115.098 115.48 -115.674 116.071C-116.25 116.661 -162.638 95.922 -174.992 112.469C-174.992 112.469 -168.247 94.447 -116.554 114.263z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-119.154 118.335C-119.154 118.335 -117.546 119.343 -118.036 120.006C-118.526 120.669 -167.308 106.446 -177.291 124.522C-177.291 124.522 -173.066 105.749 -119.154 118.335z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-108.42 118.949C-108.42 118.949 -107.298 120.48 -107.999 120.915C-108.7 121.35 -148.769 90.102 -164.727 103.207C-164.727 103.207 -153.862 87.326 -108.42 118.949z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-128.2 90C-128.2 90 -127.6 91.8 -128.4 92C-129.2 92.2 -157.8 50.2 -177.001 57.8C-177.001 57.8 -161.8 46 -128.2 90z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-127.505 96.979C-127.505 96.979 -126.53 98.608 -127.269 98.975C-128.007 99.343 -164.992 64.499 -182.101 76.061C-182.101 76.061 -169.804 61.261 -127.505 96.979z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.172, + "path":"M-127.62 101.349C-127.62 101.349 -126.498 102.88 -127.199 103.315C-127.9 103.749 -167.969 72.502 -183.927 85.607C-183.927 85.607 -173.062 69.726 -127.62 101.349z"} + , + {"fill": "#ffffff", "stroke":"#000000", + "path":"M-129.83 103.065C-129.327 109.113 -128.339 115.682 -126.6 118.801C-126.6 118.801 -130.2 131.201 -121.4 144.401C-121.4 144.401 -121.8 151.601 -120.2 154.801C-120.2 154.801 -116.2 163.201 -111.4 164.001C-107.516 164.648 -98.793 167.717 -88.932 169.121C-88.932 169.121 -71.8 183.201 -75 196.001C-75 196.001 -75.4 212.401 -79 214.001C-79 214.001 -67.4 202.801 -77 219.601L-81.4 238.401C-81.4 238.401 -55.8 216.801 -71.4 235.201L-81.4 261.201C-81.4 261.201 -61.8 242.801 -69 251.201L-72.2 260.001C-72.2 260.001 -29 232.801 -59.8 262.401C-59.8 262.401 -51.8 258.801 -47.4 261.601C-47.4 261.601 -40.6 260.401 -41.4 262.001C-41.4 262.001 -62.2 272.401 -65.8 290.801C-65.8 290.801 -57.4 280.801 -60.6 291.601L-60.2 303.201C-60.2 303.201 -56.2 281.601 -56.6 319.201C-56.6 319.201 -37.4 301.201 -49 322.001L-49 338.801C-49 338.801 -33.8 322.401 -40.2 335.201C-40.2 335.201 -30.2 326.401 -34.2 341.601C-34.2 341.601 -35 352.001 -30.6 340.801C-30.6 340.801 -14.6 310.201 -20.6 336.401C-20.6 336.401 -21.4 355.601 -16.6 340.801C-16.6 340.801 -16.2 351.201 -7 358.401C-7 358.401 -8.2 307.601 4.6 343.601L8.6 360.001C8.6 360.001 11.4 350.801 11 345.601C11 345.601 25.8 329.201 19 353.601C19 353.601 34.2 330.801 31 344.001C31 344.001 23.4 360.001 25 364.801C25 364.801 41.8 330.001 43 328.401C43 328.401 41 370.802 51.8 334.801C51.8 334.801 57.4 346.801 54.6 351.201C54.6 351.201 62.6 343.201 61.8 340.001C61.8 340.001 66.4 331.801 69.2 345.401C69.2 345.401 71 354.801 72.6 351.601C72.6 351.601 76.6 375.602 77.8 352.801C77.8 352.801 79.4 339.201 72.2 327.601C72.2 327.601 73 324.401 70.2 320.401C70.2 320.401 83.8 342.001 76.6 313.201C76.6 313.201 87.801 321.201 89.001 321.201C89.001 321.201 75.4 298.001 84.2 302.801C84.2 302.801 79 292.401 97.001 304.401C97.001 304.401 81 288.401 98.601 298.001C98.601 298.001 106.601 304.401 99.001 294.401C99.001 294.401 84.6 278.401 106.601 296.401C106.601 296.401 118.201 312.801 119.001 315.601C119.001 315.601 109.001 286.401 104.601 283.601C104.601 283.601 113.001 247.201 154.201 262.801C154.201 262.801 161.001 280.001 165.401 261.601C165.401 261.601 178.201 255.201 189.401 282.801C189.401 282.801 193.401 269.201 192.601 266.401C192.601 266.401 199.401 267.601 198.601 266.401C198.601 266.401 211.801 270.801 213.001 270.001C213.001 270.001 219.801 276.801 220.201 273.201C220.201 273.201 229.401 276.001 227.401 272.401C227.401 272.401 236.201 288.001 236.601 291.601L239.001 277.601L241.001 280.401C241.001 280.401 242.601 272.801 241.801 271.601C241.001 270.401 261.801 278.401 266.601 299.201L268.601 307.601C268.601 307.601 274.601 292.801 273.001 288.801C273.001 288.801 278.201 289.601 278.601 294.001C278.601 294.001 282.601 270.801 277.801 264.801C277.801 264.801 282.201 264.001 283.401 267.601L283.401 260.401C283.401 260.401 290.601 261.201 290.601 258.801C290.601 258.801 295.001 254.801 297.001 259.601C297.001 259.601 284.601 224.401 303.001 243.601C303.001 243.601 310.201 254.401 306.601 235.601C303.001 216.801 299.001 215.201 303.801 214.801C303.801 214.801 304.601 211.201 302.601 209.601C300.601 208.001 303.801 209.601 303.801 209.601C303.801 209.601 308.601 213.601 303.401 191.601C303.401 191.601 309.801 193.201 297.801 164.001C297.801 164.001 300.601 161.601 296.601 153.201C296.601 153.201 304.601 157.601 307.401 156.001C307.401 156.001 307.001 154.401 303.801 150.401C303.801 150.401 282.201 95.6 302.601 117.601C302.601 117.601 314.451 131.151 308.051 108.351C308.051 108.351 298.94 84.341 299.717 80.045L-129.83 103.065z"} + , + {"fill": "#cc7226", "stroke":"#000000", + "path":"M299.717 80.245C300.345 80.426 302.551 81.55 303.801 83.2C303.801 83.2 310.601 94 305.401 75.6C305.401 75.6 296.201 46.8 305.001 58C305.001 58 311.001 65.2 307.801 51.6C303.936 35.173 301.401 28.8 301.401 28.8C301.401 28.8 313.001 33.6 286.201 -6L295.001 -2.4C295.001 -2.4 275.401 -42 253.801 -47.2L245.801 -53.2C245.801 -53.2 284.201 -91.2 271.401 -128C271.401 -128 264.601 -133.2 255.001 -124C255.001 -124 248.601 -119.2 242.601 -120.8C242.601 -120.8 211.801 -119.6 209.801 -119.6C207.801 -119.6 173.001 -156.8 107.401 -139.2C107.401 -139.2 102.201 -137.2 97.801 -138.4C97.801 -138.4 79.4 -154.4 30.6 -131.6C30.6 -131.6 20.6 -129.6 19 -129.6C17.4 -129.6 14.6 -129.6 6.6 -123.2C-1.4 -116.8 -1.8 -116 -3.8 -114.4C-3.8 -114.4 -20.2 -103.2 -25 -102.4C-25 -102.4 -36.6 -96 -41 -86L-44.6 -84.8C-44.6 -84.8 -46.2 -77.6 -46.6 -76.4C-46.6 -76.4 -51.4 -72.8 -52.2 -67.2C-52.2 -67.2 -61 -61.2 -60.6 -56.8C-60.6 -56.8 -62.2 -51.6 -63 -46.8C-63 -46.8 -70.2 -42 -69.4 -39.2C-69.4 -39.2 -77 -25.2 -75.8 -18.4C-75.8 -18.4 -82.2 -18.8 -85 -16.4C-85 -16.4 -85.8 -11.6 -87.4 -11.2C-87.4 -11.2 -90.2 -10 -87.8 -6C-87.8 -6 -89.4 -3.2 -89.8 -1.6C-89.8 -1.6 -89 1.2 -93.4 6.8C-93.4 6.8 -99.8 25.6 -97.8 30.8C-97.8 30.8 -97.4 35.6 -100.2 37.2C-100.2 37.2 -103.8 36.8 -95.4 48.8C-95.4 48.8 -94.6 50 -97.8 52.4C-97.8 52.4 -115 56 -117.4 72.4C-117.4 72.4 -131 87.2 -131 92.4C-131 94.705 -130.729 97.852 -130.03 102.465C-130.03 102.465 -130.6 110.801 -103 111.601C-75.4 112.401 299.717 80.245 299.717 80.245z"} + , + {"fill": "#cc7226", + "path":"M-115.6 102.6C-140.6 63.2 -126.2 119.601 -126.2 119.601C-117.4 154.001 12.2 116.401 12.2 116.401C12.2 116.401 181.001 86 192.201 82C203.401 78 298.601 84.4 298.601 84.4L293.001 67.6C228.201 21.2 209.001 44.4 195.401 40.4C181.801 36.4 184.201 46 181.001 46.8C177.801 47.6 138.601 22.8 132.201 23.6C125.801 24.4 100.459 0.649 115.401 32.4C131.401 66.4 57 71.6 40.2 60.4C23.4 49.2 47.4 78.8 47.4 78.8C65.8 98.8 31.4 82 31.4 82C-3 69.2 -27 94.8 -30.2 95.6C-33.4 96.4 -38.2 99.6 -39 93.2C-39.8 86.8 -47.31 70.099 -79 96.4C-99 113.001 -112.8 91 -112.8 91L-115.6 102.6z"} + , + {"fill": "#e87f3a", + "path":"M133.51 25.346C127.11 26.146 101.743 2.407 116.71 34.146C133.31 69.346 58.31 73.346 41.51 62.146C24.709 50.946 48.71 80.546 48.71 80.546C67.11 100.546 32.709 83.746 32.709 83.746C-1.691 70.946 -25.691 96.546 -28.891 97.346C-32.091 98.146 -36.891 101.346 -37.691 94.946C-38.491 88.546 -45.87 72.012 -77.691 98.146C-98.927 115.492 -112.418 94.037 -112.418 94.037L-115.618 104.146C-140.618 64.346 -125.546 122.655 -125.546 122.655C-116.745 157.056 13.509 118.146 13.509 118.146C13.509 118.146 182.31 87.746 193.51 83.746C204.71 79.746 299.038 86.073 299.038 86.073L293.51 68.764C228.71 22.364 210.31 46.146 196.71 42.146C183.11 38.146 185.51 47.746 182.31 48.546C179.11 49.346 139.91 24.546 133.51 25.346z"} + , + {"fill": "#ea8c4d", + "path":"M134.819 27.091C128.419 27.891 103.685 3.862 118.019 35.891C134.219 72.092 59.619 75.092 42.819 63.892C26.019 52.692 50.019 82.292 50.019 82.292C68.419 102.292 34.019 85.492 34.019 85.492C-0.381 72.692 -24.382 98.292 -27.582 99.092C-30.782 99.892 -35.582 103.092 -36.382 96.692C-37.182 90.292 -44.43 73.925 -76.382 99.892C-98.855 117.983 -112.036 97.074 -112.036 97.074L-115.636 105.692C-139.436 66.692 -124.891 125.71 -124.891 125.71C-116.091 160.11 14.819 119.892 14.819 119.892C14.819 119.892 183.619 89.492 194.819 85.492C206.019 81.492 299.474 87.746 299.474 87.746L294.02 69.928C229.219 23.528 211.619 47.891 198.019 43.891C184.419 39.891 186.819 49.491 183.619 50.292C180.419 51.092 141.219 26.291 134.819 27.091z"} + , + {"fill": "#ec9961", + "path":"M136.128 28.837C129.728 29.637 104.999 5.605 119.328 37.637C136.128 75.193 60.394 76.482 44.128 65.637C27.328 54.437 51.328 84.037 51.328 84.037C69.728 104.037 35.328 87.237 35.328 87.237C0.928 74.437 -23.072 100.037 -26.272 100.837C-29.472 101.637 -34.272 104.837 -35.072 98.437C-35.872 92.037 -42.989 75.839 -75.073 101.637C-98.782 120.474 -111.655 100.11 -111.655 100.11L-115.655 107.237C-137.455 70.437 -124.236 128.765 -124.236 128.765C-115.436 163.165 16.128 121.637 16.128 121.637C16.128 121.637 184.928 91.237 196.129 87.237C207.329 83.237 299.911 89.419 299.911 89.419L294.529 71.092C229.729 24.691 212.929 49.637 199.329 45.637C185.728 41.637 188.128 51.237 184.928 52.037C181.728 52.837 142.528 28.037 136.128 28.837z"} + , + {"fill": "#eea575", + "path":"M137.438 30.583C131.037 31.383 106.814 7.129 120.637 39.383C137.438 78.583 62.237 78.583 45.437 67.383C28.637 56.183 52.637 85.783 52.637 85.783C71.037 105.783 36.637 88.983 36.637 88.983C2.237 76.183 -21.763 101.783 -24.963 102.583C-28.163 103.383 -32.963 106.583 -33.763 100.183C-34.563 93.783 -41.548 77.752 -73.763 103.383C-98.709 122.965 -111.273 103.146 -111.273 103.146L-115.673 108.783C-135.473 73.982 -123.582 131.819 -123.582 131.819C-114.782 166.22 17.437 123.383 17.437 123.383C17.437 123.383 186.238 92.983 197.438 88.983C208.638 84.983 300.347 91.092 300.347 91.092L295.038 72.255C230.238 25.855 214.238 51.383 200.638 47.383C187.038 43.383 189.438 52.983 186.238 53.783C183.038 54.583 143.838 29.783 137.438 30.583z"} + , + {"fill": "#f1b288", + "path":"M138.747 32.328C132.347 33.128 106.383 9.677 121.947 41.128C141.147 79.928 63.546 80.328 46.746 69.128C29.946 57.928 53.946 87.528 53.946 87.528C72.346 107.528 37.946 90.728 37.946 90.728C3.546 77.928 -20.454 103.528 -23.654 104.328C-26.854 105.128 -31.654 108.328 -32.454 101.928C-33.254 95.528 -40.108 79.665 -72.454 105.128C-98.636 125.456 -110.891 106.183 -110.891 106.183L-115.691 110.328C-133.691 77.128 -122.927 134.874 -122.927 134.874C-114.127 169.274 18.746 125.128 18.746 125.128C18.746 125.128 187.547 94.728 198.747 90.728C209.947 86.728 300.783 92.764 300.783 92.764L295.547 73.419C230.747 27.019 215.547 53.128 201.947 49.128C188.347 45.128 190.747 54.728 187.547 55.528C184.347 56.328 145.147 31.528 138.747 32.328z"} + , + {"fill": "#f3bf9c", + "path":"M140.056 34.073C133.655 34.873 107.313 11.613 123.255 42.873C143.656 82.874 64.855 82.074 48.055 70.874C31.255 59.674 55.255 89.274 55.255 89.274C73.655 109.274 39.255 92.474 39.255 92.474C4.855 79.674 -19.145 105.274 -22.345 106.074C-25.545 106.874 -30.345 110.074 -31.145 103.674C-31.945 97.274 -38.668 81.578 -71.145 106.874C-98.564 127.947 -110.509 109.219 -110.509 109.219L-115.709 111.874C-131.709 81.674 -122.273 137.929 -122.273 137.929C-113.473 172.329 20.055 126.874 20.055 126.874C20.055 126.874 188.856 96.474 200.056 92.474C211.256 88.474 301.22 94.437 301.22 94.437L296.056 74.583C231.256 28.183 216.856 54.874 203.256 50.874C189.656 46.873 192.056 56.474 188.856 57.274C185.656 58.074 146.456 33.273 140.056 34.073z"} + , + {"fill": "#f5ccb0", + "path":"M141.365 35.819C134.965 36.619 107.523 13.944 124.565 44.619C146.565 84.219 66.164 83.819 49.364 72.619C32.564 61.419 56.564 91.019 56.564 91.019C74.964 111.019 40.564 94.219 40.564 94.219C6.164 81.419 -17.836 107.019 -21.036 107.819C-24.236 108.619 -29.036 111.819 -29.836 105.419C-30.636 99.019 -37.227 83.492 -69.836 108.619C-98.491 130.438 -110.127 112.256 -110.127 112.256L-115.727 113.419C-130.128 85.019 -121.618 140.983 -121.618 140.983C-112.818 175.384 21.364 128.619 21.364 128.619C21.364 128.619 190.165 98.219 201.365 94.219C212.565 90.219 301.656 96.11 301.656 96.11L296.565 75.746C231.765 29.346 218.165 56.619 204.565 52.619C190.965 48.619 193.365 58.219 190.165 59.019C186.965 59.819 147.765 35.019 141.365 35.819z"} + , + {"fill": "#f8d8c4", + "path":"M142.674 37.565C136.274 38.365 108.832 15.689 125.874 46.365C147.874 85.965 67.474 85.565 50.674 74.365C33.874 63.165 57.874 92.765 57.874 92.765C76.274 112.765 41.874 95.965 41.874 95.965C7.473 83.165 -16.527 108.765 -19.727 109.565C-22.927 110.365 -27.727 113.565 -28.527 107.165C-29.327 100.765 -35.786 85.405 -68.527 110.365C-98.418 132.929 -109.745 115.293 -109.745 115.293L-115.745 114.965C-129.346 88.564 -120.963 144.038 -120.963 144.038C-112.163 178.438 22.673 130.365 22.673 130.365C22.673 130.365 191.474 99.965 202.674 95.965C213.874 91.965 302.093 97.783 302.093 97.783L297.075 76.91C232.274 30.51 219.474 58.365 205.874 54.365C192.274 50.365 194.674 59.965 191.474 60.765C188.274 61.565 149.074 36.765 142.674 37.565z"} + , + {"fill": "#fae5d7", + "path":"M143.983 39.31C137.583 40.11 110.529 17.223 127.183 48.11C149.183 88.91 68.783 87.31 51.983 76.11C35.183 64.91 59.183 94.51 59.183 94.51C77.583 114.51 43.183 97.71 43.183 97.71C8.783 84.91 -15.217 110.51 -18.417 111.31C-21.618 112.11 -26.418 115.31 -27.218 108.91C-28.018 102.51 -34.346 87.318 -67.218 112.11C-98.345 135.42 -109.363 118.329 -109.363 118.329L-115.764 116.51C-128.764 92.51 -120.309 147.093 -120.309 147.093C-111.509 181.493 23.983 132.11 23.983 132.11C23.983 132.11 192.783 101.71 203.983 97.71C215.183 93.71 302.529 99.456 302.529 99.456L297.583 78.074C232.783 31.673 220.783 60.11 207.183 56.11C193.583 52.11 195.983 61.71 192.783 62.51C189.583 63.31 150.383 38.51 143.983 39.31z"} + , + {"fill": "#fcf2eb", + "path":"M145.292 41.055C138.892 41.855 112.917 18.411 128.492 49.855C149.692 92.656 70.092 89.056 53.292 77.856C36.492 66.656 60.492 96.256 60.492 96.256C78.892 116.256 44.492 99.456 44.492 99.456C10.092 86.656 -13.908 112.256 -17.108 113.056C-20.308 113.856 -25.108 117.056 -25.908 110.656C-26.708 104.256 -32.905 89.232 -65.908 113.856C-98.273 137.911 -108.982 121.365 -108.982 121.365L-115.782 118.056C-128.582 94.856 -119.654 150.147 -119.654 150.147C-110.854 184.547 25.292 133.856 25.292 133.856C25.292 133.856 194.093 103.456 205.293 99.456C216.493 95.456 302.965 101.128 302.965 101.128L298.093 79.237C233.292 32.837 222.093 61.856 208.493 57.856C194.893 53.855 197.293 63.456 194.093 64.256C190.892 65.056 151.692 40.255 145.292 41.055z"} + , + {"fill": "#ffffff", + "path":"M-115.8 119.601C-128.6 97.6 -119 153.201 -119 153.201C-110.2 187.601 26.6 135.601 26.6 135.601C26.6 135.601 195.401 105.2 206.601 101.2C217.801 97.2 303.401 102.8 303.401 102.8L298.601 80.4C233.801 34 223.401 63.6 209.801 59.6C196.201 55.6 198.601 65.2 195.401 66C192.201 66.8 153.001 42 146.601 42.8C140.201 43.6 114.981 19.793 129.801 51.6C152.028 99.307 69.041 89.227 54.6 79.6C37.8 68.4 61.8 98 61.8 98C80.2 118.001 45.8 101.2 45.8 101.2C11.4 88.4 -12.6 114.001 -15.8 114.801C-19 115.601 -23.8 118.801 -24.6 112.401C-25.4 106 -31.465 91.144 -64.6 115.601C-98.2 140.401 -108.6 124.401 -108.6 124.401L-115.8 119.601z"} + , + {"fill": "#000000", + "path":"M-74.2 149.601C-74.2 149.601 -81.4 161.201 -60.6 174.401C-60.6 174.401 -59.2 175.801 -77.2 171.601C-77.2 171.601 -83.4 169.601 -85 159.201C-85 159.201 -89.8 154.801 -94.6 149.201C-99.4 143.601 -74.2 149.601 -74.2 149.601z"} + , + {"fill": "#cccccc", + "path":"M65.8 102C65.8 102 83.498 128.821 82.9 133.601C81.6 144.001 81.4 153.601 84.6 157.601C87.801 161.601 96.601 194.801 96.601 194.801C96.601 194.801 96.201 196.001 108.601 158.001C108.601 158.001 120.201 142.001 100.201 123.601C100.201 123.601 65 94.8 65.8 102z"} + , + {"fill": "#000000", + "path":"M-54.2 176.401C-54.2 176.401 -43 183.601 -57.4 214.801L-51 212.401C-51 212.401 -51.8 223.601 -55 226.001L-47.8 222.801C-47.8 222.801 -43 230.801 -47 235.601C-47 235.601 -30.2 243.601 -31 250.001C-31 250.001 -24.6 242.001 -28.6 235.601C-32.6 229.201 -39.8 233.201 -39 214.801L-47.8 218.001C-47.8 218.001 -42.2 209.201 -42.2 202.801L-50.2 205.201C-50.2 205.201 -34.731 178.623 -45.4 177.201C-51.4 176.401 -54.2 176.401 -54.2 176.401z"} + , + {"fill": "#cccccc", + "path":"M-21.8 193.201C-21.8 193.201 -19 188.801 -21.8 189.601C-24.6 190.401 -55.8 205.201 -61.8 214.801C-61.8 214.801 -27.4 190.401 -21.8 193.201z"} + , + {"fill": "#cccccc", + "path":"M-11.4 201.201C-11.4 201.201 -8.6 196.801 -11.4 197.601C-14.2 198.401 -45.4 213.201 -51.4 222.801C-51.4 222.801 -17 198.401 -11.4 201.201z"} + , + {"fill": "#cccccc", + "path":"M1.8 186.001C1.8 186.001 4.6 181.601 1.8 182.401C-1 183.201 -32.2 198.001 -38.2 207.601C-38.2 207.601 -3.8 183.201 1.8 186.001z"} + , + {"fill": "#cccccc", + "path":"M-21.4 229.601C-21.4 229.601 -21.4 223.601 -24.2 224.401C-27 225.201 -63 242.801 -69 252.401C-69 252.401 -27 226.801 -21.4 229.601z"} + , + {"fill": "#cccccc", + "path":"M-20.2 218.801C-20.2 218.801 -19 214.001 -21.8 214.801C-23.8 214.801 -50.2 226.401 -56.2 236.001C-56.2 236.001 -26.6 214.401 -20.2 218.801z"} + , + {"fill": "#cccccc", + "path":"M-34.6 266.401L-44.6 274.001C-44.6 274.001 -34.2 266.401 -30.6 267.601C-30.6 267.601 -37.4 278.801 -38.2 284.001C-38.2 284.001 -27.8 271.201 -22.2 271.601C-22.2 271.601 -14.6 272.001 -14.6 282.801C-14.6 282.801 -9 272.401 -5.8 272.801C-5.8 272.801 -4.6 279.201 -5.8 286.001C-5.8 286.001 -1.8 278.401 2.2 280.001C2.2 280.001 8.6 278.001 7.8 289.601C7.8 289.601 7.8 300.001 7 302.801C7 302.801 12.6 276.401 15 276.001C15 276.001 23 274.801 27.8 283.601C27.8 283.601 23.8 276.001 28.6 278.001C28.6 278.001 39.4 279.601 42.6 286.401C42.6 286.401 35.8 274.401 41.4 277.601C41.4 277.601 48.2 277.601 49.4 284.001C49.4 284.001 57.8 305.201 59.8 306.801C59.8 306.801 52.2 285.201 53.8 285.201C53.8 285.201 51.8 273.201 57 288.001C57 288.001 53.8 274.001 59.4 274.801C65 275.601 69.4 285.601 77.8 283.201C77.8 283.201 87.401 288.801 89.401 219.601L-34.6 266.401z"} + , + {"fill": "#000000", + "path":"M-29.8 173.601C-29.8 173.601 -15 167.601 25 173.601C25 173.601 32.2 174.001 39 165.201C45.8 156.401 72.6 149.201 79 151.201L88.601 157.601L89.401 158.801C89.401 158.801 101.801 169.201 102.201 176.801C102.601 184.401 87.801 232.401 78.2 248.401C68.6 264.401 59 276.801 39.8 274.401C39.8 274.401 19 270.401 -6.6 274.401C-6.6 274.401 -35.8 272.801 -38.6 264.801C-41.4 256.801 -27.4 241.601 -27.4 241.601C-27.4 241.601 -23 233.201 -24.2 218.801C-25.4 204.401 -25 176.401 -29.8 173.601z"} + , + {"fill": "#e5668c", + "path":"M-7.8 175.601C0.6 194.001 -29 259.201 -29 259.201C-31 260.801 -16.34 266.846 -6.2 264.401C4.746 261.763 45 266.001 45 266.001C68.6 250.401 81.4 206.001 81.4 206.001C81.4 206.001 91.801 182.001 74.2 178.801C56.6 175.601 -7.8 175.601 -7.8 175.601z"} + , + {"fill": "#b23259", + "path":"M-9.831 206.497C-6.505 193.707 -4.921 181.906 -7.8 175.601C-7.8 175.601 54.6 182.001 65.8 161.201C70.041 153.326 84.801 184.001 84.4 193.601C84.4 193.601 21.4 208.001 6.6 196.801L-9.831 206.497z"} + , + {"fill": "#a5264c", + "path":"M-5.4 222.801C-5.4 222.801 -3.4 230.001 -5.8 234.001C-5.8 234.001 -7.4 234.801 -8.6 235.201C-8.6 235.201 -7.4 238.801 -1.4 240.401C-1.4 240.401 0.6 244.801 3 245.201C5.4 245.601 10.2 251.201 14.2 250.001C18.2 248.801 29.4 244.801 29.4 244.801C29.4 244.801 35 241.601 43.8 245.201C43.8 245.201 46.175 244.399 46.6 240.401C47.1 235.701 50.2 232.001 52.2 230.001C54.2 228.001 63.8 215.201 62.6 214.801C61.4 214.401 -5.4 222.801 -5.4 222.801z"} + , + {"fill": "#ff727f", "stroke":"#000000", + "path":"M-9.8 174.401C-9.8 174.401 -12.6 196.801 -9.4 205.201C-6.2 213.601 -7 215.601 -7.8 219.601C-8.6 223.601 -4.2 233.601 1.4 239.601L13.4 241.201C13.4 241.201 28.6 237.601 37.8 240.401C37.8 240.401 46.794 241.744 50.2 226.801C50.2 226.801 55 220.401 62.2 217.601C69.4 214.801 76.6 173.201 72.6 165.201C68.6 157.201 54.2 152.801 38.2 168.401C22.2 184.001 20.2 167.201 -9.8 174.401z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-8.2 249.201C-8.2 249.201 -9 247.201 -13.4 246.801C-13.4 246.801 -35.8 243.201 -44.2 230.801C-44.2 230.801 -51 225.201 -46.6 236.801C-46.6 236.801 -36.2 257.201 -29.4 260.001C-29.4 260.001 -13 264.001 -8.2 249.201z"} + , + {"fill": "#cc3f4c", + "path":"M71.742 185.229C72.401 177.323 74.354 168.709 72.6 165.201C66.154 152.307 49.181 157.695 38.2 168.401C22.2 184.001 20.2 167.201 -9.8 174.401C-9.8 174.401 -11.545 188.364 -10.705 198.376C-10.705 198.376 26.6 186.801 27.4 192.401C27.4 192.401 29 189.201 38.2 189.201C47.4 189.201 70.142 188.029 71.742 185.229z"} + , + {"stroke":"#a51926", "width":2, + "path":"M28.6 175.201C28.6 175.201 33.4 180.001 29.8 189.601C29.8 189.601 15.4 205.601 17.4 219.601"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-19.4 260.001C-19.4 260.001 -23.8 247.201 -15 254.001C-15 254.001 -10.2 256.001 -11.4 257.601C-12.6 259.201 -18.2 263.201 -19.4 260.001z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-14.36 261.201C-14.36 261.201 -17.88 250.961 -10.84 256.401C-10.84 256.401 -6.419 258.849 -7.96 259.281C-12.52 260.561 -7.96 263.121 -14.36 261.201z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-9.56 261.201C-9.56 261.201 -13.08 250.961 -6.04 256.401C-6.04 256.401 -1.665 258.711 -3.16 259.281C-6.52 260.561 -3.16 263.121 -9.56 261.201z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-2.96 261.401C-2.96 261.401 -6.48 251.161 0.56 256.601C0.56 256.601 4.943 258.933 3.441 259.481C0.48 260.561 3.441 263.321 -2.96 261.401z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M3.52 261.321C3.52 261.321 0 251.081 7.041 256.521C7.041 256.521 10.881 258.121 9.921 259.401C8.961 260.681 9.921 263.241 3.52 261.321z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M10.2 262.001C10.2 262.001 5.4 249.601 14.6 256.001C14.6 256.001 19.4 258.001 18.2 259.601C17 261.201 18.2 264.401 10.2 262.001z"} + , + {"stroke":"#a5264c", "width":2, + "path":"M-18.2 244.801C-18.2 244.801 -5 242.001 1 245.201C1 245.201 7 246.401 8.2 246.001C9.4 245.601 12.6 245.201 12.6 245.201"} + , + {"stroke":"#a5264c", "width":2, + "path":"M15.8 253.601C15.8 253.601 27.8 240.001 39.8 244.401C46.816 246.974 45.8 243.601 46.6 240.801C47.4 238.001 47.6 233.801 52.6 230.801"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M33 237.601C33 237.601 29 226.801 26.2 239.601C23.4 252.401 20.2 256.001 18.6 258.801C18.6 258.801 18.6 264.001 27 263.601C27 263.601 37.8 263.201 38.2 260.401C38.6 257.601 37 246.001 33 237.601z"} + , + {"stroke":"#a5264c", "width":2, + "path":"M47 244.801C47 244.801 50.6 242.401 53 243.601"} + , + {"stroke":"#a5264c", "width":2, + "path":"M53.5 228.401C53.5 228.401 56.4 223.501 61.2 222.701"} + , + {"fill": "#b2b2b2", + "path":"M-25.8 265.201C-25.8 265.201 -7.8 268.401 -3.4 266.801C-3.4 266.801 5.4 266.801 -3 268.801C-3 268.801 -15.8 268.801 -23.8 267.601C-23.8 267.601 -35.4 262.001 -25.8 265.201z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-11.8 172.001C-11.8 172.001 5.8 172.001 7.8 172.801C7.8 172.801 15 203.601 11.4 211.201C11.4 211.201 10.2 214.001 7.4 208.401C7.4 208.401 -11 175.601 -14.2 173.601C-17.4 171.601 -13 172.001 -11.8 172.001z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-88.9 169.301C-88.9 169.301 -80 171.001 -67.4 173.601C-67.4 173.601 -62.6 196.001 -59.4 200.801C-56.2 205.601 -59.8 205.601 -63.4 202.801C-67 200.001 -81.8 186.001 -83.8 181.601C-85.8 177.201 -88.9 169.301 -88.9 169.301z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-67.039 173.818C-67.039 173.818 -61.239 175.366 -60.23 177.581C-59.222 179.795 -61.432 183.092 -61.432 183.092C-61.432 183.092 -62.432 186.397 -63.634 184.235C-64.836 182.072 -67.708 174.412 -67.039 173.818z"} + , + {"fill": "#000000", + "path":"M-67 173.601C-67 173.601 -63.4 178.801 -59.8 178.801C-56.2 178.801 -55.818 178.388 -53 179.001C-48.4 180.001 -48.8 178.001 -42.2 179.201C-39.56 179.681 -37 178.801 -34.2 180.001C-31.4 181.201 -28.2 180.401 -27 178.401C-25.8 176.401 -21 172.201 -21 172.201C-21 172.201 -33.8 174.001 -36.6 174.801C-36.6 174.801 -59 176.001 -67 173.601z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-22.4 173.801C-22.4 173.801 -28.85 177.301 -29.25 179.701C-29.65 182.101 -24 185.801 -24 185.801C-24 185.801 -21.25 190.401 -20.65 188.001C-20.05 185.601 -21.6 174.201 -22.4 173.801z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-59.885 179.265C-59.885 179.265 -52.878 190.453 -52.661 179.242C-52.661 179.242 -52.104 177.984 -53.864 177.962C-59.939 177.886 -58.418 173.784 -59.885 179.265z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-52.707 179.514C-52.707 179.514 -44.786 190.701 -45.422 179.421C-45.422 179.421 -45.415 179.089 -47.168 178.936C-51.915 178.522 -51.57 174.004 -52.707 179.514z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-45.494 179.522C-45.494 179.522 -37.534 190.15 -38.203 180.484C-38.203 180.484 -38.084 179.251 -39.738 178.95C-43.63 178.244 -43.841 174.995 -45.494 179.522z"} + , + {"fill": "#ffffcc", "stroke":"#000000", "width":0.5, + "path":"M-38.618 179.602C-38.618 179.602 -30.718 191.163 -30.37 181.382C-30.37 181.382 -28.726 180.004 -30.472 179.782C-36.29 179.042 -35.492 174.588 -38.618 179.602z"} + , + {"fill": "#e5e5b2", + "path":"M-74.792 183.132L-82.45 181.601C-85.05 176.601 -87.15 170.451 -87.15 170.451C-87.15 170.451 -80.8 171.451 -68.3 174.251C-68.3 174.251 -67.424 177.569 -65.952 183.364L-74.792 183.132z"} + , + {"fill": "#e5e5b2", + "path":"M-9.724 178.47C-11.39 175.964 -12.707 174.206 -13.357 173.8C-16.37 171.917 -12.227 172.294 -11.098 172.294C-11.098 172.294 5.473 172.294 7.356 173.047C7.356 173.047 7.88 175.289 8.564 178.68C8.564 178.68 -1.524 176.67 -9.724 178.47z"} + , + {"fill": "#cc7226", + "path":"M43.88 40.321C71.601 44.281 97.121 8.641 98.881 -1.04C100.641 -10.72 90.521 -22.6 90.521 -22.6C91.841 -25.68 87.001 -39.76 81.721 -49C76.441 -58.24 60.54 -57.266 43 -58.24C27.16 -59.12 8.68 -35.8 7.36 -34.04C6.04 -32.28 12.2 6.001 13.52 11.721C14.84 17.441 12.2 43.841 12.2 43.841C46.44 34.741 16.16 36.361 43.88 40.321z"} + , + {"fill": "#ea8e51", + "path":"M8.088 -33.392C6.792 -31.664 12.84 5.921 14.136 11.537C15.432 17.153 12.84 43.073 12.84 43.073C45.512 34.193 16.728 35.729 43.944 39.617C71.161 43.505 96.217 8.513 97.945 -0.992C99.673 -10.496 89.737 -22.16 89.737 -22.16C91.033 -25.184 86.281 -39.008 81.097 -48.08C75.913 -57.152 60.302 -56.195 43.08 -57.152C27.528 -58.016 9.384 -35.12 8.088 -33.392z"} + , + {"fill": "#efaa7c", + "path":"M8.816 -32.744C7.544 -31.048 13.48 5.841 14.752 11.353C16.024 16.865 13.48 42.305 13.48 42.305C44.884 33.145 17.296 35.097 44.008 38.913C70.721 42.729 95.313 8.385 97.009 -0.944C98.705 -10.272 88.953 -21.72 88.953 -21.72C90.225 -24.688 85.561 -38.256 80.473 -47.16C75.385 -56.064 60.063 -55.125 43.16 -56.064C27.896 -56.912 10.088 -34.44 8.816 -32.744z"} + , + {"fill": "#f4c6a8", + "path":"M9.544 -32.096C8.296 -30.432 14.12 5.761 15.368 11.169C16.616 16.577 14.12 41.537 14.12 41.537C43.556 32.497 17.864 34.465 44.072 38.209C70.281 41.953 94.409 8.257 96.073 -0.895C97.737 -10.048 88.169 -21.28 88.169 -21.28C89.417 -24.192 84.841 -37.504 79.849 -46.24C74.857 -54.976 59.824 -54.055 43.24 -54.976C28.264 -55.808 10.792 -33.76 9.544 -32.096z"} + , + {"fill": "#f9e2d3", + "path":"M10.272 -31.448C9.048 -29.816 14.76 5.681 15.984 10.985C17.208 16.289 14.76 40.769 14.76 40.769C42.628 31.849 18.432 33.833 44.136 37.505C69.841 41.177 93.505 8.129 95.137 -0.848C96.769 -9.824 87.385 -20.84 87.385 -20.84C88.609 -23.696 84.121 -36.752 79.225 -45.32C74.329 -53.888 59.585 -52.985 43.32 -53.888C28.632 -54.704 11.496 -33.08 10.272 -31.448z"} + , + {"fill": "#ffffff", + "path":"M44.2 36.8C69.4 40.4 92.601 8 94.201 -0.8C95.801 -9.6 86.601 -20.4 86.601 -20.4C87.801 -23.2 83.4 -36 78.6 -44.4C73.8 -52.8 59.346 -51.914 43.4 -52.8C29 -53.6 12.2 -32.4 11 -30.8C9.8 -29.2 15.4 5.6 16.6 10.8C17.8 16 15.4 40 15.4 40C40.9 31.4 19 33.2 44.2 36.8z"} + , + {"fill": "#cccccc", + "path":"M90.601 2.8C90.601 2.8 62.8 10.4 51.2 8.8C51.2 8.8 35.4 2.2 26.6 24C26.6 24 23 31.2 21 33.2C19 35.2 90.601 2.8 90.601 2.8z"} + , + {"fill": "#000000", + "path":"M94.401 0.6C94.401 0.6 65.4 12.8 55.4 12.4C55.4 12.4 39 7.8 30.6 22.4C30.6 22.4 22.2 31.6 19 33.2C19 33.2 18.6 34.8 25 30.8L35.4 36C35.4 36 50.2 45.6 59.8 29.6C59.8 29.6 63.8 18.4 63.8 16.4C63.8 14.4 85 8.8 86.601 8.4C88.201 8 94.801 3.8 94.401 0.6z"} + , + {"fill": "#99cc32", + "path":"M47 36.514C40.128 36.514 31.755 32.649 31.755 26.4C31.755 20.152 40.128 13.887 47 13.887C53.874 13.887 59.446 18.952 59.446 25.2C59.446 31.449 53.874 36.514 47 36.514z"} + , + {"fill": "#659900", + "path":"M43.377 19.83C38.531 20.552 33.442 22.055 33.514 21.839C35.054 17.22 41.415 13.887 47 13.887C51.296 13.887 55.084 15.865 57.32 18.875C57.32 18.875 52.004 18.545 43.377 19.83z"} + , + {"fill": "#ffffff", + "path":"M55.4 19.6C55.4 19.6 51 16.4 51 18.6C51 18.6 54.6 23 55.4 19.6z"} + , + {"fill": "#000000", + "path":"M45.4 27.726C42.901 27.726 40.875 25.7 40.875 23.2C40.875 20.701 42.901 18.675 45.4 18.675C47.9 18.675 49.926 20.701 49.926 23.2C49.926 25.7 47.9 27.726 45.4 27.726z"} + , + {"fill": "#cc7226", + "path":"M-58.6 14.4C-58.6 14.4 -61.8 -6.8 -59.4 -11.2C-59.4 -11.2 -48.6 -21.2 -49 -24.8C-49 -24.8 -49.4 -42.8 -50.6 -43.6C-51.8 -44.4 -59.4 -50.4 -65.4 -44C-65.4 -44 -75.8 -26 -75 -19.6L-75 -17.6C-75 -17.6 -82.6 -18 -84.2 -16C-84.2 -16 -85.4 -10.8 -86.6 -10.4C-86.6 -10.4 -89.4 -8 -87.4 -5.2C-87.4 -5.2 -89.4 -2.8 -89 1.2L-81.4 5.2C-81.4 5.2 -79.4 19.6 -68.6 24.8C-63.764 27.129 -60.6 20.4 -58.6 14.4z"} + , + {"fill": "#ffffff", + "path":"M-59.6 12.56C-59.6 12.56 -62.48 -6.52 -60.32 -10.48C-60.32 -10.48 -50.6 -19.48 -50.96 -22.72C-50.96 -22.72 -51.32 -38.92 -52.4 -39.64C-53.48 -40.36 -60.32 -45.76 -65.72 -40C-65.72 -40 -75.08 -23.8 -74.36 -18.04L-74.36 -16.24C-74.36 -16.24 -81.2 -16.6 -82.64 -14.8C-82.64 -14.8 -83.72 -10.12 -84.8 -9.76C-84.8 -9.76 -87.32 -7.6 -85.52 -5.08C-85.52 -5.08 -87.32 -2.92 -86.96 0.68L-80.12 4.28C-80.12 4.28 -78.32 17.24 -68.6 21.92C-64.248 24.015 -61.4 17.96 -59.6 12.56z"} + , + {"fill": "#eb955c", + "path":"M-51.05 -42.61C-52.14 -43.47 -59.63 -49.24 -65.48 -43C-65.48 -43 -75.62 -25.45 -74.84 -19.21L-74.84 -17.26C-74.84 -17.26 -82.25 -17.65 -83.81 -15.7C-83.81 -15.7 -84.98 -10.63 -86.15 -10.24C-86.15 -10.24 -88.88 -7.9 -86.93 -5.17C-86.93 -5.17 -88.88 -2.83 -88.49 1.07L-81.08 4.97C-81.08 4.97 -79.13 19.01 -68.6 24.08C-63.886 26.35 -60.8 19.79 -58.85 13.94C-58.85 13.94 -61.97 -6.73 -59.63 -11.02C-59.63 -11.02 -49.1 -20.77 -49.49 -24.28C-49.49 -24.28 -49.88 -41.83 -51.05 -42.61z"} + , + {"fill": "#f2b892", + "path":"M-51.5 -41.62C-52.48 -42.54 -59.86 -48.08 -65.56 -42C-65.56 -42 -75.44 -24.9 -74.68 -18.82L-74.68 -16.92C-74.68 -16.92 -81.9 -17.3 -83.42 -15.4C-83.42 -15.4 -84.56 -10.46 -85.7 -10.08C-85.7 -10.08 -88.36 -7.8 -86.46 -5.14C-86.46 -5.14 -88.36 -2.86 -87.98 0.94L-80.76 4.74C-80.76 4.74 -78.86 18.42 -68.6 23.36C-64.006 25.572 -61 19.18 -59.1 13.48C-59.1 13.48 -62.14 -6.66 -59.86 -10.84C-59.86 -10.84 -49.6 -20.34 -49.98 -23.76C-49.98 -23.76 -50.36 -40.86 -51.5 -41.62z"} + , + {"fill": "#f8dcc8", + "path":"M-51.95 -40.63C-52.82 -41.61 -60.09 -46.92 -65.64 -41C-65.64 -41 -75.26 -24.35 -74.52 -18.43L-74.52 -16.58C-74.52 -16.58 -81.55 -16.95 -83.03 -15.1C-83.03 -15.1 -84.14 -10.29 -85.25 -9.92C-85.25 -9.92 -87.84 -7.7 -85.99 -5.11C-85.99 -5.11 -87.84 -2.89 -87.47 0.81L-80.44 4.51C-80.44 4.51 -78.59 17.83 -68.6 22.64C-64.127 24.794 -61.2 18.57 -59.35 13.02C-59.35 13.02 -62.31 -6.59 -60.09 -10.66C-60.09 -10.66 -50.1 -19.91 -50.47 -23.24C-50.47 -23.24 -50.84 -39.89 -51.95 -40.63z"} + , + {"fill": "#ffffff", + "path":"M-59.6 12.46C-59.6 12.46 -62.48 -6.52 -60.32 -10.48C-60.32 -10.48 -50.6 -19.48 -50.96 -22.72C-50.96 -22.72 -51.32 -38.92 -52.4 -39.64C-53.16 -40.68 -60.32 -45.76 -65.72 -40C-65.72 -40 -75.08 -23.8 -74.36 -18.04L-74.36 -16.24C-74.36 -16.24 -81.2 -16.6 -82.64 -14.8C-82.64 -14.8 -83.72 -10.12 -84.8 -9.76C-84.8 -9.76 -87.32 -7.6 -85.52 -5.08C-85.52 -5.08 -87.32 -2.92 -86.96 0.68L-80.12 4.28C-80.12 4.28 -78.32 17.24 -68.6 21.92C-64.248 24.015 -61.4 17.86 -59.6 12.46z"} + , + {"fill": "#cccccc", + "path":"M-62.7 6.2C-62.7 6.2 -84.3 -4 -85.2 -4.8C-85.2 -4.8 -76.1 3.4 -75.3 3.4C-74.5 3.4 -62.7 6.2 -62.7 6.2z"} + , + {"fill": "#000000", + "path":"M-79.8 0C-79.8 0 -61.4 3.6 -61.4 8C-61.4 10.912 -61.643 24.331 -67 22.8C-75.4 20.4 -71.8 6 -79.8 0z"} + , + {"fill": "#99cc32", + "path":"M-71.4 3.8C-71.4 3.8 -62.422 5.274 -61.4 8C-60.8 9.6 -60.137 17.908 -65.6 19C-70.152 19.911 -72.382 9.69 -71.4 3.8z"} + , + {"fill": "#000000", + "path":"M14.595 46.349C14.098 44.607 15.409 44.738 17.2 44.2C19.2 43.6 31.4 39.8 32.2 37.2C33 34.6 46.2 39 46.2 39C48 39.8 52.4 42.4 52.4 42.4C57.2 43.6 63.8 44 63.8 44C66.2 45 69.6 47.8 69.6 47.8C84.2 58 96.601 50.8 96.601 50.8C116.601 44.2 110.601 27 110.601 27C107.601 18 110.801 14.6 110.801 14.6C111.001 10.8 118.201 17.2 118.201 17.2C120.801 21.4 121.601 26.4 121.601 26.4C129.601 37.6 126.201 19.8 126.201 19.8C126.401 18.8 123.601 15.2 123.601 14C123.601 12.8 121.801 9.4 121.801 9.4C118.801 6 121.201 -1 121.201 -1C123.001 -14.8 120.801 -13 120.801 -13C119.601 -14.8 110.401 -4.8 110.401 -4.8C108.201 -1.4 102.201 0.2 102.201 0.2C99.401 2 96.001 0.6 96.001 0.6C93.401 0.2 87.801 7.2 87.801 7.2C90.601 7 93.001 11.4 95.401 11.6C97.801 11.8 99.601 9.2 101.201 8.6C102.801 8 105.601 13.8 105.601 13.8C106.001 16.4 100.401 21.2 100.401 21.2C100.001 25.8 98.401 24.2 98.401 24.2C95.401 23.6 94.201 27.4 93.201 32C92.201 36.6 88.001 37 88.001 37C86.401 44.4 85.2 41.4 85.2 41.4C85 35.8 79 41.6 79 41.6C77.8 43.6 73.2 41.4 73.2 41.4C66.4 39.4 68.8 37.4 68.8 37.4C70.6 35.2 81.8 37.4 81.8 37.4C84 35.8 76 31.8 76 31.8C75.4 30 76.4 25.6 76.4 25.6C77.6 22.4 84.4 16.8 84.4 16.8C93.801 15.6 91.001 14 91.001 14C84.801 8.8 79 16.4 79 16.4C76.8 22.6 59.4 37.6 59.4 37.6C54.6 41 57.2 34.2 53.2 37.6C49.2 41 28.6 32 28.6 32C17.038 30.807 14.306 46.549 10.777 43.429C10.777 43.429 16.195 51.949 14.595 46.349z"} + , + {"fill": "#000000", + "path":"M209.401 -120C209.401 -120 183.801 -112 181.001 -93.2C181.001 -93.2 178.601 -70.4 199.001 -52.8C199.001 -52.8 199.401 -46.4 201.401 -43.2C201.401 -43.2 199.801 -38.4 218.601 -46L245.801 -54.4C245.801 -54.4 252.201 -56.8 257.401 -65.6C262.601 -74.4 277.801 -93.2 274.201 -118.4C274.201 -118.4 275.401 -129.6 269.401 -130C269.401 -130 261.001 -131.6 253.801 -124C253.801 -124 247.001 -120.8 244.601 -121.2L209.401 -120z"} + , + {"fill": "#000000", + "path":"M264.022 -120.99C264.022 -120.99 266.122 -129.92 261.282 -125.08C261.282 -125.08 254.242 -119.36 246.761 -119.36C246.761 -119.36 232.241 -117.16 227.841 -103.96C227.841 -103.96 223.881 -77.12 231.801 -71.4C231.801 -71.4 236.641 -63.92 243.681 -70.52C250.722 -77.12 266.222 -107.35 264.022 -120.99z"} + , + {"fill": "#323232", + "path":"M263.648 -120.632C263.648 -120.632 265.738 -129.376 260.986 -124.624C260.986 -124.624 254.074 -119.008 246.729 -119.008C246.729 -119.008 232.473 -116.848 228.153 -103.888C228.153 -103.888 224.265 -77.536 232.041 -71.92C232.041 -71.92 236.793 -64.576 243.705 -71.056C250.618 -77.536 265.808 -107.24 263.648 -120.632z"} + , + {"fill": "#666666", + "path":"M263.274 -120.274C263.274 -120.274 265.354 -128.832 260.69 -124.168C260.69 -124.168 253.906 -118.656 246.697 -118.656C246.697 -118.656 232.705 -116.536 228.465 -103.816C228.465 -103.816 224.649 -77.952 232.281 -72.44C232.281 -72.44 236.945 -65.232 243.729 -71.592C250.514 -77.952 265.394 -107.13 263.274 -120.274z"} + , + {"fill": "#999999", + "path":"M262.9 -119.916C262.9 -119.916 264.97 -128.288 260.394 -123.712C260.394 -123.712 253.738 -118.304 246.665 -118.304C246.665 -118.304 232.937 -116.224 228.777 -103.744C228.777 -103.744 225.033 -78.368 232.521 -72.96C232.521 -72.96 237.097 -65.888 243.753 -72.128C250.41 -78.368 264.98 -107.02 262.9 -119.916z"} + , + {"fill": "#cccccc", + "path":"M262.526 -119.558C262.526 -119.558 264.586 -127.744 260.098 -123.256C260.098 -123.256 253.569 -117.952 246.633 -117.952C246.633 -117.952 233.169 -115.912 229.089 -103.672C229.089 -103.672 225.417 -78.784 232.761 -73.48C232.761 -73.48 237.249 -66.544 243.777 -72.664C250.305 -78.784 264.566 -106.91 262.526 -119.558z"} + , + {"fill": "#ffffff", + "path":"M262.151 -119.2C262.151 -119.2 264.201 -127.2 259.801 -122.8C259.801 -122.8 253.401 -117.6 246.601 -117.6C246.601 -117.6 233.401 -115.6 229.401 -103.6C229.401 -103.6 225.801 -79.2 233.001 -74C233.001 -74 237.401 -67.2 243.801 -73.2C250.201 -79.2 264.151 -106.8 262.151 -119.2z"} + , + {"fill": "#992600", + "path":"M50.6 84C50.6 84 30.2 64.8 22.2 64C22.2 64 -12.2 60 -27 78C-27 78 -9.4 57.6 18.2 63.2C18.2 63.2 -3.4 58.8 -15.8 62C-15.8 62 -32.6 62 -42.2 76L-45 80.8C-45 80.8 -41 66 -22.6 60C-22.6 60 0.2 55.2 11 60C11 60 -10.6 53.2 -20.6 55.2C-20.6 55.2 -51 52.8 -63.8 79.2C-63.8 79.2 -59.8 64.8 -45 57.6C-45 57.6 -31.4 48.8 -11 51.6C-11 51.6 3.4 54.8 8.6 57.2C13.8 59.6 12.6 56.8 4.2 52C4.2 52 -1.4 42 -15.4 42.4C-15.4 42.4 -58.2 46 -68.6 58C-68.6 58 -55 46.8 -44.6 44C-44.6 44 -22.2 36 -13.8 36.8C-13.8 36.8 11 37.8 18.6 33.8C18.6 33.8 7.4 38.8 10.6 42C13.8 45.2 20.6 52.8 20.6 54C20.6 55.2 44.8 77.3 48.4 81.7L50.6 84z"} + , + {"fill": "#cccccc", + "path":"M189 278C189 278 173.5 241.5 161 232C161 232 187 248 190.5 266C190.5 266 190.5 276 189 278z"} + , + {"fill": "#cccccc", + "path":"M236 285.5C236 285.5 209.5 230.5 191 206.5C191 206.5 234.5 244 239.5 270.5L240 276L237 273.5C237 273.5 236.5 282.5 236 285.5z"} + , + {"fill": "#cccccc", + "path":"M292.5 237C292.5 237 230 177.5 228.5 175C228.5 175 289 241 292 248.5C292 248.5 290 239.5 292.5 237z"} + , + {"fill": "#cccccc", + "path":"M104 280.5C104 280.5 123.5 228.5 142.5 251C142.5 251 157.5 261 157 264C157 264 153 257.5 135 258C135 258 116 255 104 280.5z"} + , + {"fill": "#cccccc", + "path":"M294.5 153C294.5 153 249.5 124.5 242 123C230.193 120.639 291.5 152 296.5 162.5C296.5 162.5 298.5 160 294.5 153z"} + , + {"fill": "#000000", + "path":"M143.801 259.601C143.801 259.601 164.201 257.601 171.001 250.801L175.401 254.401L193.001 216.001L196.601 221.201C196.601 221.201 211.001 206.401 210.201 198.401C209.401 190.401 223.001 204.401 223.001 204.401C223.001 204.401 222.201 192.801 229.401 199.601C229.401 199.601 227.001 184.001 235.401 192.001C235.401 192.001 224.864 161.844 247.401 187.601C253.001 194.001 248.601 187.201 248.601 187.201C248.601 187.201 222.601 139.201 244.201 153.601C244.201 153.601 246.201 130.801 245.001 126.401C243.801 122.001 241.801 99.6 237.001 94.4C232.201 89.2 237.401 87.6 243.001 92.8C243.001 92.8 231.801 68.8 245.001 80.8C245.001 80.8 241.401 65.6 237.001 62.8C237.001 62.8 231.401 45.6 246.601 56.4C246.601 56.4 242.201 44 239.001 40.8C239.001 40.8 227.401 13.2 234.601 18L239.001 21.6C239.001 21.6 232.201 7.6 238.601 12C245.001 16.4 245.001 16 245.001 16C245.001 16 223.801 -17.2 244.201 0.4C244.201 0.4 236.042 -13.518 232.601 -20.4C232.601 -20.4 213.801 -40.8 228.201 -34.4L233.001 -32.8C233.001 -32.8 224.201 -42.8 216.201 -44.4C208.201 -46 218.601 -52.4 225.001 -50.4C231.401 -48.4 247.001 -40.8 247.001 -40.8C247.001 -40.8 259.801 -22 263.801 -21.6C263.801 -21.6 243.801 -29.2 249.801 -21.2C249.801 -21.2 264.201 -7.2 257.001 -7.6C257.001 -7.6 251.001 -0.4 255.801 8.4C255.801 8.4 237.342 -9.991 252.201 15.6L259.001 32C259.001 32 234.601 7.2 245.801 29.2C245.801 29.2 263.001 52.8 265.001 53.2C267.001 53.6 271.401 62.4 271.401 62.4L267.001 60.4L272.201 69.2C272.201 69.2 261.001 57.2 267.001 70.4L272.601 84.8C272.601 84.8 252.201 62.8 265.801 92.4C265.801 92.4 249.401 87.2 258.201 104.4C258.201 104.4 256.601 120.401 257.001 125.601C257.401 130.801 258.601 159.201 254.201 167.201C249.801 175.201 260.201 194.401 262.201 198.401C264.201 202.401 267.801 213.201 259.001 204.001C250.201 194.801 254.601 200.401 256.601 209.201C258.601 218.001 264.601 233.601 263.801 239.201C263.801 239.201 262.601 240.401 259.401 236.801C259.401 236.801 244.601 214.001 246.201 228.401C246.201 228.401 245.001 236.401 241.801 245.201C241.801 245.201 238.601 256.001 238.601 247.201C238.601 247.201 235.401 230.401 232.601 238.001C229.801 245.601 226.201 251.601 223.401 254.001C220.601 256.401 215.401 233.601 214.201 244.001C214.201 244.001 202.201 231.601 197.401 248.001L185.801 264.401C185.801 264.401 185.401 252.001 184.201 258.001C184.201 258.001 154.201 264.001 143.801 259.601z"} + , + {"fill": "#000000", + "path":"M109.401 -97.2C109.401 -97.2 97.801 -105.2 93.801 -104.8C89.801 -104.4 121.401 -113.6 162.601 -86C162.601 -86 167.401 -83.2 171.001 -83.6C171.001 -83.6 174.201 -81.2 171.401 -77.6C171.401 -77.6 162.601 -68 173.801 -56.8C173.801 -56.8 192.201 -50 186.601 -58.8C186.601 -58.8 197.401 -54.8 199.801 -50.8C202.201 -46.8 201.001 -50.8 201.001 -50.8C201.001 -50.8 194.601 -58 188.601 -63.2C188.601 -63.2 183.401 -65.2 180.601 -73.6C177.801 -82 175.401 -92 179.801 -95.2C179.801 -95.2 175.801 -90.8 176.601 -94.8C177.401 -98.8 181.001 -102.4 182.601 -102.8C184.201 -103.2 200.601 -119 207.401 -119.4C207.401 -119.4 198.201 -118 195.201 -119C192.201 -120 165.601 -131.4 159.601 -132.6C159.601 -132.6 142.801 -139.2 154.801 -137.2C154.801 -137.2 190.601 -133.4 208.801 -120.2C208.801 -120.2 201.601 -128.6 183.201 -135.6C183.201 -135.6 161.001 -148.2 125.801 -143.2C125.801 -143.2 108.001 -140 100.201 -138.2C100.201 -138.2 97.601 -138.8 97.001 -139.2C96.401 -139.6 84.6 -148.6 57 -141.6C57 -141.6 40 -137 31.4 -132.2C31.4 -132.2 16.2 -131 12.6 -127.8C12.6 -127.8 -6 -113.2 -8 -112.4C-10 -111.6 -21.4 -104 -22.2 -103.6C-22.2 -103.6 2.4 -110.2 4.8 -112.6C7.2 -115 24.6 -117.6 27 -116.2C29.4 -114.8 37.8 -115.4 28.2 -114.8C28.2 -114.8 103.801 -100 104.601 -98C105.401 -96 109.401 -97.2 109.401 -97.2z"} + , + {"fill": "#cc7226", + "path":"M180.801 -106.4C180.801 -106.4 170.601 -113.8 168.601 -113.8C166.601 -113.8 154.201 -124 150.001 -123.6C145.801 -123.2 133.601 -133.2 106.201 -125C106.201 -125 105.601 -127 109.201 -127.8C109.201 -127.8 115.601 -130 116.001 -130.6C116.001 -130.6 136.201 -134.8 143.401 -131.2C143.401 -131.2 152.601 -128.6 158.801 -122.4C158.801 -122.4 170.001 -119.2 173.201 -120.2C173.201 -120.2 182.001 -118 182.401 -116.2C182.401 -116.2 188.201 -113.2 186.401 -110.6C186.401 -110.6 186.801 -109 180.801 -106.4z"} + , + {"fill": "#cc7226", + "path":"M168.33 -108.509C169.137 -107.877 170.156 -107.779 170.761 -106.97C170.995 -106.656 170.706 -106.33 170.391 -106.233C169.348 -105.916 168.292 -106.486 167.15 -105.898C166.748 -105.691 166.106 -105.873 165.553 -106.022C163.921 -106.463 162.092 -106.488 160.401 -105.8C158.416 -106.929 156.056 -106.345 153.975 -107.346C153.917 -107.373 153.695 -107.027 153.621 -107.054C150.575 -108.199 146.832 -107.916 144.401 -110.2C141.973 -110.612 139.616 -111.074 137.188 -111.754C135.37 -112.263 133.961 -113.252 132.341 -114.084C130.964 -114.792 129.507 -115.314 127.973 -115.686C126.11 -116.138 124.279 -116.026 122.386 -116.546C122.293 -116.571 122.101 -116.227 122.019 -116.254C121.695 -116.362 121.405 -116.945 121.234 -116.892C119.553 -116.37 118.065 -117.342 116.401 -117C115.223 -118.224 113.495 -117.979 111.949 -118.421C108.985 -119.269 105.831 -117.999 102.801 -119C106.914 -120.842 111.601 -119.61 115.663 -121.679C117.991 -122.865 120.653 -121.763 123.223 -122.523C123.71 -122.667 124.401 -122.869 124.801 -122.2C124.935 -122.335 125.117 -122.574 125.175 -122.546C127.625 -121.389 129.94 -120.115 132.422 -119.049C132.763 -118.903 133.295 -119.135 133.547 -118.933C135.067 -117.717 137.01 -117.82 138.401 -116.6C140.099 -117.102 141.892 -116.722 143.621 -117.346C143.698 -117.373 143.932 -117.032 143.965 -117.054C145.095 -117.802 146.25 -117.531 147.142 -117.227C147.48 -117.112 148.143 -116.865 148.448 -116.791C149.574 -116.515 150.43 -116.035 151.609 -115.852C151.723 -115.834 151.908 -116.174 151.98 -116.146C153.103 -115.708 154.145 -115.764 154.801 -114.6C154.936 -114.735 155.101 -114.973 155.183 -114.946C156.21 -114.608 156.859 -113.853 157.96 -113.612C158.445 -113.506 159.057 -112.88 159.633 -112.704C162.025 -111.973 163.868 -110.444 166.062 -109.549C166.821 -109.239 167.697 -109.005 168.33 -108.509z"} + , + {"fill": "#cc7226", + "path":"M91.696 -122.739C89.178 -124.464 86.81 -125.57 84.368 -127.356C84.187 -127.489 83.827 -127.319 83.625 -127.441C82.618 -128.05 81.73 -128.631 80.748 -129.327C80.209 -129.709 79.388 -129.698 78.88 -129.956C76.336 -131.248 73.707 -131.806 71.2 -133C71.882 -133.638 73.004 -133.394 73.6 -134.2C73.795 -133.92 74.033 -133.636 74.386 -133.827C76.064 -134.731 77.914 -134.884 79.59 -134.794C81.294 -134.702 83.014 -134.397 84.789 -134.125C85.096 -134.078 85.295 -133.555 85.618 -133.458C87.846 -132.795 90.235 -133.32 92.354 -132.482C93.945 -131.853 95.515 -131.03 96.754 -129.755C97.006 -129.495 96.681 -129.194 96.401 -129C96.789 -129.109 97.062 -128.903 97.173 -128.59C97.257 -128.351 97.257 -128.049 97.173 -127.81C97.061 -127.498 96.782 -127.397 96.408 -127.346C95.001 -127.156 96.773 -128.536 96.073 -128.088C94.8 -127.274 95.546 -125.868 94.801 -124.6C94.521 -124.794 94.291 -125.012 94.401 -125.4C94.635 -124.878 94.033 -124.588 93.865 -124.272C93.48 -123.547 92.581 -122.132 91.696 -122.739z"} + , + {"fill": "#cc7226", + "path":"M59.198 -115.391C56.044 -116.185 52.994 -116.07 49.978 -117.346C49.911 -117.374 49.688 -117.027 49.624 -117.054C48.258 -117.648 47.34 -118.614 46.264 -119.66C45.351 -120.548 43.693 -120.161 42.419 -120.648C42.095 -120.772 41.892 -121.284 41.591 -121.323C40.372 -121.48 39.445 -122.429 38.4 -123C40.736 -123.795 43.147 -123.764 45.609 -124.148C45.722 -124.166 45.867 -123.845 46 -123.845C46.136 -123.845 46.266 -124.066 46.4 -124.2C46.595 -123.92 46.897 -123.594 47.154 -123.848C47.702 -124.388 48.258 -124.198 48.798 -124.158C48.942 -124.148 49.067 -123.845 49.2 -123.845C49.336 -123.845 49.467 -124.156 49.6 -124.156C49.736 -124.155 49.867 -123.845 50 -123.845C50.136 -123.845 50.266 -124.066 50.4 -124.2C51.092 -123.418 51.977 -123.972 52.799 -123.793C53.837 -123.566 54.104 -122.418 55.178 -122.12C59.893 -120.816 64.03 -118.671 68.393 -116.584C68.7 -116.437 68.91 -116.189 68.8 -115.8C69.067 -115.8 69.38 -115.888 69.57 -115.756C70.628 -115.024 71.669 -114.476 72.366 -113.378C72.582 -113.039 72.253 -112.632 72.02 -112.684C67.591 -113.679 63.585 -114.287 59.198 -115.391z"} + , + {"fill": "#cc7226", + "path":"M45.338 -71.179C43.746 -72.398 43.162 -74.429 42.034 -76.221C41.82 -76.561 42.094 -76.875 42.411 -76.964C42.971 -77.123 43.514 -76.645 43.923 -76.443C45.668 -75.581 47.203 -74.339 49.2 -74.2C51.19 -71.966 55.45 -71.581 55.457 -68.2C55.458 -67.341 54.03 -68.259 53.6 -67.4C51.149 -68.403 48.76 -68.3 46.38 -69.767C45.763 -70.148 46.093 -70.601 45.338 -71.179z"} + , + {"fill": "#cc7226", + "path":"M17.8 -123.756C17.935 -123.755 24.966 -123.522 24.949 -123.408C24.904 -123.099 17.174 -122.05 16.81 -122.22C16.646 -122.296 9.134 -119.866 9 -120C9.268 -120.135 17.534 -123.756 17.8 -123.756z"} + , + {"fill": "#000000", + "path":"M33.2 -114C33.2 -114 18.4 -112.2 14 -111C9.6 -109.8 -9 -102.2 -12 -100.2C-12 -100.2 -25.4 -94.8 -42.4 -74.8C-42.4 -74.8 -34.8 -78.2 -32.6 -81C-32.6 -81 -19 -93.6 -19.2 -91C-19.2 -91 -7 -99.6 -7.6 -97.4C-7.6 -97.4 16.8 -108.6 14.8 -105.4C14.8 -105.4 36.4 -110 35.4 -108C35.4 -108 54.2 -103.6 51.4 -103.4C51.4 -103.4 45.6 -102.2 52 -98.6C52 -98.6 48.6 -94.2 43.2 -98.2C37.8 -102.2 40.8 -100 35.8 -99C35.8 -99 33.2 -98.2 28.6 -102.2C28.6 -102.2 23 -106.8 14.2 -103.2C14.2 -103.2 -16.4 -90.6 -18.4 -90C-18.4 -90 -22 -87.2 -24.4 -83.6C-24.4 -83.6 -30.2 -79.2 -33.2 -77.8C-33.2 -77.8 -46 -66.2 -47.2 -64.8C-47.2 -64.8 -50.6 -59.6 -51.4 -59.2C-51.4 -59.2 -45 -63 -43 -65C-43 -65 -29 -75 -23.6 -75.8C-23.6 -75.8 -19.2 -78.8 -18.4 -80.2C-18.4 -80.2 -4 -89.4 0.2 -89.4C0.2 -89.4 9.4 -84.2 11.8 -91.2C11.8 -91.2 17.6 -93 23.2 -91.8C23.2 -91.8 26.4 -94.4 25.6 -96.6C25.6 -96.6 27.2 -98.4 28.2 -94.6C28.2 -94.6 31.6 -91 36.4 -93C36.4 -93 40.4 -93.2 38.4 -90.8C38.4 -90.8 34 -87 22.2 -86.8C22.2 -86.8 9.8 -86.2 -6.6 -78.6C-6.6 -78.6 -36.4 -68.2 -45.6 -57.8C-45.6 -57.8 -52 -49 -57.4 -47.8C-57.4 -47.8 -63.2 -47 -69.2 -39.6C-69.2 -39.6 -59.4 -45.4 -50.4 -45.4C-50.4 -45.4 -46.4 -47.8 -50.2 -44.2C-50.2 -44.2 -53.8 -36.6 -52.2 -31.2C-52.2 -31.2 -52.8 -26 -53.6 -24.4C-53.6 -24.4 -61.4 -11.6 -61.4 -9.2C-61.4 -6.8 -60.2 3 -59.8 3.6C-59.4 4.2 -60.8 2 -57 4.4C-53.2 6.8 -50.4 8.4 -49.6 11.2C-48.8 14 -51.6 5.8 -51.8 4C-52 2.2 -56.2 -5 -55.4 -7.4C-55.4 -7.4 -54.4 -6.4 -53.6 -5C-53.6 -5 -54.2 -5.6 -53.6 -9.2C-53.6 -9.2 -52.8 -14.4 -51.4 -17.6C-50 -20.8 -48 -24.6 -47.6 -25.4C-47.2 -26.2 -47.2 -32 -45.8 -29.4L-42.4 -26.8C-42.4 -26.8 -45.2 -29.4 -43 -31.6C-43 -31.6 -44 -37.2 -42.2 -39.8C-42.2 -39.8 -35.2 -48.2 -33.6 -49.2C-32 -50.2 -33.4 -49.8 -33.4 -49.8C-33.4 -49.8 -27.4 -54 -33.2 -52.4C-33.2 -52.4 -37.2 -50.8 -40.2 -50.8C-40.2 -50.8 -47.8 -48.8 -43.8 -53C-39.8 -57.2 -29.8 -62.6 -26 -62.4L-25.2 -60.8L-14 -63.2L-15.2 -62.4C-15.2 -62.4 -15.4 -62.6 -11.2 -63C-7 -63.4 -1.2 -62 0.2 -63.8C1.6 -65.6 5 -66.6 4.6 -65.2C4.2 -63.8 4 -61.8 4 -61.8C4 -61.8 9 -67.6 8.4 -65.4C7.8 -63.2 -0.4 -58 -1.8 -51.8L8.6 -60L12.2 -63C12.2 -63 15.8 -60.8 16 -62.4C16.2 -64 20.8 -69.8 22 -69.6C23.2 -69.4 25.2 -72.2 25 -69.6C24.8 -67 32.4 -61.6 32.4 -61.6C32.4 -61.6 35.6 -63.4 37 -62C38.4 -60.6 42.6 -81.8 42.6 -81.8L67.6 -92.4L111.201 -95.8L94.201 -102.6L33.2 -114z"} + , + {"stroke":"#4c0000", "width":2, + "path":"M51.4 85C51.4 85 36.4 68.2 28 65.6C28 65.6 14.6 58.8 -10 66.6"} + , + {"stroke":"#4c0000", "width":2, + "path":"M24.8 64.2C24.8 64.2 -0.4 56.2 -15.8 60.4C-15.8 60.4 -34.2 62.4 -42.6 76.2"} + , + {"stroke":"#4c0000", "width":2, + "path":"M21.2 63C21.2 63 4.2 55.8 -10.6 53.6C-10.6 53.6 -27.2 51 -43.8 58.2C-43.8 58.2 -56 64.2 -61.4 74.4"} + , + {"stroke":"#4c0000", "width":2, + "path":"M22.2 63.4C22.2 63.4 6.8 52.4 5.8 51C5.8 51 -1.2 40 -14.2 39.6C-14.2 39.6 -35.6 40.4 -52.8 48.4"} + , + {"fill": "#000000", + "path":"M20.895 54.407C22.437 55.87 49.4 84.8 49.4 84.8C84.6 121.401 56.6 87.2 56.6 87.2C49 82.4 39.8 63.6 39.8 63.6C38.6 60.8 53.8 70.8 53.8 70.8C57.8 71.6 71.4 90.8 71.4 90.8C64.6 88.4 69.4 95.6 69.4 95.6C72.2 97.6 92.601 113.201 92.601 113.201C96.201 117.201 100.201 118.801 100.201 118.801C114.201 113.601 107.801 126.801 107.801 126.801C110.201 133.601 115.801 122.001 115.801 122.001C127.001 105.2 110.601 107.601 110.601 107.601C80.6 110.401 73.8 94.4 73.8 94.4C71.4 92 80.2 94.4 80.2 94.4C88.601 96.4 73 82 73 82C75.4 82 84.6 88.8 84.6 88.8C95.001 98 97.001 96 97.001 96C115.001 87.2 125.401 94.8 125.401 94.8C127.401 96.4 121.801 103.2 123.401 108.401C125.001 113.601 129.801 126.001 129.801 126.001C127.401 127.601 127.801 138.401 127.801 138.401C144.601 161.601 135.001 159.601 135.001 159.601C119.401 159.201 134.201 166.801 134.201 166.801C137.401 168.801 146.201 176.001 146.201 176.001C143.401 174.801 141.801 180.001 141.801 180.001C146.601 184.001 143.801 188.801 143.801 188.801C137.801 190.001 136.601 194.001 136.601 194.001C143.401 202.001 133.401 202.401 133.401 202.401C137.001 206.801 132.201 218.801 132.201 218.801C127.401 218.801 121.001 224.401 121.001 224.401C123.401 229.201 113.001 234.801 113.001 234.801C104.601 236.401 107.401 243.201 107.401 243.201C99.401 249.201 97.001 265.201 97.001 265.201C96.201 275.601 93.801 278.801 99.001 276.801C104.201 274.801 103.401 262.401 103.401 262.401C98.601 246.801 141.401 230.801 141.401 230.801C145.401 229.201 146.201 224.001 146.201 224.001C148.201 224.401 157.001 232.001 157.001 232.001C164.601 243.201 165.001 234.001 165.001 234.001C166.201 230.401 164.601 224.401 164.601 224.401C170.601 202.801 156.601 196.401 156.601 196.401C146.601 162.801 160.601 171.201 160.601 171.201C163.401 176.801 174.201 182.001 174.201 182.001L177.801 179.601C176.201 174.801 184.601 168.801 184.601 168.801C187.401 175.201 193.401 167.201 193.401 167.201C197.001 142.801 209.401 157.201 209.401 157.201C213.401 158.401 214.601 151.601 214.601 151.601C218.201 141.201 214.601 127.601 214.601 127.601C218.201 127.201 227.801 133.201 227.801 133.201C230.601 129.601 221.401 112.801 225.401 115.201C229.401 117.601 233.801 119.201 233.801 119.201C234.601 117.201 224.601 104.801 224.601 104.801C220.201 102 215.001 81.6 215.001 81.6C222.201 85.2 212.201 70 212.201 70C212.201 66.8 218.201 55.6 218.201 55.6C217.401 48.8 218.201 49.2 218.201 49.2C221.001 50.4 229.001 52 222.201 45.6C215.401 39.2 223.001 34.4 223.001 34.4C227.401 31.6 213.801 32 213.801 32C208.601 27.6 209.001 23.6 209.001 23.6C217.001 25.6 202.601 11.2 200.201 7.6C197.801 4 207.401 -1.2 207.401 -1.2C220.601 -4.8 209.001 -8 209.001 -8C189.401 -7.6 200.201 -18.4 200.201 -18.4C206.201 -18 204.601 -20.4 204.601 -20.4C199.401 -21.6 189.801 -28 189.801 -28C185.801 -31.6 189.401 -30.8 189.401 -30.8C206.201 -29.6 177.401 -40.8 177.401 -40.8C185.401 -40.8 167.401 -51.2 167.401 -51.2C165.401 -52.8 162.201 -60.4 162.201 -60.4C156.201 -65.6 151.401 -72.4 151.401 -72.4C151.001 -76.8 146.201 -81.6 146.201 -81.6C134.601 -95.2 129.001 -94.8 129.001 -94.8C114.201 -98.4 109.001 -97.6 109.001 -97.6L56.2 -93.2C29.8 -80.4 37.6 -59.4 37.6 -59.4C44 -51 53.2 -54.8 53.2 -54.8C57.8 -61 69.4 -58.8 69.4 -58.8C89.801 -55.6 87.201 -59.2 87.201 -59.2C84.801 -63.8 68.6 -70 68.4 -70.6C68.2 -71.2 59.4 -74.6 59.4 -74.6C56.4 -75.8 52 -85 52 -85C48.8 -88.4 64.6 -82.6 64.6 -82.6C63.4 -81.6 70.8 -77.6 70.8 -77.6C88.201 -78.6 98.801 -67.8 98.801 -67.8C109.601 -51.2 109.801 -59.4 109.801 -59.4C112.601 -68.8 100.801 -90 100.801 -90C101.201 -92 109.401 -85.4 109.401 -85.4C110.801 -87.4 111.601 -81.6 111.601 -81.6C111.801 -79.2 115.601 -71.2 115.601 -71.2C118.401 -58.2 122.001 -65.6 122.001 -65.6L126.601 -56.2C128.001 -53.6 122.001 -46 122.001 -46C121.801 -43.2 122.601 -43.4 117.001 -35.8C111.401 -28.2 114.801 -23.8 114.801 -23.8C113.401 -17.2 122.201 -17.6 122.201 -17.6C124.801 -15.4 128.201 -15.4 128.201 -15.4C130.001 -13.4 132.401 -14 132.401 -14C134.001 -17.8 140.201 -15.8 140.201 -15.8C141.601 -18.2 149.801 -18.6 149.801 -18.6C150.801 -21.2 151.201 -22.8 154.601 -23.4C158.001 -24 133.401 -67 133.401 -67C139.801 -67.8 131.601 -80.2 131.601 -80.2C129.401 -86.8 140.801 -72.2 143.001 -70.8C145.201 -69.4 146.201 -67.2 144.601 -67.4C143.001 -67.6 141.201 -65.4 142.601 -65.2C144.001 -65 157.001 -50 160.401 -39.8C163.801 -29.6 169.801 -25.6 176.001 -19.6C182.201 -13.6 181.401 10.6 181.401 10.6C181.001 19.4 187.001 30 187.001 30C189.001 33.8 184.801 52 184.801 52C182.801 54.2 184.201 55 184.201 55C185.201 56.2 192.001 69.4 192.001 69.4C190.201 69.2 193.801 72.8 193.801 72.8C199.001 78.8 192.601 75.8 192.601 75.8C186.601 74.2 193.601 84 193.601 84C194.801 85.8 185.801 81.2 185.801 81.2C176.601 80.6 188.201 87.8 188.201 87.8C196.801 95 185.401 90.6 185.401 90.6C180.801 88.8 184.001 95.6 184.001 95.6C187.201 97.2 204.401 104.2 204.401 104.2C204.801 108.001 201.801 113.001 201.801 113.001C202.201 117.001 200.001 120.401 200.001 120.401C198.801 128.601 198.201 129.401 198.201 129.401C194.001 129.601 186.601 143.401 186.601 143.401C184.801 146.001 174.601 158.001 174.601 158.001C172.601 165.001 154.601 157.801 154.601 157.801C148.001 161.201 150.001 157.801 150.001 157.801C149.601 155.601 154.401 149.601 154.401 149.601C161.401 147.001 158.801 136.201 158.801 136.201C162.801 134.801 151.601 132.001 151.801 130.801C152.001 129.601 157.801 128.201 157.801 128.201C165.801 126.201 161.401 123.801 161.401 123.801C160.801 119.801 163.801 114.201 163.801 114.201C175.401 113.401 163.801 97.2 163.801 97.2C153.001 89.6 152.001 83.8 152.001 83.8C164.601 75.6 156.401 63.2 156.601 59.6C156.801 56 158.001 34.4 158.001 34.4C156.001 28.2 153.001 14.6 153.001 14.6C155.201 9.4 162.601 -3.2 162.601 -3.2C165.401 -7.4 174.201 -12.2 172.001 -15.2C169.801 -18.2 162.001 -16.4 162.001 -16.4C154.201 -17.8 154.801 -12.6 154.801 -12.6C153.201 -11.6 152.401 -6.6 152.401 -6.6C151.68 1.333 142.801 7.6 142.801 7.6C131.601 13.8 140.801 17.8 140.801 17.8C146.801 24.4 137.001 24.6 137.001 24.6C126.001 22.8 134.201 33 134.201 33C145.001 45.8 142.001 48.6 142.001 48.6C131.801 49.6 144.401 58.8 144.401 58.8C144.401 58.8 143.601 56.8 143.801 58.6C144.001 60.4 147.001 64.6 147.801 66.6C148.601 68.6 144.601 68.8 144.601 68.8C145.201 78.4 129.801 74.2 129.801 74.2C129.801 74.2 129.801 74.2 128.201 74.4C126.601 74.6 115.401 73.8 109.601 71.6C103.801 69.4 97.001 69.4 97.001 69.4C97.001 69.4 93.001 71.2 85.4 71C77.8 70.8 69.8 73.6 69.8 73.6C65.4 73.2 74 68.8 74.2 69C74.4 69.2 80 63.6 72 64.2C50.203 65.835 39.4 55.6 39.4 55.6C37.4 54.2 34.8 51.4 34.8 51.4C24.8 49.4 36.2 63.8 36.2 63.8C37.4 65.2 36 66.2 36 66.2C35.2 64.6 27.4 59.2 27.4 59.2C24.589 58.227 23.226 56.893 20.895 54.407z"} + , + {"fill": "#4c0000", + "path":"M-3 42.8C-3 42.8 8.6 48.4 11.2 51.2C13.8 54 27.8 65.4 27.8 65.4C27.8 65.4 22.4 63.4 19.8 61.6C17.2 59.8 6.4 51.6 6.4 51.6C6.4 51.6 2.6 45.6 -3 42.8z"} + , + {"fill": "#99cc32", + "path":"M-61.009 11.603C-60.672 11.455 -61.196 8.743 -61.4 8.2C-62.422 5.474 -71.4 4 -71.4 4C-71.627 5.365 -71.682 6.961 -71.576 8.599C-71.576 8.599 -66.708 14.118 -61.009 11.603z"} + , + {"fill": "#659900", + "path":"M-61.009 11.403C-61.458 11.561 -61.024 8.669 -61.2 8.2C-62.222 5.474 -71.4 3.9 -71.4 3.9C-71.627 5.265 -71.682 6.861 -71.576 8.499C-71.576 8.499 -67.308 13.618 -61.009 11.403z"} + , + {"fill": "#000000", + "path":"M-65.4 11.546C-66.025 11.546 -66.531 10.406 -66.531 9C-66.531 7.595 -66.025 6.455 -65.4 6.455C-64.775 6.455 -64.268 7.595 -64.268 9C-64.268 10.406 -64.775 11.546 -65.4 11.546z"} + , + {"fill": "#000000", + "path":"M-65.4 9z"} + , + {"fill": "#000000", + "path":"M-111 109.601C-111 109.601 -116.6 119.601 -91.8 113.601C-91.8 113.601 -77.8 112.401 -75.4 110.001C-74.2 110.801 -65.834 113.734 -63 114.401C-56.2 116.001 -47.8 106 -47.8 106C-47.8 106 -43.2 95.5 -40.4 95.5C-37.6 95.5 -40.8 97.1 -40.8 97.1C-40.8 97.1 -47.4 107.201 -47 108.801C-47 108.801 -52.2 128.801 -68.2 129.601C-68.2 129.601 -84.35 130.551 -83 136.401C-83 136.401 -74.2 134.001 -71.8 136.401C-71.8 136.401 -61 136.001 -69 142.401L-75.8 154.001C-75.8 154.001 -75.66 157.919 -85.8 154.401C-95.6 151.001 -105.9 138.101 -105.9 138.101C-105.9 138.101 -121.85 123.551 -111 109.601z"} + , + {"fill": "#e59999", + "path":"M-112.2 113.601C-112.2 113.601 -114.2 123.201 -77.4 112.801C-77.4 112.801 -73 112.801 -70.6 113.601C-68.2 114.401 -56.2 117.201 -54.2 116.001C-54.2 116.001 -61.4 129.601 -73 128.001C-73 128.001 -86.2 129.601 -85.8 134.401C-85.8 134.401 -81.8 141.601 -77 144.001C-77 144.001 -74.2 146.401 -74.6 149.601C-75 152.801 -77.8 154.401 -79.8 155.201C-81.8 156.001 -85 152.801 -86.6 152.801C-88.2 152.801 -96.6 146.401 -101 141.601C-105.4 136.801 -113.8 124.801 -113.4 122.001C-113 119.201 -112.2 113.601 -112.2 113.601z"} + , + {"fill": "#b26565", + "path":"M-109 131.051C-106.4 135.001 -103.2 139.201 -101 141.601C-96.6 146.401 -88.2 152.801 -86.6 152.801C-85 152.801 -81.8 156.001 -79.8 155.201C-77.8 154.401 -75 152.801 -74.6 149.601C-74.2 146.401 -77 144.001 -77 144.001C-80.066 142.468 -82.806 138.976 -84.385 136.653C-84.385 136.653 -84.2 139.201 -89.4 138.401C-94.6 137.601 -99.8 134.801 -101.4 131.601C-103 128.401 -105.4 126.001 -103.8 129.601C-102.2 133.201 -99.8 136.801 -98.2 137.201C-96.6 137.601 -97 138.801 -99.4 138.401C-101.8 138.001 -104.6 137.601 -109 132.401z"} + , + {"fill": "#992600", + "path":"M-111.6 110.001C-111.6 110.001 -109.8 96.4 -108.6 92.4C-108.6 92.4 -109.4 85.6 -107 81.4C-104.6 77.2 -102.6 71 -99.6 65.6C-96.6 60.2 -96.4 56.2 -92.4 54.6C-88.4 53 -82.4 44.4 -79.6 43.4C-76.8 42.4 -77 43.2 -77 43.2C-77 43.2 -70.2 28.4 -56.6 32.4C-56.6 32.4 -72.8 29.6 -57 20.2C-57 20.2 -61.8 21.3 -58.5 14.3C-56.299 9.632 -56.8 16.4 -67.8 28.2C-67.8 28.2 -72.8 36.8 -78 39.8C-83.2 42.8 -95.2 49.8 -96.4 53.6C-97.6 57.4 -100.8 63.2 -102.8 64.8C-104.8 66.4 -107.6 70.6 -108 74C-108 74 -109.2 78 -110.6 79.2C-112 80.4 -112.2 83.6 -112.2 85.6C-112.2 87.6 -114.2 90.4 -114 92.8C-114 92.8 -113.2 111.801 -113.6 113.801L-111.6 110.001z"} + , + {"fill": "#ffffff", + "path":"M-120.2 114.601C-120.2 114.601 -122.2 113.201 -126.6 119.201C-126.6 119.201 -119.3 152.201 -119.3 153.601C-119.3 153.601 -118.2 151.501 -119.5 144.301C-120.8 137.101 -121.7 124.401 -121.7 124.401L-120.2 114.601z"} + , + {"fill": "#992600", + "path":"M-98.6 54C-98.6 54 -116.2 57.2 -115.8 86.4L-116.6 111.201C-116.6 111.201 -117.8 85.6 -119 84C-120.2 82.4 -116.2 71.2 -119.4 77.2C-119.4 77.2 -133.4 91.2 -125.4 112.401C-125.4 112.401 -123.9 115.701 -126.9 111.101C-126.9 111.101 -131.5 98.5 -130.4 92.1C-130.4 92.1 -130.2 89.9 -128.3 87.1C-128.3 87.1 -119.7 75.4 -117 73.1C-117 73.1 -115.2 58.7 -99.8 53.5C-99.8 53.5 -94.1 51.2 -98.6 54z"} + , + {"fill": "#000000", + "path":"M40.8 -12.2C41.46 -12.554 41.451 -13.524 42.031 -13.697C43.18 -14.041 43.344 -15.108 43.862 -15.892C44.735 -17.211 44.928 -18.744 45.51 -20.235C45.782 -20.935 45.809 -21.89 45.496 -22.55C44.322 -25.031 43.62 -27.48 42.178 -29.906C41.91 -30.356 41.648 -31.15 41.447 -31.748C40.984 -33.132 39.727 -34.123 38.867 -35.443C38.579 -35.884 39.104 -36.809 38.388 -36.893C37.491 -36.998 36.042 -37.578 35.809 -36.552C35.221 -33.965 36.232 -31.442 37.2 -29C36.418 -28.308 36.752 -27.387 36.904 -26.62C37.614 -23.014 36.416 -19.662 35.655 -16.188C35.632 -16.084 35.974 -15.886 35.946 -15.824C34.724 -13.138 33.272 -10.693 31.453 -8.312C30.695 -7.32 29.823 -6.404 29.326 -5.341C28.958 -4.554 28.55 -3.588 28.8 -2.6C25.365 0.18 23.115 4.025 20.504 7.871C20.042 8.551 20.333 9.76 20.884 10.029C21.697 10.427 22.653 9.403 23.123 8.557C23.512 7.859 23.865 7.209 24.356 6.566C24.489 6.391 24.31 5.972 24.445 5.851C27.078 3.504 28.747 0.568 31.2 -1.8C33.15 -2.129 34.687 -3.127 36.435 -4.14C36.743 -4.319 37.267 -4.07 37.557 -4.265C39.31 -5.442 39.308 -7.478 39.414 -9.388C39.464 -10.272 39.66 -11.589 40.8 -12.2z"} + , + {"fill": "#000000", + "path":"M31.959 -16.666C32.083 -16.743 31.928 -17.166 32.037 -17.382C32.199 -17.706 32.602 -17.894 32.764 -18.218C32.873 -18.434 32.71 -18.814 32.846 -18.956C35.179 -21.403 35.436 -24.427 34.4 -27.4C35.424 -28.02 35.485 -29.282 35.06 -30.129C34.207 -31.829 34.014 -33.755 33.039 -35.298C32.237 -36.567 30.659 -37.811 29.288 -36.508C28.867 -36.108 28.546 -35.321 28.824 -34.609C28.888 -34.446 29.173 -34.3 29.146 -34.218C29.039 -33.894 28.493 -33.67 28.487 -33.398C28.457 -31.902 27.503 -30.391 28.133 -29.062C28.905 -27.433 29.724 -25.576 30.4 -23.8C29.166 -21.684 30.199 -19.235 28.446 -17.358C28.31 -17.212 28.319 -16.826 28.441 -16.624C28.733 -16.138 29.139 -15.732 29.625 -15.44C29.827 -15.319 30.175 -15.317 30.375 -15.441C30.953 -15.803 31.351 -16.29 31.959 -16.666z"} + , + {"fill": "#000000", + "path":"M94.771 -26.977C96.16 -25.185 96.45 -22.39 94.401 -21C94.951 -17.691 98.302 -19.67 100.401 -20.2C100.292 -20.588 100.519 -20.932 100.802 -20.937C101.859 -20.952 102.539 -21.984 103.601 -21.8C104.035 -23.357 105.673 -24.059 106.317 -25.439C108.043 -29.134 107.452 -33.407 104.868 -36.653C104.666 -36.907 104.883 -37.424 104.759 -37.786C104.003 -39.997 101.935 -40.312 100.001 -41C98.824 -44.875 98.163 -48.906 96.401 -52.6C94.787 -52.85 94.089 -54.589 92.752 -55.309C91.419 -56.028 90.851 -54.449 90.892 -53.403C90.899 -53.198 91.351 -52.974 91.181 -52.609C91.105 -52.445 90.845 -52.334 90.845 -52.2C90.846 -52.065 91.067 -51.934 91.201 -51.8C90.283 -50.98 88.86 -50.503 88.565 -49.358C87.611 -45.648 90.184 -42.523 91.852 -39.322C92.443 -38.187 91.707 -36.916 90.947 -35.708C90.509 -35.013 90.617 -33.886 90.893 -33.03C91.645 -30.699 93.236 -28.96 94.771 -26.977z"} + , + {"fill": "#000000", + "path":"M57.611 -8.591C56.124 -6.74 52.712 -4.171 55.629 -2.243C55.823 -2.114 56.193 -2.11 56.366 -2.244C58.387 -3.809 60.39 -4.712 62.826 -5.294C62.95 -5.323 63.224 -4.856 63.593 -5.017C65.206 -5.72 67.216 -5.662 68.4 -7C72.167 -6.776 75.732 -7.892 79.123 -9.2C80.284 -9.648 81.554 -10.207 82.755 -10.709C84.131 -11.285 85.335 -12.213 86.447 -13.354C86.58 -13.49 86.934 -13.4 87.201 -13.4C87.161 -14.263 88.123 -14.39 88.37 -15.012C88.462 -15.244 88.312 -15.64 88.445 -15.742C90.583 -17.372 91.503 -19.39 90.334 -21.767C90.049 -22.345 89.8 -22.963 89.234 -23.439C88.149 -24.35 87.047 -23.496 86 -23.8C85.841 -23.172 85.112 -23.344 84.726 -23.146C83.867 -22.707 82.534 -23.292 81.675 -22.854C80.313 -22.159 79.072 -21.99 77.65 -21.613C77.338 -21.531 76.56 -21.627 76.4 -21C76.266 -21.134 76.118 -21.368 76.012 -21.346C74.104 -20.95 72.844 -20.736 71.543 -19.044C71.44 -18.911 70.998 -19.09 70.839 -18.955C69.882 -18.147 69.477 -16.913 68.376 -16.241C68.175 -16.118 67.823 -16.286 67.629 -16.157C66.983 -15.726 66.616 -15.085 65.974 -14.638C65.645 -14.409 65.245 -14.734 65.277 -14.99C65.522 -16.937 66.175 -18.724 65.6 -20.6C67.677 -23.12 70.194 -25.069 72 -27.8C72.015 -29.966 72.707 -32.112 72.594 -34.189C72.584 -34.382 72.296 -35.115 72.17 -35.462C71.858 -36.316 72.764 -37.382 71.92 -38.106C70.516 -39.309 69.224 -38.433 68.4 -37C66.562 -36.61 64.496 -35.917 62.918 -37.151C61.911 -37.938 61.333 -38.844 60.534 -39.9C59.549 -41.202 59.884 -42.638 59.954 -44.202C59.96 -44.33 59.645 -44.466 59.645 -44.6C59.646 -44.735 59.866 -44.866 60 -45C59.294 -45.626 59.019 -46.684 58 -47C58.305 -48.092 57.629 -48.976 56.758 -49.278C54.763 -49.969 53.086 -48.057 51.194 -47.984C50.68 -47.965 50.213 -49.003 49.564 -49.328C49.132 -49.544 48.428 -49.577 48.066 -49.311C47.378 -48.807 46.789 -48.693 46.031 -48.488C44.414 -48.052 43.136 -46.958 41.656 -46.103C40.171 -45.246 39.216 -43.809 38.136 -42.489C37.195 -41.337 37.059 -38.923 38.479 -38.423C40.322 -37.773 41.626 -40.476 43.592 -40.15C43.904 -40.099 44.11 -39.788 44 -39.4C44.389 -39.291 44.607 -39.52 44.8 -39.8C45.658 -38.781 46.822 -38.444 47.76 -37.571C48.73 -36.667 50.476 -37.085 51.491 -36.088C53.02 -34.586 52.461 -31.905 54.4 -30.6C53.814 -29.287 53.207 -28.01 52.872 -26.583C52.59 -25.377 53.584 -24.18 54.795 -24.271C56.053 -24.365 56.315 -25.124 56.8 -26.2C57.067 -25.933 57.536 -25.636 57.495 -25.42C57.038 -23.033 56.011 -21.04 55.553 -18.609C55.494 -18.292 55.189 -18.09 54.8 -18.2C54.332 -14.051 50.28 -11.657 47.735 -8.492C47.332 -7.99 47.328 -6.741 47.737 -6.338C49.14 -4.951 51.1 -6.497 52.8 -7C53.013 -8.206 53.872 -9.148 55.204 -9.092C55.46 -9.082 55.695 -9.624 56.019 -9.754C56.367 -9.892 56.869 -9.668 57.155 -9.866C58.884 -11.061 60.292 -12.167 62.03 -13.356C62.222 -13.487 62.566 -13.328 62.782 -13.436C63.107 -13.598 63.294 -13.985 63.617 -14.17C63.965 -14.37 64.207 -14.08 64.4 -13.8C63.754 -13.451 63.75 -12.494 63.168 -12.292C62.393 -12.024 61.832 -11.511 61.158 -11.064C60.866 -10.871 60.207 -11.119 60.103 -10.94C59.505 -9.912 58.321 -9.474 57.611 -8.591z"} + , + {"fill": "#000000", + "path":"M2.2 -58C2.2 -58 -7.038 -60.872 -18.2 -35.2C-18.2 -35.2 -20.6 -30 -23 -28C-25.4 -26 -36.6 -22.4 -38.6 -18.4L-49 -2.4C-49 -2.4 -34.2 -18.4 -31 -20.8C-31 -20.8 -23 -29.2 -26.2 -22.4C-26.2 -22.4 -40.2 -11.6 -39 -2.4C-39 -2.4 -44.6 12 -45.4 14C-45.4 14 -29.4 -18 -27 -19.2C-24.6 -20.4 -23.4 -20.4 -24.6 -16.8C-25.8 -13.2 -26.2 3.2 -29 5.2C-29 5.2 -21 -15.2 -21.8 -18.4C-21.8 -18.4 -18.6 -22 -16.2 -16.8L-17.4 -0.8L-13 11.2C-13 11.2 -15.4 0 -13.8 -15.6C-13.8 -15.6 -15.8 -26 -11.8 -20.4C-7.8 -14.8 1.8 -8.8 1.8 -4C1.8 -4 -3.4 -21.6 -12.6 -26.4L-16.6 -20.4L-17.8 -22.4C-17.8 -22.4 -21.4 -23.2 -17 -30C-12.6 -36.8 -13 -37.6 -13 -37.6C-13 -37.6 -6.6 -30.4 -5 -30.4C-5 -30.4 8.2 -38 9.4 -13.6C9.4 -13.6 16.2 -28 7 -34.8C7 -34.8 -7.8 -36.8 -6.6 -42L0.6 -54.4C4.2 -59.6 2.6 -56.8 2.6 -56.8z"} + , + {"fill": "#000000", + "path":"M-17.8 -41.6C-17.8 -41.6 -30.6 -41.6 -33.8 -36.4L-41 -26.8C-41 -26.8 -23.8 -36.8 -19.8 -38C-15.8 -39.2 -17.8 -41.6 -17.8 -41.6z"} + , + {"fill": "#000000", + "path":"M-57.8 -35.2C-57.8 -35.2 -59.8 -34 -60.2 -31.2C-60.6 -28.4 -63 -28 -62.2 -25.2C-61.4 -22.4 -59.4 -20 -59.4 -24C-59.4 -28 -57.8 -30 -57 -31.2C-56.2 -32.4 -54.6 -36.8 -57.8 -35.2z"} + , + {"fill": "#000000", + "path":"M-66.6 26C-66.6 26 -75 22 -78.2 18.4C-81.4 14.8 -80.948 19.966 -85.8 19.6C-91.647 19.159 -90.6 3.2 -90.6 3.2L-94.6 10.8C-94.6 10.8 -95.8 25.2 -87.8 22.8C-83.893 21.628 -82.6 23.2 -84.2 24C-85.8 24.8 -78.6 25.2 -81.4 26.8C-84.2 28.4 -69.8 23.2 -72.2 33.6L-66.6 26z"} + , + {"fill": "#000000", + "path":"M-79.2 40.4C-79.2 40.4 -94.6 44.8 -98.2 35.2C-98.2 35.2 -103 37.6 -100.8 40.6C-98.6 43.6 -97.4 44 -97.4 44C-97.4 44 -92 45.2 -92.6 46C-93.2 46.8 -95.6 50.2 -95.6 50.2C-95.6 50.2 -85.4 44.2 -79.2 40.4z"} + , + {"fill": "#ffffff", + "path":"M149.201 118.601C148.774 120.735 147.103 121.536 145.201 122.201C143.284 121.243 140.686 118.137 138.801 120.201C138.327 119.721 137.548 119.661 137.204 118.999C136.739 118.101 137.011 117.055 136.669 116.257C136.124 114.985 135.415 113.619 135.601 112.201C137.407 111.489 138.002 109.583 137.528 107.82C137.459 107.563 137.03 107.366 137.23 107.017C137.416 106.694 137.734 106.467 138.001 106.2C137.866 106.335 137.721 106.568 137.61 106.548C137 106.442 137.124 105.805 137.254 105.418C137.839 103.672 139.853 103.408 141.201 104.6C141.457 104.035 141.966 104.229 142.401 104.2C142.351 103.621 142.759 103.094 142.957 102.674C143.475 101.576 145.104 102.682 145.901 102.07C146.977 101.245 148.04 100.546 149.118 101.149C150.927 102.162 152.636 103.374 153.835 105.115C154.41 105.949 154.65 107.23 154.592 108.188C154.554 108.835 153.173 108.483 152.83 109.412C152.185 111.16 154.016 111.679 154.772 113.017C154.97 113.366 154.706 113.67 154.391 113.768C153.98 113.896 153.196 113.707 153.334 114.16C154.306 117.353 151.55 118.031 149.201 118.601z"} + , + {"fill": "#ffffff", + "path":"M139.6 138.201C139.593 136.463 137.992 134.707 139.201 133.001C139.336 133.135 139.467 133.356 139.601 133.356C139.736 133.356 139.867 133.135 140.001 133.001C141.496 135.217 145.148 136.145 145.006 138.991C144.984 139.438 143.897 140.356 144.801 141.001C142.988 142.349 142.933 144.719 142.001 146.601C140.763 146.315 139.551 145.952 138.401 145.401C138.753 143.915 138.636 142.231 139.456 140.911C139.89 140.213 139.603 139.134 139.6 138.201z"} + , + {"fill": "#cccccc", + "path":"M-26.6 129.201C-26.6 129.201 -43.458 139.337 -29.4 124.001C-20.6 114.401 -10.6 108.801 -10.6 108.801C-10.6 108.801 -0.2 104.4 3.4 103.2C7 102 22.2 96.8 25.4 96.4C28.6 96 38.2 92 45 96C51.8 100 59.8 104.4 59.8 104.4C59.8 104.4 43.4 96 39.8 98.4C36.2 100.8 29 100.4 23 103.6C23 103.6 8.2 108.001 5 110.001C1.8 112.001 -8.6 123.601 -10.2 122.801C-11.8 122.001 -9.8 121.601 -8.6 118.801C-7.4 116.001 -9.4 114.401 -17.4 120.801C-25.4 127.201 -26.6 129.201 -26.6 129.201z"} + , + {"fill": "#000000", + "path":"M-19.195 123.234C-19.195 123.234 -17.785 110.194 -9.307 111.859C-9.307 111.859 -1.081 107.689 1.641 105.721C1.641 105.721 9.78 104.019 11.09 103.402C29.569 94.702 44.288 99.221 44.835 98.101C45.381 96.982 65.006 104.099 68.615 108.185C69.006 108.628 58.384 102.588 48.686 100.697C40.413 99.083 18.811 100.944 7.905 106.48C4.932 107.989 -4.013 113.773 -6.544 113.662C-9.075 113.55 -19.195 123.234 -19.195 123.234z"} + , + {"fill": "#cccccc", + "path":"M-23 148.801C-23 148.801 -38.2 146.401 -21.4 144.801C-21.4 144.801 -3.4 142.801 0.6 137.601C0.6 137.601 14.2 128.401 17 128.001C19.8 127.601 49.8 120.401 50.2 118.001C50.6 115.601 56.2 115.601 57.8 116.401C59.4 117.201 58.6 118.401 55.8 119.201C53 120.001 21.8 136.401 15.4 137.601C9 138.801 -2.6 146.401 -7.4 147.601C-12.2 148.801 -23 148.801 -23 148.801z"} + , + {"fill": "#000000", + "path":"M-3.48 141.403C-3.48 141.403 -12.062 140.574 -3.461 139.755C-3.461 139.755 5.355 136.331 7.403 133.668C7.403 133.668 14.367 128.957 15.8 128.753C17.234 128.548 31.194 124.861 31.399 123.633C31.604 122.404 65.67 109.823 70.09 113.013C73.001 115.114 63.1 113.437 53.466 117.847C52.111 118.467 18.258 133.054 14.981 133.668C11.704 134.283 5.765 138.174 3.307 138.788C0.85 139.403 -3.48 141.403 -3.48 141.403z"} + , + {"fill": "#000000", + "path":"M-11.4 143.601C-11.4 143.601 -6.2 143.201 -7.4 144.801C-8.6 146.401 -11 145.601 -11 145.601L-11.4 143.601z"} + , + {"fill": "#000000", + "path":"M-18.6 145.201C-18.6 145.201 -13.4 144.801 -14.6 146.401C-15.8 148.001 -18.2 147.201 -18.2 147.201L-18.6 145.201z"} + , + {"fill": "#000000", + "path":"M-29 146.801C-29 146.801 -23.8 146.401 -25 148.001C-26.2 149.601 -28.6 148.801 -28.6 148.801L-29 146.801z"} + , + {"fill": "#000000", + "path":"M-36.6 147.601C-36.6 147.601 -31.4 147.201 -32.6 148.801C-33.8 150.401 -36.2 149.601 -36.2 149.601L-36.6 147.601z"} + , + {"fill": "#000000", + "path":"M1.8 108.001C1.8 108.001 6.2 108.001 5 109.601C3.8 111.201 0.6 110.801 0.6 110.801L1.8 108.001z"} + , + {"fill": "#000000", + "path":"M-8.2 113.601C-8.2 113.601 -1.694 111.46 -4.2 114.801C-5.4 116.401 -7.8 115.601 -7.8 115.601L-8.2 113.601z"} + , + {"fill": "#000000", + "path":"M-19.4 118.401C-19.4 118.401 -14.2 118.001 -15.4 119.601C-16.6 121.201 -19 120.401 -19 120.401L-19.4 118.401z"} + , + {"fill": "#000000", + "path":"M-27 124.401C-27 124.401 -21.8 124.001 -23 125.601C-24.2 127.201 -26.6 126.401 -26.6 126.401L-27 124.401z"} + , + {"fill": "#000000", + "path":"M-33.8 129.201C-33.8 129.201 -28.6 128.801 -29.8 130.401C-31 132.001 -33.4 131.201 -33.4 131.201L-33.8 129.201z"} + , + {"fill": "#000000", + "path":"M5.282 135.598C5.282 135.598 12.203 135.066 10.606 137.195C9.009 139.325 5.814 138.26 5.814 138.26L5.282 135.598z"} + , + {"fill": "#000000", + "path":"M15.682 130.798C15.682 130.798 22.603 130.266 21.006 132.395C19.409 134.525 16.214 133.46 16.214 133.46L15.682 130.798z"} + , + {"fill": "#000000", + "path":"M26.482 126.398C26.482 126.398 33.403 125.866 31.806 127.995C30.209 130.125 27.014 129.06 27.014 129.06L26.482 126.398z"} + , + {"fill": "#000000", + "path":"M36.882 121.598C36.882 121.598 43.803 121.066 42.206 123.195C40.609 125.325 37.414 124.26 37.414 124.26L36.882 121.598z"} + , + {"fill": "#000000", + "path":"M9.282 103.598C9.282 103.598 16.203 103.066 14.606 105.195C13.009 107.325 9.014 107.06 9.014 107.06L9.282 103.598z"} + , + {"fill": "#000000", + "path":"M19.282 100.398C19.282 100.398 26.203 99.866 24.606 101.995C23.009 104.125 18.614 103.86 18.614 103.86L19.282 100.398z"} + , + {"fill": "#000000", + "path":"M-3.4 140.401C-3.4 140.401 1.8 140.001 0.6 141.601C-0.6 143.201 -3 142.401 -3 142.401L-3.4 140.401z"} + , + {"fill": "#992600", + "path":"M-76.6 41.2C-76.6 41.2 -81 50 -81.4 53.2C-81.4 53.2 -80.6 44.4 -79.4 42.4C-78.2 40.4 -76.6 41.2 -76.6 41.2z"} + , + {"fill": "#992600", + "path":"M-95 55.2C-95 55.2 -98.2 69.6 -97.8 72.4C-97.8 72.4 -99 60.8 -98.6 59.6C-98.2 58.4 -95 55.2 -95 55.2z"} + , + {"fill": "#cccccc", + "path":"M-74.2 -19.4L-74.4 -16.2L-76.6 -16C-76.6 -16 -62.4 -3.4 -61.8 4.2C-61.8 4.2 -61 -4 -74.2 -19.4z"} + , + {"fill": "#000000", + "path":"M-70.216 -18.135C-70.647 -18.551 -70.428 -19.296 -70.836 -19.556C-71.645 -20.072 -69.538 -20.129 -69.766 -20.845C-70.149 -22.051 -69.962 -22.072 -70.084 -23.348C-70.141 -23.946 -69.553 -25.486 -69.168 -25.926C-67.722 -27.578 -69.046 -30.51 -67.406 -32.061C-67.102 -32.35 -66.726 -32.902 -66.441 -33.32C-65.782 -34.283 -64.598 -34.771 -63.648 -35.599C-63.33 -35.875 -63.531 -36.702 -62.962 -36.61C-62.248 -36.495 -61.007 -36.625 -61.052 -35.784C-61.165 -33.664 -62.494 -31.944 -63.774 -30.276C-63.323 -29.572 -63.781 -28.937 -64.065 -28.38C-65.4 -25.76 -65.211 -22.919 -65.385 -20.079C-65.39 -19.994 -65.697 -19.916 -65.689 -19.863C-65.336 -17.528 -64.752 -15.329 -63.873 -13.1C-63.507 -12.17 -63.036 -11.275 -62.886 -10.348C-62.775 -9.662 -62.672 -8.829 -63.08 -8.124C-61.045 -5.234 -62.354 -2.583 -61.185 0.948C-60.978 1.573 -59.286 3.487 -59.749 3.326C-62.262 2.455 -62.374 2.057 -62.551 1.304C-62.697 0.681 -63.027 -0.696 -63.264 -1.298C-63.328 -1.462 -63.499 -3.346 -63.577 -3.468C-65.09 -5.85 -63.732 -5.674 -65.102 -8.032C-66.53 -8.712 -67.496 -9.816 -68.619 -10.978C-68.817 -11.182 -67.674 -11.906 -67.855 -12.119C-68.947 -13.408 -70.1 -14.175 -69.764 -15.668C-69.609 -16.358 -69.472 -17.415 -70.216 -18.135z"} + , + {"fill": "#000000", + "path":"M-73.8 -16.4C-73.8 -16.4 -73.4 -9.6 -71 -8C-68.6 -6.4 -69.8 -7.2 -73 -8.4C-76.2 -9.6 -75 -10.4 -75 -10.4C-75 -10.4 -77.8 -10 -75.4 -8C-73 -6 -69.4 -3.6 -71 -3.6C-72.6 -3.6 -80.2 -7.6 -80.2 -10.4C-80.2 -13.2 -81.2 -17.3 -81.2 -17.3C-81.2 -17.3 -80.1 -18.1 -75.3 -18C-75.3 -18 -73.9 -17.3 -73.8 -16.4z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-74.6 2.2C-74.6 2.2 -83.12 -0.591 -101.6 2.8C-101.6 2.8 -92.569 0.722 -73.8 3C-63.5 4.25 -74.6 2.2 -74.6 2.2z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-72.502 2.129C-72.502 2.129 -80.748 -1.389 -99.453 0.392C-99.453 0.392 -90.275 -0.897 -71.774 2.995C-61.62 5.131 -72.502 2.129 -72.502 2.129z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-70.714 2.222C-70.714 2.222 -78.676 -1.899 -97.461 -1.514C-97.461 -1.514 -88.213 -2.118 -70.052 3.14C-60.086 6.025 -70.714 2.222 -70.714 2.222z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-69.444 2.445C-69.444 2.445 -76.268 -1.862 -93.142 -2.96C-93.142 -2.96 -84.803 -2.79 -68.922 3.319C-60.206 6.672 -69.444 2.445 -69.444 2.445z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M45.84 12.961C45.84 12.961 44.91 13.605 45.124 12.424C45.339 11.243 73.547 -1.927 77.161 -1.677C77.161 -1.677 46.913 11.529 45.84 12.961z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M42.446 13.6C42.446 13.6 41.57 14.315 41.691 13.121C41.812 11.927 68.899 -3.418 72.521 -3.452C72.521 -3.452 43.404 12.089 42.446 13.6z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M39.16 14.975C39.16 14.975 38.332 15.747 38.374 14.547C38.416 13.348 58.233 -2.149 68.045 -4.023C68.045 -4.023 50.015 4.104 39.16 14.975z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M36.284 16.838C36.284 16.838 35.539 17.532 35.577 16.453C35.615 15.373 53.449 1.426 62.28 -0.26C62.28 -0.26 46.054 7.054 36.284 16.838z"} + , + {"fill": "#cccccc", + "path":"M4.6 164.801C4.6 164.801 -10.6 162.401 6.2 160.801C6.2 160.801 24.2 158.801 28.2 153.601C28.2 153.601 41.8 144.401 44.6 144.001C47.4 143.601 63.8 140.001 64.2 137.601C64.6 135.201 70.6 132.801 72.2 133.601C73.8 134.401 73.8 143.601 71 144.401C68.2 145.201 49.4 152.401 43 153.601C36.6 154.801 25 162.401 20.2 163.601C15.4 164.801 4.6 164.801 4.6 164.801z"} + , + {"fill": "#000000", + "path":"M77.6 127.401C77.6 127.401 74.6 129.001 73.4 131.601C73.4 131.601 67 142.201 52.8 145.401C52.8 145.401 29.8 154.401 22 156.401C22 156.401 8.6 161.401 1.2 160.601C1.2 160.601 -5.8 160.801 0.4 162.401C0.4 162.401 20.6 160.401 24 158.601C24 158.601 39.6 153.401 42.6 150.801C45.6 148.201 63.8 143.201 66 141.201C68.2 139.201 78 130.801 77.6 127.401z"} + , + {"fill": "#000000", + "path":"M18.882 158.911C18.882 158.911 24.111 158.685 22.958 160.234C21.805 161.784 19.357 160.91 19.357 160.91L18.882 158.911z"} + , + {"fill": "#000000", + "path":"M11.68 160.263C11.68 160.263 16.908 160.037 15.756 161.586C14.603 163.136 12.155 162.263 12.155 162.263L11.68 160.263z"} + , + {"fill": "#000000", + "path":"M1.251 161.511C1.251 161.511 6.48 161.284 5.327 162.834C4.174 164.383 1.726 163.51 1.726 163.51L1.251 161.511z"} + , + {"fill": "#000000", + "path":"M-6.383 162.055C-6.383 162.055 -1.154 161.829 -2.307 163.378C-3.46 164.928 -5.908 164.054 -5.908 164.054L-6.383 162.055z"} + , + {"fill": "#000000", + "path":"M35.415 151.513C35.415 151.513 42.375 151.212 40.84 153.274C39.306 155.336 36.047 154.174 36.047 154.174L35.415 151.513z"} + , + {"fill": "#000000", + "path":"M45.73 147.088C45.73 147.088 51.689 143.787 51.155 148.849C50.885 151.405 46.362 149.749 46.362 149.749L45.73 147.088z"} + , + {"fill": "#000000", + "path":"M54.862 144.274C54.862 144.274 62.021 140.573 60.287 146.035C59.509 148.485 55.493 146.935 55.493 146.935L54.862 144.274z"} + , + {"fill": "#000000", + "path":"M64.376 139.449C64.376 139.449 68.735 134.548 69.801 141.21C70.207 143.748 65.008 142.11 65.008 142.11L64.376 139.449z"} + , + {"fill": "#000000", + "path":"M26.834 155.997C26.834 155.997 32.062 155.77 30.91 157.32C29.757 158.869 27.308 157.996 27.308 157.996L26.834 155.997z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M62.434 34.603C62.434 34.603 61.708 35.268 61.707 34.197C61.707 33.127 79.191 19.863 88.034 18.479C88.034 18.479 71.935 25.208 62.434 34.603z"} + , + {"fill": "#000000", + "path":"M65.4 98.4C65.4 98.4 87.401 120.801 96.601 124.401C96.601 124.401 105.801 135.601 101.801 161.601C101.801 161.601 98.601 169.201 95.401 148.401C95.401 148.401 98.601 123.201 87.401 139.201C87.401 139.201 79 129.301 85.4 129.601C85.4 129.601 88.601 131.601 89.001 130.001C89.401 128.401 81.4 114.801 64.2 100.4C47 86 65.4 98.4 65.4 98.4z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M7 137.201C7 137.201 6.8 135.401 8.6 136.201C10.4 137.001 104.601 143.201 136.201 167.201C136.201 167.201 91.001 144.001 7 137.201z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M17.4 132.801C17.4 132.801 17.2 131.001 19 131.801C20.8 132.601 157.401 131.601 181.001 164.001C181.001 164.001 159.001 138.801 17.4 132.801z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M29 128.801C29 128.801 28.8 127.001 30.6 127.801C32.4 128.601 205.801 115.601 229.401 148.001C229.401 148.001 219.801 122.401 29 128.801z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M39 124.001C39 124.001 38.8 122.201 40.6 123.001C42.4 123.801 164.601 85.2 188.201 117.601C188.201 117.601 174.801 93 39 124.001z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-19 146.801C-19 146.801 -19.2 145.001 -17.4 145.801C-15.6 146.601 2.2 148.801 4.2 187.601C4.2 187.601 -3 145.601 -19 146.801z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-27.8 148.401C-27.8 148.401 -28 146.601 -26.2 147.401C-24.4 148.201 -10.2 143.601 -13 182.401C-13 182.401 -11.8 147.201 -27.8 148.401z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-35.8 148.801C-35.8 148.801 -36 147.001 -34.2 147.801C-32.4 148.601 -17 149.201 -29.4 171.601C-29.4 171.601 -19.8 147.601 -35.8 148.801z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M11.526 104.465C11.526 104.465 11.082 106.464 12.631 105.247C28.699 92.622 61.141 33.72 116.826 28.086C116.826 28.086 78.518 15.976 11.526 104.465z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M22.726 102.665C22.726 102.665 21.363 101.472 23.231 100.847C25.099 100.222 137.541 27.72 176.826 35.686C176.826 35.686 149.719 28.176 22.726 102.665z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M1.885 108.767C1.885 108.767 1.376 110.366 3.087 109.39C12.062 104.27 15.677 47.059 59.254 45.804C59.254 45.804 26.843 31.09 1.885 108.767z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-18.038 119.793C-18.038 119.793 -19.115 121.079 -17.162 120.825C-6.916 119.493 14.489 78.222 58.928 83.301C58.928 83.301 26.962 68.955 -18.038 119.793z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-6.8 113.667C-6.8 113.667 -7.611 115.136 -5.742 114.511C4.057 111.237 17.141 66.625 61.729 63.078C61.729 63.078 27.603 55.135 -6.8 113.667z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-25.078 124.912C-25.078 124.912 -25.951 125.954 -24.369 125.748C-16.07 124.669 1.268 91.24 37.264 95.354C37.264 95.354 11.371 83.734 -25.078 124.912z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-32.677 130.821C-32.677 130.821 -33.682 131.866 -32.091 131.748C-27.923 131.439 2.715 98.36 21.183 113.862C21.183 113.862 9.168 95.139 -32.677 130.821z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M36.855 98.898C36.855 98.898 35.654 97.543 37.586 97.158C39.518 96.774 160.221 39.061 198.184 51.927C198.184 51.927 172.243 41.053 36.855 98.898z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M3.4 163.201C3.4 163.201 3.2 161.401 5 162.201C6.8 163.001 22.2 163.601 9.8 186.001C9.8 186.001 19.4 162.001 3.4 163.201z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M13.8 161.601C13.8 161.601 13.6 159.801 15.4 160.601C17.2 161.401 35 163.601 37 202.401C37 202.401 29.8 160.401 13.8 161.601z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M20.6 160.001C20.6 160.001 20.4 158.201 22.2 159.001C24 159.801 48.6 163.201 72.2 195.601C72.2 195.601 36.6 158.801 20.6 160.001z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M28.225 157.972C28.225 157.972 27.788 156.214 29.678 156.768C31.568 157.322 52.002 155.423 90.099 189.599C90.099 189.599 43.924 154.656 28.225 157.972z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M38.625 153.572C38.625 153.572 38.188 151.814 40.078 152.368C41.968 152.922 76.802 157.423 128.499 192.399C128.499 192.399 54.324 150.256 38.625 153.572z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-1.8 142.001C-1.8 142.001 -2 140.201 -0.2 141.001C1.6 141.801 55 144.401 85.4 171.201C85.4 171.201 50.499 146.426 -1.8 142.001z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M-11.8 146.001C-11.8 146.001 -12 144.201 -10.2 145.001C-8.4 145.801 16.2 149.201 39.8 181.601C39.8 181.601 4.2 144.801 -11.8 146.001z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M49.503 148.962C49.503 148.962 48.938 147.241 50.864 147.655C52.79 148.068 87.86 150.004 141.981 181.098C141.981 181.098 64.317 146.704 49.503 148.962z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M57.903 146.562C57.903 146.562 57.338 144.841 59.264 145.255C61.19 145.668 96.26 147.604 150.381 178.698C150.381 178.698 73.317 143.904 57.903 146.562z"} + , + {"fill": "#ffffff", "stroke":"#000000", "width":0.1, + "path":"M67.503 141.562C67.503 141.562 66.938 139.841 68.864 140.255C70.79 140.668 113.86 145.004 203.582 179.298C203.582 179.298 82.917 138.904 67.503 141.562z"} + , + {"fill": "#000000", + "path":"M-43.8 148.401C-43.8 148.401 -38.6 148.001 -39.8 149.601C-41 151.201 -43.4 150.401 -43.4 150.401L-43.8 148.401z"} + , + {"fill": "#000000", + "path":"M-13 162.401C-13 162.401 -7.8 162.001 -9 163.601C-10.2 165.201 -12.6 164.401 -12.6 164.401L-13 162.401z"} + , + {"fill": "#000000", + "path":"M-21.8 162.001C-21.8 162.001 -16.6 161.601 -17.8 163.201C-19 164.801 -21.4 164.001 -21.4 164.001L-21.8 162.001z"} + , + {"fill": "#000000", + "path":"M-117.169 150.182C-117.169 150.182 -112.124 151.505 -113.782 152.624C-115.439 153.744 -117.446 152.202 -117.446 152.202L-117.169 150.182z"} + , + {"fill": "#000000", + "path":"M-115.169 140.582C-115.169 140.582 -110.124 141.905 -111.782 143.024C-113.439 144.144 -115.446 142.602 -115.446 142.602L-115.169 140.582z"} + , + {"fill": "#000000", + "path":"M-122.369 136.182C-122.369 136.182 -117.324 137.505 -118.982 138.624C-120.639 139.744 -122.646 138.202 -122.646 138.202L-122.369 136.182z"} + , + {"fill": "#cccccc", + "path":"M-42.6 211.201C-42.6 211.201 -44.2 211.201 -48.2 213.201C-50.2 213.201 -61.4 216.801 -67 226.801C-67 226.801 -54.6 217.201 -42.6 211.201z"} + , + {"fill": "#cccccc", + "path":"M45.116 303.847C45.257 304.105 45.312 304.525 45.604 304.542C46.262 304.582 47.495 304.883 47.37 304.247C46.522 299.941 45.648 295.004 41.515 293.197C40.876 292.918 39.434 293.331 39.36 294.215C39.233 295.739 39.116 297.088 39.425 298.554C39.725 299.975 41.883 299.985 42.8 298.601C43.736 300.273 44.168 302.116 45.116 303.847z"} + , + {"fill": "#cccccc", + "path":"M34.038 308.581C34.786 309.994 34.659 311.853 36.074 312.416C36.814 312.71 38.664 311.735 38.246 310.661C37.444 308.6 37.056 306.361 35.667 304.55C35.467 304.288 35.707 303.755 35.547 303.427C34.953 302.207 33.808 301.472 32.4 301.801C31.285 304.004 32.433 306.133 33.955 307.842C34.091 307.994 33.925 308.37 34.038 308.581z"} + , + {"fill": "#cccccc", + "path":"M-5.564 303.391C-5.672 303.014 -5.71 302.551 -5.545 302.23C-5.014 301.197 -4.221 300.075 -4.558 299.053C-4.906 297.997 -6.022 298.179 -6.672 298.748C-7.807 299.742 -7.856 301.568 -8.547 302.927C-8.743 303.313 -8.692 303.886 -9.133 304.277C-9.607 304.698 -10.047 306.222 -9.951 306.793C-9.898 307.106 -10.081 317.014 -9.859 316.751C-9.24 316.018 -6.19 306.284 -6.121 305.392C-6.064 304.661 -5.332 304.196 -5.564 303.391z"} + , + {"fill": "#cccccc", + "path":"M-31.202 296.599C-28.568 294.1 -25.778 291.139 -26.22 287.427C-26.336 286.451 -28.111 286.978 -28.298 287.824C-29.1 291.449 -31.139 294.11 -33.707 296.502C-35.903 298.549 -37.765 304.893 -38 305.401C-34.303 300.145 -32.046 297.399 -31.202 296.599z"} + , + {"fill": "#cccccc", + "path":"M-44.776 290.635C-44.253 290.265 -44.555 289.774 -44.338 289.442C-43.385 287.984 -42.084 286.738 -42.066 285C-42.063 284.723 -42.441 284.414 -42.776 284.638C-43.053 284.822 -43.395 284.952 -43.503 285.082C-45.533 287.531 -46.933 290.202 -48.376 293.014C-48.559 293.371 -49.703 297.862 -49.39 297.973C-49.151 298.058 -47.431 293.877 -47.221 293.763C-45.958 293.077 -45.946 291.462 -44.776 290.635z"} + , + {"fill": "#cccccc", + "path":"M-28.043 310.179C-27.599 309.31 -26.023 308.108 -26.136 307.219C-26.254 306.291 -25.786 304.848 -26.698 305.536C-27.955 306.484 -31.404 307.833 -31.674 313.641C-31.7 314.212 -28.726 311.519 -28.043 310.179z"} + , + {"fill": "#cccccc", + "path":"M-13.6 293.001C-13.2 292.333 -12.492 292.806 -12.033 292.543C-11.385 292.171 -10.774 291.613 -10.482 290.964C-9.512 288.815 -7.743 286.995 -7.6 284.601C-9.091 283.196 -9.77 285.236 -10.4 286.201C-11.723 284.554 -12.722 286.428 -14.022 286.947C-14.092 286.975 -14.305 286.628 -14.38 286.655C-15.557 287.095 -16.237 288.176 -17.235 288.957C-17.406 289.091 -17.811 288.911 -17.958 289.047C-18.61 289.65 -19.583 289.975 -19.863 290.657C-20.973 293.364 -24.113 295.459 -26 303.001C-25.619 303.91 -21.488 296.359 -21.001 295.661C-20.165 294.465 -20.047 297.322 -18.771 296.656C-18.72 296.629 -18.534 296.867 -18.4 297.001C-18.206 296.721 -17.988 296.492 -17.6 296.601C-17.6 296.201 -17.734 295.645 -17.533 295.486C-16.296 294.509 -16.38 293.441 -15.6 292.201C-15.142 292.99 -14.081 292.271 -13.6 293.001z"} + , + {"fill": "#cccccc", + "path":"M46.2 347.401C46.2 347.401 53.6 327.001 49.2 315.801C49.2 315.801 60.6 337.401 56 348.601C56 348.601 55.6 338.201 51.6 333.201C51.6 333.201 47.6 346.001 46.2 347.401z"} + , + {"fill": "#cccccc", + "path":"M31.4 344.801C31.4 344.801 36.8 336.001 28.8 317.601C28.8 317.601 28 338.001 21.2 349.001C21.2 349.001 35.4 328.801 31.4 344.801z"} + , + {"fill": "#cccccc", + "path":"M21.4 342.801C21.4 342.801 21.2 322.801 21.6 319.801C21.6 319.801 17.8 336.401 7.6 346.001C7.6 346.001 22 334.001 21.4 342.801z"} + , + {"fill": "#cccccc", + "path":"M11.8 310.801C11.8 310.801 17.8 324.401 7.8 342.801C7.8 342.801 14.2 330.601 9.4 323.601C9.4 323.601 12 320.201 11.8 310.801z"} + , + {"fill": "#cccccc", + "path":"M-7.4 342.401C-7.4 342.401 -8.4 326.801 -6.6 324.601C-6.6 324.601 -6.4 318.201 -6.8 317.201C-6.8 317.201 -2.8 311.001 -2.6 318.401C-2.6 318.401 -1.2 326.201 1.6 330.801C1.6 330.801 5.2 336.201 5 342.601C5 342.601 -5 312.401 -7.4 342.401z"} + , + {"fill": "#cccccc", + "path":"M-11 314.801C-11 314.801 -17.6 325.601 -19.4 344.601C-19.4 344.601 -20.8 338.401 -17 324.001C-17 324.001 -12.8 308.601 -11 314.801z"} + , + {"fill": "#cccccc", + "path":"M-32.8 334.601C-32.8 334.601 -27.8 329.201 -26.4 324.201C-26.4 324.201 -22.8 308.401 -29.2 317.001C-29.2 317.001 -29 325.001 -37.2 332.401C-37.2 332.401 -32.4 330.001 -32.8 334.601z"} + , + {"fill": "#cccccc", + "path":"M-38.6 329.601C-38.6 329.601 -35.2 312.201 -34.4 311.401C-34.4 311.401 -32.6 308.001 -35.4 311.201C-35.4 311.201 -44.2 330.401 -48.2 337.001C-48.2 337.001 -40.2 327.801 -38.6 329.601z"} + , + {"fill": "#cccccc", + "path":"M-44.4 313.001C-44.4 313.001 -32.8 290.601 -54.6 316.401C-54.6 316.401 -43.6 306.601 -44.4 313.001z"} + , + {"fill": "#cccccc", + "path":"M-59.8 298.401C-59.8 298.401 -55 279.601 -52.4 279.801C-52.4 279.801 -44.2 270.801 -50.8 281.401C-50.8 281.401 -56.8 291.001 -56.2 300.801C-56.2 300.801 -56.8 291.201 -59.8 298.401z"} + , + {"fill": "#cccccc", + "path":"M270.5 287C270.5 287 258.5 277 256 273.5C256 273.5 269.5 292 269.5 299C269.5 299 272 291.5 270.5 287z"} + , + {"fill": "#cccccc", + "path":"M276 265C276 265 255 250 251.5 242.5C251.5 242.5 278 272 278 276.5C278 276.5 278.5 267.5 276 265z"} + , + {"fill": "#cccccc", + "path":"M293 111C293 111 281 103 279.5 105C279.5 105 290 111.5 292.5 120C292.5 120 291 111 293 111z"} + , + {"fill": "#cccccc", + "path":"M301.5 191.5L284 179.5C284 179.5 303 196.5 303.5 200.5L301.5 191.5z"} + , + {"stroke":"#000000", + "path":"M-89.25 169L-67.25 173.75"} + , + {"stroke":"#000000", + "path":"M-39 331C-39 331 -39.5 327.5 -48.5 338"} + , + {"stroke":"#000000", + "path":"M-33.5 336C-33.5 336 -31.5 329.5 -38 334"} + , + {"stroke":"#000000", + "path":"M20.5 344.5C20.5 344.5 22 333.5 10.5 346.5"} +]; \ No newline at end of file diff --git a/examples/quick/canvas/tiger/tiger.qml b/examples/quick/canvas/tiger/tiger.qml new file mode 100644 index 0000000..8b629ee --- /dev/null +++ b/examples/quick/canvas/tiger/tiger.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import "../contents" +import "tiger.js" as Tiger +Item { + id:container + width:320 + height:480 + + Column { + spacing:5 + anchors.fill:parent + Text { font.pointSize:15; text:"Tiger with SVG path"; anchors.horizontalCenter:parent.horizontalCenter} + + Canvas { + id:canvas + width:320 + height:280 + antialiasing: true + property string strokeStyle:"steelblue" + property string fillStyle:"yellow" + property bool fill:true + property bool stroke:true + property real alpha:alphaCtrl.value + property real scaleX : scaleXCtrl.value + property real scaleY : scaleYCtrl.value + property real rotate : rotateCtrl.value + property int frame:0 + + onFillChanged: requestPaint(); + onStrokeChanged: requestPaint(); + onAlphaChanged: requestPaint(); + onScaleXChanged: requestPaint(); + onScaleYChanged: requestPaint(); + onRotateChanged: requestPaint(); + + onPainted : { + canvas.frame++; + if (canvas.frame < Tiger.tiger.length) + requestPaint(); + } + onPaint: { + var ctx = canvas.getContext('2d'); + ctx.save(); + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.globalAlpha = canvas.alpha; + ctx.scale(canvas.scaleX, canvas.scaleY); + ctx.rotate(canvas.rotate); + ctx.globalCompositeOperation = "source-over"; + ctx.translate(canvas.width/2, canvas.height/2); + ctx.strokeStyle = Qt.rgba(.3, .3, .3,1); + ctx.lineWidth = 1; + + //! [0] + for (var i = 0; i < canvas.frame && i < Tiger.tiger.length; i++) { + if (Tiger.tiger[i].width != undefined) + ctx.lineWidth = Tiger.tiger[i].width; + + if (Tiger.tiger[i].path != undefined) + ctx.path = Tiger.tiger[i].path; + + if (Tiger.tiger[i].fill != undefined) { + ctx.fillStyle = Tiger.tiger[i].fill; + ctx.fill(); + } + + if (Tiger.tiger[i].stroke != undefined) { + ctx.strokeStyle = Tiger.tiger[i].stroke; + ctx.stroke(); + } + } + //! [0] + ctx.restore(); + } + } + Rectangle { + id:controls + width:320 + height:150 + Column { + spacing:3 + Slider {id:scaleXCtrl; width:300; height:20; min:0.1; max:10; init:0.5; name:"ScaleX"} + Slider {id:scaleYCtrl; width:300; height:20; min:0.1; max:10; init:0.5; name:"ScaleY"} + Slider {id:rotateCtrl; width:300; height:20; min:0; max:Math.PI*2; init:0; name:"Rotate"} + Slider {id:alphaCtrl; width:300; height:20; min:0; max:1; init:1; name:"Alpha"} + } + } + } +} diff --git a/examples/quick/models/abstractitemmodel/abstractitemmodel.py b/examples/quick/models/abstractitemmodel/abstractitemmodel.py new file mode 100644 index 0000000..75f8d77 --- /dev/null +++ b/examples/quick/models/abstractitemmodel/abstractitemmodel.py @@ -0,0 +1,121 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +## of its contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import QAbstractListModel, QModelIndex, Qt, QUrl +from PyQt6.QtGui import QGuiApplication +from PyQt6.QtQuick import QQuickView + + +class Animal: + + def __init__(self, type, size): + self._type = type + self._size = size + + def type(self): + return self._type + + def size(self): + return self._size + + +class AnimalModel(QAbstractListModel): + + TypeRole = Qt.ItemDataRole.UserRole + 1 + SizeRole = Qt.ItemDataRole.UserRole + 2 + + _roles = {TypeRole: b"type", SizeRole: b"size"} + + def __init__(self, parent=None): + super().__init__(parent) + + self._animals = [] + + def addAnimal(self, animal): + self.beginInsertRows(QModelIndex(), self.rowCount(), self.rowCount()) + self._animals.append(animal) + self.endInsertRows() + + def rowCount(self, parent=QModelIndex()): + return len(self._animals) + + def data(self, index, role=Qt.ItemDataRole.DisplayRole): + try: + animal = self._animals[index.row()] + except IndexError: + return None + + if role == self.TypeRole: + return animal.type() + + if role == self.SizeRole: + return animal.size() + + return None + + def roleNames(self): + return self._roles + + +if __name__ == '__main__': + import os + import sys + + # This is necessary to avoid a possible crash when running from another + # directory by ensuring the compiled version of the embedded QML file + # doesn't get mixed up with another of the same name. + os.chdir(os.path.dirname(os.path.abspath(__file__))) + + app = QGuiApplication(sys.argv) + + model = AnimalModel() + model.addAnimal(Animal("Wolf", "Medium")) + model.addAnimal(Animal("Polar bear", "Large")) + model.addAnimal(Animal("Quoll", "Small")) + + view = QQuickView() + view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) + ctxt = view.rootContext() + ctxt.setContextProperty('myModel', model) + + view.setSource(QUrl.fromLocalFile('view.qml')) + view.show() + + sys.exit(app.exec()) diff --git a/examples/quick/models/abstractitemmodel/view.qml b/examples/quick/models/abstractitemmodel/view.qml new file mode 100644 index 0000000..381df0b --- /dev/null +++ b/examples/quick/models/abstractitemmodel/view.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +//![0] +ListView { + width: 200; height: 250 + + model: myModel + delegate: Text { text: "Animal: " + type + ", " + size } +} +//![0] + diff --git a/examples/quick/models/objectlistmodel/objectlistmodel.py b/examples/quick/models/objectlistmodel/objectlistmodel.py new file mode 100644 index 0000000..66edcae --- /dev/null +++ b/examples/quick/models/objectlistmodel/objectlistmodel.py @@ -0,0 +1,102 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +## of its contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import pyqtProperty, pyqtSignal, QObject, QUrl +from PyQt6.QtGui import QGuiApplication +from PyQt6.QtQuick import QQuickView + + +class DataObject(QObject): + + nameChanged = pyqtSignal() + + @pyqtProperty(str, notify=nameChanged) + def name(self): + return self._name + + @name.setter + def name(self, name): + if self._name != name: + self._name = name + self.nameChanged.emit() + + colorChanged = pyqtSignal() + + @pyqtProperty(str, notify=colorChanged) + def color(self): + return self._color + + @color.setter + def color(self, color): + if self._color != color: + self._color = color + self.colorChanged.emit() + + def __init__(self, name='', color='', parent=None): + super().__init__(parent) + + self._name = name + self._color = color + + +if __name__ == '__main__': + import os + import sys + + # This is necessary to avoid a possible crash when running from another + # directory by ensuring the compiled version of the embedded QML file + # doesn't get mixed up with another of the same name. + os.chdir(os.path.dirname(os.path.abspath(__file__))) + + app = QGuiApplication(sys.argv) + + dataList = [DataObject("Item 1", 'red'), + DataObject("Item 2", 'green'), + DataObject("Item 3", 'blue'), + DataObject("Item 4", 'yellow')] + + view = QQuickView() + view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) + view.setInitialProperties(dict(model=dataList)) + + view.setSource(QUrl.fromLocalFile('view.qml')) + view.show() + + sys.exit(app.exec()) diff --git a/examples/quick/models/objectlistmodel/view.qml b/examples/quick/models/objectlistmodel/view.qml new file mode 100644 index 0000000..de692ee --- /dev/null +++ b/examples/quick/models/objectlistmodel/view.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +//![0] +ListView { + width: 100; height: 100 + required model + + delegate: Rectangle { + required color + required property string name + + height: 25 + width: 100 + Text { text: parent.name } + } +} +//![0] diff --git a/examples/quick/models/stringlistmodel/stringlistmodel.py b/examples/quick/models/stringlistmodel/stringlistmodel.py new file mode 100644 index 0000000..c006d3c --- /dev/null +++ b/examples/quick/models/stringlistmodel/stringlistmodel.py @@ -0,0 +1,64 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +## of its contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +import os +import sys + +from PyQt6.QtCore import QUrl +from PyQt6.QtGui import QGuiApplication +from PyQt6.QtQuick import QQuickView + + +# This is necessary to avoid a possible crash when running from another +# directory by ensuring the compiled version of the embedded QML file doesn't +# get mixed up with another of the same name. +os.chdir(os.path.dirname(os.path.abspath(__file__))) + +app = QGuiApplication(sys.argv) + +dataList = ["Item 1", "Item 2", "Item 3", "Item 4"] + +view = QQuickView() +view.setInitialProperties(dict(model=dataList)) + +view.setSource(QUrl.fromLocalFile('view.qml')) +view.show() + +sys.exit(app.exec()) diff --git a/examples/quick/models/stringlistmodel/view.qml b/examples/quick/models/stringlistmodel/view.qml new file mode 100644 index 0000000..852e263 --- /dev/null +++ b/examples/quick/models/stringlistmodel/view.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +//![0] + +ListView { + width: 100 + height: 100 + required model + + delegate: Rectangle { + required property string modelData + height: 25 + width: 100 + Text { text: parent.modelData } + } +} +//![0] diff --git a/examples/quick/scenegraph/customgeometry/customgeometry.py b/examples/quick/scenegraph/customgeometry/customgeometry.py new file mode 100644 index 0000000..179d75f --- /dev/null +++ b/examples/quick/scenegraph/customgeometry/customgeometry.py @@ -0,0 +1,186 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +## of its contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import pyqtProperty, pyqtSignal, QPointF, QUrl +from PyQt6.QtGui import QColor, QGuiApplication +from PyQt6.QtQml import qmlRegisterType +from PyQt6.QtQuick import (QQuickItem, QQuickView, QSGFlatColorMaterial, + QSGGeometry, QSGGeometryNode, QSGNode) + + +class BezierCurve(QQuickItem): + + p1Changed = pyqtSignal(QPointF) + + @pyqtProperty(QPointF, notify=p1Changed) + def p1(self): + return self._p1 + + @p1.setter + def p1(self, p): + if self._p1 != p: + self._p1 = QPointF(p) + self.p1Changed.emit(p) + self.update() + + p2Changed = pyqtSignal(QPointF) + + @pyqtProperty(QPointF, notify=p2Changed) + def p2(self): + return self._p2 + + @p2.setter + def p2(self, p): + if self._p2 != p: + self._p2 = QPointF(p) + self.p2Changed.emit(p) + self.update() + + p3Changed = pyqtSignal(QPointF) + + @pyqtProperty(QPointF, notify=p3Changed) + def p3(self): + return self._p3 + + @p3.setter + def p3(self, p): + if self._p3 != p: + self._p3 = QPointF(p) + self.p3Changed.emit(p) + self.update() + + p4Changed = pyqtSignal(QPointF) + + @pyqtProperty(QPointF, notify=p4Changed) + def p4(self): + return self._p4 + + @p4.setter + def p4(self, p): + if self._p4 != p: + self._p4 = QPointF(p) + self.p4Changed.emit(p) + self.update() + + segmentCountChanged = pyqtSignal(int) + + @pyqtProperty(int, notify=segmentCountChanged) + def segmentCount(self): + return self._segmentCount + + @segmentCount.setter + def segmentCount(self, count): + if self._segmentCount != count: + self._segmentCount = count + self.segmentCountChanged.emit(count) + self.update() + + def __init__(self, parent=None): + super().__init__(parent) + + self._p1 = QPointF(0, 0) + self._p2 = QPointF(1, 0) + self._p3 = QPointF(0, 1) + self._p4 = QPointF(1, 1) + + self._segmentCount = 32 + + self._root_node = None + + self.setFlag(QQuickItem.Flags.ItemHasContents, True) + + def updatePaintNode(self, oldNode, nodeData): + if self._root_node is None: + self._root_node = QSGGeometryNode() + + geometry = QSGGeometry(QSGGeometry.defaultAttributes_Point2D(), + self._segmentCount) + geometry.setLineWidth(2) + geometry.setDrawingMode(QSGGeometry.DrawingMode.DrawLineStrip) + self._root_node.setGeometry(geometry) + self._root_node.setFlag(QSGNode.Flags.OwnsGeometry) + + material = QSGFlatColorMaterial() + material.setColor(QColor(255, 0, 0)) + self._root_node.setMaterial(material) + self._root_node.setFlag(QSGNode.Flags.OwnsMaterial) + else: + geometry = self._root_node.geometry() + geometry.allocate(self._segmentCount) + + w = self.width() + h = self.height() + vertices = geometry.vertexDataAsPoint2D() + + for i in range(self._segmentCount): + t = i / float(self._segmentCount - 1) + invt = 1 - t + + pos = invt * invt * invt * self._p1 \ + + 3 * invt * invt * t * self._p2 \ + + 3 * invt * t * t * self._p3 \ + + t * t * t * self._p4 + + vertices[i].set(pos.x() * w, pos.y() * h) + + self._root_node.markDirty(QSGNode.DirtyState.DirtyGeometry) + + return self._root_node + + +if __name__ == '__main__': + import os + import sys + + os.chdir(os.path.dirname(os.path.abspath(__file__))) + + app = QGuiApplication(sys.argv) + + qmlRegisterType(BezierCurve, 'CustomGeometry', 1, 0) + + view = QQuickView() + format = view.format() + format.setSamples(16) + view.setFormat(format) + + view.setSource(QUrl.fromLocalFile('main.qml')) + view.show() + + sys.exit(app.exec()) diff --git a/examples/quick/scenegraph/customgeometry/main.qml b/examples/quick/scenegraph/customgeometry/main.qml new file mode 100644 index 0000000..e14fc2b --- /dev/null +++ b/examples/quick/scenegraph/customgeometry/main.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the demonstration applications of the Qt Toolkit. +** +** $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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import CustomGeometry 1.0 + +Item { + width: 300 + height: 200 + + BezierCurve { + id: line + anchors.fill: parent + anchors.margins: 20 + + property real t + SequentialAnimation on t { + NumberAnimation { to: 1; duration: 2000; easing.type: Easing.InOutQuad } + NumberAnimation { to: 0; duration: 2000; easing.type: Easing.InOutQuad } + loops: Animation.Infinite + } + + p2: Qt.point(t, 1 - t) + p3: Qt.point(1 - t, t) + } + + Text { + anchors.bottom: line.bottom + + x: 20 + width: parent.width - 40 + wrapMode: Text.WordWrap + + text: "This curve is a custom scene graph item, implemented using GL_LINE_STRIP" + } +} diff --git a/examples/quick/shared/Button.qml b/examples/quick/shared/Button.qml new file mode 100644 index 0000000..9bbc01a --- /dev/null +++ b/examples/quick/shared/Button.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: container + + property string text: "Button" + property string subText: "" + signal clicked + property alias containsMouse: mouseArea.containsMouse + property alias pressed: mouseArea.pressed + implicitHeight: col.height + height: implicitHeight + width: buttonLabel.width + 20 + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: container.clicked() + hoverEnabled: true + } + + Column { + spacing: 2 + id: col + anchors.verticalCenter: parent.verticalCenter + width: parent.width + Text { + id: buttonLabel + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 10 + text: container.text + color: "black" + font.pixelSize: 22 + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + styleColor: "white" + style: Text.Raised + + } + Text { + id: buttonLabel2 + anchors.left: parent.left + anchors.leftMargin: 10 + text: container.subText + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + color: "#666" + font.pixelSize: 12 + } + } +} diff --git a/examples/quick/shared/LauncherList.qml b/examples/quick/shared/LauncherList.qml new file mode 100644 index 0000000..20f9c2b --- /dev/null +++ b/examples/quick/shared/LauncherList.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +Rectangle { + //model is a list of {"name":"somename", "url":"file:///some/url/mainfile.qml"} + //function used to add to model A) to enforce scheme B) to allow Qt.resolveUrl in url assignments + + color: "#eee" + function addExample(name, desc, url) + { + myModel.append({"name":name, "description":desc, "url":url}) + } + function hideExample() + { + ei.visible = false; + } + + ListView { + clip: true + delegate: SimpleLauncherDelegate{exampleItem: ei} + model: ListModel {id:myModel} + anchors.fill: parent + } + + Item { + id: ei + visible: false + clip: true + property url exampleUrl + onExampleUrlChanged: visible = (exampleUrl == '' ? false : true); //Setting exampleUrl automatically shows example + anchors.fill: parent + anchors.bottomMargin: 40 + Rectangle { + id: bg + anchors.fill: parent + color: "white" + } + MouseArea{ + anchors.fill: parent + enabled: ei.visible + //Eats mouse events + } + Loader{ + focus: true + source: ei.exampleUrl + anchors.fill: parent + } + } + Rectangle { + id: bar + visible: ei.visible + anchors.bottom: parent.bottom + width: parent.width + height: 40 + + Rectangle { + height: 1 + color: "#ccc" + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + } + + Rectangle { + height: 1 + color: "#fff" + anchors.top: parent.top + anchors.topMargin: 1 + anchors.left: parent.left + anchors.right: parent.right + } + + gradient: Gradient { + GradientStop { position: 0 ; color: "#eee" } + GradientStop { position: 1 ; color: "#ccc" } + } + + MouseArea{ + anchors.fill: parent + enabled: ei.visible + //Eats mouse events + } + + Image { + id: back + source: "images/back.png" + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 2 + anchors.left: parent.left + anchors.leftMargin: 16 + + MouseArea { + id: mouse + hoverEnabled: true + anchors.centerIn: parent + width: 38 + height: 31 + anchors.verticalCenterOffset: -1 + onClicked: ei.exampleUrl = "" + Rectangle { + anchors.fill: parent + opacity: mouse.pressed ? 1 : 0 + Behavior on opacity { NumberAnimation{ duration: 100 }} + gradient: Gradient { + GradientStop { position: 0 ; color: "#22000000" } + GradientStop { position: 0.2 ; color: "#11000000" } + } + border.color: "darkgray" + antialiasing: true + radius: 4 + } + } + } + } +} diff --git a/examples/quick/shared/SimpleLauncherDelegate.qml b/examples/quick/shared/SimpleLauncherDelegate.qml new file mode 100644 index 0000000..e891266 --- /dev/null +++ b/examples/quick/shared/SimpleLauncherDelegate.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +Rectangle { + id: container + property Item exampleItem + width: ListView.view.width + height: button.implicitHeight + 22 + + gradient: Gradient { + GradientStop { + position: 0 + Behavior on color {ColorAnimation { duration: 100 }} + color: button.pressed ? "#e0e0e0" : "#fff" + } + GradientStop { + position: 1 + Behavior on color {ColorAnimation { duration: 100 }} + color: button.pressed ? "#e0e0e0" : button.containsMouse ? "#f5f5f5" : "#eee" + } + } + + Image { + id: image + opacity: 0.7 + Behavior on opacity {NumberAnimation {duration: 100}} + source: "images/next.png" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 16 + } + + Button { + id: button + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.right:image.left + text: name + subText: description + onClicked: exampleItem.exampleUrl = url; + } + + Rectangle { + height: 1 + color: "#ccc" + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + } +} diff --git a/examples/quick/shared/images/back.png b/examples/quick/shared/images/back.png new file mode 100644 index 0000000000000000000000000000000000000000..53402096b294d5f7afdbbd36f5f13f68d7eb945e GIT binary patch literal 1590 zcmeAS@N?(olHy`uVBq!ia0vp@KrGI|1|%;mJK6}OBuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrIztFso#SM3hAM`dB6B=jtVb)aX^@765fKFxc2v6eK2Rr0UTq__OB&@Hb09I0xZL0)vRD^GUf^&XRs)DJWv2L<~p`n7AnVzAE zshOFfj)IYap^?4;5Si&3npl~dSs9rtK!Fm_wxX0Ys~{IQs9ivwtx`rwNr9EVetCJh zUb(Seeo?xx^|#0uTKVr7^KE~&-IMVSR9nfZANAQKal@=Hr> zm4GgVcp$o0y!L2NKW( z>+top^2{qPNz6-5^>ndS0-B+hnVDkc;_PZ+WNv0@YHng-Xy|I>WZ>#*Y2@VUYGiI; zV(#Ju)9aF-T$-DjR|38Iua(|ZvxVNYLRdxL?2X@#eYV@SoV zo+bjqPAtebucc)VTMZf1V)@8@r}*L{7aS3Nj=_x+t(i~XPf z&MTIToOaUjaMo770-5hKP82N+(7Bhu*K{i?`h8~UF2k(~6N+~F6uo|Jm}h?=ZSzhZ zw!_SU>(xtb{JC101YHZas->9Clvo>P&6eQ8wBTaKl%L7Gy!LMoLGkha5^ajTy}g|4&zo;dS3NEE;fjLi^{=4}pWPOJ+O*mMbvm9UC_~USn8hJahfdn0GNs6MyU#Ud6|L<)ey(jcl)*zJ@~BnY7I% z^9yaN8UEd=O~{<_^R~0I$>vA1J)Q`?6Fi)=^%C3J119ckS37<_$18U}fi7AzZCsS=07?@QuLn2Bde0{8v^Kf6`()~Xj@TAnpKdC8`Lf!&sHg;q@=(~U%$M( zT(8_%FTW^V-_X+15@d#vkuFe$ZgFK^Nn(X=Ua>OF1ees}+T7#d8#0MoBXEYLU9GXQxBrqI_HztY@Xxa#7Ppj3o=u^L<)Qdy9y zACy|0Us{w5jJPyqkW~d%&PAz-CHX}m`T04pPz=b(FUc>?$S+WE4mMNJ@J&q4%mWE% zf_3=%T6yLbmn7yTr+T{BDgn*V%gju%a&dOGFfunYH8nS}Ff?>Eax!prwKQ^abu}_K zFfn&=g6Vb1PcF?(%`1WFO+n~2!>JdP7;+1MHoK%2WtOF;xE1B+Du6w0m5JLe#yHJ` z>P^Az789I$^?{Dj2SqJXRKtXT=?BDwCtM&0p7c}mfa$#mn6Pj1+&{p;z!aLZn+uSIUMb9?9tH@OHz)A;$UOpUc9z-Zh|nkbgqtRZ%5}14JQ*j z2d54(F{LD{|7{8pEV1XOYPY05d$%s_!J9MhWcF3Q*=sy;Y00jeo7OOA@KrS%weO6% z#uahs0-FiH>jI4}>_2|RJ3OBCKDr^bsY#Bvc6LMVZ&uCQ+vEfM9rn)p=lR8aZ^&v@ z{eTX+JrAc}m~wDC^V)~%7RMwnGAmy*__Wf%_}4wQ^QL>!CUBea@Mi2u7V^2e-{1|8 zZ*;@f!^O<&lUWSkTxK@oI{MIZeY@t}s@DmH8Y?%d+%-u3#m%E#ap2cO%}M4@MCCbn zrF8gpC3IXhmhN#dDUD*9Wq41%d|_>mrv1b78?;TV7Yg1rI?VXV=#=3y?e~iIEN_Cf zR~eb4Y*@2`%^_@J^X^m3ml{{8oNZA^l3~2m`ijqsW5ODVn>;HWYG=LE&ybu@Yj~aE z + + + + +Heart Left-Highlight +This is a normal valentines day heart. + + +holiday +valentines + +valentine +hash(0x8a091c0) +hash(0x8a0916c) +signs_and_symbols +hash(0x8a091f0) +day + + + + +Jon Phillips + + + + +Jon Phillips + + + + +Jon Phillips + + + +image/svg+xml + + +en + + + + + + + + + + + + + + + diff --git a/examples/richtext/textobject/textobject.py b/examples/richtext/textobject/textobject.py new file mode 100644 index 0000000..ffc1516 --- /dev/null +++ b/examples/richtext/textobject/textobject.py @@ -0,0 +1,122 @@ +############################################################################# +## +## Copyright (C) 2021 Riverbank Computing Limited. +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## +## This file is part of the examples of PyQt. +## +## $QT_BEGIN_LICENSE:BSD$ +## You may use this file under the terms of the BSD license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +## the names of its contributors may be used to endorse or promote +## products derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## $QT_END_LICENSE$ +## +############################################################################# + + +from PyQt6.QtCore import QObject, QSizeF +from PyQt6.QtGui import QTextCharFormat, QTextFormat, QTextObjectInterface +from PyQt6.QtWidgets import (QApplication, QHBoxLayout, QLabel, QLineEdit, + QPushButton, QTextEdit, QVBoxLayout, QWidget) +from PyQt6.QtSvg import QSvgRenderer + + +class SvgTextObject(QObject, QTextObjectInterface): + + def intrinsicSize(self, doc, posInDocument, format): + renderer = QSvgRenderer(format.property(Window.SvgFileName)) + size = renderer.defaultSize() + + if size.height() > 25: + size *= 25.0 / size.height() + + return QSizeF(size) + + def drawObject(self, painter, rect, doc, posInDocument, format): + renderer = QSvgRenderer(format.property(Window.SvgFileName)) + renderer.render(painter, rect) + + +class Window(QWidget): + + SvgTextFormat = QTextFormat.ObjectTypes.UserObject + 1 + + SvgFileName = 1 + + def __init__(self): + super().__init__() + + self.setupGui() + self.setupTextObject() + + self.setWindowTitle("Text Object Example") + + def insertTextObject(self): + svgCharFormat = QTextCharFormat() + svgCharFormat.setObjectType(Window.SvgTextFormat) + svgCharFormat.setProperty(Window.SvgFileName, + self.fileNameLineEdit.text()) + + cursor = self.textEdit.textCursor() + cursor.insertText('\N{object replacement character}', svgCharFormat) + self.textEdit.setTextCursor(cursor) + + def setupTextObject(self): + svgInterface = SvgTextObject(self) + self.textEdit.document().documentLayout().registerHandler(Window.SvgTextFormat, svgInterface) + + def setupGui(self): + fileNameLabel = QLabel("Svg File Name:") + self.fileNameLineEdit = QLineEdit() + insertTextObjectButton = QPushButton("Insert Image") + + self.fileNameLineEdit.setText('heart.svg') + insertTextObjectButton.clicked.connect(self.insertTextObject) + + bottomLayout = QHBoxLayout() + bottomLayout.addWidget(fileNameLabel) + bottomLayout.addWidget(self.fileNameLineEdit) + bottomLayout.addWidget(insertTextObjectButton) + + self.textEdit = QTextEdit() + + mainLayout = QVBoxLayout() + mainLayout.addWidget(self.textEdit) + mainLayout.addLayout(bottomLayout) + + self.setLayout(mainLayout) + + +if __name__ == '__main__': + + import sys + + app = QApplication(sys.argv) + window = Window() + window.show() + sys.exit(app.exec()) diff --git a/lupdate/__init__.py b/lupdate/__init__.py new file mode 100644 index 0000000..64bdd5d --- /dev/null +++ b/lupdate/__init__.py @@ -0,0 +1,20 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +# The public API. +from .lupdate import lupdate diff --git a/lupdate/designer_source.py b/lupdate/designer_source.py new file mode 100644 index 0000000..d2cda54 --- /dev/null +++ b/lupdate/designer_source.py @@ -0,0 +1,68 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +from ..uic import UIFile + +from .source_file import SourceFile +from .translations import Context, Message +from .user import User, UserException + + +class DesignerSource(SourceFile, User): + """ Encapsulate a Designer source file. """ + + def __init__(self, **kwargs): + """ Initialise the object. """ + + super().__init__(**kwargs) + + # Read the source file. + self.progress("Reading {0}...".format(self.filename)) + + try: + ui_file = UIFile(self.filename) + except Exception as e: + raise UserException(str(e)) + + if ui_file.widget is not None: + context = Context(ui_file.class_name) + + # Get each element. Note that we don't support the + # element which seems to provide defaults for the + # attributes of any child elements. + for string_el in ui_file.widget.iter('string'): + if string_el.get('notr', 'false') == 'true': + continue + + # This can be None or an empty string depending on the exact + # XML. + if not string_el.text: + continue + + message = Message(self.filename, 0, string_el.text, + string_el.get('comment', ''), False) + + extra_comment = string_el.get('extracomment') + if extra_comment: + message.embedded_comments.extra_comments.append( + extra_comment) + + context.messages.append(message) + + if context.messages: + self.contexts.append(context) diff --git a/lupdate/lupdate.py b/lupdate/lupdate.py new file mode 100644 index 0000000..98fc648 --- /dev/null +++ b/lupdate/lupdate.py @@ -0,0 +1,98 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +import fnmatch +import os + +from .designer_source import DesignerSource +from .python_source import PythonSource +from .translation_file import TranslationFile +from .user import UserException + + +def lupdate(sources, translation_files, no_obsolete=False, no_summary=True, + verbose=False, excludes=None): + """ Update a sequence of translation (.ts) files from a sequence of Python + source (.py) files, Designer source (.ui) files or directories containing + source files. + """ + + if excludes is None: + excludes = () + + # Read the .ts files. + translations = [TranslationFile(ts, no_obsolete=no_obsolete, + no_summary=no_summary, verbose=verbose) + for ts in translation_files] + + # Read the sources. + source_files = [] + for source in sources: + if os.path.isdir(source): + for dirpath, dirnames, filenames in os.walk(source): + _remove_excludes(dirnames, excludes) + _remove_excludes(filenames, excludes) + + for fn in filenames: + filename = os.path.join(dirpath, fn) + + if filename.endswith('.py'): + source_files.append( + PythonSource(filename=filename, + verbose=verbose)) + + elif filename.endswith('.ui'): + source_files.append( + DesignerSource(filename=filename, + verbose=verbose)) + + elif verbose: + print("Ignoring", filename) + + elif source.endswith('.py'): + source_files.append( + PythonSource(filename=source, verbose=verbose)) + + elif source.endswith('.ui'): + source_files.append( + DesignerSource(filename=source, verbose=verbose)) + + else: + raise UserException( + "{0} must be a directory or a .py or a .ui file".format( + source)) + + # Update each translation for each source. + for t in translations: + for s in source_files: + t.update(s) + + t.write() + + +def _remove_excludes(names, excludes): + """ Remove all implicitly and explicitly excluded names from a list. """ + + for name in list(names): + if name.startswith('.'): + names.remove(name) + else: + for exclude in excludes: + if fnmatch.fnmatch(name, exclude): + names.remove(name) + break diff --git a/lupdate/pylupdate.py b/lupdate/pylupdate.py new file mode 100644 index 0000000..a7ce6ee --- /dev/null +++ b/lupdate/pylupdate.py @@ -0,0 +1,87 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +import sys + +from .lupdate import lupdate + + +def main(): + """ Update a .ts file from a .py file. """ + + import argparse + + from PyQt6.QtCore import PYQT_VERSION_STR + + from .user import UserException + + # The program name. + PROGRAM_NAME = 'pylupdate6' + + # Parse the command line. + parser = argparse.ArgumentParser(prog=PROGRAM_NAME, + description="Python Language Update Tool") + + parser.add_argument('-V', '--version', action='version', + version=PYQT_VERSION_STR) + parser.add_argument('--exclude', action='append', metavar="PATTERN", + help="exclude matching files when reading a directory") + parser.add_argument('--no-obsolete', '-no-obsolete', action='store_true', + help="remove any obsolete translated messages") + parser.add_argument('--no-summary', action='store_true', + help="suppress the summary") + parser.add_argument('--ts', '-ts', action='append', metavar="FILE", + required=True, + help="a .ts file to update or create") + parser.add_argument('--verbose', action='store_true', + help="show progress messages") + parser.add_argument('file', nargs='+', + help="the .py or .ui file, or directory to be read") + + args = parser.parse_args() + + # Update the translation files. + try: + lupdate(args.file, args.ts, args.no_obsolete, args.no_summary, + args.verbose, args.exclude) + except UserException as e: + print("{0}: {1}".format(PROGRAM_NAME, e), file=sys.stderr) + return 1 + except: + if args.verbose: + import traceback + + traceback.print_exception(*sys.exc_info()) + else: + print("""An unexpected error occurred. +Check that you are using the latest version of {name} and send an error +report to the PyQt mailing list and include the following information: + +- the version of {name} ({version}) +- the .py or .ui file that caused the error (as an attachment) +- the verbose output of {name} (use the --verbose flag when calling + {name})""".format(name=PROGRAM_NAME, version=PYQT_VERSION_STR), + file=sys.stderr) + + return 2 + + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/lupdate/python_source.py b/lupdate/python_source.py new file mode 100644 index 0000000..1177d23 --- /dev/null +++ b/lupdate/python_source.py @@ -0,0 +1,361 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +import ast +import re +import tokenize + +from .source_file import SourceFile +from .translations import Context, EmbeddedComments, Message +from .user import User, UserException + + +class PythonSource(SourceFile, User): + """ Encapsulate a Python source file. """ + + # The regular expression to extract a PEP 263 encoding. + _PEP_263 = re.compile(rb'^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)') + + def __init__(self, **kwargs): + """ Initialise the object. """ + + super().__init__(**kwargs) + + # Read the source file. + self.progress("Reading {0}...".format(self.filename)) + with open(self.filename, 'rb') as f: + source = f.read() + + # Implement universal newlines. + source = source.replace(b'\r\n', b'\n').replace(b'\r', b'\n') + + # Try and extract a PEP 263 encoding. + encoding = 'UTF-8' + + for line_nr, line in enumerate(source.split(b'\n')): + if line_nr > 1: + break + + match = re.match(self._PEP_263, line) + if match: + encoding = match.group(1).decode('ascii') + break + + # Decode the source according to the encoding. + try: + source = source.decode(encoding) + except LookupError: + raise UserException("Unsupported encoding '{0}'".format(encoding)) + + # Parse the source file. + self.progress("Parsing {0}...".format(self.filename)) + + try: + tree = ast.parse(source, filename=self.filename) + except SyntaxError as e: + raise UserException( + "Invalid syntax at line {0} of {1}:\n{2}".format( + e.lineno, e.filename, e.text.rstrip())) + + # Look for translation contexts and their contents. + visitor = Visitor(self) + visitor.visit(tree) + + # Read the file again as a sequence of tokens so that we see the + # comments. + with open(self.filename, 'rb') as f: + current = None + + for token in tokenize.tokenize(f.readline): + if token.type == tokenize.COMMENT: + # See if it is an embedded comment. + parts = token.string.split(' ', maxsplit=1) + if len(parts) == 2: + if parts[0] == '#:': + if current is None: + current = EmbeddedComments() + + current.extra_comments.append(parts[1]) + elif parts[0] == '#=': + if current is None: + current = EmbeddedComments() + + current.message_id = parts[1] + elif parts[0] == '#~': + parts = parts[1].split(' ', maxsplit=1) + if len(parts) == 1: + parts.append('') + + if current is None: + current = EmbeddedComments() + + current.extras.append(parts) + + elif token.type == tokenize.NL: + continue + + elif current is not None: + # Associate the embedded comment with the line containing + # this token. + line_nr = token.start[0] + + # See if there is a message on that line. + for context in self.contexts: + for message in context.messages: + if message.line_nr == line_nr: + break + else: + message = None + + if message is not None: + message.embedded_comments = current + break + + current = None + + +class Visitor(ast.NodeVisitor): + """ A visitor that extracts translation contexts. """ + + def __init__(self, source): + """ Initialise the visitor. """ + + self._source = source + self._context_stack = [] + + super().__init__() + + def visit_Call(self, node): + """ Visit a call. """ + + # Parse the arguments if a translation function is being called. + call_args = None + + if isinstance(node.func, ast.Attribute): + name = node.func.attr + + elif isinstance(node.func, ast.Name): + name = node.func.id + + if name == 'QT_TR_NOOP': + call_args = self._parse_QT_TR_NOOP(node) + elif name == 'QT_TRANSLATE_NOOP': + call_args = self._parse_QT_TRANSLATE_NOOP(node) + else: + name = '' + + # Allow these to be either methods or functions. + if name == 'tr': + call_args = self._parse_tr(node) + elif name == 'translate': + call_args = self._parse_translate(node) + + # Update the context if the arguments are usable. + if call_args is not None and call_args.source != '': + call_args.context.messages.append( + Message(self._source.filename, node.lineno, + call_args.source, call_args.disambiguation, + (call_args.numerus))) + + self.generic_visit(node) + + def visit_ClassDef(self, node): + """ Visit a class. """ + + try: + name = self._context_stack[-1].name + '.' + node.name + except IndexError: + name = node.name + + self._context_stack.append(Context(name)) + + self.generic_visit(node) + + context = self._context_stack.pop() + + if context.messages: + self._source.contexts.append(context) + + def _get_current_context(self): + """ Return the current Context object if there is one. """ + + return self._context_stack[-1] if self._context_stack else None + + @classmethod + def _get_first_str(cls, args): + """ Get the first of a list of arguments as a str. """ + + # Check that there is at least one argument. + if not args: + return None + + return cls._get_str(args[0]) + + def _get_or_create_context(self, name): + """ Return the Context object for a name, creating it if necessary. """ + + for context in self._source.contexts: + if context.name == name: + return context + + context = Context(name) + self._source.contexts.append(context) + + return context + + @staticmethod + def _get_str(node, allow_none=False): + """ Return the str from a node or None if it wasn't an appropriate + node. + """ + + if isinstance(node, ast.Str): + return node.s + + if isinstance(node, ast.Constant): + if isinstance(node.value, str): + return node.value + + if allow_none and node.value is None: + return '' + + return None + + def _parse_QT_TR_NOOP(self, node): + """ Parse the arguments to QT_TR_NOOP(). """ + + # Ignore unless there is a current context. + context = self._get_current_context() + if context is None: + return None + + call_args = self._parse_noop_without_context(node.args, node.keywords) + if call_args is None: + return None + + call_args.context = context + + return call_args + + def _parse_QT_TRANSLATE_NOOP(self, node): + """ Parse the arguments to QT_TRANSLATE_NOOP(). """ + + # Get the context. + name = self._get_first_str(node.args) + if name is None: + return None + + call_args = self._parse_noop_without_context(node.args[1:], + node.keywords) + if call_args is None: + return None + + call_args.context = self._get_or_create_context(name) + + return call_args + + def _parse_tr(self, node): + """ Parse the arguments to tr(). """ + + # Ignore unless there is a current context. + context = self._get_current_context() + if context is None: + return None + + call_args = self._parse_without_context(node.args, node.keywords) + if call_args is None: + return None + + call_args.context = context + + return call_args + + def _parse_translate(self, node): + """ Parse the arguments to translate(). """ + + # Get the context. + name = self._get_first_str(node.args) + if name is None: + return None + + call_args = self._parse_without_context(node.args[1:], node.keywords) + if call_args is None: + return None + + call_args.context = self._get_or_create_context(name) + + return call_args + + def _parse_without_context(self, args, keywords): + """ Parse arguments for a message source and optional disambiguation + and n. + """ + + # The source is required. + source = self._get_first_str(args) + if source is None: + return None + + if len(args) > 1: + disambiguation = self._get_str(args[1], allow_none=True) + else: + for kw in keywords: + if kw.arg == 'disambiguation': + disambiguation = self._get_str(kw.value, allow_none=True) + break + else: + disambiguation = '' + + # Ignore if the disambiguation is specified but isn't a string. + if disambiguation is None: + return None + + if len(args) > 2: + numerus = True + else: + numerus = 'n' in keywords + + if len(args) > 3: + return None + + return CallArguments(source, disambiguation, numerus) + + def _parse_noop_without_context(self, args, keywords): + """ Parse arguments for a message source. """ + + # There must be exactly one positional argument. + if len(args) != 1 or len(keywords) != 0: + return None + + source = self._get_str(args[0]) + if source is None: + return None + + return CallArguments(source) + + +class CallArguments: + """ Encapsulate the possible arguments of a translation function. """ + + def __init__(self, source, disambiguation='', numerus=False): + """ Initialise the object. """ + + self.context = None + self.source = source + self.disambiguation = disambiguation + self.numerus = numerus diff --git a/lupdate/source_file.py b/lupdate/source_file.py new file mode 100644 index 0000000..aaca74e --- /dev/null +++ b/lupdate/source_file.py @@ -0,0 +1,29 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class SourceFile: + """ The base class for any source file that provides translation contexts. + """ + + def __init__(self, filename, **kwargs): + """ Initialise the object. """ + + super().__init__(**kwargs) + + self.filename = filename + self.contexts = [] diff --git a/lupdate/translation_file.py b/lupdate/translation_file.py new file mode 100644 index 0000000..3b6b436 --- /dev/null +++ b/lupdate/translation_file.py @@ -0,0 +1,413 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +import os +from xml.etree import ElementTree + +from .user import User, UserException + + +class TranslationFile(User): + """ Encapsulate a translation file. """ + + def __init__(self, ts_file, no_obsolete, no_summary, **kwargs): + """ Initialise the translation file. """ + + super().__init__(**kwargs) + + if os.path.isfile(ts_file): + self.progress("Reading {0}...".format(ts_file)) + + try: + self._root = ElementTree.parse(ts_file).getroot() + except Exception as e: + raise UserException( + "{}: {}: {}".format(ts_file, + "invalid translation file", str(e))) + else: + self._root = ElementTree.fromstring(_EMPTY_TS) + + self._ts_file = ts_file + self._no_obsolete = no_obsolete + self._no_summary = no_summary + self._updated_contexts = {} + + # Create a dict of contexts keyed by the context name and having the + # list of message elements as the value. + self._contexts = {} + + # Also create a dict of existing translations so that they can be + # re-used. + self._translations = {} + + context_els = [] + for context_el in self._root: + if context_el.tag != 'context': + continue + + context_els.append(context_el) + + name = '' + message_els = [] + + for el in context_el: + if el.tag == 'name': + name = el.text + elif el.tag == 'message': + message_els.append(el) + + if name: + self._contexts[name] = message_els + + for message_el in message_els: + source_el = message_el.find('source') + if source_el is None or not source_el.text: + continue + + translation_el = message_el.find('translation') + if translation_el is None or not translation_el.text: + continue + + self._translations[source_el.text] = translation_el.text + + # Remove the context elements but keep everything else in the root + # (probably set by Linguist). + for context_el in context_els: + self._root.remove(context_el) + + # Clear the summary statistics. + self._nr_new = 0 + self._nr_new_duplicates = 0 + self._nr_new_using_existing_translation = 0 + self._nr_existing = 0 + self._nr_kept_obsolete = 0 + self._nr_discarded_obsolete = 0 + self._nr_discarded_untranslated = 0 + + # Remember all new messages so we can make the summary less confusing + # than it otherwise might be. + self._new_message_els = [] + + def update(self, source): + """ Update the translation file from a SourceFile object. """ + + self.progress( + "Updating {0} from {1}...".format(self._ts_file, + source.filename)) + + for context in source.contexts: + # Get the messages that we already know about for this context. + try: + message_els = self._contexts[context.name] + except KeyError: + message_els = [] + + # Get the messages that have already been updated. + updated_message_els = self._get_updated_message_els(context.name) + + for message in context.messages: + message_el = self._find_message(message, message_els) + + if message_el is not None: + # Move the message to the updated list. + message_els.remove(message_el) + self._add_message_el(message_el, updated_message_els) + else: + # See if this is a new message. If not then we just have + # another location for an existing message. + message_el = self._find_message(message, + updated_message_els) + + if message_el is None: + message_el = self._make_message_el(message) + updated_message_els.append(message_el) + + self.progress( + "Added new message '{0}'".format( + self.pretty(message.source))) + self._nr_new += 1 + else: + self.progress( + "Updated message '{0}'".format( + self.pretty(message.source))) + + # Go through any translations making sure they are not + # 'vanished' which might happen if we have restored a + # previously obsolete message. + for translation_el in message_el.findall('translation'): + if translation_el.get('type') == 'vanished': + if translation_el.text: + del translation_el.attrib['type'] + else: + translation_el.set('type', 'unfinished') + + # Don't count another copy of a new message as an existing + # one. + if message_el in self._new_message_els: + self._nr_new_duplicates += 1 + else: + self._nr_existing += 1 + + message_el.insert(0, self._make_location_el(message)) + + def write(self): + """ Write the translation file back to the filesystem. """ + + # If we are keeping obsolete messages then add them to the updated + # message elements list. + for name, message_els in self._contexts.items(): + updated_message_els = None + + for message_el in message_els: + source = self.pretty(message_el.find('source').text) + + translation_el = message_el.find('translation') + if translation_el is not None and translation_el.text: + if self._no_obsolete: + self.progress( + "Discarded obsolete message '{0}'".format( + source)) + self._nr_discarded_obsolete += 1 + else: + translation_el.set('type', 'vanished') + + if updated_message_els is None: + updated_message_els = self._get_updated_message_els( + name) + + self._add_message_el(message_el, updated_message_els) + + self.progress( + "Kept obsolete message '{0}'".format(source)) + self._nr_kept_obsolete += 1 + else: + self.progress( + "Discarded untranslated message '{0}'".format( + source)) + self._nr_discarded_untranslated += 1 + + # Created the sorted context elements. + for name in sorted(self._updated_contexts.keys()): + context_el = ElementTree.Element('context') + + name_el = ElementTree.Element('name') + name_el.text = name + context_el.append(name_el) + + context_el.extend(self._updated_contexts[name]) + + self._root.append(context_el) + + self.progress("Writing {0}...".format(self._ts_file)) + with open(self._ts_file, 'w', encoding='utf-8', newline='\n') as f: + f.write('\n') + f.write('\n') + + # Python v3.9 and later. + if hasattr(ElementTree, 'indent'): + ElementTree.indent(self._root) + + ElementTree.ElementTree(self._root).write(f, encoding='unicode') + f.write('\n') + + if not self._no_summary: + self._summary() + + @staticmethod + def _add_message_el(message_el, updated_message_els): + """ Add a message element to a list of updated message elements. """ + + # Remove all the location elements. + for location_el in message_el.findall('location'): + message_el.remove(location_el) + + # Add the message to the updated list. + updated_message_els.append(message_el) + + @classmethod + def _find_message(cls, message, message_els): + """ Return the message element for a message from a list. """ + + for message_el in message_els: + source = '' + comment = '' + extra_comment = '' + extras = [] + + # Extract the data from the element. + for el in message_el: + if el.tag == 'source': + source = el.text + elif el.tag == 'comment': + comment = el.text + elif el.tag == 'extracomment': + extra_comment = el.text + elif el.tag.startswith('extra-'): + extras.append([el.tag[6:], el.text]) + + # Compare with the message. + if source != message.source: + continue + + if comment != message.comment: + continue + + if extra_comment != cls._get_message_extra_comments(message): + continue + + if extras != message.embedded_comments.extras: + continue + + return message_el + + return None + + @staticmethod + def _get_message_extra_comments(message): + """ Return a message's extra comments as they appear in a .ts file. """ + + return ' '.join(message.embedded_comments.extra_comments) + + def _get_updated_message_els(self, name): + """ Return the list of updated message elements for a context. """ + + try: + updated_message_els = self._updated_contexts[name] + except KeyError: + updated_message_els = [] + self._updated_contexts[name] = updated_message_els + + return updated_message_els + + def _make_location_el(self, message): + """ Return a 'location' element. """ + + return ElementTree.Element('location', + filename=os.path.relpath(message.filename, + start=os.path.dirname(os.path.abspath(self._ts_file))), + line=str(message.line_nr)) + + def _make_message_el(self, message): + """ Return a 'message' element. """ + + attrs = {} + + if message.embedded_comments.message_id: + attrs['id'] = message.embedded_comments.message_id + + if message.numerus: + attrs['numerus'] = 'yes' + + message_el = ElementTree.Element('message', attrs) + + source_el = ElementTree.Element('source') + source_el.text = message.source + message_el.append(source_el) + + if message.comment: + comment_el = ElementTree.Element('comment') + comment_el.text = message.comment + message_el.append(comment_el) + + if message.embedded_comments.extra_comments: + extracomment_el = ElementTree.Element('extracomment') + extracomment_el.text = self._get_message_extra_comments(message) + message_el.append(extracomment_el) + + translation_el = ElementTree.Element('translation', + type='unfinished') + + # Try and find another message with the same source and use its + # translation if it has one. + translation = self._translations.get(message.source) + if translation: + translation_el.text = translation + + self.progress( + "Reused existing translation for '{0}'".format( + self.pretty(message.source))) + self._nr_new_using_existing_translation += 1 + + if message.numerus: + translation_el.append(ElementTree.Element( + 'numerusform')) + + message_el.append(translation_el) + + for field, value in message.embedded_comments.extras: + el = ElementTree.Element('extra-' + field) + el.text = value + message_el.append(el) + + self._new_message_els.append(message_el) + + return message_el + + def _summary(self): + """ Display the summary of changes to the user. """ + + summary_lines = [] + + # Display a line of the summary and the heading if not already done. + def summary(line): + nonlocal summary_lines + + if not summary_lines: + summary_lines.append( + "Summary of changes to {ts}:".format(ts=self._ts_file)) + + summary_lines.append(" " + line) + + if self._nr_new: + if self._nr_new_duplicates: + summary("{0} new messages were added (and {1} duplicates)".format( + self._nr_new, self._nr_new_duplicates)) + else: + summary("{0} new messages were added".format(self._nr_new)) + + if self._nr_new_using_existing_translation: + summary("{0} messages reused existing translations".format( + self._nr_new_using_existing_translation)) + + if self._nr_existing: + summary("{0} existing messages were found".format( + self._nr_existing)) + + if self._nr_kept_obsolete: + summary("{0} obsolete messages were kept".format( + self._nr_kept_obsolete)) + + if self._nr_discarded_obsolete: + summary("{0} obsolete messages were discarded".format( + self._nr_discarded_obsolete)) + + if self._nr_discarded_untranslated: + summary("{0} untranslated messages were discarded".format( + self._nr_discarded_untranslated)) + + if not summary_lines: + summary_lines.append("{ts} was unchanged".format(ts=self._ts_file)) + + print(os.linesep.join(summary_lines)) + + +# The XML of an empty .ts file. This is what a current lupdate will create +# with an empty C++ source file. +_EMPTY_TS = ''' + +''' diff --git a/lupdate/translations.py b/lupdate/translations.py new file mode 100644 index 0000000..f78eeec --- /dev/null +++ b/lupdate/translations.py @@ -0,0 +1,51 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class Context: + """ Encapsulate a message context. """ + + def __init__(self, name): + """ Initialise the context. """ + + self.name = name + self.messages = [] + + +class EmbeddedComments: + """ Encapsulate information for a translator embedded in comments. """ + + def __init__(self): + """ Initialise the object. """ + + self.message_id = '' + self.extra_comments = [] + self.extras = [] + + +class Message: + """ Encapsulate a message. """ + + def __init__(self, filename, line_nr, source, comment, numerus): + """ Initialise the message. """ + + self.filename = filename + self.line_nr = line_nr + self.source = source + self.comment = comment + self.numerus = numerus + self.embedded_comments = EmbeddedComments() diff --git a/lupdate/user.py b/lupdate/user.py new file mode 100644 index 0000000..c4cb5f4 --- /dev/null +++ b/lupdate/user.py @@ -0,0 +1,47 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class UserException(Exception): + """ Encapsulate an exception ultimate caused by the user. """ + + pass + + +class User: + """ A mixin that provides methods for communicating with the user. """ + + def __init__(self, verbose, **kwargs): + """ Initialise the object. """ + + super().__init__(**kwargs) + + self._verbose = verbose + + @staticmethod + def pretty(text): + """ Returns a pretty-fied version of some text suitable for displaying + to the user. + """ + + return text.replace('\n', '\\n') + + def progress(self, message): + """ Display a progress message. """ + + if self._verbose: + print(message) diff --git a/project.py b/project.py new file mode 100644 index 0000000..753689d --- /dev/null +++ b/project.py @@ -0,0 +1,915 @@ +# This is the PyQt6 build script. +# +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +import glob +import os +import sys + +from pyqtbuild import PyQtBindings, PyQtProject, QmakeTargetInstallable +from sipbuild import (Buildable, BuildableModule, Installable, Option, + UserException) + + +# The minimum sip module ABI version needed. +ABI_VERSION = '13.4' + + +class PyQt(PyQtProject): + """ The PyQt6 project. """ + + def __init__(self): + """ Initialise the project. """ + + # We specify the name of the sip module because PyQt-builder doesn't + # provide it if we are creating an sdist. + super().__init__(abi_version=ABI_VERSION, sip_module='PyQt6.sip', + dunder_init=True, tag_prefix='Qt', console_scripts=[ + 'pylupdate6 = PyQt6.lupdate.pylupdate:main', + 'pyuic6 = PyQt6.uic.pyuic:main']) + + # Each set of bindings must appear after any set they depend on. + # QtLocation is still to be ported to Qt6. + self.bindings_factories = [QtCore, QtNetwork, QtGui, QtQml, QtWidgets, + QtDBus, QtDesigner, QtHelp, QtOpenGL, QtOpenGLWidgets, + QtPrintSupport, QtQuick, QtQuick3D, QtQuickWidgets, QtSql, + QtSvg, QtSvgWidgets, QtTest, QtXml, QtMultimedia, + QtMultimediaWidgets, QtPositioning, QtRemoteObjects, QtSensors, + QtSerialPort, QtWebChannel, QtWebSockets, QtBluetooth, QtNfc, + QtPdf, QtPdfWidgets, QtSpatialAudio, QtTextToSpeech, + QAxContainer] + + def apply_user_defaults(self, tool): + """ Set default values where needed. """ + + if self.license_dir is None: + self.license_dir = os.path.join(self.root_dir, 'sip') + else: + self.license_dir = os.path.abspath(self.license_dir) + + super().apply_user_defaults(tool) + + if not self.tools: + self.console_scripts = [] + + def get_dunder_init(self): + """ Return the contents of the __init__.py file to install. """ + + with open(os.path.join(self.root_dir, '__init__.py')) as f: + dunder_init = f.read() + + if self.py_platform == 'win32': + dunder_init += """ + +def find_qt(): + import os, sys + + qtcore_dll = '\\\\Qt6Core.dll' + + dll_dir = os.path.dirname(sys.executable) + if not os.path.isfile(dll_dir + qtcore_dll): + path = os.environ['PATH'] + + dll_dir = os.path.dirname(__file__) + '\\\\Qt6\\\\bin' + if os.path.isfile(dll_dir + qtcore_dll): + path = dll_dir + ';' + path + os.environ['PATH'] = path + else: + for dll_dir in path.split(';'): + if os.path.isfile(dll_dir + qtcore_dll): + break + else: + return + + try: + os.add_dll_directory(dll_dir) + except AttributeError: + pass + + +find_qt() +del find_qt +""" + + return dunder_init + + def get_options(self): + """ Return the sequence of configurable options. """ + + # Get the standard options. + options = super().get_options() + + # Add our new options. + options.append( + Option('confirm_license', option_type=bool, + help="confirm acceptance of the license")) + + options.append( + Option('license_dir', option_type=str, + help="the license file can be found in DIR", + metavar="DIR")) + + options.append( + Option('qt_shared', option_type=bool, + help="assume Qt has been built as shared libraries")) + + options.append( + Option('designer_plugin', option_type=bool, inverted=True, + help="disable the building of the Python plugin for Qt Designer")) + + options.append( + Option('qml_plugin', option_type=bool, inverted=True, + help="disable the building of the Python plugin for qmlscene")) + + options.append( + Option('dbus', option_type=str, + help="the directory containing the dbus/dbus-python.h file", + metavar="DIR")) + + options.append( + Option('dbus_python', option_type=bool, inverted=True, + help="disable the Qt support for the dbus-python package")) + + options.append( + Option('tools', option_type=bool, inverted=True, + help="disable the installation of pyuic6 and pylupdate6")) + + return options + + def update(self, tool): + """ Update the configuration. """ + + if tool not in Option.BUILD_TOOLS: + return + + # Check we support the version of Qt. + if self.builder.qt_version >> 16 != 6: + raise UserException( + "Qt v6 is required, not v{0}".format( + self.builder.qt_version_str)) + + # Automatically confirm the license if there might not be a command + # line option to do so. + if tool == 'pep517': + self.confirm_license = True + + self._check_license() + + # Handle the platform tag. + platform_tags_map = { + 'android': 'Android', + 'darwin': 'macOS', + 'ios': 'iOS', + 'wasm': 'WebAssembly', + 'win32': 'Windows', + } + + self.bindings['QtCore'].tags.append( + platform_tags_map.get(self.py_platform, 'Linux')) + + # Make sure the bindings are buildable. + super().update(tool) + + # PyQt6-WebEngine needs to know if QtWebChannel is available. + if 'QtWebChannel' not in self.bindings: + qtcore = self.bindings.get('QtCore') + if qtcore is not None: + qtcore.disabled_features.append('PyQt_WebChannel') + + # Always install the lupdate module. + installable = Installable('lupdate', target_subdir='PyQt6') + installable.files.append(os.path.join(self.root_dir, 'lupdate')) + self.installables.append(installable) + + # Always install the uic module. + installable = Installable('uic', target_subdir='PyQt6') + installable.files.append(os.path.join(self.root_dir, 'uic')) + self.installables.append(installable) + + # If any set of bindings is being built as a debug version then assume + # the plugins and DBus support should as well. + for bindings in self.bindings.values(): + if bindings.debug: + others_debug = True + break + else: + others_debug = self.py_debug + + # Add the plugins. For the moment we don't include them in wheels. + # This may change when we improve the bundling of Qt. + if tool in ('build', 'install'): + if self.designer_plugin and 'QtDesigner' in self.bindings: + self._add_plugin('designer', "Qt Designer", 'pyqt6', + 'designer', others_debug) + + if self.qml_plugin and 'QtQml' in self.bindings: + self._add_plugin('qmlscene', "qmlscene", 'pyqt6qmlplugin', + 'PyQt6', others_debug) + + # Add the dbus-python support. + if self.dbus_python: + self._add_dbus(others_debug) + + def _add_dbus(self, debug): + """ Add the dbus-python support. """ + + self.progress( + "Checking to see if the dbus-python support should be built") + + # See if dbus-python is installed. + try: + import dbus.mainloop + except ImportError: + self.progress( + "The dbus-python package does not seem to be installed.") + return + + dbus_module_dir = dbus.mainloop.__path__[0] + + # Get the flags for the DBus library. + dbus_inc_dirs = [] + dbus_lib_dirs = [] + dbus_libs = [] + + args = ['pkg-config', '--cflags-only-I', '--libs dbus-1'] + + for line in self.read_command_pipe(args, fatal=False): + for flag in line.strip().split(): + if flag.startswith('-I'): + dbus_inc_dirs.append(flag[2:]) + elif flag.startswith('-L'): + dbus_lib_dirs.append(flag[2:]) + elif flag.startswith('-l'): + dbus_libs.append(flag[2:]) + + if not any([dbus_inc_dirs, dbus_lib_dirs, dbus_libs]): + self.progress("DBus v1 does not seem to be installed.") + + # Try and find dbus-python.h. The current PyPI package doesn't install + # it. We look where DBus itself is installed. + if self.dbus: + dbus_inc_dirs.append(self.dbus) + + for d in dbus_inc_dirs: + if os.path.isfile(os.path.join(d, 'dbus', 'dbus-python.h')): + break + else: + self.progress( + "dbus/dbus-python.h could not be found and so the " + "dbus-python support module will be disabled. If " + "dbus-python is installed then use the --dbus argument to " + "explicitly specify the directory containing " + "dbus/dbus-python.h.") + return + + # Create the buildable. + sources_dir = os.path.join(self.root_dir, 'dbus') + + buildable = BuildableModule(self, 'dbus', 'dbus.mainloop.pyqt6', + uses_limited_api=True) + buildable.builder_settings.append('QT -= gui') + buildable.sources.extend(glob.glob(os.path.join(sources_dir, '*.cpp'))) + buildable.headers.extend(glob.glob(os.path.join(sources_dir, '*.h'))) + buildable.include_dirs.extend(dbus_inc_dirs) + buildable.library_dirs.extend(dbus_lib_dirs) + buildable.libraries.extend(dbus_libs) + buildable.debug = debug + + self.buildables.append(buildable) + + def _add_plugin(self, name, user_name, target_name, target_subdir, debug): + """ Add a plugin to the project buildables. """ + + builder = self.builder + + # Check we have a shared interpreter library. + if not self.py_pylib_shlib: + self.progress("The {0} plugin was disabled because a shared Python library couldn't be found.".format(user_name)) + return + + # Where the plugin will (eventually) be installed. + target_plugin_dir = os.path.join( + builder.qt_configuration['QT_INSTALL_PLUGINS'], target_subdir) + + # Create the buildable and add it to the builder. + buildable = Buildable(self, name) + self.buildables.append(buildable) + + # The platform-specific name of the plugin file. + if self.py_platform == 'win32': + target_name = target_name + '.dll' + elif self.py_platform == 'darwin': + target_name = 'lib' + target_name + '.dylib' + else: + target_name = 'lib' + target_name + '.so' + + # Create the corresponding installable. + installable = QmakeTargetInstallable(target_name, target_plugin_dir) + buildable.installables.append(installable) + + # Create the .pro file. + self.progress( + "Generating the {0} plugin .pro file".format(user_name)) + + root_plugin_dir = os.path.join(self.root_dir, name) + + with open(os.path.join(root_plugin_dir, name + '.pro-in')) as f: + prj = f.read() + + prj = prj.replace('@QTCONFIG@', 'debug' if debug else 'release') + prj = prj.replace('@PYINCDIR@', + builder.qmake_quote(self.py_include_dir)) + prj = prj.replace('@SIPINCDIR@', builder.qmake_quote(self.build_dir)) + prj = prj.replace('@PYLINK@', + '-L{} -l{}'.format(self.py_pylib_dir, self.py_pylib_lib)) + prj = prj.replace('@PYSHLIB@', self.py_pylib_shlib) + prj = prj.replace('@QTPLUGINDIR@', + builder.qmake_quote(target_plugin_dir)) + + # Write the .pro file. + pro_path = os.path.join(buildable.build_dir, name + '.pro') + pro_f = self.open_for_writing(pro_path) + + pro_f.write(prj) + + pro_f.write(''' +INCLUDEPATH += {} +VPATH = {} +'''.format(builder.qmake_quote(root_plugin_dir), builder.qmake_quote(root_plugin_dir))) + + pro_f.write('\n'.join(builder.qmake_settings) + '\n') + + pro_f.close() + + def _check_license(self): + """ Handle the validation of the PyQt6 license. """ + + license_dat = os.path.join(self.root_dir, 'license.dat') + + if os.path.isfile(license_dat): + ltype = lname = lfile = None + + with open(license_dat) as lf: + for line in lf: + parts = line.split('=') + if len(parts) == 2: + name, value = parts + + name = name.strip() + value = value.strip()[1:-1] + + if name == 'LicenseType': + ltype = value + elif name == 'LicenseName': + lname = value + elif name == 'LicenseFile': + lfile = value + + if lname is None or lfile is None: + ltype = None + else: + ltype = None + + # Default to the GPL. + if ltype is None: + ltype = 'GPL' + lname = "GNU General Public License" + lfile = 'pyqt-gpl.sip' + + self.progress( + "This is the {0} version of PyQt {1} (licensed under the {2}) " + "for Python {3} on {4}.".format( + ltype, self.version_str, lname, + sys.version.split()[0], sys.platform)) + + # Confirm the license if not already done. + if not self.confirm_license: + loptions = """ +Type 'L' to view the license. +""" + + sys.stdout.write(loptions) + sys.stdout.write("""Type 'yes' to accept the terms of the license. +Type 'no' to decline the terms of the license. + +""") + + while True: + sys.stdout.write("Do you accept the terms of the license? ") + sys.stdout.flush() + + try: + resp = sys.stdin.readline() + except KeyboardInterrupt: + raise SystemExit + except: + resp = "" + + resp = resp.strip().lower() + + if resp == "yes": + break + + if resp == "no": + sys.exit() + + if resp == 'l': + os.system('more LICENSE') + + # Check that the license file exists and fix its syntax. + src_lfile = os.path.join(self.license_dir, lfile) + + if os.path.isfile(src_lfile): + self.progress("Found the license file '{0}'.".format(lfile)) + self._fix_license(src_lfile, + os.path.join(self.build_dir, lfile + '5')) + + # Make sure sip can find the license file. + self.sip_include_dirs.append(self.build_dir) + else: + raise UserException( + "Please copy the license file '{0}' to '{1}'".format(lfile, + self.license_dir)) + + def _fix_license(self, src_lfile, dst_lfile): + """ Copy the license file and fix it so that it conforms to the SIP v5 + syntax. + """ + + with open(src_lfile) as f: + f5 = self.open_for_writing(dst_lfile) + + for line in f: + if line.startswith('%License'): + anno_start = line.find('/') + anno_end = line.rfind('/') + + if anno_start < 0 or anno_end < 0 or anno_start == anno_end: + f5.close() + + raise UserException( + "'{0}' has missing annotations".format(name)) + + annos = line[anno_start + 1:anno_end].split(', ') + annos5 = [anno[0].lower() + anno[1:] for anno in annos] + + f5.write('%License(') + f5.write(', '.join(annos5)) + f5.write(')\n') + else: + f5.write(line) + + f5.close() + + +class QAxContainer(PyQtBindings): + """ The QAxContainer bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QAxContainer', qmake_QT=['axcontainer'], + test_headers=['qaxobject.h'], test_statement='new QAxObject()') + + +class QtBluetooth(PyQtBindings): + """ The QtBluetooth bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtBluetooth', qmake_QT=['bluetooth'], + test_headers=['qbluetoothaddress.h'], + test_statement='new QBluetoothAddress()') + + +class QtCore(PyQtBindings): + """ The QtCore bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtCore', qmake_QT=['-gui'], + define_macros=['QT_KEYPAD_NAVIGATION']) + + def handle_test_output(self, test_output): + """ Handle the output from the external test program and return True if + the bindings are buildable. + """ + + project = self.project + + if not project.qt_shared and test_output[0] == 'shared': + project.qt_shared = True + + # If permissions are available make sure the static plugins get + # compiled in. + if 'PyQt_Permissions' not in test_output: + self.builder_settings.append('CONFIG += permssions') + self.builder_settings.append( + 'QMAKE_INFO_PLIST = ' + self._info_plist()) + + return super().handle_test_output(test_output[1:]) + + def _info_plist(self): + """ Create an Info.plist that contains entries for all supported + permissions and return the absolute name of the file. + """ + + keys = ('NSBluetoothAlwaysUsageDescription', + 'NSCalendarsUsageDescription', 'NSCameraUsageDescription', + 'NSContactsUsageDescription', 'NSLocationUsageDescription', + 'NSMicrophoneUsageDescription') + + content = '\n'.join( + ['{}Dummy'.format(k) for k in keys]) + + info_plist = os.path.join(self.project.build_dir, 'Info.plist') + + with open(info_plist, 'w') as f: + f.write( +''' + + + +{} + + +'''.format(content)) + + return info_plist + + +class QtDBus(PyQtBindings): + """ The QtDBus bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtDBus', qmake_QT=['dbus', '-gui'], + test_headers=['qdbusconnection.h'], + test_statement='QDBusConnection::systemBus()') + + +class QtDesigner(PyQtBindings): + """ The QtDesigner bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtDesigner', qmake_QT=['designer'], + test_headers=['QExtensionFactory', + 'QtUiPlugin/customwidget.h'], + test_statement='new QExtensionFactory()') + + def is_buildable(self): + """ Return True if the bindings are buildable. """ + + project = self.project + + if not project.qt_shared: + project.progress( + "The QtDesigner bindings are disabled with a static Qt " + "installation") + return False + + return super().is_buildable() + + +class QtGui(PyQtBindings): + """ The QtGui bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtGui') + + +class QtHelp(PyQtBindings): + """ The QtHelp bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtHelp', qmake_QT=['help'], + test_headers=['qhelpengine.h'], + test_statement='new QHelpEngine("foo")') + + +class QtLocation(PyQtBindings): + """ The QtLocation bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtLocation', qmake_QT=['location'], + test_headers=['qplace.h'], test_statement='new QPlace()') + + +class QtMultimedia(PyQtBindings): + """ The QtMultimedia bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtMultimedia', qmake_QT=['multimedia'], + test_headers=['QAudioDevice'], + test_statement='new QAudioDevice()') + + +class QtMultimediaWidgets(PyQtBindings): + """ The QtMultimediaWidgets bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtMultimediaWidgets', + qmake_QT=['multimediawidgets'], + test_headers=['QVideoWidget'], + test_statement='new QVideoWidget()') + + +class QtNetwork(PyQtBindings): + """ The QtNetwork bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtNetwork', qmake_QT=['network', '-gui']) + + +class QtNfc(PyQtBindings): + """ The QtNfc bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtNfc', qmake_QT=['nfc', '-gui'], + test_headers=['qnearfieldmanager.h'], + test_statement='new QNearFieldManager()') + + +class QtOpenGL(PyQtBindings): + """ The QtOpenGL bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtOpenGL', qmake_QT=['opengl'], + test_headers=['qopengldebug.h'], + test_statement='new QOpenGLDebugLogger()') + + +class QtOpenGLWidgets(PyQtBindings): + """ The QtOpenGLWidgets bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtOpenGLWidgets', + qmake_QT=['openglwidgets'], test_headers=['qopenglwidget.h'], + test_statement='new QOpenGLWidget()') + + +class QtPdf(PyQtBindings): + """ The QtPdf bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtPdf', qmake_QT=['pdf'], + test_headers=['qpdfdocument.h'], + test_statement='new QPdfDocument(nullptr)') + + +class QtPdfWidgets(PyQtBindings): + """ The QtPdfWidgets bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtPdfWidgets', qmake_QT=['pdfwidgets'], + test_headers=['qpdfview.h'], + test_statement='new QPdfView(nullptr)') + + +class QtPositioning(PyQtBindings): + """ The QtPositioning bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtPositioning', qmake_QT=['positioning'], + test_headers=['qgeoaddress.h'], + test_statement='new QGeoAddress()') + + +class QtPrintSupport(PyQtBindings): + """ The QtPrintSupport bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtPrintSupport', qmake_QT=['printsupport']) + + +class QtQml(PyQtBindings): + """ The QtQml bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtQml', qmake_QT=['qml'], + test_headers=['qjsengine.h'], test_statement='new QJSEngine()') + + +class QtQuick(PyQtBindings): + """ The QtQuick bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtQuick', qmake_QT=['quick'], + test_headers=['qquickwindow.h'], + test_statement='new QQuickWindow()') + + +class QtQuick3D(PyQtBindings): + """ The QtQuick3D bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtQuick3D', qmake_QT=['quick3d'], + test_headers=['qquick3d.h'], + test_statement='QQuick3D::idealSurfaceFormat()') + + +class QtQuickWidgets(PyQtBindings): + """ The QtQuickWidgets bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtQuickWidgets', qmake_QT=['quickwidgets'], + test_headers=['qquickwidget.h'], + test_statement='new QQuickWidget()') + + +class QtRemoteObjects(PyQtBindings): + """ The QtRemoteObjects bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtRemoteObjects', + qmake_QT=['remoteobjects', '-gui'], + test_headers=['qtremoteobjectsversion.h'], + test_statement='const char *v = QTREMOTEOBJECTS_VERSION_STR') + + +class QtSensors(PyQtBindings): + """ The QtSensors bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtSensors', qmake_QT=['sensors'], + test_headers=['qsensor.h'], + test_statement='new QSensor(QByteArray())') + + +class QtSerialPort(PyQtBindings): + """ The QtSerialPort bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtSerialPort', qmake_QT=['serialport'], + test_headers=['qserialport.h'], + test_statement='new QSerialPort()') + + +class QtSpatialAudio(PyQtBindings): + """ The QtSpatialAudio bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtSpatialAudio', qmake_QT=['spatialaudio'], + test_headers=['qaudioengine.h'], + test_statement='new QAudioEngine()') + + +class QtSql(PyQtBindings): + """ The QtSql bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtSql', qmake_QT=['sql', 'widgets'], + test_headers=['qsqldatabase.h'], + test_statement='new QSqlDatabase()') + + +class QtSvg(PyQtBindings): + """ The QtSvg bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtSvg', qmake_QT=['svg'], + test_headers=['qsvgrenderer.h'], + test_statement='new QSvgRenderer()') + + +class QtSvgWidgets(PyQtBindings): + """ The QtSvgWidgets bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtSvgWidgets', qmake_QT=['svgwidgets'], + test_headers=['qsvgwidget.h'], + test_statement='new QSvgWidget()') + + +class QtTest(PyQtBindings): + """ The QtTest bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtTest', qmake_QT=['testlib', 'widgets'], + test_headers=['QtTest'], test_statement='QTest::qSleep(0)') + + +class QtTextToSpeech(PyQtBindings): + """ The QtTextToSpeech bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtTextToSpeech', + qmake_QT=['texttospeech', '-gui', 'qmlintegration'], + test_headers=['QTextToSpeech'], + test_statement='new QTextToSpeech()') + + +class QtWebChannel(PyQtBindings): + """ The QtWebChannel bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtWebChannel', + qmake_QT=['webchannel', 'network', '-gui'], + test_headers=['qwebchannel.h'], + test_statement='new QWebChannel()') + + +class QtWebSockets(PyQtBindings): + """ The QtWebSockets bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtWebSockets', + qmake_QT=['websockets', '-gui'], test_headers=['qwebsocket.h'], + test_statement='new QWebSocket()') + + +class QtWidgets(PyQtBindings): + """ The QtWidgets bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtWidgets', qmake_QT=['widgets'], + test_headers=['qwidget.h'], test_statement='new QWidget()') + + +class QtXml(PyQtBindings): + """ The QtXml bindings. """ + + def __init__(self, project): + """ Initialise the bindings. """ + + super().__init__(project, 'QtXml', qmake_QT=['xml', '-gui'], + test_headers=['qdom.h'], test_statement='new QDomDocument()') diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e7802ae --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +# Specify the build system for the project. +[build-system] +requires = ["sip >=6.5, <7", "PyQt-builder >=1.15, <2"] +build-backend = "sipbuild.api" + +# Specify the PEP 566 metadata for the project. +[tool.sip.metadata] +name = "PyQt6" +version = "6.5.2" +summary = "Python bindings for the Qt cross platform application toolkit" +home-page = "https://www.riverbankcomputing.com/software/pyqt/" +author = "Riverbank Computing Limited" +author-email = "info@riverbankcomputing.com" +license = "GPL v3" +description-file = "README" +requires-python = ">=3.6.1" + diff --git a/qmlscene/pluginloader.cpp b/qmlscene/pluginloader.cpp new file mode 100644 index 0000000..275fd57 --- /dev/null +++ b/qmlscene/pluginloader.cpp @@ -0,0 +1,376 @@ +/* + * This is the qmlscene plugin that collects all the Python plugins it can + * find. + * + * Copyright (c) 2023 Riverbank Computing Limited + * + * This file is part of PyQt6. + * + * This file may be used under the terms of the GNU General Public License + * version 3.0 as published by the Free Software Foundation and appearing in + * the file LICENSE included in the packaging of this file. Please review the + * following information to ensure the GNU General Public License version 3.0 + * requirements will be met: http://www.gnu.org/copyleft/gpl.html. + * + * If you do not wish to use this file under the terms of the GPL version 3.0 + * then you may purchase a commercial license. For more information contact + * info@riverbankcomputing.com. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include "pluginloader.h" + + +// Construct the C++ plugin. +PyQt6QmlPlugin::PyQt6QmlPlugin(QObject *parent) : QQmlExtensionPlugin(parent), + py_plugin_obj(0), sip(0) +{ + // Make sure the interpreter is initialised. + if (!Py_IsInitialized()) + { + QLibrary library(PYTHON_LIB); + + library.setLoadHints(QLibrary::ExportExternalSymbolsHint); + + if (library.load()) + { + // If we seem to be running in a venv the set the program name + // explicitly so that Python finds the right site-packages. + QString venv = QString::fromLocal8Bit(qgetenv("VIRTUAL_ENV")); + + if (!venv.isEmpty()) + { + venv.append(QDir::separator()); +#if defined(Q_OS_WIN) + venv.append(QLatin1String("Scripts")); +#else + venv.append(QLatin1String("bin")); +#endif + venv.append(QDir::separator()).append(QLatin1String("python")); + + wchar_t *venv_wc = new wchar_t[venv.length() + 1]; + venv_wc[venv.toWCharArray(venv_wc)] = L'\0'; + + Py_SetProgramName(venv_wc); + + delete[] venv_wc; + } + + Py_Initialize(); + + getSipAPI(); + +#ifdef WITH_THREAD + // Make sure we don't have the GIL. +#if PY_VERSION_HEX < 0x03070000 + PyEval_InitThreads(); +#endif + PyEval_SaveThread(); +#endif + } + } +} + + +// Destroy the C++ plugin. +PyQt6QmlPlugin::~PyQt6QmlPlugin() +{ + if (Py_IsInitialized()) + { +#ifdef WITH_THREAD + PyGILState_STATE gil = PyGILState_Ensure(); +#endif + + Py_XDECREF(py_plugin_obj); + +#ifdef WITH_THREAD + PyGILState_Release(gil); +#endif + } +} + + +// Initialize the QML engine. +void PyQt6QmlPlugin::initializeEngine(QQmlEngine *engine, const char *uri) +{ + if (!Py_IsInitialized() || !py_plugin_obj || !sip) + return; + +#ifdef WITH_THREAD + PyGILState_STATE gil = PyGILState_Ensure(); +#endif + + const sipTypeDef *td = sip->api_find_type("QQmlEngine"); + + if (!td) + { + PyErr_SetString(PyExc_AttributeError, + "unable to find type for QQmlEngine"); + } + else + { + PyObject *engine_obj = sip->api_convert_from_type(engine, td, 0); + + if (!engine_obj) + { + td = 0; + } + else + { + PyObject *res_obj = PyObject_CallMethod(py_plugin_obj, + const_cast("initializeEngine"), + const_cast("Os"), engine_obj, uri); + + Py_DECREF(engine_obj); + + if (res_obj != Py_None) + { + if (res_obj) + PyErr_Format(PyExc_TypeError, + "unexpected result from initializeEngine(): %S", + res_obj); + + td = 0; + } + + Py_XDECREF(res_obj); + } + } + + if (!td) + PyErr_Print(); + +#ifdef WITH_THREAD + PyGILState_Release(gil); +#endif +} + + +// Register the plugin's types. +void PyQt6QmlPlugin::registerTypes(const char *uri) +{ + // Construct the import path that the engine will have used by default. + // Unfortunately we won't know about any directories added by qmlscene's -I + // flag. + QStringList import_path; + + import_path << QCoreApplication::applicationDirPath(); + + const char *env_path = getenv("QML2_IMPORT_PATH"); + + if (env_path) + { +#if defined(Q_OS_WIN) + QLatin1Char sep(';'); +#else + QLatin1Char sep(':'); +#endif + + QStringList env_dirs = QString::fromLatin1(env_path).split(sep, Qt::SkipEmptyParts); + + foreach (QString dir_name, env_dirs) + import_path << QDir(dir_name).canonicalPath(); + } + + import_path << QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath); + + // Try and find the URI directory, check that it has a qmldir file and that + // it has a file called *plugin.py. + QString py_plugin; + QString py_plugin_dir; + + foreach (QString dir_name, import_path) + { + dir_name.append('/'); + dir_name.append(uri); + + QDir dir(dir_name); + + if (!dir.exists() || !dir.exists("qmldir")) + continue; + + QStringList candidates = dir.entryList(QDir::Files|QDir::Readable); + + foreach (QString py_plugin_file, candidates) + { + QStringList parts = py_plugin_file.split('.'); + + if (parts.size() == 2 && parts.at(0).endsWith("plugin") && parts.at(1).startsWith("py")) + { + py_plugin = parts.at(0); + break; + } + } + + if (!py_plugin.isEmpty()) + { + py_plugin_dir = QDir::toNativeSeparators(dir.absolutePath()); + break; + } + } + + if (py_plugin.isEmpty()) + return; + +#ifdef WITH_THREAD + PyGILState_STATE gil = PyGILState_Ensure(); +#endif + + if (!addToSysPath(py_plugin_dir) || !callRegisterTypes(py_plugin, uri)) + PyErr_Print(); + +#ifdef WITH_THREAD + PyGILState_Release(gil); +#endif +} + + +// Call the registerTypes() function of a plugin. +bool PyQt6QmlPlugin::callRegisterTypes(const QString &py_plugin, + const char *uri) +{ + // Import the plugin. + PyObject *plugin_mod = PyImport_ImportModule(py_plugin.toLatin1().data()); + + if (!plugin_mod) + return false; + + // Get QQmlExtensionPlugin. We do this after the import of the plugin to + // allow it to fiddle with the context. + PyObject *extension_plugin = getModuleAttr("PyQt6.QtQml", + "QQmlExtensionPlugin"); + + if (!extension_plugin) + { + Py_DECREF(plugin_mod); + return false; + } + + // Go through the module looking for a type that implements + // QQmlExtensionPlugin. + PyObject *mod_dict = PyModule_GetDict(plugin_mod); + PyObject *key, *value, *plugin_type = 0; + Py_ssize_t pos = 0; + + while (PyDict_Next(mod_dict, &pos, &key, &value)) + if (value != extension_plugin && PyType_Check(value) && PyType_IsSubtype((PyTypeObject *)value, (PyTypeObject *)extension_plugin)) + { + plugin_type = value; + break; + } + + Py_DECREF(extension_plugin); + + if (!plugin_type) + { + PyErr_Format(PyExc_AttributeError, + "%s does not contain an implementation of QQmlExtensionPlugin", + py_plugin.toLatin1().constData()); + + Py_DECREF(plugin_mod); + return false; + } + + // Create the plugin instance. + PyObject *plugin_obj = PyObject_CallObject(plugin_type, NULL); + + Py_DECREF(plugin_mod); + + if (!plugin_obj) + return false; + + // Call registerTypes(). + PyObject *res_obj = PyObject_CallMethod(plugin_obj, + const_cast("registerTypes"), const_cast("s"), uri); + + if (res_obj != Py_None) + { + Py_DECREF(plugin_obj); + + if (res_obj) + { + PyErr_Format(PyExc_TypeError, + "unexpected result from registerTypes(): %S", res_obj); + + Py_DECREF(res_obj); + } + + return false; + } + + Py_DECREF(res_obj); + + py_plugin_obj = plugin_obj; + + return true; +} + + +// Add a directory to sys.path. +bool PyQt6QmlPlugin::addToSysPath(const QString &py_plugin_dir) +{ + PyObject *sys_path = getModuleAttr("sys", "path"); + + if (!sys_path) + return false; + + PyObject *plugin_dir_obj = PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, + py_plugin_dir.constData(), py_plugin_dir.length()); + + if (!plugin_dir_obj) + { + Py_DECREF(sys_path); + return false; + } + + int rc = PyList_Append(sys_path, plugin_dir_obj); + Py_DECREF(plugin_dir_obj); + Py_DECREF(sys_path); + + if (rc < 0) + { + return false; + } + + return true; +} + + +// Return the named attribute object from the named module. +PyObject *PyQt6QmlPlugin::getModuleAttr(const char *module, const char *attr) +{ + PyObject *mod = PyImport_ImportModule(module); + + if (!mod) + return 0; + + PyObject *obj = PyObject_GetAttrString(mod, attr); + + Py_DECREF(mod); + + return obj; +} + + +// Get the SIP API. +void PyQt6QmlPlugin::getSipAPI() +{ + sip = (const sipAPIDef *)PyCapsule_Import("PyQt6.sip._C_API", 0); + + if (!sip) + PyErr_Print(); +} diff --git a/qmlscene/pluginloader.h b/qmlscene/pluginloader.h new file mode 100644 index 0000000..c01da82 --- /dev/null +++ b/qmlscene/pluginloader.h @@ -0,0 +1,57 @@ +/* + * This is the interface of the qmlscene plugin. + * + * Copyright (c) 2023 Riverbank Computing Limited + * + * This file is part of PyQt6. + * + * This file may be used under the terms of the GNU General Public License + * version 3.0 as published by the Free Software Foundation and appearing in + * the file LICENSE included in the packaging of this file. Please review the + * following information to ensure the GNU General Public License version 3.0 + * requirements will be met: http://www.gnu.org/copyleft/gpl.html. + * + * If you do not wish to use this file under the terms of the GPL version 3.0 + * then you may purchase a commercial license. For more information contact + * info@riverbankcomputing.com. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + + +#ifndef _PLUGINLOADER_H +#define _PLUGINLOADER_H + + +#include +#include + +#include +#include + + +class PyQt6QmlPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + PyQt6QmlPlugin(QObject *parent = 0); + virtual ~PyQt6QmlPlugin(); + + void initializeEngine(QQmlEngine *engine, const char *uri); + void registerTypes(const char *uri); + +private: + void getSipAPI(); + static bool addToSysPath(const QString &py_plugin_dir); + bool callRegisterTypes(const QString &py_plugin, const char *uri); + static PyObject *getModuleAttr(const char *module, const char *attr); + + PyObject *py_plugin_obj; + const sipAPIDef *sip; +}; + + +#endif diff --git a/qmlscene/qmlscene.pro-in b/qmlscene/qmlscene.pro-in new file mode 100644 index 0000000..8278f68 --- /dev/null +++ b/qmlscene/qmlscene.pro-in @@ -0,0 +1,23 @@ +CONFIG += plugin @QTCONFIG@ warn_on +QT += qml + +# Work around QTBUG-39300. +CONFIG -= android_install + +TARGET = pyqt6qmlplugin +TEMPLATE = lib + +INCLUDEPATH += @PYINCDIR@ @SIPINCDIR@ +LIBS += @PYLINK@ +DEFINES += PYTHON_LIB=\\\"@PYSHLIB@\\\" + +SOURCES = pluginloader.cpp +HEADERS = pluginloader.h + +# Install. +target.path = @QTPLUGINDIR@ + +python.path = @QTPLUGINDIR@ +python.files = python + +INSTALLS += target python diff --git a/qpy/QtCore/qpycore_api.h b/qpy/QtCore/qpycore_api.h new file mode 100644 index 0000000..fdca9e1 --- /dev/null +++ b/qpy/QtCore/qpycore_api.h @@ -0,0 +1,117 @@ +// This defines the API provided by this library. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_API_H +#define _QPYCORE_API_H + + +#include +#include +#include +#include + +#include "qpycore_namespace.h" +#include "qpycore_public_api.h" + + +QT_BEGIN_NAMESPACE +class QAbstractEventDispatcher; +class QObject; +QT_END_NAMESPACE + + +// Support for pyqtSlot(). +PyObject *qpycore_pyqtslot(PyObject *args, PyObject *kwds); + +// Support for pyqtConfigure(). +PyObject *qpycore_pyqtconfigure(PyObject *self, PyObject *args, + PyObject *kwds); + +// Support for the QObject %FinalisationCode. +int qpycore_qobject_finalisation(PyObject *self, QObject *qobj, PyObject *kwds, + PyObject **updated_kwds); + +// Support for converting between PyObject and QString. +PyObject *qpycore_PyObject_FromQString(const QString &qstr); +QString qpycore_PyObject_AsQString(PyObject *obj); + +// Support for converting between PyObject and QVariant. +PyObject *qpycore_PyObject_FromQVariant(const QVariant &qvar); +QVariant qpycore_PyObject_AsQVariant(PyObject *obj, int *is_err); +PyObject *qpycore_PyObject_FromQVariant(const QMetaProperty &mprop, + const QVariant &qvar); +QVariant qpycore_PyObject_AsQVariant(const QMetaProperty &mprop, PyObject *obj, + bool *ok); + +// Support for pyqtClassInfo() and pyqtEnum(). +PyObject *qpycore_pyqtClassInfo(PyObject *args, PyObject *kwds); +PyObject *qpycore_pyqtEnum(PyObject *enum_cls); + +// Support for creating QGenericArgument and QGenericReturnArgument instances. +PyObject *qpycore_ArgumentFactory(PyObject *type, PyObject *data); +PyObject *qpycore_ReturnFactory(PyObject *type); +PyObject *qpycore_ReturnValue(PyObject *gra); + +// Support for QObject.__getattr__(). +PyObject *qpycore_qobject_getattr(const QObject *qobj, PyObject *py_qobj, + const char *name); + +// Support for QObject.staticMetaObject %GetCode. +PyObject *qpycore_qobject_staticmetaobject(PyObject *type_obj); + +// Support for QMetaObject.connectSlotsByName(). +void qpycore_qmetaobject_connectslotsbyname(QObject *qobj, + PyObject *qobj_wrapper); + +// Support for pyqt[Set]PickleProtocol(). +extern PyObject *qpycore_pickle_protocol; + +// Support for qDebug() etc. +int qpycore_current_context(const char **file, const char **function); + +// Support for QObject.disconnect(). +PyObject *qpycore_qobject_disconnect(const QObject *q_obj); + +// Support for QObject's garbage collector code. +int qpycore_clearSlotProxies(const QObject *transmitter); +int qpycore_visitSlotProxies(const QObject *transmitter, visitproc visit, + void *arg); + +// Support for QJsonValue. +int qpycore_canConvertTo_QJsonValue(PyObject *py); +int qpycore_convertTo_QJsonValue(PyObject *py, PyObject *transferObj, + QJsonValue **cpp, int *isErr); + +// Support for an embedded qt.conf. +bool qpycore_qt_conf(); + +// Utilities. +void qpycore_Unicode_ConcatAndDel(PyObject **string, PyObject *newpart); + +// Initialisation. +void qpycore_init(); +void qpycore_post_init(PyObject *module_dict); + + +// Termination. +extern bool qpycore_created_qapp; + + +#endif diff --git a/qpy/QtCore/qpycore_chimera.cpp b/qpy/QtCore/qpycore_chimera.cpp new file mode 100644 index 0000000..70a95e5 --- /dev/null +++ b/qpy/QtCore/qpycore_chimera.cpp @@ -0,0 +1,1905 @@ +// This is the implementation of the Chimera class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include + +#include "qpycore_chimera.h" +#include "qpycore_misc.h" +#include "qpycore_pyqtpyobject.h" +#include "qpycore_types.h" + +#include "sipAPIQtCore.h" + + +// The registered user-defined Python enum types. +QHash Chimera::_py_enum_types; + +// The cache of previously parsed argument type lists. +QHash > Chimera::_previously_parsed; + +// The registered QVariant to PyObject convertors. +Chimera::FromQVariantConvertors Chimera::registeredFromQVariantConvertors; + +// The registered PyObject to QVariant convertors. +Chimera::ToQVariantConvertors Chimera::registeredToQVariantConvertors; + +// The registered PyObject to QVariant data convertors. +Chimera::ToQVariantDataConvertors Chimera::registeredToQVariantDataConvertors; + + +// The base class for convenience wrappers around mapped type convertors. +class BaseMappedTypeConvertor +{ +public: + BaseMappedTypeConvertor(const char *name) : td(nullptr), _name(name) {} + +protected: + void ensureType(); + const sipTypeDef *td; + +private: + const char *_name; +}; + + +// Ensure that the type definition is available. +void BaseMappedTypeConvertor::ensureType() +{ + if (!td) + { + td = sipFindType(_name); + Q_ASSERT(td); + } +} + + +// A convenience wrapper around a mapped type convertor. +template +class MappedTypeConvertor : public BaseMappedTypeConvertor +{ +public: + MappedTypeConvertor(const char *name) : BaseMappedTypeConvertor(name) {} + + PyObject *fromMappedType(void *cpp); + int toMappedType(PyObject *py, T &cpp); +}; + + +// Convert an instance of the mapped type to a Python object. A NULL pointer +// is returned if there was an error. +template +PyObject *MappedTypeConvertor::fromMappedType(void *cpp) +{ + ensureType(); + + return sipConvertFromNewType(new T(*reinterpret_cast(cpp)), td, NULL); +} + + +// Convert a Python object to an instance of the mapped type. A non-zero value +// is returned if there was an error. +template +int MappedTypeConvertor::toMappedType(PyObject *py, T &cpp) +{ + ensureType(); + + int state, iserr = 0; + void *p = sipForceConvertToType(py, td, NULL, SIP_NOT_NONE, &state, + &iserr); + + if (!iserr) + { + cpp = *reinterpret_cast(p); + sipReleaseType(p, td, state); + } + + return iserr; +} + + +// The different mapped type convertors. +static MappedTypeConvertor variant_hash( + "QHash"); +static MappedTypeConvertor variant_list("QList"); +static MappedTypeConvertor variant_map("QMap"); +static MappedTypeConvertor variant_pair( + "std::pair"); + + +// Construct an invalid type. +Chimera::Chimera() + : _type(0), _py_type(0), _inexact(false), _is_qflags(false), + _is_char_star(false) +{ +} + + +// Construct a copy. +Chimera::Chimera(const Chimera &other) +{ + _type = other._type; + + _py_type = other._py_type; + Py_XINCREF((PyObject *)_py_type); + + metatype = other.metatype; + _inexact = other._inexact; + _is_qflags = other._is_qflags; + _name = other._name; + _is_char_star = other._is_char_star; +} + + +// Destroy the type. +Chimera::~Chimera() +{ + Py_XDECREF((PyObject *)_py_type); +} + + +// Register the type and pseudo fully qualified C++ name of a user-defined +// Python enum. +void Chimera::registerPyEnum(PyObject *enum_type, + const QByteArray &cpp_qualname) +{ + Py_INCREF(enum_type); + _py_enum_types.insert(enum_type, cpp_qualname); +} + + +// Parse an object as a type. +const Chimera *Chimera::parse(PyObject *obj) +{ + Chimera *ct = new Chimera; + bool parse_ok; + + if (PyType_Check(obj)) + { + // Parse the type object. + parse_ok = ct->parse_py_type((PyTypeObject *)obj); + + if (!parse_ok) + raiseParseException(obj); + } + else + { + const char *cpp_type_name = sipString_AsASCIIString(&obj); + + if (cpp_type_name) + { + // Always use normalised type names so that we have a consistent + // standard. + QByteArray norm_name = QMetaObject::normalizedType(cpp_type_name); + Py_DECREF(obj); + + // Parse the type name. + parse_ok = ct->parse_cpp_type(norm_name); + + if (!parse_ok) + raiseParseCppException(cpp_type_name); + } + else + { + parse_ok = false; + } + } + + if (!parse_ok) + { + delete ct; + return 0; + } + + return ct; +} + + +// Parse a C++ type name as a type. +const Chimera *Chimera::parse(const QByteArray &name) +{ + Chimera *ct = new Chimera; + + if (!ct->parse_cpp_type(name)) + { + delete ct; + + raiseParseCppException(name.constData()); + + return 0; + } + + return ct; +} + + +// Parse a meta-property as a type. +const Chimera *Chimera::parse(const QMetaProperty &mprop) +{ + Chimera *ct = new Chimera; + QByteArray type_name; + + // The type name of an enum property sometimes includes the scope in the + // name and sometimes doesn't (maybe only within the scope itself). + // Therefore get the name of the meta-enum. + if (mprop.isEnumType()) + { + QMetaEnum menum = mprop.enumerator(); + + type_name = QByteArray(menum.name()); + + if (menum.scope()) + type_name.prepend("::").prepend(menum.scope()); + + // If it is a QFlag then we have the typedef name rather than the + // underlying type which SIP knows about, therefore resolve the typedef + // name. + if (mprop.isFlagType()) + { + const char *resolved = sipResolveTypedef(type_name.constData()); + + if (resolved) + type_name = QByteArray(resolved); + } + } + else + { + type_name = QByteArray(mprop.typeName()); + } + + ct->_type = sipFindType(type_name.constData()); + ct->metatype = mprop.metaType(); + ct->_inexact = true; + ct->_is_qflags = mprop.isFlagType(); + ct->_name = type_name; + + return ct; +} + + +// Parse a normalised C++ signature as a list of types. +Chimera::Signature *Chimera::parse(const QByteArray &sig, const char *context) +{ + // Extract the argument list. + int start_idx = sig.indexOf('('); + + if (start_idx < 0) + start_idx = 0; + else + ++start_idx; + + int end_idx = sig.lastIndexOf(')'); + + int len; + + if (end_idx < start_idx) + len = -1; + else + len = end_idx - start_idx; + + // Parse each argument type. + Chimera::Signature *parsed_sig = new Chimera::Signature(sig, true); + + if (len > 0) + { + QByteArray args_str = sig.mid(start_idx, len); + + // Check we haven't already done it. + QList parsed_args = _previously_parsed.value(args_str); + + if (parsed_args.isEmpty()) + { + int i, arg_start, template_level; + + i = arg_start = template_level = 0; + + // Extract each argument allowing for commas in templates. + for (;;) + { + char ch = (i < args_str.size() ? args_str.at(i) : '\0'); + QByteArray arg; + + switch (ch) + { + case '<': + ++template_level; + break; + + case '>': + --template_level; + break; + + case '\0': + arg = args_str.mid(arg_start, i - arg_start); + break; + + case ',': + if (template_level == 0) + { + arg = args_str.mid(arg_start, i - arg_start); + arg_start = i + 1; + } + + break; + } + + if (!arg.isEmpty()) + { + Chimera *ct = new Chimera; + + if (!ct->parse_cpp_type(arg)) + { + delete ct; + delete parsed_sig; + qDeleteAll(parsed_args.constBegin(), + parsed_args.constEnd()); + + raiseParseCppException(arg.constData(), context); + + return 0; + } + + parsed_args.append(ct); + + if (ch == '\0') + break; + } + + ++i; + } + + // Only parse once. + _previously_parsed.insert(args_str, parsed_args); + } + + parsed_sig->parsed_arguments = parsed_args; + } + + return parsed_sig; +} + + +// Parses a C++ signature given as a Python tuple of types and an optional +// name. Return 0 if there was an error. +Chimera::Signature *Chimera::parse(PyObject *types, const char *name, + const char *context) +{ + if (!name) + name = ""; + + Chimera::Signature *parsed_sig = new Chimera::Signature(name, false); + + parsed_sig->signature.append('('); + parsed_sig->py_signature.append('['); + + for (Py_ssize_t i = 0; i < PyTuple_Size(types); ++i) + { + PyObject *type = PyTuple_GetItem(types, i); + const Chimera *parsed_type = parse(type); + + if (!parsed_type) + { + delete parsed_sig; + + raiseParseException(type, context); + + return 0; + } + + parsed_sig->parsed_arguments.append(parsed_type); + + if (i > 0) + { + parsed_sig->signature.append(','); + parsed_sig->py_signature.append(", "); + } + + parsed_sig->signature.append(parsed_type->name()); + + if (parsed_type->_py_type) + parsed_sig->py_signature.append(sipPyTypeName(parsed_type->_py_type)); + else + parsed_sig->py_signature.append(parsed_type->name()); + } + + parsed_sig->signature.append(')'); + parsed_sig->py_signature.append(']'); + + return parsed_sig; +} + + +// Raise an exception after parse() of a Python type has failed. +void Chimera::raiseParseException(PyObject *type, const char *context) +{ + if (PyType_Check(type)) + { + if (context) + PyErr_Format(PyExc_TypeError, + "Python type '%s' is not supported as %s type", + sipPyTypeName((PyTypeObject *)type), context); + else + PyErr_Format(PyExc_TypeError, "unknown Python type '%s'", + sipPyTypeName((PyTypeObject *)type)); + } + else + { + const char *cpp_type_name = sipString_AsASCIIString(&type); + + if (cpp_type_name) + { + raiseParseCppException(cpp_type_name, context); + Py_DECREF(type); + } + } +} + + +// Raise an exception after parse() of a C++ type has failed. +void Chimera::raiseParseCppException(const char *type, const char *context) +{ + if (context) + PyErr_Format(PyExc_TypeError, + "C++ type '%s' is not supported as %s type", type, context); + else + PyErr_Format(PyExc_TypeError, "unknown C++ type '%s'", type); +} + + +// Parse the given Python type object. +bool Chimera::parse_py_type(PyTypeObject *type_obj) +{ + const sipTypeDef *td = sipTypeFromPyTypeObject(type_obj); + + if (td) + { + if (sipTypeIsNamespace(td)) + return false; + + _type = td; + _name = sipTypeName(td); + + set_qflags(td); + + if (sipTypeIsEnum(td)) + { + metatype = QMetaType::fromName(_name); + + // Unregistered enums are handled as integers. + if (!metatype.isValid()) + metatype = QMetaType(QMetaType::Int); + } + else if (_is_qflags) + { + metatype = QMetaType(QMetaType::Int); + } + else + { + // If there is no assignment helper then assume it is a + // pointer-type. + if (!get_assign_helper()) + _name.append('*'); + + metatype = QMetaType::fromName(_name); + + // If it is a user type then it must be a type that SIP knows + // about but was registered by Qt. + if (metatype.id() < QMetaType::User) + { + if (PyType_IsSubtype(type_obj, sipTypeAsPyTypeObject(sipType_QObject))) + { + metatype = QMetaType(QMetaType::QObjectStar); + } + else if (sipIsUserType((sipWrapperType *)type_obj)) + { + // It is a non-QObject Python sub-class so make sure it + // gets wrapped in a PyQt_PyObject. + _type = 0; + metatype = QMetaType::fromType(); + _name.clear(); + } + } + } + } + else if (_py_enum_types.contains((PyObject *)type_obj)) + { + metatype = QMetaType(QMetaType::Int); + + // Note that we use the fully qualified name. + _name = _py_enum_types.value((PyObject *)type_obj); + } + else if (type_obj == &PyList_Type) + { + metatype = QMetaType(QMetaType::QVariantList); + } + else if (type_obj == &PyUnicode_Type) + { + _type = sipType_QString; + metatype = QMetaType(QMetaType::QString); + } + else if (type_obj == &PyBool_Type) + { + metatype = QMetaType(QMetaType::Bool); + } + else if (type_obj == &PyLong_Type) + { + // We choose to map to a C++ int for the same reasons as above and to + // be consistent with Python3 where everything is a long object. If + // this isn't appropriate the user can always use a string to specify + // the exact C++ type they want. + metatype = QMetaType(QMetaType::Int); + _inexact = true; + } + else if (type_obj == &PyFloat_Type) + { + metatype = QMetaType(QMetaType::Double); + } + else if (type_obj == sipVoidPtr_Type) + { + metatype = QMetaType(QMetaType::VoidStar); + _name = "void*"; + } + + // Fallback to using a PyQt_PyObject. + if (!metatype.isValid()) + metatype = QMetaType::fromType(); + + // If there is no name so far then use the meta-type name. + if (_name.isEmpty()) + _name = metatype.name(); + + _py_type = type_obj; + Py_INCREF((PyObject *)_py_type); + + return true; +} + + +// Set the internal QFlags flag. +void Chimera::set_qflags(const sipTypeDef *td) +{ + if (sipTypeIsMapped(td) && qpycore_is_pyqt_type(_type)) + { + const pyqt6MappedTypePluginDef *plugin = reinterpret_cast(sipTypePluginData(_type)); + + if (plugin) + _is_qflags = plugin->flags & 0x01; + } +} + + +// Update a C++ type so that any typedefs are resolved. +QByteArray Chimera::resolve_types(const QByteArray &type) +{ + // Split into a base type and a possible list of template arguments. + QByteArray resolved = type.simplified(); + + // Get the raw type, ie. without any "const", "&" or "*". + QByteArray raw_type; + int original_raw_start; + + if (resolved.startsWith("const ")) + original_raw_start = 6; + else + original_raw_start = 0; + + raw_type = resolved.mid(original_raw_start); + + while (raw_type.endsWith('&') || raw_type.endsWith('*') || raw_type.endsWith(' ')) + raw_type.chop(1); + + int original_raw_len = raw_type.size(); + + if (original_raw_len == 0) + return QByteArray(); + + // Get any template arguments. + QList args; + int tstart = raw_type.indexOf('<'); + + if (tstart >= 0) + { + // Make sure the template arguments are terminated. + if (!raw_type.endsWith('>')) + return QByteArray(); + + // Split the template arguments taking nested templates into account. + int depth = 1, arg_start = tstart + 1; + + for (int i = arg_start; i < raw_type.size(); ++i) + { + int arg_end = -1; + char ch = raw_type.at(i); + + if (ch == '<') + { + ++depth; + } + else if (ch == '>') + { + --depth; + + if (depth < 0) + return QByteArray(); + + if (depth == 0) + arg_end = i; + } + else if (ch == ',' && depth == 1) + { + arg_end = i; + } + + if (arg_end >= 0) + { + QByteArray arg = resolve_types(raw_type.mid(arg_start, arg_end - arg_start)); + + if (arg.isEmpty()) + return QByteArray(); + + args.append(arg); + + arg_start = arg_end + 1; + } + } + + if (depth != 0) + return QByteArray(); + + // Remove the template arguments. + raw_type.truncate(tstart); + } + + // Expand any typedef. + const char *base_type = sipResolveTypedef(raw_type.constData()); + + if (base_type) + raw_type = base_type; + + // Add any (now resolved) template arguments. + if (args.count() > 0) + { + raw_type.append('<'); + + for (QList::const_iterator it = args.begin();;) + { + raw_type.append(*it); + + if (++it == args.end()) + break; + + raw_type.append(','); + } + + if (raw_type.endsWith('>')) + raw_type.append(' '); + + raw_type.append('>'); + } + + // Replace the original raw type with the resolved one. + resolved.replace(original_raw_start, original_raw_len, raw_type); + + return resolved; +} + + +// Parse the given C++ type name. +bool Chimera::parse_cpp_type(const QByteArray &type) +{ + _name = type; + QByteArray nonconst_name = type.mid(type.startsWith("const ") ? 6 : 0); + + // Resolve any types. + QByteArray resolved = resolve_types(nonconst_name); + + if (resolved.isEmpty()) + return false; + + // See if the type is known to Qt. + metatype = QMetaType::fromName(resolved); + + // If not then use the PyQt_PyObject wrapper for now. + bool valid = metatype.isValid(); + + if (!valid) + metatype = QMetaType::fromType(); + + // See if the type (without a pointer) is known to SIP. + bool is_ptr = resolved.endsWith('*'); + + if (is_ptr) + { + resolved.chop(1); + + if (resolved.endsWith('*')) + return false; + } + + _type = sipFindType(resolved.constData()); + + // If we didn't find the type and we have resolved some typedefs then try + // again with the original type. This means that QVector will work + // as a signal argument type. It may be that we should always lookup the + // original type - but we don't want to risk breaking things. + if (!_type && nonconst_name != resolved) + _type = sipFindType(nonconst_name.constData()); + + if (!_type) + { + // This is the only fundamental pointer type recognised by Qt. + if (metatype.id() == QMetaType::VoidStar) + return true; + + // This is 'int', 'bool', etc. + if (metatype != QMetaType::fromType() && !is_ptr) + return true; + + if (resolved == "char" && is_ptr) + { + // This is (hopefully) '\0' terminated string. + _is_char_star = true; + + return true; + } + + // This is an explicit 'PyQt_PyObject'. + if (resolved == "PyQt_PyObject" && !is_ptr) + return true; + + return false; + } + + if (sipTypeIsNamespace(_type)) + return false; + + set_qflags(_type); + + // We always pass these as integers. + if ((!valid && sipTypeIsEnum(_type)) || _is_qflags) + metatype = QMetaType(QMetaType::Int); + + if (is_ptr) + { + // We don't support pointers to enums. + if (sipTypeIsEnum(_type)) + { + _type = 0; + } + else if (sipTypeIsClass(_type)) + { + PyTypeObject *type_obj = sipTypeAsPyTypeObject(_type); + + if (PyType_IsSubtype(type_obj, sipTypeAsPyTypeObject(sipType_QObject))) + metatype = QMetaType(QMetaType::QObjectStar); + } + } + + return true; +} + + +// Convert a Python object to C++ at a given address. This has a lot in common +// with the method that converts to a QVariant. However, unlike that method, +// we have no control over the size of the destination storage and so must +// convert exactly as requested. +bool Chimera::fromPyObject(PyObject *py, void *cpp) const +{ + // Let any registered convertors have a go first. + for (int i = 0; i < registeredToQVariantDataConvertors.count(); ++i) + { + bool ok; + + if (registeredToQVariantDataConvertors.at(i)(py, cpp, metatype, &ok)) + return ok; + } + + int iserr = 0; + + PyErr_Clear(); + + switch (typeId()) + { + case QMetaType::Nullptr: + *reinterpret_cast(cpp) = nullptr; + break; + + case QMetaType::Bool: + *reinterpret_cast(cpp) = PyLong_AsLong(py); + break; + + case QMetaType::Int: + { + if (isEnumOrFlag()) + *reinterpret_cast(cpp) = QVariant( + get_enum_value(py)); + else + *reinterpret_cast(cpp) = PyLong_AsLong(py); + + break; + } + + case QMetaType::UInt: + *reinterpret_cast(cpp) = sipLong_AsUnsignedLong(py); + break; + + case QMetaType::Double: + *reinterpret_cast(cpp) = PyFloat_AsDouble(py); + break; + + case QMetaType::VoidStar: + *reinterpret_cast(cpp) = sipConvertToVoidPtr(py); + break; + + case QMetaType::Long: + *reinterpret_cast(cpp) = PyLong_AsLong(py); + break; + + case QMetaType::LongLong: + *reinterpret_cast(cpp) = PyLong_AsLongLong(py); + break; + + case QMetaType::Short: + *reinterpret_cast(cpp) = PyLong_AsLong(py); + break; + + case QMetaType::Char: + if (PyBytes_Check(py) && PyBytes_Size(py) == 1) + *reinterpret_cast(cpp) = *PyBytes_AsString(py); + else + iserr = 1; + break; + + case QMetaType::Char16: + { + char16_t ch; + + if (to_char16_t(py, ch)) + *reinterpret_cast(cpp) = ch; + else + iserr = 1; + + break; + } + + case QMetaType::Char32: + { + char32_t ch; + + if (to_char32_t(py, ch)) + *reinterpret_cast(cpp) = ch; + else + iserr = 1; + + break; + } + + case QMetaType::ULong: + *reinterpret_cast(cpp) = sipLong_AsUnsignedLong(py); + break; + + case QMetaType::ULongLong: + *reinterpret_cast(cpp) = static_cast(PyLong_AsUnsignedLongLong(py)); + break; + + case QMetaType::UShort: + *reinterpret_cast(cpp) = sipLong_AsUnsignedLong(py); + break; + + case QMetaType::UChar: + if (PyBytes_Check(py) && PyBytes_Size(py) == 1) + *reinterpret_cast(cpp) = *PyBytes_AsString(py); + else + iserr = 1; + break; + + case QMetaType::Float: + *reinterpret_cast(cpp) = PyFloat_AsDouble(py); + break; + + case QMetaType::QObjectStar: + *reinterpret_cast(cpp) = sipForceConvertToType(py, + sipType_QObject, 0, SIP_NO_CONVERTORS, 0, &iserr); + break; + + case QMetaType::QVariantHash: + { + QVariantHash qvh; + + iserr = variant_hash.toMappedType(py, qvh); + + if (!iserr) + *reinterpret_cast(cpp) = qvh; + + break; + } + + case QMetaType::QVariantList: + { + QVariantList qvl; + + iserr = variant_list.toMappedType(py, qvl); + + if (!iserr) + *reinterpret_cast(cpp) = qvl; + + break; + } + + case QMetaType::QVariantMap: + { + QVariantMap qvm; + + iserr = variant_map.toMappedType(py, qvm); + + if (!iserr) + *reinterpret_cast(cpp) = qvm; + + break; + } + + case QMetaType::QVariantPair: + { + QVariantPair qvp; + + iserr = variant_pair.toMappedType(py, qvp); + + if (!iserr) + *reinterpret_cast(cpp) = qvp; + + break; + } + + case -1: + { + const char **ptr = reinterpret_cast(cpp); + + if (PyBytes_Check(py)) + *ptr = PyBytes_AsString(py); + else if (py == Py_None) + *ptr = 0; + else + iserr = 1; + + break; + } + + default: + if (_type) + { + if (sipTypeIsEnum(_type)) + { + *reinterpret_cast(cpp) = sipConvertToEnum(py, _type); + } + else if (_name.endsWith('*')) + { + // This must be a pointer-type. + + *reinterpret_cast(cpp) = sipForceConvertToType(py, + _type, 0, SIP_NO_CONVERTORS, 0, &iserr); + } + else + { + // This must be a value-type. + + sipAssignFunc assign = get_assign_helper(); + + if (assign) + { + int state; + void *value_class; + + value_class = sipForceConvertToType(py, _type, 0, + SIP_NOT_NONE, &state, &iserr); + + if (!iserr) + assign(cpp, 0, value_class); + + sipReleaseType(value_class, _type, state); + } + else + { + iserr = 1; + } + } + } + else + { + iserr = 1; + } + } + + if (iserr || PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "unable to convert a Python '%s' object to a C++ '%s' instance", + sipPyTypeName(Py_TYPE(py)), _name.constData()); + + return false; + } + + return true; +} + + +// Return the assignment helper for the type, if any. +sipAssignFunc Chimera::get_assign_helper() const +{ + if (sipTypeIsClass(_type)) + return ((sipClassTypeDef *)_type)->ctd_assign; + + if (sipTypeIsMapped(_type)) + return ((sipMappedTypeDef *)_type)->mtd_assign; + + return 0; +} + + +// Convert a Python object to a QVariant. +bool Chimera::fromPyObject(PyObject *py, QVariant *var, bool strict) const +{ + // Deal with the simple case of wrapping the Python object rather than + // converting it. + if (_type != sipType_QVariant && metatype == QMetaType::fromType()) + { + // If the type was specified by a Python type (as opposed to + // 'PyQt_PyObject') then check the object is an instance of it. + if (_py_type && !PyObject_TypeCheck(py, _py_type)) + return false; + + *var = keep_as_pyobject(py); + return true; + } + + // Let any registered convertors have a go first. However don't invoke + // then for None because that is effectively reserved for representing a + // null QString. + if (py != Py_None) + { + for (int i = 0; i < registeredToQVariantConvertors.count(); ++i) + { + bool ok; + + if (registeredToQVariantConvertors.at(i)(py, *var, &ok)) + return ok; + } + } + + int iserr = 0, value_class_state; + void *ptr_class, *value_class = 0; + + // Temporary storage for different types. + union { + std::nullptr_t tmp_nullptr_t; + bool tmp_bool; + int tmp_int; + unsigned int tmp_unsigned_int; + double tmp_double; + void *tmp_void_ptr; + long tmp_long; + qlonglong tmp_qlonglong; + short tmp_short; + char tmp_char; + char16_t tmp_char16_t; + char32_t tmp_char32_t; + unsigned long tmp_unsigned_long; + qulonglong tmp_qulonglong; + unsigned short tmp_unsigned_short; + unsigned char tmp_unsigned_char; + float tmp_float; + } tmp_storage; + + void *variant_data = &tmp_storage; + + PyErr_Clear(); + + QVariant variant; + int metatype_used = metatype.id(); + + switch (typeId()) + { + case QMetaType::Nullptr: + tmp_storage.tmp_nullptr_t = nullptr; + break; + + case QMetaType::Bool: + tmp_storage.tmp_bool = PyLong_AsLong(py); + break; + + case QMetaType::Int: + if (isEnumOrFlag()) + { + tmp_storage.tmp_int = get_enum_value(py); + } + else if (_inexact) + { + // Fit it into the smallest C++ type we can. + + qlonglong qll = PyLong_AsLongLong(py); + + if (PyErr_Occurred()) + { + // Try again in case the value is unsigned and will fit with + // the extra bit. + + PyErr_Clear(); + + qulonglong qull = static_cast(PyLong_AsUnsignedLongLong(py)); + + if (PyErr_Occurred()) + { + // It won't fit into any C++ type so pass it as a Python + // object. + + PyErr_Clear(); + + *var = keep_as_pyobject(py); + metatype_used = QMetaType::UnknownType; + } + else + { + tmp_storage.tmp_qulonglong = qull; + metatype_used = QMetaType::ULongLong; + } + } + else if ((qlonglong)(int)qll == qll) + { + // It fits in a C++ int. + tmp_storage.tmp_int = qll; + } + else if ((qulonglong)(unsigned int)qll == (qulonglong)qll) + { + // The extra bit is enough for it to fit. + tmp_storage.tmp_unsigned_int = qll; + metatype_used = QMetaType::UInt; + } + else + { + // This fits. + tmp_storage.tmp_qlonglong = qll; + metatype_used = QMetaType::LongLong; + } + } + else + { + // It must fit into a C++ int. + tmp_storage.tmp_int = PyLong_AsLong(py); + } + + break; + + case QMetaType::UInt: + tmp_storage.tmp_unsigned_int = sipLong_AsUnsignedLong(py); + break; + + case QMetaType::Double: + tmp_storage.tmp_double = PyFloat_AsDouble(py); + break; + + case QMetaType::VoidStar: + tmp_storage.tmp_void_ptr = sipConvertToVoidPtr(py); + break; + + case QMetaType::Long: + tmp_storage.tmp_long = PyLong_AsLong(py); + break; + + case QMetaType::LongLong: + tmp_storage.tmp_qlonglong = PyLong_AsLongLong(py); + break; + + case QMetaType::Short: + tmp_storage.tmp_short = PyLong_AsLong(py); + break; + + case QMetaType::Char: + if (PyBytes_Check(py) && PyBytes_Size(py) == 1) + tmp_storage.tmp_char = *PyBytes_AsString(py); + else + iserr = 1; + break; + + case QMetaType::Char16: + if (!to_char16_t(py, tmp_storage.tmp_char16_t)) + iserr = 1; + break; + + case QMetaType::Char32: + if (!to_char32_t(py, tmp_storage.tmp_char32_t)) + iserr = 1; + break; + + case QMetaType::ULong: + tmp_storage.tmp_unsigned_long = sipLong_AsUnsignedLong(py); + break; + + case QMetaType::ULongLong: + tmp_storage.tmp_qulonglong = static_cast(PyLong_AsUnsignedLongLong(py)); + break; + + case QMetaType::UShort: + tmp_storage.tmp_unsigned_short = sipLong_AsUnsignedLong(py); + break; + + case QMetaType::UChar: + if (PyBytes_Check(py) && PyBytes_Size(py) == 1) + tmp_storage.tmp_unsigned_char = *PyBytes_AsString(py); + else + iserr = 1; + break; + + case QMetaType::Float: + tmp_storage.tmp_float = PyFloat_AsDouble(py); + break; + + case QMetaType::QObjectStar: + tmp_storage.tmp_void_ptr = sipForceConvertToType(py, sipType_QObject, + 0, SIP_NO_CONVERTORS, 0, &iserr); + break; + + case QMetaType::QVariantHash: + { + QVariantHash qvh; + + iserr = variant_hash.toMappedType(py, qvh); + + if (!iserr) + { + *var = QVariant(qvh); + metatype_used = QMetaType::UnknownType; + } + else if (!strict) + { + // Assume the failure is because the key was the wrong type. + iserr = 0; + PyErr_Clear(); + + *var = keep_as_pyobject(py); + metatype_used = QMetaType::UnknownType; + } + + break; + } + + case QMetaType::QVariantList: + { + QVariantList qvl; + + iserr = variant_list.toMappedType(py, qvl); + + if (!iserr) + { + *var = QVariant(qvl); + metatype_used = QMetaType::UnknownType; + } + + break; + } + + case QMetaType::QVariantMap: + { + QVariantMap qvm; + + iserr = variant_map.toMappedType(py, qvm); + + if (!iserr) + { + *var = QVariant(qvm); + metatype_used = QMetaType::UnknownType; + } + else if (!strict) + { + // Assume the failure is because the key was the wrong type. + iserr = 0; + PyErr_Clear(); + + *var = keep_as_pyobject(py); + metatype_used = QMetaType::UnknownType; + } + + break; + } + + case QMetaType::QVariantPair: + { + QVariantPair qvp; + + iserr = variant_pair.toMappedType(py, qvp); + + if (!iserr) + { + *var = QVariant::fromValue(qvp); + metatype_used = QMetaType::UnknownType; + } + + break; + } + + case -1: + metatype_used = QMetaType::VoidStar; + + if (PyBytes_Check(py)) + tmp_storage.tmp_void_ptr = PyBytes_AsString(py); + else if (py == Py_None) + tmp_storage.tmp_void_ptr = 0; + else + iserr = 1; + + break; + + default: + if (_type) + { + if (sipTypeIsEnum(_type)) + { + // Note that this will be a registered enum. + tmp_storage.tmp_int = sipConvertToEnum(py, _type); + } + else if (_name.endsWith('*')) + { + ptr_class = sipForceConvertToType(py, _type, 0, + SIP_NO_CONVERTORS, 0, &iserr); + + variant_data = &ptr_class; + } + else + { + value_class = sipForceConvertToType(py, _type, 0, + SIP_NOT_NONE, &value_class_state, &iserr); + + variant_data = value_class; + } + } + else + { + // This is a class we don't recognise. + iserr = 1; + } + } + + if (iserr || PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "unable to convert a Python '%s' object to a C++ '%s' instance", + sipPyTypeName(Py_TYPE(py)), _name.constData()); + + iserr = 1; + } + else if (_type == sipType_QVariant) + { + *var = QVariant(*reinterpret_cast(variant_data)); + } + else if (metatype_used != QMetaType::UnknownType) + { + *var = QVariant(QMetaType(metatype_used), variant_data); + } + + // Release any temporary value-class instance now that QVariant will have + // made a copy. + if (value_class) + sipReleaseType(value_class, _type, value_class_state); + + return (iserr == 0); +} + + +// Convert a Python object to a QVariant based on the type of the object. +QVariant Chimera::fromAnyPyObject(PyObject *py, int *is_err) +{ + QVariant variant; + + if (py != Py_None) + { + // Let any registered convertors have a go first. + for (int i = 0; i < registeredToQVariantConvertors.count(); ++i) + { + QVariant var; + bool ok; + + if (registeredToQVariantConvertors.at(i)(py, var, &ok)) + { + *is_err = !ok; + + return var; + } + } + + Chimera ct; + + if (ct.parse_py_type(Py_TYPE(py))) + { + // If the type is a dict then try and convert it to a QVariantMap + // if possible. + if (Py_TYPE(py) == &PyDict_Type) + ct.metatype = QMetaType(QMetaType::QVariantMap); + + // The conversion is non-strict in case the type was a dict and we + // can't convert it to a QVariantMap. + if (!ct.fromPyObject(py, &variant, false)) + { + *is_err = 1; + } + } + else + { + *is_err = 1; + } + } + + return variant; +} + + +// Convert a QVariant to Python. +PyObject *Chimera::toPyObject(const QVariant &var) const +{ + if (_type != sipType_QVariant) + { + // For some reason (see qvariant_p.h) an invalid QVariant can be + // returned when a QMetaType::Void is expected. + if (!var.isValid() && metatype.id() == QMetaType::Void) + { + Py_INCREF(Py_None); + return Py_None; + } + + // Handle the reverse of non-strict conversions of dict to QVariantMap, + // ie. we want a dict but we have a QVariantMap. + if (metatype == QMetaType::fromType() && _py_type == &PyDict_Type && var.metaType().id() == QMetaType::QVariantMap) + { + QVariantMap qvm = var.toMap(); + + return variant_map.fromMappedType(&qvm); + } + + // A sanity check. + if (metatype != var.metaType()) + { + // However having an Int QVariant value and having an invalid + // QMetaType is the case that we are dealing with a user-defined + // enum and so is valid. + if (!(var.metaType().id() == QMetaType::Int && metatype.id() == QMetaType::UnknownType)) + { + PyErr_Format(PyExc_TypeError, + "unable to convert a QVariant of type %d to a QMetaType of type %d", + var.metaType().id(), metatype.id()); + + return 0; + } + } + + // Deal with the simple case of unwrapping a Python object rather than + // converting it. + if (metatype == QMetaType::fromType()) + { + PyQt_PyObject pyobj_wrapper = var.value(); + + if (!pyobj_wrapper.pyobject) + { + PyErr_SetString(PyExc_TypeError, + "unable to convert a QVariant back to a Python object"); + + return 0; + } + + Py_INCREF(pyobj_wrapper.pyobject); + + return pyobj_wrapper.pyobject; + } + } + + // Let any registered convertors have a go first. + for (int i = 0; i < registeredFromQVariantConvertors.count(); ++i) + { + PyObject *py; + + if (registeredFromQVariantConvertors.at(i)(var, &py)) + return py; + } + + return toPyObject(const_cast(var.constData())); +} + + +// Convert a C++ object at an arbitary address to Python. +PyObject *Chimera::toPyObject(void *cpp) const +{ + if (metatype == QMetaType::fromType()) + { + if (_is_char_star) + { + char *s = *reinterpret_cast(cpp); + + if (s) + return PyBytes_FromString(s); + + Py_INCREF(Py_None); + return Py_None; + } + + if (_type && !sipTypeIsEnum(_type)) + { + if (_name.endsWith('*')) + cpp = *reinterpret_cast(cpp); + + return sipConvertFromType(cpp, _type, 0); + } + + // Unwrap a Python object. + PyQt_PyObject *pyobj_wrapper = reinterpret_cast(cpp); + + if (!pyobj_wrapper->pyobject) + { + PyErr_SetString(PyExc_TypeError, + "unable to convert a QVariant back to a Python object"); + + return 0; + } + + Py_INCREF(pyobj_wrapper->pyobject); + + return pyobj_wrapper->pyobject; + } + + PyObject *py = 0; + + switch (metatype.id()) + { + case QMetaType::UnknownType: + // In invalid QMetaType probably means a user-defined enum. + py = get_enum_key(*reinterpret_cast(cpp)); + break; + + case QMetaType::Nullptr: + py = Py_None; + Py_INCREF(py); + break; + + case QMetaType::Bool: + py = PyBool_FromLong(*reinterpret_cast(cpp)); + break; + + case QMetaType::Int: + if (_is_qflags) + { + py = sipConvertFromType(cpp, _type, 0); + } + else if (isEnumOrFlag()) + { + py = get_enum_key(*reinterpret_cast(cpp)); + } + else + { + py = PyLong_FromLong(*reinterpret_cast(cpp)); + } + + break; + + case QMetaType::UInt: + { + long ui = *reinterpret_cast(cpp); + + if (ui < 0) + py = PyLong_FromUnsignedLong((unsigned long)ui); + else + py = PyLong_FromLong(ui); + + break; + } + + case QMetaType::Double: + py = PyFloat_FromDouble(*reinterpret_cast(cpp)); + break; + + case QMetaType::VoidStar: + py = sipConvertFromVoidPtr(*reinterpret_cast(cpp)); + break; + + case QMetaType::Long: + py = PyLong_FromLong(*reinterpret_cast(cpp)); + break; + + case QMetaType::LongLong: + py = PyLong_FromLongLong(*reinterpret_cast(cpp)); + break; + + case QMetaType::Short: + py = PyLong_FromLong(*reinterpret_cast(cpp)); + break; + + case QMetaType::Char: + case QMetaType::UChar: + py = PyBytes_FromStringAndSize(reinterpret_cast(cpp), 1); + break; + + case QMetaType::Char16: + py = PyUnicode_DecodeUTF16(reinterpret_cast(cpp), 1, NULL, + NULL); + break; + + case QMetaType::Char32: + py = PyUnicode_DecodeUTF32(reinterpret_cast(cpp), 1, NULL, + NULL); + break; + + case QMetaType::ULong: + py = PyLong_FromUnsignedLong(*reinterpret_cast(cpp)); + break; + + case QMetaType::ULongLong: + py = PyLong_FromUnsignedLongLong(*reinterpret_cast(cpp)); + break; + + case QMetaType::UShort: + py = PyLong_FromLong(*reinterpret_cast(cpp)); + break; + + case QMetaType::Float: + py = PyFloat_FromDouble(*reinterpret_cast(cpp)); + break; + + case QMetaType::QObjectStar: + py = sipConvertFromType(*reinterpret_cast(cpp), + sipType_QObject, 0); + break; + + case QMetaType::QVariantHash: + py = variant_hash.fromMappedType(cpp); + break; + + case QMetaType::QVariantList: + py = variant_list.fromMappedType(cpp); + break; + + case QMetaType::QVariantMap: + py = variant_map.fromMappedType(cpp); + break; + + case QMetaType::QVariantPair: + py = variant_pair.fromMappedType(cpp); + break; + + default: + if (_type) + { + if (sipTypeIsEnum(_type)) + { + // Note that this will be a registered enum. + py = sipConvertFromEnum(*reinterpret_cast(cpp), _type); + } + else if (_name.endsWith('*')) + { + py = sipConvertFromType(*reinterpret_cast(cpp), + _type, 0); + } + else + { + // Make a copy as it is a value type. + void *copy = metatype.create(cpp); + + py = sipConvertFromNewType(copy, _type, 0); + + if (!py) + metatype.destroy(copy); + } + } + else if (_name.contains("_QMLTYPE_")) + { + // These correspond to objects defined in QML. We assume that they + // are all sub-classes of QObject. If this proves not to be the + // case then we will have to look at the first part of _name (and + // possibly move this code the the QtQml module). + py = sipConvertFromType(*reinterpret_cast(cpp), + sipType_QObject, 0); + } + else if (_name.endsWith('*')) + { + // It's a pointer to an unknown type so convert it to a voidptr in + // case that can be used. + py = sipConvertFromVoidPtr(cpp); + } + } + + if (!py) + PyErr_Format(PyExc_TypeError, + "unable to convert a C++ '%s' instance to a Python object", + _name.constData()); + + return py; +} + + +// Convert a QVariant to a Python object based on the type of the object. +PyObject *Chimera::toAnyPyObject(const QVariant &var) +{ + if (!var.isValid()) + { + Py_INCREF(Py_None); + return Py_None; + } + + const char *type_name = var.typeName(); + + // Qt v5.8.0 changed the way it was handling null in QML. We treat it as a + // special case though there may be other implications still to be + // discovered. + if (qstrcmp(type_name, "std::nullptr_t") == 0) + { + Py_INCREF(Py_None); + return Py_None; + } + + const sipTypeDef *td = sipFindType(type_name); + Chimera *ct = new Chimera; + + ct->_type = td; + ct->_name = type_name; + ct->metatype = var.metaType(); + + if (td) + ct->set_qflags(td); + + PyObject *py = ct->toPyObject(var); + delete ct; + + return py; +} + + +// Wrap a Python object in a QVariant without any conversion. +QVariant Chimera::keep_as_pyobject(PyObject *py) +{ + PyQt_PyObject pyobj_wrapper(py); + + return QVariant(QMetaType::fromType(), &pyobj_wrapper); +} + + +// Convert a single character Python string to a char16_t and return true if +// there was no error. +bool Chimera::to_char16_t(PyObject *py, char16_t &cpp) +{ + if (!PyUnicode_Check(py) || PyUnicode_GetLength(py) != 1) + return false; + + PyObject *utf16 = PyUnicode_AsUTF16String(py); + + if (!utf16) + return false; + + // Skip the BOM. + cpp = reinterpret_cast(PyBytes_AsString(utf16))[1]; + + Py_DECREF(utf16); + + return true; +} + + +// Convert a single character Python string to a char32_t and return true if +// there was no error. +bool Chimera::to_char32_t(PyObject *py, char32_t &cpp) +{ + if (!PyUnicode_Check(py) || PyUnicode_GetLength(py) != 1) + return false; + + PyObject *utf32 = PyUnicode_AsUTF32String(py); + + if (!utf32) + return false; + + // Skip the BOM. + cpp = reinterpret_cast(PyBytes_AsString(utf32))[1]; + + Py_DECREF(utf32); + + return true; +} + + +// Return true if the type is either a C++ or Python enum or flag. +bool Chimera::isEnumOrFlag() const +{ + if (_type && sipTypeIsEnum(_type)) + return true; + + if (_is_qflags) + return true; + + return (_py_type ? _py_enum_types.contains((PyObject *)_py_type) : false); +} + + +// Return the value of an enum, either a wrapped one or a user-defined one. +int Chimera::get_enum_value(PyObject *py) const +{ + int value = 0; + + if (_type) + { + value = sipConvertToEnum(py, _type); + } + else + { + PyObject *value_obj = PyObject_GetAttrString(py, "value"); + + if (value_obj) + { + value = PyLong_AsLong(value_obj); + Py_DECREF(value_obj); + } + } + + return value; +} + + +// Return the key of an enum, either a wrapped one or a user-defined one. +PyObject *Chimera::get_enum_key(int cpp) const +{ + PyObject *py = NULL; + + if (_type) + { + py = sipConvertFromEnum(cpp, _type); + } + else + { + QHashIterator it(_py_enum_types); + + while (it.hasNext()) + { + it.next(); + + if (it.value() == _name) + { + py = PyObject_CallFunction(it.key(), "(i)", cpp); + break; + } + } + } + + return py; +} + + +// Convert a Python object to C++, allocating storage as necessary. +Chimera::Storage *Chimera::fromPyObjectToStorage(PyObject *py) const +{ + Chimera::Storage *st = new Chimera::Storage(this, py); + + if (!st->isValid()) + { + delete st; + st = 0; + } + + return st; +} + + +// Create the storage for a type. +Chimera::Storage *Chimera::storageFactory() const +{ + return new Chimera::Storage(this); +} diff --git a/qpy/QtCore/qpycore_chimera.h b/qpy/QtCore/qpycore_chimera.h new file mode 100644 index 0000000..0f25d3e --- /dev/null +++ b/qpy/QtCore/qpycore_chimera.h @@ -0,0 +1,283 @@ +// This is the interface of the Chimera and related classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_CHIMERA_H +#define _QPYCORE_CHIMERA_H + + +#include + +#include +#include +#include +#include +#include +#include + +#include "sipAPIQtCore.h" + + +// This describes a type that can be understood by Python and C++ (specifically +// Qt's meta-type system). The implementation assumes that the GIL is held. +class Chimera +{ +public: + // Construct a copy. + Chimera(const Chimera &other); + + // Destroy the type. + ~Chimera(); + + // Parses a Python object as a type. Return 0 if there was an error. + static const Chimera *parse(PyObject *obj); + + // Parses a Qt meta-property as a type. Return 0 if there was an error. + static const Chimera *parse(const QMetaProperty &mprop); + + // Parses a C++ type name as a type. Return 0 if there was an error. + static const Chimera *parse(const QByteArray &name); + + // The registered QVariant to PyObject convertors. + typedef bool (*FromQVariantConvertorFn)(const QVariant &, PyObject **); + typedef QList FromQVariantConvertors; + static FromQVariantConvertors registeredFromQVariantConvertors; + + // Register a function for converting a Python object to a QVariant. + typedef bool (*ToQVariantConvertorFn)(PyObject *, QVariant &, bool *); + typedef QList ToQVariantConvertors; + static ToQVariantConvertors registeredToQVariantConvertors; + + // Register a function for converting a Python object to QVariant data. + typedef bool (*ToQVariantDataConvertorFn)(PyObject *, void *, QMetaType, + bool *); + typedef QList ToQVariantDataConvertors; + static ToQVariantDataConvertors registeredToQVariantDataConvertors; + + class Signature + { + public: + // Destroy the signature and any result type objects. + ~Signature(); + + // The list of parsed argument types. + QList parsed_arguments; + + // The optional parsed result type. + const Chimera *result; + + // The original normalised signature (possibly including a method name + // but excluding a return type). + QByteArray signature; + + // The signature as declared by the user for use in exceptions. + QByteArray py_signature; + + // The revision of a slot. Putting this here is an awful hack. + int revision; + + // Return the parsed signature wrapped in a Python object. Ownership + // of the signature is passed to the Python object. Return 0 if there + // was an error. + static PyObject *toPyObject(Signature *parsed_signature); + + // Return the parsed signature extracted from a Python object. + static Signature *fromPyObject(PyObject *py); + + // Return the name from the signature. + QByteArray name() const {return name(signature);} + + // Return the name from a signature. + static QByteArray name(const QByteArray &signature); + + // Return the arguments from the signature. + QByteArray arguments() const {return arguments(signature);} + + // Return the arguments from a signature. + static QByteArray arguments(const QByteArray &signature); + + private: + friend class Chimera; + + // Set if the parsed arguments are cached. + bool _cached; + + Signature(const QByteArray &sig, bool cached) + : result(0), signature(sig), py_signature(sig), _cached(cached) {} + + Signature(const Signature &); + Signature &operator=(const Signature &); + }; + + // Parses a normalised C++ signature. Return 0 if there was an error. + static Signature *parse(const QByteArray &sig, const char *context); + + // Parses a C++ signature given as a Python tuple of types and an optional + // name. Return 0 if there was an error. + static Signature *parse(PyObject *types, const char *name, + const char *context); + + // Raise an exception after parse() has failed. + static void raiseParseException(PyObject *type, const char *context = 0); + + class Storage + { + public: + // Destroy the type and any temporary data. + ~Storage(); + + // Return the parsed type. + const Chimera *type() const {return _parsed_type;} + + // Return the address of the stored value. + void *address(); + + // Convert the stored value to a Python object. + PyObject *toPyObject() const; + + private: + friend class Chimera; + + // The parsed type. + const Chimera *_parsed_type; + + // The storage for fundamental and value types. + QVariant _value_storage; + + // The storage for pointer types. + void *_ptr_storage; + + // The state of any temporary stored data. + int _tmp_state; + + // Set if the value is valid. + bool _valid; + + Storage(const Chimera *ct); + Storage(const Chimera *ct, PyObject *py); + + // Return true if the value is valid. + bool isValid() const {return _valid;} + + // Return true is the value is a pointer type. + bool isPointerType() const; + + Storage(const Storage &); + Storage &operator=(const Storage &); + }; + + // Convert a Python object to C++, allocating storage as necessary. Return + // 0 if there was an error. + Storage *fromPyObjectToStorage(PyObject *py) const; + + // Create a storage instance for this type. + Storage *storageFactory() const; + + // Convert a Python object to C++ at a given address. Return false if + // there was an error. + bool fromPyObject(PyObject *py, void *cpp) const; + + // Convert a Python object to a QVariant. Return false if there was an + // error. + bool fromPyObject(PyObject *py, QVariant *var, bool strict = true) const; + + // Convert a Python object to a QVariant based on the type of the object. + static QVariant fromAnyPyObject(PyObject *py, int *is_err); + + // Convert a QVariant to a Python object. + PyObject *toPyObject(const QVariant &var) const; + + // Convert a C++ object at an arbitary address to a Python object. + PyObject *toPyObject(void *cpp) const; + + // Convert a QVariant to a Python object based on the type of the object. + static PyObject *toAnyPyObject(const QVariant &var); + + // Returns a borrowed reference to the Python type object that was used to + // define the type (if any). + PyObject *py_type() const {return (PyObject *)_py_type;} + + // Returns the C++ name of the type. + const QByteArray &name() const {return _name;} + + // Returns true if the type is a C++ or Python enum or flag. + bool isEnumOrFlag() const; + + // Returns the SIP generated type structure. + const sipTypeDef *typeDef() const {return _type;} + + // Register a type as a Python enum. + static void registerPyEnum(PyObject *enum_type, + const QByteArray &cpp_qualname); + + // The Qt meta-type. + QMetaType metatype; + + // The type identifer. This will be the meta-type identifier or -1 if the + // type is char *. + int typeId() const {return _is_char_star ? -1 : metatype.id();} + +private: + // The generated type structure. This may be 0 if the type is known by Qt + // but hasn't been wrapped. + const sipTypeDef *_type; + + // The Python type object if a Python type (rather than a C++ type string) + // was given. + PyTypeObject *_py_type; + + // Set if the meta-type needn't be exact. + bool _inexact; + + // Set if the the type is derived from QFlags. + bool _is_qflags; + + // The C++ name of the type. + QByteArray _name; + + // Set if the C++ type is char *. This needs special handling. + bool _is_char_star; + + // The registered user-defined enums. + static QHash _py_enum_types; + + // The cache of previously parsed argument type lists. + static QHash > _previously_parsed; + + Chimera(); + + bool parse_cpp_type(const QByteArray &type); + bool parse_py_type(PyTypeObject *type_obj); + sipAssignFunc get_assign_helper() const; + void set_qflags(const sipTypeDef *td); + static bool to_char16_t(PyObject *py, char16_t &cpp); + static bool to_char32_t(PyObject *py, char32_t &cpp); + static void raiseParseCppException(const char *type, + const char *context = 0); + static QVariant keep_as_pyobject(PyObject *py); + static int extract_raw_type(const QByteArray &type, QByteArray &raw_type); + static QByteArray resolve_types(const QByteArray &type); + int get_enum_value(PyObject *py) const; + PyObject *get_enum_key(int cpp) const; + + Chimera &operator=(const Chimera &); +}; + + +#endif diff --git a/qpy/QtCore/qpycore_chimera_signature.cpp b/qpy/QtCore/qpycore_chimera_signature.cpp new file mode 100644 index 0000000..cd1ea6c --- /dev/null +++ b/qpy/QtCore/qpycore_chimera_signature.cpp @@ -0,0 +1,93 @@ +// This is the implementation of the Chimera::Signature class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpycore_chimera.h" + + +// Forward declarations. +extern "C" {static void Signature_delete(PyObject *cap);} + + +// Destroy the signature and any type objects. +Chimera::Signature::~Signature() +{ + if (!_cached) + qDeleteAll(parsed_arguments.constBegin(), parsed_arguments.constEnd()); + + if (result) + delete result; +} + + +// Return the parsed signature wrapped in a Python object. +PyObject *Chimera::Signature::toPyObject(Chimera::Signature *parsed_signature) +{ + PyObject *py = PyCapsule_New(parsed_signature, NULL, Signature_delete); + + if (!py) + delete parsed_signature; + + return py; +} + + +// Return the parsed signature extracted from a Python object. +Chimera::Signature *Chimera::Signature::fromPyObject(PyObject *py) +{ + return reinterpret_cast(PyCapsule_GetPointer(py, NULL)); +} + + +// Return the name from a signature. +QByteArray Chimera::Signature::name(const QByteArray &signature) +{ + QByteArray nm = signature; + int idx = signature.indexOf('('); + + if (idx >= 0) + nm.truncate(idx); + + return nm; +} + + +// Return the arguments from a signature. +QByteArray Chimera::Signature::arguments(const QByteArray &signature) +{ + QByteArray args; + + int oparen = signature.indexOf('('); + int cparen = signature.lastIndexOf(')'); + + if (oparen >= 0 && cparen >= 0) + args = signature.mid(oparen, cparen - oparen + 1); + + return args; +} + + +// The PyCapsule destructor for the Chimera::Signature type. +static void Signature_delete(PyObject *cap) +{ + delete reinterpret_cast( + PyCapsule_GetPointer(cap, NULL)); +} diff --git a/qpy/QtCore/qpycore_chimera_storage.cpp b/qpy/QtCore/qpycore_chimera_storage.cpp new file mode 100644 index 0000000..c68b0b3 --- /dev/null +++ b/qpy/QtCore/qpycore_chimera_storage.cpp @@ -0,0 +1,126 @@ +// This is the implementation of the Chimera::Storage class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpycore_chimera.h" +#include "qpycore_pyqtpyobject.h" + +#include "sipAPIQtCore.h" + + +// Create a new storage instance containing a converted Python object. +Chimera::Storage::Storage(const Chimera *ct, PyObject *py) + : _parsed_type(ct), _ptr_storage(0), _tmp_state(0) +{ + // We convert to a QVariant even for pointer types because this has the + // side-effect of ensuring the object doesn't get garbage collected. + _valid = _parsed_type->fromPyObject(py, &_value_storage); + + if (isPointerType()) + { + int is_err = 0; + + _ptr_storage = sipForceConvertToType(py, _parsed_type->typeDef(), 0, 0, + &_tmp_state, &is_err); + + if (is_err) + { + _value_storage = QVariant(); + _valid = false; + } + } +} + + +// Create a new storage instance. +Chimera::Storage::Storage(const Chimera *ct) + : _parsed_type(ct), _ptr_storage(0), _tmp_state(0), _valid(true) +{ + if (!isPointerType()) + { + // Create a default fundamental or value type. + if (_parsed_type->metatype.id() == QMetaType::Void) + _value_storage = QVariant(); + else + _value_storage = QVariant(_parsed_type->metatype); + } +} + + +// Destroy the storage and any temporary value. +Chimera::Storage::~Storage() +{ + if (_tmp_state) + sipReleaseType(_ptr_storage, _parsed_type->typeDef(), _tmp_state); +} + + +// Return the address of the storage. +void *Chimera::Storage::address() +{ + if (isPointerType()) + { + if (_parsed_type->name().endsWith('*')) + return &_ptr_storage; + + return _ptr_storage; + } + + if (_parsed_type->typeDef() == sipType_QVariant) + return &_value_storage; + + return _value_storage.data(); +} + + +// Return true if the value is a pointer type. +bool Chimera::Storage::isPointerType() const +{ + if (_parsed_type->isEnumOrFlag()) + return false; + + return (_parsed_type->metatype == QMetaType::fromType() && + _parsed_type->typeDef()); +} + + +// Convert the stored value to a Python object. +PyObject *Chimera::Storage::toPyObject() const +{ + // Pointer-class and mapped types are not stored in the QVariant. + if (isPointerType()) + { + if (!_ptr_storage) + { + Py_INCREF(Py_None); + return Py_None; + } + + return sipConvertFromType(_ptr_storage, _parsed_type->typeDef(), 0); + } + + if (_parsed_type->typeDef() == sipType_QVariant) + return Chimera::toAnyPyObject(_value_storage); + + return _parsed_type->toPyObject(_value_storage); +} diff --git a/qpy/QtCore/qpycore_classinfo.cpp b/qpy/QtCore/qpycore_classinfo.cpp new file mode 100644 index 0000000..0e3b267 --- /dev/null +++ b/qpy/QtCore/qpycore_classinfo.cpp @@ -0,0 +1,109 @@ +// This contains the implementation of pyqtClassInfo. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include + +#include "qpycore_api.h" +#include "qpycore_classinfo.h" +#include "qpycore_misc.h" + +#include "sipAPIQtCore.h" + + +// Forward declarations. +extern "C" {static PyObject *decorator(PyObject *self, PyObject *cls);} + + +// The class info name/values keyed by the class type object. +static QMultiHash class_info_hash; + + +// Implement the pyqtClassInfo class decorator. +PyObject *qpycore_pyqtClassInfo(PyObject *args, PyObject *kwds) +{ + // Check there are no positional arguments. + if (PyTuple_Size(args) != 2) + { + PyErr_SetString(PyExc_TypeError, + "PyQt6.QObject.pyqtClassInfo() requires two positional arguments"); + return 0; + } + + // Check there are no keyword arguments. + if (kwds) + { + PyErr_SetString(PyExc_TypeError, + "PyQt6.QObject.pyqtClassInfo() does not support keyword arguments"); + return 0; + } + + // Create the decorator function itself. We stash the arguments in "self". + // This may be an abuse, but it seems to be Ok. + static PyMethodDef deco_method = { + "_deco", decorator, METH_O, 0 + }; + + return PyCFunction_New(&deco_method, args); +} + + +// Return the list on the heap of class info name/values for a class. +QList qpycore_pop_class_info_list(PyObject *cls) +{ + QList all; + + for (;;) + { + ClassInfo class_info = class_info_hash.take(cls); + if (class_info.first.isNull()) + break; + + all.append(class_info); + Py_DECREF(cls); + } + + return all; +} + + +// This is the decorator function that saves the class info for later +// retrieval. +static PyObject *decorator(PyObject *self, PyObject *cls) +{ + // Convert the name. + QByteArray name = qpycore_convert_ASCII(PyTuple_GetItem(self, 0)); + if (name.isNull()) + return 0; + + // Convert the value. + QByteArray value = qpycore_convert_ASCII(PyTuple_GetItem(self, 1)); + if (value.isNull()) + return 0; + + Py_INCREF(cls); + class_info_hash.insert(cls, ClassInfo(name, value)); + + // Return the class. + Py_INCREF(cls); + return cls; +} diff --git a/qpy/QtCore/qpycore_classinfo.h b/qpy/QtCore/qpycore_classinfo.h new file mode 100644 index 0000000..ac9bb3f --- /dev/null +++ b/qpy/QtCore/qpycore_classinfo.h @@ -0,0 +1,31 @@ +// This defines the interfaces to the pyqtClassInfo support. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_CLASSINFO_H +#define _QPYCORE_CLASSINFO_H + + +typedef QPair ClassInfo; + + +QList qpycore_pop_class_info_list(PyObject *cls); + + +#endif diff --git a/qpy/QtCore/qpycore_decorators.cpp b/qpy/QtCore/qpycore_decorators.cpp new file mode 100644 index 0000000..f4b9bc3 --- /dev/null +++ b/qpy/QtCore/qpycore_decorators.cpp @@ -0,0 +1,159 @@ +// This is the implementation of the pyqtSlot decorator. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpycore_api.h" +#include "qpycore_chimera.h" +#include "qpycore_misc.h" +#include "qpycore_objectified_strings.h" + + +// Forward declarations. +extern "C" {static PyObject *decorator(PyObject *self, PyObject *f);} + + +// This implements the pyqtSlot decorator. +PyObject *qpycore_pyqtslot(PyObject *args, PyObject *kwds) +{ + const char *name_str = 0; + PyObject *res_obj = 0; + int revision = 0; + static const char *kwlist[] = {"name", "result", "revision", 0}; + + static PyObject *no_args = 0; + + if (!no_args) + { + no_args = PyTuple_New(0); + + if (!no_args) + return 0; + } + + if (!PyArg_ParseTupleAndKeywords(no_args, kwds, "|sOi:pyqtSlot", + const_cast(kwlist), &name_str, &res_obj, &revision)) + return 0; + + Chimera::Signature *parsed_sig = Chimera::parse(args, name_str, + "a pyqtSlot argument"); + + if (!parsed_sig) + return 0; + + // Sticking the revision here is an awful hack, but it saves creating + // another data structure wrapped in a capsule. + parsed_sig->revision = revision; + + // Parse any result type. + if (res_obj) + { + parsed_sig->result = Chimera::parse(res_obj); + + if (!parsed_sig->result) + { + Chimera::raiseParseException(res_obj, "a pyqtSlot result"); + delete parsed_sig; + return 0; + } + } + + // Wrap the parsed signature in a Python object. + PyObject *sig_obj = Chimera::Signature::toPyObject(parsed_sig); + + if (!sig_obj) + return 0; + + // Create the decorator function itself. We stash the arguments in "self". + // This may be an abuse, but it seems to be Ok. + static PyMethodDef deco_method = { + "_deco", decorator, METH_O, 0 + }; + + PyObject *obj = PyCFunction_New(&deco_method, sig_obj); + Py_DECREF(sig_obj); + + return obj; +} + + +// This is the decorator function that saves the C++ signature as a function +// attribute. +static PyObject *decorator(PyObject *self, PyObject *f) +{ + Chimera::Signature *parsed_sig = Chimera::Signature::fromPyObject(self); + const QByteArray &sig = parsed_sig->signature; + + // Use the function name if there isn't already one. + if (sig.startsWith('(')) + { + // Get the function's name. + PyObject *nobj = PyObject_GetAttr(f, qpycore_dunder_name); + + if (!nobj) + return 0; + + QByteArray ascii = qpycore_convert_ASCII(nobj); + Py_DECREF(nobj); + + if (ascii.isNull()) + return 0; + + parsed_sig->signature.prepend(ascii); + parsed_sig->py_signature.prepend(ascii); + } + + // See if the function has already been decorated. + PyObject *decorations = PyObject_GetAttr(f, qpycore_dunder_pyqtsignature); + int rc; + + if (decorations) + { + // Insert the new decoration at the head of the existing ones so that + // the list order matches the order they appear in the script. + rc = PyList_Insert(decorations, 0, self); + } + else + { + PyErr_Clear(); + + decorations = PyList_New(1); + + if (!decorations) + return 0; + + Py_INCREF(self); + PyList_SetItem(decorations, 0, self); + + // Save the new decoration. + rc = PyObject_SetAttr(f, qpycore_dunder_pyqtsignature, decorations); + } + + Py_DECREF(decorations); + + if (rc < 0) + return 0; + + // Return the function. + Py_INCREF(f); + return f; +} diff --git a/qpy/QtCore/qpycore_enums_flags.cpp b/qpy/QtCore/qpycore_enums_flags.cpp new file mode 100644 index 0000000..5e1d0f1 --- /dev/null +++ b/qpy/QtCore/qpycore_enums_flags.cpp @@ -0,0 +1,253 @@ +// This contains the implementation of pyqtEnum. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpycore_chimera.h" +#include "qpycore_enums_flags.h" +#include "qpycore_misc.h" +#include "qpycore_objectified_strings.h" + +#include "sipAPIQtCore.h" + + +// Forward declarations. +extern "C" {static PyObject *decorator(PyObject *, PyObject *enum_cls);} + + +// Forward declarations. +static bool add_key_value(EnumFlag &enum_flag, PyObject *key, PyObject *value); +static bool objectify(const char *s, PyObject **objp); +static bool parse_members(PyObject *members, EnumFlag &enum_flag); + + +// The enums keyed by the enum type object. +static QHash enums_hash; + + +// Implement the pyqtEnum enum decorator. +PyObject *qpycore_pyqtEnum(PyObject *enum_cls) +{ + if (enum_cls) + return decorator(0, enum_cls); + + // Create the decorator function itself. + static PyMethodDef deco_method = { + "_deco", decorator, METH_O, 0 + }; + + return PyCFunction_New(&deco_method, 0); +} + + +// Return the EnumFlag for an enum class. The name will be null if there was +// none. +EnumFlag qpycore_pop_enum_flag(PyObject *enum_cls) +{ + EnumFlag enum_flag = enums_hash.take(enum_cls); + + if (!enum_flag.name.isNull()) + Py_DECREF(enum_cls); + + return enum_flag; +} + + +// This is the decorator function that saves the parsed enum for later +// retrieval. +static PyObject *decorator(PyObject *, PyObject *enum_cls) +{ + // Check the type. + EnumFlag enum_flag; + + if (sipIsEnumFlag(enum_cls)) + enum_flag.isFlag = true; + else + enum_flag.isFlag = false; + + // Get the name. + PyObject *name = PyObject_GetAttr(enum_cls, qpycore_dunder_name); + if (!name) + return 0; + + enum_flag.name = qpycore_convert_ASCII(name); + Py_DECREF(name); + + if (enum_flag.name.isNull()) + return 0; + + // Get the members. + static PyObject *members_s = 0; + + if (!objectify("__members__", &members_s)) + return 0; + + PyObject *members = PyObject_GetAttr(enum_cls, members_s); + if (!members) + return 0; + + bool ok = parse_members(members, enum_flag); + + Py_DECREF(members); + + if (!ok) + return 0; + + // Get the pseudo fully qualified C++ name. + static PyObject *qualname_s = 0; + + if (!objectify("__qualname__", &qualname_s)) + return 0; + + PyObject *qualname = PyObject_GetAttr(enum_cls, qualname_s); + if (!qualname) + return 0; + + QByteArray cpp_qualname = qpycore_convert_ASCII(qualname); + Py_DECREF(qualname); + + cpp_qualname.replace(QByteArray("."), QByteArray("::")); + + // Register the enum with our type system. + Chimera::registerPyEnum(enum_cls, cpp_qualname); + + // Save the parsed enum for later. + Py_INCREF(enum_cls); + enums_hash.insert(enum_cls, enum_flag); + + // Return the enum class. + Py_INCREF(enum_cls); + return enum_cls; +} + + +// Parse a __members__ mapping. +static bool parse_members(PyObject *members, EnumFlag &enum_flag) +{ + static PyObject *value_s = 0; + + if (!objectify("value", &value_s)) + return false; + + PyObject *items; + Py_ssize_t nr_items; + + // Get the contents of __members__. + items = PyMapping_Items(members); + + if (!items) + goto return_error; + + nr_items = PySequence_Length(items); + if (nr_items < 0) + goto release_items; + + for (Py_ssize_t i = 0; i < nr_items; ++i) + { + PyObject *item, *key, *member, *value; + + item = PySequence_GetItem(items, i); + if (!item) + goto release_items; + + // The item should be a 2-element sequence of the key name and an + // object containing the value. + key = PySequence_GetItem(item, 0); + member = PySequence_GetItem(item, 1); + + Py_DECREF(item); + + if (!key || !member) + { + Py_XDECREF(key); + Py_XDECREF(member); + + goto release_items; + } + + // Get the value. + value = PyObject_GetAttr(member, value_s); + + Py_DECREF(member); + + if (!value) + { + Py_DECREF(key); + + goto release_items; + } + + bool ok = add_key_value(enum_flag, key, value); + + Py_DECREF(key); + Py_DECREF(value); + + if (!ok) + goto release_items; + } + + Py_DECREF(items); + + return true; + +release_items: + Py_DECREF(items); + +return_error: + return false; +} + + +// Add a key/value to an enum/flag. +static bool add_key_value(EnumFlag &enum_flag, PyObject *key, PyObject *value) +{ + PyErr_Clear(); + + int i_value = sipLong_AsInt(value); + + if (PyErr_Occurred()) + return false; + + QByteArray key_ba = qpycore_convert_ASCII(key); + + if (key_ba.isNull()) + return false; + + enum_flag.keys.append(QPair(key_ba, i_value)); + + return true; +} + + +// Convert an ASCII string to a Python object if it hasn't already been done. +static bool objectify(const char *s, PyObject **objp) +{ + if (*objp == NULL) + { + *objp = PyUnicode_FromString(s); + + if (*objp == NULL) + return false; + } + + return true; +} diff --git a/qpy/QtCore/qpycore_enums_flags.h b/qpy/QtCore/qpycore_enums_flags.h new file mode 100644 index 0000000..d0bd61d --- /dev/null +++ b/qpy/QtCore/qpycore_enums_flags.h @@ -0,0 +1,42 @@ +// This defines the interfaces to the pyqtEnum support. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_ENUMS_FLAGS_H +#define _QPYCORE_ENUMS_FLAGS_H + + +#include +#include +#include + + +// Encapsulate the definition of a Python enum as required by QMetaEnum. +struct EnumFlag +{ + QByteArray name; + bool isFlag; + QList > keys; +}; + + +EnumFlag qpycore_pop_enum_flag(PyObject *enum_cls); + + +#endif diff --git a/qpy/QtCore/qpycore_event_handlers.cpp b/qpy/QtCore/qpycore_event_handlers.cpp new file mode 100644 index 0000000..e5c3a19 --- /dev/null +++ b/qpy/QtCore/qpycore_event_handlers.cpp @@ -0,0 +1,123 @@ +// This is the implementation of the event handlers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "qpycore_event_handlers.h" + +#include "sipAPIQtCore.h" + + +// The singleton that monitors the destruction of QObject instances created by +// C++. +PyQtMonitor *PyQtMonitor::instance = SIP_NULLPTR; + +// Set if monitoring is enabled. +bool PyQtMonitor::enabled = true; + + +// Forward declarations. +static void wrapped_instance_eh(void *cpp); +static void collecting_wrapper_eh(sipSimpleWrapper *self); + + +// Register the event handlers. +void qpycore_register_event_handlers() +{ + // Create the monitor. + PyQtMonitor::instance = new PyQtMonitor; + + // Register the handlers. + sipRegisterEventHandler(sipEventWrappedInstance, sipType_QObject, + (void *)wrapped_instance_eh); + sipRegisterEventHandler(sipEventCollectingWrapper, sipType_QObject, + (void *)collecting_wrapper_eh); +} + + +// Invoked when a QObject that is created by C++ is wrapped. +static void wrapped_instance_eh(void *cpp) +{ + if (PyQtMonitor::instance && PyQtMonitor::enabled) + PyQtMonitor::instance->monitor(reinterpret_cast(cpp)); +} + + +// Invoked when the Python wrapper of a QObject is garbage collected. +static void collecting_wrapper_eh(sipSimpleWrapper *self) +{ + if (PyQtMonitor::instance && PyQtMonitor::enabled) + PyQtMonitor::instance->ignore(self); +} + + +// Monitor a C++ created QObject instance. +void PyQtMonitor::monitor(QObject *cppInst) +{ + // Connect the monitor. + monitored.insert(cppInst); + + // Note that the C++ instance may be in the process of being destroyed. + // This will happen if it is the argument to the destroyed() signal. + // Python will have forgotten about the object (even if it was created by + // Python) so by the time it gets wrapped again to be passed to the slot + // it will appear to have been created by C++ and will therefore be subject + // to monitoring. Note that subsequently calling disconnect() would cause + // a crash - this is why we keep a separate record of C++ instances + // currently being monitored and never explicitly disconnect the monitor. + Py_BEGIN_ALLOW_THREADS + connect(cppInst, SIGNAL(destroyed(QObject *)), + SLOT(on_destroyed(QObject *)), Qt::UniqueConnection); + Py_END_ALLOW_THREADS +} + + +// Stop monitoring a C++ created QObject instance. +void PyQtMonitor::ignore(sipSimpleWrapper *pyObj) +{ + void *addr = sipGetAddress(pyObj); + + if (addr) + // Note the reason given above we do not disconnect the monitor. + monitored.remove(reinterpret_cast(addr)); +} + + +// Invoked when a monitored C++ created QObject instance is destroyed. +void PyQtMonitor::on_destroyed(QObject *cppInst) +{ + QSet::iterator it = monitored.find(cppInst); + + // See if we are currently monitoring this instance. + if (it != monitored.end()) + { + monitored.erase(it); + + if (sipGetInterpreter()) + { + SIP_BLOCK_THREADS + + PyObject *pyObj = sipGetPyObject(cppInst, sipType_QObject); + + if (pyObj) + sipInstanceDestroyed((sipSimpleWrapper *)pyObj); + + SIP_UNBLOCK_THREADS + } + } +} diff --git a/qpy/QtCore/qpycore_event_handlers.h b/qpy/QtCore/qpycore_event_handlers.h new file mode 100644 index 0000000..73bed42 --- /dev/null +++ b/qpy/QtCore/qpycore_event_handlers.h @@ -0,0 +1,53 @@ +// This is the definition of the API of the event handlers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_EVENT_HANDLERS_H +#define _QPYCORE_EVENT_HANDLERS_H + + +#include + +#include +#include + + +class PyQtMonitor : public QObject +{ + Q_OBJECT + +public: + void monitor(QObject *cppInst); + void ignore(sipSimpleWrapper *pyObj); + + static PyQtMonitor *instance; + static bool enabled; + +private Q_SLOTS: + void on_destroyed(QObject *); + +private: + QSet monitored; +}; + + +void qpycore_register_event_handlers(); + + +#endif diff --git a/qpy/QtCore/qpycore_init.cpp b/qpy/QtCore/qpycore_init.cpp new file mode 100644 index 0000000..29a50e3 --- /dev/null +++ b/qpy/QtCore/qpycore_init.cpp @@ -0,0 +1,106 @@ +// This is the initialisation support code for the QtCore module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpycore_api.h" +#include "qpycore_public_api.h" +#include "qpycore_pyqtslotproxy.h" +#include "qpycore_qobject_helpers.h" + +#include "sipAPIQtCore.h" + +#include + + +// Set if any QCoreApplication (or sub-class) instance was created from Python. +bool qpycore_created_qapp; + + +// This is called to clean up on exit. It is done in case the QCoreApplication +// dealloc code hasn't been called. +static PyObject *cleanup_on_exit(PyObject *, PyObject *) +{ + pyqt6_cleanup_qobjects(); + + // Never destroy a QCoreApplication if we didn't create it (eg. if we are + // embedded in a C++ application). + if (qpycore_created_qapp) + { + QCoreApplication *app = QCoreApplication::instance(); + + if (app) + { + Py_BEGIN_ALLOW_THREADS + delete app; + Py_END_ALLOW_THREADS + } + } + + Py_INCREF(Py_None); + return Py_None; +} + + +// Perform any required initialisation. +void qpycore_init() +{ + // We haven't created a QCoreApplication instance. + qpycore_created_qapp = false; + + // Export the private helpers, ie. those that should not be used by + // external handwritten code. + sipExportSymbol("qtcore_qt_metaobject", + (void *)qpycore_qobject_metaobject); + sipExportSymbol("qtcore_qt_metacall", (void *)qpycore_qobject_qt_metacall); + sipExportSymbol("qtcore_qt_metacast", (void *)qpycore_qobject_qt_metacast); + sipExportSymbol("qtcore_qobject_sender", + (void *)PyQtSlotProxy::lastSender); + + // Export the public API. + sipExportSymbol("pyqt6_cleanup_qobjects", (void *)pyqt6_cleanup_qobjects); + sipExportSymbol("pyqt6_err_print", (void *)pyqt6_err_print); + sipExportSymbol("pyqt6_from_argv_list", (void *)pyqt6_from_argv_list); + sipExportSymbol("pyqt6_from_qvariant_by_type", + (void *)pyqt6_from_qvariant_by_type); + sipExportSymbol("pyqt6_get_connection_parts", + (void *)pyqt6_get_connection_parts); + sipExportSymbol("pyqt6_get_pyqtsignal_parts", + (void *)pyqt6_get_pyqtsignal_parts); + sipExportSymbol("pyqt6_get_pyqtslot_parts", + (void *)pyqt6_get_pyqtslot_parts); + sipExportSymbol("pyqt6_get_qmetaobject", (void *)pyqt6_get_qmetaobject); + sipExportSymbol("pyqt6_get_signal_signature", + (void *)pyqt6_get_signal_signature); + sipExportSymbol("pyqt6_register_from_qvariant_convertor", + (void *)pyqt6_register_from_qvariant_convertor); + sipExportSymbol("pyqt6_register_to_qvariant_convertor", + (void *)pyqt6_register_to_qvariant_convertor); + sipExportSymbol("pyqt6_register_to_qvariant_data_convertor", + (void *)pyqt6_register_to_qvariant_data_convertor); + sipExportSymbol("pyqt6_update_argv_list", (void *)pyqt6_update_argv_list); + + // Register the cleanup function. + static PyMethodDef cleanup_md = { + "_qtcore_cleanup", cleanup_on_exit, METH_NOARGS, SIP_NULLPTR + }; + + sipRegisterExitNotifier(&cleanup_md); +} diff --git a/qpy/QtCore/qpycore_misc.cpp b/qpy/QtCore/qpycore_misc.cpp new file mode 100644 index 0000000..bf2f64c --- /dev/null +++ b/qpy/QtCore/qpycore_misc.cpp @@ -0,0 +1,72 @@ +// This contains the implementation of various odds and ends. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpycore_api.h" +#include "qpycore_misc.h" + +#include "sipAPIQtCore.h" + + +// Convert a borrowed ASCII string object to a QByteArray. +QByteArray qpycore_convert_ASCII(PyObject *str_obj) +{ + const char *str = sipString_AsASCIIString(&str_obj); + + if (!str) + { + Py_DECREF(str_obj); + return QByteArray(); + } + + QByteArray ba(str); + + Py_DECREF(str_obj); + + return ba; +} + + +// Return true if the given type was wrapped for PyQt. +bool qpycore_is_pyqt_type(const sipTypeDef *td) +{ + return sipCheckPluginForType(td, "PyQt6.QtCore"); +} + + +void qpycore_Unicode_ConcatAndDel(PyObject **string, PyObject *newpart) +{ + PyObject *old = *string; + + if (old) + { + if (newpart) + *string = PyUnicode_Concat(old, newpart); + else + *string = 0; + + Py_DECREF(old); + } + + Py_XDECREF(newpart); +} diff --git a/qpy/QtCore/qpycore_misc.h b/qpy/QtCore/qpycore_misc.h new file mode 100644 index 0000000..a96cef6 --- /dev/null +++ b/qpy/QtCore/qpycore_misc.h @@ -0,0 +1,36 @@ +// This defines the interfaces to various odd and ends. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_MISC_H +#define _QPYCORE_MISC_H + + +#include + +#include + +#include "sipAPIQtCore.h" + + +QByteArray qpycore_convert_ASCII(PyObject *str_obj); +bool qpycore_is_pyqt_type(const sipTypeDef *td); + + +#endif diff --git a/qpy/QtCore/qpycore_namespace.h b/qpy/QtCore/qpycore_namespace.h new file mode 100644 index 0000000..19ee641 --- /dev/null +++ b/qpy/QtCore/qpycore_namespace.h @@ -0,0 +1,35 @@ +// This ensures that the Qt namespace macros are defined irrespective of the +// version of Qt being used. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_NAMESPACE_H +#define _QPYCORE_NAMESPACE_H + + +#include + + +#if !defined(QT_BEGIN_NAMESPACE) +#define QT_BEGIN_NAMESPACE +#define QT_END_NAMESPACE +#endif + + +#endif diff --git a/qpy/QtCore/qpycore_objectified_strings.h b/qpy/QtCore/qpycore_objectified_strings.h new file mode 100644 index 0000000..19e20a7 --- /dev/null +++ b/qpy/QtCore/qpycore_objectified_strings.h @@ -0,0 +1,38 @@ +// This declares a number of objectified string objects. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_OBJECTIFIED_STRINGS_H +#define _QPYCORE_OBJECTIFIED_STRINGS_H + + +#include + + +// __name__ +extern PyObject *qpycore_dunder_name; + +// __mro__ +extern PyObject *qpycore_dunder_mro; + +// __pyqtSignature__ +extern PyObject *qpycore_dunder_pyqtsignature; + + +#endif diff --git a/qpy/QtCore/qpycore_post_init.cpp b/qpy/QtCore/qpycore_post_init.cpp new file mode 100644 index 0000000..81d8e51 --- /dev/null +++ b/qpy/QtCore/qpycore_post_init.cpp @@ -0,0 +1,111 @@ +// This is the post-initialisation support code for the QtCore module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpycore_api.h" +#include "qpycore_event_handlers.h" +#include "qpycore_objectified_strings.h" +#include "qpycore_pyqtboundsignal.h" +#include "qpycore_pyqtmethodproxy.h" +#include "qpycore_pyqtproperty.h" +#include "qpycore_pyqtpyobject.h" +#include "qpycore_pyqtsignal.h" +#include "qpycore_pyqtslotproxy.h" +#include "qpycore_types.h" + +#include "sipAPIQtCore.h" + + +// The objectified strings. +PyObject *qpycore_dunder_name; +PyObject *qpycore_dunder_mro; +PyObject *qpycore_dunder_pyqtsignature; + + +// Perform any required post-initialisation. +void qpycore_post_init(PyObject *module_dict) +{ + // Register the event handlers. + qpycore_register_event_handlers(); + + // Initialise the pyqtProperty type and add it to the module dictionary. + if (!qpycore_pyqtProperty_init_type()) + Py_FatalError("PyQt6.QtCore: Failed to initialise pyqtProperty type"); + + if (PyDict_SetItemString(module_dict, "pyqtProperty", + (PyObject *)qpycore_pyqtProperty_TypeObject) < 0) + Py_FatalError("PyQt6.QtCore: Failed to set pyqtProperty type"); + + // Initialise the pyqtSignal type and add it to the module dictionary. + if (!qpycore_pyqtSignal_init_type()) + Py_FatalError("PyQt6.QtCore: Failed to initialise pyqtSignal type"); + + if (PyDict_SetItemString(module_dict, "pyqtSignal", + (PyObject *)qpycore_pyqtSignal_TypeObject) < 0) + Py_FatalError("PyQt6.QtCore: Failed to set pyqtSignal type"); + + // Initialise the pyqtBoundSignal type and add it to the module dictionary. + if (!qpycore_pyqtBoundSignal_init_type()) + Py_FatalError("PyQt6.QtCore: Failed to initialise pyqtBoundSignal type"); + + if (PyDict_SetItemString(module_dict, "pyqtBoundSignal", + (PyObject *)qpycore_pyqtBoundSignal_TypeObject) < 0) + Py_FatalError("PyQt6.QtCore: Failed to set pyqtBoundSignal type"); + + // Initialise the private pyqtMethodProxy type. + if (!qpycore_pyqtMethodProxy_init_type()) + Py_FatalError("PyQt6.QtCore: Failed to initialise pyqtMethodProxy type"); + + // Register the C++ type that wraps Python objects. + qRegisterMetaType("PyQt_PyObject"); + + // Register the lazy attribute getter. + if (sipRegisterAttributeGetter(sipType_QObject, qpycore_get_lazy_attr) < 0) + Py_FatalError("PyQt6.QtCore: Failed to register attribute getter"); + + // Objectify some strings. + qpycore_dunder_name = PyUnicode_FromString("__name__"); + + if (!qpycore_dunder_name) + Py_FatalError("PyQt6.QtCore: Failed to objectify '__name__'"); + + qpycore_dunder_mro = PyUnicode_FromString("__mro__"); + + if (!qpycore_dunder_mro) + Py_FatalError("PyQt6.QtCore: Failed to objectify '__mro__'"); + + qpycore_dunder_pyqtsignature = PyUnicode_FromString("__pyqtSignature__"); + + if (!qpycore_dunder_pyqtsignature) + Py_FatalError("PyQt6.QtCore: Failed to objectify '__pyqtSignature__'"); + + // Create the mutex that serialises access to the slot proxies. We don't + // use a statically initialised one because Qt needs some things to be + // initialised first (at least for Windows) and this is the only way to + // guarantee things are done in the right order. + PyQtSlotProxy::mutex = new QRecursiveMutex(); + + // Load the embedded qt.conf file if there is a bundled copy of Qt. + if (!qpycore_qt_conf()) + Py_FatalError("PyQt6.QtCore: Unable to embed qt.conf"); +} diff --git a/qpy/QtCore/qpycore_public_api.cpp b/qpy/QtCore/qpycore_public_api.cpp new file mode 100644 index 0000000..cddefca --- /dev/null +++ b/qpy/QtCore/qpycore_public_api.cpp @@ -0,0 +1,449 @@ +// This implements the public API provided by PyQt to external packages. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include + +#include "qpycore_chimera.h" +#include "qpycore_event_handlers.h" +#include "qpycore_objectified_strings.h" +#include "qpycore_public_api.h" +#include "qpycore_pyqtboundsignal.h" +#include "qpycore_pyqtsignal.h" +#include "qpycore_types.h" + +#include +#include + + +// The visitor called for each wrapper to clean up if it is a QObject. +static void cleanup_qobject(sipSimpleWrapper *sw, void *closure) +{ + // Ignore any wrapper for QCoreApplication (or sub-class) instances or that + // have already been destroyed. + void *addr = sipGetAddress(sw); + + if (!addr || addr == closure) + return; + + // Ignore anything not owned by Python. + if (!sipIsOwnedByPython(sw)) + return; + + // Ignore non-QObjects. + if (!PyObject_TypeCheck((PyObject *)sw, sipTypeAsPyTypeObject(sipType_QObject))) + return; + + // Ignore running threads. + if (PyObject_TypeCheck((PyObject *)sw, sipTypeAsPyTypeObject(sipType_QThread))) + { + QThread *thr = reinterpret_cast(addr); + + if (thr->isRunning()) + return; + } + + sipTransferTo((PyObject *)sw, SIP_NULLPTR); + + Py_BEGIN_ALLOW_THREADS + delete reinterpret_cast(addr); + Py_END_ALLOW_THREADS +} + + +// Call the C++ dtors of all QObject instances (except for QCoreApplication +// instances) owned by Python. +void pyqt6_cleanup_qobjects() +{ + // Disable any monitoring. + PyQtMonitor::enabled = false; + + sipVisitWrappers(cleanup_qobject, QCoreApplication::instance()); +} + + +// A replacement for PyErr_Print() that passes the exception to qFatal(). +void pyqt6_err_print() +{ + static bool recursing = false; + + if (recursing) + return; + + recursing = true; + + // Save the exception in case of new exceptions raised here. + PyObject *exception, *value, *traceback; + + PyErr_Fetch(&exception, &value, &traceback); + + // Get the standard exception hook. + static PyObject *original_hook = 0; + + if (!original_hook) + original_hook = PySys_GetObject("__excepthook__"); + + // See if the application has installed its own hook. + PyObject *hook = PySys_GetObject("excepthook"); + + if (hook != original_hook) + { + // This will invoke the application's hook. + PyErr_Restore(exception, value, traceback); + PyErr_Print(); + } + else + { + // Make sure we have the StringIO ctor. + static PyObject *stringio_ctor = 0; + + if (!stringio_ctor) + { + PyObject *io_module = PyImport_ImportModule("io"); + + if (io_module) + { + stringio_ctor = PyObject_GetAttrString(io_module, "StringIO"); + Py_DECREF(io_module); + } + } + + // Create a StringIO object and replace sys.stderr with it. + PyObject *new_stderr = 0, *old_stderr; + + if (stringio_ctor) + { + old_stderr = PySys_GetObject("stderr"); + + if (old_stderr) + { + new_stderr = PyObject_CallObject(stringio_ctor, NULL); + + if (new_stderr) + { + // Make sure the old stderr doesn't get garbage collected + // when it is replaced. + Py_INCREF(old_stderr); + + if (PySys_SetObject("stderr", new_stderr) < 0) + { + Py_DECREF(old_stderr); + Py_DECREF(new_stderr); + new_stderr = 0; + } + } + } + } + + // Restore the exception and print it. + PyErr_Restore(exception, value, traceback); + PyErr_Print(); + + // This will be passed to qFatal() if we can't get the detailed text. + QByteArray message("Unhandled Python exception"); + + // Extract the detailed text if it was redirected. + if (new_stderr) + { + // Restore sys.stderr. + PySys_SetObject("stderr", old_stderr); + Py_DECREF(old_stderr); + + // Extract the text. + PyObject *text = PyObject_CallMethod(new_stderr, "getvalue", NULL); + + if (text) + { + // Strip the text as qFatal() likes to add a newline. + PyObject *stripped = PyObject_CallMethod(text, "strip", NULL); + + if (stripped) + { + Py_DECREF(text); + text = stripped; + } + + // Encode the text using the encoding of the original + // sys.stderr. + PyObject *encoding = PyObject_GetAttrString(old_stderr, + "encoding"); + + if (encoding) + { + PyObject *encoding_bytes = PyUnicode_AsUTF8String( + encoding); + + if (encoding_bytes) + { + Q_ASSERT(PyBytes_Check(encoding_bytes)); + + PyObject *bytes = PyUnicode_AsEncodedString(text, + PyBytes_AsString(encoding_bytes), "strict"); + + if (bytes) + { + Q_ASSERT(PyBytes_Check(bytes)); + + message = QByteArray(PyBytes_AsString(bytes), + PyBytes_Size(bytes)); + + Py_DECREF(bytes); + } + + Py_DECREF(encoding_bytes); + } + + Py_DECREF(encoding); + } + + Py_DECREF(text); + } + + Py_DECREF(new_stderr); + } + + // qFatal() may not call abort. + Py_BEGIN_ALLOW_THREADS + qFatal("%s", message.data()); + Py_END_ALLOW_THREADS + } + + recursing = false; +} + + +// Convert a Python argv list to a conventional C argc count and argv array. +char **pyqt6_from_argv_list(PyObject *argv_list, int &argc) +{ + argc = PyList_Size(argv_list); + + // Allocate space for two copies of the argument pointers, plus the + // terminating NULL. + char **argv = new char *[2 * (argc + 1)]; + + // Convert the list. + for (int a = 0; a < argc; ++a) + { + PyObject *arg_obj = PyList_GetItem(argv_list, a); + char *arg; + + if (PyUnicode_Check(arg_obj)) + { + QByteArray ba_arg = qpycore_PyObject_AsQString(arg_obj).toLocal8Bit(); + arg = qstrdup(ba_arg.constData()); + } + else if (PyBytes_Check(arg_obj)) + { + arg = qstrdup(PyBytes_AsString(arg_obj)); + } + else + { + arg = const_cast("invalid"); + } + + argv[a] = argv[a + argc + 1] = arg; + } + + argv[argc + argc + 1] = argv[argc] = NULL; + + return argv; +} + + +// Get the receiver object and slot signature for a connection. +sipErrorState pyqt6_get_connection_parts(PyObject *slot, QObject *transmitter, + const char *signal_signature, bool single_shot, QObject **receiver, + QByteArray &slot_signature) +{ + static QHash cache; + + QByteArray key(signal_signature); + const Chimera::Signature *parsed_signal_signature = cache.value(key); + + if (!parsed_signal_signature) + { + parsed_signal_signature = Chimera::parse(key, "a signal argument"); + + if (!parsed_signal_signature) + return sipErrorFail; + + cache.insert(key, parsed_signal_signature); + } + + return qpycore_get_receiver_slot_signature(slot, transmitter, + parsed_signal_signature, single_shot, receiver, slot_signature); +} + + + +// Get the transmitter object and signal signature from a bound signal. +sipErrorState pyqt6_get_pyqtsignal_parts(PyObject *signal, + QObject **transmitter, QByteArray &signal_signature) +{ + if (PyObject_TypeCheck(signal, qpycore_pyqtBoundSignal_TypeObject)) + { + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)signal; + + *transmitter = bs->bound_qobject; + signal_signature = bs->unbound_signal->parsed_signature->signature; + + return sipErrorNone; + } + + return sipErrorContinue; +} + + +// Get the receiver object and slot signature from a decorated callable. +sipErrorState pyqt6_get_pyqtslot_parts(PyObject *slot, QObject **receiver, + QByteArray &slot_signature) +{ + PyObject *py_receiver, *decorations; + int is_err; + void *qobj; + Chimera::Signature *sig; + sipMethodDef slot_m; + + // Get the QObject. + if (!sipGetMethod(slot, &slot_m)) + goto bad_callable; + + py_receiver = slot_m.pm_self; + if (!py_receiver) + goto bad_callable; + + is_err = 0; + + qobj = sipForceConvertToType(py_receiver, sipType_QObject, 0, + SIP_NO_CONVERTORS, 0, &is_err); + + if (is_err) + goto bad_callable; + + *receiver = reinterpret_cast(qobj); + + // Get the decoration. + decorations = PyObject_GetAttr(slot, qpycore_dunder_pyqtsignature); + + if (!decorations) + goto bad_callable; + + // Use the first one ignoring any others. + sig = Chimera::Signature::fromPyObject(PyList_GetItem(decorations, 0)); + Py_DECREF(decorations); + + slot_signature = sig->signature; + slot_signature.prepend('1'); + + return sipErrorNone; + +bad_callable: + PyErr_SetString(PyExc_TypeError, + "callable must be a method of a QtCore.QObject instance decorated " + "by QtCore.pyqtSlot"); + + return sipErrorFail; +} + + +// Get the signature string for a bound or unbound signal. +sipErrorState pyqt6_get_signal_signature(PyObject *signal, + const QObject *transmitter, QByteArray &signal_signature) +{ + qpycore_pyqtSignal *ps; + + if (PyObject_TypeCheck(signal, qpycore_pyqtBoundSignal_TypeObject)) + { + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)signal; + + if (transmitter && bs->bound_qobject != transmitter) + { + PyErr_SetString(PyExc_ValueError, + "signal is bound to a different QObject"); + return sipErrorFail; + } + + ps = bs->unbound_signal; + } + else if (PyObject_TypeCheck(signal, qpycore_pyqtSignal_TypeObject)) + { + ps = (qpycore_pyqtSignal *)signal; + } + else + { + return sipErrorContinue; + } + + signal_signature = ps->parsed_signature->signature; + + return sipErrorNone; +} + + +// Register a convertor function that converts a QVariant to a Python object. +void pyqt6_register_from_qvariant_convertor( + bool (*convertor)(const QVariant &, PyObject **)) +{ + Chimera::registeredFromQVariantConvertors.append(convertor); +} + + +// Register a convertor function that converts a Python object to a QVariant. +void pyqt6_register_to_qvariant_convertor( + bool (*convertor)(PyObject *, QVariant &, bool *)) +{ + Chimera::registeredToQVariantConvertors.append(convertor); +} + + +// Register a convertor function that converts a Python object to the +// pre-allocated data of a QVariant with a specific meta-type. +void pyqt6_register_to_qvariant_data_convertor( + bool (*convertor)(PyObject *, void *, QMetaType, bool *)) +{ + Chimera::registeredToQVariantDataConvertors.append(convertor); +} + + +// Remove arguments from the Python argv list that have been removed from the +// C argv array. +void pyqt6_update_argv_list(PyObject *argv_list, int argc, char **argv) +{ + for (int a = 0, na = 0; a < argc; ++a) + { + // See if it was removed. + if (argv[na] == argv[a + argc + 1]) + ++na; + else + PyList_SetSlice(argv_list, na, na + 1, 0); + } + + // Assume that we have created a QCoreApplication instance. + qpycore_created_qapp = true; +} + + +// Get the QMetaObject instance for a Python type. +const QMetaObject *pyqt6_get_qmetaobject(PyTypeObject *type) +{ + return qpycore_get_qmetaobject((sipWrapperType *)type); +} diff --git a/qpy/QtCore/qpycore_public_api.h b/qpy/QtCore/qpycore_public_api.h new file mode 100644 index 0000000..90cf3ac --- /dev/null +++ b/qpy/QtCore/qpycore_public_api.h @@ -0,0 +1,115 @@ +// This defines the public API provided by PyQt to external packages. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_PUBLIC_API_H +#define _QPYCORE_PUBLIC_API_H + + +#include +#include + +#include + +#include "qpycore_namespace.h" + + +QT_BEGIN_NAMESPACE +class QByteArray; +struct QMetaObject; +class QObject; +class QVariant; +QT_END_NAMESPACE + + +// Call the C++ dtors of all QObject instances (except for QCoreApplication +// instances) owned by Python. +void pyqt6_cleanup_qobjects(); + +// A replacement for PyErr_Print(). In PyQt v5.4 it raises a deprecation +// warning and calls PyErr_Print(). In PyQt v5.5 and later it passes the text +// of the exception and traceback to qFatal(). +void pyqt6_err_print(); + +// Convert a Python list to a standard C array of command line arguments and an +// argument count. +char **pyqt6_from_argv_list(PyObject *argv_list, int &argc); + +// Convert a QVariant to a Python object according to an optional Python type. +PyObject *pyqt6_from_qvariant_by_type(QVariant &value, PyObject *type); + +// Get the receiver object and slot signature to allow a signal to be connected +// to an optional transmitter. single_shot is true if the signal will only +// ever be emitted once. Returns the error state. If this is sipErrorFail +// then a Python exception will have been raised. +sipErrorState pyqt6_get_connection_parts(PyObject *slot, QObject *transmitter, + const char *signal_signature, bool single_shot, QObject **receiver, + QByteArray &slot_signature); + +// Get the QMetaObject instance for a Python type. The Python type must be a +// sub-type of QObject's Python type. +const QMetaObject *pyqt6_get_qmetaobject(PyTypeObject *type); + +// Get the transmitter object and signal signature from a bound signal. +// Returns the error state. If this is sipErrorFail then a Python exception +// will have been raised. +sipErrorState pyqt6_get_pyqtsignal_parts(PyObject *signal, + QObject **transmitter, QByteArray &signal_signature); + +// Get the receiver object and slot signature from a callable decorated with +// pyqtSlot. Returns the error state. If this is sipErrorFail then a Python +// exception will have been raised. +sipErrorState pyqt6_get_pyqtslot_parts(PyObject *slot, QObject **receiver, + QByteArray &slot_signature); + +// Get the signature string for a bound or unbound signal. If the signal is +// bound, and the given transmitter is specified, then it must be bound to the +// transmitter. Returns the error state. If this is sipErrorFail then a +// Python exception will have been raised. +sipErrorState pyqt6_get_signal_signature(PyObject *signal, + const QObject *transmitter, QByteArray &signal_signature); + +// Register a convertor function that converts a QVariant to a Python object. +// The convertor will return true if the QVariant was handled, so that no other +// convertor need be tried. If the Python object returned was 0 then there was +// an error and a Python exception raised. +void pyqt6_register_from_qvariant_convertor( + bool (*convertor)(const QVariant &, PyObject **)); + +// Register a convertor function that converts a Python object to a QVariant. +// The convertor will return true if the Python object was handled, so that no +// other convertor need be tried. If the flag set was false then there was an +// error and a Python exception raised. +void pyqt6_register_to_qvariant_convertor( + bool (*convertor)(PyObject *, QVariant &, bool *)); + +// Register a convertor function that converts a Python object to the +// pre-allocated data of a QVariant with a specific meta-type. The convertor +// will return true if the Python object was handled, so that no other +// convertor need be tried. If the flag set was false then there was an error +// and a Python exception raised. +void pyqt6_register_to_qvariant_data_convertor( + bool (*convertor)(PyObject *, void *, QMetaType, bool *)); + +// Update an Python list from a standard C array of command line arguments and +// an argument count. +void pyqt6_update_argv_list(PyObject *argv_list, int argc, char **argv); + + +#endif diff --git a/qpy/QtCore/qpycore_pyqtboundsignal.cpp b/qpy/QtCore/qpycore_pyqtboundsignal.cpp new file mode 100644 index 0000000..a7b5be4 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtboundsignal.cpp @@ -0,0 +1,1011 @@ +// This contains the implementation of the pyqtBoundSignal type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include + +#include "qpycore_api.h" +#include "qpycore_chimera.h" +#include "qpycore_misc.h" +#include "qpycore_objectified_strings.h" +#include "qpycore_pyqtboundsignal.h" +#include "qpycore_pyqtpyobject.h" +#include "qpycore_pyqtsignal.h" +#include "qpycore_pyqtslotproxy.h" + +#include "sipAPIQtCore.h" + + +// The type object. +PyTypeObject *qpycore_pyqtBoundSignal_TypeObject; + + +// Forward declarations. +extern "C" { +static PyObject *pyqtBoundSignal_call(PyObject *self, PyObject *args, + PyObject *kw); +static void pyqtBoundSignal_dealloc(PyObject *self); +static Py_hash_t pyqtBoundSignal_hash(PyObject *self); +static PyObject *pyqtBoundSignal_repr(PyObject *self); +static PyObject *pyqtBoundSignal_richcompare(PyObject *self, PyObject *other, + int op); +static PyObject *pyqtBoundSignal_get_doc(PyObject *self, void *); +static PyObject *pyqtBoundSignal_get_signal(PyObject *self, void *); +static PyObject *pyqtBoundSignal_connect(PyObject *self, PyObject *args, + PyObject *kwd_args); +static PyObject *pyqtBoundSignal_disconnect(PyObject *self, PyObject *args); +static PyObject *pyqtBoundSignal_emit(PyObject *self, PyObject *args); +static PyObject *pyqtBoundSignal_mp_subscript(PyObject *self, + PyObject *subscript); +} + +static PyObject *disconnect(qpycore_pyqtBoundSignal *bs, QObject *qrx, + const char *slot); +static bool do_emit(QObject *qtx, int signal_index, + const Chimera::Signature *parsed_signature, const char *docstring, + PyObject *sigargs); +static bool get_receiver(PyObject *slot, + const Chimera::Signature *signal_signature, QObject **receiver, + QByteArray &slot_signature); +static void slot_signature_from_decorations(QByteArray &slot_signature, + const Chimera::Signature *signal_signature, PyObject *decorations); +static QByteArray slot_signature_from_signal( + const Chimera::Signature *signal_signature, + const QByteArray &slot_name, int nr_args); +static sipErrorState get_receiver_slot_signature(PyObject *slot, + QObject *transmitter, const Chimera::Signature *signal_signature, + bool single_shot, QObject **receiver, QByteArray &slot_signature, + bool unique_connection_check, int no_receiver_check); +static void add_slot_prefix(QByteArray &slot_signature); + + +// Doc-strings. +PyDoc_STRVAR(pyqtBoundSignal_connect_doc, +"connect(slot, type=Qt.AutoConnection, no_receiver_check=False)\n" +"\n" +"slot is either a Python callable or another signal.\n" +"type is a Qt.ConnectionType.\n" +"no_receiver_check is True to disable the check that the receiver's C++\n" +"instance still exists when the signal is emitted.\n"); + +PyDoc_STRVAR(pyqtBoundSignal_disconnect_doc, +"disconnect([slot])\n" +"\n" +"slot is an optional Python callable or another signal. If it is omitted\n" +"then the signal is disconnected from everything it is connected to."); + +PyDoc_STRVAR(pyqtBoundSignal_emit_doc, +"emit(*args)\n" +"\n" +"*args are the values that will be passed as arguments to all connected\n" +"slots."); + +PyDoc_STRVAR(pyqtBoundSignal_signal_doc, +"The signature of the signal that would be returned by SIGNAL()"); + + +// Define the methods. +static PyMethodDef pyqtBoundSignal_methods[] = { + {"connect", (PyCFunction)pyqtBoundSignal_connect, + METH_VARARGS|METH_KEYWORDS, pyqtBoundSignal_connect_doc}, + {"disconnect", pyqtBoundSignal_disconnect, METH_VARARGS, + pyqtBoundSignal_disconnect_doc}, + {"emit", pyqtBoundSignal_emit, METH_VARARGS, pyqtBoundSignal_emit_doc}, + {0, 0, 0, 0} +}; + + +// The getters/setters. +static PyGetSetDef pyqtBoundSignal_getset[] = { + {(char *)"__doc__", pyqtBoundSignal_get_doc, NULL, NULL, NULL}, + {(char *)"signal", pyqtBoundSignal_get_signal, NULL, + (char *)pyqtBoundSignal_signal_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} +}; + + +// Define the slots. +static PyType_Slot qpycore_pyqtBoundSignal_Slots[] = { + {Py_tp_new, (void *)PyType_GenericNew}, + {Py_tp_dealloc, (void *)pyqtBoundSignal_dealloc}, + {Py_tp_repr, (void *)pyqtBoundSignal_repr}, + {Py_tp_richcompare, (void *)pyqtBoundSignal_richcompare}, + {Py_tp_hash, (void *)pyqtBoundSignal_hash}, + {Py_tp_call, (void *)pyqtBoundSignal_call}, + {Py_mp_subscript, (void *)pyqtBoundSignal_mp_subscript}, + {Py_tp_methods, pyqtBoundSignal_methods}, + {Py_tp_getset, pyqtBoundSignal_getset}, + {0, 0} +}; + + +// Define the type. +static PyType_Spec qpycore_pyqtBoundSignal_Spec = { + "PyQt6.QtCore.pyqtBoundSignal", + sizeof (qpycore_pyqtBoundSignal), + 0, + Py_TPFLAGS_DEFAULT, + qpycore_pyqtBoundSignal_Slots +}; + + +// The __doc__ getter. +static PyObject *pyqtBoundSignal_get_doc(PyObject *self, void *) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + const char *docstring = bs->unbound_signal->docstring; + + if (!docstring) + { + Py_INCREF(Py_None); + return Py_None; + } + + if (*docstring == '\1') + ++docstring; + + return PyUnicode_FromString(docstring); +} + + +// The 'signal' getter. +static PyObject *pyqtBoundSignal_get_signal(PyObject *self, void *) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + return PyUnicode_FromString( + bs->unbound_signal->parsed_signature->signature.constData()); +} + + +// The type repr slot. +static PyObject *pyqtBoundSignal_repr(PyObject *self) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + QByteArray name = bs->unbound_signal->parsed_signature->name(); + + return PyUnicode_FromFormat("", + name.constData() + 1, sipPyTypeName(Py_TYPE(bs->bound_pyobject)), + bs->bound_pyobject); +} + + +// The type richcompare slot. +static PyObject *pyqtBoundSignal_richcompare(PyObject *self, PyObject *other, + int op) +{ + if ((op != Py_EQ && op != Py_NE) || !PyObject_TypeCheck(other, qpycore_pyqtBoundSignal_TypeObject)) + { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + qpycore_pyqtBoundSignal *other_bs = (qpycore_pyqtBoundSignal *)other; + + int eq = PyObject_RichCompareBool((PyObject *)(bs->unbound_signal), + (PyObject *)(other_bs->unbound_signal), Py_EQ); + + if (eq == 1) + eq = PyObject_RichCompareBool(bs->bound_pyobject, + other_bs->bound_pyobject, Py_EQ); + + if (eq < 0) + return 0; + + PyObject *res; + + if (op == Py_EQ) + res = eq ? Py_True : Py_False; + else + res = eq ? Py_False : Py_True; + + Py_INCREF(res); + return res; +} + + +// The type hash slot. +static Py_hash_t pyqtBoundSignal_hash(PyObject *self) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + Py_hash_t signal_hash = PyObject_Hash((PyObject *)(bs->unbound_signal)); + if (signal_hash == -1) + return -1; + + Py_hash_t object_hash = PyObject_Hash((PyObject *)(bs->bound_pyobject)); + if (object_hash == -1) + return -1; + + Py_hash_t hash = signal_hash ^ object_hash; + if (hash == -1) + hash = -2; + + return hash; +} + + +// The type call slot. +static PyObject *pyqtBoundSignal_call(PyObject *self, PyObject *args, + PyObject *kw) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + return qpycore_call_signal_overload(bs->unbound_signal, bs->bound_pyobject, + args, kw); +} + + +// The type dealloc slot. +static void pyqtBoundSignal_dealloc(PyObject *self) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + Py_XDECREF((PyObject *)bs->unbound_signal); + + PyObject_Del(self); +} + + +// Initialise the type and return true if there was no error. +bool qpycore_pyqtBoundSignal_init_type() +{ + qpycore_pyqtBoundSignal_TypeObject = (PyTypeObject *)PyType_FromSpec( + &qpycore_pyqtBoundSignal_Spec); + + return qpycore_pyqtBoundSignal_TypeObject; +} + + +// Create a bound signal. +PyObject *qpycore_pyqtBoundSignal_New(qpycore_pyqtSignal *unbound_signal, + PyObject *bound_pyobject, QObject *bound_qobject) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)PyType_GenericNew( + qpycore_pyqtBoundSignal_TypeObject, 0, 0); + + if (bs) + { + Py_INCREF((PyObject *)unbound_signal); + bs->unbound_signal = unbound_signal; + + bs->bound_pyobject = bound_pyobject; + bs->bound_qobject = bound_qobject; + } + + return (PyObject *)bs; +} + + +// The mapping subscript slot. +static PyObject *pyqtBoundSignal_mp_subscript(PyObject *self, + PyObject *subscript) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + qpycore_pyqtSignal *ps = qpycore_find_signal(bs->unbound_signal, subscript, + "a bound signal type argument"); + + if (!ps) + return 0; + + // Create a new bound signal. + return qpycore_pyqtBoundSignal_New(ps, bs->bound_pyobject, + bs->bound_qobject); +} + + +// Connect a signal. +static PyObject *pyqtBoundSignal_connect(PyObject *self, PyObject *args, + PyObject *kwd_args) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + static const char *kwds[] = { + "slot", + "type", + "no_receiver_check", + 0 + }; + + PyObject *py_slot, *py_type = 0; + int no_receiver_check = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwd_args, "O|Op:connect", const_cast(kwds), &py_slot, &py_type, &no_receiver_check)) + return 0; + + Qt::ConnectionType q_type = Qt::AutoConnection; + + if (py_type) + { + int v = sipConvertToEnum(py_type, sipType_Qt_ConnectionType); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "Qt.ConnectionType expected, not '%s'", + sipPyTypeName(Py_TYPE(py_slot))); + + return 0; + } + + q_type = static_cast(v); + } + + QObject *q_tx = bs->bound_qobject, *q_rx; + Chimera::Signature *signal_signature = bs->unbound_signal->parsed_signature; + QByteArray slot_signature; + + sipErrorState estate = get_receiver_slot_signature(py_slot, q_tx, + signal_signature, false, &q_rx, slot_signature, + ((q_type & Qt::UniqueConnection) == Qt::UniqueConnection), + no_receiver_check); + + if (estate != sipErrorNone) + { + if (estate == sipErrorContinue) + sipBadCallableArg(0, py_slot); + + return 0; + } + + // Connect the signal to the slot and handle any errors. + + QMetaObject::Connection connection; + + Py_BEGIN_ALLOW_THREADS + connection = QObject::connect(q_tx, + signal_signature->signature.constData(), q_rx, + slot_signature.constData(), q_type); + Py_END_ALLOW_THREADS + + if (!connection) + { + QByteArray slot_name = Chimera::Signature::name(slot_signature); + + PyErr_Format(PyExc_TypeError, "connect() failed between %s and %s()", + signal_signature->py_signature.constData(), + slot_name.constData() + 1); + + return 0; + } + + // Save the connection in any proxy. + if (qstrcmp(q_rx->metaObject()->className(), "PyQtSlotProxy") == 0) + static_cast(q_rx)->connection = connection; + + return sipConvertFromNewType(new QMetaObject::Connection(connection), + sipType_QMetaObject_Connection, NULL); +} + + +// Get the receiver object and slot signature from a callable or signal. +sipErrorState qpycore_get_receiver_slot_signature(PyObject *slot, + QObject *transmitter, const Chimera::Signature *signal_signature, + bool single_shot, QObject **receiver, QByteArray &slot_signature) +{ + return get_receiver_slot_signature(slot, transmitter, signal_signature, + single_shot, receiver, slot_signature, false, 0); +} + + +// Get the receiver object and slot signature from a callable or signal. +// Optionally disable the receiver check. +static sipErrorState get_receiver_slot_signature(PyObject *slot, + QObject *transmitter, const Chimera::Signature *signal_signature, + bool single_shot, QObject **receiver, QByteArray &slot_signature, + bool unique_connection_check, int no_receiver_check) +{ + // See if the slot is a signal. + if (PyObject_TypeCheck(slot, qpycore_pyqtBoundSignal_TypeObject)) + { + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)slot; + + *receiver = bs->bound_qobject; + slot_signature = bs->unbound_signal->parsed_signature->signature; + + return sipErrorNone; + } + + // Make sure the slot is callable. + if (!PyCallable_Check(slot)) + return sipErrorContinue; + + // See if the slot can be used directly (ie. it wraps a Qt slot) or if it + // needs a proxy. + if (!get_receiver(slot, signal_signature, receiver, slot_signature)) + return sipErrorFail; + + if (slot_signature.isEmpty()) + { + slot_signature = PyQtSlotProxy::proxy_slot_signature; + + // Create a proxy for the slot. + PyQtSlotProxy *proxy; + + if (unique_connection_check) + { + proxy = PyQtSlotProxy::findSlotProxy(transmitter, + signal_signature->signature, slot); + + if (proxy) + { + // We give more information than we could if it was a Qt slot + // but to be consistent we raise a TypeError even though it's + // not the most appropriate for the type of error. + PyErr_SetString(PyExc_TypeError, "connection is not unique"); + return sipErrorFail; + } + } + + Py_BEGIN_ALLOW_THREADS + + proxy = new PyQtSlotProxy(slot, transmitter, signal_signature, + single_shot); + + if (no_receiver_check) + proxy->disableReceiverCheck(); + + if (proxy->metaObject()) + { + if (*receiver) + proxy->moveToThread((*receiver)->thread()); + + *receiver = proxy; + } + else + { + delete proxy; + proxy = 0; + } + + Py_END_ALLOW_THREADS + + if (!proxy) + return sipErrorFail; + } + + return sipErrorNone; +} + + +// Disconnect all of a QObject's signals. +PyObject *qpycore_qobject_disconnect(const QObject *q_obj) +{ + PyObject *res_obj; + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = q_obj->disconnect(); + Py_END_ALLOW_THREADS + + if (ok) + { + res_obj = Py_None; + Py_INCREF(res_obj); + } + else + { + PyErr_SetString(PyExc_TypeError, "disconnect() of all signals failed"); + res_obj = 0; + } + + PyQtSlotProxy::deleteSlotProxies(q_obj, QByteArray()); + + return res_obj; +} + + +// Disconnect a signal. +static PyObject *pyqtBoundSignal_disconnect(PyObject *self, PyObject *args) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + PyObject *py_slot = 0, *res_obj; + Chimera::Signature *signal_signature = bs->unbound_signal->parsed_signature; + + if (!PyArg_ParseTuple(args, "|O:disconnect", &py_slot)) + return 0; + + // See if we are disconnecting everything from the overload. + if (!py_slot) + { + res_obj = disconnect(bs, 0, 0); + + PyQtSlotProxy::deleteSlotProxies(bs->bound_qobject, + signal_signature->signature); + + return res_obj; + } + + // See if the slot is a connection. + if (sipCanConvertToType(py_slot, sipType_QMetaObject_Connection, SIP_NOT_NONE)) + { + int is_error = 0; + QMetaObject::Connection *connection = reinterpret_cast(sipConvertToType(py_slot, sipType_QMetaObject_Connection, NULL, 0, NULL, &is_error)); + + if (is_error) + return 0; + + if (!QObject::disconnect(*connection)) + { + PyErr_SetString(PyExc_TypeError, + "disconnect() of connection failed"); + + return 0; + } + + // Delete any connected slot proxy. + PyQtSlotProxy::deleteSlotProxy(connection); + + Py_INCREF(Py_None); + return Py_None; + } + + // See if the slot is a signal. + if (PyObject_TypeCheck(py_slot, qpycore_pyqtBoundSignal_TypeObject)) + { + qpycore_pyqtBoundSignal *slot_bs = (qpycore_pyqtBoundSignal *)py_slot; + + return disconnect(bs, slot_bs->bound_qobject, + slot_bs->unbound_signal->parsed_signature->signature.constData()); + } + + if (!PyCallable_Check(py_slot)) + { + sipBadCallableArg(0, py_slot); + return 0; + } + + // See if the slot has been used directly (ie. it wraps a Qt slot) or if it + // has a proxy. + QObject *q_rx; + QByteArray slot_signature; + + if (!get_receiver(py_slot, signal_signature, &q_rx, slot_signature)) + return 0; + + if (!slot_signature.isEmpty()) + return disconnect(bs, q_rx, slot_signature.constData()); + + PyQtSlotProxy *proxy = PyQtSlotProxy::findSlotProxy(bs->bound_qobject, + signal_signature->signature, py_slot); + + if (!proxy) + { + PyErr_Format(PyExc_TypeError, "'%s' object is not connected", + sipPyTypeName(Py_TYPE(py_slot))); + + return 0; + } + + res_obj = disconnect(bs, proxy, + PyQtSlotProxy::proxy_slot_signature.constData()); + + proxy->disable(); + + return res_obj; +} + + +// Disonnect a signal from a slot and handle any errors. +static PyObject *disconnect(qpycore_pyqtBoundSignal *bs, QObject *qrx, + const char *slot) +{ + Chimera::Signature *signature = bs->unbound_signal->parsed_signature; + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = QObject::disconnect(bs->bound_qobject, + signature->signature.constData(), qrx, slot); + Py_END_ALLOW_THREADS + + if (!ok) + { + QByteArray tx_name = signature->name(); + + if (slot) + { + QByteArray rx_name = Chimera::Signature::name(slot); + + PyErr_Format(PyExc_TypeError, + "disconnect() failed between '%s' and '%s'", + tx_name.constData() + 1, rx_name.constData() + 1); + } + else + { + PyErr_Format(PyExc_TypeError, + "disconnect() failed between '%s' and all its connections", + tx_name.constData() + 1); + } + + return 0; + } + + Py_INCREF(Py_None); + return Py_None; +} + + +// Emit a signal. +static PyObject *pyqtBoundSignal_emit(PyObject *self, PyObject *args) +{ + qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self; + + if (!bs->bound_qobject->signalsBlocked()) + { + Q_ASSERT(PyTuple_Check(args)); + + qpycore_pyqtSignal *ps = bs->unbound_signal; + + // Use the emitter if there is one. + if (ps->emitter) + { + if (ps->emitter(bs->bound_qobject, args) < 0) + return 0; + } + else + { + Chimera::Signature *signature = ps->parsed_signature; + int mo_index = bs->bound_qobject->metaObject()->indexOfSignal( + signature->signature.constData() + 1); + + if (mo_index < 0) + { + PyErr_Format(PyExc_AttributeError, + "'%s' does not have a signal with the signature %s", + sipPyTypeName(Py_TYPE(bs->bound_pyobject)), + signature->signature.constData() + 1); + return 0; + } + + // Use the docstring if there is one and it is auto-generated. + const char *docstring = bs->unbound_signal->docstring; + + if (!docstring || *docstring != '\1') + { + docstring = signature->py_signature.constData(); + } + else + { + // Skip the auto-generated marker. + ++docstring; + } + + if (!do_emit(bs->bound_qobject, mo_index, signature, docstring, args)) + return 0; + } + } + + Py_INCREF(Py_None); + return Py_None; +} + + +// Emit a signal based on a parsed signature. +static bool do_emit(QObject *qtx, int signal_index, + const Chimera::Signature *parsed_signature, const char *docstring, + PyObject *sigargs) +{ + const QList &args = parsed_signature->parsed_arguments; + + if (args.size() != PyTuple_Size(sigargs)) + { + PyErr_Format(PyExc_TypeError, + "%s signal has %d argument(s) but %d provided", docstring, + args.size(), (int)PyTuple_Size(sigargs)); + + return false; + } + + // Convert the arguments. + QList values; + void **argv = new void *[1 + args.size()]; + + argv[0] = 0; + + QList::const_iterator it = args.constBegin(); + + for (int a = 0; it != args.constEnd(); ++a) + { + PyObject *arg_obj = PyTuple_GetItem(sigargs, a); + Chimera::Storage *val = (*it)->fromPyObjectToStorage(arg_obj); + + if (!val) + { + // Mimic SIP's exception text. + PyErr_Format(PyExc_TypeError, + "%s.emit(): argument %d has unexpected type '%s'", + docstring, a + 1, sipPyTypeName(Py_TYPE(arg_obj))); + + delete[] argv; + qDeleteAll(values.constBegin(), values.constEnd()); + + return false; + } + + argv[1 + a] = val->address(); + values << val; + + ++it; + } + + Py_BEGIN_ALLOW_THREADS + QMetaObject::activate(qtx, signal_index, argv); + Py_END_ALLOW_THREADS + + delete[] argv; + qDeleteAll(values.constBegin(), values.constEnd()); + + return true; +} + + +// Get the receiver QObject from the slot (if there is one) and its signature +// (if it wraps a Qt slot). Return true if there was no error. +static bool get_receiver(PyObject *slot, + const Chimera::Signature *signal_signature, QObject **receiver, + QByteArray &slot_signature) +{ + bool try_qt_slot = false; + PyObject *rx_self = 0; + QByteArray rx_name; + sipMethodDef slot_m; + sipCFunctionDef slot_cf; + + // Assume there isn't a QObject receiver. + *receiver = 0; + + if (sipGetMethod(slot, &slot_m)) + { + rx_self = slot_m.pm_self; + + // The method may be any callable so don't assume it has a __name__. + PyObject *f_name_obj = PyObject_GetAttr(slot_m.pm_function, + qpycore_dunder_name); + if (!f_name_obj) + return false; + + rx_name = qpycore_convert_ASCII(f_name_obj); + Py_DECREF(f_name_obj); + + if (rx_name.isNull()) + return false; + + // See if this has been decorated. + PyObject *decorations = PyObject_GetAttr(slot_m.pm_function, + qpycore_dunder_pyqtsignature); + + if (decorations) + { + // Choose from the decorations. + slot_signature_from_decorations(slot_signature, signal_signature, + decorations); + + Py_DECREF(decorations); + + if (slot_signature.isEmpty()) + { + PyErr_Format(PyExc_TypeError, + "decorated slot has no signature compatible with %s", + signal_signature->py_signature.constData()); + return false; + } + } + + Py_XINCREF(rx_self); + } + else if (sipGetCFunction(slot, &slot_cf)) + { + rx_self = slot_cf.cf_self; + rx_name = slot_cf.cf_function->ml_name; + + // We actually want the C++ name which may (in theory) be completely + // different. However this will cope with the exec_ case which is + // probably good enough. + if (rx_name.endsWith('_')) + rx_name.chop(1); + + try_qt_slot = true; + + Py_XINCREF(rx_self); + } + else + { + static PyObject *partial = 0; + + // Get the functools.partial type object if we haven't already got it. + if (!partial) + { + PyObject *functools = PyImport_ImportModule("functools"); + + if (functools) + { + partial = PyObject_GetAttrString(functools, "partial"); + Py_DECREF(functools); + } + } + + // If we know about functools.partial then remove the outer partials to + // get to the original function. + if (partial && PyObject_IsInstance(slot, partial) > 0) + { + PyObject *func = slot; + sipMethodDef func_m; + sipCFunctionDef func_cf; + + Py_INCREF(func); + + do + { + PyObject *subfunc = PyObject_GetAttrString(func, "func"); + + Py_DECREF(func); + + // This should never happen. + if (!subfunc) + return false; + + func = subfunc; + } + while (PyObject_IsInstance(func, partial) > 0); + + if (sipGetMethod(func, &func_m)) + rx_self = func_m.pm_self; + else if (sipGetCFunction(func, &func_cf)) + rx_self = func_cf.cf_self; + + Py_XINCREF(rx_self); + Py_DECREF(func); + } + } + + if (!rx_self) + return true; + + int iserr = 0; + void *rx = sipForceConvertToType(rx_self, sipType_QObject, 0, + SIP_NO_CONVERTORS, 0, &iserr); + + Py_DECREF(rx_self); + + PyErr_Clear(); + + if (iserr) + return true; + + *receiver = reinterpret_cast(rx); + + // If there might be a Qt slot that can handle the arguments (or a subset + // of them) then use it. Otherwise we will fallback to using a proxy. + if (try_qt_slot) + { + const QMetaObject *mo = (*receiver)->metaObject(); + + for (int ol = signal_signature->parsed_arguments.count(); ol >= 0; --ol) + { + slot_signature = slot_signature_from_signal(signal_signature, + rx_name, ol); + + if (mo->indexOfSlot(slot_signature.constData()) >= 0) + { + add_slot_prefix(slot_signature); + break; + } + + slot_signature.clear(); + } + } + + return true; +} + + +// Return the full name and signature of a Qt slot that a signal can be +// connected to, taking the slot decorators into account. +static void slot_signature_from_decorations(QByteArray &slot_signature, + const Chimera::Signature *signal, PyObject *decorations) +{ + Chimera::Signature *candidate = 0; + int signal_nr_args = signal->parsed_arguments.count(); + + for (Py_ssize_t i = 0; i < PyList_Size(decorations); ++i) + { + Chimera::Signature *slot = Chimera::Signature::fromPyObject( + PyList_GetItem(decorations, i)); + + int slot_nr_args = slot->parsed_arguments.count(); + + // Ignore the slot if it requires more arguments than the signal will + // provide. + if (slot_nr_args > signal_nr_args) + continue; + + // Ignore the slot if any current candidate will accept more arguments. + if (candidate && candidate->parsed_arguments.count() >= slot_nr_args) + continue; + + for (int a = 0; a < slot_nr_args; ++a) + { + const Chimera *sig_arg = signal->parsed_arguments.at(a); + const Chimera *slot_arg = slot->parsed_arguments.at(a); + + // In the first instance we compare meta-types (which deals with + // typedefed types). However this can be unreliable as the + // signal's type may have been registered by Qt internally (and so + // given a new meta-type) after the slot was defined (and has the + // meta-type of PyQt_PyObject) so we also compare the C++ names. + if (sig_arg->metatype != slot_arg->metatype && + sig_arg->name() != slot_arg->name()) + { + slot = 0; + break; + } + } + + // If all of the slot's arguments were Ok then this will be the best + // candidate so far. + if (slot) + candidate = slot; + } + + if (candidate) + { + slot_signature = candidate->signature; + add_slot_prefix(slot_signature); + } +} + + +// Return the full name and signature of the Qt slot that a signal would be +// connected to. +static QByteArray slot_signature_from_signal( + const Chimera::Signature *signal_signature, + const QByteArray &slot_name, int nr_args) +{ + QByteArray slot_sig = slot_name; + + slot_sig.append('('); + + for (int a = 0; a < nr_args; ++a) + { + if (a != 0) + slot_sig.append(','); + + slot_sig.append(signal_signature->parsed_arguments.at(a)->name()); + } + + slot_sig.append(')'); + + return slot_sig; +} + + +// Add the prefix to a signaturethat tells Qt it is a slot. +static void add_slot_prefix(QByteArray &slot_signature) +{ + slot_signature.prepend('1'); +} diff --git a/qpy/QtCore/qpycore_pyqtboundsignal.h b/qpy/QtCore/qpycore_pyqtboundsignal.h new file mode 100644 index 0000000..3bddf8e --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtboundsignal.h @@ -0,0 +1,69 @@ +// This defines the interfaces for the pyqtBoundSignal type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_PYQTBOUNDSIGNAL_H +#define _QPYCORE_PYQTBOUNDSIGNAL_H + + +#include +#include + +#include "qpycore_pyqtsignal.h" +#include "qpycore_namespace.h" + + +QT_BEGIN_NAMESPACE +class QByteArray; +class QObject; +QT_END_NAMESPACE + + +extern "C" { + +// This defines the structure of a bound PyQt signal. +typedef struct { + PyObject_HEAD + + // The unbound signal. + qpycore_pyqtSignal *unbound_signal; + + // A borrowed reference to the wrapped QObject that is bound to the signal. + PyObject *bound_pyobject; + + // The QObject that is bound to the signal. + QObject *bound_qobject; +} qpycore_pyqtBoundSignal; + +} + + +// The type object. +extern PyTypeObject *qpycore_pyqtBoundSignal_TypeObject; + + +bool qpycore_pyqtBoundSignal_init_type(); +PyObject *qpycore_pyqtBoundSignal_New(qpycore_pyqtSignal *unbound_signal, + PyObject *bound_pyobject, QObject *bound_qobject); +sipErrorState qpycore_get_receiver_slot_signature(PyObject *slot, + QObject *transmitter, const Chimera::Signature *signal_signature, + bool single_shot, QObject **receiver, QByteArray &slot_signature); + + +#endif diff --git a/qpy/QtCore/qpycore_pyqtconfigure.cpp b/qpy/QtCore/qpycore_pyqtconfigure.cpp new file mode 100644 index 0000000..665efc1 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtconfigure.cpp @@ -0,0 +1,239 @@ +// This implements the helper for QObject.pyqtConfigure(). +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include + +#include "qpycore_api.h" +#include "qpycore_chimera.h" +#include "qpycore_misc.h" +#include "qpycore_pyqtboundsignal.h" + +#include "sipAPIQtCore.h" + + +// The result of handling a keyword argument. +enum ArgStatus +{ + AsError, + AsHandled, + AsUnknown +}; + + +static ArgStatus handle_argument(PyObject *self, QObject *qobj, + PyObject *name_obj, PyObject *value_obj); + + +// This is the helper for QObject.pyqtConfigure(). +PyObject *qpycore_pyqtconfigure(PyObject *self, PyObject *args, PyObject *kwds) +{ + // Check there are no positional arguments. + if (PyTuple_Size(args) > 0) + { + PyErr_SetString(PyExc_TypeError, + "QObject.pyqtConfigure() has no positional arguments"); + return 0; + } + + // Get the QObject self. + QObject *qobj = reinterpret_cast( + sipGetCppPtr((sipSimpleWrapper *)self, sipType_QObject)); + + if (!qobj) + return 0; + + PyObject *name_obj, *value_obj; + Py_ssize_t pos = 0; + + while (PyDict_Next(kwds, &pos, &name_obj, &value_obj)) + { + ArgStatus as = handle_argument(self, qobj, name_obj, value_obj); + + if (as == AsError) + return 0; + + if (as == AsUnknown) + { + PyErr_Format(PyExc_AttributeError, + "'%S' is not the name of a Qt property or signal", + name_obj); + + return 0; + } + } + + Py_INCREF(Py_None); + return Py_None; +} + + +// This is the helper for the QObject %FinalisationCode. +int qpycore_qobject_finalisation(PyObject *self, QObject *qobj, PyObject *kwds, + PyObject **updated_kwds) +{ + // This will ensure that the type's QMetaObject has been constructed. + qobj->metaObject(); + + // Handle the trivial case. + if (!kwds) + return 0; + + // The dict we will be removing handled arguments from, 0 if it needs to be + // created. + PyObject *unused = (updated_kwds ? 0 : kwds); + + PyObject *name_obj, *value_obj; + Py_ssize_t pos = 0; + + while (PyDict_Next(kwds, &pos, &name_obj, &value_obj)) + { + ArgStatus as = handle_argument(self, qobj, name_obj, value_obj); + + if (as == AsError) + return -1; + + if (as == AsHandled) + { + if (!unused) + { + unused = PyDict_Copy(kwds); + + if (!unused) + return -1; + + *updated_kwds = unused; + } + + if (PyDict_DelItem(unused, name_obj) < 0) + { + if (updated_kwds) + Py_DECREF(unused); + + return -1; + } + } + } + + return 0; +} + + +// Handle a single keyword argument. +static ArgStatus handle_argument(PyObject *self, QObject *qobj, + PyObject *name_obj, PyObject *value_obj) +{ + const QMetaObject *mo = qobj->metaObject(); + + // Get the name encoded name. + QByteArray enc_name = qpycore_convert_ASCII(name_obj); + + if (enc_name.isNull()) + return AsError; + + // See if it is a property. + int idx = mo->indexOfProperty(enc_name.constData()); + + if (idx >= 0) + { + QMetaProperty prop = mo->property(idx); + + // A negative type means a QVariant property. + if (prop.userType() >= 0) + { + bool ok; + QVariant value = qpycore_PyObject_AsQVariant(prop, value_obj, &ok); + + if (!ok) + return AsError; + + qobj->setProperty(enc_name.constData(), value); + } + else + { + int value_state, iserr = 0; + + QVariant *value = reinterpret_cast( + sipForceConvertToType(value_obj, sipType_QVariant, 0, + SIP_NOT_NONE, &value_state, &iserr)); + + if (iserr) + return AsError; + + qobj->setProperty(enc_name.constData(), *value); + + sipReleaseType(value, sipType_QVariant, value_state); + } + } + else + { + bool unknown = true; + + // See if it is a signal. + PyObject *sig = PyObject_GetAttr(self, name_obj); + + if (sig) + { + if (PyObject_TypeCheck(sig, qpycore_pyqtBoundSignal_TypeObject)) + { + static PyObject *connect_obj = NULL; + + if (!connect_obj) + { + connect_obj = PyUnicode_FromString("connect"); + + if (!connect_obj) + { + Py_DECREF(sig); + return AsError; + } + } + + // Connect the slot. + PyObject *res = PyObject_CallMethodObjArgs(sig, connect_obj, + value_obj, 0); + + if (!res) + { + Py_DECREF(sig); + return AsError; + } + + Py_DECREF(res); + + unknown = false; + } + + Py_DECREF(sig); + } + + if (unknown) + { + PyErr_Clear(); + return AsUnknown; + } + } + + return AsHandled; +} diff --git a/qpy/QtCore/qpycore_pyqtmethodproxy.cpp b/qpy/QtCore/qpycore_pyqtmethodproxy.cpp new file mode 100644 index 0000000..e0dce9d --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtmethodproxy.cpp @@ -0,0 +1,266 @@ +// This contains the implementation of the pyqtMethodProxy type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include +#include +#include +#include + +#include "qpycore_chimera.h" +#include "qpycore_pyqtmethodproxy.h" + + +// The type object. +PyTypeObject *qpycore_pyqtMethodProxy_TypeObject; + + +// Forward declarations. +extern "C" { +static PyObject *pyqtMethodProxy_call(PyObject *self, PyObject *args, + PyObject *kw_args); +static void pyqtMethodProxy_dealloc(PyObject *self); +} + +static void parse_arg(PyObject *args, int arg_nr, + const QList &types, QGenericArgument &arg, + Chimera::Storage **storage, bool &failed, const char *py_name); + + +// Define the slots. +static PyType_Slot qpycore_pyqtMethodProxy_Slots[] = { + {Py_tp_new, (void *)PyType_GenericNew}, + {Py_tp_dealloc, (void *)pyqtMethodProxy_dealloc}, + {Py_tp_call, (void *)pyqtMethodProxy_call}, + {0, 0} +}; + + +// Define the type. +static PyType_Spec qpycore_pyqtMethodProxy_Spec = { + "PyQt6.QtCore.pyqtMethodProxy", + sizeof (qpycore_pyqtMethodProxy), + 0, + Py_TPFLAGS_DEFAULT, + qpycore_pyqtMethodProxy_Slots +}; + + +// The type dealloc slot. +static void pyqtMethodProxy_dealloc(PyObject *self) +{ + qpycore_pyqtMethodProxy *mp = (qpycore_pyqtMethodProxy *)self; + + delete mp->py_name; + + PyObject_Del(self); +} + + +// The type call slot. +static PyObject *pyqtMethodProxy_call(PyObject *self, PyObject *args, + PyObject *kw_args) +{ + qpycore_pyqtMethodProxy *mp = (qpycore_pyqtMethodProxy *)self; + + const char *py_name = mp->py_name->constData(); + + // Check for keyword arguments. + if (kw_args) + { + PyErr_Format(PyExc_TypeError, + "%s() does not support keyword arguments", py_name); + return 0; + } + + QMetaMethod method = mp->qobject->metaObject()->method(mp->method_index); + QList arg_types = method.parameterTypes(); + + if (PyTuple_Size(args) != arg_types.size()) + { + PyErr_Format(PyExc_TypeError, + "%s() called with %zd arguments but %d expected", + py_name, PyTuple_Size(args), arg_types.size()); + return 0; + } + + // Parse the return type and the arguments. + QGenericReturnArgument ret; + QGenericArgument a0, a1, a2, a3, a4, a5, a6, a7, a8, a9; + Chimera::Storage *return_storage, *storage[10]; + QByteArray return_type(method.typeName()); + bool failed = false; + + return_storage = 0; + + if (!return_type.isEmpty()) + { + const Chimera *ct = Chimera::parse(return_type); + + if (!ct) + { + PyErr_Format(PyExc_TypeError, + "unable to convert return value of %s from '%s' to a Python object", + py_name, return_type.constData()); + return 0; + } + + return_storage = ct->storageFactory(); + + ret = QGenericReturnArgument(return_type.constData(), + return_storage->address()); + } + + parse_arg(args, 0, arg_types, a0, storage, failed, py_name); + parse_arg(args, 1, arg_types, a1, storage, failed, py_name); + parse_arg(args, 2, arg_types, a2, storage, failed, py_name); + parse_arg(args, 3, arg_types, a3, storage, failed, py_name); + parse_arg(args, 4, arg_types, a4, storage, failed, py_name); + parse_arg(args, 5, arg_types, a5, storage, failed, py_name); + parse_arg(args, 6, arg_types, a6, storage, failed, py_name); + parse_arg(args, 7, arg_types, a7, storage, failed, py_name); + parse_arg(args, 8, arg_types, a8, storage, failed, py_name); + parse_arg(args, 9, arg_types, a9, storage, failed, py_name); + + // Invoke the method. + PyObject *result = 0; + + if (!failed) + { + Py_BEGIN_ALLOW_THREADS + failed = !method.invoke(mp->qobject, Qt::DirectConnection, ret, a0, a1, + a2, a3, a4, a5, a6, a7, a8, a9); + Py_END_ALLOW_THREADS + + if (failed) + { + PyErr_Format(PyExc_TypeError, "invocation of %s() failed", py_name); + } + else if (return_storage) + { + result = return_storage->toPyObject(); + } + else + { + result = Py_None; + Py_INCREF(result); + } + } + + // Release any storage. + if (return_storage) + { + delete return_storage->type(); + delete return_storage; + } + + for (int i = 0; i < 10; ++i) + { + Chimera::Storage *st = storage[i]; + + if (st) + { + delete st->type(); + delete st; + } + } + + return result; +} + + +// Convert a Python object to a QGenericArgument. +static void parse_arg(PyObject *args, int arg_nr, + const QList &types, QGenericArgument &arg, + Chimera::Storage **storage, bool &failed, const char *py_name) +{ + // Initialise so that we can safely release later. + storage[arg_nr] = 0; + + // If we have already failed then there is nothing to do. + if (failed) + return; + + // If we have run out of arguments then there is nothing to do. + if (arg_nr >= types.size()) + return; + + PyObject *py_arg = PyTuple_GetItem(args, arg_nr); + const QByteArray &cpp_type = types.at(arg_nr); + + const Chimera *ct = Chimera::parse(cpp_type); + Chimera::Storage *st; + + if (ct) + st = ct->fromPyObjectToStorage(py_arg); + else + st = 0; + + if (!st) + { + if (ct) + delete ct; + + PyErr_Format(PyExc_TypeError, + "unable to convert argument %d of %s from '%s' to '%s'", + arg_nr, py_name, sipPyTypeName(Py_TYPE(py_arg)), + cpp_type.constData()); + + failed = true; + return; + } + + storage[arg_nr] = st; + + arg = QGenericArgument(cpp_type.constData(), st->address()); +} + + +// Initialise the type and return true if there was no error. +bool qpycore_pyqtMethodProxy_init_type() +{ + qpycore_pyqtMethodProxy_TypeObject = (PyTypeObject *)PyType_FromSpec( + &qpycore_pyqtMethodProxy_Spec); + + return qpycore_pyqtMethodProxy_TypeObject; +} + + +// Create a proxy for a bound introspected method. +PyObject *qpycore_pyqtMethodProxy_New(QObject *qobject, int method_index, + const QByteArray &py_name) +{ + qpycore_pyqtMethodProxy *mp; + + mp = (qpycore_pyqtMethodProxy *)PyType_GenericAlloc( + qpycore_pyqtMethodProxy_TypeObject, 0); + + if (!mp) + return 0; + + mp->qobject = qobject; + mp->method_index = method_index; + mp->py_name = new QByteArray(py_name); + + return (PyObject *)mp; +} diff --git a/qpy/QtCore/qpycore_pyqtmethodproxy.h b/qpy/QtCore/qpycore_pyqtmethodproxy.h new file mode 100644 index 0000000..02b7b81 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtmethodproxy.h @@ -0,0 +1,67 @@ +// This defines the interfaces for the pyqtMethodProxy type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_PYQTMETHODPROXY_H +#define _QPYCORE_PYQTMETHODPROXY_H + + +#include + +#include +#include + +#include "qpycore_namespace.h" + + +QT_BEGIN_NAMESPACE +class QObject; +QT_END_NAMESPACE + + +extern "C" { + +// This defines the structure of a pyqtMethodProxy object. +typedef struct _qpycore_pyqtMethodProxy { + PyObject_HEAD + + // The QObject whose method being proxied. + QObject *qobject; + + // The method index in the QObject's meta-object. + int method_index; + + // The fully qualified Python name of the method. + const QByteArray *py_name; +} qpycore_pyqtMethodProxy; + +} + + +// The type object. +extern PyTypeObject *qpycore_pyqtMethodProxy_TypeObject; + + +bool qpycore_pyqtMethodProxy_init_type(); + +PyObject *qpycore_pyqtMethodProxy_New(QObject *qobject, int method_index, + const QByteArray &py_name); + + +#endif diff --git a/qpy/QtCore/qpycore_pyqtmutexlocker.cpp b/qpy/QtCore/qpycore_pyqtmutexlocker.cpp new file mode 100644 index 0000000..65a709c --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtmutexlocker.cpp @@ -0,0 +1,86 @@ +// This is the implementation of the PyQtMutexLocker class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpycore_pyqtmutexlocker.h" + + +// Create a locker for a QMutex. +PyQtMutexLocker::PyQtMutexLocker(QMutex *mutex, PyObject *wrapper) : + _wrapper(wrapper), _r_locker(nullptr) +{ + Py_INCREF(_wrapper); + + _locker = new QMutexLocker(mutex); +} + + +// Create a locker for a QRecursiveMutex. +PyQtMutexLocker::PyQtMutexLocker(QRecursiveMutex *mutex, PyObject *wrapper) : + _wrapper(wrapper), _locker(nullptr) +{ + Py_INCREF(_wrapper); + + _r_locker = new QMutexLocker(mutex); +} + + +// Destroy the locker. +PyQtMutexLocker::~PyQtMutexLocker() +{ + if (_locker) + delete _locker; + else + delete _r_locker; + + Py_DECREF(_wrapper); +} + + +// Return the Python object that wraps the mutex. +PyObject *PyQtMutexLocker::mutex() +{ + Py_INCREF(_wrapper); + + return _wrapper; +} + + +// Explicitly unlock the mutex. +void PyQtMutexLocker::unlock() +{ + if (_locker) + _locker->unlock(); + else + _r_locker->unlock(); +} + + +// Explicitly relock the mutex. +void PyQtMutexLocker::relock() +{ + if (_locker) + _locker->relock(); + else + _r_locker->relock(); +} diff --git a/qpy/QtCore/qpycore_pyqtmutexlocker.h b/qpy/QtCore/qpycore_pyqtmutexlocker.h new file mode 100644 index 0000000..9618d59 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtmutexlocker.h @@ -0,0 +1,45 @@ +// This is the declaration of the PyQtMutexLocker class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + + +// This class implements the Qt5 QMutexLocker on top of the Qt6 template-based +// version. +class PyQtMutexLocker +{ +public: + PyQtMutexLocker(QMutex *mutex, PyObject *wrapper); + PyQtMutexLocker(QRecursiveMutex *mutex, PyObject *wrapper); + ~PyQtMutexLocker(); + + PyObject *mutex(); + void unlock(); + void relock(); + +private: + PyObject *_wrapper; + QMutexLocker *_locker; + QMutexLocker *_r_locker; + + PyQtMutexLocker(const PyQtMutexLocker &); +}; diff --git a/qpy/QtCore/qpycore_pyqtproperty.cpp b/qpy/QtCore/qpycore_pyqtproperty.cpp new file mode 100644 index 0000000..0d784e7 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtproperty.cpp @@ -0,0 +1,582 @@ +// This is the implementation of pyqtProperty. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include +#include + +#include "qpycore_chimera.h" +#include "qpycore_pyqtproperty.h" +#include "qpycore_pyqtsignal.h" + + +// The type object. +PyTypeObject *qpycore_pyqtProperty_TypeObject; + + +// Forward declarations. +extern "C" { +static PyObject *pyqtProperty_getter(PyObject *self, PyObject *getter); +static PyObject *pyqtProperty_setter(PyObject *self, PyObject *setter); +static PyObject *pyqtProperty_deleter(PyObject *self, PyObject *deleter); +static PyObject *pyqtProperty_reset(PyObject *self, PyObject *reset); +static PyObject *pyqtProperty_descr_get(PyObject *self, PyObject *obj, + PyObject *); +static int pyqtProperty_descr_set(PyObject *self, PyObject *obj, + PyObject *value); +static PyObject *pyqtProperty_call(PyObject *self, PyObject *args, + PyObject *kwds); +static void pyqtProperty_dealloc(PyObject *self); +static int pyqtProperty_init(PyObject *self, PyObject *args, PyObject *kwds); +static int pyqtProperty_traverse(PyObject *self, visitproc visit, void *arg); +} + +static qpycore_pyqtProperty *clone(qpycore_pyqtProperty *orig); +static PyObject *getter_docstring(PyObject *getter); + + +// Doc-strings. +PyDoc_STRVAR(pyqtProperty_doc, +"pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,\n" +" designable=True, scriptable=True, stored=True, user=False,\n" +" constant=False, final=False, notify=None,\n" +" revision=0) -> property attribute\n" +"\n" +"type is the type of the property. It is either a type object or a string\n" +"that is the name of a C++ type.\n" +"freset is a function for resetting an attribute to its default value.\n" +"designable sets the DESIGNABLE flag (the default is True for writable\n" +"properties and False otherwise).\n" +"scriptable sets the SCRIPTABLE flag.\n" +"stored sets the STORED flag.\n" +"user sets the USER flag.\n" +"constant sets the CONSTANT flag.\n" +"final sets the FINAL flag.\n" +"notify is the NOTIFY signal.\n" +"revision is the REVISION.\n" +"The other parameters are the same as those required by the standard Python\n" +"property type. Properties defined using pyqtProperty behave as both Python\n" +"and Qt properties." +"\n" +"Decorators can be used to define new properties or to modify existing ones."); + +PyDoc_STRVAR(getter_doc, "Descriptor to change the getter on a property."); +PyDoc_STRVAR(setter_doc, "Descriptor to change the setter on a property."); +PyDoc_STRVAR(deleter_doc, "Descriptor to change the deleter on a property."); +PyDoc_STRVAR(reset_doc, "Descriptor to change the reset on a property."); + + +// Define the attributes. +static PyMemberDef pyqtProperty_members[] = { + {const_cast("type"), T_OBJECT, + offsetof(qpycore_pyqtProperty, pyqtprop_type), READONLY, 0}, + {const_cast("fget"), T_OBJECT, + offsetof(qpycore_pyqtProperty, pyqtprop_get), READONLY, 0}, + {const_cast("fset"), T_OBJECT, + offsetof(qpycore_pyqtProperty, pyqtprop_set), READONLY, 0}, + {const_cast("fdel"), T_OBJECT, + offsetof(qpycore_pyqtProperty, pyqtprop_del), READONLY, 0}, + {const_cast("freset"), T_OBJECT, + offsetof(qpycore_pyqtProperty, pyqtprop_reset), READONLY, 0}, + {const_cast("__doc__"), T_OBJECT, + offsetof(qpycore_pyqtProperty, pyqtprop_doc), READONLY, 0}, + {0, 0, 0, 0, 0} +}; + + +// Define the methods. +static PyMethodDef pyqtProperty_methods[] = { + {"getter", pyqtProperty_getter, METH_O, getter_doc}, + {"read", pyqtProperty_getter, METH_O, getter_doc}, + {"setter", pyqtProperty_setter, METH_O, setter_doc}, + {"write", pyqtProperty_setter, METH_O, setter_doc}, + {"deleter", pyqtProperty_deleter, METH_O, deleter_doc}, + {"reset", pyqtProperty_reset, METH_O, reset_doc}, + {0, 0, 0, 0} +}; + + +// Define the slots. +static PyType_Slot qpycore_pyqtProperty_Slots[] = { + {Py_tp_new, (void *)PyType_GenericNew}, + {Py_tp_alloc, (void *)PyType_GenericAlloc}, + {Py_tp_init, (void *)pyqtProperty_init}, + {Py_tp_dealloc, (void *)pyqtProperty_dealloc}, + {Py_tp_free, (void *)PyObject_GC_Del}, + {Py_tp_call, (void *)pyqtProperty_call}, + {Py_tp_getattro, (void *)PyObject_GenericGetAttr}, + {Py_tp_doc, (void *)pyqtProperty_doc}, + {Py_tp_traverse, (void *)pyqtProperty_traverse}, + {Py_tp_descr_get, (void *)pyqtProperty_descr_get}, + {Py_tp_descr_set, (void *)pyqtProperty_descr_set}, + {Py_tp_methods, pyqtProperty_methods}, + {Py_tp_members, pyqtProperty_members}, + {0, 0} +}; + + +// Define the type. +static PyType_Spec qpycore_pyqtProperty_Spec = { + "PyQt6.QtCore.pyqtProperty", + sizeof (qpycore_pyqtProperty), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_BASETYPE, + qpycore_pyqtProperty_Slots +}; + + +// This is the sequence number to allocate to the next PyQt property to be +// defined. This ensures that properties appear in the QMetaObject in the same +// order that they are defined in Python. +static uint pyqtprop_sequence_nr = 0; + + +// The pyqtProperty dealloc function. +static void pyqtProperty_dealloc(PyObject *self) +{ + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)self; + + PyObject_GC_UnTrack(self); + + Py_XDECREF(pp->pyqtprop_get); + Py_XDECREF(pp->pyqtprop_set); + Py_XDECREF(pp->pyqtprop_del); + Py_XDECREF(pp->pyqtprop_doc); + Py_XDECREF(pp->pyqtprop_reset); + Py_XDECREF(pp->pyqtprop_notify); + Py_XDECREF(pp->pyqtprop_type); + + delete pp->pyqtprop_parsed_type; + + ((destructor)PyType_GetSlot(Py_TYPE(self), Py_tp_free))(self); +} + + +// The descriptor getter. +static PyObject *pyqtProperty_descr_get(PyObject *self, PyObject *obj, + PyObject *) +{ + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)self; + + if (!obj || obj == Py_None) + { + Py_INCREF(self); + return self; + } + + if (!pp->pyqtprop_get) + { + PyErr_SetString(PyExc_AttributeError, "unreadable attribute"); + return 0; + } + + return PyObject_CallFunction(pp->pyqtprop_get, const_cast("(O)"), + obj); +} + + +// The descriptor setter. +static int pyqtProperty_descr_set(PyObject *self, PyObject *obj, + PyObject *value) +{ + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)self; + PyObject *func, *res; + + func = (value ? pp->pyqtprop_set : pp->pyqtprop_del); + + if (!func) + { + PyErr_SetString(PyExc_AttributeError, + (value ? "can't set attribute" : "can't delete attribute")); + return -1; + } + + if (value) + res = PyObject_CallFunction(func, const_cast("(OO)"), obj, + value); + else + res = PyObject_CallFunction(func, const_cast("(O)"), obj); + + if (!res) + return -1; + + Py_DECREF(res); + return 0; +} + + +// The pyqtProperty traverse function. +static int pyqtProperty_traverse(PyObject *self, visitproc visit, void *arg) +{ + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)self; + int vret; + + if (pp->pyqtprop_get) + { + vret = visit(pp->pyqtprop_get, arg); + + if (vret != 0) + return vret; + } + + if (pp->pyqtprop_set) + { + vret = visit(pp->pyqtprop_set, arg); + + if (vret != 0) + return vret; + } + + if (pp->pyqtprop_del) + { + vret = visit(pp->pyqtprop_del, arg); + + if (vret != 0) + return vret; + } + + if (pp->pyqtprop_doc) + { + vret = visit(pp->pyqtprop_doc, arg); + + if (vret != 0) + return vret; + } + + if (pp->pyqtprop_reset) + { + vret = visit(pp->pyqtprop_reset, arg); + + if (vret != 0) + return vret; + } + + if (pp->pyqtprop_notify) + { + vret = visit(pp->pyqtprop_notify, arg); + + if (vret != 0) + return vret; + } + + if (pp->pyqtprop_type) + { + vret = visit(pp->pyqtprop_type, arg); + + if (vret != 0) + return vret; + } + + return 0; +} + + +// The pyqtProperty init function. +static int pyqtProperty_init(PyObject *self, PyObject *args, PyObject *kwds) +{ + PyObject *type, *get = 0, *set = 0, *reset = 0, *del = 0, *doc = 0, + *notify = 0; + int scriptable = 1, stored = 1, user = 0, constant = 0, final = 0; + int designable = 1, revision = 0; + static const char *kwlist[] = {"type", "fget", "fset", "freset", "fdel", + "doc", "designable", "scriptable", "stored", "user", "constant", + "final", "notify", "revision", 0}; + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)self; + + pp->pyqtprop_sequence = pyqtprop_sequence_nr++; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, + "O|OOOOOiiiiiiO!i:pyqtProperty", + const_cast(kwlist), &type, &get, &set, &reset, &del, &doc, + &designable, &scriptable, &stored, &user, &constant, &final, + qpycore_pyqtSignal_TypeObject, ¬ify, &revision)) + return -1; + + if (get == Py_None) + get = 0; + + if (set == Py_None) + set = 0; + + if (del == Py_None) + del = 0; + + if (reset == Py_None) + reset = 0; + + if (notify == Py_None) + notify = 0; + + // Parse the type. + const Chimera *ptype = Chimera::parse(type); + + if (!ptype) + { + Chimera::raiseParseException(type, "a property"); + return -1; + } + + pp->pyqtprop_parsed_type = ptype; + + Py_XINCREF(get); + Py_XINCREF(set); + Py_XINCREF(del); + Py_XINCREF(doc); + Py_XINCREF(reset); + Py_XINCREF(notify); + Py_INCREF(type); + + // If no docstring was given try the getter. + if (!doc || doc == Py_None) + { + PyObject *getter_doc = getter_docstring(get); + + if (getter_doc) + { + Py_XDECREF(doc); + doc = getter_doc; + } + } + + pp->pyqtprop_get = get; + pp->pyqtprop_set = set; + pp->pyqtprop_del = del; + pp->pyqtprop_doc = doc; + pp->pyqtprop_reset = reset; + pp->pyqtprop_notify = notify; + pp->pyqtprop_type = type; + + // ResolveEditable is always set. + unsigned flags = 0x00080000; + + if (designable) + flags |= 0x00001000; + + if (scriptable) + flags |= 0x00004000; + + if (stored) + flags |= 0x00010000; + + if (user) + flags |= 0x00100000; + + if (constant) + flags |= 0x00000400; + + if (final) + flags |= 0x00000800; + + pp->pyqtprop_flags = flags; + + pp->pyqtprop_revision = revision; + + return 0; +} + + +// Calling the property is a shorthand way of changing the getter. +static PyObject *pyqtProperty_call(PyObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *get; + static const char *kwlist[] = {"fget", 0}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:pyqtProperty", + const_cast(kwlist), &get)) + return 0; + + return pyqtProperty_getter(self, get); +} + + +// Return a copy of the property with a different getter. +static PyObject *pyqtProperty_getter(PyObject *self, PyObject *getter) +{ + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)self; + + pp = clone(pp); + + if (pp) + { + Py_XDECREF(pp->pyqtprop_get); + + if (getter == Py_None) + getter = 0; + else + Py_INCREF(getter); + + pp->pyqtprop_get = getter; + + // Use the getter's docstring if it has one. + PyObject *getter_doc = getter_docstring(getter); + + if (getter_doc) + { + Py_XDECREF(pp->pyqtprop_doc); + pp->pyqtprop_doc = getter_doc; + } + } + + return (PyObject *)pp; +} + + +// Return a copy of the property with a different setter. +static PyObject *pyqtProperty_setter(PyObject *self, PyObject *setter) +{ + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)self; + + pp = clone(pp); + + if (pp) + { + Py_XDECREF(pp->pyqtprop_set); + + if (setter == Py_None) + setter = 0; + else + Py_INCREF(setter); + + pp->pyqtprop_set = setter; + } + + return (PyObject *)pp; +} + + +// Return a copy of the property with a different deleter. +static PyObject *pyqtProperty_deleter(PyObject *self, PyObject *deleter) +{ + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)self; + + pp = clone(pp); + + if (pp) + { + Py_XDECREF(pp->pyqtprop_del); + + if (deleter == Py_None) + deleter = 0; + else + Py_INCREF(deleter); + + pp->pyqtprop_del = deleter; + } + + return (PyObject *)pp; +} + + +// Return a copy of the property with a different reset. +static PyObject *pyqtProperty_reset(PyObject *self, PyObject *reset) +{ + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)self; + + pp = clone(pp); + + if (pp) + { + Py_XDECREF(pp->pyqtprop_reset); + + if (reset == Py_None) + reset = 0; + else + Py_INCREF(reset); + + pp->pyqtprop_reset = reset; + } + + return (PyObject *)pp; +} + + +// Create a clone of a property. +static qpycore_pyqtProperty *clone(qpycore_pyqtProperty *orig) +{ + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)PyType_GenericNew( + Py_TYPE(orig), 0, 0); + + if (pp) + { + pp->pyqtprop_get = orig->pyqtprop_get; + Py_XINCREF(pp->pyqtprop_get); + + pp->pyqtprop_set = orig->pyqtprop_set; + Py_XINCREF(pp->pyqtprop_set); + + pp->pyqtprop_del = orig->pyqtprop_del; + Py_XINCREF(pp->pyqtprop_del); + + pp->pyqtprop_doc = orig->pyqtprop_doc; + Py_XINCREF(pp->pyqtprop_doc); + + pp->pyqtprop_reset = orig->pyqtprop_reset; + Py_XINCREF(pp->pyqtprop_reset); + + pp->pyqtprop_notify = orig->pyqtprop_notify; + Py_XINCREF(pp->pyqtprop_notify); + + pp->pyqtprop_type = orig->pyqtprop_type; + Py_XINCREF(pp->pyqtprop_type); + + pp->pyqtprop_parsed_type = new Chimera(*orig->pyqtprop_parsed_type); + + pp->pyqtprop_flags = orig->pyqtprop_flags; + pp->pyqtprop_revision = orig->pyqtprop_revision; + pp->pyqtprop_sequence = orig->pyqtprop_sequence; + } + + return pp; +} + + +// Return the docstring of an optional getter or 0 if it doesn't have one. +static PyObject *getter_docstring(PyObject *getter) +{ + // Handle the trivial case. + if (!getter) + return 0; + + PyObject *getter_doc = PyObject_GetAttrString(getter, "__doc__"); + + if (!getter_doc) + { + PyErr_Clear(); + return 0; + } + + if (getter_doc == Py_None) + { + Py_DECREF(getter_doc); + return 0; + } + + return getter_doc; +} + + +// Initialise the type and return true if there was no error. +bool qpycore_pyqtProperty_init_type() +{ + qpycore_pyqtProperty_TypeObject = (PyTypeObject *)PyType_FromSpec( + &qpycore_pyqtProperty_Spec); + + return qpycore_pyqtProperty_TypeObject; +} diff --git a/qpy/QtCore/qpycore_pyqtproperty.h b/qpy/QtCore/qpycore_pyqtproperty.h new file mode 100644 index 0000000..6ec92e7 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtproperty.h @@ -0,0 +1,82 @@ +// This contains the definitions for the implementation of pyqtProperty. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_PYQTPROPERTY_H +#define _QPYCORE_PYQTPROPERTY_H + + +#include + + +class Chimera; + + +extern "C" { + +// This defines the structure of a PyQt property. +typedef struct { + PyObject_HEAD + + // The fget/getter/read callable. + PyObject *pyqtprop_get; + + // The fset/setter/write callable. + PyObject *pyqtprop_set; + + // The fdel/deleter callable. + PyObject *pyqtprop_del; + + // The docstring. + PyObject *pyqtprop_doc; + + // The freset/reset callable. + PyObject *pyqtprop_reset; + + // The notify signal. + PyObject *pyqtprop_notify; + + // The property type. + PyObject *pyqtprop_type; + + // The parsed type information. + const Chimera *pyqtprop_parsed_type; + + // The DESIGNABLE, SCRIPTABLE, STORED, USER, CONSTANT and FINAL flags. + unsigned pyqtprop_flags; + + // The REVISION. + int pyqtprop_revision; + + // The property's sequence number that determines the position of the + // property in the QMetaObject. + uint pyqtprop_sequence; +} qpycore_pyqtProperty; + +} + + +// The type object. +extern PyTypeObject *qpycore_pyqtProperty_TypeObject; + + +bool qpycore_pyqtProperty_init_type(); + + +#endif diff --git a/qpy/QtCore/qpycore_pyqtpyobject.cpp b/qpy/QtCore/qpycore_pyqtpyobject.cpp new file mode 100644 index 0000000..f883e5d --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtpyobject.cpp @@ -0,0 +1,213 @@ +// This contains the support for Python objects and Qt's metatype system. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpycore_api.h" +#include "qpycore_pyqtpyobject.h" + +#include "sipAPIQtCore.h" + + +// The current pickle protocol. +PyObject *qpycore_pickle_protocol; + + +// Wrap a Python object. +PyQt_PyObject::PyQt_PyObject(PyObject *py) +{ + pyobject = py; + + SIP_BLOCK_THREADS + Py_XINCREF(pyobject); + SIP_UNBLOCK_THREADS +} + + +// Create a new wrapper, with no Python object. This is called by Qt's +// metatype system. +PyQt_PyObject::PyQt_PyObject() +{ + pyobject = 0; +} + + +// Create a copy of an existing wrapper. This is called by Qt's metatype +// system. +PyQt_PyObject::PyQt_PyObject(const PyQt_PyObject &other) +{ + pyobject = other.pyobject; + + SIP_BLOCK_THREADS + Py_XINCREF(pyobject); + SIP_UNBLOCK_THREADS +} + + +// Destroy a wrapper. +PyQt_PyObject::~PyQt_PyObject() +{ + // Qt can still be tidying up after Python has gone so make sure that it + // hasn't. + if (Py_IsInitialized()) + { + SIP_BLOCK_THREADS + Py_XDECREF(pyobject); + SIP_UNBLOCK_THREADS + } + + pyobject = 0; +} + + +// Assignment operator. +PyQt_PyObject &PyQt_PyObject::operator=(const PyQt_PyObject &other) +{ + pyobject = other.pyobject; + + SIP_BLOCK_THREADS + Py_XINCREF(pyobject); + SIP_UNBLOCK_THREADS + + return *this; +} + + +// Comparison operator. It must be global to be available to QMetaType. +bool operator==(const PyQt_PyObject &self, const PyQt_PyObject &other) +{ + // Note that we implement 'self is other' rather than 'self == other'. + return self.pyobject == other.pyobject; +} + + +// Serialise operator. +QDataStream &operator<<(QDataStream &out, const PyQt_PyObject &obj) +{ + PyObject *ser_obj = 0; + const char *ser = 0; + uint len = 0; + + if (obj.pyobject) + { + static PyObject *dumps = 0; + + SIP_BLOCK_THREADS + + if (!dumps) + { + PyObject *pickle = PyImport_ImportModule("pickle"); + + if (pickle) + { + dumps = PyObject_GetAttrString(pickle, "dumps"); + Py_DECREF(pickle); + } + } + + if (dumps) + { + if (!qpycore_pickle_protocol) + { + Py_INCREF(Py_None); + qpycore_pickle_protocol = Py_None; + } + + ser_obj = PyObject_CallFunctionObjArgs(dumps, obj.pyobject, + qpycore_pickle_protocol, 0); + + if (ser_obj) + { + if (PyBytes_Check(ser_obj)) + { + ser = PyBytes_AsString(ser_obj); + len = PyBytes_Size(ser_obj); + } + else + { + Py_DECREF(ser_obj); + ser_obj = 0; + } + } + else + { + pyqt6_err_print(); + } + } + + SIP_UNBLOCK_THREADS + } + + out.writeBytes(ser, len); + + if (ser_obj) + { + SIP_BLOCK_THREADS + Py_DECREF(ser_obj); + SIP_UNBLOCK_THREADS + } + + return out; +} + + +// De-serialise operator. +QDataStream &operator>>(QDataStream &in, PyQt_PyObject &obj) +{ + char *ser; + uint len; + + in.readBytes(ser, len); + + if (len) + { + static PyObject *loads = 0; + + SIP_BLOCK_THREADS + + if (!loads) + { + PyObject *pickle = PyImport_ImportModule("pickle"); + + if (pickle) + { + loads = PyObject_GetAttrString(pickle, "loads"); + Py_DECREF(pickle); + } + } + + if (loads) + { + PyObject *ser_obj = PyBytes_FromStringAndSize(ser, len); + + if (ser_obj) + { + obj.pyobject = PyObject_CallFunctionObjArgs(loads, ser_obj, 0); + Py_DECREF(ser_obj); + } + } + + SIP_UNBLOCK_THREADS + } + + delete[] ser; + + return in; +} diff --git a/qpy/QtCore/qpycore_pyqtpyobject.h b/qpy/QtCore/qpycore_pyqtpyobject.h new file mode 100644 index 0000000..e2cb576 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtpyobject.h @@ -0,0 +1,56 @@ +// This contains definitions related to the support for Python objects and Qt's +// meta-type system. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_PYQTPYOBJECT_H +#define _QPYCORE_PYQTPYOBJECT_H + + +#include + +#include +#include + + +// This class is used to wrap a PyObject so it can be passed around Qt's +// meta-type system while maintaining its reference count. +class PyQt_PyObject +{ +public: + PyQt_PyObject(PyObject *py); + PyQt_PyObject(); + PyQt_PyObject(const PyQt_PyObject &other); + ~PyQt_PyObject(); + + PyQt_PyObject &operator=(const PyQt_PyObject &other); + + // The Python object being wrapped. + PyObject *pyobject; +}; + +bool operator==(const PyQt_PyObject &self, const PyQt_PyObject &other); + +QDataStream &operator<<(QDataStream &out, const PyQt_PyObject &obj); +QDataStream &operator>>(QDataStream &in, PyQt_PyObject &obj); + +Q_DECLARE_METATYPE(PyQt_PyObject) + + +#endif diff --git a/qpy/QtCore/qpycore_pyqtsignal.cpp b/qpy/QtCore/qpycore_pyqtsignal.cpp new file mode 100644 index 0000000..2ac9321 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtsignal.cpp @@ -0,0 +1,753 @@ +// This contains the implementation of the pyqtSignal type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include + +#include "qpycore_chimera.h" +#include "qpycore_misc.h" +#include "qpycore_pyqtboundsignal.h" +#include "qpycore_pyqtsignal.h" + + +// The type object. +PyTypeObject *qpycore_pyqtSignal_TypeObject; + + +// Forward declarations. +extern "C" { +static PyObject *pyqtSignal_call(PyObject *self, PyObject *args, PyObject *kw); +static void pyqtSignal_dealloc(PyObject *self); +static PyObject *pyqtSignal_descr_get(PyObject *self, PyObject *obj, + PyObject *type); +static int pyqtSignal_init(PyObject *self, PyObject *args, PyObject *kwd_args); +static PyObject *pyqtSignal_repr(PyObject *self); +static PyObject *pyqtSignal_mp_subscript(PyObject *self, PyObject *subscript); +static PyObject *pyqtSignal_get_doc(PyObject *self, void *); +static PyObject *pyqtSignal_get_signatures(PyObject *self, void *); +} + +static int init_signal_from_types(qpycore_pyqtSignal *ps, const char *name, + const QList *parameter_names, int revision, + PyObject *types); +static void append_overload(qpycore_pyqtSignal *ps); +static bool is_signal_name(const char *sig, const QByteArray &name); + + +// Doc-strings. +PyDoc_STRVAR(pyqtSignal_doc, +"pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL\n" +"\n" +"types is normally a sequence of individual types. Each type is either a\n" +"type object or a string that is the name of a C++ type. Alternatively\n" +"each type could itself be a sequence of types each describing a different\n" +"overloaded signal.\n" +"name is the optional C++ name of the signal. If it is not specified then\n" +"the name of the class attribute that is bound to the signal is used.\n" +"revision is the optional revision of the signal that is exported to QML.\n" +"If it is not specified then 0 is used.\n" +"arguments is the optional sequence of the names of the signal's arguments.\n"); + +PyDoc_STRVAR(pyqtSignal_signatures_doc, +"The signatures of each of the overloaded signals"); + + +// The getters/setters. +static PyGetSetDef pyqtSignal_getset[] = { + {const_cast("__doc__"), pyqtSignal_get_doc, NULL, NULL, NULL}, + {const_cast("signatures"), pyqtSignal_get_signatures, NULL, + const_cast(pyqtSignal_signatures_doc), NULL}, + {NULL, NULL, NULL, NULL, NULL} +}; + + +// Define the slots. +static PyType_Slot qpycore_pyqtSignal_Slots[] = { + {Py_tp_new, (void *)PyType_GenericNew}, + {Py_tp_init, (void *)pyqtSignal_init}, + {Py_tp_dealloc, (void *)pyqtSignal_dealloc}, + {Py_tp_doc, (void *)pyqtSignal_doc}, + {Py_tp_repr, (void *)pyqtSignal_repr}, + {Py_tp_call, (void *)pyqtSignal_call}, + {Py_tp_descr_get, (void *)pyqtSignal_descr_get}, + {Py_mp_subscript, (void *)pyqtSignal_mp_subscript}, + {Py_tp_getset, pyqtSignal_getset}, + {0, 0} +}; + + +// Define the type. +static PyType_Spec qpycore_pyqtSignal_Spec = { + "PyQt6.QtCore.pyqtSignal", + sizeof (qpycore_pyqtSignal), + 0, + Py_TPFLAGS_DEFAULT, + qpycore_pyqtSignal_Slots +}; + + +// The __doc__ getter. +static PyObject *pyqtSignal_get_doc(PyObject *self, void *) +{ + qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)self; + + // Make sure we have the default signal. + ps = ps->default_signal; + + QByteArray doc; + + // Get any docstrings from any non-signal overloads. + if (ps->non_signals && ps->non_signals->ml_doc) + { + doc.append('\n'); + doc.append(ps->non_signals->ml_doc); + } + + // Get any docstrings from the signals. + do + { + const char *docstring = ps->docstring; + + if (docstring) + { + if (*docstring == '\1') + ++docstring; + + doc.append('\n'); + doc.append(docstring); + doc.append(" [signal]"); + } + + ps = ps->next; + } + while (ps); + + if (doc.isEmpty()) + { + Py_INCREF(Py_None); + return Py_None; + } + + return PyUnicode_FromString(doc.constData() + 1); +} + + +// The 'signatures' getter. +static PyObject *pyqtSignal_get_signatures(PyObject *self, void *) +{ + qpycore_pyqtSignal *head = ((qpycore_pyqtSignal *)self)->default_signal; + qpycore_pyqtSignal *ps; + PyObject *sigs; + Py_ssize_t sig_nr; + + // Count the number of overloads. + for (sig_nr = 0, ps = head; ps; ps = ps->next, ++sig_nr) + ; + + sigs = PyTuple_New(sig_nr); + if (!sigs) + return 0; + + for (sig_nr = 0, ps = head; ps; ps = ps->next, ++sig_nr) + { + PyObject *sig = PyUnicode_FromString( + ps->parsed_signature->signature.constData() + 1); + + if (!sig || PyTuple_SetItem(sigs, sig_nr, sig)) + { + Py_DECREF(sigs); + return 0; + } + } + + return sigs; +} + + +// The type repr slot. +static PyObject *pyqtSignal_repr(PyObject *self) +{ + qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)self; + + return PyUnicode_FromFormat("", + ps->parsed_signature->signature.constData() + 1); +} + + +// The type call slot. +static PyObject *pyqtSignal_call(PyObject *self, PyObject *args, PyObject *kw) +{ + return qpycore_call_signal_overload((qpycore_pyqtSignal *)self, 0, args, + kw); +} + + +// The type dealloc slot. +static void pyqtSignal_dealloc(PyObject *self) +{ + qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)self; + + delete ps->parsed_signature; + + if (ps->parameter_names) + delete ps->parameter_names; + + // If we are the default then we own the overloads references. + if (ps == ps->default_signal) + { + qpycore_pyqtSignal *next = ps->next; + + while (next) + { + ps = next; + next = ps->next; + + Py_DECREF((PyObject *)ps); + } + } + + PyObject_Del(self); +} + + +// The type descriptor get slot. +static PyObject *pyqtSignal_descr_get(PyObject *self, PyObject *obj, + PyObject *) +{ + qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)self; + + // Return the unbound signal if there is nothing to bind it to. + if (obj == NULL || obj == Py_None) + { + Py_INCREF(self); + return self; + } + + // Get the QObject. + int is_err = 0; + void *qobject = sipForceConvertToType(obj, sipType_QObject, 0, + SIP_NO_CONVERTORS, 0, &is_err); + + if (is_err) + return 0; + + // Return the bound signal. + return qpycore_pyqtBoundSignal_New(ps, obj, + reinterpret_cast(qobject)); +} + + +// The type init slot. +static int pyqtSignal_init(PyObject *self, PyObject *args, PyObject *kwd_args) +{ + qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)self; + + // Get the keyword arguments. + PyObject *name_obj = 0; + const char *name = 0; + int revision = 0; + QList *parameter_names = 0; + + if (kwd_args) + { + Py_ssize_t pos = 0; + PyObject *key, *value; + + while (PyDict_Next(kwd_args, &pos, &key, &value)) + { + if (PyUnicode_CompareWithASCIIString(key, "name") == 0) + { + name_obj = value; + name = sipString_AsASCIIString(&name_obj); + + if (!name) + { + PyErr_Format(PyExc_TypeError, + "signal 'name' must be a str, not %s", + sipPyTypeName(Py_TYPE(value))); + + return -1; + } + } + else if (PyUnicode_CompareWithASCIIString(key, "revision") == 0) + { + revision = sipLong_AsInt(value); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "signal 'revision' must be an int, not %s", + sipPyTypeName(Py_TYPE(value))); + + Py_XDECREF(name_obj); + return -1; + } + } + else if (PyUnicode_CompareWithASCIIString(key, "arguments") == 0) + { + bool ok = true; + + if (PySequence_Check(value)) + { + Py_ssize_t len = PySequence_Size(value); + + parameter_names = new QList; + + for (Py_ssize_t i = 0; i < len; ++i) + { + PyObject *py_attr = PySequence_GetItem(value, i); + + if (!py_attr) + { + ok = false; + break; + } + + QByteArray attr = qpycore_convert_ASCII(py_attr); + Py_DECREF(py_attr); + + if (attr.isNull()) + { + ok = false; + break; + } + + parameter_names->append(attr); + } + } + else + { + ok = false; + } + + if (!ok) + { + PyErr_Format(PyExc_TypeError, + "signal 'attribute_names' must be a sequence of str, not %s", + sipPyTypeName(Py_TYPE(value))); + + if (parameter_names) + delete parameter_names; + + Py_XDECREF(name_obj); + return -1; + } + } + else + { + PyErr_Format(PyExc_TypeError, + "pyqtSignal() got an unexpected keyword argument '%U'", + key); + + Py_XDECREF(name_obj); + return -1; + } + } + } + + // If there is at least one argument and it is a sequence then assume all + // arguments are sequences. Unfortunately a string is also a sequence so + // check for tuples and lists explicitly. + if (PyTuple_Size(args) > 0 && (PyTuple_Check(PyTuple_GetItem(args, 0)) || PyList_Check(PyTuple_GetItem(args, 0)))) + { + for (Py_ssize_t i = 0; i < PyTuple_Size(args); ++i) + { + PyObject *types = PySequence_Tuple(PyTuple_GetItem(args, i)); + + if (!types) + { + PyErr_SetString(PyExc_TypeError, + "pyqtSignal() argument expected to be sequence of types"); + + if (name) + { + Py_DECREF(name_obj); + } + + return -1; + } + + int rc; + + if (i == 0) + { + // The first is the default. + rc = init_signal_from_types(ps, name, parameter_names, + revision, types); + } + else + { + qpycore_pyqtSignal *overload = (qpycore_pyqtSignal *)PyType_GenericNew(qpycore_pyqtSignal_TypeObject, 0, 0); + + if (!overload) + { + rc = -1; + } + else if ((rc = init_signal_from_types(overload, name, 0, revision, types)) < 0) + { + Py_DECREF((PyObject *)overload); + } + else + { + overload->default_signal = ps; + append_overload(overload); + } + } + + Py_DECREF(types); + + if (rc < 0) + { + if (name) + { + Py_DECREF(name_obj); + } + + return -1; + } + } + } + else if (init_signal_from_types(ps, name, parameter_names, revision, args) < 0) + { + if (name) + { + Py_DECREF(name_obj); + } + + return -1; + } + + if (name) + { + Py_DECREF(name_obj); + } + + return 0; +} + + +// The mapping subscript slot. +static PyObject *pyqtSignal_mp_subscript(PyObject *self, PyObject *subscript) +{ + qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)self; + + PyObject *sig = (PyObject *)qpycore_find_signal(ps, subscript, + "an unbound signal type argument"); + + Py_XINCREF(sig); + + return sig; +} + + +// Initialise the type and return true if there was no error. +bool qpycore_pyqtSignal_init_type() +{ + qpycore_pyqtSignal_TypeObject = (PyTypeObject *)PyType_FromSpec( + &qpycore_pyqtSignal_Spec); + + return qpycore_pyqtSignal_TypeObject; +} + + +// Create a new signal instance. +qpycore_pyqtSignal *qpycore_pyqtSignal_New(const char *signature, bool *fatal) +{ + // Assume any error is fatal. + if (fatal) + *fatal = true; + + // See if we have two variants of the signature, ie. one with namespaces + // stripped that we can use with connect() and another that we can parse. + const char *full_sig = strchr(signature, '|'); + + Chimera::Signature *parsed_signature = Chimera::parse( + (full_sig ? full_sig + 1 : signature), "a signal argument"); + + // At first glance the parse should never fail because the signature + // originates from the .sip file. However it might if it includes a type + // that has been forward declared, but not yet defined. The only example + // in PyQt is the declaration of QWidget by QSignalMapper. Therefore we + // assume the error isn't fatal. + if (!parsed_signature) + { + if (fatal) + *fatal = false; + + return 0; + } + + if (full_sig) + // Use the variant with namespaces stripped. + parsed_signature->signature = QByteArray(signature, + full_sig - signature); + + parsed_signature->signature.prepend('2'); + + // Create and initialise the signal. + qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)PyType_GenericNew( + qpycore_pyqtSignal_TypeObject, 0, 0); + + if (!ps) + { + delete parsed_signature; + return 0; + } + + ps->default_signal = ps; + ps->next = 0; + ps->docstring = 0; + ps->parameter_names = 0; + ps->revision = 0; + ps->parsed_signature = parsed_signature; + ps->emitter = 0; + ps->non_signals = 0; + + return ps; +} + + +// Find an overload that matches a subscript. +qpycore_pyqtSignal *qpycore_find_signal(qpycore_pyqtSignal *ps, + PyObject *subscript, const char *context) +{ + // Make sure the subscript is a tuple. + PyObject *args; + + if (PyTuple_Check(subscript)) + { + args = subscript; + } + else + { + args = PyTuple_New(1); + + if (!args) + return 0; + + PyTuple_SetItem(args, 0, subscript); + } + + Py_INCREF(subscript); + + // Parse the subscript as a tuple of types. + Chimera::Signature *ss_signature = Chimera::parse(args, 0, context); + + Py_DECREF(args); + + if (!ss_signature) + return 0; + + // Search for an overload with this signature. + qpycore_pyqtSignal *overload = ps->default_signal; + + do + { + if (overload->parsed_signature->arguments() == ss_signature->signature) + break; + + overload = overload->next; + } + while (overload); + + delete ss_signature; + + if (!overload) + PyErr_SetString(PyExc_KeyError, + "there is no matching overloaded signal"); + + return overload; +} + + +// Initialise a signal when given a tuple of types. +static int init_signal_from_types(qpycore_pyqtSignal *ps, const char *name, + const QList *parameter_names, int revision, + PyObject *types) +{ + Chimera::Signature *parsed_signature = Chimera::parse(types, name, + "a pyqtSignal() type argument"); + + if (!parsed_signature) + return -1; + + if (name) + parsed_signature->signature.prepend('2'); + + ps->default_signal = ps; + ps->next = 0; + ps->docstring = 0; + ps->parameter_names = parameter_names; + ps->revision = revision; + ps->parsed_signature = parsed_signature; + ps->emitter = 0; + ps->non_signals = 0; + + return 0; +} + + +// Append an overload to the default signal's list. +static void append_overload(qpycore_pyqtSignal *ps) +{ + // Append to the list of overloads. + qpycore_pyqtSignal **tailp = &ps->default_signal->next; + + while (*tailp) + tailp = &(*tailp)->next; + + *tailp = ps; +} + + +// Give a signal a name if it hasn't already got one. +void qpycore_set_signal_name(qpycore_pyqtSignal *ps, const char *type_name, + const char *name) +{ + ps = ps->default_signal; + + // If the signature already has a name then they all have and there is + // nothing more to do. + if (!ps->parsed_signature->signature.startsWith('(')) + return; + + do + { + QByteArray &sig = ps->parsed_signature->signature; + + sig.prepend(name); + sig.prepend('2'); + + QByteArray &py_sig = ps->parsed_signature->py_signature; + + py_sig.prepend(name); + py_sig.prepend('.'); + py_sig.prepend(type_name); + + ps = ps->next; + } + while (ps); +} + + +// Handle the getting of a lazy attribute, ie. a native Qt signal. +int qpycore_get_lazy_attr(const sipTypeDef *td, PyObject *dict) +{ + const pyqt6ClassPluginDef *plugin = reinterpret_cast(sipTypePluginData(td)); + + // Handle the trvial cases. + if (!plugin) + return 0; + + const pyqt6QtSignal *sigs = plugin->qt_signals; + + if (!sigs) + return 0; + + QByteArray default_name; + qpycore_pyqtSignal *default_signal = 0; + + do + { + // See if we have come to the end of the current signal. + if (default_signal && !is_signal_name(sigs->signature, default_name)) + { + if (PyDict_SetItemString(dict, default_name.constData(), (PyObject *)default_signal) < 0) + return -1; + + default_signal = 0; + } + + bool fatal; + + qpycore_pyqtSignal *sig = qpycore_pyqtSignal_New(sigs->signature, + &fatal); + + if (!sig) + { + if (fatal) + return -1; + + PyErr_Clear(); + continue; + } + + sig->docstring = sigs->docstring; + sig->emitter = sigs->emitter; + + // See if this is a new default. + if (default_signal) + { + sig->default_signal = default_signal; + append_overload(sig); + } + else + { + sig->non_signals = sigs->non_signals; + + default_signal = sig->default_signal = sig; + + default_name = sigs->signature; + default_name.truncate(default_name.indexOf('(')); + } + } + while ((++sigs)->signature); + + // Save the last one, if any (in case of a non-fatal error). + if (!default_signal) + return 0; + + return PyDict_SetItemString(dict, default_name.constData(), + (PyObject *)default_signal); +} + + +// Return true if a signal signatures has a particular name. +static bool is_signal_name(const char *sig, const QByteArray &name) +{ + return (qstrncmp(sig, name.constData(), name.size()) == 0 && sig[name.size()] == '('); +} + + +// Call a signal's overloaded method (if there is one). +PyObject *qpycore_call_signal_overload(qpycore_pyqtSignal *ps, PyObject *bound, + PyObject *args, PyObject *kw) +{ + if (!ps->non_signals) + { + PyErr_SetString(PyExc_TypeError, "native Qt signal is not callable"); + return 0; + } + + PyObject *func = PyCFunction_New(ps->non_signals, bound); + + if (!func) + return 0; + + PyObject *result = PyObject_Call(func, args, kw); + + Py_DECREF(func); + + return result; +} diff --git a/qpy/QtCore/qpycore_pyqtsignal.h b/qpy/QtCore/qpycore_pyqtsignal.h new file mode 100644 index 0000000..d54afd6 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtsignal.h @@ -0,0 +1,87 @@ +// This defines the interfaces for the pyqtSignal type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_PYQTSIGNAL_H +#define _QPYCORE_PYQTSIGNAL_H + + +#include +#include + +#include +#include + +#include "qpycore_chimera.h" + + +extern "C" { + +// This defines the structure of a PyQt signal. +typedef struct _qpycore_pyqtSignal { + PyObject_HEAD + + // The default signal. This is the head of the linked list of overloads + // and holds references to rest of the list elements. + struct _qpycore_pyqtSignal *default_signal; + + // The next overload in the list. + struct _qpycore_pyqtSignal *next; + + // The docstring. + const char *docstring; + + // The optional parameter names. + const QList *parameter_names; + + // The revision. + int revision; + + // The parsed signature, not set if there is an emitter. + Chimera::Signature *parsed_signature; + + // An optional emitter. + pyqt6EmitFunc emitter; + + // The non-signal overloads (if any). This is only set for the default. + PyMethodDef *non_signals; +} qpycore_pyqtSignal; + + +int qpycore_get_lazy_attr(const sipTypeDef *td, PyObject *dict); + +} + + +// The type object. +extern PyTypeObject *qpycore_pyqtSignal_TypeObject; + + +bool qpycore_pyqtSignal_init_type(); +qpycore_pyqtSignal *qpycore_pyqtSignal_New(const char *signature, + bool *fatal = 0); +qpycore_pyqtSignal *qpycore_find_signal(qpycore_pyqtSignal *ps, + PyObject *subscript, const char *context); +void qpycore_set_signal_name(qpycore_pyqtSignal *ps, const char *type_name, + const char *name); +PyObject *qpycore_call_signal_overload(qpycore_pyqtSignal *ps, PyObject *bound, + PyObject *args, PyObject *kw); + + +#endif diff --git a/qpy/QtCore/qpycore_pyqtslot.cpp b/qpy/QtCore/qpycore_pyqtslot.cpp new file mode 100644 index 0000000..e7b46e0 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtslot.cpp @@ -0,0 +1,339 @@ +// This contains the implementation of the PyQtSlot class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpycore_chimera.h" +#include "qpycore_pyqtslot.h" + + +// Create the slot for a callable. +PyQtSlot::PyQtSlot(PyObject *callable, bool callable_is_method, + const Chimera::Signature *slot_signature) + : mfunc(0), mself(0), mself_wr(0), other(0), signature(slot_signature) +{ + if (callable_is_method) + { + mfunc = callable; + } + else + { + sipMethodDef callable_m; + + if (sipGetMethod(callable, &callable_m)) + { + // Save the component parts. + mfunc = callable_m.pm_function; + mself = callable_m.pm_self; + + // Try and create a weak reference to the instance object. + mself_wr = PyWeakref_NewRef(mself, 0); + } + else + { + // Give the slot an extra reference to keep it alive. + Py_INCREF(callable); + other = callable; + } + } + + // If the slot is a method then keep the function object alive. + Py_XINCREF(mfunc); +} + + +// Destroy the slot. +PyQtSlot::~PyQtSlot() +{ + Py_XDECREF(mfunc); + Py_XDECREF(mself_wr); + Py_XDECREF(other); +} + + +// Invoke the slot on behalf of C++. +PyQtSlot::Result PyQtSlot::invoke(void **qargs, bool no_receiver_check) const +{ + return invoke(qargs, 0, 0, no_receiver_check); +} + + +// Invoke the slot on behalf of C++. +bool PyQtSlot::invoke(void **qargs, PyObject *self, void *result) const +{ + return (invoke(qargs, self, result, false) != PyQtSlot::Failed); +} + + +// Invoke the slot on behalf of C++. +PyQtSlot::Result PyQtSlot::invoke(void **qargs, PyObject *self, void *result, + bool no_receiver_check) const +{ + // Get the callable. + PyObject *callable; + + if (other) + { + callable = other; + Py_INCREF(callable); + } + else + { + // Use the value we have if one wasn't supplied. + if (!self) + self = instance(); + + // If self is NULL then we didn't have a method in the first place. + // Instead we had a callable that has been cleared during garbage + // collection - so we can simply ignore the invocation. + if (!self) + return PyQtSlot::Ignored; + + // See if the instance has gone (which isn't an error). + if (self == Py_None) + return PyQtSlot::Ignored; + + // If the receiver wraps a C++ object then ignore the call if it no + // longer exists. + if (!no_receiver_check && PyObject_TypeCheck(self, sipSimpleWrapper_Type) && !sipGetAddress((sipSimpleWrapper *)self)) + return PyQtSlot::Ignored; + + sipMethodDef callable_m; + + callable_m.pm_function = mfunc; + callable_m.pm_self = self; + + callable = sipFromMethod(&callable_m); + } + + // Convert the C++ arguments to Python objects. + const QList &args = signature->parsed_arguments; + + PyObject *argtup = PyTuple_New(args.size()); + + if (!argtup) + return PyQtSlot::Failed; + + QList::const_iterator it = args.constBegin(); + + for (int a = 0; it != args.constEnd(); ++a) + { + PyObject *arg = (*it)->toPyObject(*++qargs); + + if (!arg) + { + Py_DECREF(argtup); + return PyQtSlot::Failed; + } + + PyTuple_SetItem(argtup, a, arg); + + ++it; + } + + // Dispatch to the real slot. + PyObject *res = call(callable, argtup); + + Py_DECREF(argtup); + Py_DECREF(callable); + + if (!res) + return PyQtSlot::Failed; + + // Handle any result if required. + bool ok; + + if (result && signature->result) + ok = signature->result->fromPyObject(res, result); + else + ok = true; + + Py_DECREF(res); + + return (ok ? PyQtSlot::Succeeded : PyQtSlot::Failed); +} + + +// See if this slot corresponds to the given callable. +bool PyQtSlot::operator==(PyObject *callable) const +{ + sipMethodDef callable_m; + + if (sipGetMethod(callable, &callable_m)) + { + if (other) + return false; + + return (mfunc == callable_m.pm_function && instance() == callable_m.pm_self); + } + + if (!other) + return false; + + // See if it is a wrapped C++ method. Note that the PyQt4 behaviour is to + // not save a reference but to save the components (as we do with methods). + // Hopefully it won't make a difference. However it begs the question as + // to whether we should do the same with methods and rely on the garbage + // collector - is the current way of handling methods purely historical? + sipCFunctionDef other_cf, callable_cf; + + if (sipGetCFunction(other, &other_cf) && sipGetCFunction(callable, &callable_cf)) + return (other_cf.cf_self == callable_cf.cf_self && + other_cf.cf_function->ml_meth == callable_cf.cf_function->ml_meth); + + return (other == callable); +} + + +// Get the instance object. +PyObject *PyQtSlot::instance() const +{ + // Use the weak reference if possible. + if (mself_wr) + return PyWeakref_GetObject(mself_wr); + + return mself; +} + + +// Call a single slot and return the result. +PyObject *PyQtSlot::call(PyObject *callable, PyObject *args) const +{ + PyObject *sa, *oxtype, *oxvalue, *oxtb; + + // Keep some compilers quiet. + oxtype = oxvalue = oxtb = 0; + + // We make repeated attempts to call a slot. If we work out that it failed + // because of an immediate type error we try again with one less argument. + // We keep going until we run out of arguments to drop. This emulates the + // Qt ability of the slot to accept fewer arguments than a signal provides. + sa = args; + Py_INCREF(sa); + + for (;;) + { + PyObject *nsa, *xtype, *xvalue, *xtb, *res; + + if ((res = PyObject_Call(callable, sa, NULL)) != NULL) + { + // Remove any previous exception. + + if (sa != args) + { + Py_XDECREF(oxtype); + Py_XDECREF(oxvalue); + Py_XDECREF(oxtb); + PyErr_Clear(); + } + + Py_DECREF(sa); + + return res; + } + + // Get the exception. + PyErr_Fetch(&xtype, &xvalue, &xtb); + + // See if it is unacceptable. An acceptable failure is a type error + // with no traceback - so long as we can still reduce the number of + // arguments and try again. + if (!PyErr_GivenExceptionMatches(xtype, PyExc_TypeError) || xtb || + PyTuple_Size(sa) == 0) + { + // If there is a traceback then we must have called the slot and + // the exception was later on - so report the exception as is. + if (xtb) + { + if (sa != args) + { + Py_XDECREF(oxtype); + Py_XDECREF(oxvalue); + Py_XDECREF(oxtb); + } + + PyErr_Restore(xtype,xvalue,xtb); + } + else if (sa == args) + { + PyErr_Restore(xtype, xvalue, xtb); + } + else + { + // Discard the latest exception and restore the original one. + Py_XDECREF(xtype); + Py_XDECREF(xvalue); + Py_XDECREF(xtb); + + PyErr_Restore(oxtype, oxvalue, oxtb); + } + + break; + } + + // If this is the first attempt, save the exception. + if (sa == args) + { + oxtype = xtype; + oxvalue = xvalue; + oxtb = xtb; + } + else + { + Py_XDECREF(xtype); + Py_XDECREF(xvalue); + Py_XDECREF(xtb); + } + + // Create the new argument tuple. + if ((nsa = PyTuple_GetSlice(sa, 0, PyTuple_Size(sa) - 1)) == NULL) + { + // Tidy up. + Py_XDECREF(oxtype); + Py_XDECREF(oxvalue); + Py_XDECREF(oxtb); + + break; + } + + Py_DECREF(sa); + sa = nsa; + } + + Py_DECREF(sa); + + return 0; +} + + +// Clear the slot if it has an extra reference. +void PyQtSlot::clearOther() +{ + Py_CLEAR(other); +} + + +// Visit the slot if it has an extra reference. +int PyQtSlot::visitOther(visitproc visit, void *arg) +{ + Py_VISIT(other); + + return 0; +} diff --git a/qpy/QtCore/qpycore_pyqtslot.h b/qpy/QtCore/qpycore_pyqtslot.h new file mode 100644 index 0000000..2cd4805 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtslot.h @@ -0,0 +1,73 @@ +// This defines the definition of the PyQtSlot class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_PYQTSLOT_H +#define _QPYCORE_PYQTSLOT_H + + +#include + +#include "qpycore_chimera.h" + + +class PyQtSlot +{ +public: + enum Result + { + Succeeded, // The invocation was successful. + Failed, // The invocation failed. + Ignored // The invocation was ignored because the receiver has gone. + }; + + PyQtSlot(PyObject *callable, bool callable_is_method, + const Chimera::Signature *slot_signature); + ~PyQtSlot(); + + PyQtSlot::Result invoke(void **qargs, bool no_receiver_check) const; + bool invoke(void **qargs, PyObject *self, void *result) const; + const Chimera::Signature *slotSignature() const {return signature;} + + void clearOther(); + int visitOther(visitproc visit, void *arg); + + bool operator==(PyObject *callable) const; + +private: + PyQtSlot::Result invoke(void **qargs, PyObject *self, void *result, + bool no_receiver_check) const; + PyObject *call(PyObject *callable, PyObject *args) const; + PyObject *instance() const; + + PyObject *mfunc; + PyObject *mself; + PyObject *mself_wr; + PyObject *other; + + const Chimera::Signature *signature; + + // By forcing the use of pointers we don't need to worry about managing the + // reference counts of the component Python objects. + PyQtSlot(const PyQtSlot &); + PyQtSlot &operator=(const PyQtSlot &); +}; + + +#endif diff --git a/qpy/QtCore/qpycore_pyqtslotproxy.cpp b/qpy/QtCore/qpycore_pyqtslotproxy.cpp new file mode 100644 index 0000000..1d145fc --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtslotproxy.cpp @@ -0,0 +1,407 @@ +// This contains the implementation of the PyQtSlotProxy class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include + +#include "qpycore_api.h" +#include "qpycore_chimera.h" +#include "qpycore_qmetaobjectbuilder.h" +#include "qpycore_pyqtslot.h" +#include "qpycore_pyqtslotproxy.h" + +#include "sipAPIQtCore.h" + + +// Proxy flags. +#define PROXY_SINGLE_SHOT 0x01 // The slot will only be called once. +#define PROXY_SLOT_INVOKED 0x02 // The proxied slot is executing. +#define PROXY_SLOT_DISABLED 0x04 // The proxy deleteLater() has been called + // or should be called after the slot has + // finished executing. +#define PROXY_NO_RCVR_CHECK 0x08 // The existence of the receiver C++ object + // should not be checked. + + +// The last QObject sender. +QObject *PyQtSlotProxy::last_sender = 0; + + +// Create a universal proxy used as a slot. Note that this will leak if there +// is no transmitter and this is not a single shot slot. There will be no +// meta-object if there was a problem creating the proxy. This is called +// without the GIL. +PyQtSlotProxy::PyQtSlotProxy(PyObject *slot, QObject *q_tx, + const Chimera::Signature *slot_signature, bool single_shot) + : QObject(), proxy_flags(single_shot ? PROXY_SINGLE_SHOT : 0), + signature(slot_signature->signature), transmitter(q_tx) +{ + SIP_BLOCK_THREADS + real_slot = new PyQtSlot(slot, false, slot_signature); + SIP_UNBLOCK_THREADS + + // Create a new meta-object on the heap so that it looks like it has a slot + // of the right name and signature. + QMetaObjectBuilder builder; + + builder.setClassName("PyQtSlotProxy"); + builder.setSuperClass(&QObject::staticMetaObject); + + builder.addSlot("unislot()"); + builder.addSlot("disable()"); + + meta_object = builder.toMetaObject(); + + // Detect when any transmitter is destroyed. (Note that we used to do this + // by making the proxy a child of the transmitter. This doesn't work as + // expected because QWidget destroys its children before emitting the + // destroyed signal.) We use a queued connection in case the proxy is also + // connected to the same signal and we want to make sure it has a chance to + // invoke the slot before being destroyed. + if (transmitter) + { + // Add this one to the global hash. + mutex->lock(); + proxy_slots.insert(transmitter, this); + mutex->unlock(); + + connect(transmitter, SIGNAL(destroyed(QObject *)), SLOT(disable()), + Qt::QueuedConnection); + } +} + + +// Destroy a universal proxy. This is called without the GIL. +PyQtSlotProxy::~PyQtSlotProxy() +{ + Q_ASSERT((proxy_flags & PROXY_SLOT_INVOKED) == 0); + + if (transmitter) + { + mutex->lock(); + + ProxyHash::iterator it(proxy_slots.find(transmitter)); + ProxyHash::iterator end(proxy_slots.end()); + + while (it != end && it.key() == transmitter) + { + if (it.value() == this) + it = proxy_slots.erase(it); + else + ++it; + } + + mutex->unlock(); + } + + // Qt can still be tidying up after Python has gone so make sure that it + // hasn't. + if (Py_IsInitialized()) + { + SIP_BLOCK_THREADS + delete real_slot; + SIP_UNBLOCK_THREADS + } + + if (meta_object) + { + free(const_cast(meta_object)); + } +} + + +// The static members of PyQtSlotProxy. +const QByteArray PyQtSlotProxy::proxy_slot_signature(SLOT(unislot())); +QRecursiveMutex *PyQtSlotProxy::mutex; +PyQtSlotProxy::ProxyHash PyQtSlotProxy::proxy_slots; + + +const QMetaObject *PyQtSlotProxy::metaObject() const +{ + return meta_object; +} + + +void *PyQtSlotProxy::qt_metacast(const char *_clname) +{ + if (!_clname) + return 0; + + if (qstrcmp(_clname, "PyQtSlotProxy") == 0) + return static_cast(const_cast(this)); + + return QObject::qt_metacast(_clname); +} + + +int PyQtSlotProxy::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + + if (_id < 0) + return _id; + + if (_c == QMetaObject::InvokeMetaMethod) + { + switch (_id) + { + case 0: + unislot(_a); + break; + + case 1: + disable(); + break; + } + + _id -= 2; + } + + return _id; +} + + +// This is the universal slot itself that dispatches to the real slot. +void PyQtSlotProxy::unislot(void **qargs) +{ + // If we are marked as disabled (possible if a queued signal has been + // disconnected but there is still a signal in the event queue) then just + // ignore the call. + if (proxy_flags & PROXY_SLOT_DISABLED) + return; + + // sender() must be called without the GIL to avoid possible deadlocks + // between the GIL and Qt's internal thread data mutex. + QObject *new_last_sender = sender(); + + SIP_BLOCK_THREADS + + QObject *saved_last_sender = last_sender; + last_sender = new_last_sender; + + proxy_flags |= PROXY_SLOT_INVOKED; + + switch (real_slot->invoke(qargs, (proxy_flags & PROXY_NO_RCVR_CHECK))) + { + case PyQtSlot::Succeeded: + break; + + case PyQtSlot::Failed: + pyqt6_err_print(); + break; + + case PyQtSlot::Ignored: + proxy_flags |= PROXY_SLOT_DISABLED; + break; + } + + proxy_flags &= ~PROXY_SLOT_INVOKED; + + // Self destruct if we are a single shot or disabled. + if (proxy_flags & (PROXY_SINGLE_SHOT|PROXY_SLOT_DISABLED)) + { + // See the comment in disable() for why we deleteLater(). + deleteLater(); + } + + last_sender = saved_last_sender; + + SIP_UNBLOCK_THREADS +} + + +// Disable the slot by destroying it if possible, or delaying its destruction +// until the proxied slot returns. +void PyQtSlotProxy::disable() +{ + proxy_flags |= PROXY_SLOT_DISABLED; + + // Delete it if the slot isn't currently executing, otherwise it will be + // done after the slot returns. Note that we don't rely on deleteLater() + // providing the necessary delay because the slot could process the event + // loop and the proxy would be deleted too soon. + if ((proxy_flags & PROXY_SLOT_INVOKED) == 0) + { + // Despite what the Qt documentation suggests, if there are outstanding + // queued signals then we may crash so we always delete later when the + // event queue will have been flushed. + deleteLater(); + } +} + + +// Find a slot proxy connected to a transmitter. +PyQtSlotProxy *PyQtSlotProxy::findSlotProxy(const QObject *transmitter, + const QByteArray &signal_signature, PyObject *slot) +{ + PyQtSlotProxy *proxy = 0; + + mutex->lock(); + + ProxyHash::const_iterator it(proxy_slots.find(transmitter)); + ProxyHash::const_iterator end(proxy_slots.end()); + + while (it != end && it.key() == transmitter) + { + PyQtSlotProxy *sp = it.value(); + + if (!(sp->proxy_flags & PROXY_SLOT_DISABLED) && sp->signature == signal_signature && *(sp->real_slot) == slot) + { + proxy = sp; + break; + } + + ++it; + } + + mutex->unlock(); + + return proxy; +} + + +// Delete any slot proxy for a particular connection. +void PyQtSlotProxy::deleteSlotProxy(const QMetaObject::Connection *connection) +{ + mutex->lock(); + + ProxyHash::iterator it(proxy_slots.begin()); + ProxyHash::iterator end(proxy_slots.end()); + + while (it != end) + { + PyQtSlotProxy *sp = it.value(); + + if (sp->connection == *connection) + { + proxy_slots.erase(it); + sp->disable(); + + break; + } + + ++it; + } + + mutex->unlock(); +} + + +// Delete any slot proxies for a particular transmitter and optional signal +// signature. +void PyQtSlotProxy::deleteSlotProxies(const QObject *transmitter, + const QByteArray &signal_signature) +{ + mutex->lock(); + + ProxyHash::iterator it(proxy_slots.find(transmitter)); + ProxyHash::iterator end(proxy_slots.end()); + + while (it != end && it.key() == transmitter) + { + PyQtSlotProxy *sp = it.value(); + + if (signal_signature.isEmpty() || signal_signature == sp->signature) + { + it = proxy_slots.erase(it); + sp->disable(); + } + else + { + ++it; + } + } + + mutex->unlock(); +} + + +// Clear the extra references of any slots connected to a transmitter. This is +// called with the GIL. +int PyQtSlotProxy::clearSlotProxies(const QObject *transmitter) +{ + ProxyHash::iterator it(proxy_slots.find(transmitter)); + ProxyHash::iterator end(proxy_slots.end()); + + while (it != end && it.key() == transmitter) + { + it.value()->real_slot->clearOther(); + + ++it; + } + + return 0; +} + + +// A thing wrapper available to the generated code. +int qpycore_clearSlotProxies(const QObject *transmitter) +{ + return PyQtSlotProxy::clearSlotProxies(transmitter); +} + + +// Visit the extra references of any slots connected to a transmitter. This is +// called with the GIL. +int PyQtSlotProxy::visitSlotProxies(const QObject *transmitter, + visitproc visit, void *arg) +{ + int vret = 0; + + ProxyHash::iterator it(proxy_slots.find(transmitter)); + ProxyHash::iterator end(proxy_slots.end()); + + while (it != end && it.key() == transmitter) + { + if ((vret = it.value()->real_slot->visitOther(visit, arg)) != 0) + break; + + ++it; + } + + return vret; +} + + +// A thing wrapper available to the generated code. +int qpycore_visitSlotProxies(const QObject *transmitter, visitproc visit, + void *arg) +{ + return PyQtSlotProxy::visitSlotProxies(transmitter, visit, arg); +} + + +// Get the last sender. +QObject *PyQtSlotProxy::lastSender() +{ + return last_sender; +} + + +// Disable the check that the receiver C++ object exists before invoking a +// slot. +void PyQtSlotProxy::disableReceiverCheck() +{ + proxy_flags |= PROXY_NO_RCVR_CHECK; +} diff --git a/qpy/QtCore/qpycore_pyqtslotproxy.h b/qpy/QtCore/qpycore_pyqtslotproxy.h new file mode 100644 index 0000000..daf4ae6 --- /dev/null +++ b/qpy/QtCore/qpycore_pyqtslotproxy.h @@ -0,0 +1,116 @@ +// This contains the definition of the PyQtSlotProxy class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_PYQTSLOTPROXY_H +#define _QPYCORE_PYQTSLOTPROXY_H + + +#include + +#include +#include +#include +#include + +#include "qpycore_namespace.h" +#include "qpycore_chimera.h" + + +QT_BEGIN_NAMESPACE +class QRecursiveMutex; +QT_END_NAMESPACE + +class PyQtSlot; + + +// This class is implements a slot on behalf of Python callables. It is +// derived from QObject but is not run through moc. Instead the normal +// moc-generated methods are handwritten in order to implement a universal +// slot. This requires some knowledge of the internal structure of QObject but +// it is likely that they will only change between major Qt versions. +class PyQtSlotProxy : public QObject +{ +public: + PyQtSlotProxy(PyObject *slot, QObject *transmitter, + const Chimera::Signature *slot_signature, bool single_shot); + ~PyQtSlotProxy(); + + static const QMetaObject staticMetaObject; + virtual const QMetaObject *metaObject() const; + virtual void *qt_metacast(const char *); + virtual int qt_metacall(QMetaObject::Call, int, void **); + + void unislot(void **qargs); + void disable(); + + static void deleteSlotProxy(const QMetaObject::Connection *connection); + static void deleteSlotProxies(const QObject *transmitter, + const QByteArray &signal_signature); + static PyQtSlotProxy *findSlotProxy(const QObject *transmitter, + const QByteArray &signal_signature, PyObject *slot); + + void disableReceiverCheck(); + + static int clearSlotProxies(const QObject *transmitter); + static int visitSlotProxies(const QObject *transmitter, visitproc visit, + void *arg); + + static QObject *lastSender(); + + // The signature of the slot that receives connections. + static const QByteArray proxy_slot_signature; + + // The mutex around the proxies hash. + static QRecursiveMutex *mutex; + + // The connection to the proxy. + QMetaObject::Connection connection; + +private: + // The last QObject sender. + static QObject *last_sender; + + // The type of a proxy hash. + typedef QMultiHash ProxyHash; + + // The hash of proxies. + static ProxyHash proxy_slots; + + // The proxy flags. + int proxy_flags; + + // The normalised signature. + QByteArray signature; + + // The QObject transmitter the proxy will be connected to (if any). + const QObject *transmitter; + + // The slot we are proxying for. + PyQtSlot *real_slot; + + // The meta-object. + const QMetaObject *meta_object; + + PyQtSlotProxy(const PyQtSlotProxy &); + PyQtSlotProxy &operator=(const PyQtSlotProxy &); +}; + + +#endif diff --git a/qpy/QtCore/qpycore_qjsonvalue.cpp b/qpy/QtCore/qpycore_qjsonvalue.cpp new file mode 100644 index 0000000..2d78fd0 --- /dev/null +++ b/qpy/QtCore/qpycore_qjsonvalue.cpp @@ -0,0 +1,163 @@ +// This is the support for QJsonValue. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpycore_api.h" + +#include "sipAPIQtCore.h" + + +// See if a Python object can be converted to a QJsonValue. +int qpycore_canConvertTo_QJsonValue(PyObject *py) +{ + // Note that the API doesn't provide a test for constrained named enums. + if (PyObject_TypeCheck(py, sipTypeAsPyTypeObject(sipType_QJsonValue_Type))) + return 1; + + if (PyBool_Check(py)) + return 1; + + if (PyLong_Check(py)) + return 1; + + if (PyFloat_Check(py)) + return 1; + + if (sipCanConvertToType(py, sipType_QString, 0)) + return 1; + + // We must check for QJsonObject before QJsonArray. + if (sipCanConvertToType(py, sipType_QJsonObject, 0)) + return 1; + + // We must check for QJsonValue before QJsonArray. + if (sipCanConvertToType(py, sipType_QJsonValue, SIP_NO_CONVERTORS)) + return 1; + + return sipCanConvertToType(py, sipType_QJsonArray, 0); +} + + +// Convert a Python object to a QJsonValue. +int qpycore_convertTo_QJsonValue(PyObject *py, PyObject *transferObj, + QJsonValue **cpp, int *isErr) +{ + if (py == Py_None) + { + *cpp = new QJsonValue(); + + return sipGetState(transferObj); + } + + if (PyObject_TypeCheck(py, sipTypeAsPyTypeObject(sipType_QJsonValue_Type))) + { + int v = sipConvertToEnum(py, sipType_QJsonValue_Type); + + if (PyErr_Occurred()) + { + *isErr = 1; + return 0; + } + + *cpp = new QJsonValue(static_cast(v)); + + return sipGetState(transferObj); + } + + if (PyBool_Check(py)) + { + *cpp = new QJsonValue(py == Py_True); + + return sipGetState(transferObj); + } + + if (PyLong_Check(py)) + { + *cpp = new QJsonValue((qint64)PyLong_AsLong(py)); + + return sipGetState(transferObj); + } + + if (PyFloat_Check(py)) + { + *cpp = new QJsonValue((double)PyFloat_AsDouble(py)); + + return sipGetState(transferObj); + } + + if (sipCanConvertToType(py, sipType_QString, 0)) + { + int state; + QString *q = reinterpret_cast(sipConvertToType(py, + sipType_QString, 0, 0, &state, isErr)); + + if (*isErr) + return 0; + + *cpp = new QJsonValue(*q); + + sipReleaseType(q, sipType_QString, state); + + return sipGetState(transferObj); + } + + // We must check for QJsonObject before QJsonArray. + if (sipCanConvertToType(py, sipType_QJsonObject, 0)) + { + int state; + QJsonObject *q = reinterpret_cast(sipConvertToType(py, + sipType_QJsonObject, 0, 0, &state, isErr)); + + if (*isErr) + return 0; + + *cpp = new QJsonValue(*q); + + sipReleaseType(q, sipType_QJsonObject, state); + + return sipGetState(transferObj); + } + + // We must check for QJsonValue before QJsonArray. + if (sipCanConvertToType(py, sipType_QJsonValue, SIP_NO_CONVERTORS)) + { + *cpp = reinterpret_cast(sipConvertToType(py, + sipType_QJsonValue, transferObj, SIP_NO_CONVERTORS, 0, isErr)); + + return 0; + } + + // Now it is safe to convert to QJsonArray. + { + int state; + QJsonArray *q = reinterpret_cast(sipConvertToType(py, + sipType_QJsonArray, 0, 0, &state, isErr)); + + if (*isErr) + return 0; + + *cpp = new QJsonValue(*q); + + sipReleaseType(q, sipType_QJsonArray, state); + + return sipGetState(transferObj); + } +} diff --git a/qpy/QtCore/qpycore_qmessagelogger.cpp b/qpy/QtCore/qpycore_qmessagelogger.cpp new file mode 100644 index 0000000..a7d355a --- /dev/null +++ b/qpy/QtCore/qpycore_qmessagelogger.cpp @@ -0,0 +1,102 @@ +// This is the support for QMessageLogger. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpycore_api.h" + +#include "sipAPIQtCore.h" + + +// Return the current Python context. This should be called with the GIL. +int qpycore_current_context(const char **file, const char **function) +{ + static PyObject *currentframe = 0; + static PyObject *getframeinfo = 0; + static PyObject *saved_file = 0; + static PyObject *saved_function = 0; + + PyObject *frame, *info, *file_obj, *linenr_obj, *function_obj; + int linenr; + + frame = info = NULL; + + // Make sure we have what we need from the inspect module. + if (!currentframe || !getframeinfo) + { + PyObject *inspect = PyImport_ImportModule("inspect"); + + if (inspect) + { + if (!currentframe) + currentframe = PyObject_GetAttrString(inspect, "currentframe"); + + if (!getframeinfo) + getframeinfo = PyObject_GetAttrString(inspect, "getframeinfo"); + + Py_DECREF(inspect); + } + + if (!currentframe || !getframeinfo) + goto py_error; + } + + // Get the current frame. + if ((frame = PyObject_CallFunctionObjArgs(currentframe, NULL)) == NULL) + goto py_error; + + // Get the frame details. + if ((info = PyObject_CallFunctionObjArgs(getframeinfo, frame, NULL)) == NULL) + goto py_error;; + + if ((file_obj = PyTuple_GetItem(info, 0)) == NULL) + goto py_error; + + if ((linenr_obj = PyTuple_GetItem(info, 1)) == NULL) + goto py_error; + + if ((function_obj = PyTuple_GetItem(info, 2)) == NULL) + goto py_error; + + Py_XDECREF(saved_file); + saved_file = PyUnicode_AsEncodedString(file_obj, "latin_1", "ignore"); + *file = PyBytes_AsString(saved_file); + + // Ignore any overflow exception. + linenr = sipLong_AsInt(linenr_obj); + + Py_XDECREF(saved_function); + saved_function = PyUnicode_AsEncodedString(function_obj, "latin_1", "ignore"); + *function = PyBytes_AsString(saved_function); + + Py_DECREF(info); + Py_DECREF(frame); + + return linenr; + +py_error: + Py_XDECREF(info); + Py_XDECREF(frame); + + pyqt6_err_print(); + + *file = *function = ""; + return 0; +} diff --git a/qpy/QtCore/qpycore_qmetaobject.cpp b/qpy/QtCore/qpycore_qmetaobject.cpp new file mode 100644 index 0000000..9dfd414 --- /dev/null +++ b/qpy/QtCore/qpycore_qmetaobject.cpp @@ -0,0 +1,164 @@ +// This is the support code for QMetaObject. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include + +#include "qpycore_api.h" +#include "qpycore_chimera.h" +#include "qpycore_misc.h" + +#include "sipAPIQtCore.h" + + +// Forward declarations. +static PyObject *ArgumentStorage_New(PyObject *type, PyObject *data); +extern "C" {static void ArgumentStorage_delete(PyObject *cap);} + + +// Return a wrapped QGenericArgument for the given type and Python object. +PyObject *qpycore_ArgumentFactory(PyObject *type, PyObject *data) +{ + PyObject *as_obj = ArgumentStorage_New(type, data); + + if (!as_obj) + { + Chimera::raiseParseException(type, "a Q_ARG()"); + return 0; + } + + Chimera::Storage *st = reinterpret_cast( + PyCapsule_GetPointer(as_obj, NULL)); + + QGenericArgument *arg = new QGenericArgument( + st->type()->name().constData(), st->address()); + + PyObject *ga_obj = sipConvertFromNewType(arg, sipType_QGenericArgument, 0); + + if (ga_obj) + { + // Stash the storage in the user field so that everything will be + // properly garbage collected. + sipSetUserObject((sipSimpleWrapper *)ga_obj, as_obj); + } + else + { + delete arg; + Py_DECREF(as_obj); + } + + return ga_obj; +} + + +// Return a wrapped QGenericReturnArgument for the given type. +PyObject *qpycore_ReturnFactory(PyObject *type) +{ + PyObject *as_obj = ArgumentStorage_New(type, 0); + + if (!as_obj) + { + Chimera::raiseParseException(type, "a Q_RETURN_ARG()"); + return 0; + } + + Chimera::Storage *st = reinterpret_cast( + PyCapsule_GetPointer(as_obj, NULL)); + + QGenericReturnArgument *arg = new QGenericReturnArgument( + st->type()->name().constData(), st->address()); + + PyObject *gra_obj = sipConvertFromNewType(arg, + sipType_QGenericReturnArgument, 0); + + if (gra_obj) + { + // Stash the storage in the user field so that everything will be + // properly garbage collected. + sipSetUserObject((sipSimpleWrapper *)gra_obj, as_obj); + } + else + { + delete arg; + Py_DECREF(as_obj); + } + + return gra_obj; +} + + +// Return the Python result from a QGenericReturnArgument. +PyObject *qpycore_ReturnValue(PyObject *gra_obj) +{ + PyObject *as_obj = sipGetUserObject((sipSimpleWrapper *)gra_obj); + + Chimera::Storage *st = reinterpret_cast( + PyCapsule_GetPointer(as_obj, NULL)); + + return st->toPyObject(); +} + + +// The PyCapsule destructor for the ArgumentStorage type. +static void ArgumentStorage_delete(PyObject *cap) +{ + Chimera::Storage *st = reinterpret_cast( + PyCapsule_GetPointer(cap, NULL)); + const Chimera *ct = st->type(); + + delete st; + delete ct; +} + + +// Returns a Python object wrapping an ArgumentStorage instance. +static PyObject *ArgumentStorage_New(PyObject *type, PyObject *data) +{ + const Chimera *ct = Chimera::parse(type); + + if (!ct) + return 0; + + Chimera::Storage *st; + + if (data) + st = ct->fromPyObjectToStorage(data); + else + st = ct->storageFactory(); + + if (!st) + { + delete ct; + return 0; + } + + // Convert to a Python object. + PyObject *as_obj = PyCapsule_New(st, NULL, ArgumentStorage_delete); + + if (!as_obj) + { + delete st; + delete ct; + } + + return as_obj; +} diff --git a/qpy/QtCore/qpycore_qmetaobject_helpers.cpp b/qpy/QtCore/qpycore_qmetaobject_helpers.cpp new file mode 100644 index 0000000..c636728 --- /dev/null +++ b/qpy/QtCore/qpycore_qmetaobject_helpers.cpp @@ -0,0 +1,159 @@ +// This implements the helpers for QMetaObject. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include + +#include "qpycore_api.h" +#include "qpycore_chimera.h" +#include "qpycore_misc.h" +#include "qpycore_objectified_strings.h" +#include "qpycore_public_api.h" + +#include "sipAPIQtCore.h" + + +// Forward declarations. +static void connect(QObject *qobj, PyObject *slot_obj, + const QByteArray &slot_nm, const QByteArray &args); + + +void qpycore_qmetaobject_connectslotsbyname(QObject *qobj, + PyObject *qobj_wrapper) +{ + // Get the class attributes. + PyObject *dir = PyObject_Dir((PyObject *)Py_TYPE(qobj_wrapper)); + + if (!dir) + return; + + PyObject *slot_obj = 0; + + for (Py_ssize_t li = 0; li < PyList_Size(dir); ++li) + { + PyObject *name_obj = PyList_GetItem(dir, li); + + // Get the slot object. + Py_XDECREF(slot_obj); + slot_obj = PyObject_GetAttr(qobj_wrapper, name_obj); + + if (!slot_obj) + continue; + + // Ignore it if it is not a callable. + if (!PyCallable_Check(slot_obj)) + continue; + + // Use the signature attribute instead of the name if there is one. + PyObject *sigattr = PyObject_GetAttr(slot_obj, + qpycore_dunder_pyqtsignature); + + if (sigattr) + { + for (Py_ssize_t i = 0; i < PyList_Size(sigattr); ++i) + { + PyObject *decoration = PyList_GetItem(sigattr, i); + Chimera::Signature *sig = Chimera::Signature::fromPyObject(decoration); + QByteArray args = sig->arguments(); + + if (!args.isEmpty()) + connect(qobj, slot_obj, sig->name(), args); + } + + Py_DECREF(sigattr); + } + else + { + QByteArray name = qpycore_convert_ASCII(name_obj); + if (name.isNull()) + continue; + + PyErr_Clear(); + + connect(qobj, slot_obj, name, QByteArray()); + } + } + + Py_XDECREF(slot_obj); + Py_DECREF(dir); +} + + +// Connect up a particular slot name, with optional arguments. +static void connect(QObject *qobj, PyObject *slot_obj, + const QByteArray &slot_nm, const QByteArray &args) +{ + // Ignore if it's not an autoconnect slot. + if (!slot_nm.startsWith("on_")) + return; + + // Extract the names of the emitting object and the signal. + int i; + + i = slot_nm.lastIndexOf('_'); + + if (i - 3 < 1 || i + 1 >= slot_nm.size()) + return; + + QByteArray ename = slot_nm.mid(3, i - 3); + QByteArray sname = slot_nm.mid(i + 1); + + // Find the emitting object and get its meta-object. + QObject *eobj = qobj->findChild(ename); + + if (!eobj) + return; + + const QMetaObject *mo = eobj->metaObject(); + + // Got through the methods looking for a matching signal. + for (int m = 0; m < mo->methodCount(); ++m) + { + QMetaMethod mm = mo->method(m); + + if (mm.methodType() != QMetaMethod::Signal) + continue; + + QByteArray sig(mm.methodSignature()); + + if (Chimera::Signature::name(sig) != sname) + continue; + + // If we have slot arguments then they must match as well. + if (!args.isEmpty() && Chimera::Signature::arguments(sig) != args) + continue; + + QObject *receiver; + QByteArray slot_sig; + + if (pyqt6_get_connection_parts(slot_obj, eobj, sig.constData(), false, &receiver, slot_sig) != sipErrorNone) + continue; + + // Add the type character. + sig.prepend('2'); + + // Connect the signal. + QObject::connect(eobj, sig.constData(), receiver, slot_sig.constData()); + } +} diff --git a/qpy/QtCore/qpycore_qmetaobjectbuilder.h b/qpy/QtCore/qpycore_qmetaobjectbuilder.h new file mode 100644 index 0000000..7fb5832 --- /dev/null +++ b/qpy/QtCore/qpycore_qmetaobjectbuilder.h @@ -0,0 +1,124 @@ +// This defines the subset of the interface to Qt5's internal +// QMetaObjectBuilder class. The internal representation of a QMetaObject +// changed in Qt5 (specifically revision 7) sufficiently to justify using this +// internal code. The alternative would be to reverse engineer other internal +// data structures which would be even more fragile. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_QMETAOBJECTBUILDER_H +#define _QPYCORE_QMETAOBJECTBUILDER_H + + +#include +#include +#include + +QT_BEGIN_NAMESPACE + + +class QMetaEnumBuilder; +class QMetaMethodBuilder; +class QMetaPropertyBuilder; + + +class Q_CORE_EXPORT QMetaObjectBuilder +{ +public: + QMetaObjectBuilder(); + virtual ~QMetaObjectBuilder(); + + void setClassName(const QByteArray &name); + void setSuperClass(const QMetaObject *meta); + QMetaMethodBuilder addSlot(const QByteArray &signature); + QMetaMethodBuilder addSignal(const QByteArray &signature); + QMetaPropertyBuilder addProperty(const QByteArray &name, + const QByteArray &type, int notifierId=-1); + QMetaEnumBuilder addEnumerator(const QByteArray &name); + int addClassInfo(const QByteArray &name, const QByteArray &value); + int addRelatedMetaObject(const QMetaObject *meta); + int indexOfSignal(const QByteArray &signature); + QMetaObject *toMetaObject() const; + +private: + Q_DISABLE_COPY(QMetaObjectBuilder) + + void *d; +}; + + +class Q_CORE_EXPORT QMetaMethodBuilder +{ +public: + QMetaMethodBuilder() : _mobj(0), _index(0) {} + + void setReturnType(const QByteArray &type); + void setParameterNames(const QList ¶meter_names); + void setRevision(int revision); + +private: + const QMetaObjectBuilder *_mobj; + int _index; +}; + + +class Q_CORE_EXPORT QMetaPropertyBuilder +{ +public: + QMetaPropertyBuilder() : _mobj(0), _index(0) {} + + void setReadable(bool value); + void setWritable(bool value); + void setResettable(bool value); + void setDesignable(bool value); + void setScriptable(bool value); + void setStored(bool value); + void setUser(bool value); + void setStdCppSet(bool value); + void setEnumOrFlag(bool value); + void setConstant(bool value); + void setFinal(bool value); + void setAlias(bool value); + void setBindable(bool value); + void setRevision(int revision); + +private: + const QMetaObjectBuilder *_mobj; + int _index; +}; + + +class Q_CORE_EXPORT QMetaEnumBuilder +{ +public: + QMetaEnumBuilder() : _mobj(0), _index(0) {} + + void setIsFlag(bool value); + void setIsScoped(bool value); + int addKey(const QByteArray &name, int value); + +private: + const QMetaObjectBuilder *_mobj; + int _index; +}; + + +QT_END_NAMESPACE + +#endif diff --git a/qpy/QtCore/qpycore_qobject_getattr.cpp b/qpy/QtCore/qpycore_qobject_getattr.cpp new file mode 100644 index 0000000..98e26e4 --- /dev/null +++ b/qpy/QtCore/qpycore_qobject_getattr.cpp @@ -0,0 +1,131 @@ +// This implements the helper for QObject.__getattr__(). +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include + +#include "qpycore_api.h" +#include "qpycore_pyqtboundsignal.h" +#include "qpycore_pyqtmethodproxy.h" +#include "qpycore_pyqtsignal.h" + + +// See if we can find an attribute in the Qt meta-type system. This is +// primarily to support access to JavaScript (e.g. QQuickItem) so we don't +// support overloads. +PyObject *qpycore_qobject_getattr(const QObject *qobj, PyObject *py_qobj, + const char *name) +{ + const QMetaObject *mo = qobj->metaObject(); + + // Try and find a method with the name. + QMetaMethod method; + int method_index = -1; + + // Count down to allow overrides (assuming they are possible). + for (int m = mo->methodCount() - 1; m >= 0; --m) + { + method = mo->method(m); + + if (method.methodType() == QMetaMethod::Constructor) + continue; + + // Get the method name. + QByteArray mname(method.methodSignature()); + int idx = mname.indexOf('('); + + if (idx >= 0) + mname.truncate(idx); + + if (mname == name) + { + method_index = m; + break; + } + } + + if (method_index >= 0) + { + // Get the value to return. Note that this is recreated each time. We + // could put a descriptor in the type dictionary to satisfy the request + // in future but the typical use case is getting a value from a C++ + // proxy (e.g. QDeclarativeItem) and we can't assume that what is being + // proxied is the same each time. + if (method.methodType() == QMetaMethod::Signal) + { + // We need to keep explicit references to the unbound signals + // (because we don't use the type dictionary to do so) because they + // own the parsed signature which may be needed by a PyQtSlotProxy + // at some point. + typedef QHash SignalHash; + + static SignalHash *sig_hash = 0; + + // For crappy compilers. + if (!sig_hash) + sig_hash = new SignalHash; + + PyObject *sig_obj; + + QByteArray sig_str = method.methodSignature(); + + SignalHash::const_iterator it = sig_hash->find(sig_str); + + if (it == sig_hash->end()) + { + sig_obj = (PyObject *)qpycore_pyqtSignal_New( + sig_str.constData()); + + if (!sig_obj) + return 0; + + sig_hash->insert(sig_str, sig_obj); + } + else + { + sig_obj = it.value(); + } + + return qpycore_pyqtBoundSignal_New((qpycore_pyqtSignal *)sig_obj, + py_qobj, const_cast(qobj)); + } + + // Respect the 'private' nature of __ names. + if (name[0] != '_' || name[1] != '_') + { + QByteArray py_name(sipPyTypeName(Py_TYPE(py_qobj))); + py_name.append('.'); + py_name.append(name); + + return qpycore_pyqtMethodProxy_New(const_cast(qobj), + method_index, py_name); + } + } + + // Replicate the standard Python exception. + PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", + sipPyTypeName(Py_TYPE(py_qobj)), name); + + return 0; +} diff --git a/qpy/QtCore/qpycore_qobject_helpers.cpp b/qpy/QtCore/qpycore_qobject_helpers.cpp new file mode 100644 index 0000000..9ec8c91 --- /dev/null +++ b/qpy/QtCore/qpycore_qobject_helpers.cpp @@ -0,0 +1,291 @@ +// This implements the helpers for QObject. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include +#include +#include +#include + +#include "qpycore_api.h" +#include "qpycore_chimera.h" +#include "qpycore_misc.h" +#include "qpycore_objectified_strings.h" +#include "qpycore_pyqtboundsignal.h" +#include "qpycore_pyqtproperty.h" +#include "qpycore_pyqtpyobject.h" +#include "qpycore_pyqtslot.h" +#include "qpycore_qobject_helpers.h" +#include "qpycore_types.h" + +#include "sipAPIQtCore.h" + + +// Forward declarations. +static int qt_metacall_worker(sipSimpleWrapper *pySelf, PyTypeObject *pytype, + sipTypeDef *base, QMetaObject::Call _c, int _id, void **_a); + + +// This is the helper for all implementations of QObject::metaObject(). +const QMetaObject *qpycore_qobject_metaobject(sipSimpleWrapper *pySelf, + sipTypeDef *base) +{ + sipWrapperType *wt = (pySelf ? (sipWrapperType *)Py_TYPE(pySelf) : 0); + + return qpycore_get_qmetaobject(wt, base); +} + + +// This is the helper for all implementations of QObject::qt_metacall(). +int qpycore_qobject_qt_metacall(sipSimpleWrapper *pySelf, sipTypeDef *base, + QMetaObject::Call _c, int _id, void **_a) +{ + // Check if the Python object has gone. + if (!pySelf) + return -1; + + return qt_metacall_worker(pySelf, Py_TYPE(pySelf), base, _c, _id, _a); +} + + +// This does the real work for all implementations of QObject::qt_metacall(). +static int qt_metacall_worker(sipSimpleWrapper *pySelf, PyTypeObject *pytype, + sipTypeDef *base, QMetaObject::Call _c, int _id, void **_a) +{ + // See if this is a wrapped C++ type rather than a Python sub-type. + if (pytype == sipTypeAsPyTypeObject(base)) + return _id; + + PyTypeObject *tp_base = reinterpret_cast( + PyType_GetSlot(pytype, Py_tp_base)); + + _id = qt_metacall_worker(pySelf, tp_base, base, _c, _id, _a); + + if (_id < 0) + return _id; + + const qpycore_metaobject *qo = qpycore_get_dynamic_metaobject( + (sipWrapperType *)pytype); + + bool ok = true; + + if (_c == QMetaObject::InvokeMetaMethod) + { + if (_id < qo->nr_signals + qo->pslots.count()) + { + if (_id < qo->nr_signals) + { + QObject *qthis = reinterpret_cast(sipGetCppPtr(pySelf, sipType_QObject)); + + Py_BEGIN_ALLOW_THREADS + QMetaObject::activate(qthis, qo->mo, _id, _a); + Py_END_ALLOW_THREADS + } + else + { + PyQtSlot *slot = qo->pslots.at(_id - qo->nr_signals); + + ok = slot->invoke(_a, (PyObject *)pySelf, _a[0]); + } + } + + _id -= qo->nr_signals + qo->pslots.count(); + } + else if (_c == QMetaObject::ReadProperty) + { + if (_id < qo->pprops.count()) + { + qpycore_pyqtProperty *prop = qo->pprops.at(_id); + + if (prop->pyqtprop_get) + { + PyObject *py = PyObject_CallFunction(prop->pyqtprop_get, + const_cast("O"), pySelf); + + if (py) + { + ok = prop->pyqtprop_parsed_type->fromPyObject(py, _a[0]); + Py_DECREF(py); + } + else + { + ok = false; + } + } + } + + _id -= qo->pprops.count(); + } + else if (_c == QMetaObject::WriteProperty) + { + if (_id < qo->pprops.count()) + { + qpycore_pyqtProperty *prop = qo->pprops.at(_id); + + if (prop->pyqtprop_set) + { + PyObject *py = prop->pyqtprop_parsed_type->toPyObject(_a[0]); + + if (py) + { + PyObject *res = PyObject_CallFunction(prop->pyqtprop_set, + const_cast("OO"), pySelf, py); + + if (res) + Py_DECREF(res); + else + ok = false; + + Py_DECREF(py); + } + else + { + ok = false; + } + } + } + + _id -= qo->pprops.count(); + } + else if (_c == QMetaObject::ResetProperty) + { + if (_id < qo->pprops.count()) + { + qpycore_pyqtProperty *prop = qo->pprops.at(_id); + + if (prop->pyqtprop_reset) + { + PyObject *py = PyObject_CallFunction(prop->pyqtprop_reset, + const_cast("O"), pySelf); + + if (py) + Py_DECREF(py); + else + ok = false; + } + } + + _id -= qo->pprops.count(); + } + + // Handle any Python errors. + if (!ok) + { + pyqt6_err_print(); + return -1; + } + + return _id; +} + + +// This is the helper for all implementations of QObject::qt_metacast(). +bool qpycore_qobject_qt_metacast(sipSimpleWrapper *pySelf, + const sipTypeDef *base, const char *_clname, void **sipCpp) +{ + *sipCpp = 0; + + if (!_clname) + return false; + + // Check if the Python object has gone. + if (!pySelf) + return false; + + bool is_py_class = false; + + SIP_BLOCK_THREADS + + PyTypeObject *base_pytype = sipTypeAsPyTypeObject(base); + + // We only need to look at the MRO if the object is a wrapped type (rather + // than a user sub-class). + if (base_pytype != Py_TYPE(pySelf)) + { + PyObject *mro = PyObject_GetAttr((PyObject *)Py_TYPE(pySelf), + qpycore_dunder_mro); + Q_ASSERT(mro); + + for (Py_ssize_t i = 0; i < PyTuple_Size(mro); ++i) + { + PyTypeObject *pytype = (PyTypeObject *)PyTuple_GetItem(mro, i); + + const sipTypeDef *td = sipTypeFromPyTypeObject(pytype); + + if (!td || !qpycore_is_pyqt_type(td)) + continue; + + if (qstrcmp(sipPyTypeName(pytype), _clname) == 0) + { + // The generated type definitions represent the C++ (rather + // than Python) hierachy. If the C++ hierachy doesn't match + // then the super-type must be provided by a mixin. Note that + // we check the type in both "directions" as we may be either + // "side" of the base type in the MRO. + if (PyType_IsSubtype(pytype, base_pytype) || PyType_IsSubtype(base_pytype, pytype)) + *sipCpp = sipGetAddress(pySelf); + else + *sipCpp = sipGetMixinAddress(pySelf, td); + + is_py_class = true; + break; + } + + const pyqt6ClassPluginDef *plugin = reinterpret_cast(sipTypePluginData(td)); + + if (plugin && plugin->qt_interface && qstrcmp(plugin->qt_interface, _clname) == 0) + { + *sipCpp = sipGetMixinAddress(pySelf, td); + is_py_class = true; + break; + } + } + + Py_DECREF(mro); + } + + SIP_UNBLOCK_THREADS + + return is_py_class; +} + + +// This is a helper for QObject.staticMetaObject %GetCode. +PyObject *qpycore_qobject_staticmetaobject(PyObject *type_obj) +{ + const QMetaObject *mo = qpycore_get_qmetaobject((sipWrapperType *)type_obj); + + if (!mo) + { + // We assume that this is a side effect of a wrapped class not being + // fully ready until sip's meta-class's __init__() has run (rather than + // after its __new__() method as might be expected). + PyErr_SetString(PyExc_AttributeError, + "staticMetaObject isn't available until the meta-class's __init__ returns"); + + return 0; + } + + return sipConvertFromType(const_cast(mo), + sipType_QMetaObject, 0); +} diff --git a/qpy/QtCore/qpycore_qobject_helpers.h b/qpy/QtCore/qpycore_qobject_helpers.h new file mode 100644 index 0000000..e93fd71 --- /dev/null +++ b/qpy/QtCore/qpycore_qobject_helpers.h @@ -0,0 +1,40 @@ +// This defines the interfaces of the helpers for QObject. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_QOBJECT_HELPERS_H +#define _QPYCORE_QOBJECT_HELPERS_H + + +#include + +#include + +#include "sipAPIQtCore.h" + + +const QMetaObject *qpycore_qobject_metaobject(sipSimpleWrapper *pySelf, + sipTypeDef *base); +int qpycore_qobject_qt_metacall(sipSimpleWrapper *pySelf, sipTypeDef *base, + QMetaObject::Call _c, int _id, void **_a); +bool qpycore_qobject_qt_metacast(sipSimpleWrapper *pySelf, + const sipTypeDef *base, const char *_clname, void **); + + +#endif diff --git a/qpy/QtCore/qpycore_qstring.cpp b/qpy/QtCore/qpycore_qstring.cpp new file mode 100644 index 0000000..e403480 --- /dev/null +++ b/qpy/QtCore/qpycore_qstring.cpp @@ -0,0 +1,147 @@ +// This is the support for QString. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include +#include + +#include +#include + +#include "qpycore_api.h" + +#include "sipAPIQtCore.h" + + +// Convert a QString to a Python Unicode object. +PyObject *qpycore_PyObject_FromQString(const QString &qstr) +{ + PyObject *obj; + int qt_len = qstr.length(); + int kind; + void *data; + + // We have to work out exactly which kind to use. We assume ASCII while we + // are checking so that we only go through the string once in the most + // common case. Note that we can't use PyUnicode_FromKindAndData() because + // it doesn't handle surrogates in UCS2 strings. + + if ((obj = sipUnicodeNew(qt_len, 0x007f, &kind, &data)) == NULL) + return NULL; + + const QChar *qch = qstr.constData(); + + for (int qt_i = 0; qt_i < qt_len; ++qt_i) + { + ushort uch = qch->unicode(); + + if (uch > 0x007f) + { + // This is useless. + Py_DECREF(obj); + + // Work out what kind we really need and what the Python length + // should be. + uint maxchar = 0x00ff; + + int py_len = qt_len; + + while (qt_i < qt_len) + { + uch = qch->unicode(); + + if (uch > 0x00ff) + { + if (maxchar == 0x00ff) + maxchar = 0x00ffff; + + // See if this is a surrogate pair. Note that we cannot + // trust that the QString is terminated by a null QChar. + if (qch->isHighSurrogate() && qt_i + 1 < qt_len && (qch + 1)->isLowSurrogate()) + { + maxchar = 0x10ffff; + --py_len; + ++qch; + ++qt_i; + } + } + + ++qch; + ++qt_i; + } + + // Create the correctly sized object. + if ((obj = sipUnicodeNew(py_len, maxchar, &kind, &data)) == NULL) + return NULL; + + qch = qstr.constData(); + + int qt_i2 = 0; + + for (int py_i = 0; py_i < py_len; ++py_i) + { + uint py_ch; + + if (qch->isHighSurrogate() && qt_i2 + 1 < qt_len && (qch + 1)->isLowSurrogate()) + { + py_ch = QChar::surrogateToUcs4(*qch, *(qch + 1)); + ++qt_i2; + ++qch; + } + else + { + py_ch = qch->unicode(); + } + + ++qt_i2; + ++qch; + + sipUnicodeWrite(kind, data, py_i, py_ch); + } + + break; + } + + ++qch; + + sipUnicodeWrite(kind, data, qt_i, uch); + } + + return obj; +} + + +// Convert a Python string object to a QString. +QString qpycore_PyObject_AsQString(PyObject *obj) +{ + int char_size; + Py_ssize_t len; + void *data = sipUnicodeData(obj, &char_size, &len); + + if (char_size == 1) + return QString::fromLatin1(reinterpret_cast(data), len); + + if (char_size == 2) + return QString::fromUtf16(reinterpret_cast(data), len); + + if (char_size == 4) + return QString::fromUcs4(reinterpret_cast(data), len); + + return QString(); +} diff --git a/qpy/QtCore/qpycore_qt_conf.cpp b/qpy/QtCore/qpycore_qt_conf.cpp new file mode 100644 index 0000000..97c9be2 --- /dev/null +++ b/qpy/QtCore/qpycore_qt_conf.cpp @@ -0,0 +1,118 @@ +// This is the implementatation of an embedded qt.conf file. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include + +#include "qpycore_api.h" + + +static const unsigned char qt_resource_name[] = { + // qt + 0x0,0x2, + 0x0,0x0,0x7,0x84, + 0x0,0x71, + 0x0,0x74, + // etc + 0x0,0x3, + 0x0,0x0,0x6c,0xa3, + 0x0,0x65, + 0x0,0x74,0x0,0x63, + // qt.conf + 0x0,0x7, + 0x8,0x74,0xa6,0xa6, + 0x0,0x71, + 0x0,0x74,0x0,0x2e,0x0,0x63,0x0,0x6f,0x0,0x6e,0x0,0x66, + +}; + +static const unsigned char qt_resource_struct[] = { + // : + 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1, + // :/qt + 0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x2, + // :/qt/etc + 0x0,0x0,0x0,0xa,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x3, + // :/qt/etc/qt.conf + 0x0,0x0,0x0,0x16,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0, + +}; + + +QT_BEGIN_NAMESPACE +bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, + const unsigned char *); +QT_END_NAMESPACE + + +// Embed a qt.conf file. +bool qpycore_qt_conf() +{ + // Get PyQt6.__file__. + PyObject *pyqt = PyImport_ImportModule("PyQt6"); + + if (!pyqt) + return false; + + PyObject *init = PyObject_GetAttrString(pyqt, "__file__"); + Py_DECREF(pyqt); + + if (!init) + return false; + + QString init_impl(qpycore_PyObject_AsQString(init)); + Py_DECREF(init); + + if (init_impl.isEmpty()) + return false; + + // Get the directory containing the PyQt6 extension modules. + QDir pyqt_dir = QFileInfo(QDir::fromNativeSeparators(init_impl)).absoluteDir(); + QString qt_dir_name = pyqt_dir.absoluteFilePath(QLatin1String("Qt6")); + + // Check if there is a bundled copy of Qt. + if (QFileInfo(qt_dir_name).exists()) + { + // Get the prefix path with non-native separators. + static QByteArray qt_conf = qt_dir_name.toUtf8(); + + qt_conf.prepend("[Paths]\nPrefix = "); + qt_conf.append("\n"); + + // Prepend the 4-byte size. + int size = qt_conf.size(); + + for (int i = 0; i < 4; ++i) + { + qt_conf.prepend(size & 0xff); + size >>= 8; + } + + // Register the structures. + qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, + (const unsigned char *)qt_conf.constData()); + } + + return true; +} diff --git a/qpy/QtCore/qpycore_qvariant.cpp b/qpy/QtCore/qpycore_qvariant.cpp new file mode 100644 index 0000000..6658f3a --- /dev/null +++ b/qpy/QtCore/qpycore_qvariant.cpp @@ -0,0 +1,79 @@ +// This is the support for QVariant. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include + +#include "qpycore_api.h" +#include "qpycore_chimera.h" + + +// Return the Python object from the variant. +PyObject *qpycore_PyObject_FromQVariant(const QVariant &qvar) +{ + return Chimera::toAnyPyObject(qvar); +} + + +// Return a variant containing the Python object. It will be converted to a +// C++ instance if possible (ie. if it is a fundamental type or a direct +// wrapped type). Otherwise it is left as a Python object (with an increased +// reference count). An exception is raised if there was a conversion error. +// (The type of the object will never be the cause of an error.) +QVariant qpycore_PyObject_AsQVariant(PyObject *obj, int *is_err) +{ + return Chimera::fromAnyPyObject(obj, is_err); +} + + +// Return the Python object from the variant using the information provided by +// a QMetaProperty. +PyObject *qpycore_PyObject_FromQVariant(const QMetaProperty &mprop, + const QVariant &qvar) +{ + if (!qvar.isValid()) + { + Py_INCREF(Py_None); + return Py_None; + } + + const Chimera *ct = Chimera::parse(mprop); + PyObject *py = ct->toPyObject(qvar); + delete ct; + + return py; +} + + +// Return a variant containing the Python object using the information provided +// by a QMetaProperty. An exception is raised if there was a conversion error. +// (The type of the object will never be the cause of an error.) +QVariant qpycore_PyObject_AsQVariant(const QMetaProperty &mprop, PyObject *obj, + bool *ok) +{ + const Chimera *ct = Chimera::parse(mprop); + QVariant value; + *ok = ct->fromPyObject(obj, &value); + delete ct; + + return value; +} diff --git a/qpy/QtCore/qpycore_qvariant_value.cpp b/qpy/QtCore/qpycore_qvariant_value.cpp new file mode 100644 index 0000000..a90e0e2 --- /dev/null +++ b/qpy/QtCore/qpycore_qvariant_value.cpp @@ -0,0 +1,228 @@ +// This implements the conversion of a QVariant to a Python object and is part +// of the public API. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include + +#include "qpycore_chimera.h" + +#include "sipAPIQtCore.h" + + +// Forward declarations. +static PyObject *convert_hash(const Chimera *ct, const QVariantHash &value); +static PyObject *convert_list(const Chimera *ct, const QVariantList &value); +static PyObject *convert_map(const Chimera *ct, const QVariantMap &value); +static PyObject *convert(const Chimera *ct, const QVariant &value); +static int add_variant_to_dict(const Chimera *ct, PyObject *dict, + const QString &key, const QVariant &value); + + +// Convert a QVariant to a Python object according to an optional type. +PyObject *pyqt6_from_qvariant_by_type(QVariant &value, PyObject *type) +{ + PyObject *value_obj; + + if (type) + { + const Chimera *ct = Chimera::parse(type); + + if (!ct) + return 0; + + int wanted = ct->metatype.id(); + + // Get QVariant to do a conversion if there is one to do. + if (value.isValid() && ct->metatype.id() < QMetaType::User) + { + int value_type = value.metaType().id(); + + // If we have a QStringList but are not wanting one then convert it + // to a QVariantList. + if (wanted != QMetaType::QStringList && value_type == QMetaType::QStringList) + { + value.convert(QMetaType(QMetaType::QVariantList)); + value_type = QMetaType::QVariantList; + } + + // If we have a container but are not wanting one then assume we + // want a container with elements of the wanted type. + if (wanted != QMetaType::QVariantList && value_type == QMetaType::QVariantList) + { + // If we have a QVariantList but we wanted a QStringList then + // assume each variant is a string. + if (wanted == QMetaType::QStringList) + value_obj = convert(ct, value); + else + value_obj = convert_list(ct, value.toList()); + } + else if (wanted != QMetaType::QVariantMap && value_type == QMetaType::QVariantMap) + { + value_obj = convert_map(ct, value.toMap()); + } + else if (wanted != QMetaType::QVariantHash && value_type == QMetaType::QVariantHash) + { + value_obj = convert_hash(ct, value.toHash()); + } + else + { + value_obj = convert(ct, value); + } + } + else if (!value.isValid()) + { + // Convert an invalid value to the default value of the requested + // type. + if (ct->py_type()) + value_obj = PyObject_CallObject(ct->py_type(), NULL); + else + value_obj = ct->toPyObject(QVariant(QMetaType(wanted))); + } + else + { + // This is likely to fail and the exception will say why. + value_obj = ct->toPyObject(value); + } + + delete ct; + } + else + { + QVariant *heap = new QVariant(value); + value_obj = sipConvertFromNewType(heap, sipType_QVariant, 0); + + if (!value_obj) + delete heap; + } + + return value_obj; +} + + +// Convert a QVariantList to a list of Python objects. +static PyObject *convert_list(const Chimera *ct, const QVariantList &value) +{ + PyObject *list = PyList_New(value.size()); + + if (!list) + return 0; + + for (int i = 0; i < value.size(); ++i) + { + PyObject *el = convert(ct, value.at(i)); + + if (!el) + { + Py_DECREF(list); + return 0; + } + + PyList_SetItem(list, i, el); + } + + return list; +} + + +// Convert a QVariantMap to a dict of Python objects. +static PyObject *convert_map(const Chimera *ct, const QVariantMap &value) +{ + PyObject *dict = PyDict_New(); + + if (!dict) + return 0; + + for (QVariantMap::const_iterator it = value.constBegin(); it != value.constEnd(); ++it) + { + if (add_variant_to_dict(ct, dict, it.key(), it.value()) < 0) + { + Py_DECREF(dict); + return 0; + } + } + + return dict; +} + + +// Convert a QVariantHash to a dict of Python objects. +static PyObject *convert_hash(const Chimera *ct, const QVariantHash &value) +{ + PyObject *dict = PyDict_New(); + + if (!dict) + return 0; + + for (QVariantHash::const_iterator it = value.constBegin(); it != value.constEnd(); ++it) + { + if (add_variant_to_dict(ct, dict, it.key(), it.value()) < 0) + { + Py_DECREF(dict); + return 0; + } + } + + return dict; +} + + +// Convert a QVariant to a Python object. +static PyObject *convert(const Chimera *ct, const QVariant &value) +{ + QVariant converted = value; + + if (!converted.convert(ct->metatype)) + converted = value; + + return ct->toPyObject(converted); +} + + +// Add a QVariant to a Python dict with a QString key. +static int add_variant_to_dict(const Chimera *ct, PyObject *dict, + const QString &key, const QVariant &value) +{ + QString *key_heap = new QString(key); + PyObject *key_obj = sipConvertFromNewType(key_heap, sipType_QString, 0); + + if (!key_obj) + { + delete key_heap; + return -1; + } + + PyObject *value_obj = convert(ct, value); + + if (!value_obj) + { + Py_DECREF(key_obj); + return -1; + } + + int rc = PyDict_SetItem(dict, key_obj, value_obj); + + Py_DECREF(key_obj); + Py_DECREF(value_obj); + + return rc; +} diff --git a/qpy/QtCore/qpycore_types.cpp b/qpy/QtCore/qpycore_types.cpp new file mode 100644 index 0000000..58e48b9 --- /dev/null +++ b/qpy/QtCore/qpycore_types.cpp @@ -0,0 +1,530 @@ +// This contains the meta-type used by PyQt. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include +#include +#include + +#include "qpycore_chimera.h" +#include "qpycore_classinfo.h" +#include "qpycore_enums_flags.h" +#include "qpycore_misc.h" +#include "qpycore_objectified_strings.h" +#include "qpycore_pyqtproperty.h" +#include "qpycore_pyqtsignal.h" +#include "qpycore_pyqtslot.h" +#include "qpycore_qmetaobjectbuilder.h" +#include "qpycore_types.h" + +#include "sipAPIQtCore.h" + + +// A tuple of the property name and definition. +typedef QPair PropertyData; + + +// Forward declarations. +static int trawl_hierarchy(PyTypeObject *pytype, qpycore_metaobject *qo, + QMetaObjectBuilder &builder, QList &penums, + QList &psigs, + QMap &pprops); +static int trawl_type(PyTypeObject *pytype, qpycore_metaobject *qo, + QMetaObjectBuilder &builder, QList &penums, + QList &psigs, + QMap &pprops); +static const QMetaObject *get_scope_qmetaobject(const Chimera *ct); + + +// Create a dynamic meta-object for a Python type by introspecting its +// attributes. Note that it leaks if the type is deleted. +const qpycore_metaobject *qpycore_get_dynamic_metaobject(sipWrapperType *wt) +{ + qpycore_metaobject *qo = reinterpret_cast( + sipGetTypeUserData(wt)); + + // Return any QMetaObject from a previous call. + if (qo) + return qo; + + PyTypeObject *pytype = (PyTypeObject *)wt; + + const pyqt6ClassPluginDef *plugin = reinterpret_cast(sipTypePluginData(sipTypeFromPyTypeObject(pytype))); + + // Only create a dynamic meta-object if its base wrapped type has a static + // Qt meta-object. + if (!plugin || !plugin->static_metaobject) + return 0; + + QMetaObjectBuilder builder; + + // Get the super-type's meta-object. + PyTypeObject *tp_base = reinterpret_cast( + PyType_GetSlot(pytype, Py_tp_base)); + + builder.setSuperClass(qpycore_get_qmetaobject((sipWrapperType *)tp_base)); + + // Get the name of the type. Dynamic types have simple names. + builder.setClassName(sipPyTypeName(pytype)); + + // Go through the class hierarchy getting all PyQt enums, properties, slots + // and signals. + + QList penums; + QList psigs; + QMap pprops; + + qo = new qpycore_metaobject; + + if (trawl_hierarchy(pytype, qo, builder, penums, psigs, pprops) < 0) + return 0; + + qo->nr_signals = psigs.count(); + + // Initialise the header section of the data table. Note that Qt v4.5 + // introduced revision 2 which added constructors. However the design is + // broken in that the static meta-call function doesn't provide enough + // information to determine which Python sub-class of a Qt class is to be + // created. So we stick with revision 1 (and don't allow pyqtSlot() to + // decorate __init__). + + // Set up any class information. + QList class_info_list = qpycore_pop_class_info_list( + (PyObject *)pytype); + + for (int i = 0; i < class_info_list.length(); ++i) + { + const ClassInfo &ci = class_info_list.at(i); + + builder.addClassInfo(ci.first, ci.second); + } + + // Set up any enums/flags. + for (int i = 0; i < penums.count(); ++i) + { + const EnumFlag &ef = penums.at(i); + + QMetaEnumBuilder enum_builder = builder.addEnumerator(ef.name); + enum_builder.setIsFlag(ef.isFlag); + enum_builder.setIsScoped(true); + + QList >::const_iterator it = ef.keys.constBegin(); + + while (it != ef.keys.constEnd()) + { + enum_builder.addKey(it->first, it->second); + ++it; + } + } + + // Add the signals to the meta-object. + for (int g = 0; g < qo->nr_signals; ++g) + { + const qpycore_pyqtSignal *ps = psigs.at(g); + + QMetaMethodBuilder signal_builder = builder.addSignal( + ps->parsed_signature->signature.mid(1)); + + if (ps->parameter_names) + signal_builder.setParameterNames(*ps->parameter_names); + + signal_builder.setRevision(ps->revision); + } + + // Add the slots to the meta-object. + for (int s = 0; s < qo->pslots.count(); ++s) + { + const Chimera::Signature *slot_signature = qo->pslots.at(s)->slotSignature(); + const QByteArray &sig = slot_signature->signature; + + QMetaMethodBuilder slot_builder = builder.addSlot(sig); + + // Add any type. + if (slot_signature->result) + slot_builder.setReturnType(slot_signature->result->name()); + + slot_builder.setRevision(slot_signature->revision); + } + + // Add the properties to the meta-object. + QMapIterator it(pprops); + + for (int p = 0; it.hasNext(); ++p) + { + it.next(); + + const PropertyData &pprop = it.value(); + const char *prop_name = PyBytes_AsString(pprop.first); + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)pprop.second; + int notifier_id; + + if (pp->pyqtprop_notify) + { + qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)pp->pyqtprop_notify; + const QByteArray &sig = ps->parsed_signature->signature; + + notifier_id = builder.indexOfSignal(sig.mid(1)); + + if (notifier_id < 0) + { + PyErr_Format(PyExc_TypeError, + "the notify signal '%s' was not defined in this class", + sig.constData() + 1); + + // Note that we leak the property name. + return 0; + } + } + else + { + notifier_id = -1; + } + + // A Qt v5 revision 7 meta-object holds the QMetaType::Type of the type + // or its name if it is unresolved (ie. not known to the type system). + // In Qt v4 both are held. For QObject sub-classes Chimera will fall + // back to the QMetaType::QObjectStar if there is no specific meta-type + // for the sub-class. This means that, for Qt v4, + // QMetaProperty::read() can handle the type. However, Qt v5 doesn't + // know that the unresolved type is a QObject sub-class. Therefore we + // have to tell it that the property is a QObject, rather than the + // sub-class. This means that QMetaProperty.typeName() will always + // return "QObject*". + QByteArray prop_type; + + if (pp->pyqtprop_parsed_type->metatype.id() == QMetaType::QObjectStar) + { + // However, if the type is a Python sub-class of QObject then we + // use the name of the Python type. This anticipates that the type + // is one that will be proxied by QML at some point. + if (pp->pyqtprop_parsed_type->typeDef() == sipType_QObject) + { + prop_type = sipPyTypeName( + (PyTypeObject *)pp->pyqtprop_parsed_type->py_type()); + prop_type.append('*'); + } + else + { + prop_type = "QObject*"; + } + } + else + { + prop_type = pp->pyqtprop_parsed_type->name(); + } + + // Note that there is an addProperty() overload that also takes a + // QMetaType argument (rather than call QMetaType::fromType() as this + // overload does) so we could pass the QMetaType that the parser + // created. However this breaks properties that are application Python + // enums which have a parsed QMetaType that describes an int whereas Qt + // seems to need an invalid QMetaType for these to work. + QMetaPropertyBuilder prop_builder = builder.addProperty( + QByteArray(prop_name), prop_type, notifier_id); + + // Reset the defaults. + prop_builder.setReadable(false); + prop_builder.setWritable(false); + + // Enum or flag. + if (pp->pyqtprop_parsed_type->isEnumOrFlag()) + { + prop_builder.setEnumOrFlag(true); + } + + if (pp->pyqtprop_get && PyCallable_Check(pp->pyqtprop_get)) + { + // Readable. + prop_builder.setReadable(true); + } + + if (pp->pyqtprop_set && PyCallable_Check(pp->pyqtprop_set)) + { + // Writable. + prop_builder.setWritable(true); + + // See if the name of the setter follows the Designer convention. + // If so tell the UI compilers not to use setProperty(). + PyObject *setter_name_obj = PyObject_GetAttr(pp->pyqtprop_set, + qpycore_dunder_name); + + if (setter_name_obj) + { + QByteArray ascii = qpycore_convert_ASCII(setter_name_obj); + Py_DECREF(setter_name_obj); + + if (ascii.startsWith("set") && ascii[3] == (char)toupper(prop_name[0]) && ascii.mid(4) == prop_name + 1) + prop_builder.setStdCppSet(true); + } + + PyErr_Clear(); + } + + if (pp->pyqtprop_reset && PyCallable_Check(pp->pyqtprop_reset)) + { + // Resetable. + prop_builder.setResettable(true); + } + + // Add the property flags. + prop_builder.setDesignable(pp->pyqtprop_flags & 0x00001000); + prop_builder.setScriptable(pp->pyqtprop_flags & 0x00004000); + prop_builder.setStored(pp->pyqtprop_flags & 0x00010000); + prop_builder.setUser(pp->pyqtprop_flags & 0x00100000); + prop_builder.setConstant(pp->pyqtprop_flags & 0x00000400); + prop_builder.setFinal(pp->pyqtprop_flags & 0x00000800); + + prop_builder.setRevision(pp->pyqtprop_revision); + + // Save the property data for qt_metacall(). (We already have a + // reference.) + qo->pprops.append(pp); + + // We've finished with the property name. + Py_DECREF(pprop.first); + } + + // Initialise the rest of the meta-object. + qo->mo = builder.toMetaObject(); + + // Save for next time. + sipSetTypeUserData(wt, qo); + + return qo; +} + + +// Trawl a type's hierarchy looking for any enums, slots, signals or +// properties. +static int trawl_hierarchy(PyTypeObject *pytype, qpycore_metaobject *qo, + QMetaObjectBuilder &builder, QList &penums, + QList &psigs, + QMap &pprops) +{ + if (trawl_type(pytype, qo, builder, penums, psigs, pprops) < 0) + return -1; + + PyObject *tp_bases; + + if (PyType_HasFeature(pytype, Py_TPFLAGS_HEAPTYPE)) + tp_bases = reinterpret_cast( + PyType_GetSlot(pytype, Py_tp_bases)); + else + tp_bases = 0; + + if (!tp_bases) + return 0; + + Q_ASSERT(PyTuple_Check(tp_bases)); + + for (Py_ssize_t i = 0; i < PyTuple_Size(tp_bases); ++i) + { + PyTypeObject *sup = (PyTypeObject *)PyTuple_GetItem(tp_bases, i); + + if (PyType_IsSubtype(sup, sipTypeAsPyTypeObject(sipType_QObject))) + continue; + + if (trawl_hierarchy(sup, qo, builder, penums, psigs, pprops) < 0) + return -1; + } + + return 0; +} + + +// Trawl a type's dict looking for any enums, slots, signals or properties. +static int trawl_type(PyTypeObject *pytype, qpycore_metaobject *qo, + QMetaObjectBuilder &builder, QList &penums, + QList &psigs, + QMap &pprops) +{ + Py_ssize_t pos = 0; + PyObject *key, *value, *dict; + + dict = sipPyTypeDict(pytype); + + while (PyDict_Next(dict, &pos, &key, &value)) + { + // See if it is an enum. + EnumFlag enum_flag = qpycore_pop_enum_flag(value); + if (!enum_flag.name.isNull()) + { + penums.append(enum_flag); + continue; + } + + // See if it is a slot, ie. it has been decorated with pyqtSlot(). + PyObject *sig_obj = PyObject_GetAttr(value, + qpycore_dunder_pyqtsignature); + + if (sig_obj) + { + // Make sure it is a list and not some legitimate attribute that + // happens to use our special name. + if (PyList_Check(sig_obj)) + { + for (Py_ssize_t i = 0; i < PyList_Size(sig_obj); ++i) + { + // Set up the skeleton slot. + PyObject *decoration = PyList_GetItem(sig_obj, i); + Chimera::Signature *slot_signature = Chimera::Signature::fromPyObject(decoration); + + // Check if a slot of the same signature has already been + // defined. This typically happens with sub-classed + // mixins. + bool overridden = false; + + for (int i = 0; i < qo->pslots.size(); ++i) + if (qo->pslots.at(i)->slotSignature()->signature == slot_signature->signature) + { + overridden = true; + break; + } + + if (!overridden) + qo->pslots.append( + new PyQtSlot(value, true, slot_signature)); + } + } + + Py_DECREF(sig_obj); + } + else + { + PyErr_Clear(); + + // Make sure the key is an ASCII string. Delay the error checking + // until we know we actually need it. + const char *ascii_key = sipString_AsASCIIString(&key); + + // See if the value is of interest. + if (PyObject_TypeCheck(value, qpycore_pyqtProperty_TypeObject)) + { + // It is a property. + + if (!ascii_key) + return -1; + + Py_INCREF(value); + + qpycore_pyqtProperty *pp = (qpycore_pyqtProperty *)value; + + pprops.insert(pp->pyqtprop_sequence, PropertyData(key, value)); + + // See if the property has a scope. If so, collect all + // QMetaObject pointers that are not in the super-class + // hierarchy. + const QMetaObject *mo = get_scope_qmetaobject(pp->pyqtprop_parsed_type); + + if (mo) + builder.addRelatedMetaObject(mo); + } + else if (PyObject_TypeCheck(value, qpycore_pyqtSignal_TypeObject)) + { + // It is a signal. + + if (!ascii_key) + return -1; + + qpycore_pyqtSignal *ps = (qpycore_pyqtSignal *)value; + + // Make sure the signal has a name. + qpycore_set_signal_name(ps, sipPyTypeName(pytype), ascii_key); + + // Add all the overloads. + do + { + psigs.append(ps); + ps = ps->next; + } + while (ps); + + Py_DECREF(key); + } + else + { + PyErr_Clear(); + } + } + } + + return 0; +} + + +// Return the QMetaObject for an enum type's scope. +static const QMetaObject *get_scope_qmetaobject(const Chimera *ct) +{ + // Check it is an enum. + if (!ct->isEnumOrFlag()) + return 0; + + // Check it has a scope. + if (!ct->typeDef()) + return 0; + + const sipTypeDef *td = sipTypeScope(ct->typeDef()); + + if (!td) + return 0; + + // Check the scope is wrapped by PyQt. + if (!qpycore_is_pyqt_type(td)) + return 0; + + return qpycore_get_qmetaobject((sipWrapperType *)sipTypeAsPyTypeObject(td)); +} + + +// Return the QMetaObject for a type. +const QMetaObject *qpycore_get_qmetaobject(sipWrapperType *wt, + const sipTypeDef *base_td) +{ + if (wt && sipIsUserType(wt)) + { + const qpycore_metaobject *qo = qpycore_get_dynamic_metaobject(wt); + + if (qo) + return qo->mo; + } + + // Get the static meta-object if there is one. + if (!base_td) + { + if (!wt) + return 0; + + base_td = sipTypeFromPyTypeObject((PyTypeObject *)wt); + + if (!base_td) + return 0; + } + + const pyqt6ClassPluginDef *plugin = reinterpret_cast(sipTypePluginData(base_td)); + + if (!plugin) + return 0; + + return reinterpret_cast(plugin->static_metaobject); +} diff --git a/qpy/QtCore/qpycore_types.h b/qpy/QtCore/qpycore_types.h new file mode 100644 index 0000000..3812f7f --- /dev/null +++ b/qpy/QtCore/qpycore_types.h @@ -0,0 +1,56 @@ +// This defines the interfaces for the meta-type used by PyQt. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYCORE_TYPES_H +#define _QPYCORE_TYPES_H + + +#include +#include + +#include "qpycore_pyqtproperty.h" + + +class PyQtSlot; + + +// This describes a dynamic meta-object. +struct qpycore_metaobject +{ + // The meta-object built by QMetaObjectBuilder. + QMetaObject *mo; + + // The list of properties. + QList pprops; + + // The list of slots. + QList pslots; + + // The number of signals. + int nr_signals; +}; + + +const qpycore_metaobject *qpycore_get_dynamic_metaobject(sipWrapperType *wt); +const QMetaObject *qpycore_get_qmetaobject(sipWrapperType *wt, + const sipTypeDef *base_td = 0); + + +#endif diff --git a/qpy/QtDBus/qpydbus_api.h b/qpy/QtDBus/qpydbus_api.h new file mode 100644 index 0000000..ade3ccb --- /dev/null +++ b/qpy/QtDBus/qpydbus_api.h @@ -0,0 +1,29 @@ +// This defines the API provided by this library. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDBUS_API_H +#define _QPYDBUS_API_H + + +// Initialisation. +void qpydbus_post_init(); + + +#endif diff --git a/qpy/QtDBus/qpydbus_chimera_helpers.cpp b/qpy/QtDBus/qpydbus_chimera_helpers.cpp new file mode 100644 index 0000000..8a82d97 --- /dev/null +++ b/qpy/QtDBus/qpydbus_chimera_helpers.cpp @@ -0,0 +1,257 @@ +// This is the implementation of the various Chimera helpers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include +#include + +#include "qpydbus_chimera_helpers.h" + +#include "sipAPIQtDBus.h" + + +// Forward declarations. +static PyObject *from_variant_type(const QDBusArgument &arg); +static PyObject *from_array_type(const QDBusArgument &arg); +static PyObject *from_structure_type(const QDBusArgument &arg); +static PyObject *from_map_type(const QDBusArgument &arg); +static PyObject *from_qstring(const QString &arg); +static PyObject *from_qvariant(const QVariant &arg); + + +// Convert a QVariant to a Python object. +bool qpydbus_from_qvariant_convertor(const QVariant &var, PyObject **objp) +{ + // Handle QDBusObjectPath. + if (var.userType() == qMetaTypeId()) + { + *objp = from_qstring(var.value().path()); + + return true; + } + + // Handle QDBusSignature. + if (var.userType() == qMetaTypeId()) + { + *objp = from_qstring(var.value().signature()); + + return true; + } + + // Handle QDBusVariant. + if (var.userType() == qMetaTypeId()) + { + *objp = from_qvariant(var.value().variant()); + + return true; + } + + // Anything else must be a QDBusArgument. + if (var.userType() != qMetaTypeId()) + return false; + + QDBusArgument arg = var.value(); + + switch (arg.currentType()) + { + case QDBusArgument::BasicType: + *objp = from_qvariant(arg.asVariant()); + break; + + case QDBusArgument::VariantType: + *objp = from_variant_type(arg); + break; + + case QDBusArgument::ArrayType: + *objp = from_array_type(arg); + break; + + case QDBusArgument::StructureType: + *objp = from_structure_type(arg); + break; + + case QDBusArgument::MapType: + *objp = from_map_type(arg); + break; + + default: + PyErr_Format(PyExc_TypeError, "unsupported DBus argument type %d", + (int)arg.currentType()); + *objp = 0; + } + + return true; +} + + +// Convert a QDBusArgument variant type to a Python object. +static PyObject *from_variant_type(const QDBusArgument &arg) +{ + QDBusVariant dbv; + + arg >> dbv; + + return from_qvariant(dbv.variant()); +} + + +// Convert a QDBusArgument array type to a Python object. +static PyObject *from_array_type(const QDBusArgument &arg) +{ + QVariantList vl; + + arg.beginArray(); + + while (!arg.atEnd()) + vl.append(arg.asVariant()); + + arg.endArray(); + + PyObject *obj = PyList_New(vl.count()); + + if (!obj) + return 0; + + for (int i = 0; i < vl.count(); ++i) + { + PyObject *itm = from_qvariant(vl.at(i)); + + if (!itm) + { + Py_DECREF(obj); + return 0; + } + + PyList_SetItem(obj, i, itm); + } + + return obj; +} + + +// Convert a QDBusArgument structure type to a Python object. +static PyObject *from_structure_type(const QDBusArgument &arg) +{ + QVariantList vl; + + arg.beginStructure(); + + while (!arg.atEnd()) + vl.append(arg.asVariant()); + + arg.endStructure(); + + PyObject *obj = PyTuple_New(vl.count()); + + if (!obj) + return 0; + + for (int i = 0; i < vl.count(); ++i) + { + PyObject *itm = from_qvariant(vl.at(i)); + + if (!itm) + { + Py_DECREF(obj); + return 0; + } + + PyTuple_SetItem(obj, i, itm); + } + + return obj; +} + + +// Convert a QDBusArgument map type to a Python object. +static PyObject *from_map_type(const QDBusArgument &arg) +{ + PyObject *obj = PyDict_New(); + + if (!obj) + return 0; + + arg.beginMap(); + + while (!arg.atEnd()) + { + arg.beginMapEntry(); + + PyObject *key = from_qvariant(arg.asVariant()); + PyObject *value = from_qvariant(arg.asVariant()); + + arg.endMapEntry(); + + if (!key || !value) + { + Py_XDECREF(key); + Py_XDECREF(value); + Py_DECREF(obj); + + return 0; + } + + int rc = PyDict_SetItem(obj, key, value); + + Py_DECREF(key); + Py_DECREF(value); + + if (rc < 0) + { + Py_DECREF(obj); + + return 0; + } + } + + arg.endMap(); + + return obj; +} + + +// Convert a QString to a Python object. +static PyObject *from_qstring(const QString &arg) +{ + QString *heap = new QString(arg); + PyObject *obj = sipConvertFromNewType(heap, sipType_QString, 0); + + if (!obj) + delete heap; + + return obj; +} + + +// Convert a QVariant to a Python object. +static PyObject *from_qvariant(const QVariant &arg) +{ + QVariant *heap = new QVariant(arg); + PyObject *obj = sipConvertFromNewType(heap, sipType_QVariant, 0); + + if (!obj) + delete heap; + + return obj; +} diff --git a/qpy/QtDBus/qpydbus_chimera_helpers.h b/qpy/QtDBus/qpydbus_chimera_helpers.h new file mode 100644 index 0000000..753f065 --- /dev/null +++ b/qpy/QtDBus/qpydbus_chimera_helpers.h @@ -0,0 +1,37 @@ +// This is the definition of the various Chimera helpers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDBUS_CHIMERAHELPERS_H +#define _QPYDBUS_CHIMERAHELPERS_H + + +#include + +#include + + +// Keep this in sync. with that defined in the public API. +typedef bool (*FromQVariantConvertorFn)(const QVariant &, PyObject **); + + +bool qpydbus_from_qvariant_convertor(const QVariant &var, PyObject **objp); + + +#endif diff --git a/qpy/QtDBus/qpydbus_post_init.cpp b/qpy/QtDBus/qpydbus_post_init.cpp new file mode 100644 index 0000000..5c7576c --- /dev/null +++ b/qpy/QtDBus/qpydbus_post_init.cpp @@ -0,0 +1,38 @@ +// This is the initialisation support code for the QtDBus module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpydbus_api.h" +#include "qpydbus_chimera_helpers.h" + +#include "sipAPIQtDBus.h" + + +// Perform any required initialisation. +void qpydbus_post_init() +{ + // Get the Chimera helper registration function. + void (*register_from_qvariant_convertor)(FromQVariantConvertorFn); + + register_from_qvariant_convertor = (void (*)(FromQVariantConvertorFn))sipImportSymbol("pyqt6_register_from_qvariant_convertor"); + Q_ASSERT(register_from_qvariant_convertor); + register_from_qvariant_convertor(qpydbus_from_qvariant_convertor); +} diff --git a/qpy/QtDBus/qpydbuspendingreply.cpp b/qpy/QtDBus/qpydbuspendingreply.cpp new file mode 100644 index 0000000..1b818a6 --- /dev/null +++ b/qpy/QtDBus/qpydbuspendingreply.cpp @@ -0,0 +1,66 @@ +// This is the implementation of the QPyDBusPendingReply class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpydbuspendingreply.h" + +#include "sipAPIQtDBus.h" + + +// Default ctor. +QPyDBusPendingReply::QPyDBusPendingReply() : QDBusPendingReply() +{ +} + + +// Copy a reply. +QPyDBusPendingReply::QPyDBusPendingReply(const QPyDBusPendingReply &other) + : QDBusPendingReply(other) +{ +} + + +// Extract a reply from another pending call. +QPyDBusPendingReply::QPyDBusPendingReply(const QDBusPendingCall &call) + : QDBusPendingReply(call) +{ +} + + +// Extract a reply from a message. +QPyDBusPendingReply::QPyDBusPendingReply(const QDBusMessage &reply) + : QDBusPendingReply(reply) +{ +} + + +// Return the value of the reply. The GIL should be held. +PyObject *QPyDBusPendingReply::value(PyObject *type) const +{ + QVariant val; + + // This will wait for the call to complete. + Py_BEGIN_ALLOW_THREADS + val = argumentAt(0); + Py_END_ALLOW_THREADS + + return pyqt6_qtdbus_from_qvariant_by_type(val, type); +} diff --git a/qpy/QtDBus/qpydbuspendingreply.h b/qpy/QtDBus/qpydbuspendingreply.h new file mode 100644 index 0000000..4b32a58 --- /dev/null +++ b/qpy/QtDBus/qpydbuspendingreply.h @@ -0,0 +1,41 @@ +// This is the definition of the QPyDBusPendingReply class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDBUSPENDINGREPLY_H +#define _QPYDBUSPENDINGREPLY_H + + +#include + +#include + + +class QPyDBusPendingReply : public QDBusPendingReply +{ +public: + QPyDBusPendingReply(); + QPyDBusPendingReply(const QPyDBusPendingReply &other); + QPyDBusPendingReply(const QDBusPendingCall &call); + QPyDBusPendingReply(const QDBusMessage &reply); + + PyObject *value(PyObject *type) const; +}; + +#endif diff --git a/qpy/QtDBus/qpydbusreply.cpp b/qpy/QtDBus/qpydbusreply.cpp new file mode 100644 index 0000000..cb12fd6 --- /dev/null +++ b/qpy/QtDBus/qpydbusreply.cpp @@ -0,0 +1,145 @@ +// This is the implementation of the QPyDBusReply class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include + +#include "qpydbusreply.h" + +#include "sipAPIQtDBus.h" + + +// Extract a reply from a message. The GIL should be held. +QPyDBusReply::QPyDBusReply(const QDBusMessage &reply) +{ + *this = reply; +} + + +// Extract a reply from a pending call. The GIL should be held. +QPyDBusReply::QPyDBusReply(const QDBusPendingCall &call) +{ + *this = call; +} + + +// Extract a reply from an error. +QPyDBusReply::QPyDBusReply(const QDBusError &error) +{ + _q_value = 0; + _q_is_valid = !error.isValid(); + _q_error = error; +} + + +// Copy a reply. The GIL should be held. +QPyDBusReply::QPyDBusReply(const QPyDBusReply &other) +{ + _q_value = other._q_value; + Py_XINCREF(_q_value); + + _q_value_variant = other._q_value_variant; + _q_is_valid = other._q_is_valid; + _q_error = other._q_error; +} + + +// A reply created from a QDBusReply<> mapped type convertor. +QPyDBusReply::QPyDBusReply(PyObject *q_value, bool q_is_valid, const QDBusError &q_error) : _q_value(q_value), _q_is_valid(q_is_valid), _q_error(q_error) +{ +} + + +// The dtor. The GIL should be held. +QPyDBusReply::~QPyDBusReply() +{ + Py_XDECREF(_q_value); +} + + +// Return the value of the reply. The GIL should be held. +PyObject *QPyDBusReply::value(PyObject *type) const +{ + if (!_q_is_valid) + { + PyErr_SetString(PyExc_ValueError, "QDBusReply value is invalid"); + return 0; + } + + // Return any explicit value. + if (_q_value) + { + if (type) + { + PyErr_SetString(PyExc_ValueError, + "'type' argument cannot be used with an explcitly typed reply"); + return 0; + } + + Py_INCREF(_q_value); + return _q_value; + } + + QVariant val(_q_value_variant); + + return pyqt6_qtdbus_from_qvariant_by_type(val, type); +} + + +// Extract a reply from a message. The GIL should be held. +QPyDBusReply &QPyDBusReply::operator=(const QDBusMessage &reply) +{ + _q_value = 0; + _q_error = reply; + _q_is_valid = !_q_error.isValid(); + + if (_q_is_valid) + { + QList results = reply.arguments(); + + if (results.count() == 0) + { + Py_INCREF(Py_None); + _q_value = Py_None; + } + else + { + // Convert this later if requested. + _q_value_variant = results.at(0); + } + } + + return *this; +} + + +// Extract a reply from a pending call. The GIL should be held. +QPyDBusReply &QPyDBusReply::operator=(const QDBusPendingCall &call) +{ + QDBusPendingCall other(call); + + Py_BEGIN_ALLOW_THREADS + other.waitForFinished(); + Py_END_ALLOW_THREADS + + return *this = other.reply(); +} diff --git a/qpy/QtDBus/qpydbusreply.h b/qpy/QtDBus/qpydbusreply.h new file mode 100644 index 0000000..ce558b7 --- /dev/null +++ b/qpy/QtDBus/qpydbusreply.h @@ -0,0 +1,60 @@ +// This is the definition of the QPyDBusReply class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDBUSREPLY_H +#define _QPYDBUSREPLY_H + + +#include + +#include +#include + + +class QDBusMessage; +class QDBusPendingCall; + + +class QPyDBusReply +{ +public: + QPyDBusReply(const QDBusMessage &reply); + QPyDBusReply(const QDBusPendingCall &call); + QPyDBusReply(const QDBusError &error = QDBusError()); + QPyDBusReply(const QPyDBusReply &other); + QPyDBusReply(PyObject *q_value, bool q_is_valid, const QDBusError &q_error); + ~QPyDBusReply(); + + inline const QDBusError &error() const {return _q_error;} + inline bool isValid() const {return _q_is_valid;} + + PyObject *value(PyObject *type) const; + + QPyDBusReply &operator=(const QDBusMessage &reply); + QPyDBusReply &operator=(const QDBusPendingCall &call); + +private: + PyObject *_q_value; + QVariant _q_value_variant; + bool _q_is_valid; + QDBusError _q_error; +}; + +#endif diff --git a/qpy/QtDesigner/qpydesignercontainerextension.h b/qpy/QtDesigner/qpydesignercontainerextension.h new file mode 100644 index 0000000..f1ebb7d --- /dev/null +++ b/qpy/QtDesigner/qpydesignercontainerextension.h @@ -0,0 +1,42 @@ +// This is the definition and implementation of the +// QPyDesignerContainerExtension class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDESIGNERCONTAINEREXTENSION_H +#define _QPYDESIGNERCONTAINEREXTENSION_H + + +#include +#include + + +class QPyDesignerContainerExtension : public QObject, public QDesignerContainerExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerContainerExtension) + +public: + QPyDesignerContainerExtension(QObject *parent) : QObject(parent) {}; + +private: + QPyDesignerContainerExtension(const QPyDesignerContainerExtension &); +}; + +#endif diff --git a/qpy/QtDesigner/qpydesignercustomwidgetcollectionplugin.h b/qpy/QtDesigner/qpydesignercustomwidgetcollectionplugin.h new file mode 100644 index 0000000..47100da --- /dev/null +++ b/qpy/QtDesigner/qpydesignercustomwidgetcollectionplugin.h @@ -0,0 +1,42 @@ +// This is the definition and implementation of the +// QPyDesignerCustomWidgetCollectionPlugin class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDESIGNERCUSTOMWIDGETCOLLECTIONPLUGIN_H +#define _QPYDESIGNERCUSTOMWIDGETCOLLECTIONPLUGIN_H + + +#include +#include + + +class QPyDesignerCustomWidgetCollectionPlugin : public QObject, public QDesignerCustomWidgetCollectionInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) + +public: + QPyDesignerCustomWidgetCollectionPlugin(QObject *parent = 0) : QObject(parent) {} + +private: + QPyDesignerCustomWidgetCollectionPlugin(const QPyDesignerCustomWidgetCollectionPlugin &); +}; + +#endif diff --git a/qpy/QtDesigner/qpydesignercustomwidgetplugin.h b/qpy/QtDesigner/qpydesignercustomwidgetplugin.h new file mode 100644 index 0000000..9f0f191 --- /dev/null +++ b/qpy/QtDesigner/qpydesignercustomwidgetplugin.h @@ -0,0 +1,42 @@ +// This is the definition and implementation of the +// QPyDesignerCustomWidgetPlugin class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDESIGNERCUSTOMWIDGETPLUGIN_H +#define _QPYDESIGNERCUSTOMWIDGETPLUGIN_H + + +#include +#include + + +class QPyDesignerCustomWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) + +public: + QPyDesignerCustomWidgetPlugin(QObject *parent = 0) : QObject(parent) {} + +private: + QPyDesignerCustomWidgetPlugin(const QPyDesignerCustomWidgetPlugin &); +}; + +#endif diff --git a/qpy/QtDesigner/qpydesignermembersheetextension.h b/qpy/QtDesigner/qpydesignermembersheetextension.h new file mode 100644 index 0000000..898f2cb --- /dev/null +++ b/qpy/QtDesigner/qpydesignermembersheetextension.h @@ -0,0 +1,42 @@ +// This is the definition and implementation of the +// QPyDesignerMemberSheetExtension class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDESIGNERMEMBERSHEETEXTENSION_H +#define _QPYDESIGNERMEMBERSHEETEXTENSION_H + + +#include +#include + + +class QPyDesignerMemberSheetExtension : public QObject, public QDesignerMemberSheetExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerMemberSheetExtension) + +public: + QPyDesignerMemberSheetExtension(QObject *parent) : QObject(parent) {}; + +private: + QPyDesignerMemberSheetExtension(const QPyDesignerMemberSheetExtension &); +}; + +#endif diff --git a/qpy/QtDesigner/qpydesignerpropertysheetextension.h b/qpy/QtDesigner/qpydesignerpropertysheetextension.h new file mode 100644 index 0000000..d0fc7bd --- /dev/null +++ b/qpy/QtDesigner/qpydesignerpropertysheetextension.h @@ -0,0 +1,42 @@ +// This is the definition and implementation of the +// QPyDesignerPropertySheetExtension class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDESIGNERPROPERTYSHEETEXTENSION_H +#define _QPYDESIGNERPROPERTYSHEETEXTENSION_H + + +#include +#include + + +class QPyDesignerPropertySheetExtension : public QObject, public QDesignerPropertySheetExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerPropertySheetExtension) + +public: + QPyDesignerPropertySheetExtension(QObject *parent) : QObject(parent) {}; + +private: + QPyDesignerPropertySheetExtension(const QPyDesignerPropertySheetExtension &); +}; + +#endif diff --git a/qpy/QtDesigner/qpydesignertaskmenuextension.h b/qpy/QtDesigner/qpydesignertaskmenuextension.h new file mode 100644 index 0000000..113ad6e --- /dev/null +++ b/qpy/QtDesigner/qpydesignertaskmenuextension.h @@ -0,0 +1,42 @@ +// This is the definition and implementation of the +// QPyDesignerTaskMenuExtension class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYDESIGNERTASKMENUEXTENSION_H +#define _QPYDESIGNERTASKMENUEXTENSION_H + + +#include +#include + + +class QPyDesignerTaskMenuExtension : public QObject, public QDesignerTaskMenuExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerTaskMenuExtension) + +public: + QPyDesignerTaskMenuExtension(QObject *parent) : QObject(parent) {}; + +private: + QPyDesignerTaskMenuExtension(const QPyDesignerTaskMenuExtension &); +}; + +#endif diff --git a/qpy/QtOpenGL/qpyopengl_add_constants.cpp b/qpy/QtOpenGL/qpyopengl_add_constants.cpp new file mode 100644 index 0000000..9753f89 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_add_constants.cpp @@ -0,0 +1,5121 @@ +/* + * This implements a function to populate a Python object with the OpenGL + * constants. This file is automatically generated. + * + * Copyright (c) 2023 Riverbank Computing Limited + * + * This file is part of PyQt6. + * + * This file may be used under the terms of the GNU General Public License + * version 3.0 as published by the Free Software Foundation and appearing in + * the file LICENSE included in the packaging of this file. Please review the + * following information to ensure the GNU General Public License version 3.0 + * requirements will be met: http://www.gnu.org/copyleft/gpl.html. + * + * If you do not wish to use this file under the terms of the GPL version 3.0 + * then you may purchase a commercial license. For more information contact + * info@riverbankcomputing.com. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + + +#include + + +struct OpenGLEnum_i +{ + const char *name; + int value; +}; + +static OpenGLEnum_i openGLEnums_i[] = { + {"GL_CURRENT_BIT", 0x00000001}, + {"GL_POINT_BIT", 0x00000002}, + {"GL_LINE_BIT", 0x00000004}, + {"GL_POLYGON_BIT", 0x00000008}, + {"GL_POLYGON_STIPPLE_BIT", 0x00000010}, + {"GL_PIXEL_MODE_BIT", 0x00000020}, + {"GL_LIGHTING_BIT", 0x00000040}, + {"GL_FOG_BIT", 0x00000080}, + {"GL_DEPTH_BUFFER_BIT", 0x00000100}, + {"GL_ACCUM_BUFFER_BIT", 0x00000200}, + {"GL_STENCIL_BUFFER_BIT", 0x00000400}, + {"GL_VIEWPORT_BIT", 0x00000800}, + {"GL_TRANSFORM_BIT", 0x00001000}, + {"GL_ENABLE_BIT", 0x00002000}, + {"GL_COLOR_BUFFER_BIT", 0x00004000}, + {"GL_HINT_BIT", 0x00008000}, + {"GL_EVAL_BIT", 0x00010000}, + {"GL_LIST_BIT", 0x00020000}, + {"GL_TEXTURE_BIT", 0x00040000}, + {"GL_SCISSOR_BIT", 0x00080000}, + {"GL_MULTISAMPLE_BIT", 0x20000000}, + {"GL_MULTISAMPLE_BIT_ARB", 0x20000000}, + {"GL_MULTISAMPLE_BIT_EXT", 0x20000000}, + {"GL_MULTISAMPLE_BIT_3DFX", 0x20000000}, + {"GL_ALL_ATTRIB_BITS", static_cast(0xFFFFFFFF)}, + {"GL_COVERAGE_BUFFER_BIT_NV", 0x00008000}, + {"GL_CLIENT_PIXEL_STORE_BIT", 0x00000001}, + {"GL_CLIENT_VERTEX_ARRAY_BIT", 0x00000002}, + {"GL_CLIENT_ALL_ATTRIB_BITS", static_cast(0xFFFFFFFF)}, + {"GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT", 0x00000001}, + {"GL_CONTEXT_FLAG_DEBUG_BIT", 0x00000002}, + {"GL_CONTEXT_FLAG_DEBUG_BIT_KHR", 0x00000002}, + {"GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB", 0x00000004}, + {"GL_CONTEXT_CORE_PROFILE_BIT", 0x00000001}, + {"GL_CONTEXT_COMPATIBILITY_PROFILE_BIT", 0x00000002}, + {"GL_MAP_READ_BIT", 0x0001}, + {"GL_MAP_READ_BIT_EXT", 0x0001}, + {"GL_MAP_WRITE_BIT", 0x0002}, + {"GL_MAP_WRITE_BIT_EXT", 0x0002}, + {"GL_MAP_INVALIDATE_RANGE_BIT", 0x0004}, + {"GL_MAP_INVALIDATE_RANGE_BIT_EXT", 0x0004}, + {"GL_MAP_INVALIDATE_BUFFER_BIT", 0x0008}, + {"GL_MAP_INVALIDATE_BUFFER_BIT_EXT", 0x0008}, + {"GL_MAP_FLUSH_EXPLICIT_BIT", 0x0010}, + {"GL_MAP_FLUSH_EXPLICIT_BIT_EXT", 0x0010}, + {"GL_MAP_UNSYNCHRONIZED_BIT", 0x0020}, + {"GL_MAP_UNSYNCHRONIZED_BIT_EXT", 0x0020}, + {"GL_MAP_PERSISTENT_BIT", 0x0040}, + {"GL_MAP_COHERENT_BIT", 0x0080}, + {"GL_DYNAMIC_STORAGE_BIT", 0x0100}, + {"GL_CLIENT_STORAGE_BIT", 0x0200}, + {"GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT", 0x00000001}, + {"GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT", 0x00000001}, + {"GL_ELEMENT_ARRAY_BARRIER_BIT", 0x00000002}, + {"GL_ELEMENT_ARRAY_BARRIER_BIT_EXT", 0x00000002}, + {"GL_UNIFORM_BARRIER_BIT", 0x00000004}, + {"GL_UNIFORM_BARRIER_BIT_EXT", 0x00000004}, + {"GL_TEXTURE_FETCH_BARRIER_BIT", 0x00000008}, + {"GL_TEXTURE_FETCH_BARRIER_BIT_EXT", 0x00000008}, + {"GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV", 0x00000010}, + {"GL_SHADER_IMAGE_ACCESS_BARRIER_BIT", 0x00000020}, + {"GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT", 0x00000020}, + {"GL_COMMAND_BARRIER_BIT", 0x00000040}, + {"GL_COMMAND_BARRIER_BIT_EXT", 0x00000040}, + {"GL_PIXEL_BUFFER_BARRIER_BIT", 0x00000080}, + {"GL_PIXEL_BUFFER_BARRIER_BIT_EXT", 0x00000080}, + {"GL_TEXTURE_UPDATE_BARRIER_BIT", 0x00000100}, + {"GL_TEXTURE_UPDATE_BARRIER_BIT_EXT", 0x00000100}, + {"GL_BUFFER_UPDATE_BARRIER_BIT", 0x00000200}, + {"GL_BUFFER_UPDATE_BARRIER_BIT_EXT", 0x00000200}, + {"GL_FRAMEBUFFER_BARRIER_BIT", 0x00000400}, + {"GL_FRAMEBUFFER_BARRIER_BIT_EXT", 0x00000400}, + {"GL_TRANSFORM_FEEDBACK_BARRIER_BIT", 0x00000800}, + {"GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT", 0x00000800}, + {"GL_ATOMIC_COUNTER_BARRIER_BIT", 0x00001000}, + {"GL_ATOMIC_COUNTER_BARRIER_BIT_EXT", 0x00001000}, + {"GL_SHADER_STORAGE_BARRIER_BIT", 0x00002000}, + {"GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT", 0x00004000}, + {"GL_QUERY_BUFFER_BARRIER_BIT", 0x00008000}, + {"GL_ALL_BARRIER_BITS", static_cast(0xFFFFFFFF)}, + {"GL_ALL_BARRIER_BITS_EXT", static_cast(0xFFFFFFFF)}, + {"GL_SYNC_FLUSH_COMMANDS_BIT", 0x00000001}, + {"GL_SYNC_FLUSH_COMMANDS_BIT_APPLE", 0x00000001}, + {"GL_VERTEX_SHADER_BIT", 0x00000001}, + {"GL_VERTEX_SHADER_BIT_EXT", 0x00000001}, + {"GL_FRAGMENT_SHADER_BIT", 0x00000002}, + {"GL_FRAGMENT_SHADER_BIT_EXT", 0x00000002}, + {"GL_GEOMETRY_SHADER_BIT", 0x00000004}, + {"GL_TESS_CONTROL_SHADER_BIT", 0x00000008}, + {"GL_TESS_EVALUATION_SHADER_BIT", 0x00000010}, + {"GL_COMPUTE_SHADER_BIT", 0x00000020}, + {"GL_ALL_SHADER_BITS", static_cast(0xFFFFFFFF)}, + {"GL_ALL_SHADER_BITS_EXT", static_cast(0xFFFFFFFF)}, + {"GL_TEXTURE_STORAGE_SPARSE_BIT_AMD", 0x00000001}, + {"GL_RED_BIT_ATI", 0x00000001}, + {"GL_GREEN_BIT_ATI", 0x00000002}, + {"GL_BLUE_BIT_ATI", 0x00000004}, + {"GL_2X_BIT_ATI", 0x00000001}, + {"GL_4X_BIT_ATI", 0x00000002}, + {"GL_8X_BIT_ATI", 0x00000004}, + {"GL_HALF_BIT_ATI", 0x00000008}, + {"GL_QUARTER_BIT_ATI", 0x00000010}, + {"GL_EIGHTH_BIT_ATI", 0x00000020}, + {"GL_SATURATE_BIT_ATI", 0x00000040}, + {"GL_COMP_BIT_ATI", 0x00000002}, + {"GL_NEGATE_BIT_ATI", 0x00000004}, + {"GL_BIAS_BIT_ATI", 0x00000008}, + {"GL_TRACE_OPERATIONS_BIT_MESA", 0x0001}, + {"GL_TRACE_PRIMITIVES_BIT_MESA", 0x0002}, + {"GL_TRACE_ARRAYS_BIT_MESA", 0x0004}, + {"GL_TRACE_TEXTURES_BIT_MESA", 0x0008}, + {"GL_TRACE_PIXELS_BIT_MESA", 0x0010}, + {"GL_TRACE_ERRORS_BIT_MESA", 0x0020}, + {"GL_TRACE_ALL_BITS_MESA", 0xFFFF}, + {"GL_BOLD_BIT_NV", 0x01}, + {"GL_ITALIC_BIT_NV", 0x02}, + {"GL_GLYPH_WIDTH_BIT_NV", 0x01}, + {"GL_GLYPH_HEIGHT_BIT_NV", 0x02}, + {"GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV", 0x04}, + {"GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV", 0x08}, + {"GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV", 0x10}, + {"GL_GLYPH_VERTICAL_BEARING_X_BIT_NV", 0x20}, + {"GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV", 0x40}, + {"GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV", 0x80}, + {"GL_GLYPH_HAS_KERNING_BIT_NV", 0x100}, + {"GL_FONT_X_MIN_BOUNDS_BIT_NV", 0x00010000}, + {"GL_FONT_Y_MIN_BOUNDS_BIT_NV", 0x00020000}, + {"GL_FONT_X_MAX_BOUNDS_BIT_NV", 0x00040000}, + {"GL_FONT_Y_MAX_BOUNDS_BIT_NV", 0x00080000}, + {"GL_FONT_UNITS_PER_EM_BIT_NV", 0x00100000}, + {"GL_FONT_ASCENDER_BIT_NV", 0x00200000}, + {"GL_FONT_DESCENDER_BIT_NV", 0x00400000}, + {"GL_FONT_HEIGHT_BIT_NV", 0x00800000}, + {"GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV", 0x01000000}, + {"GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV", 0x02000000}, + {"GL_FONT_UNDERLINE_POSITION_BIT_NV", 0x04000000}, + {"GL_FONT_UNDERLINE_THICKNESS_BIT_NV", 0x08000000}, + {"GL_FONT_HAS_KERNING_BIT_NV", 0x10000000}, + {"GL_VERTEX23_BIT_PGI", 0x00000004}, + {"GL_VERTEX4_BIT_PGI", 0x00000008}, + {"GL_COLOR3_BIT_PGI", 0x00010000}, + {"GL_COLOR4_BIT_PGI", 0x00020000}, + {"GL_EDGEFLAG_BIT_PGI", 0x00040000}, + {"GL_INDEX_BIT_PGI", 0x00080000}, + {"GL_MAT_AMBIENT_BIT_PGI", 0x00100000}, + {"GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI", 0x00200000}, + {"GL_MAT_DIFFUSE_BIT_PGI", 0x00400000}, + {"GL_MAT_EMISSION_BIT_PGI", 0x00800000}, + {"GL_MAT_COLOR_INDEXES_BIT_PGI", 0x01000000}, + {"GL_MAT_SHININESS_BIT_PGI", 0x02000000}, + {"GL_MAT_SPECULAR_BIT_PGI", 0x04000000}, + {"GL_NORMAL_BIT_PGI", 0x08000000}, + {"GL_TEXCOORD1_BIT_PGI", 0x10000000}, + {"GL_TEXCOORD2_BIT_PGI", 0x20000000}, + {"GL_TEXCOORD3_BIT_PGI", 0x40000000}, + {"GL_TEXCOORD4_BIT_PGI", static_cast(0x80000000)}, + {"GL_COLOR_BUFFER_BIT0_QCOM", 0x00000001}, + {"GL_COLOR_BUFFER_BIT1_QCOM", 0x00000002}, + {"GL_COLOR_BUFFER_BIT2_QCOM", 0x00000004}, + {"GL_COLOR_BUFFER_BIT3_QCOM", 0x00000008}, + {"GL_COLOR_BUFFER_BIT4_QCOM", 0x00000010}, + {"GL_COLOR_BUFFER_BIT5_QCOM", 0x00000020}, + {"GL_COLOR_BUFFER_BIT6_QCOM", 0x00000040}, + {"GL_COLOR_BUFFER_BIT7_QCOM", 0x00000080}, + {"GL_DEPTH_BUFFER_BIT0_QCOM", 0x00000100}, + {"GL_DEPTH_BUFFER_BIT1_QCOM", 0x00000200}, + {"GL_DEPTH_BUFFER_BIT2_QCOM", 0x00000400}, + {"GL_DEPTH_BUFFER_BIT3_QCOM", 0x00000800}, + {"GL_DEPTH_BUFFER_BIT4_QCOM", 0x00001000}, + {"GL_DEPTH_BUFFER_BIT5_QCOM", 0x00002000}, + {"GL_DEPTH_BUFFER_BIT6_QCOM", 0x00004000}, + {"GL_DEPTH_BUFFER_BIT7_QCOM", 0x00008000}, + {"GL_STENCIL_BUFFER_BIT0_QCOM", 0x00010000}, + {"GL_STENCIL_BUFFER_BIT1_QCOM", 0x00020000}, + {"GL_STENCIL_BUFFER_BIT2_QCOM", 0x00040000}, + {"GL_STENCIL_BUFFER_BIT3_QCOM", 0x00080000}, + {"GL_STENCIL_BUFFER_BIT4_QCOM", 0x00100000}, + {"GL_STENCIL_BUFFER_BIT5_QCOM", 0x00200000}, + {"GL_STENCIL_BUFFER_BIT6_QCOM", 0x00400000}, + {"GL_STENCIL_BUFFER_BIT7_QCOM", 0x00800000}, + {"GL_MULTISAMPLE_BUFFER_BIT0_QCOM", 0x01000000}, + {"GL_MULTISAMPLE_BUFFER_BIT1_QCOM", 0x02000000}, + {"GL_MULTISAMPLE_BUFFER_BIT2_QCOM", 0x04000000}, + {"GL_MULTISAMPLE_BUFFER_BIT3_QCOM", 0x08000000}, + {"GL_MULTISAMPLE_BUFFER_BIT4_QCOM", 0x10000000}, + {"GL_MULTISAMPLE_BUFFER_BIT5_QCOM", 0x20000000}, + {"GL_MULTISAMPLE_BUFFER_BIT6_QCOM", 0x40000000}, + {"GL_MULTISAMPLE_BUFFER_BIT7_QCOM", static_cast(0x80000000)}, + {"GL_TEXTURE_DEFORMATION_BIT_SGIX", 0x00000001}, + {"GL_GEOMETRY_DEFORMATION_BIT_SGIX", 0x00000002}, + {"GL_RESTART_SUN", 0x0001}, + {"GL_REPLACE_MIDDLE_SUN", 0x0002}, + {"GL_REPLACE_OLDEST_SUN", 0x0003}, + {"GL_LAYOUT_DEFAULT_INTEL", 0}, + {"GL_LAYOUT_LINEAR_INTEL", 1}, + {"GL_LAYOUT_LINEAR_CPU_CACHED_INTEL", 2}, + {"GL_NEXT_BUFFER_NV", -2}, + {"GL_SKIP_COMPONENTS4_NV", -3}, + {"GL_SKIP_COMPONENTS3_NV", -4}, + {"GL_SKIP_COMPONENTS2_NV", -5}, + {"GL_SKIP_COMPONENTS1_NV", -6}, + {"GL_CLOSE_PATH_NV", 0x00}, + {"GL_MOVE_TO_NV", 0x02}, + {"GL_RELATIVE_MOVE_TO_NV", 0x03}, + {"GL_LINE_TO_NV", 0x04}, + {"GL_RELATIVE_LINE_TO_NV", 0x05}, + {"GL_HORIZONTAL_LINE_TO_NV", 0x06}, + {"GL_RELATIVE_HORIZONTAL_LINE_TO_NV", 0x07}, + {"GL_VERTICAL_LINE_TO_NV", 0x08}, + {"GL_RELATIVE_VERTICAL_LINE_TO_NV", 0x09}, + {"GL_QUADRATIC_CURVE_TO_NV", 0x0A}, + {"GL_RELATIVE_QUADRATIC_CURVE_TO_NV", 0x0B}, + {"GL_CUBIC_CURVE_TO_NV", 0x0C}, + {"GL_RELATIVE_CUBIC_CURVE_TO_NV", 0x0D}, + {"GL_SMOOTH_QUADRATIC_CURVE_TO_NV", 0x0E}, + {"GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV", 0x0F}, + {"GL_SMOOTH_CUBIC_CURVE_TO_NV", 0x10}, + {"GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV", 0x11}, + {"GL_SMALL_CCW_ARC_TO_NV", 0x12}, + {"GL_RELATIVE_SMALL_CCW_ARC_TO_NV", 0x13}, + {"GL_SMALL_CW_ARC_TO_NV", 0x14}, + {"GL_RELATIVE_SMALL_CW_ARC_TO_NV", 0x15}, + {"GL_LARGE_CCW_ARC_TO_NV", 0x16}, + {"GL_RELATIVE_LARGE_CCW_ARC_TO_NV", 0x17}, + {"GL_LARGE_CW_ARC_TO_NV", 0x18}, + {"GL_RELATIVE_LARGE_CW_ARC_TO_NV", 0x19}, + {"GL_RESTART_PATH_NV", 0xF0}, + {"GL_DUP_FIRST_CUBIC_CURVE_TO_NV", 0xF2}, + {"GL_DUP_LAST_CUBIC_CURVE_TO_NV", 0xF4}, + {"GL_RECT_NV", 0xF6}, + {"GL_CIRCULAR_CCW_ARC_TO_NV", 0xF8}, + {"GL_CIRCULAR_CW_ARC_TO_NV", 0xFA}, + {"GL_CIRCULAR_TANGENT_ARC_TO_NV", 0xFC}, + {"GL_ARC_TO_NV", 0xFE}, + {"GL_RELATIVE_ARC_TO_NV", 0xFF}, + {"GL_FALSE", 0}, + {"GL_NO_ERROR", 0}, + {"GL_ZERO", 0}, + {"GL_NONE", 0}, + {"GL_NONE_OES", 0}, + {"GL_TRUE", 1}, + {"GL_ONE", 1}, + {"GL_VERSION_ES_CL_1_0", 1}, + {"GL_VERSION_ES_CM_1_1", 1}, + {"GL_VERSION_ES_CL_1_1", 1}, + {"GL_POINTS", 0x0000}, + {"GL_LINES", 0x0001}, + {"GL_LINE_LOOP", 0x0002}, + {"GL_LINE_STRIP", 0x0003}, + {"GL_TRIANGLES", 0x0004}, + {"GL_TRIANGLE_STRIP", 0x0005}, + {"GL_TRIANGLE_FAN", 0x0006}, + {"GL_QUADS", 0x0007}, + {"GL_QUAD_STRIP", 0x0008}, + {"GL_POLYGON", 0x0009}, + {"GL_LINES_ADJACENCY", 0x000A}, + {"GL_LINES_ADJACENCY_ARB", 0x000A}, + {"GL_LINES_ADJACENCY_EXT", 0x000A}, + {"GL_LINE_STRIP_ADJACENCY", 0x000B}, + {"GL_LINE_STRIP_ADJACENCY_ARB", 0x000B}, + {"GL_LINE_STRIP_ADJACENCY_EXT", 0x000B}, + {"GL_TRIANGLES_ADJACENCY", 0x000C}, + {"GL_TRIANGLES_ADJACENCY_ARB", 0x000C}, + {"GL_TRIANGLES_ADJACENCY_EXT", 0x000C}, + {"GL_TRIANGLE_STRIP_ADJACENCY", 0x000D}, + {"GL_TRIANGLE_STRIP_ADJACENCY_ARB", 0x000D}, + {"GL_TRIANGLE_STRIP_ADJACENCY_EXT", 0x000D}, + {"GL_PATCHES", 0x000E}, + {"GL_ACCUM", 0x0100}, + {"GL_LOAD", 0x0101}, + {"GL_RETURN", 0x0102}, + {"GL_MULT", 0x0103}, + {"GL_ADD", 0x0104}, + {"GL_NEVER", 0x0200}, + {"GL_LESS", 0x0201}, + {"GL_EQUAL", 0x0202}, + {"GL_LEQUAL", 0x0203}, + {"GL_GREATER", 0x0204}, + {"GL_NOTEQUAL", 0x0205}, + {"GL_GEQUAL", 0x0206}, + {"GL_ALWAYS", 0x0207}, + {"GL_SRC_COLOR", 0x0300}, + {"GL_ONE_MINUS_SRC_COLOR", 0x0301}, + {"GL_SRC_ALPHA", 0x0302}, + {"GL_ONE_MINUS_SRC_ALPHA", 0x0303}, + {"GL_DST_ALPHA", 0x0304}, + {"GL_ONE_MINUS_DST_ALPHA", 0x0305}, + {"GL_DST_COLOR", 0x0306}, + {"GL_ONE_MINUS_DST_COLOR", 0x0307}, + {"GL_SRC_ALPHA_SATURATE", 0x0308}, + {"GL_FRONT_LEFT", 0x0400}, + {"GL_FRONT_RIGHT", 0x0401}, + {"GL_BACK_LEFT", 0x0402}, + {"GL_BACK_RIGHT", 0x0403}, + {"GL_FRONT", 0x0404}, + {"GL_BACK", 0x0405}, + {"GL_LEFT", 0x0406}, + {"GL_RIGHT", 0x0407}, + {"GL_FRONT_AND_BACK", 0x0408}, + {"GL_AUX0", 0x0409}, + {"GL_AUX1", 0x040A}, + {"GL_AUX2", 0x040B}, + {"GL_AUX3", 0x040C}, + {"GL_INVALID_ENUM", 0x0500}, + {"GL_INVALID_VALUE", 0x0501}, + {"GL_INVALID_OPERATION", 0x0502}, + {"GL_STACK_OVERFLOW", 0x0503}, + {"GL_STACK_OVERFLOW_KHR", 0x0503}, + {"GL_STACK_UNDERFLOW", 0x0504}, + {"GL_STACK_UNDERFLOW_KHR", 0x0504}, + {"GL_OUT_OF_MEMORY", 0x0505}, + {"GL_INVALID_FRAMEBUFFER_OPERATION", 0x0506}, + {"GL_INVALID_FRAMEBUFFER_OPERATION_EXT", 0x0506}, + {"GL_INVALID_FRAMEBUFFER_OPERATION_OES", 0x0506}, + {"GL_2D", 0x0600}, + {"GL_3D", 0x0601}, + {"GL_3D_COLOR", 0x0602}, + {"GL_3D_COLOR_TEXTURE", 0x0603}, + {"GL_4D_COLOR_TEXTURE", 0x0604}, + {"GL_PASS_THROUGH_TOKEN", 0x0700}, + {"GL_POINT_TOKEN", 0x0701}, + {"GL_LINE_TOKEN", 0x0702}, + {"GL_POLYGON_TOKEN", 0x0703}, + {"GL_BITMAP_TOKEN", 0x0704}, + {"GL_DRAW_PIXEL_TOKEN", 0x0705}, + {"GL_COPY_PIXEL_TOKEN", 0x0706}, + {"GL_LINE_RESET_TOKEN", 0x0707}, + {"GL_EXP", 0x0800}, + {"GL_EXP2", 0x0801}, + {"GL_CW", 0x0900}, + {"GL_CCW", 0x0901}, + {"GL_COEFF", 0x0A00}, + {"GL_ORDER", 0x0A01}, + {"GL_DOMAIN", 0x0A02}, + {"GL_CURRENT_COLOR", 0x0B00}, + {"GL_CURRENT_INDEX", 0x0B01}, + {"GL_CURRENT_NORMAL", 0x0B02}, + {"GL_CURRENT_TEXTURE_COORDS", 0x0B03}, + {"GL_CURRENT_RASTER_COLOR", 0x0B04}, + {"GL_CURRENT_RASTER_INDEX", 0x0B05}, + {"GL_CURRENT_RASTER_TEXTURE_COORDS", 0x0B06}, + {"GL_CURRENT_RASTER_POSITION", 0x0B07}, + {"GL_CURRENT_RASTER_POSITION_VALID", 0x0B08}, + {"GL_CURRENT_RASTER_DISTANCE", 0x0B09}, + {"GL_POINT_SMOOTH", 0x0B10}, + {"GL_POINT_SIZE", 0x0B11}, + {"GL_POINT_SIZE_RANGE", 0x0B12}, + {"GL_SMOOTH_POINT_SIZE_RANGE", 0x0B12}, + {"GL_POINT_SIZE_GRANULARITY", 0x0B13}, + {"GL_SMOOTH_POINT_SIZE_GRANULARITY", 0x0B13}, + {"GL_LINE_SMOOTH", 0x0B20}, + {"GL_LINE_WIDTH", 0x0B21}, + {"GL_LINE_WIDTH_RANGE", 0x0B22}, + {"GL_SMOOTH_LINE_WIDTH_RANGE", 0x0B22}, + {"GL_LINE_WIDTH_GRANULARITY", 0x0B23}, + {"GL_SMOOTH_LINE_WIDTH_GRANULARITY", 0x0B23}, + {"GL_LINE_STIPPLE", 0x0B24}, + {"GL_LINE_STIPPLE_PATTERN", 0x0B25}, + {"GL_LINE_STIPPLE_REPEAT", 0x0B26}, + {"GL_LIST_MODE", 0x0B30}, + {"GL_MAX_LIST_NESTING", 0x0B31}, + {"GL_LIST_BASE", 0x0B32}, + {"GL_LIST_INDEX", 0x0B33}, + {"GL_POLYGON_MODE", 0x0B40}, + {"GL_POLYGON_SMOOTH", 0x0B41}, + {"GL_POLYGON_STIPPLE", 0x0B42}, + {"GL_EDGE_FLAG", 0x0B43}, + {"GL_CULL_FACE", 0x0B44}, + {"GL_CULL_FACE_MODE", 0x0B45}, + {"GL_FRONT_FACE", 0x0B46}, + {"GL_LIGHTING", 0x0B50}, + {"GL_LIGHT_MODEL_LOCAL_VIEWER", 0x0B51}, + {"GL_LIGHT_MODEL_TWO_SIDE", 0x0B52}, + {"GL_LIGHT_MODEL_AMBIENT", 0x0B53}, + {"GL_SHADE_MODEL", 0x0B54}, + {"GL_COLOR_MATERIAL_FACE", 0x0B55}, + {"GL_COLOR_MATERIAL_PARAMETER", 0x0B56}, + {"GL_COLOR_MATERIAL", 0x0B57}, + {"GL_FOG", 0x0B60}, + {"GL_FOG_INDEX", 0x0B61}, + {"GL_FOG_DENSITY", 0x0B62}, + {"GL_FOG_START", 0x0B63}, + {"GL_FOG_END", 0x0B64}, + {"GL_FOG_MODE", 0x0B65}, + {"GL_FOG_COLOR", 0x0B66}, + {"GL_DEPTH_RANGE", 0x0B70}, + {"GL_DEPTH_TEST", 0x0B71}, + {"GL_DEPTH_WRITEMASK", 0x0B72}, + {"GL_DEPTH_CLEAR_VALUE", 0x0B73}, + {"GL_DEPTH_FUNC", 0x0B74}, + {"GL_ACCUM_CLEAR_VALUE", 0x0B80}, + {"GL_STENCIL_TEST", 0x0B90}, + {"GL_STENCIL_CLEAR_VALUE", 0x0B91}, + {"GL_STENCIL_FUNC", 0x0B92}, + {"GL_STENCIL_VALUE_MASK", 0x0B93}, + {"GL_STENCIL_FAIL", 0x0B94}, + {"GL_STENCIL_PASS_DEPTH_FAIL", 0x0B95}, + {"GL_STENCIL_PASS_DEPTH_PASS", 0x0B96}, + {"GL_STENCIL_REF", 0x0B97}, + {"GL_STENCIL_WRITEMASK", 0x0B98}, + {"GL_MATRIX_MODE", 0x0BA0}, + {"GL_NORMALIZE", 0x0BA1}, + {"GL_VIEWPORT", 0x0BA2}, + {"GL_MODELVIEW_STACK_DEPTH", 0x0BA3}, + {"GL_MODELVIEW0_STACK_DEPTH_EXT", 0x0BA3}, + {"GL_PROJECTION_STACK_DEPTH", 0x0BA4}, + {"GL_TEXTURE_STACK_DEPTH", 0x0BA5}, + {"GL_MODELVIEW_MATRIX", 0x0BA6}, + {"GL_MODELVIEW0_MATRIX_EXT", 0x0BA6}, + {"GL_PROJECTION_MATRIX", 0x0BA7}, + {"GL_TEXTURE_MATRIX", 0x0BA8}, + {"GL_ATTRIB_STACK_DEPTH", 0x0BB0}, + {"GL_CLIENT_ATTRIB_STACK_DEPTH", 0x0BB1}, + {"GL_ALPHA_TEST", 0x0BC0}, + {"GL_ALPHA_TEST_QCOM", 0x0BC0}, + {"GL_ALPHA_TEST_FUNC", 0x0BC1}, + {"GL_ALPHA_TEST_FUNC_QCOM", 0x0BC1}, + {"GL_ALPHA_TEST_REF", 0x0BC2}, + {"GL_ALPHA_TEST_REF_QCOM", 0x0BC2}, + {"GL_DITHER", 0x0BD0}, + {"GL_BLEND_DST", 0x0BE0}, + {"GL_BLEND_SRC", 0x0BE1}, + {"GL_BLEND", 0x0BE2}, + {"GL_LOGIC_OP_MODE", 0x0BF0}, + {"GL_INDEX_LOGIC_OP", 0x0BF1}, + {"GL_LOGIC_OP", 0x0BF1}, + {"GL_COLOR_LOGIC_OP", 0x0BF2}, + {"GL_AUX_BUFFERS", 0x0C00}, + {"GL_DRAW_BUFFER", 0x0C01}, + {"GL_DRAW_BUFFER_EXT", 0x0C01}, + {"GL_READ_BUFFER", 0x0C02}, + {"GL_READ_BUFFER_EXT", 0x0C02}, + {"GL_READ_BUFFER_NV", 0x0C02}, + {"GL_SCISSOR_BOX", 0x0C10}, + {"GL_SCISSOR_TEST", 0x0C11}, + {"GL_INDEX_CLEAR_VALUE", 0x0C20}, + {"GL_INDEX_WRITEMASK", 0x0C21}, + {"GL_COLOR_CLEAR_VALUE", 0x0C22}, + {"GL_COLOR_WRITEMASK", 0x0C23}, + {"GL_INDEX_MODE", 0x0C30}, + {"GL_RGBA_MODE", 0x0C31}, + {"GL_DOUBLEBUFFER", 0x0C32}, + {"GL_STEREO", 0x0C33}, + {"GL_RENDER_MODE", 0x0C40}, + {"GL_PERSPECTIVE_CORRECTION_HINT", 0x0C50}, + {"GL_POINT_SMOOTH_HINT", 0x0C51}, + {"GL_LINE_SMOOTH_HINT", 0x0C52}, + {"GL_POLYGON_SMOOTH_HINT", 0x0C53}, + {"GL_FOG_HINT", 0x0C54}, + {"GL_TEXTURE_GEN_S", 0x0C60}, + {"GL_TEXTURE_GEN_T", 0x0C61}, + {"GL_TEXTURE_GEN_R", 0x0C62}, + {"GL_TEXTURE_GEN_Q", 0x0C63}, + {"GL_PIXEL_MAP_I_TO_I", 0x0C70}, + {"GL_PIXEL_MAP_S_TO_S", 0x0C71}, + {"GL_PIXEL_MAP_I_TO_R", 0x0C72}, + {"GL_PIXEL_MAP_I_TO_G", 0x0C73}, + {"GL_PIXEL_MAP_I_TO_B", 0x0C74}, + {"GL_PIXEL_MAP_I_TO_A", 0x0C75}, + {"GL_PIXEL_MAP_R_TO_R", 0x0C76}, + {"GL_PIXEL_MAP_G_TO_G", 0x0C77}, + {"GL_PIXEL_MAP_B_TO_B", 0x0C78}, + {"GL_PIXEL_MAP_A_TO_A", 0x0C79}, + {"GL_PIXEL_MAP_I_TO_I_SIZE", 0x0CB0}, + {"GL_PIXEL_MAP_S_TO_S_SIZE", 0x0CB1}, + {"GL_PIXEL_MAP_I_TO_R_SIZE", 0x0CB2}, + {"GL_PIXEL_MAP_I_TO_G_SIZE", 0x0CB3}, + {"GL_PIXEL_MAP_I_TO_B_SIZE", 0x0CB4}, + {"GL_PIXEL_MAP_I_TO_A_SIZE", 0x0CB5}, + {"GL_PIXEL_MAP_R_TO_R_SIZE", 0x0CB6}, + {"GL_PIXEL_MAP_G_TO_G_SIZE", 0x0CB7}, + {"GL_PIXEL_MAP_B_TO_B_SIZE", 0x0CB8}, + {"GL_PIXEL_MAP_A_TO_A_SIZE", 0x0CB9}, + {"GL_UNPACK_SWAP_BYTES", 0x0CF0}, + {"GL_UNPACK_LSB_FIRST", 0x0CF1}, + {"GL_UNPACK_ROW_LENGTH", 0x0CF2}, + {"GL_UNPACK_ROW_LENGTH_EXT", 0x0CF2}, + {"GL_UNPACK_SKIP_ROWS", 0x0CF3}, + {"GL_UNPACK_SKIP_ROWS_EXT", 0x0CF3}, + {"GL_UNPACK_SKIP_PIXELS", 0x0CF4}, + {"GL_UNPACK_SKIP_PIXELS_EXT", 0x0CF4}, + {"GL_UNPACK_ALIGNMENT", 0x0CF5}, + {"GL_PACK_SWAP_BYTES", 0x0D00}, + {"GL_PACK_LSB_FIRST", 0x0D01}, + {"GL_PACK_ROW_LENGTH", 0x0D02}, + {"GL_PACK_SKIP_ROWS", 0x0D03}, + {"GL_PACK_SKIP_PIXELS", 0x0D04}, + {"GL_PACK_ALIGNMENT", 0x0D05}, + {"GL_MAP_COLOR", 0x0D10}, + {"GL_MAP_STENCIL", 0x0D11}, + {"GL_INDEX_SHIFT", 0x0D12}, + {"GL_INDEX_OFFSET", 0x0D13}, + {"GL_RED_SCALE", 0x0D14}, + {"GL_RED_BIAS", 0x0D15}, + {"GL_ZOOM_X", 0x0D16}, + {"GL_ZOOM_Y", 0x0D17}, + {"GL_GREEN_SCALE", 0x0D18}, + {"GL_GREEN_BIAS", 0x0D19}, + {"GL_BLUE_SCALE", 0x0D1A}, + {"GL_BLUE_BIAS", 0x0D1B}, + {"GL_ALPHA_SCALE", 0x0D1C}, + {"GL_ALPHA_BIAS", 0x0D1D}, + {"GL_DEPTH_SCALE", 0x0D1E}, + {"GL_DEPTH_BIAS", 0x0D1F}, + {"GL_MAX_EVAL_ORDER", 0x0D30}, + {"GL_MAX_LIGHTS", 0x0D31}, + {"GL_MAX_CLIP_PLANES", 0x0D32}, + {"GL_MAX_CLIP_DISTANCES", 0x0D32}, + {"GL_MAX_TEXTURE_SIZE", 0x0D33}, + {"GL_MAX_PIXEL_MAP_TABLE", 0x0D34}, + {"GL_MAX_ATTRIB_STACK_DEPTH", 0x0D35}, + {"GL_MAX_MODELVIEW_STACK_DEPTH", 0x0D36}, + {"GL_MAX_NAME_STACK_DEPTH", 0x0D37}, + {"GL_MAX_PROJECTION_STACK_DEPTH", 0x0D38}, + {"GL_MAX_TEXTURE_STACK_DEPTH", 0x0D39}, + {"GL_MAX_VIEWPORT_DIMS", 0x0D3A}, + {"GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", 0x0D3B}, + {"GL_SUBPIXEL_BITS", 0x0D50}, + {"GL_INDEX_BITS", 0x0D51}, + {"GL_RED_BITS", 0x0D52}, + {"GL_GREEN_BITS", 0x0D53}, + {"GL_BLUE_BITS", 0x0D54}, + {"GL_ALPHA_BITS", 0x0D55}, + {"GL_DEPTH_BITS", 0x0D56}, + {"GL_STENCIL_BITS", 0x0D57}, + {"GL_ACCUM_RED_BITS", 0x0D58}, + {"GL_ACCUM_GREEN_BITS", 0x0D59}, + {"GL_ACCUM_BLUE_BITS", 0x0D5A}, + {"GL_ACCUM_ALPHA_BITS", 0x0D5B}, + {"GL_NAME_STACK_DEPTH", 0x0D70}, + {"GL_AUTO_NORMAL", 0x0D80}, + {"GL_MAP1_COLOR_4", 0x0D90}, + {"GL_MAP1_INDEX", 0x0D91}, + {"GL_MAP1_NORMAL", 0x0D92}, + {"GL_MAP1_TEXTURE_COORD_1", 0x0D93}, + {"GL_MAP1_TEXTURE_COORD_2", 0x0D94}, + {"GL_MAP1_TEXTURE_COORD_3", 0x0D95}, + {"GL_MAP1_TEXTURE_COORD_4", 0x0D96}, + {"GL_MAP1_VERTEX_3", 0x0D97}, + {"GL_MAP1_VERTEX_4", 0x0D98}, + {"GL_MAP2_COLOR_4", 0x0DB0}, + {"GL_MAP2_INDEX", 0x0DB1}, + {"GL_MAP2_NORMAL", 0x0DB2}, + {"GL_MAP2_TEXTURE_COORD_1", 0x0DB3}, + {"GL_MAP2_TEXTURE_COORD_2", 0x0DB4}, + {"GL_MAP2_TEXTURE_COORD_3", 0x0DB5}, + {"GL_MAP2_TEXTURE_COORD_4", 0x0DB6}, + {"GL_MAP2_VERTEX_3", 0x0DB7}, + {"GL_MAP2_VERTEX_4", 0x0DB8}, + {"GL_MAP1_GRID_DOMAIN", 0x0DD0}, + {"GL_MAP1_GRID_SEGMENTS", 0x0DD1}, + {"GL_MAP2_GRID_DOMAIN", 0x0DD2}, + {"GL_MAP2_GRID_SEGMENTS", 0x0DD3}, + {"GL_TEXTURE_1D", 0x0DE0}, + {"GL_TEXTURE_2D", 0x0DE1}, + {"GL_FEEDBACK_BUFFER_POINTER", 0x0DF0}, + {"GL_FEEDBACK_BUFFER_SIZE", 0x0DF1}, + {"GL_FEEDBACK_BUFFER_TYPE", 0x0DF2}, + {"GL_SELECTION_BUFFER_POINTER", 0x0DF3}, + {"GL_SELECTION_BUFFER_SIZE", 0x0DF4}, + {"GL_TEXTURE_WIDTH", 0x1000}, + {"GL_TEXTURE_HEIGHT", 0x1001}, + {"GL_TEXTURE_INTERNAL_FORMAT", 0x1003}, + {"GL_TEXTURE_COMPONENTS", 0x1003}, + {"GL_TEXTURE_BORDER_COLOR", 0x1004}, + {"GL_TEXTURE_BORDER_COLOR_NV", 0x1004}, + {"GL_TEXTURE_BORDER", 0x1005}, + {"GL_DONT_CARE", 0x1100}, + {"GL_FASTEST", 0x1101}, + {"GL_NICEST", 0x1102}, + {"GL_AMBIENT", 0x1200}, + {"GL_DIFFUSE", 0x1201}, + {"GL_SPECULAR", 0x1202}, + {"GL_POSITION", 0x1203}, + {"GL_SPOT_DIRECTION", 0x1204}, + {"GL_SPOT_EXPONENT", 0x1205}, + {"GL_SPOT_CUTOFF", 0x1206}, + {"GL_CONSTANT_ATTENUATION", 0x1207}, + {"GL_LINEAR_ATTENUATION", 0x1208}, + {"GL_QUADRATIC_ATTENUATION", 0x1209}, + {"GL_COMPILE", 0x1300}, + {"GL_COMPILE_AND_EXECUTE", 0x1301}, + {"GL_BYTE", 0x1400}, + {"GL_UNSIGNED_BYTE", 0x1401}, + {"GL_SHORT", 0x1402}, + {"GL_UNSIGNED_SHORT", 0x1403}, + {"GL_INT", 0x1404}, + {"GL_UNSIGNED_INT", 0x1405}, + {"GL_FLOAT", 0x1406}, + {"GL_2_BYTES", 0x1407}, + {"GL_3_BYTES", 0x1408}, + {"GL_4_BYTES", 0x1409}, + {"GL_DOUBLE", 0x140A}, + {"GL_DOUBLE_EXT", 0x140A}, + {"GL_HALF_FLOAT", 0x140B}, + {"GL_HALF_FLOAT_ARB", 0x140B}, + {"GL_HALF_FLOAT_NV", 0x140B}, + {"GL_HALF_APPLE", 0x140B}, + {"GL_FIXED", 0x140C}, + {"GL_FIXED_OES", 0x140C}, + {"GL_INT64_NV", 0x140E}, + {"GL_UNSIGNED_INT64_ARB", 0x140F}, + {"GL_UNSIGNED_INT64_NV", 0x140F}, + {"GL_CLEAR", 0x1500}, + {"GL_AND", 0x1501}, + {"GL_AND_REVERSE", 0x1502}, + {"GL_COPY", 0x1503}, + {"GL_AND_INVERTED", 0x1504}, + {"GL_NOOP", 0x1505}, + {"GL_XOR", 0x1506}, + {"GL_OR", 0x1507}, + {"GL_NOR", 0x1508}, + {"GL_EQUIV", 0x1509}, + {"GL_INVERT", 0x150A}, + {"GL_OR_REVERSE", 0x150B}, + {"GL_COPY_INVERTED", 0x150C}, + {"GL_OR_INVERTED", 0x150D}, + {"GL_NAND", 0x150E}, + {"GL_SET", 0x150F}, + {"GL_EMISSION", 0x1600}, + {"GL_SHININESS", 0x1601}, + {"GL_AMBIENT_AND_DIFFUSE", 0x1602}, + {"GL_COLOR_INDEXES", 0x1603}, + {"GL_MODELVIEW", 0x1700}, + {"GL_MODELVIEW0_ARB", 0x1700}, + {"GL_MODELVIEW0_EXT", 0x1700}, + {"GL_PROJECTION", 0x1701}, + {"GL_TEXTURE", 0x1702}, + {"GL_COLOR", 0x1800}, + {"GL_COLOR_EXT", 0x1800}, + {"GL_DEPTH", 0x1801}, + {"GL_DEPTH_EXT", 0x1801}, + {"GL_STENCIL", 0x1802}, + {"GL_STENCIL_EXT", 0x1802}, + {"GL_COLOR_INDEX", 0x1900}, + {"GL_STENCIL_INDEX", 0x1901}, + {"GL_DEPTH_COMPONENT", 0x1902}, + {"GL_RED", 0x1903}, + {"GL_RED_EXT", 0x1903}, + {"GL_GREEN", 0x1904}, + {"GL_BLUE", 0x1905}, + {"GL_ALPHA", 0x1906}, + {"GL_RGB", 0x1907}, + {"GL_RGBA", 0x1908}, + {"GL_LUMINANCE", 0x1909}, + {"GL_LUMINANCE_ALPHA", 0x190A}, + {"GL_BITMAP", 0x1A00}, + {"GL_POINT", 0x1B00}, + {"GL_LINE", 0x1B01}, + {"GL_FILL", 0x1B02}, + {"GL_RENDER", 0x1C00}, + {"GL_FEEDBACK", 0x1C01}, + {"GL_SELECT", 0x1C02}, + {"GL_FLAT", 0x1D00}, + {"GL_SMOOTH", 0x1D01}, + {"GL_KEEP", 0x1E00}, + {"GL_REPLACE", 0x1E01}, + {"GL_INCR", 0x1E02}, + {"GL_DECR", 0x1E03}, + {"GL_VENDOR", 0x1F00}, + {"GL_RENDERER", 0x1F01}, + {"GL_VERSION", 0x1F02}, + {"GL_EXTENSIONS", 0x1F03}, + {"GL_S", 0x2000}, + {"GL_T", 0x2001}, + {"GL_R", 0x2002}, + {"GL_Q", 0x2003}, + {"GL_MODULATE", 0x2100}, + {"GL_DECAL", 0x2101}, + {"GL_TEXTURE_ENV_MODE", 0x2200}, + {"GL_TEXTURE_ENV_COLOR", 0x2201}, + {"GL_TEXTURE_ENV", 0x2300}, + {"GL_EYE_LINEAR", 0x2400}, + {"GL_OBJECT_LINEAR", 0x2401}, + {"GL_SPHERE_MAP", 0x2402}, + {"GL_TEXTURE_GEN_MODE", 0x2500}, + {"GL_OBJECT_PLANE", 0x2501}, + {"GL_EYE_PLANE", 0x2502}, + {"GL_NEAREST", 0x2600}, + {"GL_LINEAR", 0x2601}, + {"GL_NEAREST_MIPMAP_NEAREST", 0x2700}, + {"GL_LINEAR_MIPMAP_NEAREST", 0x2701}, + {"GL_NEAREST_MIPMAP_LINEAR", 0x2702}, + {"GL_LINEAR_MIPMAP_LINEAR", 0x2703}, + {"GL_TEXTURE_MAG_FILTER", 0x2800}, + {"GL_TEXTURE_MIN_FILTER", 0x2801}, + {"GL_TEXTURE_WRAP_S", 0x2802}, + {"GL_TEXTURE_WRAP_T", 0x2803}, + {"GL_CLAMP", 0x2900}, + {"GL_REPEAT", 0x2901}, + {"GL_POLYGON_OFFSET_UNITS", 0x2A00}, + {"GL_POLYGON_OFFSET_POINT", 0x2A01}, + {"GL_POLYGON_OFFSET_LINE", 0x2A02}, + {"GL_R3_G3_B2", 0x2A10}, + {"GL_V2F", 0x2A20}, + {"GL_V3F", 0x2A21}, + {"GL_C4UB_V2F", 0x2A22}, + {"GL_C4UB_V3F", 0x2A23}, + {"GL_C3F_V3F", 0x2A24}, + {"GL_N3F_V3F", 0x2A25}, + {"GL_C4F_N3F_V3F", 0x2A26}, + {"GL_T2F_V3F", 0x2A27}, + {"GL_T4F_V4F", 0x2A28}, + {"GL_T2F_C4UB_V3F", 0x2A29}, + {"GL_T2F_C3F_V3F", 0x2A2A}, + {"GL_T2F_N3F_V3F", 0x2A2B}, + {"GL_T2F_C4F_N3F_V3F", 0x2A2C}, + {"GL_T4F_C4F_N3F_V4F", 0x2A2D}, + {"GL_CLIP_PLANE0", 0x3000}, + {"GL_CLIP_DISTANCE0", 0x3000}, + {"GL_CLIP_PLANE1", 0x3001}, + {"GL_CLIP_DISTANCE1", 0x3001}, + {"GL_CLIP_PLANE2", 0x3002}, + {"GL_CLIP_DISTANCE2", 0x3002}, + {"GL_CLIP_PLANE3", 0x3003}, + {"GL_CLIP_DISTANCE3", 0x3003}, + {"GL_CLIP_PLANE4", 0x3004}, + {"GL_CLIP_DISTANCE4", 0x3004}, + {"GL_CLIP_PLANE5", 0x3005}, + {"GL_CLIP_DISTANCE5", 0x3005}, + {"GL_CLIP_DISTANCE6", 0x3006}, + {"GL_CLIP_DISTANCE7", 0x3007}, + {"GL_LIGHT0", 0x4000}, + {"GL_LIGHT1", 0x4001}, + {"GL_LIGHT2", 0x4002}, + {"GL_LIGHT3", 0x4003}, + {"GL_LIGHT4", 0x4004}, + {"GL_LIGHT5", 0x4005}, + {"GL_LIGHT6", 0x4006}, + {"GL_LIGHT7", 0x4007}, + {"GL_ABGR_EXT", 0x8000}, + {"GL_CONSTANT_COLOR", 0x8001}, + {"GL_CONSTANT_COLOR_EXT", 0x8001}, + {"GL_ONE_MINUS_CONSTANT_COLOR", 0x8002}, + {"GL_ONE_MINUS_CONSTANT_COLOR_EXT", 0x8002}, + {"GL_CONSTANT_ALPHA", 0x8003}, + {"GL_CONSTANT_ALPHA_EXT", 0x8003}, + {"GL_ONE_MINUS_CONSTANT_ALPHA", 0x8004}, + {"GL_ONE_MINUS_CONSTANT_ALPHA_EXT", 0x8004}, + {"GL_BLEND_COLOR", 0x8005}, + {"GL_BLEND_COLOR_EXT", 0x8005}, + {"GL_FUNC_ADD", 0x8006}, + {"GL_FUNC_ADD_EXT", 0x8006}, + {"GL_FUNC_ADD_OES", 0x8006}, + {"GL_MIN", 0x8007}, + {"GL_MIN_EXT", 0x8007}, + {"GL_MAX", 0x8008}, + {"GL_MAX_EXT", 0x8008}, + {"GL_BLEND_EQUATION", 0x8009}, + {"GL_BLEND_EQUATION_EXT", 0x8009}, + {"GL_BLEND_EQUATION_OES", 0x8009}, + {"GL_BLEND_EQUATION_RGB", 0x8009}, + {"GL_BLEND_EQUATION_RGB_EXT", 0x8009}, + {"GL_BLEND_EQUATION_RGB_OES", 0x8009}, + {"GL_FUNC_SUBTRACT", 0x800A}, + {"GL_FUNC_SUBTRACT_EXT", 0x800A}, + {"GL_FUNC_SUBTRACT_OES", 0x800A}, + {"GL_FUNC_REVERSE_SUBTRACT", 0x800B}, + {"GL_FUNC_REVERSE_SUBTRACT_EXT", 0x800B}, + {"GL_FUNC_REVERSE_SUBTRACT_OES", 0x800B}, + {"GL_CMYK_EXT", 0x800C}, + {"GL_CMYKA_EXT", 0x800D}, + {"GL_PACK_CMYK_HINT_EXT", 0x800E}, + {"GL_UNPACK_CMYK_HINT_EXT", 0x800F}, + {"GL_CONVOLUTION_1D", 0x8010}, + {"GL_CONVOLUTION_1D_EXT", 0x8010}, + {"GL_CONVOLUTION_2D", 0x8011}, + {"GL_CONVOLUTION_2D_EXT", 0x8011}, + {"GL_SEPARABLE_2D", 0x8012}, + {"GL_SEPARABLE_2D_EXT", 0x8012}, + {"GL_CONVOLUTION_BORDER_MODE", 0x8013}, + {"GL_CONVOLUTION_BORDER_MODE_EXT", 0x8013}, + {"GL_CONVOLUTION_FILTER_SCALE", 0x8014}, + {"GL_CONVOLUTION_FILTER_SCALE_EXT", 0x8014}, + {"GL_CONVOLUTION_FILTER_BIAS", 0x8015}, + {"GL_CONVOLUTION_FILTER_BIAS_EXT", 0x8015}, + {"GL_REDUCE", 0x8016}, + {"GL_REDUCE_EXT", 0x8016}, + {"GL_CONVOLUTION_FORMAT", 0x8017}, + {"GL_CONVOLUTION_FORMAT_EXT", 0x8017}, + {"GL_CONVOLUTION_WIDTH", 0x8018}, + {"GL_CONVOLUTION_WIDTH_EXT", 0x8018}, + {"GL_CONVOLUTION_HEIGHT", 0x8019}, + {"GL_CONVOLUTION_HEIGHT_EXT", 0x8019}, + {"GL_MAX_CONVOLUTION_WIDTH", 0x801A}, + {"GL_MAX_CONVOLUTION_WIDTH_EXT", 0x801A}, + {"GL_MAX_CONVOLUTION_HEIGHT", 0x801B}, + {"GL_MAX_CONVOLUTION_HEIGHT_EXT", 0x801B}, + {"GL_POST_CONVOLUTION_RED_SCALE", 0x801C}, + {"GL_POST_CONVOLUTION_RED_SCALE_EXT", 0x801C}, + {"GL_POST_CONVOLUTION_GREEN_SCALE", 0x801D}, + {"GL_POST_CONVOLUTION_GREEN_SCALE_EXT", 0x801D}, + {"GL_POST_CONVOLUTION_BLUE_SCALE", 0x801E}, + {"GL_POST_CONVOLUTION_BLUE_SCALE_EXT", 0x801E}, + {"GL_POST_CONVOLUTION_ALPHA_SCALE", 0x801F}, + {"GL_POST_CONVOLUTION_ALPHA_SCALE_EXT", 0x801F}, + {"GL_POST_CONVOLUTION_RED_BIAS", 0x8020}, + {"GL_POST_CONVOLUTION_RED_BIAS_EXT", 0x8020}, + {"GL_POST_CONVOLUTION_GREEN_BIAS", 0x8021}, + {"GL_POST_CONVOLUTION_GREEN_BIAS_EXT", 0x8021}, + {"GL_POST_CONVOLUTION_BLUE_BIAS", 0x8022}, + {"GL_POST_CONVOLUTION_BLUE_BIAS_EXT", 0x8022}, + {"GL_POST_CONVOLUTION_ALPHA_BIAS", 0x8023}, + {"GL_POST_CONVOLUTION_ALPHA_BIAS_EXT", 0x8023}, + {"GL_HISTOGRAM", 0x8024}, + {"GL_HISTOGRAM_EXT", 0x8024}, + {"GL_PROXY_HISTOGRAM", 0x8025}, + {"GL_PROXY_HISTOGRAM_EXT", 0x8025}, + {"GL_HISTOGRAM_WIDTH", 0x8026}, + {"GL_HISTOGRAM_WIDTH_EXT", 0x8026}, + {"GL_HISTOGRAM_FORMAT", 0x8027}, + {"GL_HISTOGRAM_FORMAT_EXT", 0x8027}, + {"GL_HISTOGRAM_RED_SIZE", 0x8028}, + {"GL_HISTOGRAM_RED_SIZE_EXT", 0x8028}, + {"GL_HISTOGRAM_GREEN_SIZE", 0x8029}, + {"GL_HISTOGRAM_GREEN_SIZE_EXT", 0x8029}, + {"GL_HISTOGRAM_BLUE_SIZE", 0x802A}, + {"GL_HISTOGRAM_BLUE_SIZE_EXT", 0x802A}, + {"GL_HISTOGRAM_ALPHA_SIZE", 0x802B}, + {"GL_HISTOGRAM_ALPHA_SIZE_EXT", 0x802B}, + {"GL_HISTOGRAM_LUMINANCE_SIZE", 0x802C}, + {"GL_HISTOGRAM_LUMINANCE_SIZE_EXT", 0x802C}, + {"GL_HISTOGRAM_SINK", 0x802D}, + {"GL_HISTOGRAM_SINK_EXT", 0x802D}, + {"GL_MINMAX", 0x802E}, + {"GL_MINMAX_EXT", 0x802E}, + {"GL_MINMAX_FORMAT", 0x802F}, + {"GL_MINMAX_FORMAT_EXT", 0x802F}, + {"GL_MINMAX_SINK", 0x8030}, + {"GL_MINMAX_SINK_EXT", 0x8030}, + {"GL_TABLE_TOO_LARGE_EXT", 0x8031}, + {"GL_TABLE_TOO_LARGE", 0x8031}, + {"GL_UNSIGNED_BYTE_3_3_2", 0x8032}, + {"GL_UNSIGNED_BYTE_3_3_2_EXT", 0x8032}, + {"GL_UNSIGNED_SHORT_4_4_4_4", 0x8033}, + {"GL_UNSIGNED_SHORT_4_4_4_4_EXT", 0x8033}, + {"GL_UNSIGNED_SHORT_5_5_5_1", 0x8034}, + {"GL_UNSIGNED_SHORT_5_5_5_1_EXT", 0x8034}, + {"GL_UNSIGNED_INT_8_8_8_8", 0x8035}, + {"GL_UNSIGNED_INT_8_8_8_8_EXT", 0x8035}, + {"GL_UNSIGNED_INT_10_10_10_2", 0x8036}, + {"GL_UNSIGNED_INT_10_10_10_2_EXT", 0x8036}, + {"GL_POLYGON_OFFSET_EXT", 0x8037}, + {"GL_POLYGON_OFFSET_FILL", 0x8037}, + {"GL_POLYGON_OFFSET_FACTOR", 0x8038}, + {"GL_POLYGON_OFFSET_FACTOR_EXT", 0x8038}, + {"GL_POLYGON_OFFSET_BIAS_EXT", 0x8039}, + {"GL_RESCALE_NORMAL", 0x803A}, + {"GL_RESCALE_NORMAL_EXT", 0x803A}, + {"GL_ALPHA4", 0x803B}, + {"GL_ALPHA4_EXT", 0x803B}, + {"GL_ALPHA8", 0x803C}, + {"GL_ALPHA8_EXT", 0x803C}, + {"GL_ALPHA12", 0x803D}, + {"GL_ALPHA12_EXT", 0x803D}, + {"GL_ALPHA16", 0x803E}, + {"GL_ALPHA16_EXT", 0x803E}, + {"GL_LUMINANCE4", 0x803F}, + {"GL_LUMINANCE4_EXT", 0x803F}, + {"GL_LUMINANCE8", 0x8040}, + {"GL_LUMINANCE8_EXT", 0x8040}, + {"GL_LUMINANCE12", 0x8041}, + {"GL_LUMINANCE12_EXT", 0x8041}, + {"GL_LUMINANCE16", 0x8042}, + {"GL_LUMINANCE16_EXT", 0x8042}, + {"GL_LUMINANCE4_ALPHA4", 0x8043}, + {"GL_LUMINANCE4_ALPHA4_EXT", 0x8043}, + {"GL_LUMINANCE6_ALPHA2", 0x8044}, + {"GL_LUMINANCE6_ALPHA2_EXT", 0x8044}, + {"GL_LUMINANCE8_ALPHA8", 0x8045}, + {"GL_LUMINANCE8_ALPHA8_EXT", 0x8045}, + {"GL_LUMINANCE12_ALPHA4", 0x8046}, + {"GL_LUMINANCE12_ALPHA4_EXT", 0x8046}, + {"GL_LUMINANCE12_ALPHA12", 0x8047}, + {"GL_LUMINANCE12_ALPHA12_EXT", 0x8047}, + {"GL_LUMINANCE16_ALPHA16", 0x8048}, + {"GL_LUMINANCE16_ALPHA16_EXT", 0x8048}, + {"GL_INTENSITY", 0x8049}, + {"GL_INTENSITY_EXT", 0x8049}, + {"GL_INTENSITY4", 0x804A}, + {"GL_INTENSITY4_EXT", 0x804A}, + {"GL_INTENSITY8", 0x804B}, + {"GL_INTENSITY8_EXT", 0x804B}, + {"GL_INTENSITY12", 0x804C}, + {"GL_INTENSITY12_EXT", 0x804C}, + {"GL_INTENSITY16", 0x804D}, + {"GL_INTENSITY16_EXT", 0x804D}, + {"GL_RGB2_EXT", 0x804E}, + {"GL_RGB4", 0x804F}, + {"GL_RGB4_EXT", 0x804F}, + {"GL_RGB5", 0x8050}, + {"GL_RGB5_EXT", 0x8050}, + {"GL_RGB8", 0x8051}, + {"GL_RGB8_EXT", 0x8051}, + {"GL_RGB10", 0x8052}, + {"GL_RGB10_EXT", 0x8052}, + {"GL_RGB12", 0x8053}, + {"GL_RGB12_EXT", 0x8053}, + {"GL_RGB16", 0x8054}, + {"GL_RGB16_EXT", 0x8054}, + {"GL_RGBA2", 0x8055}, + {"GL_RGBA2_EXT", 0x8055}, + {"GL_RGBA4", 0x8056}, + {"GL_RGBA4_EXT", 0x8056}, + {"GL_RGBA4_OES", 0x8056}, + {"GL_RGB5_A1", 0x8057}, + {"GL_RGB5_A1_EXT", 0x8057}, + {"GL_RGB5_A1_OES", 0x8057}, + {"GL_RGBA8", 0x8058}, + {"GL_RGBA8_EXT", 0x8058}, + {"GL_RGBA8_OES", 0x8058}, + {"GL_RGB10_A2", 0x8059}, + {"GL_RGB10_A2_EXT", 0x8059}, + {"GL_RGBA12", 0x805A}, + {"GL_RGBA12_EXT", 0x805A}, + {"GL_RGBA16", 0x805B}, + {"GL_RGBA16_EXT", 0x805B}, + {"GL_TEXTURE_RED_SIZE", 0x805C}, + {"GL_TEXTURE_RED_SIZE_EXT", 0x805C}, + {"GL_TEXTURE_GREEN_SIZE", 0x805D}, + {"GL_TEXTURE_GREEN_SIZE_EXT", 0x805D}, + {"GL_TEXTURE_BLUE_SIZE", 0x805E}, + {"GL_TEXTURE_BLUE_SIZE_EXT", 0x805E}, + {"GL_TEXTURE_ALPHA_SIZE", 0x805F}, + {"GL_TEXTURE_ALPHA_SIZE_EXT", 0x805F}, + {"GL_TEXTURE_LUMINANCE_SIZE", 0x8060}, + {"GL_TEXTURE_LUMINANCE_SIZE_EXT", 0x8060}, + {"GL_TEXTURE_INTENSITY_SIZE", 0x8061}, + {"GL_TEXTURE_INTENSITY_SIZE_EXT", 0x8061}, + {"GL_REPLACE_EXT", 0x8062}, + {"GL_PROXY_TEXTURE_1D", 0x8063}, + {"GL_PROXY_TEXTURE_1D_EXT", 0x8063}, + {"GL_PROXY_TEXTURE_2D", 0x8064}, + {"GL_PROXY_TEXTURE_2D_EXT", 0x8064}, + {"GL_TEXTURE_TOO_LARGE_EXT", 0x8065}, + {"GL_TEXTURE_PRIORITY", 0x8066}, + {"GL_TEXTURE_PRIORITY_EXT", 0x8066}, + {"GL_TEXTURE_RESIDENT", 0x8067}, + {"GL_TEXTURE_RESIDENT_EXT", 0x8067}, + {"GL_TEXTURE_1D_BINDING_EXT", 0x8068}, + {"GL_TEXTURE_BINDING_1D", 0x8068}, + {"GL_TEXTURE_2D_BINDING_EXT", 0x8069}, + {"GL_TEXTURE_BINDING_2D", 0x8069}, + {"GL_TEXTURE_3D_BINDING_EXT", 0x806A}, + {"GL_TEXTURE_3D_BINDING_OES", 0x806A}, + {"GL_TEXTURE_BINDING_3D", 0x806A}, + {"GL_PACK_SKIP_IMAGES", 0x806B}, + {"GL_PACK_SKIP_IMAGES_EXT", 0x806B}, + {"GL_PACK_IMAGE_HEIGHT", 0x806C}, + {"GL_PACK_IMAGE_HEIGHT_EXT", 0x806C}, + {"GL_UNPACK_SKIP_IMAGES", 0x806D}, + {"GL_UNPACK_SKIP_IMAGES_EXT", 0x806D}, + {"GL_UNPACK_IMAGE_HEIGHT", 0x806E}, + {"GL_UNPACK_IMAGE_HEIGHT_EXT", 0x806E}, + {"GL_TEXTURE_3D", 0x806F}, + {"GL_TEXTURE_3D_EXT", 0x806F}, + {"GL_TEXTURE_3D_OES", 0x806F}, + {"GL_PROXY_TEXTURE_3D", 0x8070}, + {"GL_PROXY_TEXTURE_3D_EXT", 0x8070}, + {"GL_TEXTURE_DEPTH", 0x8071}, + {"GL_TEXTURE_DEPTH_EXT", 0x8071}, + {"GL_TEXTURE_WRAP_R", 0x8072}, + {"GL_TEXTURE_WRAP_R_EXT", 0x8072}, + {"GL_TEXTURE_WRAP_R_OES", 0x8072}, + {"GL_MAX_3D_TEXTURE_SIZE", 0x8073}, + {"GL_MAX_3D_TEXTURE_SIZE_EXT", 0x8073}, + {"GL_MAX_3D_TEXTURE_SIZE_OES", 0x8073}, + {"GL_VERTEX_ARRAY", 0x8074}, + {"GL_VERTEX_ARRAY_EXT", 0x8074}, + {"GL_VERTEX_ARRAY_KHR", 0x8074}, + {"GL_NORMAL_ARRAY", 0x8075}, + {"GL_NORMAL_ARRAY_EXT", 0x8075}, + {"GL_COLOR_ARRAY", 0x8076}, + {"GL_COLOR_ARRAY_EXT", 0x8076}, + {"GL_INDEX_ARRAY", 0x8077}, + {"GL_INDEX_ARRAY_EXT", 0x8077}, + {"GL_TEXTURE_COORD_ARRAY", 0x8078}, + {"GL_TEXTURE_COORD_ARRAY_EXT", 0x8078}, + {"GL_EDGE_FLAG_ARRAY", 0x8079}, + {"GL_EDGE_FLAG_ARRAY_EXT", 0x8079}, + {"GL_VERTEX_ARRAY_SIZE", 0x807A}, + {"GL_VERTEX_ARRAY_SIZE_EXT", 0x807A}, + {"GL_VERTEX_ARRAY_TYPE", 0x807B}, + {"GL_VERTEX_ARRAY_TYPE_EXT", 0x807B}, + {"GL_VERTEX_ARRAY_STRIDE", 0x807C}, + {"GL_VERTEX_ARRAY_STRIDE_EXT", 0x807C}, + {"GL_VERTEX_ARRAY_COUNT_EXT", 0x807D}, + {"GL_NORMAL_ARRAY_TYPE", 0x807E}, + {"GL_NORMAL_ARRAY_TYPE_EXT", 0x807E}, + {"GL_NORMAL_ARRAY_STRIDE", 0x807F}, + {"GL_NORMAL_ARRAY_STRIDE_EXT", 0x807F}, + {"GL_NORMAL_ARRAY_COUNT_EXT", 0x8080}, + {"GL_COLOR_ARRAY_SIZE", 0x8081}, + {"GL_COLOR_ARRAY_SIZE_EXT", 0x8081}, + {"GL_COLOR_ARRAY_TYPE", 0x8082}, + {"GL_COLOR_ARRAY_TYPE_EXT", 0x8082}, + {"GL_COLOR_ARRAY_STRIDE", 0x8083}, + {"GL_COLOR_ARRAY_STRIDE_EXT", 0x8083}, + {"GL_COLOR_ARRAY_COUNT_EXT", 0x8084}, + {"GL_INDEX_ARRAY_TYPE", 0x8085}, + {"GL_INDEX_ARRAY_TYPE_EXT", 0x8085}, + {"GL_INDEX_ARRAY_STRIDE", 0x8086}, + {"GL_INDEX_ARRAY_STRIDE_EXT", 0x8086}, + {"GL_INDEX_ARRAY_COUNT_EXT", 0x8087}, + {"GL_TEXTURE_COORD_ARRAY_SIZE", 0x8088}, + {"GL_TEXTURE_COORD_ARRAY_SIZE_EXT", 0x8088}, + {"GL_TEXTURE_COORD_ARRAY_TYPE", 0x8089}, + {"GL_TEXTURE_COORD_ARRAY_TYPE_EXT", 0x8089}, + {"GL_TEXTURE_COORD_ARRAY_STRIDE", 0x808A}, + {"GL_TEXTURE_COORD_ARRAY_STRIDE_EXT", 0x808A}, + {"GL_TEXTURE_COORD_ARRAY_COUNT_EXT", 0x808B}, + {"GL_EDGE_FLAG_ARRAY_STRIDE", 0x808C}, + {"GL_EDGE_FLAG_ARRAY_STRIDE_EXT", 0x808C}, + {"GL_EDGE_FLAG_ARRAY_COUNT_EXT", 0x808D}, + {"GL_VERTEX_ARRAY_POINTER", 0x808E}, + {"GL_VERTEX_ARRAY_POINTER_EXT", 0x808E}, + {"GL_NORMAL_ARRAY_POINTER", 0x808F}, + {"GL_NORMAL_ARRAY_POINTER_EXT", 0x808F}, + {"GL_COLOR_ARRAY_POINTER", 0x8090}, + {"GL_COLOR_ARRAY_POINTER_EXT", 0x8090}, + {"GL_INDEX_ARRAY_POINTER", 0x8091}, + {"GL_INDEX_ARRAY_POINTER_EXT", 0x8091}, + {"GL_TEXTURE_COORD_ARRAY_POINTER", 0x8092}, + {"GL_TEXTURE_COORD_ARRAY_POINTER_EXT", 0x8092}, + {"GL_EDGE_FLAG_ARRAY_POINTER", 0x8093}, + {"GL_EDGE_FLAG_ARRAY_POINTER_EXT", 0x8093}, + {"GL_INTERLACE_SGIX", 0x8094}, + {"GL_DETAIL_TEXTURE_2D_SGIS", 0x8095}, + {"GL_DETAIL_TEXTURE_2D_BINDING_SGIS", 0x8096}, + {"GL_LINEAR_DETAIL_SGIS", 0x8097}, + {"GL_LINEAR_DETAIL_ALPHA_SGIS", 0x8098}, + {"GL_LINEAR_DETAIL_COLOR_SGIS", 0x8099}, + {"GL_DETAIL_TEXTURE_LEVEL_SGIS", 0x809A}, + {"GL_DETAIL_TEXTURE_MODE_SGIS", 0x809B}, + {"GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS", 0x809C}, + {"GL_MULTISAMPLE", 0x809D}, + {"GL_MULTISAMPLE_ARB", 0x809D}, + {"GL_MULTISAMPLE_EXT", 0x809D}, + {"GL_MULTISAMPLE_SGIS", 0x809D}, + {"GL_SAMPLE_ALPHA_TO_COVERAGE", 0x809E}, + {"GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", 0x809E}, + {"GL_SAMPLE_ALPHA_TO_MASK_EXT", 0x809E}, + {"GL_SAMPLE_ALPHA_TO_MASK_SGIS", 0x809E}, + {"GL_SAMPLE_ALPHA_TO_ONE", 0x809F}, + {"GL_SAMPLE_ALPHA_TO_ONE_ARB", 0x809F}, + {"GL_SAMPLE_ALPHA_TO_ONE_EXT", 0x809F}, + {"GL_SAMPLE_ALPHA_TO_ONE_SGIS", 0x809F}, + {"GL_SAMPLE_COVERAGE", 0x80A0}, + {"GL_SAMPLE_COVERAGE_ARB", 0x80A0}, + {"GL_SAMPLE_MASK_EXT", 0x80A0}, + {"GL_SAMPLE_MASK_SGIS", 0x80A0}, + {"GL_1PASS_EXT", 0x80A1}, + {"GL_1PASS_SGIS", 0x80A1}, + {"GL_2PASS_0_EXT", 0x80A2}, + {"GL_2PASS_0_SGIS", 0x80A2}, + {"GL_2PASS_1_EXT", 0x80A3}, + {"GL_2PASS_1_SGIS", 0x80A3}, + {"GL_4PASS_0_EXT", 0x80A4}, + {"GL_4PASS_0_SGIS", 0x80A4}, + {"GL_4PASS_1_EXT", 0x80A5}, + {"GL_4PASS_1_SGIS", 0x80A5}, + {"GL_4PASS_2_EXT", 0x80A6}, + {"GL_4PASS_2_SGIS", 0x80A6}, + {"GL_4PASS_3_EXT", 0x80A7}, + {"GL_4PASS_3_SGIS", 0x80A7}, + {"GL_SAMPLE_BUFFERS", 0x80A8}, + {"GL_SAMPLE_BUFFERS_ARB", 0x80A8}, + {"GL_SAMPLE_BUFFERS_EXT", 0x80A8}, + {"GL_SAMPLE_BUFFERS_SGIS", 0x80A8}, + {"GL_SAMPLES", 0x80A9}, + {"GL_SAMPLES_ARB", 0x80A9}, + {"GL_SAMPLES_EXT", 0x80A9}, + {"GL_SAMPLES_SGIS", 0x80A9}, + {"GL_SAMPLE_COVERAGE_VALUE", 0x80AA}, + {"GL_SAMPLE_COVERAGE_VALUE_ARB", 0x80AA}, + {"GL_SAMPLE_MASK_VALUE_EXT", 0x80AA}, + {"GL_SAMPLE_MASK_VALUE_SGIS", 0x80AA}, + {"GL_SAMPLE_COVERAGE_INVERT", 0x80AB}, + {"GL_SAMPLE_COVERAGE_INVERT_ARB", 0x80AB}, + {"GL_SAMPLE_MASK_INVERT_EXT", 0x80AB}, + {"GL_SAMPLE_MASK_INVERT_SGIS", 0x80AB}, + {"GL_SAMPLE_PATTERN_EXT", 0x80AC}, + {"GL_SAMPLE_PATTERN_SGIS", 0x80AC}, + {"GL_LINEAR_SHARPEN_SGIS", 0x80AD}, + {"GL_LINEAR_SHARPEN_ALPHA_SGIS", 0x80AE}, + {"GL_LINEAR_SHARPEN_COLOR_SGIS", 0x80AF}, + {"GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS", 0x80B0}, + {"GL_COLOR_MATRIX", 0x80B1}, + {"GL_COLOR_MATRIX_SGI", 0x80B1}, + {"GL_COLOR_MATRIX_STACK_DEPTH", 0x80B2}, + {"GL_COLOR_MATRIX_STACK_DEPTH_SGI", 0x80B2}, + {"GL_MAX_COLOR_MATRIX_STACK_DEPTH", 0x80B3}, + {"GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI", 0x80B3}, + {"GL_POST_COLOR_MATRIX_RED_SCALE", 0x80B4}, + {"GL_POST_COLOR_MATRIX_RED_SCALE_SGI", 0x80B4}, + {"GL_POST_COLOR_MATRIX_GREEN_SCALE", 0x80B5}, + {"GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI", 0x80B5}, + {"GL_POST_COLOR_MATRIX_BLUE_SCALE", 0x80B6}, + {"GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI", 0x80B6}, + {"GL_POST_COLOR_MATRIX_ALPHA_SCALE", 0x80B7}, + {"GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI", 0x80B7}, + {"GL_POST_COLOR_MATRIX_RED_BIAS", 0x80B8}, + {"GL_POST_COLOR_MATRIX_RED_BIAS_SGI", 0x80B8}, + {"GL_POST_COLOR_MATRIX_GREEN_BIAS", 0x80B9}, + {"GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI", 0x80B9}, + {"GL_POST_COLOR_MATRIX_BLUE_BIAS", 0x80BA}, + {"GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI", 0x80BA}, + {"GL_POST_COLOR_MATRIX_ALPHA_BIAS", 0x80BB}, + {"GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI", 0x80BB}, + {"GL_TEXTURE_COLOR_TABLE_SGI", 0x80BC}, + {"GL_PROXY_TEXTURE_COLOR_TABLE_SGI", 0x80BD}, + {"GL_TEXTURE_ENV_BIAS_SGIX", 0x80BE}, + {"GL_SHADOW_AMBIENT_SGIX", 0x80BF}, + {"GL_TEXTURE_COMPARE_FAIL_VALUE_ARB", 0x80BF}, + {"GL_BLEND_DST_RGB", 0x80C8}, + {"GL_BLEND_DST_RGB_EXT", 0x80C8}, + {"GL_BLEND_DST_RGB_OES", 0x80C8}, + {"GL_BLEND_SRC_RGB", 0x80C9}, + {"GL_BLEND_SRC_RGB_EXT", 0x80C9}, + {"GL_BLEND_SRC_RGB_OES", 0x80C9}, + {"GL_BLEND_DST_ALPHA", 0x80CA}, + {"GL_BLEND_DST_ALPHA_EXT", 0x80CA}, + {"GL_BLEND_DST_ALPHA_OES", 0x80CA}, + {"GL_BLEND_SRC_ALPHA", 0x80CB}, + {"GL_BLEND_SRC_ALPHA_EXT", 0x80CB}, + {"GL_BLEND_SRC_ALPHA_OES", 0x80CB}, + {"GL_422_EXT", 0x80CC}, + {"GL_422_REV_EXT", 0x80CD}, + {"GL_422_AVERAGE_EXT", 0x80CE}, + {"GL_422_REV_AVERAGE_EXT", 0x80CF}, + {"GL_COLOR_TABLE", 0x80D0}, + {"GL_COLOR_TABLE_SGI", 0x80D0}, + {"GL_POST_CONVOLUTION_COLOR_TABLE", 0x80D1}, + {"GL_POST_CONVOLUTION_COLOR_TABLE_SGI", 0x80D1}, + {"GL_POST_COLOR_MATRIX_COLOR_TABLE", 0x80D2}, + {"GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", 0x80D2}, + {"GL_PROXY_COLOR_TABLE", 0x80D3}, + {"GL_PROXY_COLOR_TABLE_SGI", 0x80D3}, + {"GL_PROXY_POST_CONVOLUTION_COLOR_TABLE", 0x80D4}, + {"GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI", 0x80D4}, + {"GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE", 0x80D5}, + {"GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI", 0x80D5}, + {"GL_COLOR_TABLE_SCALE", 0x80D6}, + {"GL_COLOR_TABLE_SCALE_SGI", 0x80D6}, + {"GL_COLOR_TABLE_BIAS", 0x80D7}, + {"GL_COLOR_TABLE_BIAS_SGI", 0x80D7}, + {"GL_COLOR_TABLE_FORMAT", 0x80D8}, + {"GL_COLOR_TABLE_FORMAT_SGI", 0x80D8}, + {"GL_COLOR_TABLE_WIDTH", 0x80D9}, + {"GL_COLOR_TABLE_WIDTH_SGI", 0x80D9}, + {"GL_COLOR_TABLE_RED_SIZE", 0x80DA}, + {"GL_COLOR_TABLE_RED_SIZE_SGI", 0x80DA}, + {"GL_COLOR_TABLE_GREEN_SIZE", 0x80DB}, + {"GL_COLOR_TABLE_GREEN_SIZE_SGI", 0x80DB}, + {"GL_COLOR_TABLE_BLUE_SIZE", 0x80DC}, + {"GL_COLOR_TABLE_BLUE_SIZE_SGI", 0x80DC}, + {"GL_COLOR_TABLE_ALPHA_SIZE", 0x80DD}, + {"GL_COLOR_TABLE_ALPHA_SIZE_SGI", 0x80DD}, + {"GL_COLOR_TABLE_LUMINANCE_SIZE", 0x80DE}, + {"GL_COLOR_TABLE_LUMINANCE_SIZE_SGI", 0x80DE}, + {"GL_COLOR_TABLE_INTENSITY_SIZE", 0x80DF}, + {"GL_COLOR_TABLE_INTENSITY_SIZE_SGI", 0x80DF}, + {"GL_BGR", 0x80E0}, + {"GL_BGR_EXT", 0x80E0}, + {"GL_BGRA", 0x80E1}, + {"GL_BGRA_EXT", 0x80E1}, + {"GL_COLOR_INDEX1_EXT", 0x80E2}, + {"GL_COLOR_INDEX2_EXT", 0x80E3}, + {"GL_COLOR_INDEX4_EXT", 0x80E4}, + {"GL_COLOR_INDEX8_EXT", 0x80E5}, + {"GL_COLOR_INDEX12_EXT", 0x80E6}, + {"GL_COLOR_INDEX16_EXT", 0x80E7}, + {"GL_MAX_ELEMENTS_VERTICES", 0x80E8}, + {"GL_MAX_ELEMENTS_VERTICES_EXT", 0x80E8}, + {"GL_MAX_ELEMENTS_INDICES", 0x80E9}, + {"GL_MAX_ELEMENTS_INDICES_EXT", 0x80E9}, + {"GL_PHONG_WIN", 0x80EA}, + {"GL_PHONG_HINT_WIN", 0x80EB}, + {"GL_FOG_SPECULAR_TEXTURE_WIN", 0x80EC}, + {"GL_TEXTURE_INDEX_SIZE_EXT", 0x80ED}, + {"GL_PARAMETER_BUFFER_ARB", 0x80EE}, + {"GL_PARAMETER_BUFFER_BINDING_ARB", 0x80EF}, + {"GL_CLIP_VOLUME_CLIPPING_HINT_EXT", 0x80F0}, + {"GL_DUAL_ALPHA4_SGIS", 0x8110}, + {"GL_DUAL_ALPHA8_SGIS", 0x8111}, + {"GL_DUAL_ALPHA12_SGIS", 0x8112}, + {"GL_DUAL_ALPHA16_SGIS", 0x8113}, + {"GL_DUAL_LUMINANCE4_SGIS", 0x8114}, + {"GL_DUAL_LUMINANCE8_SGIS", 0x8115}, + {"GL_DUAL_LUMINANCE12_SGIS", 0x8116}, + {"GL_DUAL_LUMINANCE16_SGIS", 0x8117}, + {"GL_DUAL_INTENSITY4_SGIS", 0x8118}, + {"GL_DUAL_INTENSITY8_SGIS", 0x8119}, + {"GL_DUAL_INTENSITY12_SGIS", 0x811A}, + {"GL_DUAL_INTENSITY16_SGIS", 0x811B}, + {"GL_DUAL_LUMINANCE_ALPHA4_SGIS", 0x811C}, + {"GL_DUAL_LUMINANCE_ALPHA8_SGIS", 0x811D}, + {"GL_QUAD_ALPHA4_SGIS", 0x811E}, + {"GL_QUAD_ALPHA8_SGIS", 0x811F}, + {"GL_QUAD_LUMINANCE4_SGIS", 0x8120}, + {"GL_QUAD_LUMINANCE8_SGIS", 0x8121}, + {"GL_QUAD_INTENSITY4_SGIS", 0x8122}, + {"GL_QUAD_INTENSITY8_SGIS", 0x8123}, + {"GL_DUAL_TEXTURE_SELECT_SGIS", 0x8124}, + {"GL_QUAD_TEXTURE_SELECT_SGIS", 0x8125}, + {"GL_POINT_SIZE_MIN", 0x8126}, + {"GL_POINT_SIZE_MIN_ARB", 0x8126}, + {"GL_POINT_SIZE_MIN_EXT", 0x8126}, + {"GL_POINT_SIZE_MIN_SGIS", 0x8126}, + {"GL_POINT_SIZE_MAX", 0x8127}, + {"GL_POINT_SIZE_MAX_ARB", 0x8127}, + {"GL_POINT_SIZE_MAX_EXT", 0x8127}, + {"GL_POINT_SIZE_MAX_SGIS", 0x8127}, + {"GL_POINT_FADE_THRESHOLD_SIZE", 0x8128}, + {"GL_POINT_FADE_THRESHOLD_SIZE_ARB", 0x8128}, + {"GL_POINT_FADE_THRESHOLD_SIZE_EXT", 0x8128}, + {"GL_POINT_FADE_THRESHOLD_SIZE_SGIS", 0x8128}, + {"GL_DISTANCE_ATTENUATION_EXT", 0x8129}, + {"GL_DISTANCE_ATTENUATION_SGIS", 0x8129}, + {"GL_POINT_DISTANCE_ATTENUATION", 0x8129}, + {"GL_POINT_DISTANCE_ATTENUATION_ARB", 0x8129}, + {"GL_FOG_FUNC_SGIS", 0x812A}, + {"GL_FOG_FUNC_POINTS_SGIS", 0x812B}, + {"GL_MAX_FOG_FUNC_POINTS_SGIS", 0x812C}, + {"GL_CLAMP_TO_BORDER", 0x812D}, + {"GL_CLAMP_TO_BORDER_ARB", 0x812D}, + {"GL_CLAMP_TO_BORDER_NV", 0x812D}, + {"GL_CLAMP_TO_BORDER_SGIS", 0x812D}, + {"GL_TEXTURE_MULTI_BUFFER_HINT_SGIX", 0x812E}, + {"GL_CLAMP_TO_EDGE", 0x812F}, + {"GL_CLAMP_TO_EDGE_SGIS", 0x812F}, + {"GL_PACK_SKIP_VOLUMES_SGIS", 0x8130}, + {"GL_PACK_IMAGE_DEPTH_SGIS", 0x8131}, + {"GL_UNPACK_SKIP_VOLUMES_SGIS", 0x8132}, + {"GL_UNPACK_IMAGE_DEPTH_SGIS", 0x8133}, + {"GL_TEXTURE_4D_SGIS", 0x8134}, + {"GL_PROXY_TEXTURE_4D_SGIS", 0x8135}, + {"GL_TEXTURE_4DSIZE_SGIS", 0x8136}, + {"GL_TEXTURE_WRAP_Q_SGIS", 0x8137}, + {"GL_MAX_4D_TEXTURE_SIZE_SGIS", 0x8138}, + {"GL_PIXEL_TEX_GEN_SGIX", 0x8139}, + {"GL_TEXTURE_MIN_LOD", 0x813A}, + {"GL_TEXTURE_MIN_LOD_SGIS", 0x813A}, + {"GL_TEXTURE_MAX_LOD", 0x813B}, + {"GL_TEXTURE_MAX_LOD_SGIS", 0x813B}, + {"GL_TEXTURE_BASE_LEVEL", 0x813C}, + {"GL_TEXTURE_BASE_LEVEL_SGIS", 0x813C}, + {"GL_TEXTURE_MAX_LEVEL", 0x813D}, + {"GL_TEXTURE_MAX_LEVEL_SGIS", 0x813D}, + {"GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX", 0x813E}, + {"GL_PIXEL_TILE_CACHE_INCREMENT_SGIX", 0x813F}, + {"GL_PIXEL_TILE_WIDTH_SGIX", 0x8140}, + {"GL_PIXEL_TILE_HEIGHT_SGIX", 0x8141}, + {"GL_PIXEL_TILE_GRID_WIDTH_SGIX", 0x8142}, + {"GL_PIXEL_TILE_GRID_HEIGHT_SGIX", 0x8143}, + {"GL_PIXEL_TILE_GRID_DEPTH_SGIX", 0x8144}, + {"GL_PIXEL_TILE_CACHE_SIZE_SGIX", 0x8145}, + {"GL_FILTER4_SGIS", 0x8146}, + {"GL_TEXTURE_FILTER4_SIZE_SGIS", 0x8147}, + {"GL_SPRITE_SGIX", 0x8148}, + {"GL_SPRITE_MODE_SGIX", 0x8149}, + {"GL_SPRITE_AXIS_SGIX", 0x814A}, + {"GL_SPRITE_TRANSLATION_SGIX", 0x814B}, + {"GL_SPRITE_AXIAL_SGIX", 0x814C}, + {"GL_SPRITE_OBJECT_ALIGNED_SGIX", 0x814D}, + {"GL_SPRITE_EYE_ALIGNED_SGIX", 0x814E}, + {"GL_TEXTURE_4D_BINDING_SGIS", 0x814F}, + {"GL_IGNORE_BORDER_HP", 0x8150}, + {"GL_CONSTANT_BORDER", 0x8151}, + {"GL_CONSTANT_BORDER_HP", 0x8151}, + {"GL_REPLICATE_BORDER", 0x8153}, + {"GL_REPLICATE_BORDER_HP", 0x8153}, + {"GL_CONVOLUTION_BORDER_COLOR", 0x8154}, + {"GL_CONVOLUTION_BORDER_COLOR_HP", 0x8154}, + {"GL_IMAGE_SCALE_X_HP", 0x8155}, + {"GL_IMAGE_SCALE_Y_HP", 0x8156}, + {"GL_IMAGE_TRANSLATE_X_HP", 0x8157}, + {"GL_IMAGE_TRANSLATE_Y_HP", 0x8158}, + {"GL_IMAGE_ROTATE_ANGLE_HP", 0x8159}, + {"GL_IMAGE_ROTATE_ORIGIN_X_HP", 0x815A}, + {"GL_IMAGE_ROTATE_ORIGIN_Y_HP", 0x815B}, + {"GL_IMAGE_MAG_FILTER_HP", 0x815C}, + {"GL_IMAGE_MIN_FILTER_HP", 0x815D}, + {"GL_IMAGE_CUBIC_WEIGHT_HP", 0x815E}, + {"GL_CUBIC_HP", 0x815F}, + {"GL_AVERAGE_HP", 0x8160}, + {"GL_IMAGE_TRANSFORM_2D_HP", 0x8161}, + {"GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP", 0x8162}, + {"GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP", 0x8163}, + {"GL_OCCLUSION_TEST_HP", 0x8165}, + {"GL_OCCLUSION_TEST_RESULT_HP", 0x8166}, + {"GL_TEXTURE_LIGHTING_MODE_HP", 0x8167}, + {"GL_TEXTURE_POST_SPECULAR_HP", 0x8168}, + {"GL_TEXTURE_PRE_SPECULAR_HP", 0x8169}, + {"GL_LINEAR_CLIPMAP_LINEAR_SGIX", 0x8170}, + {"GL_TEXTURE_CLIPMAP_CENTER_SGIX", 0x8171}, + {"GL_TEXTURE_CLIPMAP_FRAME_SGIX", 0x8172}, + {"GL_TEXTURE_CLIPMAP_OFFSET_SGIX", 0x8173}, + {"GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX", 0x8174}, + {"GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX", 0x8175}, + {"GL_TEXTURE_CLIPMAP_DEPTH_SGIX", 0x8176}, + {"GL_MAX_CLIPMAP_DEPTH_SGIX", 0x8177}, + {"GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX", 0x8178}, + {"GL_POST_TEXTURE_FILTER_BIAS_SGIX", 0x8179}, + {"GL_POST_TEXTURE_FILTER_SCALE_SGIX", 0x817A}, + {"GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX", 0x817B}, + {"GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX", 0x817C}, + {"GL_REFERENCE_PLANE_SGIX", 0x817D}, + {"GL_REFERENCE_PLANE_EQUATION_SGIX", 0x817E}, + {"GL_IR_INSTRUMENT1_SGIX", 0x817F}, + {"GL_INSTRUMENT_BUFFER_POINTER_SGIX", 0x8180}, + {"GL_INSTRUMENT_MEASUREMENTS_SGIX", 0x8181}, + {"GL_LIST_PRIORITY_SGIX", 0x8182}, + {"GL_CALLIGRAPHIC_FRAGMENT_SGIX", 0x8183}, + {"GL_PIXEL_TEX_GEN_Q_CEILING_SGIX", 0x8184}, + {"GL_PIXEL_TEX_GEN_Q_ROUND_SGIX", 0x8185}, + {"GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX", 0x8186}, + {"GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX", 0x8187}, + {"GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX", 0x8188}, + {"GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX", 0x8189}, + {"GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX", 0x818A}, + {"GL_FRAMEZOOM_SGIX", 0x818B}, + {"GL_FRAMEZOOM_FACTOR_SGIX", 0x818C}, + {"GL_MAX_FRAMEZOOM_FACTOR_SGIX", 0x818D}, + {"GL_TEXTURE_LOD_BIAS_S_SGIX", 0x818E}, + {"GL_TEXTURE_LOD_BIAS_T_SGIX", 0x818F}, + {"GL_TEXTURE_LOD_BIAS_R_SGIX", 0x8190}, + {"GL_GENERATE_MIPMAP", 0x8191}, + {"GL_GENERATE_MIPMAP_SGIS", 0x8191}, + {"GL_GENERATE_MIPMAP_HINT", 0x8192}, + {"GL_GENERATE_MIPMAP_HINT_SGIS", 0x8192}, + {"GL_GEOMETRY_DEFORMATION_SGIX", 0x8194}, + {"GL_TEXTURE_DEFORMATION_SGIX", 0x8195}, + {"GL_DEFORMATIONS_MASK_SGIX", 0x8196}, + {"GL_MAX_DEFORMATION_ORDER_SGIX", 0x8197}, + {"GL_FOG_OFFSET_SGIX", 0x8198}, + {"GL_FOG_OFFSET_VALUE_SGIX", 0x8199}, + {"GL_TEXTURE_COMPARE_SGIX", 0x819A}, + {"GL_TEXTURE_COMPARE_OPERATOR_SGIX", 0x819B}, + {"GL_TEXTURE_LEQUAL_R_SGIX", 0x819C}, + {"GL_TEXTURE_GEQUAL_R_SGIX", 0x819D}, + {"GL_DEPTH_COMPONENT16", 0x81A5}, + {"GL_DEPTH_COMPONENT16_ARB", 0x81A5}, + {"GL_DEPTH_COMPONENT16_OES", 0x81A5}, + {"GL_DEPTH_COMPONENT16_SGIX", 0x81A5}, + {"GL_DEPTH_COMPONENT24", 0x81A6}, + {"GL_DEPTH_COMPONENT24_ARB", 0x81A6}, + {"GL_DEPTH_COMPONENT24_OES", 0x81A6}, + {"GL_DEPTH_COMPONENT24_SGIX", 0x81A6}, + {"GL_DEPTH_COMPONENT32", 0x81A7}, + {"GL_DEPTH_COMPONENT32_ARB", 0x81A7}, + {"GL_DEPTH_COMPONENT32_OES", 0x81A7}, + {"GL_DEPTH_COMPONENT32_SGIX", 0x81A7}, + {"GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", 0x81A8}, + {"GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", 0x81A9}, + {"GL_CULL_VERTEX_EXT", 0x81AA}, + {"GL_CULL_VERTEX_EYE_POSITION_EXT", 0x81AB}, + {"GL_CULL_VERTEX_OBJECT_POSITION_EXT", 0x81AC}, + {"GL_IUI_V2F_EXT", 0x81AD}, + {"GL_IUI_V3F_EXT", 0x81AE}, + {"GL_IUI_N3F_V2F_EXT", 0x81AF}, + {"GL_IUI_N3F_V3F_EXT", 0x81B0}, + {"GL_T2F_IUI_V2F_EXT", 0x81B1}, + {"GL_T2F_IUI_V3F_EXT", 0x81B2}, + {"GL_T2F_IUI_N3F_V2F_EXT", 0x81B3}, + {"GL_T2F_IUI_N3F_V3F_EXT", 0x81B4}, + {"GL_INDEX_TEST_EXT", 0x81B5}, + {"GL_INDEX_TEST_FUNC_EXT", 0x81B6}, + {"GL_INDEX_TEST_REF_EXT", 0x81B7}, + {"GL_INDEX_MATERIAL_EXT", 0x81B8}, + {"GL_INDEX_MATERIAL_PARAMETER_EXT", 0x81B9}, + {"GL_INDEX_MATERIAL_FACE_EXT", 0x81BA}, + {"GL_YCRCB_422_SGIX", 0x81BB}, + {"GL_YCRCB_444_SGIX", 0x81BC}, + {"GL_WRAP_BORDER_SUN", 0x81D4}, + {"GL_UNPACK_CONSTANT_DATA_SUNX", 0x81D5}, + {"GL_TEXTURE_CONSTANT_DATA_SUNX", 0x81D6}, + {"GL_TRIANGLE_LIST_SUN", 0x81D7}, + {"GL_REPLACEMENT_CODE_SUN", 0x81D8}, + {"GL_GLOBAL_ALPHA_SUN", 0x81D9}, + {"GL_GLOBAL_ALPHA_FACTOR_SUN", 0x81DA}, + {"GL_TEXTURE_COLOR_WRITEMASK_SGIS", 0x81EF}, + {"GL_EYE_DISTANCE_TO_POINT_SGIS", 0x81F0}, + {"GL_OBJECT_DISTANCE_TO_POINT_SGIS", 0x81F1}, + {"GL_EYE_DISTANCE_TO_LINE_SGIS", 0x81F2}, + {"GL_OBJECT_DISTANCE_TO_LINE_SGIS", 0x81F3}, + {"GL_EYE_POINT_SGIS", 0x81F4}, + {"GL_OBJECT_POINT_SGIS", 0x81F5}, + {"GL_EYE_LINE_SGIS", 0x81F6}, + {"GL_OBJECT_LINE_SGIS", 0x81F7}, + {"GL_LIGHT_MODEL_COLOR_CONTROL", 0x81F8}, + {"GL_LIGHT_MODEL_COLOR_CONTROL_EXT", 0x81F8}, + {"GL_SINGLE_COLOR", 0x81F9}, + {"GL_SINGLE_COLOR_EXT", 0x81F9}, + {"GL_SEPARATE_SPECULAR_COLOR", 0x81FA}, + {"GL_SEPARATE_SPECULAR_COLOR_EXT", 0x81FA}, + {"GL_SHARED_TEXTURE_PALETTE_EXT", 0x81FB}, + {"GL_TEXT_FRAGMENT_SHADER_ATI", 0x8200}, + {"GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING", 0x8210}, + {"GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE", 0x8211}, + {"GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT", 0x8211}, + {"GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE", 0x8212}, + {"GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE", 0x8213}, + {"GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE", 0x8214}, + {"GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE", 0x8215}, + {"GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE", 0x8216}, + {"GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE", 0x8217}, + {"GL_FRAMEBUFFER_DEFAULT", 0x8218}, + {"GL_FRAMEBUFFER_UNDEFINED", 0x8219}, + {"GL_FRAMEBUFFER_UNDEFINED_OES", 0x8219}, + {"GL_DEPTH_STENCIL_ATTACHMENT", 0x821A}, + {"GL_MAJOR_VERSION", 0x821B}, + {"GL_MINOR_VERSION", 0x821C}, + {"GL_NUM_EXTENSIONS", 0x821D}, + {"GL_CONTEXT_FLAGS", 0x821E}, + {"GL_BUFFER_IMMUTABLE_STORAGE", 0x821F}, + {"GL_BUFFER_STORAGE_FLAGS", 0x8220}, + {"GL_INDEX", 0x8222}, + {"GL_COMPRESSED_RED", 0x8225}, + {"GL_COMPRESSED_RG", 0x8226}, + {"GL_RG", 0x8227}, + {"GL_RG_EXT", 0x8227}, + {"GL_RG_INTEGER", 0x8228}, + {"GL_R8", 0x8229}, + {"GL_R8_EXT", 0x8229}, + {"GL_R16", 0x822A}, + {"GL_RG8", 0x822B}, + {"GL_RG8_EXT", 0x822B}, + {"GL_RG16", 0x822C}, + {"GL_R16F", 0x822D}, + {"GL_R16F_EXT", 0x822D}, + {"GL_R32F", 0x822E}, + {"GL_RG16F", 0x822F}, + {"GL_RG16F_EXT", 0x822F}, + {"GL_RG32F", 0x8230}, + {"GL_R8I", 0x8231}, + {"GL_R8UI", 0x8232}, + {"GL_R16I", 0x8233}, + {"GL_R16UI", 0x8234}, + {"GL_R32I", 0x8235}, + {"GL_R32UI", 0x8236}, + {"GL_RG8I", 0x8237}, + {"GL_RG8UI", 0x8238}, + {"GL_RG16I", 0x8239}, + {"GL_RG16UI", 0x823A}, + {"GL_RG32I", 0x823B}, + {"GL_RG32UI", 0x823C}, + {"GL_SYNC_CL_EVENT_ARB", 0x8240}, + {"GL_SYNC_CL_EVENT_COMPLETE_ARB", 0x8241}, + {"GL_DEBUG_OUTPUT_SYNCHRONOUS", 0x8242}, + {"GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB", 0x8242}, + {"GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR", 0x8242}, + {"GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH", 0x8243}, + {"GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB", 0x8243}, + {"GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR", 0x8243}, + {"GL_DEBUG_CALLBACK_FUNCTION", 0x8244}, + {"GL_DEBUG_CALLBACK_FUNCTION_ARB", 0x8244}, + {"GL_DEBUG_CALLBACK_FUNCTION_KHR", 0x8244}, + {"GL_DEBUG_CALLBACK_USER_PARAM", 0x8245}, + {"GL_DEBUG_CALLBACK_USER_PARAM_ARB", 0x8245}, + {"GL_DEBUG_CALLBACK_USER_PARAM_KHR", 0x8245}, + {"GL_DEBUG_SOURCE_API", 0x8246}, + {"GL_DEBUG_SOURCE_API_ARB", 0x8246}, + {"GL_DEBUG_SOURCE_API_KHR", 0x8246}, + {"GL_DEBUG_SOURCE_WINDOW_SYSTEM", 0x8247}, + {"GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB", 0x8247}, + {"GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR", 0x8247}, + {"GL_DEBUG_SOURCE_SHADER_COMPILER", 0x8248}, + {"GL_DEBUG_SOURCE_SHADER_COMPILER_ARB", 0x8248}, + {"GL_DEBUG_SOURCE_SHADER_COMPILER_KHR", 0x8248}, + {"GL_DEBUG_SOURCE_THIRD_PARTY", 0x8249}, + {"GL_DEBUG_SOURCE_THIRD_PARTY_ARB", 0x8249}, + {"GL_DEBUG_SOURCE_THIRD_PARTY_KHR", 0x8249}, + {"GL_DEBUG_SOURCE_APPLICATION", 0x824A}, + {"GL_DEBUG_SOURCE_APPLICATION_ARB", 0x824A}, + {"GL_DEBUG_SOURCE_APPLICATION_KHR", 0x824A}, + {"GL_DEBUG_SOURCE_OTHER", 0x824B}, + {"GL_DEBUG_SOURCE_OTHER_ARB", 0x824B}, + {"GL_DEBUG_SOURCE_OTHER_KHR", 0x824B}, + {"GL_DEBUG_TYPE_ERROR", 0x824C}, + {"GL_DEBUG_TYPE_ERROR_ARB", 0x824C}, + {"GL_DEBUG_TYPE_ERROR_KHR", 0x824C}, + {"GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR", 0x824D}, + {"GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB", 0x824D}, + {"GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR", 0x824D}, + {"GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR", 0x824E}, + {"GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB", 0x824E}, + {"GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR", 0x824E}, + {"GL_DEBUG_TYPE_PORTABILITY", 0x824F}, + {"GL_DEBUG_TYPE_PORTABILITY_ARB", 0x824F}, + {"GL_DEBUG_TYPE_PORTABILITY_KHR", 0x824F}, + {"GL_DEBUG_TYPE_PERFORMANCE", 0x8250}, + {"GL_DEBUG_TYPE_PERFORMANCE_ARB", 0x8250}, + {"GL_DEBUG_TYPE_PERFORMANCE_KHR", 0x8250}, + {"GL_DEBUG_TYPE_OTHER", 0x8251}, + {"GL_DEBUG_TYPE_OTHER_ARB", 0x8251}, + {"GL_DEBUG_TYPE_OTHER_KHR", 0x8251}, + {"GL_LOSE_CONTEXT_ON_RESET_ARB", 0x8252}, + {"GL_GUILTY_CONTEXT_RESET_ARB", 0x8253}, + {"GL_INNOCENT_CONTEXT_RESET_ARB", 0x8254}, + {"GL_UNKNOWN_CONTEXT_RESET_ARB", 0x8255}, + {"GL_RESET_NOTIFICATION_STRATEGY_ARB", 0x8256}, + {"GL_PROGRAM_BINARY_RETRIEVABLE_HINT", 0x8257}, + {"GL_PROGRAM_SEPARABLE", 0x8258}, + {"GL_PROGRAM_SEPARABLE_EXT", 0x8258}, + {"GL_ACTIVE_PROGRAM", 0x8259}, + {"GL_ACTIVE_PROGRAM_EXT", 0x8259}, + {"GL_PROGRAM_PIPELINE_BINDING", 0x825A}, + {"GL_PROGRAM_PIPELINE_BINDING_EXT", 0x825A}, + {"GL_MAX_VIEWPORTS", 0x825B}, + {"GL_VIEWPORT_SUBPIXEL_BITS", 0x825C}, + {"GL_VIEWPORT_BOUNDS_RANGE", 0x825D}, + {"GL_LAYER_PROVOKING_VERTEX", 0x825E}, + {"GL_VIEWPORT_INDEX_PROVOKING_VERTEX", 0x825F}, + {"GL_UNDEFINED_VERTEX", 0x8260}, + {"GL_NO_RESET_NOTIFICATION_ARB", 0x8261}, + {"GL_MAX_COMPUTE_SHARED_MEMORY_SIZE", 0x8262}, + {"GL_MAX_COMPUTE_UNIFORM_COMPONENTS", 0x8263}, + {"GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS", 0x8264}, + {"GL_MAX_COMPUTE_ATOMIC_COUNTERS", 0x8265}, + {"GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS", 0x8266}, + {"GL_COMPUTE_LOCAL_WORK_SIZE", 0x8267}, + {"GL_DEBUG_TYPE_MARKER", 0x8268}, + {"GL_DEBUG_TYPE_MARKER_KHR", 0x8268}, + {"GL_DEBUG_TYPE_PUSH_GROUP", 0x8269}, + {"GL_DEBUG_TYPE_PUSH_GROUP_KHR", 0x8269}, + {"GL_DEBUG_TYPE_POP_GROUP", 0x826A}, + {"GL_DEBUG_TYPE_POP_GROUP_KHR", 0x826A}, + {"GL_DEBUG_SEVERITY_NOTIFICATION", 0x826B}, + {"GL_DEBUG_SEVERITY_NOTIFICATION_KHR", 0x826B}, + {"GL_MAX_DEBUG_GROUP_STACK_DEPTH", 0x826C}, + {"GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR", 0x826C}, + {"GL_DEBUG_GROUP_STACK_DEPTH", 0x826D}, + {"GL_DEBUG_GROUP_STACK_DEPTH_KHR", 0x826D}, + {"GL_MAX_UNIFORM_LOCATIONS", 0x826E}, + {"GL_INTERNALFORMAT_SUPPORTED", 0x826F}, + {"GL_INTERNALFORMAT_PREFERRED", 0x8270}, + {"GL_INTERNALFORMAT_RED_SIZE", 0x8271}, + {"GL_INTERNALFORMAT_GREEN_SIZE", 0x8272}, + {"GL_INTERNALFORMAT_BLUE_SIZE", 0x8273}, + {"GL_INTERNALFORMAT_ALPHA_SIZE", 0x8274}, + {"GL_INTERNALFORMAT_DEPTH_SIZE", 0x8275}, + {"GL_INTERNALFORMAT_STENCIL_SIZE", 0x8276}, + {"GL_INTERNALFORMAT_SHARED_SIZE", 0x8277}, + {"GL_INTERNALFORMAT_RED_TYPE", 0x8278}, + {"GL_INTERNALFORMAT_GREEN_TYPE", 0x8279}, + {"GL_INTERNALFORMAT_BLUE_TYPE", 0x827A}, + {"GL_INTERNALFORMAT_ALPHA_TYPE", 0x827B}, + {"GL_INTERNALFORMAT_DEPTH_TYPE", 0x827C}, + {"GL_INTERNALFORMAT_STENCIL_TYPE", 0x827D}, + {"GL_MAX_WIDTH", 0x827E}, + {"GL_MAX_HEIGHT", 0x827F}, + {"GL_MAX_DEPTH", 0x8280}, + {"GL_MAX_LAYERS", 0x8281}, + {"GL_MAX_COMBINED_DIMENSIONS", 0x8282}, + {"GL_COLOR_COMPONENTS", 0x8283}, + {"GL_DEPTH_COMPONENTS", 0x8284}, + {"GL_STENCIL_COMPONENTS", 0x8285}, + {"GL_COLOR_RENDERABLE", 0x8286}, + {"GL_DEPTH_RENDERABLE", 0x8287}, + {"GL_STENCIL_RENDERABLE", 0x8288}, + {"GL_FRAMEBUFFER_RENDERABLE", 0x8289}, + {"GL_FRAMEBUFFER_RENDERABLE_LAYERED", 0x828A}, + {"GL_FRAMEBUFFER_BLEND", 0x828B}, + {"GL_READ_PIXELS", 0x828C}, + {"GL_READ_PIXELS_FORMAT", 0x828D}, + {"GL_READ_PIXELS_TYPE", 0x828E}, + {"GL_TEXTURE_IMAGE_FORMAT", 0x828F}, + {"GL_TEXTURE_IMAGE_TYPE", 0x8290}, + {"GL_GET_TEXTURE_IMAGE_FORMAT", 0x8291}, + {"GL_GET_TEXTURE_IMAGE_TYPE", 0x8292}, + {"GL_MIPMAP", 0x8293}, + {"GL_MANUAL_GENERATE_MIPMAP", 0x8294}, + {"GL_AUTO_GENERATE_MIPMAP", 0x8295}, + {"GL_COLOR_ENCODING", 0x8296}, + {"GL_SRGB_READ", 0x8297}, + {"GL_SRGB_WRITE", 0x8298}, + {"GL_SRGB_DECODE_ARB", 0x8299}, + {"GL_FILTER", 0x829A}, + {"GL_VERTEX_TEXTURE", 0x829B}, + {"GL_TESS_CONTROL_TEXTURE", 0x829C}, + {"GL_TESS_EVALUATION_TEXTURE", 0x829D}, + {"GL_GEOMETRY_TEXTURE", 0x829E}, + {"GL_FRAGMENT_TEXTURE", 0x829F}, + {"GL_COMPUTE_TEXTURE", 0x82A0}, + {"GL_TEXTURE_SHADOW", 0x82A1}, + {"GL_TEXTURE_GATHER", 0x82A2}, + {"GL_TEXTURE_GATHER_SHADOW", 0x82A3}, + {"GL_SHADER_IMAGE_LOAD", 0x82A4}, + {"GL_SHADER_IMAGE_STORE", 0x82A5}, + {"GL_SHADER_IMAGE_ATOMIC", 0x82A6}, + {"GL_IMAGE_TEXEL_SIZE", 0x82A7}, + {"GL_IMAGE_COMPATIBILITY_CLASS", 0x82A8}, + {"GL_IMAGE_PIXEL_FORMAT", 0x82A9}, + {"GL_IMAGE_PIXEL_TYPE", 0x82AA}, + {"GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST", 0x82AC}, + {"GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST", 0x82AD}, + {"GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE", 0x82AE}, + {"GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE", 0x82AF}, + {"GL_TEXTURE_COMPRESSED_BLOCK_WIDTH", 0x82B1}, + {"GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT", 0x82B2}, + {"GL_TEXTURE_COMPRESSED_BLOCK_SIZE", 0x82B3}, + {"GL_CLEAR_BUFFER", 0x82B4}, + {"GL_TEXTURE_VIEW", 0x82B5}, + {"GL_VIEW_COMPATIBILITY_CLASS", 0x82B6}, + {"GL_FULL_SUPPORT", 0x82B7}, + {"GL_CAVEAT_SUPPORT", 0x82B8}, + {"GL_IMAGE_CLASS_4_X_32", 0x82B9}, + {"GL_IMAGE_CLASS_2_X_32", 0x82BA}, + {"GL_IMAGE_CLASS_1_X_32", 0x82BB}, + {"GL_IMAGE_CLASS_4_X_16", 0x82BC}, + {"GL_IMAGE_CLASS_2_X_16", 0x82BD}, + {"GL_IMAGE_CLASS_1_X_16", 0x82BE}, + {"GL_IMAGE_CLASS_4_X_8", 0x82BF}, + {"GL_IMAGE_CLASS_2_X_8", 0x82C0}, + {"GL_IMAGE_CLASS_1_X_8", 0x82C1}, + {"GL_IMAGE_CLASS_11_11_10", 0x82C2}, + {"GL_IMAGE_CLASS_10_10_10_2", 0x82C3}, + {"GL_VIEW_CLASS_128_BITS", 0x82C4}, + {"GL_VIEW_CLASS_96_BITS", 0x82C5}, + {"GL_VIEW_CLASS_64_BITS", 0x82C6}, + {"GL_VIEW_CLASS_48_BITS", 0x82C7}, + {"GL_VIEW_CLASS_32_BITS", 0x82C8}, + {"GL_VIEW_CLASS_24_BITS", 0x82C9}, + {"GL_VIEW_CLASS_16_BITS", 0x82CA}, + {"GL_VIEW_CLASS_8_BITS", 0x82CB}, + {"GL_VIEW_CLASS_S3TC_DXT1_RGB", 0x82CC}, + {"GL_VIEW_CLASS_S3TC_DXT1_RGBA", 0x82CD}, + {"GL_VIEW_CLASS_S3TC_DXT3_RGBA", 0x82CE}, + {"GL_VIEW_CLASS_S3TC_DXT5_RGBA", 0x82CF}, + {"GL_VIEW_CLASS_RGTC1_RED", 0x82D0}, + {"GL_VIEW_CLASS_RGTC2_RG", 0x82D1}, + {"GL_VIEW_CLASS_BPTC_UNORM", 0x82D2}, + {"GL_VIEW_CLASS_BPTC_FLOAT", 0x82D3}, + {"GL_VERTEX_ATTRIB_BINDING", 0x82D4}, + {"GL_VERTEX_ATTRIB_RELATIVE_OFFSET", 0x82D5}, + {"GL_VERTEX_BINDING_DIVISOR", 0x82D6}, + {"GL_VERTEX_BINDING_OFFSET", 0x82D7}, + {"GL_VERTEX_BINDING_STRIDE", 0x82D8}, + {"GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 0x82D9}, + {"GL_MAX_VERTEX_ATTRIB_BINDINGS", 0x82DA}, + {"GL_TEXTURE_VIEW_MIN_LEVEL", 0x82DB}, + {"GL_TEXTURE_VIEW_NUM_LEVELS", 0x82DC}, + {"GL_TEXTURE_VIEW_MIN_LAYER", 0x82DD}, + {"GL_TEXTURE_VIEW_NUM_LAYERS", 0x82DE}, + {"GL_TEXTURE_IMMUTABLE_LEVELS", 0x82DF}, + {"GL_BUFFER", 0x82E0}, + {"GL_BUFFER_KHR", 0x82E0}, + {"GL_SHADER", 0x82E1}, + {"GL_SHADER_KHR", 0x82E1}, + {"GL_PROGRAM", 0x82E2}, + {"GL_PROGRAM_KHR", 0x82E2}, + {"GL_QUERY", 0x82E3}, + {"GL_QUERY_KHR", 0x82E3}, + {"GL_PROGRAM_PIPELINE", 0x82E4}, + {"GL_MAX_VERTEX_ATTRIB_STRIDE", 0x82E5}, + {"GL_SAMPLER", 0x82E6}, + {"GL_SAMPLER_KHR", 0x82E6}, + {"GL_DISPLAY_LIST", 0x82E7}, + {"GL_MAX_LABEL_LENGTH", 0x82E8}, + {"GL_MAX_LABEL_LENGTH_KHR", 0x82E8}, + {"GL_NUM_SHADING_LANGUAGE_VERSIONS", 0x82E9}, + {"GL_DEPTH_PASS_INSTRUMENT_SGIX", 0x8310}, + {"GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX", 0x8311}, + {"GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX", 0x8312}, + {"GL_FRAGMENTS_INSTRUMENT_SGIX", 0x8313}, + {"GL_FRAGMENTS_INSTRUMENT_COUNTERS_SGIX", 0x8314}, + {"GL_FRAGMENTS_INSTRUMENT_MAX_SGIX", 0x8315}, + {"GL_CONVOLUTION_HINT_SGIX", 0x8316}, + {"GL_YCRCB_SGIX", 0x8318}, + {"GL_YCRCBA_SGIX", 0x8319}, + {"GL_UNPACK_COMPRESSED_SIZE_SGIX", 0x831A}, + {"GL_PACK_MAX_COMPRESSED_SIZE_SGIX", 0x831B}, + {"GL_PACK_COMPRESSED_SIZE_SGIX", 0x831C}, + {"GL_SLIM8U_SGIX", 0x831D}, + {"GL_SLIM10U_SGIX", 0x831E}, + {"GL_SLIM12S_SGIX", 0x831F}, + {"GL_ALPHA_MIN_SGIX", 0x8320}, + {"GL_ALPHA_MAX_SGIX", 0x8321}, + {"GL_SCALEBIAS_HINT_SGIX", 0x8322}, + {"GL_ASYNC_MARKER_SGIX", 0x8329}, + {"GL_PIXEL_TEX_GEN_MODE_SGIX", 0x832B}, + {"GL_ASYNC_HISTOGRAM_SGIX", 0x832C}, + {"GL_MAX_ASYNC_HISTOGRAM_SGIX", 0x832D}, + {"GL_PIXEL_TRANSFORM_2D_EXT", 0x8330}, + {"GL_PIXEL_MAG_FILTER_EXT", 0x8331}, + {"GL_PIXEL_MIN_FILTER_EXT", 0x8332}, + {"GL_PIXEL_CUBIC_WEIGHT_EXT", 0x8333}, + {"GL_CUBIC_EXT", 0x8334}, + {"GL_AVERAGE_EXT", 0x8335}, + {"GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT", 0x8336}, + {"GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT", 0x8337}, + {"GL_PIXEL_TRANSFORM_2D_MATRIX_EXT", 0x8338}, + {"GL_FRAGMENT_MATERIAL_EXT", 0x8349}, + {"GL_FRAGMENT_NORMAL_EXT", 0x834A}, + {"GL_FRAGMENT_COLOR_EXT", 0x834C}, + {"GL_ATTENUATION_EXT", 0x834D}, + {"GL_SHADOW_ATTENUATION_EXT", 0x834E}, + {"GL_TEXTURE_APPLICATION_MODE_EXT", 0x834F}, + {"GL_TEXTURE_LIGHT_EXT", 0x8350}, + {"GL_TEXTURE_MATERIAL_FACE_EXT", 0x8351}, + {"GL_TEXTURE_MATERIAL_PARAMETER_EXT", 0x8352}, + {"GL_PIXEL_TEXTURE_SGIS", 0x8353}, + {"GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS", 0x8354}, + {"GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS", 0x8355}, + {"GL_PIXEL_GROUP_COLOR_SGIS", 0x8356}, + {"GL_LINE_QUALITY_HINT_SGIX", 0x835B}, + {"GL_ASYNC_TEX_IMAGE_SGIX", 0x835C}, + {"GL_ASYNC_DRAW_PIXELS_SGIX", 0x835D}, + {"GL_ASYNC_READ_PIXELS_SGIX", 0x835E}, + {"GL_MAX_ASYNC_TEX_IMAGE_SGIX", 0x835F}, + {"GL_MAX_ASYNC_DRAW_PIXELS_SGIX", 0x8360}, + {"GL_MAX_ASYNC_READ_PIXELS_SGIX", 0x8361}, + {"GL_UNSIGNED_BYTE_2_3_3_REV", 0x8362}, + {"GL_UNSIGNED_BYTE_2_3_3_REV_EXT", 0x8362}, + {"GL_UNSIGNED_SHORT_5_6_5", 0x8363}, + {"GL_UNSIGNED_SHORT_5_6_5_EXT", 0x8363}, + {"GL_UNSIGNED_SHORT_5_6_5_REV", 0x8364}, + {"GL_UNSIGNED_SHORT_5_6_5_REV_EXT", 0x8364}, + {"GL_UNSIGNED_SHORT_4_4_4_4_REV", 0x8365}, + {"GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT", 0x8365}, + {"GL_UNSIGNED_SHORT_1_5_5_5_REV", 0x8366}, + {"GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT", 0x8366}, + {"GL_UNSIGNED_INT_8_8_8_8_REV", 0x8367}, + {"GL_UNSIGNED_INT_8_8_8_8_REV_EXT", 0x8367}, + {"GL_UNSIGNED_INT_2_10_10_10_REV", 0x8368}, + {"GL_UNSIGNED_INT_2_10_10_10_REV_EXT", 0x8368}, + {"GL_TEXTURE_MAX_CLAMP_S_SGIX", 0x8369}, + {"GL_TEXTURE_MAX_CLAMP_T_SGIX", 0x836A}, + {"GL_TEXTURE_MAX_CLAMP_R_SGIX", 0x836B}, + {"GL_MIRRORED_REPEAT", 0x8370}, + {"GL_MIRRORED_REPEAT_ARB", 0x8370}, + {"GL_MIRRORED_REPEAT_IBM", 0x8370}, + {"GL_MIRRORED_REPEAT_OES", 0x8370}, + {"GL_RGB_S3TC", 0x83A0}, + {"GL_RGB4_S3TC", 0x83A1}, + {"GL_RGBA_S3TC", 0x83A2}, + {"GL_RGBA4_S3TC", 0x83A3}, + {"GL_RGBA_DXT5_S3TC", 0x83A4}, + {"GL_RGBA4_DXT5_S3TC", 0x83A5}, + {"GL_VERTEX_PRECLIP_SGIX", 0x83EE}, + {"GL_VERTEX_PRECLIP_HINT_SGIX", 0x83EF}, + {"GL_COMPRESSED_RGB_S3TC_DXT1_EXT", 0x83F0}, + {"GL_COMPRESSED_RGBA_S3TC_DXT1_EXT", 0x83F1}, + {"GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE", 0x83F2}, + {"GL_COMPRESSED_RGBA_S3TC_DXT3_EXT", 0x83F2}, + {"GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE", 0x83F3}, + {"GL_COMPRESSED_RGBA_S3TC_DXT5_EXT", 0x83F3}, + {"GL_PARALLEL_ARRAYS_INTEL", 0x83F4}, + {"GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL", 0x83F5}, + {"GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL", 0x83F6}, + {"GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL", 0x83F7}, + {"GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL", 0x83F8}, + {"GL_TEXTURE_MEMORY_LAYOUT_INTEL", 0x83FF}, + {"GL_FRAGMENT_LIGHTING_SGIX", 0x8400}, + {"GL_FRAGMENT_COLOR_MATERIAL_SGIX", 0x8401}, + {"GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX", 0x8402}, + {"GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX", 0x8403}, + {"GL_MAX_FRAGMENT_LIGHTS_SGIX", 0x8404}, + {"GL_MAX_ACTIVE_LIGHTS_SGIX", 0x8405}, + {"GL_CURRENT_RASTER_NORMAL_SGIX", 0x8406}, + {"GL_LIGHT_ENV_MODE_SGIX", 0x8407}, + {"GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX", 0x8408}, + {"GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX", 0x8409}, + {"GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX", 0x840A}, + {"GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX", 0x840B}, + {"GL_FRAGMENT_LIGHT0_SGIX", 0x840C}, + {"GL_FRAGMENT_LIGHT1_SGIX", 0x840D}, + {"GL_FRAGMENT_LIGHT2_SGIX", 0x840E}, + {"GL_FRAGMENT_LIGHT3_SGIX", 0x840F}, + {"GL_FRAGMENT_LIGHT4_SGIX", 0x8410}, + {"GL_FRAGMENT_LIGHT5_SGIX", 0x8411}, + {"GL_FRAGMENT_LIGHT6_SGIX", 0x8412}, + {"GL_FRAGMENT_LIGHT7_SGIX", 0x8413}, + {"GL_PACK_RESAMPLE_SGIX", 0x842C}, + {"GL_UNPACK_RESAMPLE_SGIX", 0x842D}, + {"GL_RESAMPLE_REPLICATE_SGIX", 0x842E}, + {"GL_RESAMPLE_ZERO_FILL_SGIX", 0x842F}, + {"GL_RESAMPLE_DECIMATE_SGIX", 0x8430}, + {"GL_TANGENT_ARRAY_EXT", 0x8439}, + {"GL_BINORMAL_ARRAY_EXT", 0x843A}, + {"GL_CURRENT_TANGENT_EXT", 0x843B}, + {"GL_CURRENT_BINORMAL_EXT", 0x843C}, + {"GL_TANGENT_ARRAY_TYPE_EXT", 0x843E}, + {"GL_TANGENT_ARRAY_STRIDE_EXT", 0x843F}, + {"GL_BINORMAL_ARRAY_TYPE_EXT", 0x8440}, + {"GL_BINORMAL_ARRAY_STRIDE_EXT", 0x8441}, + {"GL_TANGENT_ARRAY_POINTER_EXT", 0x8442}, + {"GL_BINORMAL_ARRAY_POINTER_EXT", 0x8443}, + {"GL_MAP1_TANGENT_EXT", 0x8444}, + {"GL_MAP2_TANGENT_EXT", 0x8445}, + {"GL_MAP1_BINORMAL_EXT", 0x8446}, + {"GL_MAP2_BINORMAL_EXT", 0x8447}, + {"GL_NEAREST_CLIPMAP_NEAREST_SGIX", 0x844D}, + {"GL_NEAREST_CLIPMAP_LINEAR_SGIX", 0x844E}, + {"GL_LINEAR_CLIPMAP_NEAREST_SGIX", 0x844F}, + {"GL_FOG_COORDINATE_SOURCE", 0x8450}, + {"GL_FOG_COORDINATE_SOURCE_EXT", 0x8450}, + {"GL_FOG_COORD_SRC", 0x8450}, + {"GL_FOG_COORDINATE", 0x8451}, + {"GL_FOG_COORD", 0x8451}, + {"GL_FOG_COORDINATE_EXT", 0x8451}, + {"GL_FRAGMENT_DEPTH", 0x8452}, + {"GL_FRAGMENT_DEPTH_EXT", 0x8452}, + {"GL_CURRENT_FOG_COORDINATE", 0x8453}, + {"GL_CURRENT_FOG_COORD", 0x8453}, + {"GL_CURRENT_FOG_COORDINATE_EXT", 0x8453}, + {"GL_FOG_COORDINATE_ARRAY_TYPE", 0x8454}, + {"GL_FOG_COORDINATE_ARRAY_TYPE_EXT", 0x8454}, + {"GL_FOG_COORD_ARRAY_TYPE", 0x8454}, + {"GL_FOG_COORDINATE_ARRAY_STRIDE", 0x8455}, + {"GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", 0x8455}, + {"GL_FOG_COORD_ARRAY_STRIDE", 0x8455}, + {"GL_FOG_COORDINATE_ARRAY_POINTER", 0x8456}, + {"GL_FOG_COORDINATE_ARRAY_POINTER_EXT", 0x8456}, + {"GL_FOG_COORD_ARRAY_POINTER", 0x8456}, + {"GL_FOG_COORDINATE_ARRAY", 0x8457}, + {"GL_FOG_COORDINATE_ARRAY_EXT", 0x8457}, + {"GL_FOG_COORD_ARRAY", 0x8457}, + {"GL_COLOR_SUM", 0x8458}, + {"GL_COLOR_SUM_ARB", 0x8458}, + {"GL_COLOR_SUM_EXT", 0x8458}, + {"GL_CURRENT_SECONDARY_COLOR", 0x8459}, + {"GL_CURRENT_SECONDARY_COLOR_EXT", 0x8459}, + {"GL_SECONDARY_COLOR_ARRAY_SIZE", 0x845A}, + {"GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", 0x845A}, + {"GL_SECONDARY_COLOR_ARRAY_TYPE", 0x845B}, + {"GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", 0x845B}, + {"GL_SECONDARY_COLOR_ARRAY_STRIDE", 0x845C}, + {"GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", 0x845C}, + {"GL_SECONDARY_COLOR_ARRAY_POINTER", 0x845D}, + {"GL_SECONDARY_COLOR_ARRAY_POINTER_EXT", 0x845D}, + {"GL_SECONDARY_COLOR_ARRAY", 0x845E}, + {"GL_SECONDARY_COLOR_ARRAY_EXT", 0x845E}, + {"GL_CURRENT_RASTER_SECONDARY_COLOR", 0x845F}, + {"GL_ALIASED_POINT_SIZE_RANGE", 0x846D}, + {"GL_ALIASED_LINE_WIDTH_RANGE", 0x846E}, + {"GL_SCREEN_COORDINATES_REND", 0x8490}, + {"GL_INVERTED_SCREEN_W_REND", 0x8491}, + {"GL_TEXTURE0", 0x84C0}, + {"GL_TEXTURE0_ARB", 0x84C0}, + {"GL_TEXTURE1", 0x84C1}, + {"GL_TEXTURE1_ARB", 0x84C1}, + {"GL_TEXTURE2", 0x84C2}, + {"GL_TEXTURE2_ARB", 0x84C2}, + {"GL_TEXTURE3", 0x84C3}, + {"GL_TEXTURE3_ARB", 0x84C3}, + {"GL_TEXTURE4", 0x84C4}, + {"GL_TEXTURE4_ARB", 0x84C4}, + {"GL_TEXTURE5", 0x84C5}, + {"GL_TEXTURE5_ARB", 0x84C5}, + {"GL_TEXTURE6", 0x84C6}, + {"GL_TEXTURE6_ARB", 0x84C6}, + {"GL_TEXTURE7", 0x84C7}, + {"GL_TEXTURE7_ARB", 0x84C7}, + {"GL_TEXTURE8", 0x84C8}, + {"GL_TEXTURE8_ARB", 0x84C8}, + {"GL_TEXTURE9", 0x84C9}, + {"GL_TEXTURE9_ARB", 0x84C9}, + {"GL_TEXTURE10", 0x84CA}, + {"GL_TEXTURE10_ARB", 0x84CA}, + {"GL_TEXTURE11", 0x84CB}, + {"GL_TEXTURE11_ARB", 0x84CB}, + {"GL_TEXTURE12", 0x84CC}, + {"GL_TEXTURE12_ARB", 0x84CC}, + {"GL_TEXTURE13", 0x84CD}, + {"GL_TEXTURE13_ARB", 0x84CD}, + {"GL_TEXTURE14", 0x84CE}, + {"GL_TEXTURE14_ARB", 0x84CE}, + {"GL_TEXTURE15", 0x84CF}, + {"GL_TEXTURE15_ARB", 0x84CF}, + {"GL_TEXTURE16", 0x84D0}, + {"GL_TEXTURE16_ARB", 0x84D0}, + {"GL_TEXTURE17", 0x84D1}, + {"GL_TEXTURE17_ARB", 0x84D1}, + {"GL_TEXTURE18", 0x84D2}, + {"GL_TEXTURE18_ARB", 0x84D2}, + {"GL_TEXTURE19", 0x84D3}, + {"GL_TEXTURE19_ARB", 0x84D3}, + {"GL_TEXTURE20", 0x84D4}, + {"GL_TEXTURE20_ARB", 0x84D4}, + {"GL_TEXTURE21", 0x84D5}, + {"GL_TEXTURE21_ARB", 0x84D5}, + {"GL_TEXTURE22", 0x84D6}, + {"GL_TEXTURE22_ARB", 0x84D6}, + {"GL_TEXTURE23", 0x84D7}, + {"GL_TEXTURE23_ARB", 0x84D7}, + {"GL_TEXTURE24", 0x84D8}, + {"GL_TEXTURE24_ARB", 0x84D8}, + {"GL_TEXTURE25", 0x84D9}, + {"GL_TEXTURE25_ARB", 0x84D9}, + {"GL_TEXTURE26", 0x84DA}, + {"GL_TEXTURE26_ARB", 0x84DA}, + {"GL_TEXTURE27", 0x84DB}, + {"GL_TEXTURE27_ARB", 0x84DB}, + {"GL_TEXTURE28", 0x84DC}, + {"GL_TEXTURE28_ARB", 0x84DC}, + {"GL_TEXTURE29", 0x84DD}, + {"GL_TEXTURE29_ARB", 0x84DD}, + {"GL_TEXTURE30", 0x84DE}, + {"GL_TEXTURE30_ARB", 0x84DE}, + {"GL_TEXTURE31", 0x84DF}, + {"GL_TEXTURE31_ARB", 0x84DF}, + {"GL_ACTIVE_TEXTURE", 0x84E0}, + {"GL_ACTIVE_TEXTURE_ARB", 0x84E0}, + {"GL_CLIENT_ACTIVE_TEXTURE", 0x84E1}, + {"GL_CLIENT_ACTIVE_TEXTURE_ARB", 0x84E1}, + {"GL_MAX_TEXTURE_UNITS", 0x84E2}, + {"GL_MAX_TEXTURE_UNITS_ARB", 0x84E2}, + {"GL_TRANSPOSE_MODELVIEW_MATRIX", 0x84E3}, + {"GL_TRANSPOSE_MODELVIEW_MATRIX_ARB", 0x84E3}, + {"GL_TRANSPOSE_PROJECTION_MATRIX", 0x84E4}, + {"GL_TRANSPOSE_PROJECTION_MATRIX_ARB", 0x84E4}, + {"GL_TRANSPOSE_TEXTURE_MATRIX", 0x84E5}, + {"GL_TRANSPOSE_TEXTURE_MATRIX_ARB", 0x84E5}, + {"GL_TRANSPOSE_COLOR_MATRIX", 0x84E6}, + {"GL_TRANSPOSE_COLOR_MATRIX_ARB", 0x84E6}, + {"GL_SUBTRACT", 0x84E7}, + {"GL_SUBTRACT_ARB", 0x84E7}, + {"GL_MAX_RENDERBUFFER_SIZE", 0x84E8}, + {"GL_MAX_RENDERBUFFER_SIZE_EXT", 0x84E8}, + {"GL_MAX_RENDERBUFFER_SIZE_OES", 0x84E8}, + {"GL_COMPRESSED_ALPHA", 0x84E9}, + {"GL_COMPRESSED_ALPHA_ARB", 0x84E9}, + {"GL_COMPRESSED_LUMINANCE", 0x84EA}, + {"GL_COMPRESSED_LUMINANCE_ARB", 0x84EA}, + {"GL_COMPRESSED_LUMINANCE_ALPHA", 0x84EB}, + {"GL_COMPRESSED_LUMINANCE_ALPHA_ARB", 0x84EB}, + {"GL_COMPRESSED_INTENSITY", 0x84EC}, + {"GL_COMPRESSED_INTENSITY_ARB", 0x84EC}, + {"GL_COMPRESSED_RGB", 0x84ED}, + {"GL_COMPRESSED_RGB_ARB", 0x84ED}, + {"GL_COMPRESSED_RGBA", 0x84EE}, + {"GL_COMPRESSED_RGBA_ARB", 0x84EE}, + {"GL_TEXTURE_COMPRESSION_HINT", 0x84EF}, + {"GL_TEXTURE_COMPRESSION_HINT_ARB", 0x84EF}, + {"GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER", 0x84F0}, + {"GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER", 0x84F1}, + {"GL_ALL_COMPLETED_NV", 0x84F2}, + {"GL_FENCE_STATUS_NV", 0x84F3}, + {"GL_FENCE_CONDITION_NV", 0x84F4}, + {"GL_TEXTURE_RECTANGLE", 0x84F5}, + {"GL_TEXTURE_RECTANGLE_ARB", 0x84F5}, + {"GL_TEXTURE_RECTANGLE_NV", 0x84F5}, + {"GL_TEXTURE_BINDING_RECTANGLE", 0x84F6}, + {"GL_TEXTURE_BINDING_RECTANGLE_ARB", 0x84F6}, + {"GL_TEXTURE_BINDING_RECTANGLE_NV", 0x84F6}, + {"GL_PROXY_TEXTURE_RECTANGLE", 0x84F7}, + {"GL_PROXY_TEXTURE_RECTANGLE_ARB", 0x84F7}, + {"GL_PROXY_TEXTURE_RECTANGLE_NV", 0x84F7}, + {"GL_MAX_RECTANGLE_TEXTURE_SIZE", 0x84F8}, + {"GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB", 0x84F8}, + {"GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", 0x84F8}, + {"GL_DEPTH_STENCIL", 0x84F9}, + {"GL_DEPTH_STENCIL_EXT", 0x84F9}, + {"GL_DEPTH_STENCIL_NV", 0x84F9}, + {"GL_DEPTH_STENCIL_OES", 0x84F9}, + {"GL_UNSIGNED_INT_24_8", 0x84FA}, + {"GL_UNSIGNED_INT_24_8_EXT", 0x84FA}, + {"GL_UNSIGNED_INT_24_8_NV", 0x84FA}, + {"GL_UNSIGNED_INT_24_8_OES", 0x84FA}, + {"GL_MAX_TEXTURE_LOD_BIAS", 0x84FD}, + {"GL_MAX_TEXTURE_LOD_BIAS_EXT", 0x84FD}, + {"GL_TEXTURE_MAX_ANISOTROPY_EXT", 0x84FE}, + {"GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", 0x84FF}, + {"GL_TEXTURE_FILTER_CONTROL", 0x8500}, + {"GL_TEXTURE_FILTER_CONTROL_EXT", 0x8500}, + {"GL_TEXTURE_LOD_BIAS", 0x8501}, + {"GL_TEXTURE_LOD_BIAS_EXT", 0x8501}, + {"GL_MODELVIEW1_STACK_DEPTH_EXT", 0x8502}, + {"GL_COMBINE4_NV", 0x8503}, + {"GL_MAX_SHININESS_NV", 0x8504}, + {"GL_MAX_SPOT_EXPONENT_NV", 0x8505}, + {"GL_MODELVIEW1_MATRIX_EXT", 0x8506}, + {"GL_INCR_WRAP", 0x8507}, + {"GL_INCR_WRAP_EXT", 0x8507}, + {"GL_INCR_WRAP_OES", 0x8507}, + {"GL_DECR_WRAP", 0x8508}, + {"GL_DECR_WRAP_EXT", 0x8508}, + {"GL_DECR_WRAP_OES", 0x8508}, + {"GL_VERTEX_WEIGHTING_EXT", 0x8509}, + {"GL_MODELVIEW1_ARB", 0x850A}, + {"GL_MODELVIEW1_EXT", 0x850A}, + {"GL_CURRENT_VERTEX_WEIGHT_EXT", 0x850B}, + {"GL_VERTEX_WEIGHT_ARRAY_EXT", 0x850C}, + {"GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT", 0x850D}, + {"GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT", 0x850E}, + {"GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT", 0x850F}, + {"GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT", 0x8510}, + {"GL_NORMAL_MAP", 0x8511}, + {"GL_NORMAL_MAP_ARB", 0x8511}, + {"GL_NORMAL_MAP_EXT", 0x8511}, + {"GL_NORMAL_MAP_NV", 0x8511}, + {"GL_NORMAL_MAP_OES", 0x8511}, + {"GL_REFLECTION_MAP", 0x8512}, + {"GL_REFLECTION_MAP_ARB", 0x8512}, + {"GL_REFLECTION_MAP_EXT", 0x8512}, + {"GL_REFLECTION_MAP_NV", 0x8512}, + {"GL_REFLECTION_MAP_OES", 0x8512}, + {"GL_TEXTURE_CUBE_MAP", 0x8513}, + {"GL_TEXTURE_CUBE_MAP_ARB", 0x8513}, + {"GL_TEXTURE_CUBE_MAP_EXT", 0x8513}, + {"GL_TEXTURE_CUBE_MAP_OES", 0x8513}, + {"GL_TEXTURE_BINDING_CUBE_MAP", 0x8514}, + {"GL_TEXTURE_BINDING_CUBE_MAP_ARB", 0x8514}, + {"GL_TEXTURE_BINDING_CUBE_MAP_EXT", 0x8514}, + {"GL_TEXTURE_BINDING_CUBE_MAP_OES", 0x8514}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_X", 0x8515}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB", 0x8515}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT", 0x8515}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES", 0x8515}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_X", 0x8516}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB", 0x8516}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT", 0x8516}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES", 0x8516}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_Y", 0x8517}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB", 0x8517}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT", 0x8517}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES", 0x8517}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_Y", 0x8518}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB", 0x8518}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT", 0x8518}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES", 0x8518}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_Z", 0x8519}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB", 0x8519}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT", 0x8519}, + {"GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES", 0x8519}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_Z", 0x851A}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB", 0x851A}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT", 0x851A}, + {"GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES", 0x851A}, + {"GL_PROXY_TEXTURE_CUBE_MAP", 0x851B}, + {"GL_PROXY_TEXTURE_CUBE_MAP_ARB", 0x851B}, + {"GL_PROXY_TEXTURE_CUBE_MAP_EXT", 0x851B}, + {"GL_MAX_CUBE_MAP_TEXTURE_SIZE", 0x851C}, + {"GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", 0x851C}, + {"GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT", 0x851C}, + {"GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES", 0x851C}, + {"GL_VERTEX_ARRAY_RANGE_APPLE", 0x851D}, + {"GL_VERTEX_ARRAY_RANGE_NV", 0x851D}, + {"GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE", 0x851E}, + {"GL_VERTEX_ARRAY_RANGE_LENGTH_NV", 0x851E}, + {"GL_VERTEX_ARRAY_RANGE_VALID_NV", 0x851F}, + {"GL_VERTEX_ARRAY_STORAGE_HINT_APPLE", 0x851F}, + {"GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV", 0x8520}, + {"GL_VERTEX_ARRAY_RANGE_POINTER_APPLE", 0x8521}, + {"GL_VERTEX_ARRAY_RANGE_POINTER_NV", 0x8521}, + {"GL_REGISTER_COMBINERS_NV", 0x8522}, + {"GL_VARIABLE_A_NV", 0x8523}, + {"GL_VARIABLE_B_NV", 0x8524}, + {"GL_VARIABLE_C_NV", 0x8525}, + {"GL_VARIABLE_D_NV", 0x8526}, + {"GL_VARIABLE_E_NV", 0x8527}, + {"GL_VARIABLE_F_NV", 0x8528}, + {"GL_VARIABLE_G_NV", 0x8529}, + {"GL_CONSTANT_COLOR0_NV", 0x852A}, + {"GL_CONSTANT_COLOR1_NV", 0x852B}, + {"GL_PRIMARY_COLOR_NV", 0x852C}, + {"GL_SECONDARY_COLOR_NV", 0x852D}, + {"GL_SPARE0_NV", 0x852E}, + {"GL_SPARE1_NV", 0x852F}, + {"GL_DISCARD_NV", 0x8530}, + {"GL_E_TIMES_F_NV", 0x8531}, + {"GL_SPARE0_PLUS_SECONDARY_COLOR_NV", 0x8532}, + {"GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV", 0x8533}, + {"GL_MULTISAMPLE_FILTER_HINT_NV", 0x8534}, + {"GL_PER_STAGE_CONSTANTS_NV", 0x8535}, + {"GL_UNSIGNED_IDENTITY_NV", 0x8536}, + {"GL_UNSIGNED_INVERT_NV", 0x8537}, + {"GL_EXPAND_NORMAL_NV", 0x8538}, + {"GL_EXPAND_NEGATE_NV", 0x8539}, + {"GL_HALF_BIAS_NORMAL_NV", 0x853A}, + {"GL_HALF_BIAS_NEGATE_NV", 0x853B}, + {"GL_SIGNED_IDENTITY_NV", 0x853C}, + {"GL_SIGNED_NEGATE_NV", 0x853D}, + {"GL_SCALE_BY_TWO_NV", 0x853E}, + {"GL_SCALE_BY_FOUR_NV", 0x853F}, + {"GL_SCALE_BY_ONE_HALF_NV", 0x8540}, + {"GL_BIAS_BY_NEGATIVE_ONE_HALF_NV", 0x8541}, + {"GL_COMBINER_INPUT_NV", 0x8542}, + {"GL_COMBINER_MAPPING_NV", 0x8543}, + {"GL_COMBINER_COMPONENT_USAGE_NV", 0x8544}, + {"GL_COMBINER_AB_DOT_PRODUCT_NV", 0x8545}, + {"GL_COMBINER_CD_DOT_PRODUCT_NV", 0x8546}, + {"GL_COMBINER_MUX_SUM_NV", 0x8547}, + {"GL_COMBINER_SCALE_NV", 0x8548}, + {"GL_COMBINER_BIAS_NV", 0x8549}, + {"GL_COMBINER_AB_OUTPUT_NV", 0x854A}, + {"GL_COMBINER_CD_OUTPUT_NV", 0x854B}, + {"GL_COMBINER_SUM_OUTPUT_NV", 0x854C}, + {"GL_MAX_GENERAL_COMBINERS_NV", 0x854D}, + {"GL_NUM_GENERAL_COMBINERS_NV", 0x854E}, + {"GL_COLOR_SUM_CLAMP_NV", 0x854F}, + {"GL_COMBINER0_NV", 0x8550}, + {"GL_COMBINER1_NV", 0x8551}, + {"GL_COMBINER2_NV", 0x8552}, + {"GL_COMBINER3_NV", 0x8553}, + {"GL_COMBINER4_NV", 0x8554}, + {"GL_COMBINER5_NV", 0x8555}, + {"GL_COMBINER6_NV", 0x8556}, + {"GL_COMBINER7_NV", 0x8557}, + {"GL_PRIMITIVE_RESTART_NV", 0x8558}, + {"GL_PRIMITIVE_RESTART_INDEX_NV", 0x8559}, + {"GL_FOG_DISTANCE_MODE_NV", 0x855A}, + {"GL_EYE_RADIAL_NV", 0x855B}, + {"GL_EYE_PLANE_ABSOLUTE_NV", 0x855C}, + {"GL_EMBOSS_LIGHT_NV", 0x855D}, + {"GL_EMBOSS_CONSTANT_NV", 0x855E}, + {"GL_EMBOSS_MAP_NV", 0x855F}, + {"GL_RED_MIN_CLAMP_INGR", 0x8560}, + {"GL_GREEN_MIN_CLAMP_INGR", 0x8561}, + {"GL_BLUE_MIN_CLAMP_INGR", 0x8562}, + {"GL_ALPHA_MIN_CLAMP_INGR", 0x8563}, + {"GL_RED_MAX_CLAMP_INGR", 0x8564}, + {"GL_GREEN_MAX_CLAMP_INGR", 0x8565}, + {"GL_BLUE_MAX_CLAMP_INGR", 0x8566}, + {"GL_ALPHA_MAX_CLAMP_INGR", 0x8567}, + {"GL_INTERLACE_READ_INGR", 0x8568}, + {"GL_COMBINE", 0x8570}, + {"GL_COMBINE_ARB", 0x8570}, + {"GL_COMBINE_EXT", 0x8570}, + {"GL_COMBINE_RGB", 0x8571}, + {"GL_COMBINE_RGB_ARB", 0x8571}, + {"GL_COMBINE_RGB_EXT", 0x8571}, + {"GL_COMBINE_ALPHA", 0x8572}, + {"GL_COMBINE_ALPHA_ARB", 0x8572}, + {"GL_COMBINE_ALPHA_EXT", 0x8572}, + {"GL_RGB_SCALE", 0x8573}, + {"GL_RGB_SCALE_ARB", 0x8573}, + {"GL_RGB_SCALE_EXT", 0x8573}, + {"GL_ADD_SIGNED", 0x8574}, + {"GL_ADD_SIGNED_ARB", 0x8574}, + {"GL_ADD_SIGNED_EXT", 0x8574}, + {"GL_INTERPOLATE", 0x8575}, + {"GL_INTERPOLATE_ARB", 0x8575}, + {"GL_INTERPOLATE_EXT", 0x8575}, + {"GL_CONSTANT", 0x8576}, + {"GL_CONSTANT_ARB", 0x8576}, + {"GL_CONSTANT_EXT", 0x8576}, + {"GL_PRIMARY_COLOR", 0x8577}, + {"GL_PRIMARY_COLOR_ARB", 0x8577}, + {"GL_PRIMARY_COLOR_EXT", 0x8577}, + {"GL_PREVIOUS", 0x8578}, + {"GL_PREVIOUS_ARB", 0x8578}, + {"GL_PREVIOUS_EXT", 0x8578}, + {"GL_SOURCE0_RGB", 0x8580}, + {"GL_SOURCE0_RGB_ARB", 0x8580}, + {"GL_SOURCE0_RGB_EXT", 0x8580}, + {"GL_SRC0_RGB", 0x8580}, + {"GL_SOURCE1_RGB", 0x8581}, + {"GL_SOURCE1_RGB_ARB", 0x8581}, + {"GL_SOURCE1_RGB_EXT", 0x8581}, + {"GL_SRC1_RGB", 0x8581}, + {"GL_SOURCE2_RGB", 0x8582}, + {"GL_SOURCE2_RGB_ARB", 0x8582}, + {"GL_SOURCE2_RGB_EXT", 0x8582}, + {"GL_SRC2_RGB", 0x8582}, + {"GL_SOURCE3_RGB_NV", 0x8583}, + {"GL_SOURCE0_ALPHA", 0x8588}, + {"GL_SOURCE0_ALPHA_ARB", 0x8588}, + {"GL_SOURCE0_ALPHA_EXT", 0x8588}, + {"GL_SRC0_ALPHA", 0x8588}, + {"GL_SOURCE1_ALPHA", 0x8589}, + {"GL_SOURCE1_ALPHA_ARB", 0x8589}, + {"GL_SOURCE1_ALPHA_EXT", 0x8589}, + {"GL_SRC1_ALPHA", 0x8589}, + {"GL_SOURCE2_ALPHA", 0x858A}, + {"GL_SOURCE2_ALPHA_ARB", 0x858A}, + {"GL_SOURCE2_ALPHA_EXT", 0x858A}, + {"GL_SRC2_ALPHA", 0x858A}, + {"GL_SOURCE3_ALPHA_NV", 0x858B}, + {"GL_OPERAND0_RGB", 0x8590}, + {"GL_OPERAND0_RGB_ARB", 0x8590}, + {"GL_OPERAND0_RGB_EXT", 0x8590}, + {"GL_OPERAND1_RGB", 0x8591}, + {"GL_OPERAND1_RGB_ARB", 0x8591}, + {"GL_OPERAND1_RGB_EXT", 0x8591}, + {"GL_OPERAND2_RGB", 0x8592}, + {"GL_OPERAND2_RGB_ARB", 0x8592}, + {"GL_OPERAND2_RGB_EXT", 0x8592}, + {"GL_OPERAND3_RGB_NV", 0x8593}, + {"GL_OPERAND0_ALPHA", 0x8598}, + {"GL_OPERAND0_ALPHA_ARB", 0x8598}, + {"GL_OPERAND0_ALPHA_EXT", 0x8598}, + {"GL_OPERAND1_ALPHA", 0x8599}, + {"GL_OPERAND1_ALPHA_ARB", 0x8599}, + {"GL_OPERAND1_ALPHA_EXT", 0x8599}, + {"GL_OPERAND2_ALPHA", 0x859A}, + {"GL_OPERAND2_ALPHA_ARB", 0x859A}, + {"GL_OPERAND2_ALPHA_EXT", 0x859A}, + {"GL_OPERAND3_ALPHA_NV", 0x859B}, + {"GL_PACK_SUBSAMPLE_RATE_SGIX", 0x85A0}, + {"GL_UNPACK_SUBSAMPLE_RATE_SGIX", 0x85A1}, + {"GL_PIXEL_SUBSAMPLE_4444_SGIX", 0x85A2}, + {"GL_PIXEL_SUBSAMPLE_2424_SGIX", 0x85A3}, + {"GL_PIXEL_SUBSAMPLE_4242_SGIX", 0x85A4}, + {"GL_PERTURB_EXT", 0x85AE}, + {"GL_TEXTURE_NORMAL_EXT", 0x85AF}, + {"GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE", 0x85B0}, + {"GL_TRANSFORM_HINT_APPLE", 0x85B1}, + {"GL_UNPACK_CLIENT_STORAGE_APPLE", 0x85B2}, + {"GL_BUFFER_OBJECT_APPLE", 0x85B3}, + {"GL_STORAGE_CLIENT_APPLE", 0x85B4}, + {"GL_VERTEX_ARRAY_BINDING", 0x85B5}, + {"GL_VERTEX_ARRAY_BINDING_APPLE", 0x85B5}, + {"GL_TEXTURE_RANGE_LENGTH_APPLE", 0x85B7}, + {"GL_TEXTURE_RANGE_POINTER_APPLE", 0x85B8}, + {"GL_YCBCR_422_APPLE", 0x85B9}, + {"GL_UNSIGNED_SHORT_8_8_APPLE", 0x85BA}, + {"GL_UNSIGNED_SHORT_8_8_MESA", 0x85BA}, + {"GL_UNSIGNED_SHORT_8_8_REV_APPLE", 0x85BB}, + {"GL_UNSIGNED_SHORT_8_8_REV_MESA", 0x85BB}, + {"GL_TEXTURE_STORAGE_HINT_APPLE", 0x85BC}, + {"GL_STORAGE_PRIVATE_APPLE", 0x85BD}, + {"GL_STORAGE_CACHED_APPLE", 0x85BE}, + {"GL_STORAGE_SHARED_APPLE", 0x85BF}, + {"GL_REPLACEMENT_CODE_ARRAY_SUN", 0x85C0}, + {"GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN", 0x85C1}, + {"GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN", 0x85C2}, + {"GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN", 0x85C3}, + {"GL_R1UI_V3F_SUN", 0x85C4}, + {"GL_R1UI_C4UB_V3F_SUN", 0x85C5}, + {"GL_R1UI_C3F_V3F_SUN", 0x85C6}, + {"GL_R1UI_N3F_V3F_SUN", 0x85C7}, + {"GL_R1UI_C4F_N3F_V3F_SUN", 0x85C8}, + {"GL_R1UI_T2F_V3F_SUN", 0x85C9}, + {"GL_R1UI_T2F_N3F_V3F_SUN", 0x85CA}, + {"GL_R1UI_T2F_C4F_N3F_V3F_SUN", 0x85CB}, + {"GL_SLICE_ACCUM_SUN", 0x85CC}, + {"GL_QUAD_MESH_SUN", 0x8614}, + {"GL_TRIANGLE_MESH_SUN", 0x8615}, + {"GL_VERTEX_PROGRAM_ARB", 0x8620}, + {"GL_VERTEX_PROGRAM_NV", 0x8620}, + {"GL_VERTEX_STATE_PROGRAM_NV", 0x8621}, + {"GL_VERTEX_ATTRIB_ARRAY_ENABLED", 0x8622}, + {"GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB", 0x8622}, + {"GL_ATTRIB_ARRAY_SIZE_NV", 0x8623}, + {"GL_VERTEX_ATTRIB_ARRAY_SIZE", 0x8623}, + {"GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB", 0x8623}, + {"GL_ATTRIB_ARRAY_STRIDE_NV", 0x8624}, + {"GL_VERTEX_ATTRIB_ARRAY_STRIDE", 0x8624}, + {"GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB", 0x8624}, + {"GL_ATTRIB_ARRAY_TYPE_NV", 0x8625}, + {"GL_VERTEX_ATTRIB_ARRAY_TYPE", 0x8625}, + {"GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB", 0x8625}, + {"GL_CURRENT_ATTRIB_NV", 0x8626}, + {"GL_CURRENT_VERTEX_ATTRIB", 0x8626}, + {"GL_CURRENT_VERTEX_ATTRIB_ARB", 0x8626}, + {"GL_PROGRAM_LENGTH_ARB", 0x8627}, + {"GL_PROGRAM_LENGTH_NV", 0x8627}, + {"GL_PROGRAM_STRING_ARB", 0x8628}, + {"GL_PROGRAM_STRING_NV", 0x8628}, + {"GL_MODELVIEW_PROJECTION_NV", 0x8629}, + {"GL_IDENTITY_NV", 0x862A}, + {"GL_INVERSE_NV", 0x862B}, + {"GL_TRANSPOSE_NV", 0x862C}, + {"GL_INVERSE_TRANSPOSE_NV", 0x862D}, + {"GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", 0x862E}, + {"GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV", 0x862E}, + {"GL_MAX_PROGRAM_MATRICES_ARB", 0x862F}, + {"GL_MAX_TRACK_MATRICES_NV", 0x862F}, + {"GL_MATRIX0_NV", 0x8630}, + {"GL_MATRIX1_NV", 0x8631}, + {"GL_MATRIX2_NV", 0x8632}, + {"GL_MATRIX3_NV", 0x8633}, + {"GL_MATRIX4_NV", 0x8634}, + {"GL_MATRIX5_NV", 0x8635}, + {"GL_MATRIX6_NV", 0x8636}, + {"GL_MATRIX7_NV", 0x8637}, + {"GL_CURRENT_MATRIX_STACK_DEPTH_ARB", 0x8640}, + {"GL_CURRENT_MATRIX_STACK_DEPTH_NV", 0x8640}, + {"GL_CURRENT_MATRIX_ARB", 0x8641}, + {"GL_CURRENT_MATRIX_NV", 0x8641}, + {"GL_VERTEX_PROGRAM_POINT_SIZE", 0x8642}, + {"GL_VERTEX_PROGRAM_POINT_SIZE_ARB", 0x8642}, + {"GL_VERTEX_PROGRAM_POINT_SIZE_NV", 0x8642}, + {"GL_PROGRAM_POINT_SIZE", 0x8642}, + {"GL_PROGRAM_POINT_SIZE_ARB", 0x8642}, + {"GL_PROGRAM_POINT_SIZE_EXT", 0x8642}, + {"GL_VERTEX_PROGRAM_TWO_SIDE", 0x8643}, + {"GL_VERTEX_PROGRAM_TWO_SIDE_ARB", 0x8643}, + {"GL_VERTEX_PROGRAM_TWO_SIDE_NV", 0x8643}, + {"GL_PROGRAM_PARAMETER_NV", 0x8644}, + {"GL_ATTRIB_ARRAY_POINTER_NV", 0x8645}, + {"GL_VERTEX_ATTRIB_ARRAY_POINTER", 0x8645}, + {"GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB", 0x8645}, + {"GL_PROGRAM_TARGET_NV", 0x8646}, + {"GL_PROGRAM_RESIDENT_NV", 0x8647}, + {"GL_TRACK_MATRIX_NV", 0x8648}, + {"GL_TRACK_MATRIX_TRANSFORM_NV", 0x8649}, + {"GL_VERTEX_PROGRAM_BINDING_NV", 0x864A}, + {"GL_PROGRAM_ERROR_POSITION_ARB", 0x864B}, + {"GL_PROGRAM_ERROR_POSITION_NV", 0x864B}, + {"GL_OFFSET_TEXTURE_RECTANGLE_NV", 0x864C}, + {"GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV", 0x864D}, + {"GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV", 0x864E}, + {"GL_DEPTH_CLAMP", 0x864F}, + {"GL_DEPTH_CLAMP_NV", 0x864F}, + {"GL_VERTEX_ATTRIB_ARRAY0_NV", 0x8650}, + {"GL_VERTEX_ATTRIB_ARRAY1_NV", 0x8651}, + {"GL_VERTEX_ATTRIB_ARRAY2_NV", 0x8652}, + {"GL_VERTEX_ATTRIB_ARRAY3_NV", 0x8653}, + {"GL_VERTEX_ATTRIB_ARRAY4_NV", 0x8654}, + {"GL_VERTEX_ATTRIB_ARRAY5_NV", 0x8655}, + {"GL_VERTEX_ATTRIB_ARRAY6_NV", 0x8656}, + {"GL_VERTEX_ATTRIB_ARRAY7_NV", 0x8657}, + {"GL_VERTEX_ATTRIB_ARRAY8_NV", 0x8658}, + {"GL_VERTEX_ATTRIB_ARRAY9_NV", 0x8659}, + {"GL_VERTEX_ATTRIB_ARRAY10_NV", 0x865A}, + {"GL_VERTEX_ATTRIB_ARRAY11_NV", 0x865B}, + {"GL_VERTEX_ATTRIB_ARRAY12_NV", 0x865C}, + {"GL_VERTEX_ATTRIB_ARRAY13_NV", 0x865D}, + {"GL_VERTEX_ATTRIB_ARRAY14_NV", 0x865E}, + {"GL_VERTEX_ATTRIB_ARRAY15_NV", 0x865F}, + {"GL_MAP1_VERTEX_ATTRIB0_4_NV", 0x8660}, + {"GL_MAP1_VERTEX_ATTRIB1_4_NV", 0x8661}, + {"GL_MAP1_VERTEX_ATTRIB2_4_NV", 0x8662}, + {"GL_MAP1_VERTEX_ATTRIB3_4_NV", 0x8663}, + {"GL_MAP1_VERTEX_ATTRIB4_4_NV", 0x8664}, + {"GL_MAP1_VERTEX_ATTRIB5_4_NV", 0x8665}, + {"GL_MAP1_VERTEX_ATTRIB6_4_NV", 0x8666}, + {"GL_MAP1_VERTEX_ATTRIB7_4_NV", 0x8667}, + {"GL_MAP1_VERTEX_ATTRIB8_4_NV", 0x8668}, + {"GL_MAP1_VERTEX_ATTRIB9_4_NV", 0x8669}, + {"GL_MAP1_VERTEX_ATTRIB10_4_NV", 0x866A}, + {"GL_MAP1_VERTEX_ATTRIB11_4_NV", 0x866B}, + {"GL_MAP1_VERTEX_ATTRIB12_4_NV", 0x866C}, + {"GL_MAP1_VERTEX_ATTRIB13_4_NV", 0x866D}, + {"GL_MAP1_VERTEX_ATTRIB14_4_NV", 0x866E}, + {"GL_MAP1_VERTEX_ATTRIB15_4_NV", 0x866F}, + {"GL_MAP2_VERTEX_ATTRIB0_4_NV", 0x8670}, + {"GL_MAP2_VERTEX_ATTRIB1_4_NV", 0x8671}, + {"GL_MAP2_VERTEX_ATTRIB2_4_NV", 0x8672}, + {"GL_MAP2_VERTEX_ATTRIB3_4_NV", 0x8673}, + {"GL_MAP2_VERTEX_ATTRIB4_4_NV", 0x8674}, + {"GL_MAP2_VERTEX_ATTRIB5_4_NV", 0x8675}, + {"GL_MAP2_VERTEX_ATTRIB6_4_NV", 0x8676}, + {"GL_MAP2_VERTEX_ATTRIB7_4_NV", 0x8677}, + {"GL_PROGRAM_BINDING_ARB", 0x8677}, + {"GL_MAP2_VERTEX_ATTRIB8_4_NV", 0x8678}, + {"GL_MAP2_VERTEX_ATTRIB9_4_NV", 0x8679}, + {"GL_MAP2_VERTEX_ATTRIB10_4_NV", 0x867A}, + {"GL_MAP2_VERTEX_ATTRIB11_4_NV", 0x867B}, + {"GL_MAP2_VERTEX_ATTRIB12_4_NV", 0x867C}, + {"GL_MAP2_VERTEX_ATTRIB13_4_NV", 0x867D}, + {"GL_MAP2_VERTEX_ATTRIB14_4_NV", 0x867E}, + {"GL_MAP2_VERTEX_ATTRIB15_4_NV", 0x867F}, + {"GL_TEXTURE_COMPRESSED_IMAGE_SIZE", 0x86A0}, + {"GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB", 0x86A0}, + {"GL_TEXTURE_COMPRESSED", 0x86A1}, + {"GL_TEXTURE_COMPRESSED_ARB", 0x86A1}, + {"GL_NUM_COMPRESSED_TEXTURE_FORMATS", 0x86A2}, + {"GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", 0x86A2}, + {"GL_COMPRESSED_TEXTURE_FORMATS", 0x86A3}, + {"GL_COMPRESSED_TEXTURE_FORMATS_ARB", 0x86A3}, + {"GL_MAX_VERTEX_UNITS_ARB", 0x86A4}, + {"GL_MAX_VERTEX_UNITS_OES", 0x86A4}, + {"GL_ACTIVE_VERTEX_UNITS_ARB", 0x86A5}, + {"GL_WEIGHT_SUM_UNITY_ARB", 0x86A6}, + {"GL_VERTEX_BLEND_ARB", 0x86A7}, + {"GL_CURRENT_WEIGHT_ARB", 0x86A8}, + {"GL_WEIGHT_ARRAY_TYPE_ARB", 0x86A9}, + {"GL_WEIGHT_ARRAY_TYPE_OES", 0x86A9}, + {"GL_WEIGHT_ARRAY_STRIDE_ARB", 0x86AA}, + {"GL_WEIGHT_ARRAY_STRIDE_OES", 0x86AA}, + {"GL_WEIGHT_ARRAY_SIZE_ARB", 0x86AB}, + {"GL_WEIGHT_ARRAY_SIZE_OES", 0x86AB}, + {"GL_WEIGHT_ARRAY_POINTER_ARB", 0x86AC}, + {"GL_WEIGHT_ARRAY_POINTER_OES", 0x86AC}, + {"GL_WEIGHT_ARRAY_ARB", 0x86AD}, + {"GL_WEIGHT_ARRAY_OES", 0x86AD}, + {"GL_DOT3_RGB", 0x86AE}, + {"GL_DOT3_RGB_ARB", 0x86AE}, + {"GL_DOT3_RGBA", 0x86AF}, + {"GL_DOT3_RGBA_ARB", 0x86AF}, + {"GL_DOT3_RGBA_IMG", 0x86AF}, + {"GL_COMPRESSED_RGB_FXT1_3DFX", 0x86B0}, + {"GL_COMPRESSED_RGBA_FXT1_3DFX", 0x86B1}, + {"GL_MULTISAMPLE_3DFX", 0x86B2}, + {"GL_SAMPLE_BUFFERS_3DFX", 0x86B3}, + {"GL_SAMPLES_3DFX", 0x86B4}, + {"GL_EVAL_2D_NV", 0x86C0}, + {"GL_EVAL_TRIANGULAR_2D_NV", 0x86C1}, + {"GL_MAP_TESSELLATION_NV", 0x86C2}, + {"GL_MAP_ATTRIB_U_ORDER_NV", 0x86C3}, + {"GL_MAP_ATTRIB_V_ORDER_NV", 0x86C4}, + {"GL_EVAL_FRACTIONAL_TESSELLATION_NV", 0x86C5}, + {"GL_EVAL_VERTEX_ATTRIB0_NV", 0x86C6}, + {"GL_EVAL_VERTEX_ATTRIB1_NV", 0x86C7}, + {"GL_EVAL_VERTEX_ATTRIB2_NV", 0x86C8}, + {"GL_EVAL_VERTEX_ATTRIB3_NV", 0x86C9}, + {"GL_EVAL_VERTEX_ATTRIB4_NV", 0x86CA}, + {"GL_EVAL_VERTEX_ATTRIB5_NV", 0x86CB}, + {"GL_EVAL_VERTEX_ATTRIB6_NV", 0x86CC}, + {"GL_EVAL_VERTEX_ATTRIB7_NV", 0x86CD}, + {"GL_EVAL_VERTEX_ATTRIB8_NV", 0x86CE}, + {"GL_EVAL_VERTEX_ATTRIB9_NV", 0x86CF}, + {"GL_EVAL_VERTEX_ATTRIB10_NV", 0x86D0}, + {"GL_EVAL_VERTEX_ATTRIB11_NV", 0x86D1}, + {"GL_EVAL_VERTEX_ATTRIB12_NV", 0x86D2}, + {"GL_EVAL_VERTEX_ATTRIB13_NV", 0x86D3}, + {"GL_EVAL_VERTEX_ATTRIB14_NV", 0x86D4}, + {"GL_EVAL_VERTEX_ATTRIB15_NV", 0x86D5}, + {"GL_MAX_MAP_TESSELLATION_NV", 0x86D6}, + {"GL_MAX_RATIONAL_EVAL_ORDER_NV", 0x86D7}, + {"GL_MAX_PROGRAM_PATCH_ATTRIBS_NV", 0x86D8}, + {"GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV", 0x86D9}, + {"GL_UNSIGNED_INT_S8_S8_8_8_NV", 0x86DA}, + {"GL_UNSIGNED_INT_8_8_S8_S8_REV_NV", 0x86DB}, + {"GL_DSDT_MAG_INTENSITY_NV", 0x86DC}, + {"GL_SHADER_CONSISTENT_NV", 0x86DD}, + {"GL_TEXTURE_SHADER_NV", 0x86DE}, + {"GL_SHADER_OPERATION_NV", 0x86DF}, + {"GL_CULL_MODES_NV", 0x86E0}, + {"GL_OFFSET_TEXTURE_MATRIX_NV", 0x86E1}, + {"GL_OFFSET_TEXTURE_2D_MATRIX_NV", 0x86E1}, + {"GL_OFFSET_TEXTURE_SCALE_NV", 0x86E2}, + {"GL_OFFSET_TEXTURE_2D_SCALE_NV", 0x86E2}, + {"GL_OFFSET_TEXTURE_BIAS_NV", 0x86E3}, + {"GL_OFFSET_TEXTURE_2D_BIAS_NV", 0x86E3}, + {"GL_PREVIOUS_TEXTURE_INPUT_NV", 0x86E4}, + {"GL_CONST_EYE_NV", 0x86E5}, + {"GL_PASS_THROUGH_NV", 0x86E6}, + {"GL_CULL_FRAGMENT_NV", 0x86E7}, + {"GL_OFFSET_TEXTURE_2D_NV", 0x86E8}, + {"GL_DEPENDENT_AR_TEXTURE_2D_NV", 0x86E9}, + {"GL_DEPENDENT_GB_TEXTURE_2D_NV", 0x86EA}, + {"GL_SURFACE_STATE_NV", 0x86EB}, + {"GL_DOT_PRODUCT_NV", 0x86EC}, + {"GL_DOT_PRODUCT_DEPTH_REPLACE_NV", 0x86ED}, + {"GL_DOT_PRODUCT_TEXTURE_2D_NV", 0x86EE}, + {"GL_DOT_PRODUCT_TEXTURE_3D_NV", 0x86EF}, + {"GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV", 0x86F0}, + {"GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV", 0x86F1}, + {"GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV", 0x86F2}, + {"GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV", 0x86F3}, + {"GL_HILO_NV", 0x86F4}, + {"GL_DSDT_NV", 0x86F5}, + {"GL_DSDT_MAG_NV", 0x86F6}, + {"GL_DSDT_MAG_VIB_NV", 0x86F7}, + {"GL_HILO16_NV", 0x86F8}, + {"GL_SIGNED_HILO_NV", 0x86F9}, + {"GL_SIGNED_HILO16_NV", 0x86FA}, + {"GL_SIGNED_RGBA_NV", 0x86FB}, + {"GL_SIGNED_RGBA8_NV", 0x86FC}, + {"GL_SURFACE_REGISTERED_NV", 0x86FD}, + {"GL_SIGNED_RGB_NV", 0x86FE}, + {"GL_SIGNED_RGB8_NV", 0x86FF}, + {"GL_SURFACE_MAPPED_NV", 0x8700}, + {"GL_SIGNED_LUMINANCE_NV", 0x8701}, + {"GL_SIGNED_LUMINANCE8_NV", 0x8702}, + {"GL_SIGNED_LUMINANCE_ALPHA_NV", 0x8703}, + {"GL_SIGNED_LUMINANCE8_ALPHA8_NV", 0x8704}, + {"GL_SIGNED_ALPHA_NV", 0x8705}, + {"GL_SIGNED_ALPHA8_NV", 0x8706}, + {"GL_SIGNED_INTENSITY_NV", 0x8707}, + {"GL_SIGNED_INTENSITY8_NV", 0x8708}, + {"GL_DSDT8_NV", 0x8709}, + {"GL_DSDT8_MAG8_NV", 0x870A}, + {"GL_DSDT8_MAG8_INTENSITY8_NV", 0x870B}, + {"GL_SIGNED_RGB_UNSIGNED_ALPHA_NV", 0x870C}, + {"GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV", 0x870D}, + {"GL_HI_SCALE_NV", 0x870E}, + {"GL_LO_SCALE_NV", 0x870F}, + {"GL_DS_SCALE_NV", 0x8710}, + {"GL_DT_SCALE_NV", 0x8711}, + {"GL_MAGNITUDE_SCALE_NV", 0x8712}, + {"GL_VIBRANCE_SCALE_NV", 0x8713}, + {"GL_HI_BIAS_NV", 0x8714}, + {"GL_LO_BIAS_NV", 0x8715}, + {"GL_DS_BIAS_NV", 0x8716}, + {"GL_DT_BIAS_NV", 0x8717}, + {"GL_MAGNITUDE_BIAS_NV", 0x8718}, + {"GL_VIBRANCE_BIAS_NV", 0x8719}, + {"GL_TEXTURE_BORDER_VALUES_NV", 0x871A}, + {"GL_TEXTURE_HI_SIZE_NV", 0x871B}, + {"GL_TEXTURE_LO_SIZE_NV", 0x871C}, + {"GL_TEXTURE_DS_SIZE_NV", 0x871D}, + {"GL_TEXTURE_DT_SIZE_NV", 0x871E}, + {"GL_TEXTURE_MAG_SIZE_NV", 0x871F}, + {"GL_MODELVIEW2_ARB", 0x8722}, + {"GL_MODELVIEW3_ARB", 0x8723}, + {"GL_MODELVIEW4_ARB", 0x8724}, + {"GL_MODELVIEW5_ARB", 0x8725}, + {"GL_MODELVIEW6_ARB", 0x8726}, + {"GL_MODELVIEW7_ARB", 0x8727}, + {"GL_MODELVIEW8_ARB", 0x8728}, + {"GL_MODELVIEW9_ARB", 0x8729}, + {"GL_MODELVIEW10_ARB", 0x872A}, + {"GL_MODELVIEW11_ARB", 0x872B}, + {"GL_MODELVIEW12_ARB", 0x872C}, + {"GL_MODELVIEW13_ARB", 0x872D}, + {"GL_MODELVIEW14_ARB", 0x872E}, + {"GL_MODELVIEW15_ARB", 0x872F}, + {"GL_MODELVIEW16_ARB", 0x8730}, + {"GL_MODELVIEW17_ARB", 0x8731}, + {"GL_MODELVIEW18_ARB", 0x8732}, + {"GL_MODELVIEW19_ARB", 0x8733}, + {"GL_MODELVIEW20_ARB", 0x8734}, + {"GL_MODELVIEW21_ARB", 0x8735}, + {"GL_MODELVIEW22_ARB", 0x8736}, + {"GL_MODELVIEW23_ARB", 0x8737}, + {"GL_MODELVIEW24_ARB", 0x8738}, + {"GL_MODELVIEW25_ARB", 0x8739}, + {"GL_MODELVIEW26_ARB", 0x873A}, + {"GL_MODELVIEW27_ARB", 0x873B}, + {"GL_MODELVIEW28_ARB", 0x873C}, + {"GL_MODELVIEW29_ARB", 0x873D}, + {"GL_MODELVIEW30_ARB", 0x873E}, + {"GL_MODELVIEW31_ARB", 0x873F}, + {"GL_DOT3_RGB_EXT", 0x8740}, + {"GL_Z400_BINARY_AMD", 0x8740}, + {"GL_DOT3_RGBA_EXT", 0x8741}, + {"GL_PROGRAM_BINARY_LENGTH_OES", 0x8741}, + {"GL_PROGRAM_BINARY_LENGTH", 0x8741}, + {"GL_MIRROR_CLAMP_ATI", 0x8742}, + {"GL_MIRROR_CLAMP_EXT", 0x8742}, + {"GL_MIRROR_CLAMP_TO_EDGE", 0x8743}, + {"GL_MIRROR_CLAMP_TO_EDGE_ATI", 0x8743}, + {"GL_MIRROR_CLAMP_TO_EDGE_EXT", 0x8743}, + {"GL_MODULATE_ADD_ATI", 0x8744}, + {"GL_MODULATE_SIGNED_ADD_ATI", 0x8745}, + {"GL_MODULATE_SUBTRACT_ATI", 0x8746}, + {"GL_SET_AMD", 0x874A}, + {"GL_REPLACE_VALUE_AMD", 0x874B}, + {"GL_STENCIL_OP_VALUE_AMD", 0x874C}, + {"GL_STENCIL_BACK_OP_VALUE_AMD", 0x874D}, + {"GL_VERTEX_ATTRIB_ARRAY_LONG", 0x874E}, + {"GL_DEPTH_STENCIL_MESA", 0x8750}, + {"GL_UNSIGNED_INT_24_8_MESA", 0x8751}, + {"GL_UNSIGNED_INT_8_24_REV_MESA", 0x8752}, + {"GL_UNSIGNED_SHORT_15_1_MESA", 0x8753}, + {"GL_UNSIGNED_SHORT_1_15_REV_MESA", 0x8754}, + {"GL_TRACE_MASK_MESA", 0x8755}, + {"GL_TRACE_NAME_MESA", 0x8756}, + {"GL_YCBCR_MESA", 0x8757}, + {"GL_PACK_INVERT_MESA", 0x8758}, + {"GL_DEBUG_OBJECT_MESA", 0x8759}, + {"GL_TEXTURE_1D_STACK_MESAX", 0x8759}, + {"GL_DEBUG_PRINT_MESA", 0x875A}, + {"GL_TEXTURE_2D_STACK_MESAX", 0x875A}, + {"GL_DEBUG_ASSERT_MESA", 0x875B}, + {"GL_PROXY_TEXTURE_1D_STACK_MESAX", 0x875B}, + {"GL_PROXY_TEXTURE_2D_STACK_MESAX", 0x875C}, + {"GL_TEXTURE_1D_STACK_BINDING_MESAX", 0x875D}, + {"GL_TEXTURE_2D_STACK_BINDING_MESAX", 0x875E}, + {"GL_STATIC_ATI", 0x8760}, + {"GL_DYNAMIC_ATI", 0x8761}, + {"GL_PRESERVE_ATI", 0x8762}, + {"GL_DISCARD_ATI", 0x8763}, + {"GL_BUFFER_SIZE", 0x8764}, + {"GL_BUFFER_SIZE_ARB", 0x8764}, + {"GL_OBJECT_BUFFER_SIZE_ATI", 0x8764}, + {"GL_BUFFER_USAGE", 0x8765}, + {"GL_BUFFER_USAGE_ARB", 0x8765}, + {"GL_OBJECT_BUFFER_USAGE_ATI", 0x8765}, + {"GL_ARRAY_OBJECT_BUFFER_ATI", 0x8766}, + {"GL_ARRAY_OBJECT_OFFSET_ATI", 0x8767}, + {"GL_ELEMENT_ARRAY_ATI", 0x8768}, + {"GL_ELEMENT_ARRAY_TYPE_ATI", 0x8769}, + {"GL_ELEMENT_ARRAY_POINTER_ATI", 0x876A}, + {"GL_MAX_VERTEX_STREAMS_ATI", 0x876B}, + {"GL_VERTEX_STREAM0_ATI", 0x876C}, + {"GL_VERTEX_STREAM1_ATI", 0x876D}, + {"GL_VERTEX_STREAM2_ATI", 0x876E}, + {"GL_VERTEX_STREAM3_ATI", 0x876F}, + {"GL_VERTEX_STREAM4_ATI", 0x8770}, + {"GL_VERTEX_STREAM5_ATI", 0x8771}, + {"GL_VERTEX_STREAM6_ATI", 0x8772}, + {"GL_VERTEX_STREAM7_ATI", 0x8773}, + {"GL_VERTEX_SOURCE_ATI", 0x8774}, + {"GL_BUMP_ROT_MATRIX_ATI", 0x8775}, + {"GL_BUMP_ROT_MATRIX_SIZE_ATI", 0x8776}, + {"GL_BUMP_NUM_TEX_UNITS_ATI", 0x8777}, + {"GL_BUMP_TEX_UNITS_ATI", 0x8778}, + {"GL_DUDV_ATI", 0x8779}, + {"GL_DU8DV8_ATI", 0x877A}, + {"GL_BUMP_ENVMAP_ATI", 0x877B}, + {"GL_BUMP_TARGET_ATI", 0x877C}, + {"GL_VERTEX_SHADER_EXT", 0x8780}, + {"GL_VERTEX_SHADER_BINDING_EXT", 0x8781}, + {"GL_OP_INDEX_EXT", 0x8782}, + {"GL_OP_NEGATE_EXT", 0x8783}, + {"GL_OP_DOT3_EXT", 0x8784}, + {"GL_OP_DOT4_EXT", 0x8785}, + {"GL_OP_MUL_EXT", 0x8786}, + {"GL_OP_ADD_EXT", 0x8787}, + {"GL_OP_MADD_EXT", 0x8788}, + {"GL_OP_FRAC_EXT", 0x8789}, + {"GL_OP_MAX_EXT", 0x878A}, + {"GL_OP_MIN_EXT", 0x878B}, + {"GL_OP_SET_GE_EXT", 0x878C}, + {"GL_OP_SET_LT_EXT", 0x878D}, + {"GL_OP_CLAMP_EXT", 0x878E}, + {"GL_OP_FLOOR_EXT", 0x878F}, + {"GL_OP_ROUND_EXT", 0x8790}, + {"GL_OP_EXP_BASE_2_EXT", 0x8791}, + {"GL_OP_LOG_BASE_2_EXT", 0x8792}, + {"GL_OP_POWER_EXT", 0x8793}, + {"GL_OP_RECIP_EXT", 0x8794}, + {"GL_OP_RECIP_SQRT_EXT", 0x8795}, + {"GL_OP_SUB_EXT", 0x8796}, + {"GL_OP_CROSS_PRODUCT_EXT", 0x8797}, + {"GL_OP_MULTIPLY_MATRIX_EXT", 0x8798}, + {"GL_OP_MOV_EXT", 0x8799}, + {"GL_OUTPUT_VERTEX_EXT", 0x879A}, + {"GL_OUTPUT_COLOR0_EXT", 0x879B}, + {"GL_OUTPUT_COLOR1_EXT", 0x879C}, + {"GL_OUTPUT_TEXTURE_COORD0_EXT", 0x879D}, + {"GL_OUTPUT_TEXTURE_COORD1_EXT", 0x879E}, + {"GL_OUTPUT_TEXTURE_COORD2_EXT", 0x879F}, + {"GL_OUTPUT_TEXTURE_COORD3_EXT", 0x87A0}, + {"GL_OUTPUT_TEXTURE_COORD4_EXT", 0x87A1}, + {"GL_OUTPUT_TEXTURE_COORD5_EXT", 0x87A2}, + {"GL_OUTPUT_TEXTURE_COORD6_EXT", 0x87A3}, + {"GL_OUTPUT_TEXTURE_COORD7_EXT", 0x87A4}, + {"GL_OUTPUT_TEXTURE_COORD8_EXT", 0x87A5}, + {"GL_OUTPUT_TEXTURE_COORD9_EXT", 0x87A6}, + {"GL_OUTPUT_TEXTURE_COORD10_EXT", 0x87A7}, + {"GL_OUTPUT_TEXTURE_COORD11_EXT", 0x87A8}, + {"GL_OUTPUT_TEXTURE_COORD12_EXT", 0x87A9}, + {"GL_OUTPUT_TEXTURE_COORD13_EXT", 0x87AA}, + {"GL_OUTPUT_TEXTURE_COORD14_EXT", 0x87AB}, + {"GL_OUTPUT_TEXTURE_COORD15_EXT", 0x87AC}, + {"GL_OUTPUT_TEXTURE_COORD16_EXT", 0x87AD}, + {"GL_OUTPUT_TEXTURE_COORD17_EXT", 0x87AE}, + {"GL_OUTPUT_TEXTURE_COORD18_EXT", 0x87AF}, + {"GL_OUTPUT_TEXTURE_COORD19_EXT", 0x87B0}, + {"GL_OUTPUT_TEXTURE_COORD20_EXT", 0x87B1}, + {"GL_OUTPUT_TEXTURE_COORD21_EXT", 0x87B2}, + {"GL_OUTPUT_TEXTURE_COORD22_EXT", 0x87B3}, + {"GL_OUTPUT_TEXTURE_COORD23_EXT", 0x87B4}, + {"GL_OUTPUT_TEXTURE_COORD24_EXT", 0x87B5}, + {"GL_OUTPUT_TEXTURE_COORD25_EXT", 0x87B6}, + {"GL_OUTPUT_TEXTURE_COORD26_EXT", 0x87B7}, + {"GL_OUTPUT_TEXTURE_COORD27_EXT", 0x87B8}, + {"GL_OUTPUT_TEXTURE_COORD28_EXT", 0x87B9}, + {"GL_OUTPUT_TEXTURE_COORD29_EXT", 0x87BA}, + {"GL_OUTPUT_TEXTURE_COORD30_EXT", 0x87BB}, + {"GL_OUTPUT_TEXTURE_COORD31_EXT", 0x87BC}, + {"GL_OUTPUT_FOG_EXT", 0x87BD}, + {"GL_SCALAR_EXT", 0x87BE}, + {"GL_VECTOR_EXT", 0x87BF}, + {"GL_MATRIX_EXT", 0x87C0}, + {"GL_VARIANT_EXT", 0x87C1}, + {"GL_INVARIANT_EXT", 0x87C2}, + {"GL_LOCAL_CONSTANT_EXT", 0x87C3}, + {"GL_LOCAL_EXT", 0x87C4}, + {"GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT", 0x87C5}, + {"GL_MAX_VERTEX_SHADER_VARIANTS_EXT", 0x87C6}, + {"GL_MAX_VERTEX_SHADER_INVARIANTS_EXT", 0x87C7}, + {"GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT", 0x87C8}, + {"GL_MAX_VERTEX_SHADER_LOCALS_EXT", 0x87C9}, + {"GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT", 0x87CA}, + {"GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT", 0x87CB}, + {"GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT", 0x87CC}, + {"GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT", 0x87CD}, + {"GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT", 0x87CE}, + {"GL_VERTEX_SHADER_INSTRUCTIONS_EXT", 0x87CF}, + {"GL_VERTEX_SHADER_VARIANTS_EXT", 0x87D0}, + {"GL_VERTEX_SHADER_INVARIANTS_EXT", 0x87D1}, + {"GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT", 0x87D2}, + {"GL_VERTEX_SHADER_LOCALS_EXT", 0x87D3}, + {"GL_VERTEX_SHADER_OPTIMIZED_EXT", 0x87D4}, + {"GL_X_EXT", 0x87D5}, + {"GL_Y_EXT", 0x87D6}, + {"GL_Z_EXT", 0x87D7}, + {"GL_W_EXT", 0x87D8}, + {"GL_NEGATIVE_X_EXT", 0x87D9}, + {"GL_NEGATIVE_Y_EXT", 0x87DA}, + {"GL_NEGATIVE_Z_EXT", 0x87DB}, + {"GL_NEGATIVE_W_EXT", 0x87DC}, + {"GL_ZERO_EXT", 0x87DD}, + {"GL_ONE_EXT", 0x87DE}, + {"GL_NEGATIVE_ONE_EXT", 0x87DF}, + {"GL_NORMALIZED_RANGE_EXT", 0x87E0}, + {"GL_FULL_RANGE_EXT", 0x87E1}, + {"GL_CURRENT_VERTEX_EXT", 0x87E2}, + {"GL_MVP_MATRIX_EXT", 0x87E3}, + {"GL_VARIANT_VALUE_EXT", 0x87E4}, + {"GL_VARIANT_DATATYPE_EXT", 0x87E5}, + {"GL_VARIANT_ARRAY_STRIDE_EXT", 0x87E6}, + {"GL_VARIANT_ARRAY_TYPE_EXT", 0x87E7}, + {"GL_VARIANT_ARRAY_EXT", 0x87E8}, + {"GL_VARIANT_ARRAY_POINTER_EXT", 0x87E9}, + {"GL_INVARIANT_VALUE_EXT", 0x87EA}, + {"GL_INVARIANT_DATATYPE_EXT", 0x87EB}, + {"GL_LOCAL_CONSTANT_VALUE_EXT", 0x87EC}, + {"GL_LOCAL_CONSTANT_DATATYPE_EXT", 0x87ED}, + {"GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD", 0x87EE}, + {"GL_PN_TRIANGLES_ATI", 0x87F0}, + {"GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI", 0x87F1}, + {"GL_PN_TRIANGLES_POINT_MODE_ATI", 0x87F2}, + {"GL_PN_TRIANGLES_NORMAL_MODE_ATI", 0x87F3}, + {"GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI", 0x87F4}, + {"GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI", 0x87F5}, + {"GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI", 0x87F6}, + {"GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI", 0x87F7}, + {"GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI", 0x87F8}, + {"GL_3DC_X_AMD", 0x87F9}, + {"GL_3DC_XY_AMD", 0x87FA}, + {"GL_VBO_FREE_MEMORY_ATI", 0x87FB}, + {"GL_TEXTURE_FREE_MEMORY_ATI", 0x87FC}, + {"GL_RENDERBUFFER_FREE_MEMORY_ATI", 0x87FD}, + {"GL_NUM_PROGRAM_BINARY_FORMATS", 0x87FE}, + {"GL_NUM_PROGRAM_BINARY_FORMATS_OES", 0x87FE}, + {"GL_PROGRAM_BINARY_FORMATS", 0x87FF}, + {"GL_PROGRAM_BINARY_FORMATS_OES", 0x87FF}, + {"GL_STENCIL_BACK_FUNC", 0x8800}, + {"GL_STENCIL_BACK_FUNC_ATI", 0x8800}, + {"GL_STENCIL_BACK_FAIL", 0x8801}, + {"GL_STENCIL_BACK_FAIL_ATI", 0x8801}, + {"GL_STENCIL_BACK_PASS_DEPTH_FAIL", 0x8802}, + {"GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI", 0x8802}, + {"GL_STENCIL_BACK_PASS_DEPTH_PASS", 0x8803}, + {"GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI", 0x8803}, + {"GL_FRAGMENT_PROGRAM_ARB", 0x8804}, + {"GL_PROGRAM_ALU_INSTRUCTIONS_ARB", 0x8805}, + {"GL_PROGRAM_TEX_INSTRUCTIONS_ARB", 0x8806}, + {"GL_PROGRAM_TEX_INDIRECTIONS_ARB", 0x8807}, + {"GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB", 0x8808}, + {"GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB", 0x8809}, + {"GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB", 0x880A}, + {"GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB", 0x880B}, + {"GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB", 0x880C}, + {"GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB", 0x880D}, + {"GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB", 0x880E}, + {"GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB", 0x880F}, + {"GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB", 0x8810}, + {"GL_RGBA32F", 0x8814}, + {"GL_RGBA32F_ARB", 0x8814}, + {"GL_RGBA_FLOAT32_APPLE", 0x8814}, + {"GL_RGBA_FLOAT32_ATI", 0x8814}, + {"GL_RGB32F", 0x8815}, + {"GL_RGB32F_ARB", 0x8815}, + {"GL_RGB_FLOAT32_APPLE", 0x8815}, + {"GL_RGB_FLOAT32_ATI", 0x8815}, + {"GL_ALPHA32F_ARB", 0x8816}, + {"GL_ALPHA_FLOAT32_APPLE", 0x8816}, + {"GL_ALPHA_FLOAT32_ATI", 0x8816}, + {"GL_INTENSITY32F_ARB", 0x8817}, + {"GL_INTENSITY_FLOAT32_APPLE", 0x8817}, + {"GL_INTENSITY_FLOAT32_ATI", 0x8817}, + {"GL_LUMINANCE32F_ARB", 0x8818}, + {"GL_LUMINANCE_FLOAT32_APPLE", 0x8818}, + {"GL_LUMINANCE_FLOAT32_ATI", 0x8818}, + {"GL_LUMINANCE_ALPHA32F_ARB", 0x8819}, + {"GL_LUMINANCE_ALPHA_FLOAT32_APPLE", 0x8819}, + {"GL_LUMINANCE_ALPHA_FLOAT32_ATI", 0x8819}, + {"GL_RGBA16F", 0x881A}, + {"GL_RGBA16F_ARB", 0x881A}, + {"GL_RGBA16F_EXT", 0x881A}, + {"GL_RGBA_FLOAT16_APPLE", 0x881A}, + {"GL_RGBA_FLOAT16_ATI", 0x881A}, + {"GL_RGB16F", 0x881B}, + {"GL_RGB16F_ARB", 0x881B}, + {"GL_RGB16F_EXT", 0x881B}, + {"GL_RGB_FLOAT16_APPLE", 0x881B}, + {"GL_RGB_FLOAT16_ATI", 0x881B}, + {"GL_ALPHA16F_ARB", 0x881C}, + {"GL_ALPHA_FLOAT16_APPLE", 0x881C}, + {"GL_ALPHA_FLOAT16_ATI", 0x881C}, + {"GL_INTENSITY16F_ARB", 0x881D}, + {"GL_INTENSITY_FLOAT16_APPLE", 0x881D}, + {"GL_INTENSITY_FLOAT16_ATI", 0x881D}, + {"GL_LUMINANCE16F_ARB", 0x881E}, + {"GL_LUMINANCE_FLOAT16_APPLE", 0x881E}, + {"GL_LUMINANCE_FLOAT16_ATI", 0x881E}, + {"GL_LUMINANCE_ALPHA16F_ARB", 0x881F}, + {"GL_LUMINANCE_ALPHA_FLOAT16_APPLE", 0x881F}, + {"GL_LUMINANCE_ALPHA_FLOAT16_ATI", 0x881F}, + {"GL_RGBA_FLOAT_MODE_ARB", 0x8820}, + {"GL_RGBA_FLOAT_MODE_ATI", 0x8820}, + {"GL_WRITEONLY_RENDERING_QCOM", 0x8823}, + {"GL_MAX_DRAW_BUFFERS", 0x8824}, + {"GL_MAX_DRAW_BUFFERS_ARB", 0x8824}, + {"GL_MAX_DRAW_BUFFERS_ATI", 0x8824}, + {"GL_MAX_DRAW_BUFFERS_EXT", 0x8824}, + {"GL_MAX_DRAW_BUFFERS_NV", 0x8824}, + {"GL_DRAW_BUFFER0", 0x8825}, + {"GL_DRAW_BUFFER0_ARB", 0x8825}, + {"GL_DRAW_BUFFER0_ATI", 0x8825}, + {"GL_DRAW_BUFFER0_EXT", 0x8825}, + {"GL_DRAW_BUFFER0_NV", 0x8825}, + {"GL_DRAW_BUFFER1", 0x8826}, + {"GL_DRAW_BUFFER1_ARB", 0x8826}, + {"GL_DRAW_BUFFER1_ATI", 0x8826}, + {"GL_DRAW_BUFFER1_EXT", 0x8826}, + {"GL_DRAW_BUFFER1_NV", 0x8826}, + {"GL_DRAW_BUFFER2", 0x8827}, + {"GL_DRAW_BUFFER2_ARB", 0x8827}, + {"GL_DRAW_BUFFER2_ATI", 0x8827}, + {"GL_DRAW_BUFFER2_EXT", 0x8827}, + {"GL_DRAW_BUFFER2_NV", 0x8827}, + {"GL_DRAW_BUFFER3", 0x8828}, + {"GL_DRAW_BUFFER3_ARB", 0x8828}, + {"GL_DRAW_BUFFER3_ATI", 0x8828}, + {"GL_DRAW_BUFFER3_EXT", 0x8828}, + {"GL_DRAW_BUFFER3_NV", 0x8828}, + {"GL_DRAW_BUFFER4", 0x8829}, + {"GL_DRAW_BUFFER4_ARB", 0x8829}, + {"GL_DRAW_BUFFER4_ATI", 0x8829}, + {"GL_DRAW_BUFFER4_EXT", 0x8829}, + {"GL_DRAW_BUFFER4_NV", 0x8829}, + {"GL_DRAW_BUFFER5", 0x882A}, + {"GL_DRAW_BUFFER5_ARB", 0x882A}, + {"GL_DRAW_BUFFER5_ATI", 0x882A}, + {"GL_DRAW_BUFFER5_EXT", 0x882A}, + {"GL_DRAW_BUFFER5_NV", 0x882A}, + {"GL_DRAW_BUFFER6", 0x882B}, + {"GL_DRAW_BUFFER6_ARB", 0x882B}, + {"GL_DRAW_BUFFER6_ATI", 0x882B}, + {"GL_DRAW_BUFFER6_EXT", 0x882B}, + {"GL_DRAW_BUFFER6_NV", 0x882B}, + {"GL_DRAW_BUFFER7", 0x882C}, + {"GL_DRAW_BUFFER7_ARB", 0x882C}, + {"GL_DRAW_BUFFER7_ATI", 0x882C}, + {"GL_DRAW_BUFFER7_EXT", 0x882C}, + {"GL_DRAW_BUFFER7_NV", 0x882C}, + {"GL_DRAW_BUFFER8", 0x882D}, + {"GL_DRAW_BUFFER8_ARB", 0x882D}, + {"GL_DRAW_BUFFER8_ATI", 0x882D}, + {"GL_DRAW_BUFFER8_EXT", 0x882D}, + {"GL_DRAW_BUFFER8_NV", 0x882D}, + {"GL_DRAW_BUFFER9", 0x882E}, + {"GL_DRAW_BUFFER9_ARB", 0x882E}, + {"GL_DRAW_BUFFER9_ATI", 0x882E}, + {"GL_DRAW_BUFFER9_EXT", 0x882E}, + {"GL_DRAW_BUFFER9_NV", 0x882E}, + {"GL_DRAW_BUFFER10", 0x882F}, + {"GL_DRAW_BUFFER10_ARB", 0x882F}, + {"GL_DRAW_BUFFER10_ATI", 0x882F}, + {"GL_DRAW_BUFFER10_EXT", 0x882F}, + {"GL_DRAW_BUFFER10_NV", 0x882F}, + {"GL_DRAW_BUFFER11", 0x8830}, + {"GL_DRAW_BUFFER11_ARB", 0x8830}, + {"GL_DRAW_BUFFER11_ATI", 0x8830}, + {"GL_DRAW_BUFFER11_EXT", 0x8830}, + {"GL_DRAW_BUFFER11_NV", 0x8830}, + {"GL_DRAW_BUFFER12", 0x8831}, + {"GL_DRAW_BUFFER12_ARB", 0x8831}, + {"GL_DRAW_BUFFER12_ATI", 0x8831}, + {"GL_DRAW_BUFFER12_EXT", 0x8831}, + {"GL_DRAW_BUFFER12_NV", 0x8831}, + {"GL_DRAW_BUFFER13", 0x8832}, + {"GL_DRAW_BUFFER13_ARB", 0x8832}, + {"GL_DRAW_BUFFER13_ATI", 0x8832}, + {"GL_DRAW_BUFFER13_EXT", 0x8832}, + {"GL_DRAW_BUFFER13_NV", 0x8832}, + {"GL_DRAW_BUFFER14", 0x8833}, + {"GL_DRAW_BUFFER14_ARB", 0x8833}, + {"GL_DRAW_BUFFER14_ATI", 0x8833}, + {"GL_DRAW_BUFFER14_EXT", 0x8833}, + {"GL_DRAW_BUFFER14_NV", 0x8833}, + {"GL_DRAW_BUFFER15", 0x8834}, + {"GL_DRAW_BUFFER15_ARB", 0x8834}, + {"GL_DRAW_BUFFER15_ATI", 0x8834}, + {"GL_DRAW_BUFFER15_EXT", 0x8834}, + {"GL_DRAW_BUFFER15_NV", 0x8834}, + {"GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI", 0x8835}, + {"GL_BLEND_EQUATION_ALPHA", 0x883D}, + {"GL_BLEND_EQUATION_ALPHA_EXT", 0x883D}, + {"GL_BLEND_EQUATION_ALPHA_OES", 0x883D}, + {"GL_SUBSAMPLE_DISTANCE_AMD", 0x883F}, + {"GL_MATRIX_PALETTE_ARB", 0x8840}, + {"GL_MATRIX_PALETTE_OES", 0x8840}, + {"GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB", 0x8841}, + {"GL_MAX_PALETTE_MATRICES_ARB", 0x8842}, + {"GL_MAX_PALETTE_MATRICES_OES", 0x8842}, + {"GL_CURRENT_PALETTE_MATRIX_ARB", 0x8843}, + {"GL_CURRENT_PALETTE_MATRIX_OES", 0x8843}, + {"GL_MATRIX_INDEX_ARRAY_ARB", 0x8844}, + {"GL_MATRIX_INDEX_ARRAY_OES", 0x8844}, + {"GL_CURRENT_MATRIX_INDEX_ARB", 0x8845}, + {"GL_MATRIX_INDEX_ARRAY_SIZE_ARB", 0x8846}, + {"GL_MATRIX_INDEX_ARRAY_SIZE_OES", 0x8846}, + {"GL_MATRIX_INDEX_ARRAY_TYPE_ARB", 0x8847}, + {"GL_MATRIX_INDEX_ARRAY_TYPE_OES", 0x8847}, + {"GL_MATRIX_INDEX_ARRAY_STRIDE_ARB", 0x8848}, + {"GL_MATRIX_INDEX_ARRAY_STRIDE_OES", 0x8848}, + {"GL_MATRIX_INDEX_ARRAY_POINTER_ARB", 0x8849}, + {"GL_MATRIX_INDEX_ARRAY_POINTER_OES", 0x8849}, + {"GL_TEXTURE_DEPTH_SIZE", 0x884A}, + {"GL_TEXTURE_DEPTH_SIZE_ARB", 0x884A}, + {"GL_DEPTH_TEXTURE_MODE", 0x884B}, + {"GL_DEPTH_TEXTURE_MODE_ARB", 0x884B}, + {"GL_TEXTURE_COMPARE_MODE", 0x884C}, + {"GL_TEXTURE_COMPARE_MODE_ARB", 0x884C}, + {"GL_TEXTURE_COMPARE_MODE_EXT", 0x884C}, + {"GL_TEXTURE_COMPARE_FUNC", 0x884D}, + {"GL_TEXTURE_COMPARE_FUNC_ARB", 0x884D}, + {"GL_TEXTURE_COMPARE_FUNC_EXT", 0x884D}, + {"GL_COMPARE_R_TO_TEXTURE", 0x884E}, + {"GL_COMPARE_R_TO_TEXTURE_ARB", 0x884E}, + {"GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT", 0x884E}, + {"GL_COMPARE_REF_TO_TEXTURE", 0x884E}, + {"GL_COMPARE_REF_TO_TEXTURE_EXT", 0x884E}, + {"GL_TEXTURE_CUBE_MAP_SEAMLESS", 0x884F}, + {"GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV", 0x8850}, + {"GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV", 0x8851}, + {"GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV", 0x8852}, + {"GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV", 0x8853}, + {"GL_OFFSET_HILO_TEXTURE_2D_NV", 0x8854}, + {"GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV", 0x8855}, + {"GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV", 0x8856}, + {"GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV", 0x8857}, + {"GL_DEPENDENT_HILO_TEXTURE_2D_NV", 0x8858}, + {"GL_DEPENDENT_RGB_TEXTURE_3D_NV", 0x8859}, + {"GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV", 0x885A}, + {"GL_DOT_PRODUCT_PASS_THROUGH_NV", 0x885B}, + {"GL_DOT_PRODUCT_TEXTURE_1D_NV", 0x885C}, + {"GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV", 0x885D}, + {"GL_HILO8_NV", 0x885E}, + {"GL_SIGNED_HILO8_NV", 0x885F}, + {"GL_FORCE_BLUE_TO_ONE_NV", 0x8860}, + {"GL_POINT_SPRITE", 0x8861}, + {"GL_POINT_SPRITE_ARB", 0x8861}, + {"GL_POINT_SPRITE_NV", 0x8861}, + {"GL_POINT_SPRITE_OES", 0x8861}, + {"GL_COORD_REPLACE", 0x8862}, + {"GL_COORD_REPLACE_ARB", 0x8862}, + {"GL_COORD_REPLACE_NV", 0x8862}, + {"GL_COORD_REPLACE_OES", 0x8862}, + {"GL_POINT_SPRITE_R_MODE_NV", 0x8863}, + {"GL_PIXEL_COUNTER_BITS_NV", 0x8864}, + {"GL_QUERY_COUNTER_BITS", 0x8864}, + {"GL_QUERY_COUNTER_BITS_ARB", 0x8864}, + {"GL_QUERY_COUNTER_BITS_EXT", 0x8864}, + {"GL_CURRENT_OCCLUSION_QUERY_ID_NV", 0x8865}, + {"GL_CURRENT_QUERY", 0x8865}, + {"GL_CURRENT_QUERY_ARB", 0x8865}, + {"GL_CURRENT_QUERY_EXT", 0x8865}, + {"GL_PIXEL_COUNT_NV", 0x8866}, + {"GL_QUERY_RESULT", 0x8866}, + {"GL_QUERY_RESULT_ARB", 0x8866}, + {"GL_QUERY_RESULT_EXT", 0x8866}, + {"GL_PIXEL_COUNT_AVAILABLE_NV", 0x8867}, + {"GL_QUERY_RESULT_AVAILABLE", 0x8867}, + {"GL_QUERY_RESULT_AVAILABLE_ARB", 0x8867}, + {"GL_QUERY_RESULT_AVAILABLE_EXT", 0x8867}, + {"GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", 0x8868}, + {"GL_MAX_VERTEX_ATTRIBS", 0x8869}, + {"GL_MAX_VERTEX_ATTRIBS_ARB", 0x8869}, + {"GL_VERTEX_ATTRIB_ARRAY_NORMALIZED", 0x886A}, + {"GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB", 0x886A}, + {"GL_MAX_TESS_CONTROL_INPUT_COMPONENTS", 0x886C}, + {"GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS", 0x886D}, + {"GL_DEPTH_STENCIL_TO_RGBA_NV", 0x886E}, + {"GL_DEPTH_STENCIL_TO_BGRA_NV", 0x886F}, + {"GL_FRAGMENT_PROGRAM_NV", 0x8870}, + {"GL_MAX_TEXTURE_COORDS", 0x8871}, + {"GL_MAX_TEXTURE_COORDS_ARB", 0x8871}, + {"GL_MAX_TEXTURE_COORDS_NV", 0x8871}, + {"GL_MAX_TEXTURE_IMAGE_UNITS", 0x8872}, + {"GL_MAX_TEXTURE_IMAGE_UNITS_ARB", 0x8872}, + {"GL_MAX_TEXTURE_IMAGE_UNITS_NV", 0x8872}, + {"GL_FRAGMENT_PROGRAM_BINDING_NV", 0x8873}, + {"GL_PROGRAM_ERROR_STRING_ARB", 0x8874}, + {"GL_PROGRAM_ERROR_STRING_NV", 0x8874}, + {"GL_PROGRAM_FORMAT_ASCII_ARB", 0x8875}, + {"GL_PROGRAM_FORMAT_ARB", 0x8876}, + {"GL_WRITE_PIXEL_DATA_RANGE_NV", 0x8878}, + {"GL_READ_PIXEL_DATA_RANGE_NV", 0x8879}, + {"GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV", 0x887A}, + {"GL_READ_PIXEL_DATA_RANGE_LENGTH_NV", 0x887B}, + {"GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV", 0x887C}, + {"GL_READ_PIXEL_DATA_RANGE_POINTER_NV", 0x887D}, + {"GL_GEOMETRY_SHADER_INVOCATIONS", 0x887F}, + {"GL_FLOAT_R_NV", 0x8880}, + {"GL_FLOAT_RG_NV", 0x8881}, + {"GL_FLOAT_RGB_NV", 0x8882}, + {"GL_FLOAT_RGBA_NV", 0x8883}, + {"GL_FLOAT_R16_NV", 0x8884}, + {"GL_FLOAT_R32_NV", 0x8885}, + {"GL_FLOAT_RG16_NV", 0x8886}, + {"GL_FLOAT_RG32_NV", 0x8887}, + {"GL_FLOAT_RGB16_NV", 0x8888}, + {"GL_FLOAT_RGB32_NV", 0x8889}, + {"GL_FLOAT_RGBA16_NV", 0x888A}, + {"GL_FLOAT_RGBA32_NV", 0x888B}, + {"GL_TEXTURE_FLOAT_COMPONENTS_NV", 0x888C}, + {"GL_FLOAT_CLEAR_COLOR_VALUE_NV", 0x888D}, + {"GL_FLOAT_RGBA_MODE_NV", 0x888E}, + {"GL_TEXTURE_UNSIGNED_REMAP_MODE_NV", 0x888F}, + {"GL_DEPTH_BOUNDS_TEST_EXT", 0x8890}, + {"GL_DEPTH_BOUNDS_EXT", 0x8891}, + {"GL_ARRAY_BUFFER", 0x8892}, + {"GL_ARRAY_BUFFER_ARB", 0x8892}, + {"GL_ELEMENT_ARRAY_BUFFER", 0x8893}, + {"GL_ELEMENT_ARRAY_BUFFER_ARB", 0x8893}, + {"GL_ARRAY_BUFFER_BINDING", 0x8894}, + {"GL_ARRAY_BUFFER_BINDING_ARB", 0x8894}, + {"GL_ELEMENT_ARRAY_BUFFER_BINDING", 0x8895}, + {"GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", 0x8895}, + {"GL_VERTEX_ARRAY_BUFFER_BINDING", 0x8896}, + {"GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", 0x8896}, + {"GL_NORMAL_ARRAY_BUFFER_BINDING", 0x8897}, + {"GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", 0x8897}, + {"GL_COLOR_ARRAY_BUFFER_BINDING", 0x8898}, + {"GL_COLOR_ARRAY_BUFFER_BINDING_ARB", 0x8898}, + {"GL_INDEX_ARRAY_BUFFER_BINDING", 0x8899}, + {"GL_INDEX_ARRAY_BUFFER_BINDING_ARB", 0x8899}, + {"GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING", 0x889A}, + {"GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", 0x889A}, + {"GL_EDGE_FLAG_ARRAY_BUFFER_BINDING", 0x889B}, + {"GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", 0x889B}, + {"GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING", 0x889C}, + {"GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", 0x889C}, + {"GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", 0x889D}, + {"GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING", 0x889D}, + {"GL_FOG_COORD_ARRAY_BUFFER_BINDING", 0x889D}, + {"GL_WEIGHT_ARRAY_BUFFER_BINDING", 0x889E}, + {"GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB", 0x889E}, + {"GL_WEIGHT_ARRAY_BUFFER_BINDING_OES", 0x889E}, + {"GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", 0x889F}, + {"GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB", 0x889F}, + {"GL_PROGRAM_INSTRUCTIONS_ARB", 0x88A0}, + {"GL_MAX_PROGRAM_INSTRUCTIONS_ARB", 0x88A1}, + {"GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB", 0x88A2}, + {"GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB", 0x88A3}, + {"GL_PROGRAM_TEMPORARIES_ARB", 0x88A4}, + {"GL_MAX_PROGRAM_TEMPORARIES_ARB", 0x88A5}, + {"GL_PROGRAM_NATIVE_TEMPORARIES_ARB", 0x88A6}, + {"GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB", 0x88A7}, + {"GL_PROGRAM_PARAMETERS_ARB", 0x88A8}, + {"GL_MAX_PROGRAM_PARAMETERS_ARB", 0x88A9}, + {"GL_PROGRAM_NATIVE_PARAMETERS_ARB", 0x88AA}, + {"GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB", 0x88AB}, + {"GL_PROGRAM_ATTRIBS_ARB", 0x88AC}, + {"GL_MAX_PROGRAM_ATTRIBS_ARB", 0x88AD}, + {"GL_PROGRAM_NATIVE_ATTRIBS_ARB", 0x88AE}, + {"GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB", 0x88AF}, + {"GL_PROGRAM_ADDRESS_REGISTERS_ARB", 0x88B0}, + {"GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB", 0x88B1}, + {"GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB", 0x88B2}, + {"GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB", 0x88B3}, + {"GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB", 0x88B4}, + {"GL_MAX_PROGRAM_ENV_PARAMETERS_ARB", 0x88B5}, + {"GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB", 0x88B6}, + {"GL_TRANSPOSE_CURRENT_MATRIX_ARB", 0x88B7}, + {"GL_READ_ONLY", 0x88B8}, + {"GL_READ_ONLY_ARB", 0x88B8}, + {"GL_WRITE_ONLY", 0x88B9}, + {"GL_WRITE_ONLY_ARB", 0x88B9}, + {"GL_WRITE_ONLY_OES", 0x88B9}, + {"GL_READ_WRITE", 0x88BA}, + {"GL_READ_WRITE_ARB", 0x88BA}, + {"GL_BUFFER_ACCESS", 0x88BB}, + {"GL_BUFFER_ACCESS_ARB", 0x88BB}, + {"GL_BUFFER_ACCESS_OES", 0x88BB}, + {"GL_BUFFER_MAPPED", 0x88BC}, + {"GL_BUFFER_MAPPED_ARB", 0x88BC}, + {"GL_BUFFER_MAPPED_OES", 0x88BC}, + {"GL_BUFFER_MAP_POINTER", 0x88BD}, + {"GL_BUFFER_MAP_POINTER_ARB", 0x88BD}, + {"GL_BUFFER_MAP_POINTER_OES", 0x88BD}, + {"GL_WRITE_DISCARD_NV", 0x88BE}, + {"GL_TIME_ELAPSED", 0x88BF}, + {"GL_TIME_ELAPSED_EXT", 0x88BF}, + {"GL_MATRIX0_ARB", 0x88C0}, + {"GL_MATRIX1_ARB", 0x88C1}, + {"GL_MATRIX2_ARB", 0x88C2}, + {"GL_MATRIX3_ARB", 0x88C3}, + {"GL_MATRIX4_ARB", 0x88C4}, + {"GL_MATRIX5_ARB", 0x88C5}, + {"GL_MATRIX6_ARB", 0x88C6}, + {"GL_MATRIX7_ARB", 0x88C7}, + {"GL_MATRIX8_ARB", 0x88C8}, + {"GL_MATRIX9_ARB", 0x88C9}, + {"GL_MATRIX10_ARB", 0x88CA}, + {"GL_MATRIX11_ARB", 0x88CB}, + {"GL_MATRIX12_ARB", 0x88CC}, + {"GL_MATRIX13_ARB", 0x88CD}, + {"GL_MATRIX14_ARB", 0x88CE}, + {"GL_MATRIX15_ARB", 0x88CF}, + {"GL_MATRIX16_ARB", 0x88D0}, + {"GL_MATRIX17_ARB", 0x88D1}, + {"GL_MATRIX18_ARB", 0x88D2}, + {"GL_MATRIX19_ARB", 0x88D3}, + {"GL_MATRIX20_ARB", 0x88D4}, + {"GL_MATRIX21_ARB", 0x88D5}, + {"GL_MATRIX22_ARB", 0x88D6}, + {"GL_MATRIX23_ARB", 0x88D7}, + {"GL_MATRIX24_ARB", 0x88D8}, + {"GL_MATRIX25_ARB", 0x88D9}, + {"GL_MATRIX26_ARB", 0x88DA}, + {"GL_MATRIX27_ARB", 0x88DB}, + {"GL_MATRIX28_ARB", 0x88DC}, + {"GL_MATRIX29_ARB", 0x88DD}, + {"GL_MATRIX30_ARB", 0x88DE}, + {"GL_MATRIX31_ARB", 0x88DF}, + {"GL_STREAM_DRAW", 0x88E0}, + {"GL_STREAM_DRAW_ARB", 0x88E0}, + {"GL_STREAM_READ", 0x88E1}, + {"GL_STREAM_READ_ARB", 0x88E1}, + {"GL_STREAM_COPY", 0x88E2}, + {"GL_STREAM_COPY_ARB", 0x88E2}, + {"GL_STATIC_DRAW", 0x88E4}, + {"GL_STATIC_DRAW_ARB", 0x88E4}, + {"GL_STATIC_READ", 0x88E5}, + {"GL_STATIC_READ_ARB", 0x88E5}, + {"GL_STATIC_COPY", 0x88E6}, + {"GL_STATIC_COPY_ARB", 0x88E6}, + {"GL_DYNAMIC_DRAW", 0x88E8}, + {"GL_DYNAMIC_DRAW_ARB", 0x88E8}, + {"GL_DYNAMIC_READ", 0x88E9}, + {"GL_DYNAMIC_READ_ARB", 0x88E9}, + {"GL_DYNAMIC_COPY", 0x88EA}, + {"GL_DYNAMIC_COPY_ARB", 0x88EA}, + {"GL_PIXEL_PACK_BUFFER", 0x88EB}, + {"GL_PIXEL_PACK_BUFFER_ARB", 0x88EB}, + {"GL_PIXEL_PACK_BUFFER_EXT", 0x88EB}, + {"GL_PIXEL_UNPACK_BUFFER", 0x88EC}, + {"GL_PIXEL_UNPACK_BUFFER_ARB", 0x88EC}, + {"GL_PIXEL_UNPACK_BUFFER_EXT", 0x88EC}, + {"GL_PIXEL_PACK_BUFFER_BINDING", 0x88ED}, + {"GL_PIXEL_PACK_BUFFER_BINDING_ARB", 0x88ED}, + {"GL_PIXEL_PACK_BUFFER_BINDING_EXT", 0x88ED}, + {"GL_ETC1_SRGB8_NV", 0x88EE}, + {"GL_PIXEL_UNPACK_BUFFER_BINDING", 0x88EF}, + {"GL_PIXEL_UNPACK_BUFFER_BINDING_ARB", 0x88EF}, + {"GL_PIXEL_UNPACK_BUFFER_BINDING_EXT", 0x88EF}, + {"GL_DEPTH24_STENCIL8", 0x88F0}, + {"GL_DEPTH24_STENCIL8_EXT", 0x88F0}, + {"GL_DEPTH24_STENCIL8_OES", 0x88F0}, + {"GL_TEXTURE_STENCIL_SIZE", 0x88F1}, + {"GL_TEXTURE_STENCIL_SIZE_EXT", 0x88F1}, + {"GL_STENCIL_TAG_BITS_EXT", 0x88F2}, + {"GL_STENCIL_CLEAR_TAG_VALUE_EXT", 0x88F3}, + {"GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV", 0x88F4}, + {"GL_MAX_PROGRAM_CALL_DEPTH_NV", 0x88F5}, + {"GL_MAX_PROGRAM_IF_DEPTH_NV", 0x88F6}, + {"GL_MAX_PROGRAM_LOOP_DEPTH_NV", 0x88F7}, + {"GL_MAX_PROGRAM_LOOP_COUNT_NV", 0x88F8}, + {"GL_SRC1_COLOR", 0x88F9}, + {"GL_ONE_MINUS_SRC1_COLOR", 0x88FA}, + {"GL_ONE_MINUS_SRC1_ALPHA", 0x88FB}, + {"GL_MAX_DUAL_SOURCE_DRAW_BUFFERS", 0x88FC}, + {"GL_VERTEX_ATTRIB_ARRAY_INTEGER", 0x88FD}, + {"GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT", 0x88FD}, + {"GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV", 0x88FD}, + {"GL_VERTEX_ATTRIB_ARRAY_DIVISOR", 0x88FE}, + {"GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE", 0x88FE}, + {"GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB", 0x88FE}, + {"GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV", 0x88FE}, + {"GL_MAX_ARRAY_TEXTURE_LAYERS", 0x88FF}, + {"GL_MAX_ARRAY_TEXTURE_LAYERS_EXT", 0x88FF}, + {"GL_MIN_PROGRAM_TEXEL_OFFSET", 0x8904}, + {"GL_MIN_PROGRAM_TEXEL_OFFSET_EXT", 0x8904}, + {"GL_MIN_PROGRAM_TEXEL_OFFSET_NV", 0x8904}, + {"GL_MAX_PROGRAM_TEXEL_OFFSET", 0x8905}, + {"GL_MAX_PROGRAM_TEXEL_OFFSET_EXT", 0x8905}, + {"GL_MAX_PROGRAM_TEXEL_OFFSET_NV", 0x8905}, + {"GL_PROGRAM_ATTRIB_COMPONENTS_NV", 0x8906}, + {"GL_PROGRAM_RESULT_COMPONENTS_NV", 0x8907}, + {"GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV", 0x8908}, + {"GL_MAX_PROGRAM_RESULT_COMPONENTS_NV", 0x8909}, + {"GL_STENCIL_TEST_TWO_SIDE_EXT", 0x8910}, + {"GL_ACTIVE_STENCIL_FACE_EXT", 0x8911}, + {"GL_MIRROR_CLAMP_TO_BORDER_EXT", 0x8912}, + {"GL_SAMPLES_PASSED", 0x8914}, + {"GL_SAMPLES_PASSED_ARB", 0x8914}, + {"GL_GEOMETRY_VERTICES_OUT", 0x8916}, + {"GL_GEOMETRY_INPUT_TYPE", 0x8917}, + {"GL_GEOMETRY_OUTPUT_TYPE", 0x8918}, + {"GL_SAMPLER_BINDING", 0x8919}, + {"GL_CLAMP_VERTEX_COLOR", 0x891A}, + {"GL_CLAMP_VERTEX_COLOR_ARB", 0x891A}, + {"GL_CLAMP_FRAGMENT_COLOR", 0x891B}, + {"GL_CLAMP_FRAGMENT_COLOR_ARB", 0x891B}, + {"GL_CLAMP_READ_COLOR", 0x891C}, + {"GL_CLAMP_READ_COLOR_ARB", 0x891C}, + {"GL_FIXED_ONLY", 0x891D}, + {"GL_FIXED_ONLY_ARB", 0x891D}, + {"GL_TESS_CONTROL_PROGRAM_NV", 0x891E}, + {"GL_TESS_EVALUATION_PROGRAM_NV", 0x891F}, + {"GL_FRAGMENT_SHADER_ATI", 0x8920}, + {"GL_REG_0_ATI", 0x8921}, + {"GL_REG_1_ATI", 0x8922}, + {"GL_REG_2_ATI", 0x8923}, + {"GL_REG_3_ATI", 0x8924}, + {"GL_REG_4_ATI", 0x8925}, + {"GL_REG_5_ATI", 0x8926}, + {"GL_REG_6_ATI", 0x8927}, + {"GL_REG_7_ATI", 0x8928}, + {"GL_REG_8_ATI", 0x8929}, + {"GL_REG_9_ATI", 0x892A}, + {"GL_REG_10_ATI", 0x892B}, + {"GL_REG_11_ATI", 0x892C}, + {"GL_REG_12_ATI", 0x892D}, + {"GL_REG_13_ATI", 0x892E}, + {"GL_REG_14_ATI", 0x892F}, + {"GL_REG_15_ATI", 0x8930}, + {"GL_REG_16_ATI", 0x8931}, + {"GL_REG_17_ATI", 0x8932}, + {"GL_REG_18_ATI", 0x8933}, + {"GL_REG_19_ATI", 0x8934}, + {"GL_REG_20_ATI", 0x8935}, + {"GL_REG_21_ATI", 0x8936}, + {"GL_REG_22_ATI", 0x8937}, + {"GL_REG_23_ATI", 0x8938}, + {"GL_REG_24_ATI", 0x8939}, + {"GL_REG_25_ATI", 0x893A}, + {"GL_REG_26_ATI", 0x893B}, + {"GL_REG_27_ATI", 0x893C}, + {"GL_REG_28_ATI", 0x893D}, + {"GL_REG_29_ATI", 0x893E}, + {"GL_REG_30_ATI", 0x893F}, + {"GL_REG_31_ATI", 0x8940}, + {"GL_CON_0_ATI", 0x8941}, + {"GL_CON_1_ATI", 0x8942}, + {"GL_CON_2_ATI", 0x8943}, + {"GL_CON_3_ATI", 0x8944}, + {"GL_CON_4_ATI", 0x8945}, + {"GL_CON_5_ATI", 0x8946}, + {"GL_CON_6_ATI", 0x8947}, + {"GL_CON_7_ATI", 0x8948}, + {"GL_CON_8_ATI", 0x8949}, + {"GL_CON_9_ATI", 0x894A}, + {"GL_CON_10_ATI", 0x894B}, + {"GL_CON_11_ATI", 0x894C}, + {"GL_CON_12_ATI", 0x894D}, + {"GL_CON_13_ATI", 0x894E}, + {"GL_CON_14_ATI", 0x894F}, + {"GL_CON_15_ATI", 0x8950}, + {"GL_CON_16_ATI", 0x8951}, + {"GL_CON_17_ATI", 0x8952}, + {"GL_CON_18_ATI", 0x8953}, + {"GL_CON_19_ATI", 0x8954}, + {"GL_CON_20_ATI", 0x8955}, + {"GL_CON_21_ATI", 0x8956}, + {"GL_CON_22_ATI", 0x8957}, + {"GL_CON_23_ATI", 0x8958}, + {"GL_CON_24_ATI", 0x8959}, + {"GL_CON_25_ATI", 0x895A}, + {"GL_CON_26_ATI", 0x895B}, + {"GL_CON_27_ATI", 0x895C}, + {"GL_CON_28_ATI", 0x895D}, + {"GL_CON_29_ATI", 0x895E}, + {"GL_CON_30_ATI", 0x895F}, + {"GL_CON_31_ATI", 0x8960}, + {"GL_MOV_ATI", 0x8961}, + {"GL_ADD_ATI", 0x8963}, + {"GL_MUL_ATI", 0x8964}, + {"GL_SUB_ATI", 0x8965}, + {"GL_DOT3_ATI", 0x8966}, + {"GL_DOT4_ATI", 0x8967}, + {"GL_MAD_ATI", 0x8968}, + {"GL_LERP_ATI", 0x8969}, + {"GL_CND_ATI", 0x896A}, + {"GL_CND0_ATI", 0x896B}, + {"GL_DOT2_ADD_ATI", 0x896C}, + {"GL_SECONDARY_INTERPOLATOR_ATI", 0x896D}, + {"GL_NUM_FRAGMENT_REGISTERS_ATI", 0x896E}, + {"GL_NUM_FRAGMENT_CONSTANTS_ATI", 0x896F}, + {"GL_NUM_PASSES_ATI", 0x8970}, + {"GL_NUM_INSTRUCTIONS_PER_PASS_ATI", 0x8971}, + {"GL_NUM_INSTRUCTIONS_TOTAL_ATI", 0x8972}, + {"GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", 0x8973}, + {"GL_NUM_LOOPBACK_COMPONENTS_ATI", 0x8974}, + {"GL_COLOR_ALPHA_PAIRING_ATI", 0x8975}, + {"GL_SWIZZLE_STR_ATI", 0x8976}, + {"GL_SWIZZLE_STQ_ATI", 0x8977}, + {"GL_SWIZZLE_STR_DR_ATI", 0x8978}, + {"GL_SWIZZLE_STQ_DQ_ATI", 0x8979}, + {"GL_SWIZZLE_STRQ_ATI", 0x897A}, + {"GL_SWIZZLE_STRQ_DQ_ATI", 0x897B}, + {"GL_INTERLACE_OML", 0x8980}, + {"GL_INTERLACE_READ_OML", 0x8981}, + {"GL_FORMAT_SUBSAMPLE_24_24_OML", 0x8982}, + {"GL_FORMAT_SUBSAMPLE_244_244_OML", 0x8983}, + {"GL_PACK_RESAMPLE_OML", 0x8984}, + {"GL_UNPACK_RESAMPLE_OML", 0x8985}, + {"GL_RESAMPLE_REPLICATE_OML", 0x8986}, + {"GL_RESAMPLE_ZERO_FILL_OML", 0x8987}, + {"GL_RESAMPLE_AVERAGE_OML", 0x8988}, + {"GL_RESAMPLE_DECIMATE_OML", 0x8989}, + {"GL_POINT_SIZE_ARRAY_TYPE_OES", 0x898A}, + {"GL_POINT_SIZE_ARRAY_STRIDE_OES", 0x898B}, + {"GL_POINT_SIZE_ARRAY_POINTER_OES", 0x898C}, + {"GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES", 0x898D}, + {"GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES", 0x898E}, + {"GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES", 0x898F}, + {"GL_VERTEX_ATTRIB_MAP1_APPLE", 0x8A00}, + {"GL_VERTEX_ATTRIB_MAP2_APPLE", 0x8A01}, + {"GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE", 0x8A02}, + {"GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE", 0x8A03}, + {"GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE", 0x8A04}, + {"GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE", 0x8A05}, + {"GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE", 0x8A06}, + {"GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE", 0x8A07}, + {"GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE", 0x8A08}, + {"GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE", 0x8A09}, + {"GL_DRAW_PIXELS_APPLE", 0x8A0A}, + {"GL_FENCE_APPLE", 0x8A0B}, + {"GL_ELEMENT_ARRAY_APPLE", 0x8A0C}, + {"GL_ELEMENT_ARRAY_TYPE_APPLE", 0x8A0D}, + {"GL_ELEMENT_ARRAY_POINTER_APPLE", 0x8A0E}, + {"GL_COLOR_FLOAT_APPLE", 0x8A0F}, + {"GL_UNIFORM_BUFFER", 0x8A11}, + {"GL_BUFFER_SERIALIZED_MODIFY_APPLE", 0x8A12}, + {"GL_BUFFER_FLUSHING_UNMAP_APPLE", 0x8A13}, + {"GL_AUX_DEPTH_STENCIL_APPLE", 0x8A14}, + {"GL_PACK_ROW_BYTES_APPLE", 0x8A15}, + {"GL_UNPACK_ROW_BYTES_APPLE", 0x8A16}, + {"GL_RELEASED_APPLE", 0x8A19}, + {"GL_VOLATILE_APPLE", 0x8A1A}, + {"GL_RETAINED_APPLE", 0x8A1B}, + {"GL_UNDEFINED_APPLE", 0x8A1C}, + {"GL_PURGEABLE_APPLE", 0x8A1D}, + {"GL_RGB_422_APPLE", 0x8A1F}, + {"GL_UNIFORM_BUFFER_BINDING", 0x8A28}, + {"GL_UNIFORM_BUFFER_START", 0x8A29}, + {"GL_UNIFORM_BUFFER_SIZE", 0x8A2A}, + {"GL_MAX_VERTEX_UNIFORM_BLOCKS", 0x8A2B}, + {"GL_MAX_GEOMETRY_UNIFORM_BLOCKS", 0x8A2C}, + {"GL_MAX_FRAGMENT_UNIFORM_BLOCKS", 0x8A2D}, + {"GL_MAX_COMBINED_UNIFORM_BLOCKS", 0x8A2E}, + {"GL_MAX_UNIFORM_BUFFER_BINDINGS", 0x8A2F}, + {"GL_MAX_UNIFORM_BLOCK_SIZE", 0x8A30}, + {"GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", 0x8A31}, + {"GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS", 0x8A32}, + {"GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", 0x8A33}, + {"GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT", 0x8A34}, + {"GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH", 0x8A35}, + {"GL_ACTIVE_UNIFORM_BLOCKS", 0x8A36}, + {"GL_UNIFORM_TYPE", 0x8A37}, + {"GL_UNIFORM_SIZE", 0x8A38}, + {"GL_UNIFORM_NAME_LENGTH", 0x8A39}, + {"GL_UNIFORM_BLOCK_INDEX", 0x8A3A}, + {"GL_UNIFORM_OFFSET", 0x8A3B}, + {"GL_UNIFORM_ARRAY_STRIDE", 0x8A3C}, + {"GL_UNIFORM_MATRIX_STRIDE", 0x8A3D}, + {"GL_UNIFORM_IS_ROW_MAJOR", 0x8A3E}, + {"GL_UNIFORM_BLOCK_BINDING", 0x8A3F}, + {"GL_UNIFORM_BLOCK_DATA_SIZE", 0x8A40}, + {"GL_UNIFORM_BLOCK_NAME_LENGTH", 0x8A41}, + {"GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS", 0x8A42}, + {"GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES", 0x8A43}, + {"GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER", 0x8A44}, + {"GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER", 0x8A45}, + {"GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER", 0x8A46}, + {"GL_TEXTURE_SRGB_DECODE_EXT", 0x8A48}, + {"GL_DECODE_EXT", 0x8A49}, + {"GL_SKIP_DECODE_EXT", 0x8A4A}, + {"GL_PROGRAM_PIPELINE_OBJECT_EXT", 0x8A4F}, + {"GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT", 0x8A52}, + {"GL_SYNC_OBJECT_APPLE", 0x8A53}, + {"GL_FRAGMENT_SHADER", 0x8B30}, + {"GL_FRAGMENT_SHADER_ARB", 0x8B30}, + {"GL_VERTEX_SHADER", 0x8B31}, + {"GL_VERTEX_SHADER_ARB", 0x8B31}, + {"GL_PROGRAM_OBJECT_ARB", 0x8B40}, + {"GL_PROGRAM_OBJECT_EXT", 0x8B40}, + {"GL_SHADER_OBJECT_ARB", 0x8B48}, + {"GL_SHADER_OBJECT_EXT", 0x8B48}, + {"GL_MAX_FRAGMENT_UNIFORM_COMPONENTS", 0x8B49}, + {"GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", 0x8B49}, + {"GL_MAX_VERTEX_UNIFORM_COMPONENTS", 0x8B4A}, + {"GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", 0x8B4A}, + {"GL_MAX_VARYING_FLOATS", 0x8B4B}, + {"GL_MAX_VARYING_COMPONENTS", 0x8B4B}, + {"GL_MAX_VARYING_COMPONENTS_EXT", 0x8B4B}, + {"GL_MAX_VARYING_FLOATS_ARB", 0x8B4B}, + {"GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS", 0x8B4C}, + {"GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", 0x8B4C}, + {"GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS", 0x8B4D}, + {"GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", 0x8B4D}, + {"GL_OBJECT_TYPE_ARB", 0x8B4E}, + {"GL_SHADER_TYPE", 0x8B4F}, + {"GL_OBJECT_SUBTYPE_ARB", 0x8B4F}, + {"GL_FLOAT_VEC2", 0x8B50}, + {"GL_FLOAT_VEC2_ARB", 0x8B50}, + {"GL_FLOAT_VEC3", 0x8B51}, + {"GL_FLOAT_VEC3_ARB", 0x8B51}, + {"GL_FLOAT_VEC4", 0x8B52}, + {"GL_FLOAT_VEC4_ARB", 0x8B52}, + {"GL_INT_VEC2", 0x8B53}, + {"GL_INT_VEC2_ARB", 0x8B53}, + {"GL_INT_VEC3", 0x8B54}, + {"GL_INT_VEC3_ARB", 0x8B54}, + {"GL_INT_VEC4", 0x8B55}, + {"GL_INT_VEC4_ARB", 0x8B55}, + {"GL_BOOL", 0x8B56}, + {"GL_BOOL_ARB", 0x8B56}, + {"GL_BOOL_VEC2", 0x8B57}, + {"GL_BOOL_VEC2_ARB", 0x8B57}, + {"GL_BOOL_VEC3", 0x8B58}, + {"GL_BOOL_VEC3_ARB", 0x8B58}, + {"GL_BOOL_VEC4", 0x8B59}, + {"GL_BOOL_VEC4_ARB", 0x8B59}, + {"GL_FLOAT_MAT2", 0x8B5A}, + {"GL_FLOAT_MAT2_ARB", 0x8B5A}, + {"GL_FLOAT_MAT3", 0x8B5B}, + {"GL_FLOAT_MAT3_ARB", 0x8B5B}, + {"GL_FLOAT_MAT4", 0x8B5C}, + {"GL_FLOAT_MAT4_ARB", 0x8B5C}, + {"GL_SAMPLER_1D", 0x8B5D}, + {"GL_SAMPLER_1D_ARB", 0x8B5D}, + {"GL_SAMPLER_2D", 0x8B5E}, + {"GL_SAMPLER_2D_ARB", 0x8B5E}, + {"GL_SAMPLER_3D", 0x8B5F}, + {"GL_SAMPLER_3D_ARB", 0x8B5F}, + {"GL_SAMPLER_3D_OES", 0x8B5F}, + {"GL_SAMPLER_CUBE", 0x8B60}, + {"GL_SAMPLER_CUBE_ARB", 0x8B60}, + {"GL_SAMPLER_1D_SHADOW", 0x8B61}, + {"GL_SAMPLER_1D_SHADOW_ARB", 0x8B61}, + {"GL_SAMPLER_2D_SHADOW", 0x8B62}, + {"GL_SAMPLER_2D_SHADOW_ARB", 0x8B62}, + {"GL_SAMPLER_2D_SHADOW_EXT", 0x8B62}, + {"GL_SAMPLER_2D_RECT", 0x8B63}, + {"GL_SAMPLER_2D_RECT_ARB", 0x8B63}, + {"GL_SAMPLER_2D_RECT_SHADOW", 0x8B64}, + {"GL_SAMPLER_2D_RECT_SHADOW_ARB", 0x8B64}, + {"GL_FLOAT_MAT2x3", 0x8B65}, + {"GL_FLOAT_MAT2x4", 0x8B66}, + {"GL_FLOAT_MAT3x2", 0x8B67}, + {"GL_FLOAT_MAT3x4", 0x8B68}, + {"GL_FLOAT_MAT4x2", 0x8B69}, + {"GL_FLOAT_MAT4x3", 0x8B6A}, + {"GL_DELETE_STATUS", 0x8B80}, + {"GL_OBJECT_DELETE_STATUS_ARB", 0x8B80}, + {"GL_COMPILE_STATUS", 0x8B81}, + {"GL_OBJECT_COMPILE_STATUS_ARB", 0x8B81}, + {"GL_LINK_STATUS", 0x8B82}, + {"GL_OBJECT_LINK_STATUS_ARB", 0x8B82}, + {"GL_VALIDATE_STATUS", 0x8B83}, + {"GL_OBJECT_VALIDATE_STATUS_ARB", 0x8B83}, + {"GL_INFO_LOG_LENGTH", 0x8B84}, + {"GL_OBJECT_INFO_LOG_LENGTH_ARB", 0x8B84}, + {"GL_ATTACHED_SHADERS", 0x8B85}, + {"GL_OBJECT_ATTACHED_OBJECTS_ARB", 0x8B85}, + {"GL_ACTIVE_UNIFORMS", 0x8B86}, + {"GL_OBJECT_ACTIVE_UNIFORMS_ARB", 0x8B86}, + {"GL_ACTIVE_UNIFORM_MAX_LENGTH", 0x8B87}, + {"GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB", 0x8B87}, + {"GL_SHADER_SOURCE_LENGTH", 0x8B88}, + {"GL_OBJECT_SHADER_SOURCE_LENGTH_ARB", 0x8B88}, + {"GL_ACTIVE_ATTRIBUTES", 0x8B89}, + {"GL_OBJECT_ACTIVE_ATTRIBUTES_ARB", 0x8B89}, + {"GL_ACTIVE_ATTRIBUTE_MAX_LENGTH", 0x8B8A}, + {"GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB", 0x8B8A}, + {"GL_FRAGMENT_SHADER_DERIVATIVE_HINT", 0x8B8B}, + {"GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", 0x8B8B}, + {"GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES", 0x8B8B}, + {"GL_SHADING_LANGUAGE_VERSION", 0x8B8C}, + {"GL_SHADING_LANGUAGE_VERSION_ARB", 0x8B8C}, + {"GL_CURRENT_PROGRAM", 0x8B8D}, + {"GL_ACTIVE_PROGRAM_EXT", 0x8B8D}, + {"GL_PALETTE4_RGB8_OES", 0x8B90}, + {"GL_PALETTE4_RGBA8_OES", 0x8B91}, + {"GL_PALETTE4_R5_G6_B5_OES", 0x8B92}, + {"GL_PALETTE4_RGBA4_OES", 0x8B93}, + {"GL_PALETTE4_RGB5_A1_OES", 0x8B94}, + {"GL_PALETTE8_RGB8_OES", 0x8B95}, + {"GL_PALETTE8_RGBA8_OES", 0x8B96}, + {"GL_PALETTE8_R5_G6_B5_OES", 0x8B97}, + {"GL_PALETTE8_RGBA4_OES", 0x8B98}, + {"GL_PALETTE8_RGB5_A1_OES", 0x8B99}, + {"GL_IMPLEMENTATION_COLOR_READ_TYPE", 0x8B9A}, + {"GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", 0x8B9A}, + {"GL_IMPLEMENTATION_COLOR_READ_FORMAT", 0x8B9B}, + {"GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", 0x8B9B}, + {"GL_POINT_SIZE_ARRAY_OES", 0x8B9C}, + {"GL_TEXTURE_CROP_RECT_OES", 0x8B9D}, + {"GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES", 0x8B9E}, + {"GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES", 0x8B9F}, + {"GL_FRAGMENT_PROGRAM_POSITION_MESA", 0x8BB0}, + {"GL_FRAGMENT_PROGRAM_CALLBACK_MESA", 0x8BB1}, + {"GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA", 0x8BB2}, + {"GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA", 0x8BB3}, + {"GL_VERTEX_PROGRAM_CALLBACK_MESA", 0x8BB4}, + {"GL_VERTEX_PROGRAM_POSITION_MESA", 0x8BB4}, + {"GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA", 0x8BB6}, + {"GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA", 0x8BB7}, + {"GL_COUNTER_TYPE_AMD", 0x8BC0}, + {"GL_COUNTER_RANGE_AMD", 0x8BC1}, + {"GL_UNSIGNED_INT64_AMD", 0x8BC2}, + {"GL_PERCENTAGE_AMD", 0x8BC3}, + {"GL_PERFMON_RESULT_AVAILABLE_AMD", 0x8BC4}, + {"GL_PERFMON_RESULT_SIZE_AMD", 0x8BC5}, + {"GL_PERFMON_RESULT_AMD", 0x8BC6}, + {"GL_TEXTURE_WIDTH_QCOM", 0x8BD2}, + {"GL_TEXTURE_HEIGHT_QCOM", 0x8BD3}, + {"GL_TEXTURE_DEPTH_QCOM", 0x8BD4}, + {"GL_TEXTURE_INTERNAL_FORMAT_QCOM", 0x8BD5}, + {"GL_TEXTURE_FORMAT_QCOM", 0x8BD6}, + {"GL_TEXTURE_TYPE_QCOM", 0x8BD7}, + {"GL_TEXTURE_IMAGE_VALID_QCOM", 0x8BD8}, + {"GL_TEXTURE_NUM_LEVELS_QCOM", 0x8BD9}, + {"GL_TEXTURE_TARGET_QCOM", 0x8BDA}, + {"GL_TEXTURE_OBJECT_VALID_QCOM", 0x8BDB}, + {"GL_STATE_RESTORE", 0x8BDC}, + {"GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG", 0x8C00}, + {"GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG", 0x8C01}, + {"GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", 0x8C02}, + {"GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", 0x8C03}, + {"GL_MODULATE_COLOR_IMG", 0x8C04}, + {"GL_RECIP_ADD_SIGNED_ALPHA_IMG", 0x8C05}, + {"GL_TEXTURE_ALPHA_MODULATE_IMG", 0x8C06}, + {"GL_FACTOR_ALPHA_MODULATE_IMG", 0x8C07}, + {"GL_FRAGMENT_ALPHA_MODULATE_IMG", 0x8C08}, + {"GL_ADD_BLEND_IMG", 0x8C09}, + {"GL_SGX_BINARY_IMG", 0x8C0A}, + {"GL_TEXTURE_RED_TYPE", 0x8C10}, + {"GL_TEXTURE_RED_TYPE_ARB", 0x8C10}, + {"GL_TEXTURE_GREEN_TYPE", 0x8C11}, + {"GL_TEXTURE_GREEN_TYPE_ARB", 0x8C11}, + {"GL_TEXTURE_BLUE_TYPE", 0x8C12}, + {"GL_TEXTURE_BLUE_TYPE_ARB", 0x8C12}, + {"GL_TEXTURE_ALPHA_TYPE", 0x8C13}, + {"GL_TEXTURE_ALPHA_TYPE_ARB", 0x8C13}, + {"GL_TEXTURE_LUMINANCE_TYPE", 0x8C14}, + {"GL_TEXTURE_LUMINANCE_TYPE_ARB", 0x8C14}, + {"GL_TEXTURE_INTENSITY_TYPE", 0x8C15}, + {"GL_TEXTURE_INTENSITY_TYPE_ARB", 0x8C15}, + {"GL_TEXTURE_DEPTH_TYPE", 0x8C16}, + {"GL_TEXTURE_DEPTH_TYPE_ARB", 0x8C16}, + {"GL_UNSIGNED_NORMALIZED", 0x8C17}, + {"GL_UNSIGNED_NORMALIZED_ARB", 0x8C17}, + {"GL_UNSIGNED_NORMALIZED_EXT", 0x8C17}, + {"GL_TEXTURE_1D_ARRAY", 0x8C18}, + {"GL_TEXTURE_1D_ARRAY_EXT", 0x8C18}, + {"GL_PROXY_TEXTURE_1D_ARRAY", 0x8C19}, + {"GL_PROXY_TEXTURE_1D_ARRAY_EXT", 0x8C19}, + {"GL_TEXTURE_2D_ARRAY", 0x8C1A}, + {"GL_TEXTURE_2D_ARRAY_EXT", 0x8C1A}, + {"GL_PROXY_TEXTURE_2D_ARRAY", 0x8C1B}, + {"GL_PROXY_TEXTURE_2D_ARRAY_EXT", 0x8C1B}, + {"GL_TEXTURE_BINDING_1D_ARRAY", 0x8C1C}, + {"GL_TEXTURE_BINDING_1D_ARRAY_EXT", 0x8C1C}, + {"GL_TEXTURE_BINDING_2D_ARRAY", 0x8C1D}, + {"GL_TEXTURE_BINDING_2D_ARRAY_EXT", 0x8C1D}, + {"GL_GEOMETRY_PROGRAM_NV", 0x8C26}, + {"GL_MAX_PROGRAM_OUTPUT_VERTICES_NV", 0x8C27}, + {"GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV", 0x8C28}, + {"GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS", 0x8C29}, + {"GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", 0x8C29}, + {"GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT", 0x8C29}, + {"GL_TEXTURE_BUFFER", 0x8C2A}, + {"GL_TEXTURE_BUFFER_ARB", 0x8C2A}, + {"GL_TEXTURE_BUFFER_EXT", 0x8C2A}, + {"GL_MAX_TEXTURE_BUFFER_SIZE", 0x8C2B}, + {"GL_MAX_TEXTURE_BUFFER_SIZE_ARB", 0x8C2B}, + {"GL_MAX_TEXTURE_BUFFER_SIZE_EXT", 0x8C2B}, + {"GL_TEXTURE_BINDING_BUFFER", 0x8C2C}, + {"GL_TEXTURE_BINDING_BUFFER_ARB", 0x8C2C}, + {"GL_TEXTURE_BINDING_BUFFER_EXT", 0x8C2C}, + {"GL_TEXTURE_BUFFER_DATA_STORE_BINDING", 0x8C2D}, + {"GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB", 0x8C2D}, + {"GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT", 0x8C2D}, + {"GL_TEXTURE_BUFFER_FORMAT_ARB", 0x8C2E}, + {"GL_TEXTURE_BUFFER_FORMAT_EXT", 0x8C2E}, + {"GL_ANY_SAMPLES_PASSED", 0x8C2F}, + {"GL_ANY_SAMPLES_PASSED_EXT", 0x8C2F}, + {"GL_SAMPLE_SHADING", 0x8C36}, + {"GL_SAMPLE_SHADING_ARB", 0x8C36}, + {"GL_MIN_SAMPLE_SHADING_VALUE", 0x8C37}, + {"GL_MIN_SAMPLE_SHADING_VALUE_ARB", 0x8C37}, + {"GL_R11F_G11F_B10F", 0x8C3A}, + {"GL_R11F_G11F_B10F_EXT", 0x8C3A}, + {"GL_UNSIGNED_INT_10F_11F_11F_REV", 0x8C3B}, + {"GL_UNSIGNED_INT_10F_11F_11F_REV_EXT", 0x8C3B}, + {"GL_RGBA_SIGNED_COMPONENTS_EXT", 0x8C3C}, + {"GL_RGB9_E5", 0x8C3D}, + {"GL_RGB9_E5_EXT", 0x8C3D}, + {"GL_UNSIGNED_INT_5_9_9_9_REV", 0x8C3E}, + {"GL_UNSIGNED_INT_5_9_9_9_REV_EXT", 0x8C3E}, + {"GL_TEXTURE_SHARED_SIZE", 0x8C3F}, + {"GL_TEXTURE_SHARED_SIZE_EXT", 0x8C3F}, + {"GL_SRGB", 0x8C40}, + {"GL_SRGB_EXT", 0x8C40}, + {"GL_SRGB8", 0x8C41}, + {"GL_SRGB8_EXT", 0x8C41}, + {"GL_SRGB8_NV", 0x8C41}, + {"GL_SRGB_ALPHA", 0x8C42}, + {"GL_SRGB_ALPHA_EXT", 0x8C42}, + {"GL_SRGB8_ALPHA8", 0x8C43}, + {"GL_SRGB8_ALPHA8_EXT", 0x8C43}, + {"GL_SLUMINANCE_ALPHA", 0x8C44}, + {"GL_SLUMINANCE_ALPHA_EXT", 0x8C44}, + {"GL_SLUMINANCE_ALPHA_NV", 0x8C44}, + {"GL_SLUMINANCE8_ALPHA8", 0x8C45}, + {"GL_SLUMINANCE8_ALPHA8_EXT", 0x8C45}, + {"GL_SLUMINANCE8_ALPHA8_NV", 0x8C45}, + {"GL_SLUMINANCE", 0x8C46}, + {"GL_SLUMINANCE_EXT", 0x8C46}, + {"GL_SLUMINANCE_NV", 0x8C46}, + {"GL_SLUMINANCE8", 0x8C47}, + {"GL_SLUMINANCE8_EXT", 0x8C47}, + {"GL_SLUMINANCE8_NV", 0x8C47}, + {"GL_COMPRESSED_SRGB", 0x8C48}, + {"GL_COMPRESSED_SRGB_EXT", 0x8C48}, + {"GL_COMPRESSED_SRGB_ALPHA", 0x8C49}, + {"GL_COMPRESSED_SRGB_ALPHA_EXT", 0x8C49}, + {"GL_COMPRESSED_SLUMINANCE", 0x8C4A}, + {"GL_COMPRESSED_SLUMINANCE_EXT", 0x8C4A}, + {"GL_COMPRESSED_SLUMINANCE_ALPHA", 0x8C4B}, + {"GL_COMPRESSED_SLUMINANCE_ALPHA_EXT", 0x8C4B}, + {"GL_COMPRESSED_SRGB_S3TC_DXT1_EXT", 0x8C4C}, + {"GL_COMPRESSED_SRGB_S3TC_DXT1_NV", 0x8C4C}, + {"GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", 0x8C4D}, + {"GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV", 0x8C4D}, + {"GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", 0x8C4E}, + {"GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV", 0x8C4E}, + {"GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", 0x8C4F}, + {"GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV", 0x8C4F}, + {"GL_COMPRESSED_LUMINANCE_LATC1_EXT", 0x8C70}, + {"GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT", 0x8C71}, + {"GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT", 0x8C72}, + {"GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT", 0x8C73}, + {"GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV", 0x8C74}, + {"GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV", 0x8C75}, + {"GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH", 0x8C76}, + {"GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT", 0x8C76}, + {"GL_BACK_PRIMARY_COLOR_NV", 0x8C77}, + {"GL_BACK_SECONDARY_COLOR_NV", 0x8C78}, + {"GL_TEXTURE_COORD_NV", 0x8C79}, + {"GL_CLIP_DISTANCE_NV", 0x8C7A}, + {"GL_VERTEX_ID_NV", 0x8C7B}, + {"GL_PRIMITIVE_ID_NV", 0x8C7C}, + {"GL_GENERIC_ATTRIB_NV", 0x8C7D}, + {"GL_TRANSFORM_FEEDBACK_ATTRIBS_NV", 0x8C7E}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_MODE", 0x8C7F}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT", 0x8C7F}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV", 0x8C7F}, + {"GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", 0x8C80}, + {"GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT", 0x8C80}, + {"GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV", 0x8C80}, + {"GL_ACTIVE_VARYINGS_NV", 0x8C81}, + {"GL_ACTIVE_VARYING_MAX_LENGTH_NV", 0x8C82}, + {"GL_TRANSFORM_FEEDBACK_VARYINGS", 0x8C83}, + {"GL_TRANSFORM_FEEDBACK_VARYINGS_EXT", 0x8C83}, + {"GL_TRANSFORM_FEEDBACK_VARYINGS_NV", 0x8C83}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_START", 0x8C84}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT", 0x8C84}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_START_NV", 0x8C84}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_SIZE", 0x8C85}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT", 0x8C85}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV", 0x8C85}, + {"GL_TRANSFORM_FEEDBACK_RECORD_NV", 0x8C86}, + {"GL_PRIMITIVES_GENERATED", 0x8C87}, + {"GL_PRIMITIVES_GENERATED_EXT", 0x8C87}, + {"GL_PRIMITIVES_GENERATED_NV", 0x8C87}, + {"GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN", 0x8C88}, + {"GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT", 0x8C88}, + {"GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV", 0x8C88}, + {"GL_RASTERIZER_DISCARD", 0x8C89}, + {"GL_RASTERIZER_DISCARD_EXT", 0x8C89}, + {"GL_RASTERIZER_DISCARD_NV", 0x8C89}, + {"GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", 0x8C8A}, + {"GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT", 0x8C8A}, + {"GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV", 0x8C8A}, + {"GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", 0x8C8B}, + {"GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT", 0x8C8B}, + {"GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV", 0x8C8B}, + {"GL_INTERLEAVED_ATTRIBS", 0x8C8C}, + {"GL_INTERLEAVED_ATTRIBS_EXT", 0x8C8C}, + {"GL_INTERLEAVED_ATTRIBS_NV", 0x8C8C}, + {"GL_SEPARATE_ATTRIBS", 0x8C8D}, + {"GL_SEPARATE_ATTRIBS_EXT", 0x8C8D}, + {"GL_SEPARATE_ATTRIBS_NV", 0x8C8D}, + {"GL_TRANSFORM_FEEDBACK_BUFFER", 0x8C8E}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_EXT", 0x8C8E}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_NV", 0x8C8E}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_BINDING", 0x8C8F}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT", 0x8C8F}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV", 0x8C8F}, + {"GL_ATC_RGB_AMD", 0x8C92}, + {"GL_ATC_RGBA_EXPLICIT_ALPHA_AMD", 0x8C93}, + {"GL_POINT_SPRITE_COORD_ORIGIN", 0x8CA0}, + {"GL_LOWER_LEFT", 0x8CA1}, + {"GL_UPPER_LEFT", 0x8CA2}, + {"GL_STENCIL_BACK_REF", 0x8CA3}, + {"GL_STENCIL_BACK_VALUE_MASK", 0x8CA4}, + {"GL_STENCIL_BACK_WRITEMASK", 0x8CA5}, + {"GL_DRAW_FRAMEBUFFER_BINDING", 0x8CA6}, + {"GL_DRAW_FRAMEBUFFER_BINDING_EXT", 0x8CA6}, + {"GL_DRAW_FRAMEBUFFER_BINDING_NV", 0x8CA6}, + {"GL_FRAMEBUFFER_BINDING", 0x8CA6}, + {"GL_FRAMEBUFFER_BINDING_ANGLE", 0x8CA6}, + {"GL_FRAMEBUFFER_BINDING_EXT", 0x8CA6}, + {"GL_FRAMEBUFFER_BINDING_OES", 0x8CA6}, + {"GL_RENDERBUFFER_BINDING", 0x8CA7}, + {"GL_RENDERBUFFER_BINDING_ANGLE", 0x8CA7}, + {"GL_RENDERBUFFER_BINDING_EXT", 0x8CA7}, + {"GL_RENDERBUFFER_BINDING_OES", 0x8CA7}, + {"GL_READ_FRAMEBUFFER", 0x8CA8}, + {"GL_READ_FRAMEBUFFER_ANGLE", 0x8CA8}, + {"GL_READ_FRAMEBUFFER_EXT", 0x8CA8}, + {"GL_READ_FRAMEBUFFER_NV", 0x8CA8}, + {"GL_DRAW_FRAMEBUFFER", 0x8CA9}, + {"GL_DRAW_FRAMEBUFFER_ANGLE", 0x8CA9}, + {"GL_DRAW_FRAMEBUFFER_EXT", 0x8CA9}, + {"GL_DRAW_FRAMEBUFFER_NV", 0x8CA9}, + {"GL_READ_FRAMEBUFFER_BINDING", 0x8CAA}, + {"GL_READ_FRAMEBUFFER_BINDING_EXT", 0x8CAA}, + {"GL_READ_FRAMEBUFFER_BINDING_NV", 0x8CAA}, + {"GL_RENDERBUFFER_COVERAGE_SAMPLES_NV", 0x8CAB}, + {"GL_RENDERBUFFER_SAMPLES", 0x8CAB}, + {"GL_RENDERBUFFER_SAMPLES_ANGLE", 0x8CAB}, + {"GL_RENDERBUFFER_SAMPLES_EXT", 0x8CAB}, + {"GL_RENDERBUFFER_SAMPLES_NV", 0x8CAB}, + {"GL_DEPTH_COMPONENT32F", 0x8CAC}, + {"GL_DEPTH32F_STENCIL8", 0x8CAD}, + {"GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", 0x8CD0}, + {"GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT", 0x8CD0}, + {"GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES", 0x8CD0}, + {"GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", 0x8CD1}, + {"GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT", 0x8CD1}, + {"GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES", 0x8CD1}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", 0x8CD2}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT", 0x8CD2}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES", 0x8CD2}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE", 0x8CD3}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT", 0x8CD3}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES", 0x8CD3}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT", 0x8CD4}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES", 0x8CD4}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER", 0x8CD4}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT", 0x8CD4}, + {"GL_FRAMEBUFFER_COMPLETE", 0x8CD5}, + {"GL_FRAMEBUFFER_COMPLETE_EXT", 0x8CD5}, + {"GL_FRAMEBUFFER_COMPLETE_OES", 0x8CD5}, + {"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT", 0x8CD6}, + {"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT", 0x8CD6}, + {"GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES", 0x8CD6}, + {"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT", 0x8CD7}, + {"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT", 0x8CD7}, + {"GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES", 0x8CD7}, + {"GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS", 0x8CD9}, + {"GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT", 0x8CD9}, + {"GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES", 0x8CD9}, + {"GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT", 0x8CDA}, + {"GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES", 0x8CDA}, + {"GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER", 0x8CDB}, + {"GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT", 0x8CDB}, + {"GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES", 0x8CDB}, + {"GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER", 0x8CDC}, + {"GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT", 0x8CDC}, + {"GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES", 0x8CDC}, + {"GL_FRAMEBUFFER_UNSUPPORTED", 0x8CDD}, + {"GL_FRAMEBUFFER_UNSUPPORTED_EXT", 0x8CDD}, + {"GL_FRAMEBUFFER_UNSUPPORTED_OES", 0x8CDD}, + {"GL_MAX_COLOR_ATTACHMENTS", 0x8CDF}, + {"GL_MAX_COLOR_ATTACHMENTS_EXT", 0x8CDF}, + {"GL_MAX_COLOR_ATTACHMENTS_NV", 0x8CDF}, + {"GL_COLOR_ATTACHMENT0", 0x8CE0}, + {"GL_COLOR_ATTACHMENT0_EXT", 0x8CE0}, + {"GL_COLOR_ATTACHMENT0_NV", 0x8CE0}, + {"GL_COLOR_ATTACHMENT0_OES", 0x8CE0}, + {"GL_COLOR_ATTACHMENT1", 0x8CE1}, + {"GL_COLOR_ATTACHMENT1_EXT", 0x8CE1}, + {"GL_COLOR_ATTACHMENT1_NV", 0x8CE1}, + {"GL_COLOR_ATTACHMENT2", 0x8CE2}, + {"GL_COLOR_ATTACHMENT2_EXT", 0x8CE2}, + {"GL_COLOR_ATTACHMENT2_NV", 0x8CE2}, + {"GL_COLOR_ATTACHMENT3", 0x8CE3}, + {"GL_COLOR_ATTACHMENT3_EXT", 0x8CE3}, + {"GL_COLOR_ATTACHMENT3_NV", 0x8CE3}, + {"GL_COLOR_ATTACHMENT4", 0x8CE4}, + {"GL_COLOR_ATTACHMENT4_EXT", 0x8CE4}, + {"GL_COLOR_ATTACHMENT4_NV", 0x8CE4}, + {"GL_COLOR_ATTACHMENT5", 0x8CE5}, + {"GL_COLOR_ATTACHMENT5_EXT", 0x8CE5}, + {"GL_COLOR_ATTACHMENT5_NV", 0x8CE5}, + {"GL_COLOR_ATTACHMENT6", 0x8CE6}, + {"GL_COLOR_ATTACHMENT6_EXT", 0x8CE6}, + {"GL_COLOR_ATTACHMENT6_NV", 0x8CE6}, + {"GL_COLOR_ATTACHMENT7", 0x8CE7}, + {"GL_COLOR_ATTACHMENT7_EXT", 0x8CE7}, + {"GL_COLOR_ATTACHMENT7_NV", 0x8CE7}, + {"GL_COLOR_ATTACHMENT8", 0x8CE8}, + {"GL_COLOR_ATTACHMENT8_EXT", 0x8CE8}, + {"GL_COLOR_ATTACHMENT8_NV", 0x8CE8}, + {"GL_COLOR_ATTACHMENT9", 0x8CE9}, + {"GL_COLOR_ATTACHMENT9_EXT", 0x8CE9}, + {"GL_COLOR_ATTACHMENT9_NV", 0x8CE9}, + {"GL_COLOR_ATTACHMENT10", 0x8CEA}, + {"GL_COLOR_ATTACHMENT10_EXT", 0x8CEA}, + {"GL_COLOR_ATTACHMENT10_NV", 0x8CEA}, + {"GL_COLOR_ATTACHMENT11", 0x8CEB}, + {"GL_COLOR_ATTACHMENT11_EXT", 0x8CEB}, + {"GL_COLOR_ATTACHMENT11_NV", 0x8CEB}, + {"GL_COLOR_ATTACHMENT12", 0x8CEC}, + {"GL_COLOR_ATTACHMENT12_EXT", 0x8CEC}, + {"GL_COLOR_ATTACHMENT12_NV", 0x8CEC}, + {"GL_COLOR_ATTACHMENT13", 0x8CED}, + {"GL_COLOR_ATTACHMENT13_EXT", 0x8CED}, + {"GL_COLOR_ATTACHMENT13_NV", 0x8CED}, + {"GL_COLOR_ATTACHMENT14", 0x8CEE}, + {"GL_COLOR_ATTACHMENT14_EXT", 0x8CEE}, + {"GL_COLOR_ATTACHMENT14_NV", 0x8CEE}, + {"GL_COLOR_ATTACHMENT15", 0x8CEF}, + {"GL_COLOR_ATTACHMENT15_EXT", 0x8CEF}, + {"GL_COLOR_ATTACHMENT15_NV", 0x8CEF}, + {"GL_DEPTH_ATTACHMENT", 0x8D00}, + {"GL_DEPTH_ATTACHMENT_EXT", 0x8D00}, + {"GL_DEPTH_ATTACHMENT_OES", 0x8D00}, + {"GL_STENCIL_ATTACHMENT", 0x8D20}, + {"GL_STENCIL_ATTACHMENT_EXT", 0x8D20}, + {"GL_STENCIL_ATTACHMENT_OES", 0x8D20}, + {"GL_FRAMEBUFFER", 0x8D40}, + {"GL_FRAMEBUFFER_EXT", 0x8D40}, + {"GL_FRAMEBUFFER_OES", 0x8D40}, + {"GL_RENDERBUFFER", 0x8D41}, + {"GL_RENDERBUFFER_EXT", 0x8D41}, + {"GL_RENDERBUFFER_OES", 0x8D41}, + {"GL_RENDERBUFFER_WIDTH", 0x8D42}, + {"GL_RENDERBUFFER_WIDTH_EXT", 0x8D42}, + {"GL_RENDERBUFFER_WIDTH_OES", 0x8D42}, + {"GL_RENDERBUFFER_HEIGHT", 0x8D43}, + {"GL_RENDERBUFFER_HEIGHT_EXT", 0x8D43}, + {"GL_RENDERBUFFER_HEIGHT_OES", 0x8D43}, + {"GL_RENDERBUFFER_INTERNAL_FORMAT", 0x8D44}, + {"GL_RENDERBUFFER_INTERNAL_FORMAT_EXT", 0x8D44}, + {"GL_RENDERBUFFER_INTERNAL_FORMAT_OES", 0x8D44}, + {"GL_STENCIL_INDEX1", 0x8D46}, + {"GL_STENCIL_INDEX1_EXT", 0x8D46}, + {"GL_STENCIL_INDEX1_OES", 0x8D46}, + {"GL_STENCIL_INDEX4", 0x8D47}, + {"GL_STENCIL_INDEX4_EXT", 0x8D47}, + {"GL_STENCIL_INDEX4_OES", 0x8D47}, + {"GL_STENCIL_INDEX8", 0x8D48}, + {"GL_STENCIL_INDEX8_EXT", 0x8D48}, + {"GL_STENCIL_INDEX8_OES", 0x8D48}, + {"GL_STENCIL_INDEX16", 0x8D49}, + {"GL_STENCIL_INDEX16_EXT", 0x8D49}, + {"GL_RENDERBUFFER_RED_SIZE", 0x8D50}, + {"GL_RENDERBUFFER_RED_SIZE_EXT", 0x8D50}, + {"GL_RENDERBUFFER_RED_SIZE_OES", 0x8D50}, + {"GL_RENDERBUFFER_GREEN_SIZE", 0x8D51}, + {"GL_RENDERBUFFER_GREEN_SIZE_EXT", 0x8D51}, + {"GL_RENDERBUFFER_GREEN_SIZE_OES", 0x8D51}, + {"GL_RENDERBUFFER_BLUE_SIZE", 0x8D52}, + {"GL_RENDERBUFFER_BLUE_SIZE_EXT", 0x8D52}, + {"GL_RENDERBUFFER_BLUE_SIZE_OES", 0x8D52}, + {"GL_RENDERBUFFER_ALPHA_SIZE", 0x8D53}, + {"GL_RENDERBUFFER_ALPHA_SIZE_EXT", 0x8D53}, + {"GL_RENDERBUFFER_ALPHA_SIZE_OES", 0x8D53}, + {"GL_RENDERBUFFER_DEPTH_SIZE", 0x8D54}, + {"GL_RENDERBUFFER_DEPTH_SIZE_EXT", 0x8D54}, + {"GL_RENDERBUFFER_DEPTH_SIZE_OES", 0x8D54}, + {"GL_RENDERBUFFER_STENCIL_SIZE", 0x8D55}, + {"GL_RENDERBUFFER_STENCIL_SIZE_EXT", 0x8D55}, + {"GL_RENDERBUFFER_STENCIL_SIZE_OES", 0x8D55}, + {"GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE", 0x8D56}, + {"GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE", 0x8D56}, + {"GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT", 0x8D56}, + {"GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV", 0x8D56}, + {"GL_MAX_SAMPLES", 0x8D57}, + {"GL_MAX_SAMPLES_ANGLE", 0x8D57}, + {"GL_MAX_SAMPLES_EXT", 0x8D57}, + {"GL_MAX_SAMPLES_NV", 0x8D57}, + {"GL_TEXTURE_GEN_STR_OES", 0x8D60}, + {"GL_HALF_FLOAT_OES", 0x8D61}, + {"GL_RGB565_OES", 0x8D62}, + {"GL_RGB565", 0x8D62}, + {"GL_ETC1_RGB8_OES", 0x8D64}, + {"GL_TEXTURE_EXTERNAL_OES", 0x8D65}, + {"GL_SAMPLER_EXTERNAL_OES", 0x8D66}, + {"GL_TEXTURE_BINDING_EXTERNAL_OES", 0x8D67}, + {"GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES", 0x8D68}, + {"GL_PRIMITIVE_RESTART_FIXED_INDEX", 0x8D69}, + {"GL_ANY_SAMPLES_PASSED_CONSERVATIVE", 0x8D6A}, + {"GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT", 0x8D6A}, + {"GL_MAX_ELEMENT_INDEX", 0x8D6B}, + {"GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT", 0x8D6C}, + {"GL_RGBA32UI", 0x8D70}, + {"GL_RGBA32UI_EXT", 0x8D70}, + {"GL_RGB32UI", 0x8D71}, + {"GL_RGB32UI_EXT", 0x8D71}, + {"GL_ALPHA32UI_EXT", 0x8D72}, + {"GL_INTENSITY32UI_EXT", 0x8D73}, + {"GL_LUMINANCE32UI_EXT", 0x8D74}, + {"GL_LUMINANCE_ALPHA32UI_EXT", 0x8D75}, + {"GL_RGBA16UI", 0x8D76}, + {"GL_RGBA16UI_EXT", 0x8D76}, + {"GL_RGB16UI", 0x8D77}, + {"GL_RGB16UI_EXT", 0x8D77}, + {"GL_ALPHA16UI_EXT", 0x8D78}, + {"GL_INTENSITY16UI_EXT", 0x8D79}, + {"GL_LUMINANCE16UI_EXT", 0x8D7A}, + {"GL_LUMINANCE_ALPHA16UI_EXT", 0x8D7B}, + {"GL_RGBA8UI", 0x8D7C}, + {"GL_RGBA8UI_EXT", 0x8D7C}, + {"GL_RGB8UI", 0x8D7D}, + {"GL_RGB8UI_EXT", 0x8D7D}, + {"GL_ALPHA8UI_EXT", 0x8D7E}, + {"GL_INTENSITY8UI_EXT", 0x8D7F}, + {"GL_LUMINANCE8UI_EXT", 0x8D80}, + {"GL_LUMINANCE_ALPHA8UI_EXT", 0x8D81}, + {"GL_RGBA32I", 0x8D82}, + {"GL_RGBA32I_EXT", 0x8D82}, + {"GL_RGB32I", 0x8D83}, + {"GL_RGB32I_EXT", 0x8D83}, + {"GL_ALPHA32I_EXT", 0x8D84}, + {"GL_INTENSITY32I_EXT", 0x8D85}, + {"GL_LUMINANCE32I_EXT", 0x8D86}, + {"GL_LUMINANCE_ALPHA32I_EXT", 0x8D87}, + {"GL_RGBA16I", 0x8D88}, + {"GL_RGBA16I_EXT", 0x8D88}, + {"GL_RGB16I", 0x8D89}, + {"GL_RGB16I_EXT", 0x8D89}, + {"GL_ALPHA16I_EXT", 0x8D8A}, + {"GL_INTENSITY16I_EXT", 0x8D8B}, + {"GL_LUMINANCE16I_EXT", 0x8D8C}, + {"GL_LUMINANCE_ALPHA16I_EXT", 0x8D8D}, + {"GL_RGBA8I", 0x8D8E}, + {"GL_RGBA8I_EXT", 0x8D8E}, + {"GL_RGB8I", 0x8D8F}, + {"GL_RGB8I_EXT", 0x8D8F}, + {"GL_ALPHA8I_EXT", 0x8D90}, + {"GL_INTENSITY8I_EXT", 0x8D91}, + {"GL_LUMINANCE8I_EXT", 0x8D92}, + {"GL_LUMINANCE_ALPHA8I_EXT", 0x8D93}, + {"GL_RED_INTEGER", 0x8D94}, + {"GL_RED_INTEGER_EXT", 0x8D94}, + {"GL_GREEN_INTEGER", 0x8D95}, + {"GL_GREEN_INTEGER_EXT", 0x8D95}, + {"GL_BLUE_INTEGER", 0x8D96}, + {"GL_BLUE_INTEGER_EXT", 0x8D96}, + {"GL_ALPHA_INTEGER", 0x8D97}, + {"GL_ALPHA_INTEGER_EXT", 0x8D97}, + {"GL_RGB_INTEGER", 0x8D98}, + {"GL_RGB_INTEGER_EXT", 0x8D98}, + {"GL_RGBA_INTEGER", 0x8D99}, + {"GL_RGBA_INTEGER_EXT", 0x8D99}, + {"GL_BGR_INTEGER", 0x8D9A}, + {"GL_BGR_INTEGER_EXT", 0x8D9A}, + {"GL_BGRA_INTEGER", 0x8D9B}, + {"GL_BGRA_INTEGER_EXT", 0x8D9B}, + {"GL_LUMINANCE_INTEGER_EXT", 0x8D9C}, + {"GL_LUMINANCE_ALPHA_INTEGER_EXT", 0x8D9D}, + {"GL_RGBA_INTEGER_MODE_EXT", 0x8D9E}, + {"GL_INT_2_10_10_10_REV", 0x8D9F}, + {"GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV", 0x8DA0}, + {"GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV", 0x8DA1}, + {"GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV", 0x8DA2}, + {"GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV", 0x8DA3}, + {"GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV", 0x8DA4}, + {"GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV", 0x8DA5}, + {"GL_MAX_PROGRAM_GENERIC_RESULTS_NV", 0x8DA6}, + {"GL_FRAMEBUFFER_ATTACHMENT_LAYERED", 0x8DA7}, + {"GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB", 0x8DA7}, + {"GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT", 0x8DA7}, + {"GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS", 0x8DA8}, + {"GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB", 0x8DA8}, + {"GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT", 0x8DA8}, + {"GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB", 0x8DA9}, + {"GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT", 0x8DA9}, + {"GL_LAYER_NV", 0x8DAA}, + {"GL_DEPTH_COMPONENT32F_NV", 0x8DAB}, + {"GL_DEPTH32F_STENCIL8_NV", 0x8DAC}, + {"GL_FLOAT_32_UNSIGNED_INT_24_8_REV", 0x8DAD}, + {"GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV", 0x8DAD}, + {"GL_SHADER_INCLUDE_ARB", 0x8DAE}, + {"GL_DEPTH_BUFFER_FLOAT_MODE_NV", 0x8DAF}, + {"GL_FRAMEBUFFER_SRGB", 0x8DB9}, + {"GL_FRAMEBUFFER_SRGB_EXT", 0x8DB9}, + {"GL_FRAMEBUFFER_SRGB_CAPABLE_EXT", 0x8DBA}, + {"GL_COMPRESSED_RED_RGTC1", 0x8DBB}, + {"GL_COMPRESSED_RED_RGTC1_EXT", 0x8DBB}, + {"GL_COMPRESSED_SIGNED_RED_RGTC1", 0x8DBC}, + {"GL_COMPRESSED_SIGNED_RED_RGTC1_EXT", 0x8DBC}, + {"GL_COMPRESSED_RED_GREEN_RGTC2_EXT", 0x8DBD}, + {"GL_COMPRESSED_RG_RGTC2", 0x8DBD}, + {"GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT", 0x8DBE}, + {"GL_COMPRESSED_SIGNED_RG_RGTC2", 0x8DBE}, + {"GL_SAMPLER_1D_ARRAY", 0x8DC0}, + {"GL_SAMPLER_1D_ARRAY_EXT", 0x8DC0}, + {"GL_SAMPLER_2D_ARRAY", 0x8DC1}, + {"GL_SAMPLER_2D_ARRAY_EXT", 0x8DC1}, + {"GL_SAMPLER_BUFFER", 0x8DC2}, + {"GL_SAMPLER_BUFFER_EXT", 0x8DC2}, + {"GL_SAMPLER_1D_ARRAY_SHADOW", 0x8DC3}, + {"GL_SAMPLER_1D_ARRAY_SHADOW_EXT", 0x8DC3}, + {"GL_SAMPLER_2D_ARRAY_SHADOW", 0x8DC4}, + {"GL_SAMPLER_2D_ARRAY_SHADOW_EXT", 0x8DC4}, + {"GL_SAMPLER_2D_ARRAY_SHADOW_NV", 0x8DC4}, + {"GL_SAMPLER_CUBE_SHADOW", 0x8DC5}, + {"GL_SAMPLER_CUBE_SHADOW_EXT", 0x8DC5}, + {"GL_SAMPLER_CUBE_SHADOW_NV", 0x8DC5}, + {"GL_UNSIGNED_INT_VEC2", 0x8DC6}, + {"GL_UNSIGNED_INT_VEC2_EXT", 0x8DC6}, + {"GL_UNSIGNED_INT_VEC3", 0x8DC7}, + {"GL_UNSIGNED_INT_VEC3_EXT", 0x8DC7}, + {"GL_UNSIGNED_INT_VEC4", 0x8DC8}, + {"GL_UNSIGNED_INT_VEC4_EXT", 0x8DC8}, + {"GL_INT_SAMPLER_1D", 0x8DC9}, + {"GL_INT_SAMPLER_1D_EXT", 0x8DC9}, + {"GL_INT_SAMPLER_2D", 0x8DCA}, + {"GL_INT_SAMPLER_2D_EXT", 0x8DCA}, + {"GL_INT_SAMPLER_3D", 0x8DCB}, + {"GL_INT_SAMPLER_3D_EXT", 0x8DCB}, + {"GL_INT_SAMPLER_CUBE", 0x8DCC}, + {"GL_INT_SAMPLER_CUBE_EXT", 0x8DCC}, + {"GL_INT_SAMPLER_2D_RECT", 0x8DCD}, + {"GL_INT_SAMPLER_2D_RECT_EXT", 0x8DCD}, + {"GL_INT_SAMPLER_1D_ARRAY", 0x8DCE}, + {"GL_INT_SAMPLER_1D_ARRAY_EXT", 0x8DCE}, + {"GL_INT_SAMPLER_2D_ARRAY", 0x8DCF}, + {"GL_INT_SAMPLER_2D_ARRAY_EXT", 0x8DCF}, + {"GL_INT_SAMPLER_BUFFER", 0x8DD0}, + {"GL_INT_SAMPLER_BUFFER_EXT", 0x8DD0}, + {"GL_UNSIGNED_INT_SAMPLER_1D", 0x8DD1}, + {"GL_UNSIGNED_INT_SAMPLER_1D_EXT", 0x8DD1}, + {"GL_UNSIGNED_INT_SAMPLER_2D", 0x8DD2}, + {"GL_UNSIGNED_INT_SAMPLER_2D_EXT", 0x8DD2}, + {"GL_UNSIGNED_INT_SAMPLER_3D", 0x8DD3}, + {"GL_UNSIGNED_INT_SAMPLER_3D_EXT", 0x8DD3}, + {"GL_UNSIGNED_INT_SAMPLER_CUBE", 0x8DD4}, + {"GL_UNSIGNED_INT_SAMPLER_CUBE_EXT", 0x8DD4}, + {"GL_UNSIGNED_INT_SAMPLER_2D_RECT", 0x8DD5}, + {"GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT", 0x8DD5}, + {"GL_UNSIGNED_INT_SAMPLER_1D_ARRAY", 0x8DD6}, + {"GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT", 0x8DD6}, + {"GL_UNSIGNED_INT_SAMPLER_2D_ARRAY", 0x8DD7}, + {"GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT", 0x8DD7}, + {"GL_UNSIGNED_INT_SAMPLER_BUFFER", 0x8DD8}, + {"GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT", 0x8DD8}, + {"GL_GEOMETRY_SHADER", 0x8DD9}, + {"GL_GEOMETRY_SHADER_ARB", 0x8DD9}, + {"GL_GEOMETRY_SHADER_EXT", 0x8DD9}, + {"GL_GEOMETRY_VERTICES_OUT_ARB", 0x8DDA}, + {"GL_GEOMETRY_VERTICES_OUT_EXT", 0x8DDA}, + {"GL_GEOMETRY_INPUT_TYPE_ARB", 0x8DDB}, + {"GL_GEOMETRY_INPUT_TYPE_EXT", 0x8DDB}, + {"GL_GEOMETRY_OUTPUT_TYPE_ARB", 0x8DDC}, + {"GL_GEOMETRY_OUTPUT_TYPE_EXT", 0x8DDC}, + {"GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB", 0x8DDD}, + {"GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT", 0x8DDD}, + {"GL_MAX_VERTEX_VARYING_COMPONENTS_ARB", 0x8DDE}, + {"GL_MAX_VERTEX_VARYING_COMPONENTS_EXT", 0x8DDE}, + {"GL_MAX_GEOMETRY_UNIFORM_COMPONENTS", 0x8DDF}, + {"GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB", 0x8DDF}, + {"GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT", 0x8DDF}, + {"GL_MAX_GEOMETRY_OUTPUT_VERTICES", 0x8DE0}, + {"GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB", 0x8DE0}, + {"GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT", 0x8DE0}, + {"GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS", 0x8DE1}, + {"GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB", 0x8DE1}, + {"GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT", 0x8DE1}, + {"GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT", 0x8DE2}, + {"GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT", 0x8DE3}, + {"GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT", 0x8DE4}, + {"GL_ACTIVE_SUBROUTINES", 0x8DE5}, + {"GL_ACTIVE_SUBROUTINE_UNIFORMS", 0x8DE6}, + {"GL_MAX_SUBROUTINES", 0x8DE7}, + {"GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS", 0x8DE8}, + {"GL_NAMED_STRING_LENGTH_ARB", 0x8DE9}, + {"GL_NAMED_STRING_TYPE_ARB", 0x8DEA}, + {"GL_MAX_BINDABLE_UNIFORM_SIZE_EXT", 0x8DED}, + {"GL_UNIFORM_BUFFER_EXT", 0x8DEE}, + {"GL_UNIFORM_BUFFER_BINDING_EXT", 0x8DEF}, + {"GL_LOW_FLOAT", 0x8DF0}, + {"GL_MEDIUM_FLOAT", 0x8DF1}, + {"GL_HIGH_FLOAT", 0x8DF2}, + {"GL_LOW_INT", 0x8DF3}, + {"GL_MEDIUM_INT", 0x8DF4}, + {"GL_HIGH_INT", 0x8DF5}, + {"GL_UNSIGNED_INT_10_10_10_2_OES", 0x8DF6}, + {"GL_INT_10_10_10_2_OES", 0x8DF7}, + {"GL_SHADER_BINARY_FORMATS", 0x8DF8}, + {"GL_NUM_SHADER_BINARY_FORMATS", 0x8DF9}, + {"GL_SHADER_COMPILER", 0x8DFA}, + {"GL_MAX_VERTEX_UNIFORM_VECTORS", 0x8DFB}, + {"GL_MAX_VARYING_VECTORS", 0x8DFC}, + {"GL_MAX_FRAGMENT_UNIFORM_VECTORS", 0x8DFD}, + {"GL_RENDERBUFFER_COLOR_SAMPLES_NV", 0x8E10}, + {"GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV", 0x8E11}, + {"GL_MULTISAMPLE_COVERAGE_MODES_NV", 0x8E12}, + {"GL_QUERY_WAIT", 0x8E13}, + {"GL_QUERY_WAIT_NV", 0x8E13}, + {"GL_QUERY_NO_WAIT", 0x8E14}, + {"GL_QUERY_NO_WAIT_NV", 0x8E14}, + {"GL_QUERY_BY_REGION_WAIT", 0x8E15}, + {"GL_QUERY_BY_REGION_WAIT_NV", 0x8E15}, + {"GL_QUERY_BY_REGION_NO_WAIT", 0x8E16}, + {"GL_QUERY_BY_REGION_NO_WAIT_NV", 0x8E16}, + {"GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS", 0x8E1E}, + {"GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS", 0x8E1F}, + {"GL_COLOR_SAMPLES_NV", 0x8E20}, + {"GL_TRANSFORM_FEEDBACK", 0x8E22}, + {"GL_TRANSFORM_FEEDBACK_NV", 0x8E22}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED", 0x8E23}, + {"GL_TRANSFORM_FEEDBACK_PAUSED", 0x8E23}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV", 0x8E23}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE", 0x8E24}, + {"GL_TRANSFORM_FEEDBACK_ACTIVE", 0x8E24}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV", 0x8E24}, + {"GL_TRANSFORM_FEEDBACK_BINDING", 0x8E25}, + {"GL_TRANSFORM_FEEDBACK_BINDING_NV", 0x8E25}, + {"GL_FRAME_NV", 0x8E26}, + {"GL_FIELDS_NV", 0x8E27}, + {"GL_CURRENT_TIME_NV", 0x8E28}, + {"GL_TIMESTAMP", 0x8E28}, + {"GL_TIMESTAMP_EXT", 0x8E28}, + {"GL_NUM_FILL_STREAMS_NV", 0x8E29}, + {"GL_PRESENT_TIME_NV", 0x8E2A}, + {"GL_PRESENT_DURATION_NV", 0x8E2B}, + {"GL_DEPTH_COMPONENT16_NONLINEAR_NV", 0x8E2C}, + {"GL_PROGRAM_MATRIX_EXT", 0x8E2D}, + {"GL_TRANSPOSE_PROGRAM_MATRIX_EXT", 0x8E2E}, + {"GL_PROGRAM_MATRIX_STACK_DEPTH_EXT", 0x8E2F}, + {"GL_TEXTURE_SWIZZLE_R", 0x8E42}, + {"GL_TEXTURE_SWIZZLE_R_EXT", 0x8E42}, + {"GL_TEXTURE_SWIZZLE_G", 0x8E43}, + {"GL_TEXTURE_SWIZZLE_G_EXT", 0x8E43}, + {"GL_TEXTURE_SWIZZLE_B", 0x8E44}, + {"GL_TEXTURE_SWIZZLE_B_EXT", 0x8E44}, + {"GL_TEXTURE_SWIZZLE_A", 0x8E45}, + {"GL_TEXTURE_SWIZZLE_A_EXT", 0x8E45}, + {"GL_TEXTURE_SWIZZLE_RGBA", 0x8E46}, + {"GL_TEXTURE_SWIZZLE_RGBA_EXT", 0x8E46}, + {"GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS", 0x8E47}, + {"GL_ACTIVE_SUBROUTINE_MAX_LENGTH", 0x8E48}, + {"GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH", 0x8E49}, + {"GL_NUM_COMPATIBLE_SUBROUTINES", 0x8E4A}, + {"GL_COMPATIBLE_SUBROUTINES", 0x8E4B}, + {"GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION", 0x8E4C}, + {"GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT", 0x8E4C}, + {"GL_FIRST_VERTEX_CONVENTION", 0x8E4D}, + {"GL_FIRST_VERTEX_CONVENTION_EXT", 0x8E4D}, + {"GL_LAST_VERTEX_CONVENTION", 0x8E4E}, + {"GL_LAST_VERTEX_CONVENTION_EXT", 0x8E4E}, + {"GL_PROVOKING_VERTEX", 0x8E4F}, + {"GL_PROVOKING_VERTEX_EXT", 0x8E4F}, + {"GL_SAMPLE_POSITION", 0x8E50}, + {"GL_SAMPLE_POSITION_NV", 0x8E50}, + {"GL_SAMPLE_MASK", 0x8E51}, + {"GL_SAMPLE_MASK_NV", 0x8E51}, + {"GL_SAMPLE_MASK_VALUE", 0x8E52}, + {"GL_SAMPLE_MASK_VALUE_NV", 0x8E52}, + {"GL_TEXTURE_BINDING_RENDERBUFFER_NV", 0x8E53}, + {"GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV", 0x8E54}, + {"GL_TEXTURE_RENDERBUFFER_NV", 0x8E55}, + {"GL_SAMPLER_RENDERBUFFER_NV", 0x8E56}, + {"GL_INT_SAMPLER_RENDERBUFFER_NV", 0x8E57}, + {"GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV", 0x8E58}, + {"GL_MAX_SAMPLE_MASK_WORDS", 0x8E59}, + {"GL_MAX_SAMPLE_MASK_WORDS_NV", 0x8E59}, + {"GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV", 0x8E5A}, + {"GL_MAX_GEOMETRY_SHADER_INVOCATIONS", 0x8E5A}, + {"GL_MIN_FRAGMENT_INTERPOLATION_OFFSET", 0x8E5B}, + {"GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV", 0x8E5B}, + {"GL_MAX_FRAGMENT_INTERPOLATION_OFFSET", 0x8E5C}, + {"GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV", 0x8E5C}, + {"GL_FRAGMENT_INTERPOLATION_OFFSET_BITS", 0x8E5D}, + {"GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV", 0x8E5D}, + {"GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET", 0x8E5E}, + {"GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB", 0x8E5E}, + {"GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV", 0x8E5E}, + {"GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET", 0x8E5F}, + {"GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB", 0x8E5F}, + {"GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV", 0x8E5F}, + {"GL_MAX_TRANSFORM_FEEDBACK_BUFFERS", 0x8E70}, + {"GL_MAX_VERTEX_STREAMS", 0x8E71}, + {"GL_PATCH_VERTICES", 0x8E72}, + {"GL_PATCH_DEFAULT_INNER_LEVEL", 0x8E73}, + {"GL_PATCH_DEFAULT_OUTER_LEVEL", 0x8E74}, + {"GL_TESS_CONTROL_OUTPUT_VERTICES", 0x8E75}, + {"GL_TESS_GEN_MODE", 0x8E76}, + {"GL_TESS_GEN_SPACING", 0x8E77}, + {"GL_TESS_GEN_VERTEX_ORDER", 0x8E78}, + {"GL_TESS_GEN_POINT_MODE", 0x8E79}, + {"GL_ISOLINES", 0x8E7A}, + {"GL_FRACTIONAL_ODD", 0x8E7B}, + {"GL_FRACTIONAL_EVEN", 0x8E7C}, + {"GL_MAX_PATCH_VERTICES", 0x8E7D}, + {"GL_MAX_TESS_GEN_LEVEL", 0x8E7E}, + {"GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS", 0x8E7F}, + {"GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS", 0x8E80}, + {"GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS", 0x8E81}, + {"GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS", 0x8E82}, + {"GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS", 0x8E83}, + {"GL_MAX_TESS_PATCH_COMPONENTS", 0x8E84}, + {"GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS", 0x8E85}, + {"GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS", 0x8E86}, + {"GL_TESS_EVALUATION_SHADER", 0x8E87}, + {"GL_TESS_CONTROL_SHADER", 0x8E88}, + {"GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS", 0x8E89}, + {"GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS", 0x8E8A}, + {"GL_COMPRESSED_RGBA_BPTC_UNORM_ARB", 0x8E8C}, + {"GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB", 0x8E8D}, + {"GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB", 0x8E8E}, + {"GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB", 0x8E8F}, + {"GL_COVERAGE_COMPONENT_NV", 0x8ED0}, + {"GL_COVERAGE_COMPONENT4_NV", 0x8ED1}, + {"GL_COVERAGE_ATTACHMENT_NV", 0x8ED2}, + {"GL_COVERAGE_BUFFERS_NV", 0x8ED3}, + {"GL_COVERAGE_SAMPLES_NV", 0x8ED4}, + {"GL_COVERAGE_ALL_FRAGMENTS_NV", 0x8ED5}, + {"GL_COVERAGE_EDGE_FRAGMENTS_NV", 0x8ED6}, + {"GL_COVERAGE_AUTOMATIC_NV", 0x8ED7}, + {"GL_BUFFER_GPU_ADDRESS_NV", 0x8F1D}, + {"GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV", 0x8F1E}, + {"GL_ELEMENT_ARRAY_UNIFIED_NV", 0x8F1F}, + {"GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV", 0x8F20}, + {"GL_VERTEX_ARRAY_ADDRESS_NV", 0x8F21}, + {"GL_NORMAL_ARRAY_ADDRESS_NV", 0x8F22}, + {"GL_COLOR_ARRAY_ADDRESS_NV", 0x8F23}, + {"GL_INDEX_ARRAY_ADDRESS_NV", 0x8F24}, + {"GL_TEXTURE_COORD_ARRAY_ADDRESS_NV", 0x8F25}, + {"GL_EDGE_FLAG_ARRAY_ADDRESS_NV", 0x8F26}, + {"GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV", 0x8F27}, + {"GL_FOG_COORD_ARRAY_ADDRESS_NV", 0x8F28}, + {"GL_ELEMENT_ARRAY_ADDRESS_NV", 0x8F29}, + {"GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV", 0x8F2A}, + {"GL_VERTEX_ARRAY_LENGTH_NV", 0x8F2B}, + {"GL_NORMAL_ARRAY_LENGTH_NV", 0x8F2C}, + {"GL_COLOR_ARRAY_LENGTH_NV", 0x8F2D}, + {"GL_INDEX_ARRAY_LENGTH_NV", 0x8F2E}, + {"GL_TEXTURE_COORD_ARRAY_LENGTH_NV", 0x8F2F}, + {"GL_EDGE_FLAG_ARRAY_LENGTH_NV", 0x8F30}, + {"GL_SECONDARY_COLOR_ARRAY_LENGTH_NV", 0x8F31}, + {"GL_FOG_COORD_ARRAY_LENGTH_NV", 0x8F32}, + {"GL_ELEMENT_ARRAY_LENGTH_NV", 0x8F33}, + {"GL_GPU_ADDRESS_NV", 0x8F34}, + {"GL_MAX_SHADER_BUFFER_ADDRESS_NV", 0x8F35}, + {"GL_COPY_READ_BUFFER", 0x8F36}, + {"GL_COPY_READ_BUFFER_BINDING", 0x8F36}, + {"GL_COPY_WRITE_BUFFER", 0x8F37}, + {"GL_COPY_WRITE_BUFFER_BINDING", 0x8F37}, + {"GL_MAX_IMAGE_UNITS", 0x8F38}, + {"GL_MAX_IMAGE_UNITS_EXT", 0x8F38}, + {"GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS", 0x8F39}, + {"GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT", 0x8F39}, + {"GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES", 0x8F39}, + {"GL_IMAGE_BINDING_NAME", 0x8F3A}, + {"GL_IMAGE_BINDING_NAME_EXT", 0x8F3A}, + {"GL_IMAGE_BINDING_LEVEL", 0x8F3B}, + {"GL_IMAGE_BINDING_LEVEL_EXT", 0x8F3B}, + {"GL_IMAGE_BINDING_LAYERED", 0x8F3C}, + {"GL_IMAGE_BINDING_LAYERED_EXT", 0x8F3C}, + {"GL_IMAGE_BINDING_LAYER", 0x8F3D}, + {"GL_IMAGE_BINDING_LAYER_EXT", 0x8F3D}, + {"GL_IMAGE_BINDING_ACCESS", 0x8F3E}, + {"GL_IMAGE_BINDING_ACCESS_EXT", 0x8F3E}, + {"GL_DRAW_INDIRECT_BUFFER", 0x8F3F}, + {"GL_DRAW_INDIRECT_UNIFIED_NV", 0x8F40}, + {"GL_DRAW_INDIRECT_ADDRESS_NV", 0x8F41}, + {"GL_DRAW_INDIRECT_LENGTH_NV", 0x8F42}, + {"GL_DRAW_INDIRECT_BUFFER_BINDING", 0x8F43}, + {"GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV", 0x8F44}, + {"GL_MAX_PROGRAM_SUBROUTINE_NUM_NV", 0x8F45}, + {"GL_DOUBLE_MAT2", 0x8F46}, + {"GL_DOUBLE_MAT2_EXT", 0x8F46}, + {"GL_DOUBLE_MAT3", 0x8F47}, + {"GL_DOUBLE_MAT3_EXT", 0x8F47}, + {"GL_DOUBLE_MAT4", 0x8F48}, + {"GL_DOUBLE_MAT4_EXT", 0x8F48}, + {"GL_DOUBLE_MAT2x3", 0x8F49}, + {"GL_DOUBLE_MAT2x3_EXT", 0x8F49}, + {"GL_DOUBLE_MAT2x4", 0x8F4A}, + {"GL_DOUBLE_MAT2x4_EXT", 0x8F4A}, + {"GL_DOUBLE_MAT3x2", 0x8F4B}, + {"GL_DOUBLE_MAT3x2_EXT", 0x8F4B}, + {"GL_DOUBLE_MAT3x4", 0x8F4C}, + {"GL_DOUBLE_MAT3x4_EXT", 0x8F4C}, + {"GL_DOUBLE_MAT4x2", 0x8F4D}, + {"GL_DOUBLE_MAT4x2_EXT", 0x8F4D}, + {"GL_DOUBLE_MAT4x3", 0x8F4E}, + {"GL_DOUBLE_MAT4x3_EXT", 0x8F4E}, + {"GL_MALI_SHADER_BINARY_ARM", 0x8F60}, + {"GL_MALI_PROGRAM_BINARY_ARM", 0x8F61}, + {"GL_RED_SNORM", 0x8F90}, + {"GL_RG_SNORM", 0x8F91}, + {"GL_RGB_SNORM", 0x8F92}, + {"GL_RGBA_SNORM", 0x8F93}, + {"GL_R8_SNORM", 0x8F94}, + {"GL_RG8_SNORM", 0x8F95}, + {"GL_RGB8_SNORM", 0x8F96}, + {"GL_RGBA8_SNORM", 0x8F97}, + {"GL_R16_SNORM", 0x8F98}, + {"GL_RG16_SNORM", 0x8F99}, + {"GL_RGB16_SNORM", 0x8F9A}, + {"GL_RGBA16_SNORM", 0x8F9B}, + {"GL_SIGNED_NORMALIZED", 0x8F9C}, + {"GL_PRIMITIVE_RESTART", 0x8F9D}, + {"GL_PRIMITIVE_RESTART_INDEX", 0x8F9E}, + {"GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB", 0x8F9F}, + {"GL_PERFMON_GLOBAL_MODE_QCOM", 0x8FA0}, + {"GL_BINNING_CONTROL_HINT_QCOM", 0x8FB0}, + {"GL_CPU_OPTIMIZED_QCOM", 0x8FB1}, + {"GL_GPU_OPTIMIZED_QCOM", 0x8FB2}, + {"GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM", 0x8FB3}, + {"GL_GPU_DISJOINT_EXT", 0x8FBB}, + {"GL_SHADER_BINARY_VIV", 0x8FC4}, + {"GL_INT8_NV", 0x8FE0}, + {"GL_INT8_VEC2_NV", 0x8FE1}, + {"GL_INT8_VEC3_NV", 0x8FE2}, + {"GL_INT8_VEC4_NV", 0x8FE3}, + {"GL_INT16_NV", 0x8FE4}, + {"GL_INT16_VEC2_NV", 0x8FE5}, + {"GL_INT16_VEC3_NV", 0x8FE6}, + {"GL_INT16_VEC4_NV", 0x8FE7}, + {"GL_INT64_VEC2_NV", 0x8FE9}, + {"GL_INT64_VEC3_NV", 0x8FEA}, + {"GL_INT64_VEC4_NV", 0x8FEB}, + {"GL_UNSIGNED_INT8_NV", 0x8FEC}, + {"GL_UNSIGNED_INT8_VEC2_NV", 0x8FED}, + {"GL_UNSIGNED_INT8_VEC3_NV", 0x8FEE}, + {"GL_UNSIGNED_INT8_VEC4_NV", 0x8FEF}, + {"GL_UNSIGNED_INT16_NV", 0x8FF0}, + {"GL_UNSIGNED_INT16_VEC2_NV", 0x8FF1}, + {"GL_UNSIGNED_INT16_VEC3_NV", 0x8FF2}, + {"GL_UNSIGNED_INT16_VEC4_NV", 0x8FF3}, + {"GL_UNSIGNED_INT64_VEC2_NV", 0x8FF5}, + {"GL_UNSIGNED_INT64_VEC3_NV", 0x8FF6}, + {"GL_UNSIGNED_INT64_VEC4_NV", 0x8FF7}, + {"GL_FLOAT16_NV", 0x8FF8}, + {"GL_FLOAT16_VEC2_NV", 0x8FF9}, + {"GL_FLOAT16_VEC3_NV", 0x8FFA}, + {"GL_FLOAT16_VEC4_NV", 0x8FFB}, + {"GL_DOUBLE_VEC2", 0x8FFC}, + {"GL_DOUBLE_VEC2_EXT", 0x8FFC}, + {"GL_DOUBLE_VEC3", 0x8FFD}, + {"GL_DOUBLE_VEC3_EXT", 0x8FFD}, + {"GL_DOUBLE_VEC4", 0x8FFE}, + {"GL_DOUBLE_VEC4_EXT", 0x8FFE}, + {"GL_SAMPLER_BUFFER_AMD", 0x9001}, + {"GL_INT_SAMPLER_BUFFER_AMD", 0x9002}, + {"GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD", 0x9003}, + {"GL_TESSELLATION_MODE_AMD", 0x9004}, + {"GL_TESSELLATION_FACTOR_AMD", 0x9005}, + {"GL_DISCRETE_AMD", 0x9006}, + {"GL_CONTINUOUS_AMD", 0x9007}, + {"GL_TEXTURE_CUBE_MAP_ARRAY", 0x9009}, + {"GL_TEXTURE_CUBE_MAP_ARRAY_ARB", 0x9009}, + {"GL_TEXTURE_BINDING_CUBE_MAP_ARRAY", 0x900A}, + {"GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", 0x900A}, + {"GL_PROXY_TEXTURE_CUBE_MAP_ARRAY", 0x900B}, + {"GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB", 0x900B}, + {"GL_SAMPLER_CUBE_MAP_ARRAY", 0x900C}, + {"GL_SAMPLER_CUBE_MAP_ARRAY_ARB", 0x900C}, + {"GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW", 0x900D}, + {"GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB", 0x900D}, + {"GL_INT_SAMPLER_CUBE_MAP_ARRAY", 0x900E}, + {"GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB", 0x900E}, + {"GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY", 0x900F}, + {"GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB", 0x900F}, + {"GL_ALPHA_SNORM", 0x9010}, + {"GL_LUMINANCE_SNORM", 0x9011}, + {"GL_LUMINANCE_ALPHA_SNORM", 0x9012}, + {"GL_INTENSITY_SNORM", 0x9013}, + {"GL_ALPHA8_SNORM", 0x9014}, + {"GL_LUMINANCE8_SNORM", 0x9015}, + {"GL_LUMINANCE8_ALPHA8_SNORM", 0x9016}, + {"GL_INTENSITY8_SNORM", 0x9017}, + {"GL_ALPHA16_SNORM", 0x9018}, + {"GL_LUMINANCE16_SNORM", 0x9019}, + {"GL_LUMINANCE16_ALPHA16_SNORM", 0x901A}, + {"GL_INTENSITY16_SNORM", 0x901B}, + {"GL_FACTOR_MIN_AMD", 0x901C}, + {"GL_FACTOR_MAX_AMD", 0x901D}, + {"GL_DEPTH_CLAMP_NEAR_AMD", 0x901E}, + {"GL_DEPTH_CLAMP_FAR_AMD", 0x901F}, + {"GL_VIDEO_BUFFER_NV", 0x9020}, + {"GL_VIDEO_BUFFER_BINDING_NV", 0x9021}, + {"GL_FIELD_UPPER_NV", 0x9022}, + {"GL_FIELD_LOWER_NV", 0x9023}, + {"GL_NUM_VIDEO_CAPTURE_STREAMS_NV", 0x9024}, + {"GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV", 0x9025}, + {"GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV", 0x9026}, + {"GL_LAST_VIDEO_CAPTURE_STATUS_NV", 0x9027}, + {"GL_VIDEO_BUFFER_PITCH_NV", 0x9028}, + {"GL_VIDEO_COLOR_CONVERSION_MATRIX_NV", 0x9029}, + {"GL_VIDEO_COLOR_CONVERSION_MAX_NV", 0x902A}, + {"GL_VIDEO_COLOR_CONVERSION_MIN_NV", 0x902B}, + {"GL_VIDEO_COLOR_CONVERSION_OFFSET_NV", 0x902C}, + {"GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV", 0x902D}, + {"GL_PARTIAL_SUCCESS_NV", 0x902E}, + {"GL_SUCCESS_NV", 0x902F}, + {"GL_FAILURE_NV", 0x9030}, + {"GL_YCBYCR8_422_NV", 0x9031}, + {"GL_YCBAYCR8A_4224_NV", 0x9032}, + {"GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV", 0x9033}, + {"GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV", 0x9034}, + {"GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV", 0x9035}, + {"GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV", 0x9036}, + {"GL_Z4Y12Z4CB12Z4CR12_444_NV", 0x9037}, + {"GL_VIDEO_CAPTURE_FRAME_WIDTH_NV", 0x9038}, + {"GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV", 0x9039}, + {"GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV", 0x903A}, + {"GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV", 0x903B}, + {"GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV", 0x903C}, + {"GL_TEXTURE_COVERAGE_SAMPLES_NV", 0x9045}, + {"GL_TEXTURE_COLOR_SAMPLES_NV", 0x9046}, + {"GL_IMAGE_1D", 0x904C}, + {"GL_IMAGE_1D_EXT", 0x904C}, + {"GL_IMAGE_2D", 0x904D}, + {"GL_IMAGE_2D_EXT", 0x904D}, + {"GL_IMAGE_3D", 0x904E}, + {"GL_IMAGE_3D_EXT", 0x904E}, + {"GL_IMAGE_2D_RECT", 0x904F}, + {"GL_IMAGE_2D_RECT_EXT", 0x904F}, + {"GL_IMAGE_CUBE", 0x9050}, + {"GL_IMAGE_CUBE_EXT", 0x9050}, + {"GL_IMAGE_BUFFER", 0x9051}, + {"GL_IMAGE_BUFFER_EXT", 0x9051}, + {"GL_IMAGE_1D_ARRAY", 0x9052}, + {"GL_IMAGE_1D_ARRAY_EXT", 0x9052}, + {"GL_IMAGE_2D_ARRAY", 0x9053}, + {"GL_IMAGE_2D_ARRAY_EXT", 0x9053}, + {"GL_IMAGE_CUBE_MAP_ARRAY", 0x9054}, + {"GL_IMAGE_CUBE_MAP_ARRAY_EXT", 0x9054}, + {"GL_IMAGE_2D_MULTISAMPLE", 0x9055}, + {"GL_IMAGE_2D_MULTISAMPLE_EXT", 0x9055}, + {"GL_IMAGE_2D_MULTISAMPLE_ARRAY", 0x9056}, + {"GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT", 0x9056}, + {"GL_INT_IMAGE_1D", 0x9057}, + {"GL_INT_IMAGE_1D_EXT", 0x9057}, + {"GL_INT_IMAGE_2D", 0x9058}, + {"GL_INT_IMAGE_2D_EXT", 0x9058}, + {"GL_INT_IMAGE_3D", 0x9059}, + {"GL_INT_IMAGE_3D_EXT", 0x9059}, + {"GL_INT_IMAGE_2D_RECT", 0x905A}, + {"GL_INT_IMAGE_2D_RECT_EXT", 0x905A}, + {"GL_INT_IMAGE_CUBE", 0x905B}, + {"GL_INT_IMAGE_CUBE_EXT", 0x905B}, + {"GL_INT_IMAGE_BUFFER", 0x905C}, + {"GL_INT_IMAGE_BUFFER_EXT", 0x905C}, + {"GL_INT_IMAGE_1D_ARRAY", 0x905D}, + {"GL_INT_IMAGE_1D_ARRAY_EXT", 0x905D}, + {"GL_INT_IMAGE_2D_ARRAY", 0x905E}, + {"GL_INT_IMAGE_2D_ARRAY_EXT", 0x905E}, + {"GL_INT_IMAGE_CUBE_MAP_ARRAY", 0x905F}, + {"GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT", 0x905F}, + {"GL_INT_IMAGE_2D_MULTISAMPLE", 0x9060}, + {"GL_INT_IMAGE_2D_MULTISAMPLE_EXT", 0x9060}, + {"GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY", 0x9061}, + {"GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT", 0x9061}, + {"GL_UNSIGNED_INT_IMAGE_1D", 0x9062}, + {"GL_UNSIGNED_INT_IMAGE_1D_EXT", 0x9062}, + {"GL_UNSIGNED_INT_IMAGE_2D", 0x9063}, + {"GL_UNSIGNED_INT_IMAGE_2D_EXT", 0x9063}, + {"GL_UNSIGNED_INT_IMAGE_3D", 0x9064}, + {"GL_UNSIGNED_INT_IMAGE_3D_EXT", 0x9064}, + {"GL_UNSIGNED_INT_IMAGE_2D_RECT", 0x9065}, + {"GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT", 0x9065}, + {"GL_UNSIGNED_INT_IMAGE_CUBE", 0x9066}, + {"GL_UNSIGNED_INT_IMAGE_CUBE_EXT", 0x9066}, + {"GL_UNSIGNED_INT_IMAGE_BUFFER", 0x9067}, + {"GL_UNSIGNED_INT_IMAGE_BUFFER_EXT", 0x9067}, + {"GL_UNSIGNED_INT_IMAGE_1D_ARRAY", 0x9068}, + {"GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT", 0x9068}, + {"GL_UNSIGNED_INT_IMAGE_2D_ARRAY", 0x9069}, + {"GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT", 0x9069}, + {"GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY", 0x906A}, + {"GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT", 0x906A}, + {"GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE", 0x906B}, + {"GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT", 0x906B}, + {"GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY", 0x906C}, + {"GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT", 0x906C}, + {"GL_MAX_IMAGE_SAMPLES", 0x906D}, + {"GL_MAX_IMAGE_SAMPLES_EXT", 0x906D}, + {"GL_IMAGE_BINDING_FORMAT", 0x906E}, + {"GL_IMAGE_BINDING_FORMAT_EXT", 0x906E}, + {"GL_RGB10_A2UI", 0x906F}, + {"GL_PATH_FORMAT_SVG_NV", 0x9070}, + {"GL_PATH_FORMAT_PS_NV", 0x9071}, + {"GL_STANDARD_FONT_NAME_NV", 0x9072}, + {"GL_SYSTEM_FONT_NAME_NV", 0x9073}, + {"GL_FILE_NAME_NV", 0x9074}, + {"GL_PATH_STROKE_WIDTH_NV", 0x9075}, + {"GL_PATH_END_CAPS_NV", 0x9076}, + {"GL_PATH_INITIAL_END_CAP_NV", 0x9077}, + {"GL_PATH_TERMINAL_END_CAP_NV", 0x9078}, + {"GL_PATH_JOIN_STYLE_NV", 0x9079}, + {"GL_PATH_MITER_LIMIT_NV", 0x907A}, + {"GL_PATH_DASH_CAPS_NV", 0x907B}, + {"GL_PATH_INITIAL_DASH_CAP_NV", 0x907C}, + {"GL_PATH_TERMINAL_DASH_CAP_NV", 0x907D}, + {"GL_PATH_DASH_OFFSET_NV", 0x907E}, + {"GL_PATH_CLIENT_LENGTH_NV", 0x907F}, + {"GL_PATH_FILL_MODE_NV", 0x9080}, + {"GL_PATH_FILL_MASK_NV", 0x9081}, + {"GL_PATH_FILL_COVER_MODE_NV", 0x9082}, + {"GL_PATH_STROKE_COVER_MODE_NV", 0x9083}, + {"GL_PATH_STROKE_MASK_NV", 0x9084}, + {"GL_COUNT_UP_NV", 0x9088}, + {"GL_COUNT_DOWN_NV", 0x9089}, + {"GL_PATH_OBJECT_BOUNDING_BOX_NV", 0x908A}, + {"GL_CONVEX_HULL_NV", 0x908B}, + {"GL_BOUNDING_BOX_NV", 0x908D}, + {"GL_TRANSLATE_X_NV", 0x908E}, + {"GL_TRANSLATE_Y_NV", 0x908F}, + {"GL_TRANSLATE_2D_NV", 0x9090}, + {"GL_TRANSLATE_3D_NV", 0x9091}, + {"GL_AFFINE_2D_NV", 0x9092}, + {"GL_AFFINE_3D_NV", 0x9094}, + {"GL_TRANSPOSE_AFFINE_2D_NV", 0x9096}, + {"GL_TRANSPOSE_AFFINE_3D_NV", 0x9098}, + {"GL_UTF8_NV", 0x909A}, + {"GL_UTF16_NV", 0x909B}, + {"GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV", 0x909C}, + {"GL_PATH_COMMAND_COUNT_NV", 0x909D}, + {"GL_PATH_COORD_COUNT_NV", 0x909E}, + {"GL_PATH_DASH_ARRAY_COUNT_NV", 0x909F}, + {"GL_PATH_COMPUTED_LENGTH_NV", 0x90A0}, + {"GL_PATH_FILL_BOUNDING_BOX_NV", 0x90A1}, + {"GL_PATH_STROKE_BOUNDING_BOX_NV", 0x90A2}, + {"GL_SQUARE_NV", 0x90A3}, + {"GL_ROUND_NV", 0x90A4}, + {"GL_TRIANGULAR_NV", 0x90A5}, + {"GL_BEVEL_NV", 0x90A6}, + {"GL_MITER_REVERT_NV", 0x90A7}, + {"GL_MITER_TRUNCATE_NV", 0x90A8}, + {"GL_SKIP_MISSING_GLYPH_NV", 0x90A9}, + {"GL_USE_MISSING_GLYPH_NV", 0x90AA}, + {"GL_PATH_ERROR_POSITION_NV", 0x90AB}, + {"GL_PATH_FOG_GEN_MODE_NV", 0x90AC}, + {"GL_ACCUM_ADJACENT_PAIRS_NV", 0x90AD}, + {"GL_ADJACENT_PAIRS_NV", 0x90AE}, + {"GL_FIRST_TO_REST_NV", 0x90AF}, + {"GL_PATH_GEN_MODE_NV", 0x90B0}, + {"GL_PATH_GEN_COEFF_NV", 0x90B1}, + {"GL_PATH_GEN_COLOR_FORMAT_NV", 0x90B2}, + {"GL_PATH_GEN_COMPONENTS_NV", 0x90B3}, + {"GL_PATH_DASH_OFFSET_RESET_NV", 0x90B4}, + {"GL_MOVE_TO_RESETS_NV", 0x90B5}, + {"GL_MOVE_TO_CONTINUES_NV", 0x90B6}, + {"GL_PATH_STENCIL_FUNC_NV", 0x90B7}, + {"GL_PATH_STENCIL_REF_NV", 0x90B8}, + {"GL_PATH_STENCIL_VALUE_MASK_NV", 0x90B9}, + {"GL_SCALED_RESOLVE_FASTEST_EXT", 0x90BA}, + {"GL_SCALED_RESOLVE_NICEST_EXT", 0x90BB}, + {"GL_MIN_MAP_BUFFER_ALIGNMENT", 0x90BC}, + {"GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV", 0x90BD}, + {"GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV", 0x90BE}, + {"GL_PATH_COVER_DEPTH_FUNC_NV", 0x90BF}, + {"GL_IMAGE_FORMAT_COMPATIBILITY_TYPE", 0x90C7}, + {"GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE", 0x90C8}, + {"GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS", 0x90C9}, + {"GL_MAX_VERTEX_IMAGE_UNIFORMS", 0x90CA}, + {"GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS", 0x90CB}, + {"GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS", 0x90CC}, + {"GL_MAX_GEOMETRY_IMAGE_UNIFORMS", 0x90CD}, + {"GL_MAX_FRAGMENT_IMAGE_UNIFORMS", 0x90CE}, + {"GL_MAX_COMBINED_IMAGE_UNIFORMS", 0x90CF}, + {"GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV", 0x90D0}, + {"GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV", 0x90D1}, + {"GL_SHADER_STORAGE_BUFFER", 0x90D2}, + {"GL_SHADER_STORAGE_BUFFER_BINDING", 0x90D3}, + {"GL_SHADER_STORAGE_BUFFER_START", 0x90D4}, + {"GL_SHADER_STORAGE_BUFFER_SIZE", 0x90D5}, + {"GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS", 0x90D6}, + {"GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS", 0x90D7}, + {"GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS", 0x90D8}, + {"GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS", 0x90D9}, + {"GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS", 0x90DA}, + {"GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS", 0x90DB}, + {"GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS", 0x90DC}, + {"GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS", 0x90DD}, + {"GL_MAX_SHADER_STORAGE_BLOCK_SIZE", 0x90DE}, + {"GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT", 0x90DF}, + {"GL_SYNC_X11_FENCE_EXT", 0x90E1}, + {"GL_DEPTH_STENCIL_TEXTURE_MODE", 0x90EA}, + {"GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB", 0x90EB}, + {"GL_MAX_COMPUTE_LOCAL_INVOCATIONS", 0x90EB}, + {"GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER", 0x90EC}, + {"GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER", 0x90ED}, + {"GL_DISPATCH_INDIRECT_BUFFER", 0x90EE}, + {"GL_DISPATCH_INDIRECT_BUFFER_BINDING", 0x90EF}, + {"GL_COLOR_ATTACHMENT_EXT", 0x90F0}, + {"GL_MULTIVIEW_EXT", 0x90F1}, + {"GL_MAX_MULTIVIEW_BUFFERS_EXT", 0x90F2}, + {"GL_COMPUTE_PROGRAM_NV", 0x90FB}, + {"GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV", 0x90FC}, + {"GL_TEXTURE_2D_MULTISAMPLE", 0x9100}, + {"GL_PROXY_TEXTURE_2D_MULTISAMPLE", 0x9101}, + {"GL_TEXTURE_2D_MULTISAMPLE_ARRAY", 0x9102}, + {"GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY", 0x9103}, + {"GL_TEXTURE_BINDING_2D_MULTISAMPLE", 0x9104}, + {"GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", 0x9105}, + {"GL_TEXTURE_SAMPLES", 0x9106}, + {"GL_TEXTURE_FIXED_SAMPLE_LOCATIONS", 0x9107}, + {"GL_SAMPLER_2D_MULTISAMPLE", 0x9108}, + {"GL_INT_SAMPLER_2D_MULTISAMPLE", 0x9109}, + {"GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE", 0x910A}, + {"GL_SAMPLER_2D_MULTISAMPLE_ARRAY", 0x910B}, + {"GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY", 0x910C}, + {"GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY", 0x910D}, + {"GL_MAX_COLOR_TEXTURE_SAMPLES", 0x910E}, + {"GL_MAX_DEPTH_TEXTURE_SAMPLES", 0x910F}, + {"GL_MAX_INTEGER_SAMPLES", 0x9110}, + {"GL_MAX_SERVER_WAIT_TIMEOUT", 0x9111}, + {"GL_MAX_SERVER_WAIT_TIMEOUT_APPLE", 0x9111}, + {"GL_OBJECT_TYPE", 0x9112}, + {"GL_OBJECT_TYPE_APPLE", 0x9112}, + {"GL_SYNC_CONDITION", 0x9113}, + {"GL_SYNC_CONDITION_APPLE", 0x9113}, + {"GL_SYNC_STATUS", 0x9114}, + {"GL_SYNC_STATUS_APPLE", 0x9114}, + {"GL_SYNC_FLAGS", 0x9115}, + {"GL_SYNC_FLAGS_APPLE", 0x9115}, + {"GL_SYNC_FENCE", 0x9116}, + {"GL_SYNC_FENCE_APPLE", 0x9116}, + {"GL_SYNC_GPU_COMMANDS_COMPLETE", 0x9117}, + {"GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE", 0x9117}, + {"GL_UNSIGNALED", 0x9118}, + {"GL_UNSIGNALED_APPLE", 0x9118}, + {"GL_SIGNALED", 0x9119}, + {"GL_SIGNALED_APPLE", 0x9119}, + {"GL_ALREADY_SIGNALED", 0x911A}, + {"GL_ALREADY_SIGNALED_APPLE", 0x911A}, + {"GL_TIMEOUT_EXPIRED", 0x911B}, + {"GL_TIMEOUT_EXPIRED_APPLE", 0x911B}, + {"GL_CONDITION_SATISFIED", 0x911C}, + {"GL_CONDITION_SATISFIED_APPLE", 0x911C}, + {"GL_WAIT_FAILED", 0x911D}, + {"GL_WAIT_FAILED_APPLE", 0x911D}, + {"GL_BUFFER_ACCESS_FLAGS", 0x911F}, + {"GL_BUFFER_MAP_LENGTH", 0x9120}, + {"GL_BUFFER_MAP_OFFSET", 0x9121}, + {"GL_MAX_VERTEX_OUTPUT_COMPONENTS", 0x9122}, + {"GL_MAX_GEOMETRY_INPUT_COMPONENTS", 0x9123}, + {"GL_MAX_GEOMETRY_OUTPUT_COMPONENTS", 0x9124}, + {"GL_MAX_FRAGMENT_INPUT_COMPONENTS", 0x9125}, + {"GL_CONTEXT_PROFILE_MASK", 0x9126}, + {"GL_UNPACK_COMPRESSED_BLOCK_WIDTH", 0x9127}, + {"GL_UNPACK_COMPRESSED_BLOCK_HEIGHT", 0x9128}, + {"GL_UNPACK_COMPRESSED_BLOCK_DEPTH", 0x9129}, + {"GL_UNPACK_COMPRESSED_BLOCK_SIZE", 0x912A}, + {"GL_PACK_COMPRESSED_BLOCK_WIDTH", 0x912B}, + {"GL_PACK_COMPRESSED_BLOCK_HEIGHT", 0x912C}, + {"GL_PACK_COMPRESSED_BLOCK_DEPTH", 0x912D}, + {"GL_PACK_COMPRESSED_BLOCK_SIZE", 0x912E}, + {"GL_TEXTURE_IMMUTABLE_FORMAT", 0x912F}, + {"GL_SGX_PROGRAM_BINARY_IMG", 0x9130}, + {"GL_RENDERBUFFER_SAMPLES_IMG", 0x9133}, + {"GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG", 0x9134}, + {"GL_MAX_SAMPLES_IMG", 0x9135}, + {"GL_TEXTURE_SAMPLES_IMG", 0x9136}, + {"GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG", 0x9137}, + {"GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG", 0x9138}, + {"GL_MAX_DEBUG_MESSAGE_LENGTH", 0x9143}, + {"GL_MAX_DEBUG_MESSAGE_LENGTH_AMD", 0x9143}, + {"GL_MAX_DEBUG_MESSAGE_LENGTH_ARB", 0x9143}, + {"GL_MAX_DEBUG_MESSAGE_LENGTH_KHR", 0x9143}, + {"GL_MAX_DEBUG_LOGGED_MESSAGES", 0x9144}, + {"GL_MAX_DEBUG_LOGGED_MESSAGES_AMD", 0x9144}, + {"GL_MAX_DEBUG_LOGGED_MESSAGES_ARB", 0x9144}, + {"GL_MAX_DEBUG_LOGGED_MESSAGES_KHR", 0x9144}, + {"GL_DEBUG_LOGGED_MESSAGES", 0x9145}, + {"GL_DEBUG_LOGGED_MESSAGES_AMD", 0x9145}, + {"GL_DEBUG_LOGGED_MESSAGES_ARB", 0x9145}, + {"GL_DEBUG_LOGGED_MESSAGES_KHR", 0x9145}, + {"GL_DEBUG_SEVERITY_HIGH", 0x9146}, + {"GL_DEBUG_SEVERITY_HIGH_AMD", 0x9146}, + {"GL_DEBUG_SEVERITY_HIGH_ARB", 0x9146}, + {"GL_DEBUG_SEVERITY_HIGH_KHR", 0x9146}, + {"GL_DEBUG_SEVERITY_MEDIUM", 0x9147}, + {"GL_DEBUG_SEVERITY_MEDIUM_AMD", 0x9147}, + {"GL_DEBUG_SEVERITY_MEDIUM_ARB", 0x9147}, + {"GL_DEBUG_SEVERITY_MEDIUM_KHR", 0x9147}, + {"GL_DEBUG_SEVERITY_LOW", 0x9148}, + {"GL_DEBUG_SEVERITY_LOW_AMD", 0x9148}, + {"GL_DEBUG_SEVERITY_LOW_ARB", 0x9148}, + {"GL_DEBUG_SEVERITY_LOW_KHR", 0x9148}, + {"GL_DEBUG_CATEGORY_API_ERROR_AMD", 0x9149}, + {"GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD", 0x914A}, + {"GL_DEBUG_CATEGORY_DEPRECATION_AMD", 0x914B}, + {"GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD", 0x914C}, + {"GL_DEBUG_CATEGORY_PERFORMANCE_AMD", 0x914D}, + {"GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD", 0x914E}, + {"GL_DEBUG_CATEGORY_APPLICATION_AMD", 0x914F}, + {"GL_DEBUG_CATEGORY_OTHER_AMD", 0x9150}, + {"GL_BUFFER_OBJECT_EXT", 0x9151}, + {"GL_DATA_BUFFER_AMD", 0x9151}, + {"GL_PERFORMANCE_MONITOR_AMD", 0x9152}, + {"GL_QUERY_OBJECT_AMD", 0x9153}, + {"GL_QUERY_OBJECT_EXT", 0x9153}, + {"GL_VERTEX_ARRAY_OBJECT_AMD", 0x9154}, + {"GL_VERTEX_ARRAY_OBJECT_EXT", 0x9154}, + {"GL_SAMPLER_OBJECT_AMD", 0x9155}, + {"GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD", 0x9160}, + {"GL_QUERY_BUFFER", 0x9192}, + {"GL_QUERY_BUFFER_AMD", 0x9192}, + {"GL_QUERY_BUFFER_BINDING", 0x9193}, + {"GL_QUERY_BUFFER_BINDING_AMD", 0x9193}, + {"GL_QUERY_RESULT_NO_WAIT", 0x9194}, + {"GL_QUERY_RESULT_NO_WAIT_AMD", 0x9194}, + {"GL_VIRTUAL_PAGE_SIZE_X_ARB", 0x9195}, + {"GL_VIRTUAL_PAGE_SIZE_X_AMD", 0x9195}, + {"GL_VIRTUAL_PAGE_SIZE_Y_ARB", 0x9196}, + {"GL_VIRTUAL_PAGE_SIZE_Y_AMD", 0x9196}, + {"GL_VIRTUAL_PAGE_SIZE_Z_ARB", 0x9197}, + {"GL_VIRTUAL_PAGE_SIZE_Z_AMD", 0x9197}, + {"GL_MAX_SPARSE_TEXTURE_SIZE_ARB", 0x9198}, + {"GL_MAX_SPARSE_TEXTURE_SIZE_AMD", 0x9198}, + {"GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB", 0x9199}, + {"GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD", 0x9199}, + {"GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB", 0x919A}, + {"GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS", 0x919A}, + {"GL_MIN_SPARSE_LEVEL_ARB", 0x919B}, + {"GL_MIN_SPARSE_LEVEL_AMD", 0x919B}, + {"GL_MIN_LOD_WARNING_AMD", 0x919C}, + {"GL_TEXTURE_BUFFER_OFFSET", 0x919D}, + {"GL_TEXTURE_BUFFER_SIZE", 0x919E}, + {"GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT", 0x919F}, + {"GL_VERTEX_ELEMENT_SWIZZLE_AMD", 0x91A4}, + {"GL_VERTEX_ID_SWIZZLE_AMD", 0x91A5}, + {"GL_TEXTURE_SPARSE_ARB", 0x91A6}, + {"GL_VIRTUAL_PAGE_SIZE_INDEX_ARB", 0x91A7}, + {"GL_NUM_VIRTUAL_PAGE_SIZES_ARB", 0x91A8}, + {"GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB", 0x91A9}, + {"GL_COMPUTE_SHADER", 0x91B9}, + {"GL_MAX_COMPUTE_UNIFORM_BLOCKS", 0x91BB}, + {"GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS", 0x91BC}, + {"GL_MAX_COMPUTE_IMAGE_UNIFORMS", 0x91BD}, + {"GL_MAX_COMPUTE_WORK_GROUP_COUNT", 0x91BE}, + {"GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB", 0x91BF}, + {"GL_MAX_COMPUTE_WORK_GROUP_SIZE", 0x91BF}, + {"GL_UNPACK_FLIP_Y_WEBGL", 0x9240}, + {"GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL", 0x9241}, + {"GL_CONTEXT_LOST_WEBGL", 0x9242}, + {"GL_UNPACK_COLORSPACE_CONVERSION_WEBGL", 0x9243}, + {"GL_BROWSER_DEFAULT_WEBGL", 0x9244}, + {"GL_SHADER_BINARY_DMP", 0x9250}, + {"GL_GCCSO_SHADER_BINARY_FJ", 0x9260}, + {"GL_COMPRESSED_R11_EAC", 0x9270}, + {"GL_COMPRESSED_R11_EAC_OES", 0x9270}, + {"GL_COMPRESSED_SIGNED_R11_EAC", 0x9271}, + {"GL_COMPRESSED_SIGNED_R11_EAC_OES", 0x9271}, + {"GL_COMPRESSED_RG11_EAC", 0x9272}, + {"GL_COMPRESSED_RG11_EAC_OES", 0x9272}, + {"GL_COMPRESSED_SIGNED_RG11_EAC", 0x9273}, + {"GL_COMPRESSED_SIGNED_RG11_EAC_OES", 0x9273}, + {"GL_COMPRESSED_RGB8_ETC2", 0x9274}, + {"GL_COMPRESSED_RGB8_ETC2_OES", 0x9274}, + {"GL_COMPRESSED_SRGB8_ETC2", 0x9275}, + {"GL_COMPRESSED_SRGB8_ETC2_OES", 0x9275}, + {"GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", 0x9276}, + {"GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2_OES", 0x9276}, + {"GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", 0x9277}, + {"GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2_OES", 0x9277}, + {"GL_COMPRESSED_RGBA8_ETC2_EAC", 0x9278}, + {"GL_COMPRESSED_RGBA8_ETC2_EAC_OES", 0x9278}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", 0x9279}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC_OES", 0x9279}, + {"GL_BLEND_PREMULTIPLIED_SRC_NV", 0x9280}, + {"GL_BLEND_OVERLAP_NV", 0x9281}, + {"GL_UNCORRELATED_NV", 0x9282}, + {"GL_DISJOINT_NV", 0x9283}, + {"GL_CONJOINT_NV", 0x9284}, + {"GL_BLEND_ADVANCED_COHERENT_NV", 0x9285}, + {"GL_SRC_NV", 0x9286}, + {"GL_DST_NV", 0x9287}, + {"GL_SRC_OVER_NV", 0x9288}, + {"GL_DST_OVER_NV", 0x9289}, + {"GL_SRC_IN_NV", 0x928A}, + {"GL_DST_IN_NV", 0x928B}, + {"GL_SRC_OUT_NV", 0x928C}, + {"GL_DST_OUT_NV", 0x928D}, + {"GL_SRC_ATOP_NV", 0x928E}, + {"GL_DST_ATOP_NV", 0x928F}, + {"GL_PLUS_NV", 0x9291}, + {"GL_PLUS_DARKER_NV", 0x9292}, + {"GL_MULTIPLY_NV", 0x9294}, + {"GL_SCREEN_NV", 0x9295}, + {"GL_OVERLAY_NV", 0x9296}, + {"GL_DARKEN_NV", 0x9297}, + {"GL_LIGHTEN_NV", 0x9298}, + {"GL_COLORDODGE_NV", 0x9299}, + {"GL_COLORBURN_NV", 0x929A}, + {"GL_HARDLIGHT_NV", 0x929B}, + {"GL_SOFTLIGHT_NV", 0x929C}, + {"GL_DIFFERENCE_NV", 0x929E}, + {"GL_MINUS_NV", 0x929F}, + {"GL_EXCLUSION_NV", 0x92A0}, + {"GL_CONTRAST_NV", 0x92A1}, + {"GL_INVERT_RGB_NV", 0x92A3}, + {"GL_LINEARDODGE_NV", 0x92A4}, + {"GL_LINEARBURN_NV", 0x92A5}, + {"GL_VIVIDLIGHT_NV", 0x92A6}, + {"GL_LINEARLIGHT_NV", 0x92A7}, + {"GL_PINLIGHT_NV", 0x92A8}, + {"GL_HARDMIX_NV", 0x92A9}, + {"GL_HSL_HUE_NV", 0x92AD}, + {"GL_HSL_SATURATION_NV", 0x92AE}, + {"GL_HSL_COLOR_NV", 0x92AF}, + {"GL_HSL_LUMINOSITY_NV", 0x92B0}, + {"GL_PLUS_CLAMPED_NV", 0x92B1}, + {"GL_PLUS_CLAMPED_ALPHA_NV", 0x92B2}, + {"GL_MINUS_CLAMPED_NV", 0x92B3}, + {"GL_INVERT_OVG_NV", 0x92B4}, + {"GL_ATOMIC_COUNTER_BUFFER", 0x92C0}, + {"GL_ATOMIC_COUNTER_BUFFER_BINDING", 0x92C1}, + {"GL_ATOMIC_COUNTER_BUFFER_START", 0x92C2}, + {"GL_ATOMIC_COUNTER_BUFFER_SIZE", 0x92C3}, + {"GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE", 0x92C4}, + {"GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS", 0x92C5}, + {"GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES", 0x92C6}, + {"GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER", 0x92C7}, + {"GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER", 0x92C8}, + {"GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER", 0x92C9}, + {"GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER", 0x92CA}, + {"GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER", 0x92CB}, + {"GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS", 0x92CC}, + {"GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS", 0x92CD}, + {"GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS", 0x92CE}, + {"GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS", 0x92CF}, + {"GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS", 0x92D0}, + {"GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS", 0x92D1}, + {"GL_MAX_VERTEX_ATOMIC_COUNTERS", 0x92D2}, + {"GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS", 0x92D3}, + {"GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS", 0x92D4}, + {"GL_MAX_GEOMETRY_ATOMIC_COUNTERS", 0x92D5}, + {"GL_MAX_FRAGMENT_ATOMIC_COUNTERS", 0x92D6}, + {"GL_MAX_COMBINED_ATOMIC_COUNTERS", 0x92D7}, + {"GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE", 0x92D8}, + {"GL_ACTIVE_ATOMIC_COUNTER_BUFFERS", 0x92D9}, + {"GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX", 0x92DA}, + {"GL_UNSIGNED_INT_ATOMIC_COUNTER", 0x92DB}, + {"GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS", 0x92DC}, + {"GL_DEBUG_OUTPUT", 0x92E0}, + {"GL_DEBUG_OUTPUT_KHR", 0x92E0}, + {"GL_UNIFORM", 0x92E1}, + {"GL_UNIFORM_BLOCK", 0x92E2}, + {"GL_PROGRAM_INPUT", 0x92E3}, + {"GL_PROGRAM_OUTPUT", 0x92E4}, + {"GL_BUFFER_VARIABLE", 0x92E5}, + {"GL_SHADER_STORAGE_BLOCK", 0x92E6}, + {"GL_IS_PER_PATCH", 0x92E7}, + {"GL_VERTEX_SUBROUTINE", 0x92E8}, + {"GL_TESS_CONTROL_SUBROUTINE", 0x92E9}, + {"GL_TESS_EVALUATION_SUBROUTINE", 0x92EA}, + {"GL_GEOMETRY_SUBROUTINE", 0x92EB}, + {"GL_FRAGMENT_SUBROUTINE", 0x92EC}, + {"GL_COMPUTE_SUBROUTINE", 0x92ED}, + {"GL_VERTEX_SUBROUTINE_UNIFORM", 0x92EE}, + {"GL_TESS_CONTROL_SUBROUTINE_UNIFORM", 0x92EF}, + {"GL_TESS_EVALUATION_SUBROUTINE_UNIFORM", 0x92F0}, + {"GL_GEOMETRY_SUBROUTINE_UNIFORM", 0x92F1}, + {"GL_FRAGMENT_SUBROUTINE_UNIFORM", 0x92F2}, + {"GL_COMPUTE_SUBROUTINE_UNIFORM", 0x92F3}, + {"GL_TRANSFORM_FEEDBACK_VARYING", 0x92F4}, + {"GL_ACTIVE_RESOURCES", 0x92F5}, + {"GL_MAX_NAME_LENGTH", 0x92F6}, + {"GL_MAX_NUM_ACTIVE_VARIABLES", 0x92F7}, + {"GL_MAX_NUM_COMPATIBLE_SUBROUTINES", 0x92F8}, + {"GL_NAME_LENGTH", 0x92F9}, + {"GL_TYPE", 0x92FA}, + {"GL_ARRAY_SIZE", 0x92FB}, + {"GL_OFFSET", 0x92FC}, + {"GL_BLOCK_INDEX", 0x92FD}, + {"GL_ARRAY_STRIDE", 0x92FE}, + {"GL_MATRIX_STRIDE", 0x92FF}, + {"GL_IS_ROW_MAJOR", 0x9300}, + {"GL_ATOMIC_COUNTER_BUFFER_INDEX", 0x9301}, + {"GL_BUFFER_BINDING", 0x9302}, + {"GL_BUFFER_DATA_SIZE", 0x9303}, + {"GL_NUM_ACTIVE_VARIABLES", 0x9304}, + {"GL_ACTIVE_VARIABLES", 0x9305}, + {"GL_REFERENCED_BY_VERTEX_SHADER", 0x9306}, + {"GL_REFERENCED_BY_TESS_CONTROL_SHADER", 0x9307}, + {"GL_REFERENCED_BY_TESS_EVALUATION_SHADER", 0x9308}, + {"GL_REFERENCED_BY_GEOMETRY_SHADER", 0x9309}, + {"GL_REFERENCED_BY_FRAGMENT_SHADER", 0x930A}, + {"GL_REFERENCED_BY_COMPUTE_SHADER", 0x930B}, + {"GL_TOP_LEVEL_ARRAY_SIZE", 0x930C}, + {"GL_TOP_LEVEL_ARRAY_STRIDE", 0x930D}, + {"GL_LOCATION", 0x930E}, + {"GL_LOCATION_INDEX", 0x930F}, + {"GL_FRAMEBUFFER_DEFAULT_WIDTH", 0x9310}, + {"GL_FRAMEBUFFER_DEFAULT_HEIGHT", 0x9311}, + {"GL_FRAMEBUFFER_DEFAULT_LAYERS", 0x9312}, + {"GL_FRAMEBUFFER_DEFAULT_SAMPLES", 0x9313}, + {"GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS", 0x9314}, + {"GL_MAX_FRAMEBUFFER_WIDTH", 0x9315}, + {"GL_MAX_FRAMEBUFFER_HEIGHT", 0x9316}, + {"GL_MAX_FRAMEBUFFER_LAYERS", 0x9317}, + {"GL_MAX_FRAMEBUFFER_SAMPLES", 0x9318}, + {"GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB", 0x9344}, + {"GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB", 0x9345}, + {"GL_LOCATION_COMPONENT", 0x934A}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_INDEX", 0x934B}, + {"GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE", 0x934C}, + {"GL_CLEAR_TEXTURE", 0x9365}, + {"GL_NUM_SAMPLE_COUNTS", 0x9380}, + {"GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE", 0x93A0}, + {"GL_TEXTURE_USAGE_ANGLE", 0x93A2}, + {"GL_FRAMEBUFFER_ATTACHMENT_ANGLE", 0x93A3}, + {"GL_PACK_REVERSE_ROW_ORDER_ANGLE", 0x93A4}, + {"GL_PROGRAM_BINARY_ANGLE", 0x93A6}, + {"GL_COMPRESSED_RGBA_ASTC_4x4_KHR", 0x93B0}, + {"GL_COMPRESSED_RGBA_ASTC_5x4_KHR", 0x93B1}, + {"GL_COMPRESSED_RGBA_ASTC_5x5_KHR", 0x93B2}, + {"GL_COMPRESSED_RGBA_ASTC_6x5_KHR", 0x93B3}, + {"GL_COMPRESSED_RGBA_ASTC_6x6_KHR", 0x93B4}, + {"GL_COMPRESSED_RGBA_ASTC_8x5_KHR", 0x93B5}, + {"GL_COMPRESSED_RGBA_ASTC_8x6_KHR", 0x93B6}, + {"GL_COMPRESSED_RGBA_ASTC_8x8_KHR", 0x93B7}, + {"GL_COMPRESSED_RGBA_ASTC_10x5_KHR", 0x93B8}, + {"GL_COMPRESSED_RGBA_ASTC_10x6_KHR", 0x93B9}, + {"GL_COMPRESSED_RGBA_ASTC_10x8_KHR", 0x93BA}, + {"GL_COMPRESSED_RGBA_ASTC_10x10_KHR", 0x93BB}, + {"GL_COMPRESSED_RGBA_ASTC_12x10_KHR", 0x93BC}, + {"GL_COMPRESSED_RGBA_ASTC_12x12_KHR", 0x93BD}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR", 0x93D0}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR", 0x93D1}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR", 0x93D2}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR", 0x93D3}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR", 0x93D4}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR", 0x93D5}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR", 0x93D6}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR", 0x93D7}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR", 0x93D8}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR", 0x93D9}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR", 0x93DA}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR", 0x93DB}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR", 0x93DC}, + {"GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR", 0x93DD}, + {"GL_RASTER_POSITION_UNCLIPPED_IBM", 0x19262}, + {"GL_CULL_VERTEX_IBM", 103050}, + {"GL_ALL_STATIC_DATA_IBM", 103060}, + {"GL_STATIC_VERTEX_ARRAY_IBM", 103061}, + {"GL_VERTEX_ARRAY_LIST_IBM", 103070}, + {"GL_NORMAL_ARRAY_LIST_IBM", 103071}, + {"GL_COLOR_ARRAY_LIST_IBM", 103072}, + {"GL_INDEX_ARRAY_LIST_IBM", 103073}, + {"GL_TEXTURE_COORD_ARRAY_LIST_IBM", 103074}, + {"GL_EDGE_FLAG_ARRAY_LIST_IBM", 103075}, + {"GL_FOG_COORDINATE_ARRAY_LIST_IBM", 103076}, + {"GL_SECONDARY_COLOR_ARRAY_LIST_IBM", 103077}, + {"GL_VERTEX_ARRAY_LIST_STRIDE_IBM", 103080}, + {"GL_NORMAL_ARRAY_LIST_STRIDE_IBM", 103081}, + {"GL_COLOR_ARRAY_LIST_STRIDE_IBM", 103082}, + {"GL_INDEX_ARRAY_LIST_STRIDE_IBM", 103083}, + {"GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM", 103084}, + {"GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM", 103085}, + {"GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM", 103086}, + {"GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM", 103087}, + {"GL_PREFER_DOUBLEBUFFER_HINT_PGI", 0x1A1F8}, + {"GL_CONSERVE_MEMORY_HINT_PGI", 0x1A1FD}, + {"GL_RECLAIM_MEMORY_HINT_PGI", 0x1A1FE}, + {"GL_NATIVE_GRAPHICS_HANDLE_PGI", 0x1A202}, + {"GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI", 0x1A203}, + {"GL_NATIVE_GRAPHICS_END_HINT_PGI", 0x1A204}, + {"GL_ALWAYS_FAST_HINT_PGI", 0x1A20C}, + {"GL_ALWAYS_SOFT_HINT_PGI", 0x1A20D}, + {"GL_ALLOW_DRAW_OBJ_HINT_PGI", 0x1A20E}, + {"GL_ALLOW_DRAW_WIN_HINT_PGI", 0x1A20F}, + {"GL_ALLOW_DRAW_FRG_HINT_PGI", 0x1A210}, + {"GL_ALLOW_DRAW_MEM_HINT_PGI", 0x1A211}, + {"GL_STRICT_DEPTHFUNC_HINT_PGI", 0x1A216}, + {"GL_STRICT_LIGHTING_HINT_PGI", 0x1A217}, + {"GL_STRICT_SCISSOR_HINT_PGI", 0x1A218}, + {"GL_FULL_STIPPLE_HINT_PGI", 0x1A219}, + {"GL_CLIP_NEAR_HINT_PGI", 0x1A220}, + {"GL_CLIP_FAR_HINT_PGI", 0x1A221}, + {"GL_WIDE_LINE_HINT_PGI", 0x1A222}, + {"GL_BACK_NORMALS_HINT_PGI", 0x1A223}, + {"GL_VERTEX_DATA_HINT_PGI", 0x1A22A}, + {"GL_VERTEX_CONSISTENT_HINT_PGI", 0x1A22B}, + {"GL_MATERIAL_SIDE_HINT_PGI", 0x1A22C}, + {"GL_MAX_VERTEX_HINT_PGI", 0x1A22D}, + {"GL_MAX_CLIP_PLANES_IMG", 0x0D32}, + {"GL_TEXTURE_GEN_MODE_OES", 0x2500}, + {"GL_CLIP_PLANE0_IMG", 0x3000}, + {"GL_CLIP_PLANE1_IMG", 0x3001}, + {"GL_CLIP_PLANE2_IMG", 0x3002}, + {"GL_CLIP_PLANE3_IMG", 0x3003}, + {"GL_CLIP_PLANE4_IMG", 0x3004}, + {"GL_CLIP_PLANE5_IMG", 0x3005}, + {"GL_ALPHA8_OES", 0x803C}, + {"GL_LUMINANCE8_OES", 0x8040}, + {"GL_LUMINANCE4_ALPHA4_OES", 0x8043}, + {"GL_LUMINANCE8_ALPHA8_OES", 0x8045}, + {"GL_RGB8_OES", 0x8051}, + {"GL_TEXTURE_BINDING_3D_OES", 0x806A}, + {"GL_BGRA_IMG", 0x80E1}, + {"GL_TEXTURE_MAX_LEVEL_APPLE", 0x813D}, + {"GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT", 0x8210}, + {"GL_R32F_EXT", 0x822E}, + {"GL_RG32F_EXT", 0x8230}, + {"GL_LOSE_CONTEXT_ON_RESET_EXT", 0x8252}, + {"GL_GUILTY_CONTEXT_RESET_EXT", 0x8253}, + {"GL_INNOCENT_CONTEXT_RESET_EXT", 0x8254}, + {"GL_UNKNOWN_CONTEXT_RESET_EXT", 0x8255}, + {"GL_RESET_NOTIFICATION_STRATEGY_EXT", 0x8256}, + {"GL_NO_RESET_NOTIFICATION_EXT", 0x8261}, + {"GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG", 0x8365}, + {"GL_VERTEX_ARRAY_BINDING_OES", 0x85B5}, + {"GL_RGBA32F_EXT", 0x8814}, + {"GL_RGB32F_EXT", 0x8815}, + {"GL_ALPHA32F_EXT", 0x8816}, + {"GL_LUMINANCE32F_EXT", 0x8818}, + {"GL_LUMINANCE_ALPHA32F_EXT", 0x8819}, + {"GL_ALPHA16F_EXT", 0x881C}, + {"GL_LUMINANCE16F_EXT", 0x881E}, + {"GL_LUMINANCE_ALPHA16F_EXT", 0x881F}, + {"GL_DRAW_FRAMEBUFFER_BINDING_ANGLE", 0x8CA6}, + {"GL_DRAW_FRAMEBUFFER_BINDING_APPLE", 0x8CA6}, + {"GL_READ_FRAMEBUFFER_APPLE", 0x8CA8}, + {"GL_DRAW_FRAMEBUFFER_APPLE", 0x8CA9}, + {"GL_READ_FRAMEBUFFER_BINDING_ANGLE", 0x8CAA}, + {"GL_READ_FRAMEBUFFER_BINDING_APPLE", 0x8CAA}, + {"GL_RENDERBUFFER_SAMPLES_APPLE", 0x8CAB}, + {"GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE", 0x8D56}, + {"GL_MAX_SAMPLES_APPLE", 0x8D57}, + {"GL_CONTEXT_ROBUST_ACCESS_EXT", 0x90F3}, + {"GL_TEXTURE_IMMUTABLE_FORMAT_EXT", 0x912F}, + {"GL_BGRA8_EXT", 0x93A1}, + {0, 0} +}; + +struct OpenGLEnum_u +{ + const char *name; + unsigned value; +}; + +static OpenGLEnum_u openGLEnums_u[] = { + {"GL_INVALID_INDEX", 0xFFFFFFFFu}, + {0, 0} +}; + +struct OpenGLEnum_ull +{ + const char *name; + unsigned long long value; +}; + +static OpenGLEnum_ull openGLEnums_ull[] = { + {"GL_TIMEOUT_IGNORED", 0xFFFFFFFFFFFFFFFFull}, + {"GL_TIMEOUT_IGNORED_APPLE", 0xFFFFFFFFFFFFFFFFull}, + {0, 0} +}; + + +/* + * Add the OpenGL constants to a Python object. Return -1 and raise an + * exception on error. + */ +int qpyopengl_add_constants(PyObject *obj) +{ + int i, rc; + PyObject *py_value; + + for (i = 0; openGLEnums_i[i].name; ++i) + { + py_value = PyLong_FromLong(openGLEnums_i[i].value); + + if (!py_value) + return -1; + + rc = PyObject_SetAttrString(obj, openGLEnums_i[i].name, py_value); + Py_DECREF(py_value); + + if (rc < 0) + return -1; + } + + for (i = 0; openGLEnums_u[i].name; ++i) + { + py_value = PyLong_FromUnsignedLong(openGLEnums_u[i].value); + + if (!py_value) + return -1; + + rc = PyObject_SetAttrString(obj, openGLEnums_u[i].name, py_value); + Py_DECREF(py_value); + + if (rc < 0) + return -1; + } + + for (i = 0; openGLEnums_ull[i].name; ++i) + { + py_value = PyLong_FromUnsignedLongLong(openGLEnums_ull[i].value); + + if (!py_value) + return -1; + + rc = PyObject_SetAttrString(obj, openGLEnums_ull[i].name, py_value); + Py_DECREF(py_value); + + if (rc < 0) + return -1; + } + + return 0; +} + diff --git a/qpy/QtOpenGL/qpyopengl_api.h b/qpy/QtOpenGL/qpyopengl_api.h new file mode 100644 index 0000000..806d171 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_api.h @@ -0,0 +1,69 @@ +// This defines the OpenGL related API provided by this library. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYOPENGL_API_H +#define _QPYOPENGL_API_H + + +#include + +#include + +#include "sipAPIQtOpenGL.h" + + +// Initialisation. +void qpyopengl_init(); + +// Support for shader arrays. +const GLfloat *qpyopengl_attribute_array(PyObject *values, PyObject *shader, + PyObject *key, int *tsize, sipErrorState *estate); +const void *qpyopengl_uniform_value_array(PyObject *values, PyObject *shader, + PyObject *key, const sipTypeDef **array_type, int *array_len, + int *tsize, sipErrorState *estate); + +// Support for QOpenGLVersionFunctionsFactory.get(). +class QOpenGLContext; +class QOpenGLVersionProfile; + +PyObject *qpyopengl_version_functions( + const QOpenGLVersionProfile &version_profile, QOpenGLContext *context, + PyObject *py_context); + +// Support for the OpenGL bindings. +const GLvoid *qpyopengl_value_array(sipErrorState *estate, PyObject *values, + GLenum gl_type, PyObject *bindings); +const GLvoid *qpyopengl_value_array_cached(sipErrorState *estate, + PyObject *values, GLenum gl_type, PyObject *bindings, const char *pkey, + GLuint skey); +GLint qpyopengl_get(GLenum pname, GLenum *query); +PyObject *qpyopengl_from_GLint(int *eflag, const GLint *array, Py_ssize_t len); +PyObject *qpyopengl_from_GLuint(int *eflag, const GLuint *array, + Py_ssize_t len); +PyObject *qpyopengl_from_GLboolean(int *eflag, const GLboolean *array, + Py_ssize_t len); +PyObject *qpyopengl_from_GLfloat(int *eflag, const GLfloat *array, + Py_ssize_t len); +#if !defined(SIP_FEATURE_PyQt_OpenGL_ES2) +PyObject *qpyopengl_from_GLdouble(int *eflag, const GLdouble *array, + Py_ssize_t len); +#endif + +#endif diff --git a/qpy/QtOpenGL/qpyopengl_array_convertors.cpp b/qpy/QtOpenGL/qpyopengl_array_convertors.cpp new file mode 100644 index 0000000..516175f --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_array_convertors.cpp @@ -0,0 +1,189 @@ +// This contains the support for converting QOpenGL arrays to Python objects. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpyopengl_api.h" + + +// Convert a GLint array to a Python object. +PyObject *qpyopengl_from_GLint(int *eflag, const GLint *array, Py_ssize_t len) +{ + if (len == 1) + return PyLong_FromLong(array[0]); + + PyObject *tuple = PyTuple_New(len); + + if (!tuple) + { + *eflag = 1; + return 0; + } + + for (Py_ssize_t i = 0; i < len; ++i) + { + PyObject *itm = PyLong_FromLong(array[i]); + + if (!itm) + { + Py_DECREF(tuple); + *eflag = 1; + return 0; + } + + PyTuple_SetItem(tuple, i, itm); + } + + return tuple; +} + + +// Convert a GLuint array to a Python object. +PyObject *qpyopengl_from_GLuint(int *eflag, const GLuint *array, + Py_ssize_t len) +{ + if (len == 1) + return PyLong_FromUnsignedLong(array[0]); + + PyObject *tuple = PyTuple_New(len); + + if (!tuple) + { + *eflag = 1; + return 0; + } + + for (Py_ssize_t i = 0; i < len; ++i) + { + PyObject *itm = PyLong_FromUnsignedLong(array[i]); + + if (!itm) + { + Py_DECREF(tuple); + *eflag = 1; + return 0; + } + + PyTuple_SetItem(tuple, i, itm); + } + + return tuple; +} + + +// Convert a GLboolean array to a Python object. +PyObject *qpyopengl_from_GLboolean(int *eflag, const GLboolean *array, + Py_ssize_t len) +{ + if (len == 1) + return PyBool_FromLong(array[0]); + + PyObject *tuple = PyTuple_New(len); + + if (!tuple) + { + *eflag = 1; + return 0; + } + + for (Py_ssize_t i = 0; i < len; ++i) + { + PyObject *itm = PyBool_FromLong(array[i]); + + if (!itm) + { + Py_DECREF(tuple); + *eflag = 1; + return 0; + } + + PyTuple_SetItem(tuple, i, itm); + } + + return tuple; +} + + +// Convert a GLfloat array to a Python object. +PyObject *qpyopengl_from_GLfloat(int *eflag, const GLfloat *array, + Py_ssize_t len) +{ + if (len == 1) + return PyFloat_FromDouble(array[0]); + + PyObject *tuple = PyTuple_New(len); + + if (!tuple) + { + *eflag = 1; + return 0; + } + + for (Py_ssize_t i = 0; i < len; ++i) + { + PyObject *itm = PyFloat_FromDouble(array[i]); + + if (!itm) + { + Py_DECREF(tuple); + *eflag = 1; + return 0; + } + + PyTuple_SetItem(tuple, i, itm); + } + + return tuple; +} + + +#if !defined(SIP_FEATURE_PyQt_OpenGL_ES2) +// Convert a GLdouble array to a Python object. +PyObject *qpyopengl_from_GLdouble(int *eflag, const GLdouble *array, + Py_ssize_t len) +{ + if (len == 1) + return PyFloat_FromDouble(array[0]); + + PyObject *tuple = PyTuple_New(len); + + if (!tuple) + { + *eflag = 1; + return 0; + } + + for (Py_ssize_t i = 0; i < len; ++i) + { + PyObject *itm = PyFloat_FromDouble(array[i]); + + if (!itm) + { + Py_DECREF(tuple); + *eflag = 1; + return 0; + } + + PyTuple_SetItem(tuple, i, itm); + } + + return tuple; +} +#endif diff --git a/qpy/QtOpenGL/qpyopengl_attribute_array.cpp b/qpy/QtOpenGL/qpyopengl_attribute_array.cpp new file mode 100644 index 0000000..43f48d3 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_attribute_array.cpp @@ -0,0 +1,269 @@ +// This contains the support for shader program attribute arrays. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include + +#include "qpyopengl_api.h" +#include "qpyopengl_misc.h" + + +// Forward declaratations. +static void array_dtor(PyObject *capsule); + + +// Parse a Python object as a sequence of either QVector[234]D instances or a +// sequence of sequence of floats and return an array that can be passed to +// QGLShaderProgram::setAttributeArray(). The array is destroyed only when the +// shader is garbage collected or when replaced by another array. +const GLfloat *qpyopengl_attribute_array(PyObject *values, PyObject *shader, + PyObject *key, int *tsize, sipErrorState *estate) +{ + // Check the key was created correctly. + if (!key) + { + *estate = sipErrorFail; + return 0; + } + + // Get the dict that holds the converted arrays. + PyObject *dict = sipGetUserObject((sipSimpleWrapper *)shader); + + if (!dict) + { + dict = PyDict_New(); + + if (!dict) + { + Py_DECREF(key); + + *estate = sipErrorFail; + return 0; + } + + sipSetUserObject((sipSimpleWrapper *)shader, dict); + } + + // Check that values is a non-empty sequence. + values = PySequence_Fast(values, "an attribute array must be a sequence"); + + if (!values) + { + Py_DECREF(key); + + *estate = sipErrorContinue; + return 0; + } + + Py_ssize_t nr_items = Sequence_Fast_Size(values); + + if (nr_items < 1) + { + PyErr_SetString(PyExc_TypeError, + "an attribute array must have at least one element"); + + Py_DECREF(key); + Py_DECREF(values); + + *estate = sipErrorFail; + return 0; + } + + // The first element determines the type expected. + PyObject *itm = Sequence_Fast_GetItem(values, 0); + + const sipTypeDef *td; + Py_ssize_t nr_dim; + + if (sipCanConvertToType(itm, sipType_QVector2D, SIP_NOT_NONE)) + { + td = sipType_QVector2D; + nr_dim = 2; + } + else if (sipCanConvertToType(itm, sipType_QVector3D, SIP_NOT_NONE)) + { + td = sipType_QVector3D; + nr_dim = 3; + } + else if (sipCanConvertToType(itm, sipType_QVector4D, SIP_NOT_NONE)) + { + td = sipType_QVector4D; + nr_dim = 4; + } + else if (PySequence_Check(itm) && (nr_dim = PySequence_Size(itm)) >= 1) + { + td = 0; + } + else + { + PyErr_SetString(PyExc_TypeError, + "an attribute array must be a sequence of QVector2D, " + "QVector3D, QVector4D, or a sequence of sequences of floats"); + + Py_DECREF(key); + Py_DECREF(values); + + *estate = sipErrorFail; + return 0; + } + + // Create the array that will be returned. + GLfloat *array = new GLfloat[nr_items * nr_dim]; + + // Convert the values. + GLfloat *ap = array; + + for (Py_ssize_t i = 0; i < nr_items; ++i) + { + int iserr = 0; + + itm = Sequence_Fast_GetItem(values, i); + + if (td) + { + void *cpp; + + cpp = sipForceConvertToType(itm, td, 0, + SIP_NOT_NONE | SIP_NO_CONVERTORS, 0, &iserr); + + if (iserr) + { + PyErr_Format(PyExc_TypeError, + "attribute array elements should all be '%s', not '%s'", + sipPyTypeName(sipTypeAsPyTypeObject(td)), + sipPyTypeName(Py_TYPE(itm))); + } + else if (td == sipType_QVector2D) + { + QVector2D *v = reinterpret_cast(cpp); + + *ap++ = v->x(); + *ap++ = v->y(); + } + else if (td == sipType_QVector3D) + { + QVector3D *v = reinterpret_cast(cpp); + + *ap++ = v->x(); + *ap++ = v->y(); + *ap++ = v->z(); + } + else if (td == sipType_QVector4D) + { + QVector4D *v = reinterpret_cast(cpp); + + *ap++ = v->x(); + *ap++ = v->y(); + *ap++ = v->z(); + *ap++ = v->w(); + } + } + else + { + itm = PySequence_Fast(itm, + "attribute array elements should all be sequences"); + + if (itm) + { + if (Sequence_Fast_Size(itm) != nr_dim) + { + PyErr_Format(PyExc_TypeError, + "attribute array elements should all be sequences " + "of length %zd", + nr_dim); + + Py_DECREF(itm); + iserr = 1; + } + else + { + PyErr_Clear(); + + for (Py_ssize_t j = 0; j < nr_dim; ++j) + *ap++ = PyFloat_AsDouble(Sequence_Fast_GetItem(itm, j)); + + if (PyErr_Occurred()) + { + PyErr_SetString(PyExc_TypeError, + "attribute array elements should all be " + "sequences of floats"); + + Py_DECREF(itm); + iserr = 1; + } + } + } + else + { + iserr = 1; + } + } + + if (iserr) + { + Py_DECREF(key); + Py_DECREF(values); + delete[] array; + + *estate = sipErrorFail; + return 0; + } + } + + Py_DECREF(values); + + *tsize = nr_dim; + + // Wrap the array in a Python object so that it won't leak. + PyObject *array_obj = PyCapsule_New(array, 0, array_dtor); + + if (!array_obj) + { + Py_DECREF(key); + delete[] array; + + *estate = sipErrorFail; + return 0; + } + + int rc = PyDict_SetItem(dict, key, array_obj); + + Py_DECREF(key); + Py_DECREF(array_obj); + + if (rc < 0) + { + *estate = sipErrorFail; + return 0; + } + + return array; +} + + +// The dtor for the saved attribute array. +static void array_dtor(PyObject *capsule) +{ + delete[] reinterpret_cast(PyCapsule_GetPointer(capsule, 0)); +} diff --git a/qpy/QtOpenGL/qpyopengl_data_cache.cpp b/qpy/QtOpenGL/qpyopengl_data_cache.cpp new file mode 100644 index 0000000..4509009 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_data_cache.cpp @@ -0,0 +1,239 @@ +// This is the implementation of dataCache. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpyopengl_data_cache.h" + + +// The type object. +PyTypeObject *qpyopengl_dataCache_TypeObject; + + +// Forward declarations. +extern "C" { +static int dataCache_clear(PyObject *self); +static void dataCache_dealloc(PyObject *self); +static int dataCache_traverse(PyObject *self, visitproc visit, void *arg); +} + + +// Define the slots. +static PyType_Slot qpyopengl_dataCache_Slots[] = { + {Py_tp_dealloc, (void *)dataCache_dealloc}, + {Py_tp_clear, (void *)dataCache_clear}, + {Py_tp_traverse, (void *)dataCache_traverse}, + {0, 0} +}; + + +// Define the type. +static PyType_Spec qpyopengl_dataCache_Spec = { + "PyQt6.QtGui.dataCache", + sizeof (qpyopengl_dataCache), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC, + qpyopengl_dataCache_Slots +}; + + +// The dataCache clear function. +static int dataCache_clear(PyObject *self) +{ + qpyopengl_dataCache *data_cache = (qpyopengl_dataCache *)self; + + Array *uncached = data_cache->uncached; + + if (uncached) + { + data_cache->uncached = 0; + + uncached->clear(); + delete uncached; + } + + PrimaryCache *pcache = data_cache->pcache; + + if (pcache) + { + data_cache->pcache = 0; + + PrimaryCache::const_iterator pit = pcache->constBegin(); + + while (pit != pcache->constEnd()) + { + delete *pit; + ++pit; + } + + delete pcache; + } + + return 0; +} + + +// The dataCache dealloc function. +static void dataCache_dealloc(PyObject *self) +{ + PyObject_GC_UnTrack(self); + + dataCache_clear(self); + + PyObject_GC_Del(self); +} + + +// The dataCache traverse function. +static int dataCache_traverse(PyObject *self, visitproc visit, void *arg) +{ + qpyopengl_dataCache *data_cache = (qpyopengl_dataCache *)self; + int vret; + + Array *uncached = data_cache->uncached; + + if (uncached) + { + vret = uncached->traverse(visit, arg); + + if (vret != 0) + return vret; + } + + PrimaryCache *pcache = data_cache->pcache; + + if (pcache) + { + PrimaryCache::const_iterator pit = pcache->constBegin(); + + while (pit != pcache->constEnd()) + { + PrimaryCacheEntry *pce = *pit; + + vret = pce->skey_0.traverse(visit, arg); + + if (vret != 0) + return vret; + + SecondaryCache *scache = pce->skey_n; + + if (scache) + { + SecondaryCache::const_iterator sit = scache->constBegin(); + + while (sit != scache->constEnd()) + { + vret = (*sit)->traverse(visit, arg); + + if (vret != 0) + return vret; + + ++sit; + } + } + + ++pit; + } + } + + return 0; +} + + +// Initialise the type and return true if there was no error. +bool qpyopengl_dataCache_init_type() +{ + qpyopengl_dataCache_TypeObject = (PyTypeObject *)PyType_FromSpec( + &qpyopengl_dataCache_Spec); + + return qpyopengl_dataCache_TypeObject; +} + + +// Create a new data cache. +qpyopengl_dataCache *qpyopengl_dataCache_New() +{ + return (qpyopengl_dataCache *)PyType_GenericAlloc( + qpyopengl_dataCache_TypeObject, 0); +} + + +// PrimaryCacheEntry ctor. +PrimaryCacheEntry::PrimaryCacheEntry() : skey_n(0) +{ +} + + +// PrimaryCacheEntry dtor. +PrimaryCacheEntry::~PrimaryCacheEntry() +{ + if (skey_n) + { + SecondaryCache::const_iterator sit = skey_n->constBegin(); + + while (sit != skey_n->constEnd()) + { + delete (*sit); + ++sit; + } + + delete skey_n; + + skey_n = 0; + } +} + + +// Array ctor. +Array::Array() : data(0) +{ + buffer.bi_obj = 0; +} + + +// Array dtor. +Array::~Array() +{ + clear(); +} + + +// Clear the array. +void Array::clear() +{ + if (data) + { + sipFree(data); + data = 0; + } + else if (buffer.bi_obj) + { + sipReleaseBufferInfo(&buffer); + } +} + + +// Traverse the array. +int Array::traverse(visitproc visit, void *arg) +{ + PyObject *obj = buffer.bi_obj; + + return obj ? visit(obj, arg) : 0; +} diff --git a/qpy/QtOpenGL/qpyopengl_data_cache.h b/qpy/QtOpenGL/qpyopengl_data_cache.h new file mode 100644 index 0000000..722f8a6 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_data_cache.h @@ -0,0 +1,96 @@ +// This contains the definitions for the implementation of dataCache. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYOPENGL_DATACACHE_H +#define _QPYOPENGL_DATACACHE_H + + +#include + +#include + +#include "sipAPIQtOpenGL.h" + + +// The wrapper around the actual array memory. +struct Array +{ + Array(); + ~Array(); + + // Clear the array. + void clear(); + + // Traverse the array for the garbage collector. + int traverse(visitproc visit, void *arg); + + // The data. If it is 0 then any data is provided by an object that + // implements the buffer protocol. + void *data; + + // The buffer information. The obj element is a reference to the object + // that implements the buffer protocol. + sipBufferInfoDef buffer; +}; + +typedef QHash SecondaryCache; + + +// The cache for all value arrays for a particular primary key. +struct PrimaryCacheEntry +{ + PrimaryCacheEntry(); + ~PrimaryCacheEntry(); + + // The cache entry for a secondary key of zero. + Array skey_0; + + // The cache entries for all non-zero secondary keys. + SecondaryCache *skey_n; +}; + +typedef QHash PrimaryCache; + + +extern "C" { + +// This defines the structure of a data cache for OpenGL. +typedef struct { + PyObject_HEAD + + // The most recent uncached array, if any. + Array *uncached; + + // The primary cache. + PrimaryCache *pcache; +} qpyopengl_dataCache; + +} + + +// The type object. +extern PyTypeObject *qpyopengl_dataCache_TypeObject; + + +bool qpyopengl_dataCache_init_type(); +qpyopengl_dataCache *qpyopengl_dataCache_New(); + + +#endif diff --git a/qpy/QtOpenGL/qpyopengl_get.cpp b/qpy/QtOpenGL/qpyopengl_get.cpp new file mode 100644 index 0000000..683d8c1 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_get.cpp @@ -0,0 +1,174 @@ +// This implements support common to all glGet functions. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "qpyopengl_api.h" + + +// Return the number of values returned for a particular parameter, or the +// subsequent query needed to obtain the number of values. +GLint qpyopengl_get(GLenum pname, GLenum *query) +{ + GLint nr_params = 0; + + switch (pname) + { +#if defined(GL_COMPRESSED_TEXTURE_FORMATS) + case GL_COMPRESSED_TEXTURE_FORMATS: + *query = GL_NUM_COMPRESSED_TEXTURE_FORMATS; + break; +#endif + +#if defined(GL_PROGRAM_BINARY_FORMATS) + case GL_PROGRAM_BINARY_FORMATS: + *query = GL_NUM_PROGRAM_BINARY_FORMATS; + break; +#endif + +#if defined(GL_SHADER_BINARY_FORMATS) + case GL_SHADER_BINARY_FORMATS: + *query = GL_NUM_SHADER_BINARY_FORMATS; + break; +#endif + +#if defined(GL_COLOR_MATRIX) + case GL_COLOR_MATRIX: +#endif +#if defined(GL_MODELVIEW_MATRIX) + case GL_MODELVIEW_MATRIX: +#endif +#if defined(GL_PROJECTION_MATRIX) + case GL_PROJECTION_MATRIX: +#endif +#if defined(GL_TEXTURE_MATRIX) + case GL_TEXTURE_MATRIX: +#endif +#if defined(GL_TRANSPOSE_COLOR_MATRIX) + case GL_TRANSPOSE_COLOR_MATRIX: +#endif +#if defined(GL_TRANSPOSE_MODELVIEW_MATRIX) + case GL_TRANSPOSE_MODELVIEW_MATRIX: +#endif +#if defined(GL_TRANSPOSE_PROJECTION_MATRIX) + case GL_TRANSPOSE_PROJECTION_MATRIX: +#endif +#if defined(GL_TRANSPOSE_TEXTURE_MATRIX) + case GL_TRANSPOSE_TEXTURE_MATRIX: +#endif + nr_params = 16; + break; + +#if defined(GL_ACCUM_CLEAR_VALUE) + case GL_ACCUM_CLEAR_VALUE: +#endif +#if defined(GL_BLEND_COLOR) + case GL_BLEND_COLOR: +#endif +#if defined(GL_COLOR_CLEAR_VALUE) + case GL_COLOR_CLEAR_VALUE: +#endif +#if defined(GL_COLOR_WRITEMASK) + case GL_COLOR_WRITEMASK: +#endif +#if defined(GL_CURRENT_COLOR) + case GL_CURRENT_COLOR: +#endif +#if defined(GL_CURRENT_RASTER_COLOR) + case GL_CURRENT_RASTER_COLOR: +#endif +#if defined(GL_CURRENT_RASTER_POSITION) + case GL_CURRENT_RASTER_POSITION: +#endif +#if defined(GL_CURRENT_RASTER_SECONDARY_COLOR) + case GL_CURRENT_RASTER_SECONDARY_COLOR: +#endif +#if defined(GL_CURRENT_RASTER_TEXTURE_COORDS) + case GL_CURRENT_RASTER_TEXTURE_COORDS: +#endif +#if defined(GL_CURRENT_SECONDARY_COLOR) + case GL_CURRENT_SECONDARY_COLOR: +#endif +#if defined(GL_CURRENT_TEXTURE_COORDS) + case GL_CURRENT_TEXTURE_COORDS: +#endif +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif +#if defined(GL_MAP2_GRID_DOMAIN) + case GL_MAP2_GRID_DOMAIN: +#endif +#if defined(GL_SCISSOR_BOX) + case GL_SCISSOR_BOX: +#endif +#if defined(GL_VIEWPORT) + case GL_VIEWPORT: +#endif + nr_params = 4; + break; + +#if defined(GL_SMOOTH_POINT_SIZE_RANGE) + case GL_SMOOTH_POINT_SIZE_RANGE: +#endif +#if defined(GL_POINT_SIZE_RANGE) && (!defined(GL_SMOOTH_POINT_SIZE_RANGE) || GL_SMOOTH_POINT_SIZE_RANGE != GL_POINT_SIZE_RANGE) + case GL_POINT_SIZE_RANGE: +#endif + +#if defined(GL_SMOOTH_LINE_WIDTH_RANGE) + case GL_SMOOTH_LINE_WIDTH_RANGE: +#endif +#if defined(GL_LINE_WIDTH_RANGE) && (!defined(GL_SMOOTH_LINE_WIDTH_RANGE) || GL_SMOOTH_LINE_WIDTH_RANGE != GL_LINE_WIDTH_RANGE) + case GL_LINE_WIDTH_RANGE: +#endif + +#if defined(GL_ALIASED_POINT_SIZE_RANGE) + case GL_ALIASED_POINT_SIZE_RANGE: +#endif +#if defined(GL_ALIASED_LINE_WIDTH_RANGE) + case GL_ALIASED_LINE_WIDTH_RANGE: +#endif +#if defined(GL_DEPTH_RANGE) + case GL_DEPTH_RANGE: +#endif +#if defined(GL_MAP1_GRID_DOMAIN) + case GL_MAP1_GRID_DOMAIN: +#endif +#if defined(GL_MAP2_GRID_SEGMENTS) + case GL_MAP2_GRID_SEGMENTS: +#endif +#if defined(GL_MAX_VIEWPORT_DIMS) + case GL_MAX_VIEWPORT_DIMS: +#endif +#if defined(GL_POLYGON_MODE) + case GL_POLYGON_MODE: +#endif +#if defined(GL_VIEWPORT_BOUNDS_RANGE) + case GL_VIEWPORT_BOUNDS_RANGE: +#endif + nr_params = 2; + break; + + default: + nr_params = 1; + } + + return nr_params; +} diff --git a/qpy/QtOpenGL/qpyopengl_init.cpp b/qpy/QtOpenGL/qpyopengl_init.cpp new file mode 100644 index 0000000..c10e040 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_init.cpp @@ -0,0 +1,33 @@ +// This is the initialisation support code for the QtOpenGL module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpyopengl_api.h" +#include "qpyopengl_data_cache.h" + + +// Perform any required initialisation. +void qpyopengl_init() +{ + // Initialise the OpenGL data cache type. + if (!qpyopengl_dataCache_init_type()) + Py_FatalError("PyQt6.QtGui: Failed to initialise dataCache type"); +} diff --git a/qpy/QtOpenGL/qpyopengl_misc.h b/qpy/QtOpenGL/qpyopengl_misc.h new file mode 100644 index 0000000..df749d4 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_misc.h @@ -0,0 +1,35 @@ +// This defines the interfaces to various odd and ends. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYOPENGL_MISC_H +#define _QPYOPENGL_MISC_H + + +#include + + +// Replacements for the corresponding Python macros that use the limited API. +#define Sequence_Fast_Size(o) \ + (PyList_Check(o) ? PyList_Size(o) : PyTuple_Size(o)) +#define Sequence_Fast_GetItem(o, i)\ + (PyList_Check(o) ? PyList_GetItem(o, i) : PyTuple_GetItem(o, i)) + + +#endif diff --git a/qpy/QtOpenGL/qpyopengl_uniform_value_array.cpp b/qpy/QtOpenGL/qpyopengl_uniform_value_array.cpp new file mode 100644 index 0000000..004c0ee --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_uniform_value_array.cpp @@ -0,0 +1,420 @@ +// This contains the support for shader program uniform value arrays. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "qpyopengl_api.h" +#include "qpyopengl_misc.h" + + +// Forward declaratations. +static void delete_array(void *array, const sipTypeDef *td); +static void array_dtor(PyObject *capsule); + + +// Parse a Python object as a sequence of either QVector[234]D or +// QMatrix[234]x[234] instances, or a sequence of sequence of floats and return +// an array that can be passed to QOpenGLShaderProgram::setUniformValueArray(). +// The array is destroyed only when the shader is garbage collected or when +// replaced by another array. +const void *qpyopengl_uniform_value_array(PyObject *values, PyObject *shader, + PyObject *key, const sipTypeDef **array_type, int *array_len, + int *tsize, sipErrorState *estate) +{ + // Check the key was created correctly. + if (!key) + { + *estate = sipErrorFail; + return 0; + } + + // Get the dict that holds the converted arrays. + PyObject *dict = sipGetUserObject((sipSimpleWrapper *)shader); + + if (!dict) + { + dict = PyDict_New(); + + if (!dict) + { + Py_DECREF(key); + + *estate = sipErrorFail; + return 0; + } + + sipSetUserObject((sipSimpleWrapper *)shader, dict); + } + + // Check that values is a non-empty sequence. + values = PySequence_Fast(values, + "a uniform value array must be a sequence"); + + if (!values) + { + Py_DECREF(key); + + *estate = sipErrorContinue; + return 0; + } + + Py_ssize_t nr_items = Sequence_Fast_Size(values); + + if (nr_items < 1) + { + PyErr_SetString(PyExc_TypeError, + "a uniform value array must have at least one element"); + + Py_DECREF(key); + Py_DECREF(values); + + *estate = sipErrorFail; + return 0; + } + + // The first element determines the type expected. + PyObject *itm = Sequence_Fast_GetItem(values, 0); + + const sipTypeDef *td; + Py_ssize_t nr_dim = 0; + void *array; + + if (sipCanConvertToType(itm, sipType_QVector2D, SIP_NOT_NONE)) + { + td = sipType_QVector2D; + array = new QVector2D[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QVector3D, SIP_NOT_NONE)) + { + td = sipType_QVector3D; + array = new QVector3D[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QVector4D, SIP_NOT_NONE)) + { + td = sipType_QVector4D; + array = new QVector4D[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QMatrix2x2, SIP_NOT_NONE)) + { + td = sipType_QMatrix2x2; + array = new QMatrix2x2[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QMatrix2x3, SIP_NOT_NONE)) + { + td = sipType_QMatrix2x3; + array = new QMatrix2x3[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QMatrix2x4, SIP_NOT_NONE)) + { + td = sipType_QMatrix2x4; + array = new QMatrix2x4[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QMatrix3x2, SIP_NOT_NONE)) + { + td = sipType_QMatrix3x2; + array = new QMatrix3x2[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QMatrix3x3, SIP_NOT_NONE)) + { + td = sipType_QMatrix3x3; + array = new QMatrix3x3[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QMatrix3x4, SIP_NOT_NONE)) + { + td = sipType_QMatrix3x4; + array = new QMatrix3x4[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QMatrix4x2, SIP_NOT_NONE)) + { + td = sipType_QMatrix4x2; + array = new QMatrix4x2[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QMatrix4x3, SIP_NOT_NONE)) + { + td = sipType_QMatrix4x3; + array = new QMatrix4x3[nr_items]; + } + else if (sipCanConvertToType(itm, sipType_QMatrix4x4, SIP_NOT_NONE)) + { + td = sipType_QMatrix4x4; + array = new QMatrix4x4[nr_items]; + } + else if (PySequence_Check(itm) && (nr_dim = PySequence_Size(itm)) >= 1) + { + td = 0; + array = new GLfloat[nr_items * nr_dim]; + } + else + { + PyErr_SetString(PyExc_TypeError, + "a uniform value array must be a sequence of QVector2D, " + "QVector3D, QVector4D, QMatrix2x2, QMatrix2x3, QMatrix2x4, " + "QMatrix3x2, QMatrix3x3, QMatrix3x4, QMatrix4x2, QMatrix4x3, " + "QMatrix4x4, or a sequence of sequences of floats"); + + Py_DECREF(key); + Py_DECREF(values); + + *estate = sipErrorFail; + return 0; + } + + // Convert the values. + for (Py_ssize_t i = 0; i < nr_items; ++i) + { + int iserr = 0; + + itm = Sequence_Fast_GetItem(values, i); + + if (td) + { + void *cpp; + + cpp = sipForceConvertToType(itm, td, 0, + SIP_NOT_NONE | SIP_NO_CONVERTORS, 0, &iserr); + + if (iserr) + { + PyErr_Format(PyExc_TypeError, + "uniform value array elements should all be '%s', not " + "'%s'", + sipPyTypeName(sipTypeAsPyTypeObject(td)), + sipPyTypeName(Py_TYPE(itm))); + } + else if (td == sipType_QVector2D) + { + QVector2D *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QVector3D) + { + QVector3D *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QVector4D) + { + QVector4D *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QMatrix2x2) + { + QMatrix2x2 *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QMatrix2x3) + { + QMatrix2x3 *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QMatrix2x4) + { + QMatrix2x4 *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QMatrix3x2) + { + QMatrix3x2 *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QMatrix3x3) + { + QMatrix3x3 *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QMatrix3x4) + { + QMatrix3x4 *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QMatrix4x2) + { + QMatrix4x2 *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QMatrix4x3) + { + QMatrix4x3 *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + else if (td == sipType_QMatrix4x4) + { + QMatrix4x4 *a = reinterpret_cast(array); + + a[i] = *reinterpret_cast(cpp); + } + } + else + { + itm = PySequence_Fast(itm, + "uniform value array elements should all be sequences"); + + if (itm) + { + if (Sequence_Fast_Size(itm) != nr_dim) + { + PyErr_Format(PyExc_TypeError, + "uniform value array elements should all be " + "sequences of length %zd", + nr_dim); + + Py_DECREF(itm); + iserr = 1; + } + else + { + GLfloat *ap = reinterpret_cast(array); + + PyErr_Clear(); + + for (Py_ssize_t j = 0; j < nr_dim; ++j) + *ap++ = PyFloat_AsDouble( + Sequence_Fast_GetItem(itm, j)); + + if (PyErr_Occurred()) + { + PyErr_SetString(PyExc_TypeError, + "uniform value array elements should all be " + "sequences of floats"); + + Py_DECREF(itm); + iserr = 1; + } + } + } + else + { + iserr = 1; + } + } + + if (iserr) + { + Py_DECREF(key); + Py_DECREF(values); + delete_array(array, td); + + *estate = sipErrorFail; + return 0; + } + } + + Py_DECREF(values); + + // Wrap the array in a Python object so that it won't leak. + PyObject *array_obj = PyCapsule_New(array, 0, array_dtor); + + if (array_obj && PyCapsule_SetContext(array_obj, const_cast(td)) != 0) + { + Py_DECREF(array_obj); + array_obj = 0; + } + + if (!array_obj) + { + Py_DECREF(key); + delete_array(array, td); + + *estate = sipErrorFail; + return 0; + } + + int rc = PyDict_SetItem(dict, key, array_obj); + + Py_DECREF(key); + Py_DECREF(array_obj); + + if (rc < 0) + { + *estate = sipErrorFail; + return 0; + } + + *array_type = td; + *array_len = nr_items; + *tsize = nr_dim; + + return array; +} + + +// Do the actual work of deleting the array. +static void delete_array(void *array, const sipTypeDef *td) +{ + if (td == sipType_QVector2D) + delete[] reinterpret_cast(array); + else if (td == sipType_QVector3D) + delete[] reinterpret_cast(array); + else if (td == sipType_QVector4D) + delete[] reinterpret_cast(array); + else if (td == sipType_QMatrix2x2) + delete[] reinterpret_cast(array); + else if (td == sipType_QMatrix2x3) + delete[] reinterpret_cast(array); + else if (td == sipType_QMatrix2x4) + delete[] reinterpret_cast(array); + else if (td == sipType_QMatrix3x2) + delete[] reinterpret_cast(array); + else if (td == sipType_QMatrix3x3) + delete[] reinterpret_cast(array); + else if (td == sipType_QMatrix3x4) + delete[] reinterpret_cast(array); + else if (td == sipType_QMatrix4x2) + delete[] reinterpret_cast(array); + else if (td == sipType_QMatrix4x3) + delete[] reinterpret_cast(array); + else if (td == sipType_QMatrix4x4) + delete[] reinterpret_cast(array); + else + delete[] reinterpret_cast(array); +} + + +// The dtor for the saved array. +static void array_dtor(PyObject *capsule) +{ + delete_array(PyCapsule_GetPointer(capsule, 0), + reinterpret_cast( + PyCapsule_GetContext(capsule))); +} diff --git a/qpy/QtOpenGL/qpyopengl_value_array.cpp b/qpy/QtOpenGL/qpyopengl_value_array.cpp new file mode 100644 index 0000000..15ac2b0 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_value_array.cpp @@ -0,0 +1,396 @@ +// This contains the support for QOpenGL value arrays. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpyopengl_api.h" +#include "qpyopengl_data_cache.h" +#include "qpyopengl_misc.h" + + +#if !defined(SIP_FEATURE_PyQt_OpenGL_ES2) && GL_DOUBLE != GL_FLOAT +#define HAVE_GL_DOUBLE +#endif + + +// Forward declarations. +static qpyopengl_dataCache *get_cache(PyObject *bindings); +static void *convert_values(Array *cache, PyObject *values, + GLenum gl_type, sipErrorState *estate); +static void convert_byte(PyObject *itm, void *array, Py_ssize_t i); +static void convert_ubyte(PyObject *itm, void *array, Py_ssize_t i); +static void convert_short(PyObject *itm, void *array, Py_ssize_t i); +static void convert_ushort(PyObject *itm, void *array, Py_ssize_t i); +static void convert_int(PyObject *itm, void *array, Py_ssize_t i); +static void convert_uint(PyObject *itm, void *array, Py_ssize_t i); +static void convert_float(PyObject *itm, void *array, Py_ssize_t i); +#if defined(HAVE_GL_DOUBLE) +static void convert_double(PyObject *itm, void *array, Py_ssize_t i); +#endif + + +// Get an array of OpenGL fundamental types from a sequence or an object that +// implements a compatible buffer. +const GLvoid *qpyopengl_value_array(sipErrorState *estate, PyObject *values, + GLenum gl_type, PyObject *bindings) +{ + // Handle the trivial None case first. 0 has a special meaning to some + // OpenGL calls so we allow it for all. If this becomes a problem then we + // can add a new variant of this function that handles None differently. + if (values == Py_None) + return 0; + + qpyopengl_dataCache *data_cache = get_cache(bindings); + + if (!data_cache) + { + *estate = sipErrorFail; + return 0; + } + + // Get an empty wrapper for the array. + if (data_cache->uncached) + data_cache->uncached->clear(); + else + data_cache->uncached = new Array; + + return convert_values(data_cache->uncached, values, gl_type, estate); +} + + +// Get an array of OpenGL fundamental types from a sequence or an object that +// implements a compatible buffer. Cache the array so that it persists until a +// similar call. +const GLvoid *qpyopengl_value_array_cached(sipErrorState *estate, + PyObject *values, GLenum gl_type, PyObject *bindings, const char *pkey, + GLuint skey) +{ + // Handle the trivial byte offset case first. + PyErr_Clear(); + + void *data = PyLong_AsVoidPtr(values); + + if (!PyErr_Occurred()) + return data; + + PyErr_Clear(); + + qpyopengl_dataCache *data_cache = get_cache(bindings); + + if (!data_cache) + { + *estate = sipErrorFail; + return 0; + } + + if (!data_cache->pcache) + data_cache->pcache = new PrimaryCache; + + // Get an empty wrapper for the array. + PrimaryCacheEntry *pce = (*data_cache->pcache)[pkey]; + + if (!pce) + { + pce = new PrimaryCacheEntry; + data_cache->pcache->insert(pkey, pce); + } + + Array *array; + + if (skey == 0) + { + array = &pce->skey_0; + } + else + { + if (!pce->skey_n) + pce->skey_n = new SecondaryCache; + + array = (*pce->skey_n)[skey]; + + if (!array) + { + array = new Array; + pce->skey_n->insert(skey, array); + } + } + + array->clear(); + + return convert_values(array, values, gl_type, estate); +} + + +// Get the cache for a set of bindings. +static qpyopengl_dataCache *get_cache(PyObject *bindings) +{ + // Create the cache if it doesn't already exist. + qpyopengl_dataCache *data_cache = (qpyopengl_dataCache *)sipGetUserObject((sipSimpleWrapper *)bindings); + + if (!data_cache) + { + data_cache = qpyopengl_dataCache_New(); + + if (data_cache) + sipSetUserObject((sipSimpleWrapper *)bindings, + (PyObject *)data_cache); + } + + return data_cache; +} + + +// Convert the Python values to a raw array. +static void *convert_values(Array *array, PyObject *values, GLenum gl_type, + sipErrorState *estate) +{ + int rc = sipGetBufferInfo(values, &array->buffer); + + if (rc < 0) + { + *estate = sipErrorFail; + return 0; + } + + if (rc > 0) + { + // Check the buffer is compatible with what we need. + GLenum array_type; + + switch (*array->buffer.bi_format) + { + case 'b': + array_type = GL_BYTE; + break; + + case 'B': + array_type = GL_UNSIGNED_BYTE; + break; + + case 'h': + array_type = GL_SHORT; + break; + + case 'H': + array_type = GL_UNSIGNED_SHORT; + break; + + case 'i': + array_type = GL_INT; + break; + + case 'I': + array_type = GL_UNSIGNED_INT; + break; + + case 'f': + array_type = GL_FLOAT; + break; + +#if !defined(SIP_FEATURE_PyQt_OpenGL_ES2) + case 'd': + array_type = GL_DOUBLE; + break; +#endif + + default: + PyErr_Format(PyExc_TypeError, "unsupported buffer type '%s'", + array->buffer.bi_format); + *estate = sipErrorFail; + return 0; + } + + if (array_type != gl_type) + { + PyErr_SetString(PyExc_TypeError, + "the buffer type is not the same as the array type"); + *estate = sipErrorFail; + return 0; + } + + return array->buffer.bi_buf; + } + + PyObject *seq = PySequence_Fast(values, + "array must be a sequence or a buffer"); + + if (!seq) + { + *estate = sipErrorContinue; + return 0; + } + + Py_ssize_t nr_items = Sequence_Fast_Size(seq); + + if (nr_items < 1) + { + Py_DECREF(seq); + + PyErr_SetString(PyExc_TypeError, + "array must have at least one element"); + *estate = sipErrorFail; + return 0; + } + + void (*convertor)(PyObject *, void *, Py_ssize_t); + size_t element_size; + + switch (gl_type) + { + case GL_BYTE: + convertor = convert_byte; + element_size = sizeof (GLbyte); + break; + + case GL_UNSIGNED_BYTE: + convertor = convert_ubyte; + element_size = sizeof (GLubyte); + break; + + case GL_SHORT: + convertor = convert_short; + element_size = sizeof (GLshort); + break; + + case GL_UNSIGNED_SHORT: + convertor = convert_ushort; + element_size = sizeof (GLushort); + break; + + case GL_INT: + convertor = convert_int; + element_size = sizeof (GLint); + break; + + case GL_UNSIGNED_INT: + convertor = convert_uint; + element_size = sizeof (GLuint); + break; + + case GL_FLOAT: + convertor = convert_float; + element_size = sizeof (GLfloat); + break; + +#if defined(HAVE_GL_DOUBLE) + case GL_DOUBLE: + convertor = convert_double; + element_size = sizeof (GLdouble); + break; +#endif + + default: + Py_DECREF(seq); + + PyErr_SetString(PyExc_TypeError, "unsupported GL element type"); + *estate = sipErrorFail; + return 0; + } + + void *data = sipMalloc(nr_items * element_size); + + if (!data) + { + Py_DECREF(seq); + + *estate = sipErrorFail; + return 0; + } + + for (Py_ssize_t i = 0; i < nr_items; ++i) + { + PyErr_Clear(); + + convertor(Sequence_Fast_GetItem(seq, i), data, i); + + if (PyErr_Occurred()) + { + sipFree(data); + Py_DECREF(seq); + + *estate = sipErrorFail; + return 0; + } + } + + Py_DECREF(seq); + + array->data = data; + + return data; +} + + +// Convert a Python object to a GLbyte. +static void convert_byte(PyObject *itm, void *array, Py_ssize_t i) +{ + reinterpret_cast(array)[i] = sipLong_AsSignedChar(itm); +} + + +// Convert a Python object to a GLubyte. +static void convert_ubyte(PyObject *itm, void *array, Py_ssize_t i) +{ + reinterpret_cast(array)[i] = sipLong_AsUnsignedChar(itm); +} + + +// Convert a Python object to a GLshort. +static void convert_short(PyObject *itm, void *array, Py_ssize_t i) +{ + reinterpret_cast(array)[i] = sipLong_AsShort(itm); +} + + +// Convert a Python object to a GLushort. +static void convert_ushort(PyObject *itm, void *array, Py_ssize_t i) +{ + reinterpret_cast(array)[i] = sipLong_AsUnsignedShort(itm); +} + + +// Convert a Python object to a GLint. +static void convert_int(PyObject *itm, void *array, Py_ssize_t i) +{ + reinterpret_cast(array)[i] = sipLong_AsInt(itm); +} + + +// Convert a Python object to a GLuint. +static void convert_uint(PyObject *itm, void *array, Py_ssize_t i) +{ + reinterpret_cast(array)[i] = sipLong_AsUnsignedInt(itm); +} + + +// Convert a Python object to a GLfloat. +static void convert_float(PyObject *itm, void *array, Py_ssize_t i) +{ + reinterpret_cast(array)[i] = PyFloat_AsDouble(itm); +} + + +#if defined(HAVE_GL_DOUBLE) +// Convert a Python object to a GLdouble. +static void convert_double(PyObject *itm, void *array, Py_ssize_t i) +{ + reinterpret_cast(array)[i] = PyFloat_AsDouble(itm); +} +#endif diff --git a/qpy/QtOpenGL/qpyopengl_version_functions.cpp b/qpy/QtOpenGL/qpyopengl_version_functions.cpp new file mode 100644 index 0000000..f3be7d5 --- /dev/null +++ b/qpy/QtOpenGL/qpyopengl_version_functions.cpp @@ -0,0 +1,110 @@ +// This contains the support for QOpenGLVersionFunctionsFactory.get(). +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include + +#include "qpyopengl_api.h" + + +// Forward declarations. +int qpyopengl_add_constants(PyObject *obj); + + +// Create the Python object that wraps the requested OpenGL functions. +PyObject *qpyopengl_version_functions( + const QOpenGLVersionProfile &version_profile, QOpenGLContext *context, + PyObject *py_context) +{ + // Get a valid version profile if possible. + QOpenGLVersionProfile vp(version_profile); + + if (!vp.isValid() && context) + vp = QOpenGLVersionProfile(context->format()); + + // Create the functions. + QAbstractOpenGLFunctions *funcs = QOpenGLVersionFunctionsFactory::get(vp, + context); + + if (!funcs) + { + Py_INCREF(Py_None); + return Py_None; + } + + // Qt doesn't allow us to introspect the functions to find which set we + // have, so work out what it should be based on the version profile. + const sipTypeDef *td; + +#if !defined(SIP_FEATURE_PyQt_OpenGL_ES2) + QByteArray name("QOpenGLFunctions_"); + + QPair version = vp.version(); + name.append(QByteArray::number(version.first)); + name.append('_'); + name.append(QByteArray::number(version.second)); + + if (vp.hasProfiles()) + { + switch (vp.profile()) + { + case QSurfaceFormat::CoreProfile: + name.append("_Core"); + break; + + case QSurfaceFormat::CompatibilityProfile: + name.append("_Compatibility"); + break; + + default: + ; + } + } + + td = sipFindType(name.constData()); + if (!td) + { + PyErr_Format(PyExc_TypeError, "%s is not supported by PyQt6", + name.constData()); + + return SIP_NULLPTR; + } +#else + td = sipType_QOpenGLFunctions_ES2; +#endif + + // Ownership is with the context. + PyObject *funcs_obj = sipConvertFromType(funcs, td, py_context); + + if (funcs_obj) + { + if (qpyopengl_add_constants(funcs_obj) < 0) + { + Py_DECREF(funcs_obj); + funcs_obj = SIP_NULLPTR; + } + } + + return funcs_obj; +} diff --git a/qpy/QtQml/qpyqml_api.h b/qpy/QtQml/qpyqml_api.h new file mode 100644 index 0000000..675eab3 --- /dev/null +++ b/qpy/QtQml/qpyqml_api.h @@ -0,0 +1,63 @@ +// This defines the API provided by this library. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQML_API_H +#define _QPYQML_API_H + + +#include + +#include +#include +#include +#include + + +// Support for qmlRegisterType(). +int qpyqml_register_anonymous_type(PyTypeObject *py_type, const char *uri, + int major); +int qpyqml_register_library_type(PyTypeObject *py_type, const char *uri, + int major, int minor, const char *qml_name, PyTypeObject *attached); +int qpyqml_register_singleton_type(PyTypeObject *py_type, const char *uri, + int major, int minor, const char *type_name, PyObject *factory); +int qpyqml_register_uncreatable_type(PyTypeObject *py_type, const char *uri, + int major, int minor, const char *qml_name, const QString &reason); + +// Support for qmlAttachedPropertiesObject(). +QObject *qpyqml_find_proxy_for(QObject *proxied); + +// Support for QJSValue. +int qpyqml_canConvertTo_QJSValue(PyObject *py); +int qpyqml_convertTo_QJSValue(PyObject *py, PyObject *transferObj, + QJSValue **cpp, int *isErr); + +// Python exception handling. +typedef void (*pyqt6_qtqml_err_print_t)(); +extern pyqt6_qtqml_err_print_t pyqt6_qtqml_err_print; + +// Other imports from QtCore. +typedef const QMetaObject *(*pyqt6_qtqml_get_qmetaobject_t)(PyTypeObject *); +extern pyqt6_qtqml_get_qmetaobject_t pyqt6_qtqml_get_qmetaobject; + +// Initialisation. +void qpyqml_post_init(PyObject *module_dict); + + +#endif diff --git a/qpy/QtQml/qpyqml_listdata.cpp b/qpy/QtQml/qpyqml_listdata.cpp new file mode 100644 index 0000000..4dee5df --- /dev/null +++ b/qpy/QtQml/qpyqml_listdata.cpp @@ -0,0 +1,58 @@ +// This is the implementation of the ListData class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpyqml_listdata.h" + + +// Create a null instance. +ListData::ListData(PyObject *py_type_, PyObject *py_obj_, PyObject *py_list_, + PyObject *py_append_, PyObject *py_count_, PyObject *py_at_, + PyObject *py_clear_, QObject *parent) : QObject(parent), + py_type(py_type_), py_obj(py_obj_), py_list(py_list_), + py_append(py_append_), py_count(py_count_), py_at(py_at_), + py_clear(py_clear_) +{ + Py_XINCREF(py_type); + Py_XINCREF(py_obj); + Py_XINCREF(py_list); + Py_XINCREF(py_append); + Py_XINCREF(py_count); + Py_XINCREF(py_at); + Py_XINCREF(py_clear); +} + + +// Destroy the data. +ListData::~ListData() +{ + SIP_BLOCK_THREADS + + Py_XDECREF(py_type); + Py_XDECREF(py_obj); + Py_XDECREF(py_list); + Py_XDECREF(py_append); + Py_XDECREF(py_count); + Py_XDECREF(py_at); + Py_XDECREF(py_clear); + + SIP_UNBLOCK_THREADS +} diff --git a/qpy/QtQml/qpyqml_listdata.h b/qpy/QtQml/qpyqml_listdata.h new file mode 100644 index 0000000..a5522ad --- /dev/null +++ b/qpy/QtQml/qpyqml_listdata.h @@ -0,0 +1,50 @@ +// This is the definition of the ListData class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQML_LISTDATA_H +#define _QPYQML_LISTDATA_H + + +#include + +#include + + +class ListData : public QObject +{ + Q_OBJECT + +public: + ListData(PyObject *py_type, PyObject *py_obj, PyObject *py_list, + PyObject *py_append, PyObject *py_count, PyObject *py_at, + PyObject *py_clear, QObject *parent); + ~ListData(); + + PyObject *py_type; + PyObject *py_obj; + PyObject *py_list; + PyObject *py_append; + PyObject *py_count; + PyObject *py_at; + PyObject *py_clear; +}; + + +#endif diff --git a/qpy/QtQml/qpyqml_post_init.cpp b/qpy/QtQml/qpyqml_post_init.cpp new file mode 100644 index 0000000..2780f6a --- /dev/null +++ b/qpy/QtQml/qpyqml_post_init.cpp @@ -0,0 +1,69 @@ +// This is the initialisation support code for the QtQml module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpyqml_api.h" +#include "qpyqmllistproperty.h" +#include "qpyqmllistpropertywrapper.h" +#include "qpyqmlobject.h" + +#include "sipAPIQtQml.h" + + +// Imports from QtCore. +pyqt6_qtqml_err_print_t pyqt6_qtqml_err_print; + + +// Perform any required initialisation. +void qpyqml_post_init(PyObject *module_dict) +{ + // QtCore imports. + pyqt6_qtqml_err_print = (pyqt6_qtqml_err_print_t)sipImportSymbol( + "pyqt6_err_print"); + Q_ASSERT(pyqt6_qtqml_err_print); + + // Register the our list type. Note that Q_DECLARE_METATYPE doesn't seem + // to work. + qMetaTypeId >(); + + // Initialise the QQmlListProperty type. + if (!qpyqml_QQmlListProperty_init_type()) + Py_FatalError("PyQt6.QtQml: Failed to initialise QQmlListProperty type"); + + // Create the only instance and add it to the module dictionary. + PyObject *inst = PyObject_CallFunction( + (PyObject *)qpyqml_QQmlListProperty_TypeObject, "s", + "QQmlListProperty"); + + if (!inst) + Py_FatalError("PyQt6.QtQml: Failed to create QQmlListProperty instance"); + + if (PyDict_SetItemString(module_dict, "QQmlListProperty", inst) < 0) + Py_FatalError("PyQt6.QtQml: Failed to set QQmlListProperty instance"); + + // Initialise the private QQmlListPropertyWrapper type. + if (!qpyqml_QQmlListPropertyWrapper_init_type()) + Py_FatalError("PyQt6.QtQml: Failed to initialise QQmlListPropertyWrapper type"); + + // Register the proxy resolver. + if (sipRegisterProxyResolver(sipType_QObject, QPyQmlObjectProxy::resolveProxy) < 0) + Py_FatalError("PyQt6.QtQml: Failed to register proxy resolver"); +} diff --git a/qpy/QtQml/qpyqml_qjsvalue.cpp b/qpy/QtQml/qpyqml_qjsvalue.cpp new file mode 100644 index 0000000..1bbfb2e --- /dev/null +++ b/qpy/QtQml/qpyqml_qjsvalue.cpp @@ -0,0 +1,115 @@ +// This is the support for QJSValue. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "qpyqml_api.h" + +#include "sipAPIQtQml.h" + + +// See if a Python object can be converted to a QJSValue. +int qpyqml_canConvertTo_QJSValue(PyObject *py) +{ + // Note that the API doesn't provide the ability to test for a constrained + // named enum. + if (PyObject_TypeCheck(py, sipTypeAsPyTypeObject(sipType_QJSValue_SpecialValue))) + return 1; + + if (PyBool_Check(py)) + return 1; + + if (PyLong_Check(py)) + return 1; + + if (PyFloat_Check(py)) + return 1; + + if (sipCanConvertToType(py, sipType_QString, 0)) + return 1; + + return sipCanConvertToType(py, sipType_QJSValue, SIP_NO_CONVERTORS); +} + + +// Convert a Python object to a QJSValue. +int qpyqml_convertTo_QJSValue(PyObject *py, PyObject *transferObj, + QJSValue **cpp, int *isErr) +{ + if (PyObject_TypeCheck(py, sipTypeAsPyTypeObject(sipType_QJSValue_SpecialValue))) + { + int v = sipConvertToEnum(py, sipType_QJSValue_SpecialValue); + + if (PyErr_Occurred()) + { + *isErr = 1; + return 0; + } + + *cpp = new QJSValue(static_cast(v)); + + return sipGetState(transferObj); + } + + if (PyBool_Check(py)) + { + *cpp = new QJSValue(py == Py_True); + + return sipGetState(transferObj); + } + + if (PyLong_Check(py)) + { + *cpp = new QJSValue((int)PyLong_AsLong(py)); + + return sipGetState(transferObj); + } + + if (PyFloat_Check(py)) + { + *cpp = new QJSValue((double)PyFloat_AsDouble(py)); + + return sipGetState(transferObj); + } + + if (sipCanConvertToType(py, sipType_QString, 0)) + { + int state; + QString *qs = reinterpret_cast(sipConvertToType(py, + sipType_QString, 0, 0, &state, isErr)); + + if (*isErr) + { + sipReleaseType(qs, sipType_QString, state); + return 0; + } + + *cpp = new QJSValue(*qs); + + sipReleaseType(qs, sipType_QString, state); + + return sipGetState(transferObj); + } + + *cpp = reinterpret_cast(sipConvertToType(py, sipType_QJSValue, + transferObj, SIP_NO_CONVERTORS, 0, isErr)); + + return 0; +} diff --git a/qpy/QtQml/qpyqml_register_singleton_type.cpp b/qpy/QtQml/qpyqml_register_singleton_type.cpp new file mode 100644 index 0000000..36b7f81 --- /dev/null +++ b/qpy/QtQml/qpyqml_register_singleton_type.cpp @@ -0,0 +1,170 @@ +// This contains the main implementation of qmlRegisterSingletonType. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include + +#include "qpyqml_api.h" +#include "qpyqmlsingletonobject.h" + +#include "sipAPIQtQml.h" + + +// Forward declarations. +static QQmlPrivate::RegisterSingletonType *init_type(PyTypeObject *py_type, + PyObject *factory); +static int register_type(QQmlPrivate::RegisterSingletonType *rt); + + +// The number of types that can be registered. +const int NrOfTypes = 30; + + +// The registration data for the proxy types. +static QQmlPrivate::RegisterSingletonType proxy_types[NrOfTypes]; + + +// Register a singleton Python type. +int qpyqml_register_singleton_type(PyTypeObject *py_type, const char *uri, + int major, int minor, const char *type_name, PyObject *factory) +{ + // Initialise the registration data structure. + QQmlPrivate::RegisterSingletonType *rt = init_type(py_type, factory); + + if (!rt) + return -1; + + if (!type_name) + type_name = sipPyTypeName(py_type); + + rt->uri = uri; + rt->version = QTypeRevision::fromVersion(major, minor); + rt->typeName = type_name; + + return register_type(rt); +} + + +// Register the proxy type with QML. +static int register_type(QQmlPrivate::RegisterSingletonType *rt) +{ + int type_id = QQmlPrivate::qmlregister(QQmlPrivate::SingletonRegistration, rt); + + if (type_id < 0) + { + PyErr_SetString(PyExc_RuntimeError, + "unable to register singleton type with QML"); + return -1; + } + + return type_id; +} + + +#define QPYQML_SINGLETON_TYPE_INIT(n) \ + case n##U: \ + QPyQmlSingletonObject##n::staticMetaObject = *mo; \ + QPyQmlSingletonObject##n::factory = factory; \ + rt->qObjectApi = QPyQmlSingletonObject##n::objectFactory; \ + rt->typeId = QQmlPrivate::QmlMetaType::self(); \ + break + + +// Return a pointer to the initialised registration structure for a type. +static QQmlPrivate::RegisterSingletonType *init_type(PyTypeObject *py_type, + PyObject *factory) +{ + // Check the type is derived from QObject. + if (!PyType_IsSubtype(py_type, sipTypeAsPyTypeObject(sipType_QObject))) + { + PyErr_SetString(PyExc_TypeError, + "type being registered must be a sub-type of QObject"); + return 0; + } + + // Get the type's number and check there aren't too many. + int type_nr = QPyQmlSingletonObjectProxy::addType(); + + if (type_nr >= NrOfTypes) + { + PyErr_Format(PyExc_TypeError, + "a maximum of %d singleton types may be registered with QML", + NrOfTypes); + return 0; + } + + QQmlPrivate::RegisterSingletonType *rt = &proxy_types[type_nr]; + + const QMetaObject *mo = pyqt6_qtqml_get_qmetaobject(py_type); + + QByteArray ptr_name(sipPyTypeName(py_type)); + ptr_name.append('*'); + + // Initialise those members that depend on the C++ type. + switch (type_nr) + { + QPYQML_SINGLETON_TYPE_INIT(0); + QPYQML_SINGLETON_TYPE_INIT(1); + QPYQML_SINGLETON_TYPE_INIT(2); + QPYQML_SINGLETON_TYPE_INIT(3); + QPYQML_SINGLETON_TYPE_INIT(4); + QPYQML_SINGLETON_TYPE_INIT(5); + QPYQML_SINGLETON_TYPE_INIT(6); + QPYQML_SINGLETON_TYPE_INIT(7); + QPYQML_SINGLETON_TYPE_INIT(8); + QPYQML_SINGLETON_TYPE_INIT(9); + QPYQML_SINGLETON_TYPE_INIT(10); + QPYQML_SINGLETON_TYPE_INIT(11); + QPYQML_SINGLETON_TYPE_INIT(12); + QPYQML_SINGLETON_TYPE_INIT(13); + QPYQML_SINGLETON_TYPE_INIT(14); + QPYQML_SINGLETON_TYPE_INIT(15); + QPYQML_SINGLETON_TYPE_INIT(16); + QPYQML_SINGLETON_TYPE_INIT(17); + QPYQML_SINGLETON_TYPE_INIT(18); + QPYQML_SINGLETON_TYPE_INIT(19); + QPYQML_SINGLETON_TYPE_INIT(20); + QPYQML_SINGLETON_TYPE_INIT(21); + QPYQML_SINGLETON_TYPE_INIT(22); + QPYQML_SINGLETON_TYPE_INIT(23); + QPYQML_SINGLETON_TYPE_INIT(24); + QPYQML_SINGLETON_TYPE_INIT(25); + QPYQML_SINGLETON_TYPE_INIT(26); + QPYQML_SINGLETON_TYPE_INIT(27); + QPYQML_SINGLETON_TYPE_INIT(28); + QPYQML_SINGLETON_TYPE_INIT(29); + } + + // Initialise the remaining members. + rt->instanceMetaObject = mo; + + rt->structVersion = 0; + rt->uri = 0; + rt->version = QTypeRevision::zero(); + rt->typeName = 0; + rt->scriptApi = 0; + rt->revision = QTypeRevision::zero(); + + Py_INCREF(factory); + + return rt; +} diff --git a/qpy/QtQml/qpyqml_register_type.cpp b/qpy/QtQml/qpyqml_register_type.cpp new file mode 100644 index 0000000..7801bdb --- /dev/null +++ b/qpy/QtQml/qpyqml_register_type.cpp @@ -0,0 +1,395 @@ +// This contains the main implementation of qmlRegisterType. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include +#include +#include + +#include "qpyqml_api.h" +#include "qpyqmlobject.h" +#include "qpyqmlvalidator.h" + +#include "sipAPIQtQml.h" + + +class QQmlPropertyValueInterceptor; + + +// Forward declarations. +static QQmlPrivate::RegisterType *init_type(PyTypeObject *py_type, bool ctor, + PyTypeObject *attached); +static void complete_init(QQmlPrivate::RegisterType *rt); +static int register_type(QQmlPrivate::RegisterType *rt); + + +// The registration data for the QValidator proxy types. +const int NrOfQValidatorTypes = 10; +static QQmlPrivate::RegisterType validator_proxy_types[NrOfQValidatorTypes]; + +// The registration data for the QObject/QAbstractItemModel proxy types. +const int NrOfQObjectTypes = 60; +static QQmlPrivate::RegisterType object_proxy_types[NrOfQObjectTypes]; + + +// Register an anonymous Python type. +int qpyqml_register_anonymous_type(PyTypeObject *py_type, const char *uri, + int major) +{ + // Initialise the registration data structure. + QQmlPrivate::RegisterType *rt = init_type(py_type, false, nullptr); + + if (!rt) + return -1; + + rt->uri = uri; + rt->version = QTypeRevision::fromVersion(major, 0); + rt->elementName = nullptr; + + return register_type(rt); +} + + +// Register a library Python type. +int qpyqml_register_library_type(PyTypeObject *py_type, const char *uri, + int major, int minor, const char *qml_name, PyTypeObject *attached) +{ + // Initialise the registration data structure. + QQmlPrivate::RegisterType *rt = init_type(py_type, true, attached); + + if (!rt) + return -1; + + if (!qml_name) + qml_name = sipPyTypeName(py_type); + + rt->uri = uri; + rt->version = QTypeRevision::fromVersion(major, minor); + rt->elementName = qml_name; + + return register_type(rt); +} + + +// Register an uncreatable library Python type. +int qpyqml_register_uncreatable_type(PyTypeObject *py_type, const char *uri, + int major, int minor, const char *qml_name, const QString &reason) +{ + // Initialise the registration data structure. + QQmlPrivate::RegisterType *rt = init_type(py_type, false, nullptr); + + if (!rt) + return -1; + + if (!qml_name) + qml_name = sipPyTypeName(py_type); + + rt->noCreationReason = reason; + rt->uri = uri; + rt->version = QTypeRevision::fromVersion(major, minor); + rt->elementName = qml_name; + + return register_type(rt); +} + + +// Register the proxy type with QML. +static int register_type(QQmlPrivate::RegisterType *rt) +{ + int type_id = QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, rt); + + if (type_id < 0) + { + PyErr_SetString(PyExc_RuntimeError, + "unable to register type with QML"); + return -1; + } + + return type_id; +} + + +#define QPYQML_TYPE_INIT(t, n) \ + case n##U: \ + QPyQml##t##n::staticMetaObject = *mo; \ + QPyQml##t##n::attachedPyType = attached; \ + rt->typeId = QQmlPrivate::QmlMetaType::self(); \ + rt->listId = QQmlPrivate::QmlMetaType::list(); \ + rt->objectSize = ctor ? sizeof(QPyQml##t##n) : 0; \ + if (ctor) rt->create = QQmlPrivate::createInto; else rt->create = 0; \ + rt->attachedPropertiesFunction = attached_mo ? QPyQml##t##n::attachedProperties : 0; \ + rt->parserStatusCast = is_parser_status ? QQmlPrivate::StaticCastSelector::cast() : -1; \ + rt->valueSourceCast = is_value_source ? QQmlPrivate::StaticCastSelector::cast() : -1; \ + rt->valueInterceptorCast = QQmlPrivate::StaticCastSelector::cast(); \ + break + + +// Return a pointer to the initialised registration structure for a type. +static QQmlPrivate::RegisterType *init_type(PyTypeObject *py_type, bool ctor, + PyTypeObject *attached) +{ + PyTypeObject *qobject_type = sipTypeAsPyTypeObject(sipType_QObject); + + // Check the type is derived from QObject and get its meta-object. + if (!PyType_IsSubtype(py_type, qobject_type)) + { + PyErr_SetString(PyExc_TypeError, + "type being registered must be a sub-type of QObject"); + return 0; + } + + const QMetaObject *mo = pyqt6_qtqml_get_qmetaobject(py_type); + + // See if the type is a parser status. + bool is_parser_status = PyType_IsSubtype(py_type, + sipTypeAsPyTypeObject(sipType_QQmlParserStatus)); + + // See if the type is a property value source. + bool is_value_source = PyType_IsSubtype(py_type, + sipTypeAsPyTypeObject(sipType_QQmlPropertyValueSource)); + + + // Check any attached type is derived from QObject and get its meta-object. + const QMetaObject *attached_mo; + + if (attached) + { + if (!PyType_IsSubtype(attached, qobject_type)) + { + PyErr_SetString(PyExc_TypeError, + "attached properties type must be a sub-type of QObject"); + return 0; + } + + attached_mo = pyqt6_qtqml_get_qmetaobject(attached); + + Py_INCREF((PyObject *)attached); + } + else + { + attached_mo = nullptr; + } + + QByteArray ptr_name(sipPyTypeName(py_type)); + ptr_name.append('*'); + + QByteArray list_name(sipPyTypeName(py_type)); + list_name.prepend("QQmlListProperty<"); + list_name.append('>'); + + QQmlPrivate::RegisterType *rt; + + // See if we have the QQuickItem registation helper from the QtQuick + // module. Check each time because it could be imported at any point. + + typedef sipErrorState (*QQuickItemRegisterFn)(PyTypeObject *, const QMetaObject *, const QByteArray &, const QByteArray &, QQmlPrivate::RegisterType **); + + static QQuickItemRegisterFn qquickitem_register = 0; + + if (!qquickitem_register) + qquickitem_register = (QQuickItemRegisterFn)sipImportSymbol( + "qtquick_register_item"); + + if (qquickitem_register) + { + sipErrorState estate = qquickitem_register(py_type, mo, ptr_name, + list_name, &rt); + + if (estate == sipErrorFail) + return 0; + + if (estate == sipErrorNone) + { + complete_init(rt); + return rt; + } + } + + // Initialise the specific type. + + static const sipTypeDef *qvalidator_td = 0; + + if (!qvalidator_td) + qvalidator_td = sipFindType("QValidator"); + + if (qvalidator_td && PyType_IsSubtype(py_type, sipTypeAsPyTypeObject(qvalidator_td))) + { + int type_nr = QPyQmlValidatorProxy::addType(py_type); + + if (type_nr >= NrOfQValidatorTypes) + { + PyErr_Format(PyExc_TypeError, + "a maximum of %d QValidator types may be registered with QML", + NrOfQValidatorTypes); + return 0; + } + + rt = &validator_proxy_types[type_nr]; + + // Initialise those members that depend on the C++ type. + switch (type_nr) + { + QPYQML_TYPE_INIT(Validator, 0); + QPYQML_TYPE_INIT(Validator, 1); + QPYQML_TYPE_INIT(Validator, 2); + QPYQML_TYPE_INIT(Validator, 3); + QPYQML_TYPE_INIT(Validator, 4); + QPYQML_TYPE_INIT(Validator, 5); + QPYQML_TYPE_INIT(Validator, 6); + QPYQML_TYPE_INIT(Validator, 7); + QPYQML_TYPE_INIT(Validator, 8); + QPYQML_TYPE_INIT(Validator, 9); + } + } + else + { + int type_nr = QPyQmlObjectProxy::addType(py_type); + + if (type_nr >= NrOfQObjectTypes) + { + PyErr_Format(PyExc_TypeError, + "a maximum of %d types may be registered with QML", + NrOfQObjectTypes); + return 0; + } + + rt = &object_proxy_types[type_nr]; + + // Initialise those members that depend on the C++ type. + switch (type_nr) + { + QPYQML_TYPE_INIT(Object, 0); + QPYQML_TYPE_INIT(Object, 1); + QPYQML_TYPE_INIT(Object, 2); + QPYQML_TYPE_INIT(Object, 3); + QPYQML_TYPE_INIT(Object, 4); + QPYQML_TYPE_INIT(Object, 5); + QPYQML_TYPE_INIT(Object, 6); + QPYQML_TYPE_INIT(Object, 7); + QPYQML_TYPE_INIT(Object, 8); + QPYQML_TYPE_INIT(Object, 9); + QPYQML_TYPE_INIT(Object, 10); + QPYQML_TYPE_INIT(Object, 11); + QPYQML_TYPE_INIT(Object, 12); + QPYQML_TYPE_INIT(Object, 13); + QPYQML_TYPE_INIT(Object, 14); + QPYQML_TYPE_INIT(Object, 15); + QPYQML_TYPE_INIT(Object, 16); + QPYQML_TYPE_INIT(Object, 17); + QPYQML_TYPE_INIT(Object, 18); + QPYQML_TYPE_INIT(Object, 19); + QPYQML_TYPE_INIT(Object, 20); + QPYQML_TYPE_INIT(Object, 21); + QPYQML_TYPE_INIT(Object, 22); + QPYQML_TYPE_INIT(Object, 23); + QPYQML_TYPE_INIT(Object, 24); + QPYQML_TYPE_INIT(Object, 25); + QPYQML_TYPE_INIT(Object, 26); + QPYQML_TYPE_INIT(Object, 27); + QPYQML_TYPE_INIT(Object, 28); + QPYQML_TYPE_INIT(Object, 29); + QPYQML_TYPE_INIT(Object, 30); + QPYQML_TYPE_INIT(Object, 31); + QPYQML_TYPE_INIT(Object, 32); + QPYQML_TYPE_INIT(Object, 33); + QPYQML_TYPE_INIT(Object, 34); + QPYQML_TYPE_INIT(Object, 35); + QPYQML_TYPE_INIT(Object, 36); + QPYQML_TYPE_INIT(Object, 37); + QPYQML_TYPE_INIT(Object, 38); + QPYQML_TYPE_INIT(Object, 39); + QPYQML_TYPE_INIT(Object, 40); + QPYQML_TYPE_INIT(Object, 41); + QPYQML_TYPE_INIT(Object, 42); + QPYQML_TYPE_INIT(Object, 43); + QPYQML_TYPE_INIT(Object, 44); + QPYQML_TYPE_INIT(Object, 45); + QPYQML_TYPE_INIT(Object, 46); + QPYQML_TYPE_INIT(Object, 47); + QPYQML_TYPE_INIT(Object, 48); + QPYQML_TYPE_INIT(Object, 49); + QPYQML_TYPE_INIT(Object, 50); + QPYQML_TYPE_INIT(Object, 51); + QPYQML_TYPE_INIT(Object, 52); + QPYQML_TYPE_INIT(Object, 53); + QPYQML_TYPE_INIT(Object, 54); + QPYQML_TYPE_INIT(Object, 55); + QPYQML_TYPE_INIT(Object, 56); + QPYQML_TYPE_INIT(Object, 57); + QPYQML_TYPE_INIT(Object, 58); + QPYQML_TYPE_INIT(Object, 59); + } + } + + rt->metaObject = mo; + rt->attachedPropertiesMetaObject = attached_mo; + + complete_init(rt); + + return rt; +} + + +// Complete the initialisation of a type registration structure. +static void complete_init(QQmlPrivate::RegisterType *rt) +{ + rt->structVersion = 0; + rt->uri = 0; + rt->version = QTypeRevision::zero(); + rt->elementName = 0; + rt->extensionObjectCreate = 0; + rt->extensionMetaObject = 0; + rt->customParser = 0; + rt->revision = QTypeRevision::zero(); +} + + +// Return the proxy that created an object. This is called with the GIL. +QObject *qpyqml_find_proxy_for(QObject *proxied) +{ + QSetIterator oit(QPyQmlObjectProxy::proxies); + + while (oit.hasNext()) + { + QPyQmlObjectProxy *proxy = static_cast(oit.next()); + + if (proxy->proxied.data() == proxied) + return proxy; + } + + QSetIterator vit(QPyQmlValidatorProxy::proxies); + + while (vit.hasNext()) + { + QPyQmlValidatorProxy *proxy = static_cast(vit.next()); + + if (proxy->proxied.data() == proxied) + return proxy; + } + + PyErr_Format(PyExc_TypeError, + "QObject instance at %p was not created from QML", proxied); + + return 0; +} diff --git a/qpy/QtQml/qpyqmllistproperty.cpp b/qpy/QtQml/qpyqmllistproperty.cpp new file mode 100644 index 0000000..b79d23f --- /dev/null +++ b/qpy/QtQml/qpyqmllistproperty.cpp @@ -0,0 +1,348 @@ +// This is the implementation of the QQmlListProperty class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include + +#include "qpyqmllistproperty.h" +#include "qpyqmllistpropertywrapper.h" +#include "qpyqml_listdata.h" + +#include "sipAPIQtQml.h" + + +// The type object. +PyTypeObject *qpyqml_QQmlListProperty_TypeObject; + + +// Forward declarations. +extern "C" { +static PyObject *QQmlListProperty_call(PyObject *, PyObject *args, + PyObject *kwds); +} + +static void list_append(QQmlListProperty *p, QObject *el); +static QObject *list_at(QQmlListProperty *p, qsizetype idx); +static void list_clear(QQmlListProperty *p); +static qsizetype list_count(QQmlListProperty *p); +static void bad_result(PyObject *py_res, const char *context); + + +// The type's doc-string. +PyDoc_STRVAR(QQmlListProperty_doc, +"QQmlListProperty(type, object, list)\n" +"QQmlListProperty(type, object, append=None, count=None, at=None, clear=None)"); + + +// This implements the QQmlListProperty Python type. It is a sub-type of the +// standard string type that is callable. + +// Define the slots. +static PyType_Slot qpyqml_QQmlListProperty_Slots[] = { + {Py_tp_base, (void *)&PyUnicode_Type}, + {Py_tp_call, (void *)QQmlListProperty_call}, + {Py_tp_doc, (void *)QQmlListProperty_doc}, + {0, 0} +}; + + +// Define the type. +static PyType_Spec qpyqml_QQmlListProperty_Spec = { + "PyQt6.QtQml.QQmlListProperty", + 0, + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_UNICODE_SUBCLASS, + qpyqml_QQmlListProperty_Slots +}; + + +// Initialise the type and return true if there was no error. +bool qpyqml_QQmlListProperty_init_type() +{ + qpyqml_QQmlListProperty_TypeObject = (PyTypeObject *)PyType_FromSpec( + &qpyqml_QQmlListProperty_Spec); + + return qpyqml_QQmlListProperty_TypeObject; +} + + +// The QQmlListProperty init function. +static PyObject *QQmlListProperty_call(PyObject *, PyObject *args, + PyObject *kwds) +{ + PyObject *py_type, *py_obj, *py_list = 0, *py_append = 0, *py_count = 0, + *py_at = 0, *py_clear = 0; + + static const char *kwlist[] = {"type", "object", "list", "append", "count", + "at", "clear", 0}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO|O!OOOO:QQmlListProperty", + const_cast(kwlist), &py_type, &py_obj, &PyList_Type, + &py_list, &py_append, &py_count, &py_at, &py_clear)) + return 0; + + // Check the type is derived from QObject. + if (!PyObject_TypeCheck(py_type, &PyType_Type) || + !PyType_IsSubtype((PyTypeObject *)py_type, sipTypeAsPyTypeObject(sipType_QObject))) + { + PyErr_Format(PyExc_TypeError, + "type argument must be a sub-type of QObject"); + return 0; + } + + // Get the C++ QObject. + int iserr = 0; + QObject *obj = reinterpret_cast(sipForceConvertToType(py_obj, + sipType_QObject, 0, SIP_NOT_NONE|SIP_NO_CONVERTORS, 0, &iserr)); + + if (iserr) + { + PyErr_Format(PyExc_TypeError, + "object argument must be of type 'QObject', not '%s'", + sipPyTypeName(Py_TYPE(py_obj))); + return 0; + } + + // If we have a list then check we have no callables. + if (py_list && (py_append || py_count || py_at || py_clear)) + { + PyErr_SetString(PyExc_TypeError, + "cannot specify a list and a list function"); + return 0; + } + + // Get a list wrapper with the C++ QObject as its parent. + ListData *list_data = new ListData(py_type, py_obj, py_list, py_append, + py_count, py_at, py_clear, obj); + + // Create the C++ QQmlListProperty with the list data as the data. + // Note that we will create a new one each time the property getter is + // called. Also note that the callables will not be reached by the garbage + // collector. + QQmlListProperty *prop = new QQmlListProperty(obj, + list_data, ((py_list || py_append) ? list_append : 0), + ((py_list || py_count) ? list_count : 0), + ((py_list || py_at) ? list_at : 0), + ((py_list || py_clear) ? list_clear : 0)); + + // Convert it to a Python object. + PyObject *prop_obj = qpyqml_QQmlListPropertyWrapper_New(prop, py_list); + + if (!prop_obj) + { + delete prop; + return 0; + } + + return prop_obj; +} + + +// Append to the list. +static void list_append(QQmlListProperty *p, QObject *el) +{ + SIP_BLOCK_THREADS + + ListData *ldata = reinterpret_cast(p->data); + bool ok = false; + + // Convert the element to a Python object and check the type. + PyObject *py_el = sipConvertFromType(el, sipType_QObject, 0); + + if (py_el) + { + if (!PyObject_TypeCheck(py_el, (PyTypeObject *)ldata->py_type)) + { + PyErr_Format(PyExc_TypeError, + "list element must be of type '%s', not '%s'", + sipPyTypeName(((PyTypeObject *)ldata->py_type)), + sipPyTypeName(Py_TYPE(py_el))); + } + else if (ldata->py_list) + { + if (PyList_Append(ldata->py_list, py_el) == 0) + ok = true; + } + else + { + // Call the function. + PyObject *py_res = PyObject_CallFunctionObjArgs(ldata->py_append, + ldata->py_obj, py_el, NULL); + + if (py_res) + { + if (py_res == Py_None) + ok = true; + else + bad_result(py_res, "append"); + + Py_DECREF(py_res); + } + } + + Py_DECREF(py_el); + } + + if (!ok) + pyqt6_qtqml_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// Get the length of the list. +static qsizetype list_count(QQmlListProperty *p) +{ + qsizetype res = -1; + + SIP_BLOCK_THREADS + + ListData *ldata = reinterpret_cast(p->data); + + if (ldata->py_list) + { + res = PyList_Size(ldata->py_list); + } + else + { + // Call the function. + PyObject *py_res = PyObject_CallFunctionObjArgs(ldata->py_count, + ldata->py_obj, NULL); + + if (py_res) + { + res = sipLong_AsInt(py_res); + + if (PyErr_Occurred()) + { + bad_result(py_res, "count"); + + res = -1; + } + + Py_DECREF(py_res); + } + } + + if (res < 0) + { + pyqt6_qtqml_err_print(); + res = 0; + } + + SIP_UNBLOCK_THREADS + + return res; +} + + +// Get an item from the list. +static QObject *list_at(QQmlListProperty *p, qsizetype idx) +{ + QObject *qobj = 0; + + SIP_BLOCK_THREADS + + ListData *ldata = reinterpret_cast(p->data); + + if (ldata->py_list) + { + PyObject *py_el = PyList_GetItem(ldata->py_list, idx); + + if (py_el) + { + int iserr = 0; + qobj = reinterpret_cast(sipForceConvertToType(py_el, + sipType_QObject, 0, SIP_NO_CONVERTORS, 0, &iserr)); + } + } + else + { + // Call the function. + PyObject *py_res = PyObject_CallFunction(ldata->py_at, + const_cast("Ni"), ldata->py_obj, idx); + + if (py_res) + { + int iserr = 0; + qobj = reinterpret_cast(sipForceConvertToType(py_res, + sipType_QObject, 0, SIP_NO_CONVERTORS, 0, &iserr)); + + if (iserr) + bad_result(py_res, "at"); + + Py_DECREF(py_res); + } + } + + if (!qobj) + pyqt6_qtqml_err_print(); + + SIP_UNBLOCK_THREADS + + return qobj; +} + + +// Clear the list. +static void list_clear(QQmlListProperty *p) +{ + SIP_BLOCK_THREADS + + ListData *ldata = reinterpret_cast(p->data); + bool ok = false; + + if (ldata->py_list) + { + if (PyList_SetSlice(ldata->py_list, 0, PyList_Size(ldata->py_list), NULL) == 0) + ok = true; + } + else + { + // Call the function. + PyObject *py_res = PyObject_CallFunctionObjArgs(ldata->py_clear, + ldata->py_obj, NULL); + + if (py_res) + { + if (py_res == Py_None) + ok = true; + else + bad_result(py_res, "clear"); + + Py_DECREF(py_res); + } + } + + if (!ok) + pyqt6_qtqml_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// Raise an exception for an unexpected result. +static void bad_result(PyObject *py_res, const char *context) +{ + PyErr_Format(PyExc_TypeError, "unexpected result from %s function: %S", + context, py_res); +} diff --git a/qpy/QtQml/qpyqmllistproperty.h b/qpy/QtQml/qpyqmllistproperty.h new file mode 100644 index 0000000..cff700a --- /dev/null +++ b/qpy/QtQml/qpyqmllistproperty.h @@ -0,0 +1,35 @@ +// This is the definition of the QQmlListProperty class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQMLLISTPROPERTY_H +#define _QPYQMLLISTPROPERTY_H + + +#include + + +// The type object. +extern PyTypeObject *qpyqml_QQmlListProperty_TypeObject; + + +bool qpyqml_QQmlListProperty_init_type(); + + +#endif diff --git a/qpy/QtQml/qpyqmllistpropertywrapper.cpp b/qpy/QtQml/qpyqmllistpropertywrapper.cpp new file mode 100644 index 0000000..62d2775 --- /dev/null +++ b/qpy/QtQml/qpyqmllistpropertywrapper.cpp @@ -0,0 +1,227 @@ +// This contains the implementation of the QQmlListPropertyWrapper type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpyqmllistpropertywrapper.h" + + +// The type object. +PyTypeObject *qpyqml_QQmlListPropertyWrapper_TypeObject; + + +// Forward declarations. +extern "C" { +static void QQmlListPropertyWrapper_dealloc(PyObject *self); +static Py_ssize_t QQmlListPropertyWrapper_sq_length(PyObject *self); +static PyObject *QQmlListPropertyWrapper_sq_concat(PyObject *self, + PyObject *other); +static PyObject *QQmlListPropertyWrapper_sq_repeat(PyObject *self, + Py_ssize_t count); +static PyObject *QQmlListPropertyWrapper_sq_item(PyObject *self, Py_ssize_t i); +static int QQmlListPropertyWrapper_sq_ass_item(PyObject *self, Py_ssize_t i, + PyObject *value); +static int QQmlListPropertyWrapper_sq_contains(PyObject *self, + PyObject *value); +static PyObject *QQmlListPropertyWrapper_sq_inplace_concat(PyObject *self, + PyObject *other); +static PyObject *QQmlListPropertyWrapper_sq_inplace_repeat(PyObject *self, + Py_ssize_t count); +} + +static PyObject *get_list(PyObject *self); + + +// Define the slots. +static PyType_Slot qpyqml_QQmlListPropertyWrapper_Slots[] = { + {Py_tp_dealloc, (void *)QQmlListPropertyWrapper_dealloc}, + {Py_sq_length, (void *)QQmlListPropertyWrapper_sq_length}, + {Py_sq_concat, (void *)QQmlListPropertyWrapper_sq_concat}, + {Py_sq_repeat, (void *)QQmlListPropertyWrapper_sq_repeat}, + {Py_sq_item, (void *)QQmlListPropertyWrapper_sq_item}, + {Py_sq_ass_item, (void *)QQmlListPropertyWrapper_sq_ass_item}, + {Py_sq_contains, (void *)QQmlListPropertyWrapper_sq_contains}, + {Py_sq_inplace_concat, (void *)QQmlListPropertyWrapper_sq_inplace_concat}, + {Py_sq_inplace_repeat, (void *)QQmlListPropertyWrapper_sq_inplace_repeat}, + {0, 0} +}; + + +// Define the type. +static PyType_Spec qpyqml_QQmlListPropertyWrapper_Spec = { + "PyQt6.QtQml.QQmlListPropertyWrapper", + sizeof (qpyqml_QQmlListPropertyWrapper), + 0, + Py_TPFLAGS_DEFAULT, + qpyqml_QQmlListPropertyWrapper_Slots +}; + + +// Initialise the type and return true if there was no error. +bool qpyqml_QQmlListPropertyWrapper_init_type() +{ + qpyqml_QQmlListPropertyWrapper_TypeObject = (PyTypeObject *)PyType_FromSpec( + &qpyqml_QQmlListPropertyWrapper_Spec); + + return qpyqml_QQmlListPropertyWrapper_TypeObject; +} + + +// Create the wrapper object. +PyObject *qpyqml_QQmlListPropertyWrapper_New(QQmlListProperty *prop, + PyObject *list) +{ + qpyqml_QQmlListPropertyWrapper *obj; + + obj = PyObject_New(qpyqml_QQmlListPropertyWrapper, + qpyqml_QQmlListPropertyWrapper_TypeObject); + + if (!obj) + return 0; + + obj->qml_list_property = prop; + obj->py_list = list; + + return (PyObject *)obj; +} + + +// The type dealloc slot. +static void QQmlListPropertyWrapper_dealloc(PyObject *self) +{ + delete ((qpyqml_QQmlListPropertyWrapper *)self)->qml_list_property; + + PyObject_Del(self); +} + + +// Return the underlying list. Return 0 and raise an exception if there wasn't +// one. +static PyObject *get_list(PyObject *self) +{ + PyObject *list = ((qpyqml_QQmlListPropertyWrapper *)self)->py_list; + + if (!list) + { + PyErr_SetString(PyExc_TypeError, + "there is no object bound to QQmlListProperty"); + return 0; + } + + // Make sure it has sequence methods. + if (!PySequence_Check(list)) + { + PyErr_SetString(PyExc_TypeError, + "object bound to QQmlListProperty is not a sequence"); + return 0; + } + + return list; +} + + +// The proxy sequence methods. + +static Py_ssize_t QQmlListPropertyWrapper_sq_length(PyObject *self) +{ + PyObject *list = get_list(self); + + if (!list) + return -1; + + return PySequence_Size(list); +} + +static PyObject *QQmlListPropertyWrapper_sq_concat(PyObject *self, + PyObject *other) +{ + PyObject *list = get_list(self); + + if (!list) + return 0; + + return PySequence_Concat(list, other); +} + +static PyObject *QQmlListPropertyWrapper_sq_repeat(PyObject *self, + Py_ssize_t count) +{ + PyObject *list = get_list(self); + + if (!list) + return 0; + + return PySequence_Repeat(list, count); +} + +static PyObject *QQmlListPropertyWrapper_sq_item(PyObject *self, Py_ssize_t i) +{ + PyObject *list = get_list(self); + + if (!list) + return 0; + + return PySequence_GetItem(list, i); +} + +static int QQmlListPropertyWrapper_sq_ass_item(PyObject *self, Py_ssize_t i, + PyObject *value) +{ + PyObject *list = get_list(self); + + if (!list) + return -1; + + return PySequence_SetItem(list, i, value); +} + +static int QQmlListPropertyWrapper_sq_contains(PyObject *self, PyObject *value) +{ + PyObject *list = get_list(self); + + if (!list) + return -1; + + return PySequence_Contains(list, value); +} + +static PyObject *QQmlListPropertyWrapper_sq_inplace_concat(PyObject *self, + PyObject *other) +{ + PyObject *list = get_list(self); + + if (!list) + return 0; + + return PySequence_InPlaceConcat(list, other); +} + +static PyObject *QQmlListPropertyWrapper_sq_inplace_repeat(PyObject *self, + Py_ssize_t count) +{ + PyObject *list = get_list(self); + + if (!list) + return 0; + + return PySequence_InPlaceRepeat(list, count); +} diff --git a/qpy/QtQml/qpyqmllistpropertywrapper.h b/qpy/QtQml/qpyqmllistpropertywrapper.h new file mode 100644 index 0000000..f337c16 --- /dev/null +++ b/qpy/QtQml/qpyqmllistpropertywrapper.h @@ -0,0 +1,59 @@ +// This defines the interfaces for the QQmlListPropertyWrapper type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQMLLISTPROPERTYWRAPPER_H +#define _QPYQMLLISTPROPERTYWRAPPER_H + + +#include + +#include +#include + + +extern "C" { + +// This defines the structure of a QQmlListPropertyWrapper object. This serves +// two purposes. Firstly it wraps a pointer to a QQmlListProperty like a +// capsule would. Secondly it acts as a proxy for the underlying Python list. +typedef struct _qpyqml_QQmlListPropertyWrapper { + PyObject_HEAD + + // The QML list property that is being wrapped. It is owned by the + // wrapper. + QQmlListProperty *qml_list_property; + + // A borrowed reference to the underlying Python list. + PyObject *py_list; +} qpyqml_QQmlListPropertyWrapper; + +} + + +// The type object. +extern PyTypeObject *qpyqml_QQmlListPropertyWrapper_TypeObject; + + +bool qpyqml_QQmlListPropertyWrapper_init_type(); +PyObject *qpyqml_QQmlListPropertyWrapper_New(QQmlListProperty *prop, + PyObject *list); + + +#endif diff --git a/qpy/QtQml/qpyqmlobject.cpp b/qpy/QtQml/qpyqmlobject.cpp new file mode 100644 index 0000000..af57601 --- /dev/null +++ b/qpy/QtQml/qpyqmlobject.cpp @@ -0,0 +1,687 @@ +// This is the implementation of the QPyQmlObject classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "qpyqmlobject.h" + +#include "sipAPIQtQml.h" + + +// Forward declarations. +static void bad_result(PyObject *res, const char *context); + +// The list of registered Python types. +QList QPyQmlObjectProxy::pyqt_types; + +// The set of proxies in existence. +QSet QPyQmlObjectProxy::proxies; + + +// The ctor. +QPyQmlObjectProxy::QPyQmlObjectProxy(QObject *parent) : QAbstractItemModel(parent), + proxied_model(0), py_proxied(0) +{ + proxies.insert(this); +} + + +// The dtor. +QPyQmlObjectProxy::~QPyQmlObjectProxy() +{ + proxies.remove(this); + + SIP_BLOCK_THREADS + Py_XDECREF(py_proxied); + SIP_UNBLOCK_THREADS + + if (!proxied.isNull()) + delete proxied.data(); +} + + +// Called when QML has connected to a signal of the proxied object. Note that +// we also used to implement the corresponding disconnectNotify() to +// disconnect the signal. However this resulted in deadlocks and shouldn't be +// necessary anyway because it was only happening when the object that made the +// connection was itself being destroyed. +void QPyQmlObjectProxy::connectNotify(const QMetaMethod &sig) +{ + QByteArray signal_sig(sig.methodSignature()); + + // Avoid a warning message from QObject::connect(). This seems to happen + // when a notification signal of the proxied object gets connected to a + // property that is defined in QML. I think it is benign... + if (signal_sig.isEmpty()) + return; + + signal_sig.prepend('2'); + + // The signal has actually been connected to the proxy, so do the same from + // the proxied object to the proxy. Use Qt::UniqueConnection in case the + // object (ie. model) is used in more than one view. + QObject::connect(proxied, signal_sig.constData(), this, + signal_sig.constData(), Qt::UniqueConnection); +} + + +// Delegate to the real object. +const QMetaObject *QPyQmlObjectProxy::metaObject() const +{ + return !proxied.isNull() ? proxied->metaObject() : QObject::metaObject(); +} + + +// Delegate to the real object. +void *QPyQmlObjectProxy::qt_metacast(const char *_clname) +{ + return !proxied.isNull() ? proxied->qt_metacast(_clname) : 0; +} + + +// Delegate to the real object. +int QPyQmlObjectProxy::qt_metacall(QMetaObject::Call call, int idx, void **args) +{ + if (idx < 0) + return idx; + + if (proxied.isNull()) + return QObject::qt_metacall(call, idx, args); + + const QMetaObject *proxied_mo = proxied->metaObject(); + + // See if a signal defined in the proxied object might be being invoked. + // Note that we used to use sender() but this proved unreliable. + if (call == QMetaObject::InvokeMetaMethod && proxied_mo->method(idx).methodType() == QMetaMethod::Signal) + { + // Get the meta-object of the class that defines the signal. + while (idx < proxied_mo->methodOffset()) + { + proxied_mo = proxied_mo->superClass(); + Q_ASSERT(proxied_mo); + } + + // Relay the signal to QML. + QMetaObject::activate(this, proxied_mo, + idx - proxied_mo->methodOffset(), args); + + return idx - (proxied_mo->methodCount() - proxied_mo->methodOffset()); + } + + return proxied->qt_metacall(call, idx, args); +} + + +// Add a new Python type and return its number. +int QPyQmlObjectProxy::addType(PyTypeObject *type) +{ + pyqt_types.append(type); + + return pyqt_types.size() - 1; +} + + +// Create the Python instance. +void QPyQmlObjectProxy::createPyObject(QObject *parent) +{ + SIP_BLOCK_THREADS + + py_proxied = sipCallMethod(NULL, (PyObject *)pyqt_types.at(typeNr()), "D", + parent, sipType_QObject, NULL); + + if (py_proxied) + { + proxied = reinterpret_cast( + sipGetAddress((sipSimpleWrapper *)py_proxied)); + + proxied_model = qobject_cast(proxied.data()); + } + else + { + pyqt6_qtqml_err_print(); + } + + SIP_UNBLOCK_THREADS +} + + +// Resolve any proxy. +void *QPyQmlObjectProxy::resolveProxy(void *proxy) +{ + QObject *qobj = reinterpret_cast(proxy); + + // We have to search for proxy instances because we have subverted the + // usual sub-class detection mechanism. + if (proxies.contains(qobj)) + return static_cast(qobj)->proxied.data(); + + // It's not a proxy. + return proxy; +} + + +// Create an instance of the attached properties. +QObject *QPyQmlObjectProxy::createAttachedProperties(PyTypeObject *py_type, + QObject *parent) +{ + QObject *qobj = 0; + + SIP_BLOCK_THREADS + + PyObject *obj = sipCallMethod(NULL, (PyObject *)py_type, "D", parent, + sipType_QObject, NULL); + + if (obj) + { + qobj = reinterpret_cast( + sipGetAddress((sipSimpleWrapper *)obj)); + + // It should always have a parent, but just in case... + if (parent) + Py_DECREF(obj); + } + else + { + pyqt6_qtqml_err_print(); + } + + SIP_UNBLOCK_THREADS + + return qobj; +} + + +// Invoked when a class parse begins. +void QPyQmlObjectProxy::pyClassBegin() +{ + if (!py_proxied) + return; + + SIP_BLOCK_THREADS + + bool ok = false; + + static PyObject *method_name = 0; + + if (!method_name) + method_name = PyUnicode_FromString("classBegin"); + + if (method_name) + { + PyObject *res = PyObject_CallMethodObjArgs(py_proxied, method_name, + NULL); + + if (res) + { + if (res == Py_None) + ok = true; + else + bad_result(res, "classBegin()"); + + Py_DECREF(res); + } + } + + if (!ok) + pyqt6_qtqml_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// Invoked when a component parse completes. +void QPyQmlObjectProxy::pyComponentComplete() +{ + if (!py_proxied) + return; + + SIP_BLOCK_THREADS + + bool ok = false; + + static PyObject *method_name = 0; + + if (!method_name) + method_name = PyUnicode_FromString("componentComplete"); + + if (method_name) + { + PyObject *res = PyObject_CallMethodObjArgs(py_proxied, method_name, + NULL); + + if (res) + { + if (res == Py_None) + ok = true; + else + bad_result(res, "componentComplete()"); + + Py_DECREF(res); + } + } + + if (!ok) + pyqt6_qtqml_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// Invoked to set the target property of a property value source. +void QPyQmlObjectProxy::pySetTarget(const QQmlProperty &target) +{ + if (!py_proxied) + return; + + SIP_BLOCK_THREADS + + bool ok = false; + + static PyObject *method_name = 0; + + if (!method_name) + method_name = PyUnicode_FromString("setTarget"); + + if (method_name) + { + QQmlProperty *target_heap = new QQmlProperty(target); + + PyObject *py_target = sipConvertFromNewType(target_heap, + sipType_QQmlProperty, 0); + + if (!py_target) + { + delete target_heap; + } + else + { + PyObject *res = PyObject_CallMethodObjArgs(py_proxied, method_name, + py_target, NULL); + + Py_DECREF(py_target); + + if (res) + { + if (res == Py_None) + ok = true; + else + bad_result(res, "setTarget()"); + + Py_DECREF(res); + } + } + } + + if (!ok) + pyqt6_qtqml_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// Raise an exception for an unexpected result. +static void bad_result(PyObject *res, const char *context) +{ + PyErr_Format(PyExc_TypeError, "unexpected result from %s: %S", context, + res); +} + + +// The proxy type implementations. +#define QPYQML_PROXY_IMPL(n) \ +QPyQmlObject##n::QPyQmlObject##n(QObject *parent) : QPyQmlObjectProxy(parent) \ +{ \ + createPyObject(parent); \ +} \ +QObject *QPyQmlObject##n::attachedProperties(QObject *parent) \ +{ \ + return createAttachedProperties(attachedPyType, parent); \ +} \ +void QPyQmlObject##n::classBegin() \ +{ \ + pyClassBegin(); \ +} \ +void QPyQmlObject##n::componentComplete() \ +{ \ + pyComponentComplete(); \ +} \ +void QPyQmlObject##n::setTarget(const QQmlProperty &target) \ +{ \ + pySetTarget(target); \ +} \ +QMetaObject QPyQmlObject##n::staticMetaObject; \ +PyTypeObject *QPyQmlObject##n::attachedPyType + + +QPYQML_PROXY_IMPL(0); +QPYQML_PROXY_IMPL(1); +QPYQML_PROXY_IMPL(2); +QPYQML_PROXY_IMPL(3); +QPYQML_PROXY_IMPL(4); +QPYQML_PROXY_IMPL(5); +QPYQML_PROXY_IMPL(6); +QPYQML_PROXY_IMPL(7); +QPYQML_PROXY_IMPL(8); +QPYQML_PROXY_IMPL(9); +QPYQML_PROXY_IMPL(10); +QPYQML_PROXY_IMPL(11); +QPYQML_PROXY_IMPL(12); +QPYQML_PROXY_IMPL(13); +QPYQML_PROXY_IMPL(14); +QPYQML_PROXY_IMPL(15); +QPYQML_PROXY_IMPL(16); +QPYQML_PROXY_IMPL(17); +QPYQML_PROXY_IMPL(18); +QPYQML_PROXY_IMPL(19); +QPYQML_PROXY_IMPL(20); +QPYQML_PROXY_IMPL(21); +QPYQML_PROXY_IMPL(22); +QPYQML_PROXY_IMPL(23); +QPYQML_PROXY_IMPL(24); +QPYQML_PROXY_IMPL(25); +QPYQML_PROXY_IMPL(26); +QPYQML_PROXY_IMPL(27); +QPYQML_PROXY_IMPL(28); +QPYQML_PROXY_IMPL(29); +QPYQML_PROXY_IMPL(30); +QPYQML_PROXY_IMPL(31); +QPYQML_PROXY_IMPL(32); +QPYQML_PROXY_IMPL(33); +QPYQML_PROXY_IMPL(34); +QPYQML_PROXY_IMPL(35); +QPYQML_PROXY_IMPL(36); +QPYQML_PROXY_IMPL(37); +QPYQML_PROXY_IMPL(38); +QPYQML_PROXY_IMPL(39); +QPYQML_PROXY_IMPL(40); +QPYQML_PROXY_IMPL(41); +QPYQML_PROXY_IMPL(42); +QPYQML_PROXY_IMPL(43); +QPYQML_PROXY_IMPL(44); +QPYQML_PROXY_IMPL(45); +QPYQML_PROXY_IMPL(46); +QPYQML_PROXY_IMPL(47); +QPYQML_PROXY_IMPL(48); +QPYQML_PROXY_IMPL(49); +QPYQML_PROXY_IMPL(50); +QPYQML_PROXY_IMPL(51); +QPYQML_PROXY_IMPL(52); +QPYQML_PROXY_IMPL(53); +QPYQML_PROXY_IMPL(54); +QPYQML_PROXY_IMPL(55); +QPYQML_PROXY_IMPL(56); +QPYQML_PROXY_IMPL(57); +QPYQML_PROXY_IMPL(58); +QPYQML_PROXY_IMPL(59); + + +// The reimplementations of the QAbstractItemModel virtuals. + +QModelIndex QPyQmlObjectProxy::index(int row, int column, const QModelIndex &parent) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->index(row, column, parent); + + return QModelIndex(); +} + +QModelIndex QPyQmlObjectProxy::parent(const QModelIndex &child) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->parent(child); + + return QModelIndex(); +} + +QModelIndex QPyQmlObjectProxy::sibling(int row, int column, const QModelIndex &idx) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->sibling(row, column, idx); + + return QModelIndex(); +} + +int QPyQmlObjectProxy::rowCount(const QModelIndex &parent) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->rowCount(parent); + + return 0; +} + +int QPyQmlObjectProxy::columnCount(const QModelIndex &parent) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->columnCount(parent); + + return 0; +} + +bool QPyQmlObjectProxy::hasChildren(const QModelIndex &parent) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->hasChildren(parent); + + return false; +} + +QVariant QPyQmlObjectProxy::data(const QModelIndex &index, int role) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->data(index, role); + + return QVariant(); +} + +bool QPyQmlObjectProxy::setData(const QModelIndex &index, const QVariant &value, int role) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->setData(index, value, role); + + return false; +} + +QVariant QPyQmlObjectProxy::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->headerData(section, orientation, role); + + return QVariant(); +} + +bool QPyQmlObjectProxy::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->setHeaderData(section, orientation, value, role); + + return false; +} + +QMap QPyQmlObjectProxy::itemData(const QModelIndex &index) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->itemData(index); + + return QMap(); +} + +bool QPyQmlObjectProxy::setItemData(const QModelIndex &index, const QMap &roles) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->setItemData(index, roles); + + return false; +} + +QStringList QPyQmlObjectProxy::mimeTypes() const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->mimeTypes(); + + return QStringList(); +} + +QMimeData *QPyQmlObjectProxy::mimeData(const QModelIndexList &indexes) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->mimeData(indexes); + + return 0; +} + +bool QPyQmlObjectProxy::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->canDropMimeData(data, action, row, column, parent); + + return false; +} + +bool QPyQmlObjectProxy::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->dropMimeData(data, action, row, column, parent); + + return false; +} + +Qt::DropActions QPyQmlObjectProxy::supportedDropActions() const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->supportedDropActions(); + + return Qt::IgnoreAction; +} + +Qt::DropActions QPyQmlObjectProxy::supportedDragActions() const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->supportedDragActions(); + + return Qt::IgnoreAction; +} + +bool QPyQmlObjectProxy::insertRows(int row, int count, const QModelIndex &parent) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->insertRows(row, count, parent); + + return false; +} + +bool QPyQmlObjectProxy::insertColumns(int column, int count, const QModelIndex &parent) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->insertColumns(column, count, parent); + + return false; +} + +bool QPyQmlObjectProxy::removeRows(int row, int count, const QModelIndex &parent) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->removeRows(row, count, parent); + + return false; +} + +bool QPyQmlObjectProxy::removeColumns(int column, int count, const QModelIndex &parent) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->removeColumns(column, count, parent); + + return false; +} + +bool QPyQmlObjectProxy::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->moveRows(sourceParent, sourceRow, count, + destinationParent, destinationChild); + + return false; +} + +bool QPyQmlObjectProxy::moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->moveColumns(sourceParent, sourceColumn, count, + destinationParent, destinationChild); + + return false; +} + +void QPyQmlObjectProxy::fetchMore(const QModelIndex &parent) +{ + if (!proxied.isNull() && proxied_model) + proxied_model->fetchMore(parent); +} + +bool QPyQmlObjectProxy::canFetchMore(const QModelIndex &parent) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->canFetchMore(parent); + + return false; +} + +Qt::ItemFlags QPyQmlObjectProxy::flags(const QModelIndex &index) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->flags(index); + + return Qt::NoItemFlags; +} + +void QPyQmlObjectProxy::sort(int column, Qt::SortOrder order) +{ + if (!proxied.isNull() && proxied_model) + proxied_model->sort(column, order); +} + +QModelIndex QPyQmlObjectProxy::buddy(const QModelIndex &index) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->buddy(index); + + return QModelIndex(); +} + +QModelIndexList QPyQmlObjectProxy::match(const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->match(start, role, value, hits, flags); + + return QModelIndexList(); +} + +QSize QPyQmlObjectProxy::span(const QModelIndex &index) const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->span(index); + + return QSize(); +} + +QHash QPyQmlObjectProxy::roleNames() const +{ + if (!proxied.isNull() && proxied_model) + return proxied_model->roleNames(); + + return QHash(); +} diff --git a/qpy/QtQml/qpyqmlobject.h b/qpy/QtQml/qpyqmlobject.h new file mode 100644 index 0000000..ab2bae6 --- /dev/null +++ b/qpy/QtQml/qpyqmlobject.h @@ -0,0 +1,219 @@ +// This is the definition of the QPyQmlObject classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQMLOBJECT_H +#define _QPYQMLOBJECT_H + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +class QPyQmlObjectProxy : public QAbstractItemModel +{ +public: + QPyQmlObjectProxy(QObject *parent = 0); + virtual ~QPyQmlObjectProxy(); + + virtual const QMetaObject *metaObject() const; + virtual void *qt_metacast(const char *_clname); + virtual int qt_metacall(QMetaObject::Call, int, void **); + + virtual int typeNr() const = 0; + + static int addType(PyTypeObject *type); + void createPyObject(QObject *parent); + + static QObject *createAttachedProperties(PyTypeObject *py_type, + QObject *parent); + + static void *resolveProxy(void *proxy); + + void pyClassBegin(); + void pyComponentComplete(); + + void pySetTarget(const QQmlProperty &target); + + // The set of proxies in existence. + static QSet proxies; + + // The real object. + QPointer proxied; + + // The real object if it is an item model. + QAbstractItemModel *proxied_model; + + // QAbstractItemModel virtuals. + virtual QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex parent(const QModelIndex &child) const; + virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) + const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) + const; + virtual bool setData(const QModelIndex &index, const QVariant &value, + int role = Qt::EditRole); + virtual QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + virtual bool setHeaderData(int section, Qt::Orientation orientation, + const QVariant &value, int role = Qt::EditRole); + virtual QMap itemData(const QModelIndex &index) const; + virtual bool setItemData(const QModelIndex &index, + const QMap &roles); + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QModelIndexList &indexes) const; + virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent) const; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, + int row, int column, const QModelIndex &parent); + virtual Qt::DropActions supportedDropActions() const; + virtual Qt::DropActions supportedDragActions() const; + virtual bool insertRows(int row, int count, + const QModelIndex &parent = QModelIndex()); + virtual bool insertColumns(int column, int count, + const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, + const QModelIndex &parent = QModelIndex()); + virtual bool removeColumns(int column, int count, + const QModelIndex &parent = QModelIndex()); + virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, + int count, const QModelIndex &destinationParent, + int destinationChild); + virtual bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, + int count, const QModelIndex &destinationParent, + int destinationChild); + virtual void fetchMore(const QModelIndex &parent); + virtual bool canFetchMore(const QModelIndex &parent) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + virtual QModelIndex buddy(const QModelIndex &index) const; + virtual QModelIndexList match(const QModelIndex &start, int role, + const QVariant &value, int hits = 1, + Qt::MatchFlags flags = + Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const; + virtual QSize span(const QModelIndex &index) const; + virtual QHash roleNames() const; + +protected: + void connectNotify(const QMetaMethod &signal); + +private: + // These can by cast to sipWrapperType. + static QList pyqt_types; + + // The wrapped proxied object. + PyObject *py_proxied; + + QPyQmlObjectProxy(const QPyQmlObjectProxy &); +}; + + +// The proxy type declarations. +#define QPYQML_PROXY_DECL(n) \ +class QPyQmlObject##n : public QPyQmlObjectProxy, public QQmlParserStatus, public QQmlPropertyValueSource \ +{ \ +public: \ + QPyQmlObject##n(QObject *parent = 0); \ + static QMetaObject staticMetaObject; \ + virtual int typeNr() const {return n##U;} \ + static PyTypeObject *attachedPyType; \ + static QObject *attachedProperties(QObject *parent); \ + virtual void classBegin(); \ + virtual void componentComplete(); \ + virtual void setTarget(const QQmlProperty &target); \ +private: \ + QPyQmlObject##n(const QPyQmlObject##n &); \ +} + + +QPYQML_PROXY_DECL(0); +QPYQML_PROXY_DECL(1); +QPYQML_PROXY_DECL(2); +QPYQML_PROXY_DECL(3); +QPYQML_PROXY_DECL(4); +QPYQML_PROXY_DECL(5); +QPYQML_PROXY_DECL(6); +QPYQML_PROXY_DECL(7); +QPYQML_PROXY_DECL(8); +QPYQML_PROXY_DECL(9); +QPYQML_PROXY_DECL(10); +QPYQML_PROXY_DECL(11); +QPYQML_PROXY_DECL(12); +QPYQML_PROXY_DECL(13); +QPYQML_PROXY_DECL(14); +QPYQML_PROXY_DECL(15); +QPYQML_PROXY_DECL(16); +QPYQML_PROXY_DECL(17); +QPYQML_PROXY_DECL(18); +QPYQML_PROXY_DECL(19); +QPYQML_PROXY_DECL(20); +QPYQML_PROXY_DECL(21); +QPYQML_PROXY_DECL(22); +QPYQML_PROXY_DECL(23); +QPYQML_PROXY_DECL(24); +QPYQML_PROXY_DECL(25); +QPYQML_PROXY_DECL(26); +QPYQML_PROXY_DECL(27); +QPYQML_PROXY_DECL(28); +QPYQML_PROXY_DECL(29); +QPYQML_PROXY_DECL(30); +QPYQML_PROXY_DECL(31); +QPYQML_PROXY_DECL(32); +QPYQML_PROXY_DECL(33); +QPYQML_PROXY_DECL(34); +QPYQML_PROXY_DECL(35); +QPYQML_PROXY_DECL(36); +QPYQML_PROXY_DECL(37); +QPYQML_PROXY_DECL(38); +QPYQML_PROXY_DECL(39); +QPYQML_PROXY_DECL(40); +QPYQML_PROXY_DECL(41); +QPYQML_PROXY_DECL(42); +QPYQML_PROXY_DECL(43); +QPYQML_PROXY_DECL(44); +QPYQML_PROXY_DECL(45); +QPYQML_PROXY_DECL(46); +QPYQML_PROXY_DECL(47); +QPYQML_PROXY_DECL(48); +QPYQML_PROXY_DECL(49); +QPYQML_PROXY_DECL(50); +QPYQML_PROXY_DECL(51); +QPYQML_PROXY_DECL(52); +QPYQML_PROXY_DECL(53); +QPYQML_PROXY_DECL(54); +QPYQML_PROXY_DECL(55); +QPYQML_PROXY_DECL(56); +QPYQML_PROXY_DECL(57); +QPYQML_PROXY_DECL(58); +QPYQML_PROXY_DECL(59); + + +#endif diff --git a/qpy/QtQml/qpyqmlsingletonobject.cpp b/qpy/QtQml/qpyqmlsingletonobject.cpp new file mode 100644 index 0000000..7af131c --- /dev/null +++ b/qpy/QtQml/qpyqmlsingletonobject.cpp @@ -0,0 +1,110 @@ +// This is the implementation of the QPyQmlSingletonObject classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "qpyqmlsingletonobject.h" + +#include "sipAPIQtQml.h" + + +// The number of registered Python types. +int QPyQmlSingletonObjectProxy::nr_types = 0; + + +// Add a new Python type and return its number. +int QPyQmlSingletonObjectProxy::addType() +{ + return nr_types++; +} + + +// Create the QObject instance. +QObject *QPyQmlSingletonObjectProxy::createObject(QQmlEngine *engine, + QJSEngine *scriptEngine, PyObject *factory) +{ + // This should never happen. + if (!factory) + return 0; + + QObject *qobject; + + SIP_BLOCK_THREADS + + PyObject *py_obj = sipCallMethod(NULL, factory, "DD", engine, + sipType_QQmlEngine, NULL, scriptEngine, sipType_QJSEngine, NULL); + + if (py_obj) + { + qobject = reinterpret_cast( + sipGetAddress((sipSimpleWrapper *)py_obj)); + + // The engine will call the dtor and garbage collect the Python object. + sipTransferTo(py_obj, Py_None); + Py_DECREF(py_obj); + } + else + { + qobject = 0; + pyqt6_qtqml_err_print(); + } + + Py_DECREF(factory); + + SIP_UNBLOCK_THREADS + + return qobject; +} + + +// The proxy type implementations. +#define QPYQML_SINGLETON_PROXY_IMPL(n) \ +PyObject *QPyQmlSingletonObject##n::factory = 0; \ +QMetaObject QPyQmlSingletonObject##n::staticMetaObject + + +QPYQML_SINGLETON_PROXY_IMPL(0); +QPYQML_SINGLETON_PROXY_IMPL(1); +QPYQML_SINGLETON_PROXY_IMPL(2); +QPYQML_SINGLETON_PROXY_IMPL(3); +QPYQML_SINGLETON_PROXY_IMPL(4); +QPYQML_SINGLETON_PROXY_IMPL(5); +QPYQML_SINGLETON_PROXY_IMPL(6); +QPYQML_SINGLETON_PROXY_IMPL(7); +QPYQML_SINGLETON_PROXY_IMPL(8); +QPYQML_SINGLETON_PROXY_IMPL(9); +QPYQML_SINGLETON_PROXY_IMPL(10); +QPYQML_SINGLETON_PROXY_IMPL(11); +QPYQML_SINGLETON_PROXY_IMPL(12); +QPYQML_SINGLETON_PROXY_IMPL(13); +QPYQML_SINGLETON_PROXY_IMPL(14); +QPYQML_SINGLETON_PROXY_IMPL(15); +QPYQML_SINGLETON_PROXY_IMPL(16); +QPYQML_SINGLETON_PROXY_IMPL(17); +QPYQML_SINGLETON_PROXY_IMPL(18); +QPYQML_SINGLETON_PROXY_IMPL(19); +QPYQML_SINGLETON_PROXY_IMPL(20); +QPYQML_SINGLETON_PROXY_IMPL(21); +QPYQML_SINGLETON_PROXY_IMPL(22); +QPYQML_SINGLETON_PROXY_IMPL(23); +QPYQML_SINGLETON_PROXY_IMPL(24); +QPYQML_SINGLETON_PROXY_IMPL(25); +QPYQML_SINGLETON_PROXY_IMPL(26); +QPYQML_SINGLETON_PROXY_IMPL(27); +QPYQML_SINGLETON_PROXY_IMPL(28); +QPYQML_SINGLETON_PROXY_IMPL(29); diff --git a/qpy/QtQml/qpyqmlsingletonobject.h b/qpy/QtQml/qpyqmlsingletonobject.h new file mode 100644 index 0000000..9055739 --- /dev/null +++ b/qpy/QtQml/qpyqmlsingletonobject.h @@ -0,0 +1,100 @@ +// This is the definition of the QPyQmlSingletonObject classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQMLOBJECT_H +#define _QPYQMLOBJECT_H + + +#include + +#include +#include +#include + + +// Note that these classes are never instantiated. They are used to give the +// registration structure appropriate values (although whether or not those +// values are actually used isn't clear). +class QPyQmlSingletonObjectProxy : public QObject +{ +public: + static int addType(); + static QObject *createObject(QQmlEngine *engine, QJSEngine *scriptEngine, + PyObject *factory); + +private: + // The number of registered types. + static int nr_types; + + QPyQmlSingletonObjectProxy(const QPyQmlSingletonObjectProxy &); +}; + + +// The proxy type declarations. +#define QPYQML_SINGLETON_PROXY_DECL(n) \ +class QPyQmlSingletonObject##n : public QPyQmlSingletonObjectProxy \ +{ \ +public: \ + static QMetaObject staticMetaObject; \ + static PyObject *factory; \ + static QObject *objectFactory(QQmlEngine *engine, QJSEngine *scriptEngine) \ + { \ + QObject *qo = createObject(engine, scriptEngine, factory); \ + factory = 0; \ + return qo; \ + } \ +private: \ + QPyQmlSingletonObject##n(const QPyQmlSingletonObject##n &); \ +} + + +QPYQML_SINGLETON_PROXY_DECL(0); +QPYQML_SINGLETON_PROXY_DECL(1); +QPYQML_SINGLETON_PROXY_DECL(2); +QPYQML_SINGLETON_PROXY_DECL(3); +QPYQML_SINGLETON_PROXY_DECL(4); +QPYQML_SINGLETON_PROXY_DECL(5); +QPYQML_SINGLETON_PROXY_DECL(6); +QPYQML_SINGLETON_PROXY_DECL(7); +QPYQML_SINGLETON_PROXY_DECL(8); +QPYQML_SINGLETON_PROXY_DECL(9); +QPYQML_SINGLETON_PROXY_DECL(10); +QPYQML_SINGLETON_PROXY_DECL(11); +QPYQML_SINGLETON_PROXY_DECL(12); +QPYQML_SINGLETON_PROXY_DECL(13); +QPYQML_SINGLETON_PROXY_DECL(14); +QPYQML_SINGLETON_PROXY_DECL(15); +QPYQML_SINGLETON_PROXY_DECL(16); +QPYQML_SINGLETON_PROXY_DECL(17); +QPYQML_SINGLETON_PROXY_DECL(18); +QPYQML_SINGLETON_PROXY_DECL(19); +QPYQML_SINGLETON_PROXY_DECL(20); +QPYQML_SINGLETON_PROXY_DECL(21); +QPYQML_SINGLETON_PROXY_DECL(22); +QPYQML_SINGLETON_PROXY_DECL(23); +QPYQML_SINGLETON_PROXY_DECL(24); +QPYQML_SINGLETON_PROXY_DECL(25); +QPYQML_SINGLETON_PROXY_DECL(26); +QPYQML_SINGLETON_PROXY_DECL(27); +QPYQML_SINGLETON_PROXY_DECL(28); +QPYQML_SINGLETON_PROXY_DECL(29); + + +#endif diff --git a/qpy/QtQml/qpyqmlvalidator.cpp b/qpy/QtQml/qpyqmlvalidator.cpp new file mode 100644 index 0000000..85e87a0 --- /dev/null +++ b/qpy/QtQml/qpyqmlvalidator.cpp @@ -0,0 +1,407 @@ +// This is the implementation of the QPyQmlValidatorProxy class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "qpyqmlvalidator.h" + +#include "sipAPIQtQml.h" + + +// Forward declarations. +static void bad_result(PyObject *res, const char *context); + +// The list of registered Python types. +QList QPyQmlValidatorProxy::pyqt_types; + +// The set of proxies in existence. +QSet QPyQmlValidatorProxy::proxies; + + +// The ctor. +QPyQmlValidatorProxy::QPyQmlValidatorProxy(QObject *parent) : + QValidator(parent), py_proxied(0) +{ + proxies.insert(this); +} + + +// The dtor. +QPyQmlValidatorProxy::~QPyQmlValidatorProxy() +{ + proxies.remove(this); + + SIP_BLOCK_THREADS + Py_XDECREF(py_proxied); + SIP_UNBLOCK_THREADS + + if (!proxied.isNull()) + delete proxied.data(); +} + + +// Called when QML has connected to a signal of the proxied object. Note that +// we also used to implement the corresponding disconnectNotify() to +// disconnect the signal. However this resulted in deadlocks and shouldn't be +// necessary anyway because it was only happening when the object that made the +// connection was itself being destroyed. +void QPyQmlValidatorProxy::connectNotify(const QMetaMethod &sig) +{ + QByteArray signal_sig = signalSignature(sig); + + // The signal has actually been connected to the proxy, so do the same from + // the proxied object to the proxy. Use Qt::UniqueConnection in case the + // object (ie. model) is used in more than one view. + QObject::connect(proxied, signal_sig.constData(), this, + signal_sig.constData(), Qt::UniqueConnection); +} + + +// Return what SIGNAL() would return for a method. +QByteArray QPyQmlValidatorProxy::signalSignature(const QMetaMethod &signal) +{ + QByteArray signal_sig(signal.methodSignature()); + signal_sig.prepend('2'); + + return signal_sig; +} + + +// Delegate to the real object. +const QMetaObject *QPyQmlValidatorProxy::metaObject() const +{ + return !proxied.isNull() ? proxied->metaObject() : QObject::metaObject(); +} + + +// Delegate to the real object. +void *QPyQmlValidatorProxy::qt_metacast(const char *_clname) +{ + return !proxied.isNull() ? proxied->qt_metacast(_clname) : 0; +} + + +// Delegate to the real object. +int QPyQmlValidatorProxy::qt_metacall(QMetaObject::Call call, int idx, void **args) +{ + if (idx < 0) + return idx; + + if (proxied.isNull()) + return QObject::qt_metacall(call, idx, args); + + const QMetaObject *proxied_mo = proxied->metaObject(); + + // See if a signal defined in the proxied object might be being invoked. + // Note that we used to use sender() but this proved unreliable. + if (call == QMetaObject::InvokeMetaMethod && proxied_mo->method(idx).methodType() == QMetaMethod::Signal) + { + // Get the meta-object of the class that defines the signal. + while (idx < proxied_mo->methodOffset()) + { + proxied_mo = proxied_mo->superClass(); + Q_ASSERT(proxied_mo); + } + + // Relay the signal to QML. + QMetaObject::activate(this, proxied_mo, + idx - proxied_mo->methodOffset(), args); + + return idx - (proxied_mo->methodCount() - proxied_mo->methodOffset()); + } + + return proxied->qt_metacall(call, idx, args); +} + + +// Add a new Python type and return its number. +int QPyQmlValidatorProxy::addType(PyTypeObject *type) +{ + pyqt_types.append(type); + + return pyqt_types.size() - 1; +} + + +// Create the Python instance. +void QPyQmlValidatorProxy::createPyObject(QObject *parent) +{ + static const sipTypeDef *qvalidator_td = 0; + + SIP_BLOCK_THREADS + + if (!qvalidator_td) + qvalidator_td = sipFindType("QValidator"); + + if (qvalidator_td) + { + py_proxied = sipCallMethod(NULL, (PyObject *)pyqt_types.at(typeNr()), + "D", parent, qvalidator_td, NULL); + + if (py_proxied) + proxied = reinterpret_cast( + sipGetAddress((sipSimpleWrapper *)py_proxied)); + else + pyqt6_qtqml_err_print(); + } + else + { + PyErr_SetString(PyExc_TypeError, "unknown type 'QValidator'"); + pyqt6_qtqml_err_print(); + } + + SIP_UNBLOCK_THREADS +} + + +// Resolve any proxy. +void *QPyQmlValidatorProxy::resolveProxy(void *proxy) +{ + QObject *qobj = reinterpret_cast(proxy); + + // We have to search for proxy instances because we have subverted the + // usual sub-class detection mechanism. + if (proxies.contains(qobj)) + return static_cast(qobj)->proxied.data(); + + // It's not a proxy. + return proxy; +} + + +// Create an instance of the attached properties. +QObject *QPyQmlValidatorProxy::createAttachedProperties(PyTypeObject *py_type, + QObject *parent) +{ + QObject *qobj = 0; + + SIP_BLOCK_THREADS + + PyObject *obj = sipCallMethod(NULL, (PyObject *)py_type, "D", parent, + sipType_QObject, NULL); + + if (obj) + { + qobj = reinterpret_cast( + sipGetAddress((sipSimpleWrapper *)obj)); + + // It should always have a parent, but just in case... + if (parent) + Py_DECREF(obj); + } + else + { + pyqt6_qtqml_err_print(); + } + + SIP_UNBLOCK_THREADS + + return qobj; +} + + +// Invoked when a class parse begins. +void QPyQmlValidatorProxy::pyClassBegin() +{ + if (!py_proxied) + return; + + SIP_BLOCK_THREADS + + bool ok = false; + + static PyObject *method_name = 0; + + if (!method_name) + method_name = PyUnicode_FromString("classBegin"); + + if (method_name) + { + PyObject *res = PyObject_CallMethodObjArgs(py_proxied, method_name, + NULL); + + if (res) + { + if (res == Py_None) + ok = true; + else + bad_result(res, "classBegin()"); + + Py_DECREF(res); + } + } + + if (!ok) + pyqt6_qtqml_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// Invoked when a component parse completes. +void QPyQmlValidatorProxy::pyComponentComplete() +{ + if (!py_proxied) + return; + + SIP_BLOCK_THREADS + + bool ok = false; + + static PyObject *method_name = 0; + + if (!method_name) + method_name = PyUnicode_FromString("componentComplete"); + + if (method_name) + { + PyObject *res = PyObject_CallMethodObjArgs(py_proxied, method_name, + NULL); + + if (res) + { + if (res == Py_None) + ok = true; + else + bad_result(res, "componentComplete()"); + + Py_DECREF(res); + } + } + + if (!ok) + pyqt6_qtqml_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// Invoked to set the target property of a property value source. +void QPyQmlValidatorProxy::pySetTarget(const QQmlProperty &target) +{ + if (!py_proxied) + return; + + SIP_BLOCK_THREADS + + bool ok = false; + + static PyObject *method_name = 0; + + if (!method_name) + method_name = PyUnicode_FromString("setTarget"); + + if (method_name) + { + QQmlProperty *target_heap = new QQmlProperty(target); + + PyObject *py_target = sipConvertFromNewType(target_heap, + sipType_QQmlProperty, 0); + + if (!py_target) + { + delete target_heap; + } + else + { + PyObject *res = PyObject_CallMethodObjArgs(py_proxied, method_name, + py_target, NULL); + + Py_DECREF(py_target); + + if (res) + { + if (res == Py_None) + ok = true; + else + bad_result(res, "setTarget()"); + + Py_DECREF(res); + } + } + } + + if (!ok) + pyqt6_qtqml_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// Raise an exception for an unexpected result. +static void bad_result(PyObject *res, const char *context) +{ + PyErr_Format(PyExc_TypeError, "unexpected result from %s: %S", context, + res); +} + + +// The proxy type implementations. +#define QPYQML_VALIDATOR_PROXY_IMPL(n) \ +QPyQmlValidator##n::QPyQmlValidator##n(QObject *parent) : QPyQmlValidatorProxy(parent) \ +{ \ + createPyObject(parent); \ +} \ +QObject *QPyQmlValidator##n::attachedProperties(QObject *parent) \ +{ \ + return createAttachedProperties(attachedPyType, parent); \ +} \ +void QPyQmlValidator##n::classBegin() \ +{ \ + pyClassBegin(); \ +} \ +void QPyQmlValidator##n::componentComplete() \ +{ \ + pyComponentComplete(); \ +} \ +void QPyQmlValidator##n::setTarget(const QQmlProperty &target) \ +{ \ + pySetTarget(target); \ +} \ +QMetaObject QPyQmlValidator##n::staticMetaObject; \ +PyTypeObject *QPyQmlValidator##n::attachedPyType + + +QPYQML_VALIDATOR_PROXY_IMPL(0); +QPYQML_VALIDATOR_PROXY_IMPL(1); +QPYQML_VALIDATOR_PROXY_IMPL(2); +QPYQML_VALIDATOR_PROXY_IMPL(3); +QPYQML_VALIDATOR_PROXY_IMPL(4); +QPYQML_VALIDATOR_PROXY_IMPL(5); +QPYQML_VALIDATOR_PROXY_IMPL(6); +QPYQML_VALIDATOR_PROXY_IMPL(7); +QPYQML_VALIDATOR_PROXY_IMPL(8); +QPYQML_VALIDATOR_PROXY_IMPL(9); + + +// The reimplementations of the QValidator virtuals. + +void QPyQmlValidatorProxy::fixup(QString &input) const +{ + if (!proxied.isNull()) + proxied->fixup(input); +} + + +QValidator::State QPyQmlValidatorProxy::validate(QString &input, int &pos) const +{ + if (!proxied.isNull()) + return proxied->validate(input, pos); + + return QValidator::Invalid; +} diff --git a/qpy/QtQml/qpyqmlvalidator.h b/qpy/QtQml/qpyqmlvalidator.h new file mode 100644 index 0000000..fe50053 --- /dev/null +++ b/qpy/QtQml/qpyqmlvalidator.h @@ -0,0 +1,117 @@ +// This is the definition of the QPyQmlValidatorProxy class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQMLVALIDATOR_H +#define _QPYQMLVALIDATOR_H + + +#include + +#include +#include +#include +#include +#include +#include +#include + + +class QPyQmlValidatorProxy : public QValidator +{ +public: + QPyQmlValidatorProxy(QObject *parent = 0); + virtual ~QPyQmlValidatorProxy(); + + virtual const QMetaObject *metaObject() const; + virtual void *qt_metacast(const char *_clname); + virtual int qt_metacall(QMetaObject::Call, int, void **); + + virtual int typeNr() const = 0; + + static int addType(PyTypeObject *type); + void createPyObject(QObject *parent); + + static QObject *createAttachedProperties(PyTypeObject *py_type, + QObject *parent); + + static void *resolveProxy(void *proxy); + + void pyClassBegin(); + void pyComponentComplete(); + + void pySetTarget(const QQmlProperty &target); + + // The set of proxies in existence. + static QSet proxies; + + // The real object. + QPointer proxied; + + // QValidator virtuals. + virtual void fixup(QString &input) const; + virtual QValidator::State validate(QString &input, int &pos) const; + +protected: + void connectNotify(const QMetaMethod &signal); + +private: + // These can by cast to sipWrapperType. + static QList pyqt_types; + + // The wrapped proxied object. + PyObject *py_proxied; + + static QByteArray signalSignature(const QMetaMethod &signal); + + QPyQmlValidatorProxy(const QPyQmlValidatorProxy &); +}; + + +// The proxy type declarations. +#define QPYQML_VALIDATOR_PROXY_DECL(n) \ +class QPyQmlValidator##n : public QPyQmlValidatorProxy, public QQmlParserStatus, public QQmlPropertyValueSource \ +{ \ +public: \ + QPyQmlValidator##n(QObject *parent = 0); \ + static QMetaObject staticMetaObject; \ + virtual int typeNr() const {return n##U;} \ + static PyTypeObject *attachedPyType; \ + static QObject *attachedProperties(QObject *parent); \ + virtual void classBegin(); \ + virtual void componentComplete(); \ + virtual void setTarget(const QQmlProperty &target); \ +private: \ + QPyQmlValidator##n(const QPyQmlValidator##n &); \ +} + + +QPYQML_VALIDATOR_PROXY_DECL(0); +QPYQML_VALIDATOR_PROXY_DECL(1); +QPYQML_VALIDATOR_PROXY_DECL(2); +QPYQML_VALIDATOR_PROXY_DECL(3); +QPYQML_VALIDATOR_PROXY_DECL(4); +QPYQML_VALIDATOR_PROXY_DECL(5); +QPYQML_VALIDATOR_PROXY_DECL(6); +QPYQML_VALIDATOR_PROXY_DECL(7); +QPYQML_VALIDATOR_PROXY_DECL(8); +QPYQML_VALIDATOR_PROXY_DECL(9); + + +#endif diff --git a/qpy/QtQuick/qpyquick_api.h b/qpy/QtQuick/qpyquick_api.h new file mode 100644 index 0000000..286605e --- /dev/null +++ b/qpy/QtQuick/qpyquick_api.h @@ -0,0 +1,33 @@ +// This defines the API provided by this library. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQUICK_API_H +#define _QPYQUICK_API_H + + +// Python exception handling. +typedef void (*pyqt6_qtquick_err_print_t)(); +extern pyqt6_qtquick_err_print_t pyqt6_qtquick_err_print; + +// Initialisation. +void qpyquick_post_init(); + + +#endif diff --git a/qpy/QtQuick/qpyquick_chimera_helpers.cpp b/qpy/QtQuick/qpyquick_chimera_helpers.cpp new file mode 100644 index 0000000..78f29f0 --- /dev/null +++ b/qpy/QtQuick/qpyquick_chimera_helpers.cpp @@ -0,0 +1,157 @@ +// This is the implementation of the various Chimera helpers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include + +#include "qpyquick_chimera_helpers.h" + +#include "sipAPIQtQuick.h" + + +// Forward declarations. +static QMetaType QList_QObject_metatype(); +static bool to_QList_QObject(PyObject *obj, QList&cpp); + + +// Convert a QVariant to a Python object. +bool qpyquick_from_qvariant_convertor(const QVariant *varp, PyObject **objp) +{ + // Check we handle the meta-type. + if (varp->metaType() != QList_QObject_metatype()) + return false; + + const QList *cpp = reinterpret_cast *>(varp->data()); + + PyObject *obj = PyList_New(cpp->count()); + + if (obj) + { + for (int i = 0; i < cpp->count(); ++i) + { + PyObject *itm = sipConvertFromType(cpp->at(i), sipType_QObject, 0); + + if (!itm) + { + Py_DECREF(obj); + obj = 0; + break; + } + + PyList_SetItem(obj, i, itm); + } + } + + *objp = obj; + + return true; +} + + +// Convert a Python object to a QVariant. +bool qpyquick_to_qvariant_convertor(PyObject *obj, QVariant &var, bool *okp) +{ + QMetaType metatype = QList_QObject_metatype(); + + // Check the meta-type has been defined. + if (!metatype.isValid()) + return false; + + QList qlo; + + // A failure to convert isn't an error, just the wrong type of Python + // object. + if (!to_QList_QObject(obj, qlo)) + return false; + + var = QVariant(metatype, &qlo); + *okp = true; + + return true; +} + + +// Convert a Python object to QVariant data. +bool qpyquick_to_qvariant_data_convertor(PyObject *obj, void *data, + QMetaType metatype, bool *okp) +{ + // Check we handle the meta-type. + if (metatype != QList_QObject_metatype()) + return false; + + QList qlo; + + // A failure to convert isn't an error, just the wrong type of Python + // object. + if (!to_QList_QObject(obj, qlo)) + return false; + + *reinterpret_cast *>(data) = qlo; + *okp = true; + + return true; +} + + +// Get the metatype for QList or 0 if it hasn't been registered. +static QMetaType QList_QObject_metatype() +{ + static QMetaType lo_metatype; + + // We look each time until we find it rather than rely on any particular + // behaviour from QtQuick. + if (!lo_metatype.isValid()) + lo_metatype = QMetaType::fromType >(); + + return lo_metatype; +} + + +// Convert a Python list object to a QList and return true if the +// conversion was successful. An empty list is never converted and left to the +// QtCore module to handle. +static bool to_QList_QObject(PyObject *obj, QList&cpp) +{ + if (!PyList_CheckExact(obj) || PyList_Size(obj) == 0) + return false; + + for (Py_ssize_t i = 0; i < PyList_Size(obj); ++i) + { + PyObject *val_obj = PyList_GetItem(obj, i); + + if (!val_obj) + return false; + + int iserr = 0; + + QObject *val = reinterpret_cast(sipForceConvertToType( + val_obj, sipType_QObject, 0, SIP_NO_CONVERTORS, 0, &iserr)); + + if (iserr) + return false; + + cpp.append(val); + } + + return true; +} diff --git a/qpy/QtQuick/qpyquick_chimera_helpers.h b/qpy/QtQuick/qpyquick_chimera_helpers.h new file mode 100644 index 0000000..5d87414 --- /dev/null +++ b/qpy/QtQuick/qpyquick_chimera_helpers.h @@ -0,0 +1,44 @@ +// This is the definition of the various Chimera helpers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQUICK_CHIMERAHELPERS_H +#define _QPYQUICK_CHIMERAHELPERS_H + + +#include + +#include +#include + + +// Keep these in sync. with those defined in the public API. +typedef bool (*FromQVariantConvertorFn)(const QVariant *, PyObject **); +typedef bool (*ToQVariantConvertorFn)(PyObject *, QVariant &, bool *); +typedef bool (*ToQVariantDataConvertorFn)(PyObject *, void *, QMetaType, + bool *); + + +bool qpyquick_from_qvariant_convertor(const QVariant *varp, PyObject **objp); +bool qpyquick_to_qvariant_convertor(PyObject *obj, QVariant &var, bool *okp); +bool qpyquick_to_qvariant_data_convertor(PyObject *obj, void *data, QMetaType, + bool *okp); + + +#endif diff --git a/qpy/QtQuick/qpyquick_post_init.cpp b/qpy/QtQuick/qpyquick_post_init.cpp new file mode 100644 index 0000000..ee1d4a1 --- /dev/null +++ b/qpy/QtQuick/qpyquick_post_init.cpp @@ -0,0 +1,58 @@ +// This is the initialisation support code for the QtQuick module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "qpyquick_api.h" +#include "qpyquick_chimera_helpers.h" +#include "qpyquick_register_type.h" + +#include "sipAPIQtQuick.h" + + +// Imports from QtCore. +pyqt6_qtquick_err_print_t pyqt6_qtquick_err_print; + + +// Perform any required initialisation. +void qpyquick_post_init() +{ + // Import the Chimera helper registration functions. + void (*register_from_qvariant_convertor)(FromQVariantConvertorFn); + register_from_qvariant_convertor = (void (*)(FromQVariantConvertorFn))sipImportSymbol("pyqt6_register_from_qvariant_convertor"); + Q_ASSERT(register_from_qvariant_convertor); + register_from_qvariant_convertor(qpyquick_from_qvariant_convertor); + + void (*register_to_qvariant_convertor)(ToQVariantConvertorFn); + register_to_qvariant_convertor = (void (*)(ToQVariantConvertorFn))sipImportSymbol("pyqt6_register_to_qvariant_convertor"); + Q_ASSERT(register_to_qvariant_convertor); + register_to_qvariant_convertor(qpyquick_to_qvariant_convertor); + + void (*register_to_qvariant_data_convertor)(ToQVariantDataConvertorFn); + register_to_qvariant_data_convertor = (void (*)(ToQVariantDataConvertorFn))sipImportSymbol("pyqt6_register_to_qvariant_data_convertor"); + Q_ASSERT(register_to_qvariant_data_convertor); + register_to_qvariant_data_convertor(qpyquick_to_qvariant_data_convertor); + + // Other QtCore imports. + pyqt6_qtquick_err_print = (pyqt6_qtquick_err_print_t)sipImportSymbol( + "pyqt6_err_print"); + Q_ASSERT(pyqt6_qtquick_err_print); + + // Export the qml_register_type() helper. + sipExportSymbol("qtquick_register_item", (void *)qpyquick_register_type); +} diff --git a/qpy/QtQuick/qpyquick_register_type.cpp b/qpy/QtQuick/qpyquick_register_type.cpp new file mode 100644 index 0000000..2495e9c --- /dev/null +++ b/qpy/QtQuick/qpyquick_register_type.cpp @@ -0,0 +1,55 @@ +// This is the implementation of the qml_register_type() helper. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "qpyquick_register_type.h" +#include "qpyquickframebufferobject.h" +#include "qpyquickitem.h" +#include "qpyquickpainteditem.h" +#include "qpyquickview.h" +#include "qpyquickwindow.h" + +#include "sipAPIQtQuick.h" + + +sipErrorState qpyquick_register_type(PyTypeObject *py_type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name, QQmlPrivate::RegisterType **rtp) +{ + // Make sure the types are tested in the right order (ie. more specific + // types first). + + if (PyType_IsSubtype(py_type, sipTypeAsPyTypeObject(sipType_QQuickFramebufferObject))) + return ((*rtp = QPyQuickFramebufferObject::addType(py_type, mo, ptr_name, list_name)) ? sipErrorNone : sipErrorFail); + + if (PyType_IsSubtype(py_type, sipTypeAsPyTypeObject(sipType_QQuickPaintedItem))) + return ((*rtp = QPyQuickPaintedItem::addType(py_type, mo, ptr_name, list_name)) ? sipErrorNone : sipErrorFail); + + if (PyType_IsSubtype(py_type, sipTypeAsPyTypeObject(sipType_QQuickItem))) + return ((*rtp = QPyQuickItem::addType(py_type, mo, ptr_name, list_name)) ? sipErrorNone : sipErrorFail); + + if (PyType_IsSubtype(py_type, sipTypeAsPyTypeObject(sipType_QQuickView))) + return ((*rtp = QPyQuickView::addType(py_type, mo, ptr_name, list_name)) ? sipErrorNone : sipErrorFail); + + if (PyType_IsSubtype(py_type, sipTypeAsPyTypeObject(sipType_QQuickWindow))) + return ((*rtp = QPyQuickWindow::addType(py_type, mo, ptr_name, list_name)) ? sipErrorNone : sipErrorFail); + + // We don't recognise the type. + return sipErrorContinue; +} diff --git a/qpy/QtQuick/qpyquick_register_type.h b/qpy/QtQuick/qpyquick_register_type.h new file mode 100644 index 0000000..a0a879b --- /dev/null +++ b/qpy/QtQuick/qpyquick_register_type.h @@ -0,0 +1,39 @@ +// This is the declaration of the qml_register_type() helper. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQUICK_REGISTERTYPE_H +#define _QPYQUICK_REGISTERTYPE_H + + +#include + +#include +#include +#include + +#include "sipAPIQtQuick.h" + + +sipErrorState qpyquick_register_type(PyTypeObject *py_type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name, QQmlPrivate::RegisterType **rtp); + + +#endif diff --git a/qpy/QtQuick/qpyquickframebufferobject.cpp b/qpy/QtQuick/qpyquickframebufferobject.cpp new file mode 100644 index 0000000..cdf622d --- /dev/null +++ b/qpy/QtQuick/qpyquickframebufferobject.cpp @@ -0,0 +1,184 @@ +// This is the implementation of the QPyQuickFramebufferObject classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpyquickframebufferobject.h" + +#include "sipAPIQtQuick.h" + + +// The maximum number of Python QQuickFramebufferObject types. +const int NrOfQuickFramebufferObjectTypes = 30; + +// The list of registered Python types. +static QList pyqt_types; + +// The registration data for the canned types. +static QQmlPrivate::RegisterType canned_types[NrOfQuickFramebufferObjectTypes]; + +// External declarations. +extern const QMetaObject *qpyquick_pick_metaobject(const QMetaObject *super_mo, + const QMetaObject *static_mo); + + +#define QPYQUICKFRAMEBUFFEROBJECT_INIT(n) \ + case n##U: \ + QPyQuickFramebufferObject##n::staticMetaObject = *mo; \ + rt->typeId = QQmlPrivate::QmlMetaType::self(); \ + rt->listId = QQmlPrivate::QmlMetaType::list(); \ + rt->objectSize = sizeof(QPyQuickFramebufferObject##n); \ + rt->create = QQmlPrivate::createInto; \ + rt->metaObject = mo; \ + rt->attachedPropertiesFunction = QQmlPrivate::attachedPropertiesFunc(); \ + rt->attachedPropertiesMetaObject = QQmlPrivate::attachedPropertiesMetaObject(); \ + rt->parserStatusCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueSourceCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueInterceptorCast = QQmlPrivate::StaticCastSelector::cast(); \ + break + + +// The ctor. +QPyQuickFramebufferObject::QPyQuickFramebufferObject(QQuickItem *parent) + : sipQQuickFramebufferObject(parent) +{ +} + + +// Add a new Python type and return its number. +QQmlPrivate::RegisterType *QPyQuickFramebufferObject::addType( + PyTypeObject *type, const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name) +{ + int type_nr = pyqt_types.size(); + + // Check we have a spare canned type. + if (type_nr >= NrOfQuickFramebufferObjectTypes) + { + PyErr_Format(PyExc_TypeError, + "a maximum of %d QQuickFramebufferObject types may be registered with QML", + NrOfQuickFramebufferObjectTypes); + return 0; + } + + pyqt_types.append(type); + + QQmlPrivate::RegisterType *rt = &canned_types[type_nr]; + + // Initialise those members that depend on the C++ type. + switch (type_nr) + { + QPYQUICKFRAMEBUFFEROBJECT_INIT(0); + QPYQUICKFRAMEBUFFEROBJECT_INIT(1); + QPYQUICKFRAMEBUFFEROBJECT_INIT(2); + QPYQUICKFRAMEBUFFEROBJECT_INIT(3); + QPYQUICKFRAMEBUFFEROBJECT_INIT(4); + QPYQUICKFRAMEBUFFEROBJECT_INIT(5); + QPYQUICKFRAMEBUFFEROBJECT_INIT(6); + QPYQUICKFRAMEBUFFEROBJECT_INIT(7); + QPYQUICKFRAMEBUFFEROBJECT_INIT(8); + QPYQUICKFRAMEBUFFEROBJECT_INIT(9); + QPYQUICKFRAMEBUFFEROBJECT_INIT(10); + QPYQUICKFRAMEBUFFEROBJECT_INIT(11); + QPYQUICKFRAMEBUFFEROBJECT_INIT(12); + QPYQUICKFRAMEBUFFEROBJECT_INIT(13); + QPYQUICKFRAMEBUFFEROBJECT_INIT(14); + QPYQUICKFRAMEBUFFEROBJECT_INIT(15); + QPYQUICKFRAMEBUFFEROBJECT_INIT(16); + QPYQUICKFRAMEBUFFEROBJECT_INIT(17); + QPYQUICKFRAMEBUFFEROBJECT_INIT(18); + QPYQUICKFRAMEBUFFEROBJECT_INIT(19); + QPYQUICKFRAMEBUFFEROBJECT_INIT(20); + QPYQUICKFRAMEBUFFEROBJECT_INIT(21); + QPYQUICKFRAMEBUFFEROBJECT_INIT(22); + QPYQUICKFRAMEBUFFEROBJECT_INIT(23); + QPYQUICKFRAMEBUFFEROBJECT_INIT(24); + QPYQUICKFRAMEBUFFEROBJECT_INIT(25); + QPYQUICKFRAMEBUFFEROBJECT_INIT(26); + QPYQUICKFRAMEBUFFEROBJECT_INIT(27); + QPYQUICKFRAMEBUFFEROBJECT_INIT(28); + QPYQUICKFRAMEBUFFEROBJECT_INIT(29); + } + + return rt; +} + + +// Create the Python instance. +void QPyQuickFramebufferObject::createPyObject(QQuickItem *parent) +{ + SIP_BLOCK_THREADS + + // Assume C++ owns everything. + PyObject *obj = sipConvertFromNewPyType(this, pyqt_types.at(typeNr()), + NULL, &sipPySelf, "D", parent, sipType_QQuickItem, NULL); + + if (!obj) + pyqt6_qtquick_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// The canned type implementations. +#define QPYQUICKFRAMEBUFFEROBJECT_IMPL(n) \ +QPyQuickFramebufferObject##n::QPyQuickFramebufferObject##n(QQuickItem *parent) : QPyQuickFramebufferObject(parent) \ +{ \ + createPyObject(parent); \ +} \ +const QMetaObject *QPyQuickFramebufferObject##n::metaObject() const \ +{ \ + return qpyquick_pick_metaobject(QPyQuickFramebufferObject::metaObject(), &staticMetaObject); \ +} \ +QMetaObject QPyQuickFramebufferObject##n::staticMetaObject + + +QPYQUICKFRAMEBUFFEROBJECT_IMPL(0); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(1); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(2); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(3); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(4); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(5); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(6); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(7); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(8); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(9); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(10); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(11); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(12); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(13); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(14); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(15); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(16); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(17); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(18); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(19); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(20); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(21); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(22); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(23); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(24); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(25); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(26); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(27); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(28); +QPYQUICKFRAMEBUFFEROBJECT_IMPL(29); diff --git a/qpy/QtQuick/qpyquickframebufferobject.h b/qpy/QtQuick/qpyquickframebufferobject.h new file mode 100644 index 0000000..fc01128 --- /dev/null +++ b/qpy/QtQuick/qpyquickframebufferobject.h @@ -0,0 +1,97 @@ +// This is the definition of the QPyQuickFramebufferObject classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQUICKFRAMEBUFFEROBJECT_H +#define _QPYQUICKFRAMEBUFFEROBJECT_H + + +#include + +#include +#include +#include +#include + +#include "sipAPIQtQuick.h" + + +class QPyQuickFramebufferObject : public sipQQuickFramebufferObject +{ +public: + QPyQuickFramebufferObject(QQuickItem *parent = 0); + + virtual int typeNr() const = 0; + + static QQmlPrivate::RegisterType *addType(PyTypeObject *type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name); + void createPyObject(QQuickItem *parent); + +private: + QPyQuickFramebufferObject(const QPyQuickFramebufferObject &); +}; + + +// The canned type declarations. +#define QPYQUICKFRAMEBUFFEROBJECT_DECL(n) \ +class QPyQuickFramebufferObject##n : public QPyQuickFramebufferObject \ +{ \ +public: \ + QPyQuickFramebufferObject##n(QQuickItem *parent = 0); \ + static QMetaObject staticMetaObject; \ + virtual const QMetaObject *metaObject() const; \ + virtual int typeNr() const {return n##U;} \ +private: \ + QPyQuickFramebufferObject##n(const QPyQuickFramebufferObject##n &); \ +} + + +QPYQUICKFRAMEBUFFEROBJECT_DECL(0); +QPYQUICKFRAMEBUFFEROBJECT_DECL(1); +QPYQUICKFRAMEBUFFEROBJECT_DECL(2); +QPYQUICKFRAMEBUFFEROBJECT_DECL(3); +QPYQUICKFRAMEBUFFEROBJECT_DECL(4); +QPYQUICKFRAMEBUFFEROBJECT_DECL(5); +QPYQUICKFRAMEBUFFEROBJECT_DECL(6); +QPYQUICKFRAMEBUFFEROBJECT_DECL(7); +QPYQUICKFRAMEBUFFEROBJECT_DECL(8); +QPYQUICKFRAMEBUFFEROBJECT_DECL(9); +QPYQUICKFRAMEBUFFEROBJECT_DECL(10); +QPYQUICKFRAMEBUFFEROBJECT_DECL(11); +QPYQUICKFRAMEBUFFEROBJECT_DECL(12); +QPYQUICKFRAMEBUFFEROBJECT_DECL(13); +QPYQUICKFRAMEBUFFEROBJECT_DECL(14); +QPYQUICKFRAMEBUFFEROBJECT_DECL(15); +QPYQUICKFRAMEBUFFEROBJECT_DECL(16); +QPYQUICKFRAMEBUFFEROBJECT_DECL(17); +QPYQUICKFRAMEBUFFEROBJECT_DECL(18); +QPYQUICKFRAMEBUFFEROBJECT_DECL(19); +QPYQUICKFRAMEBUFFEROBJECT_DECL(20); +QPYQUICKFRAMEBUFFEROBJECT_DECL(21); +QPYQUICKFRAMEBUFFEROBJECT_DECL(22); +QPYQUICKFRAMEBUFFEROBJECT_DECL(23); +QPYQUICKFRAMEBUFFEROBJECT_DECL(24); +QPYQUICKFRAMEBUFFEROBJECT_DECL(25); +QPYQUICKFRAMEBUFFEROBJECT_DECL(26); +QPYQUICKFRAMEBUFFEROBJECT_DECL(27); +QPYQUICKFRAMEBUFFEROBJECT_DECL(28); +QPYQUICKFRAMEBUFFEROBJECT_DECL(29); + +#endif diff --git a/qpy/QtQuick/qpyquickitem.cpp b/qpy/QtQuick/qpyquickitem.cpp new file mode 100644 index 0000000..53a1b20 --- /dev/null +++ b/qpy/QtQuick/qpyquickitem.cpp @@ -0,0 +1,255 @@ +// This is the implementation of the QPyQuickItem classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpyquickitem.h" + +#include "sipAPIQtQuick.h" + + +// The maximum number of Python QQuickItem types. +const int NrOfQuickItemTypes = 60; + +// The list of registered Python types. +static QList pyqt_types; + +// The registration data for the canned types. +static QQmlPrivate::RegisterType canned_types[NrOfQuickItemTypes]; + + +// Pick the correct meta-object, either the one from the super-class or the +// static meta-object. +const QMetaObject *qpyquick_pick_metaobject(const QMetaObject *super_mo, + const QMetaObject *static_mo) +{ + // If a Python type has been sub-classed in QML then we need to use the + // QtQuick supplied meta-object. In this case it's super-class meta-object + // will be the meta-object of the Python type. Otherwise we need to use + // the static meta-object (which is a copy of the meta-object of the Python + // type). We use the class names held by the meta-objects to determine the + // correct meta-object to return. + + return (qstrcmp(super_mo->superClass()->className(), static_mo->className()) == 0) ? super_mo : static_mo; +} + + +#define QPYQUICKITEM_INIT(n) \ + case n##U: \ + QPyQuickItem##n::staticMetaObject = *mo; \ + rt->typeId = QQmlPrivate::QmlMetaType::self(); \ + rt->listId = QQmlPrivate::QmlMetaType::list(); \ + rt->objectSize = sizeof(QPyQuickItem##n); \ + rt->create = QQmlPrivate::createInto; \ + rt->metaObject = mo; \ + rt->attachedPropertiesFunction = QQmlPrivate::attachedPropertiesFunc(); \ + rt->attachedPropertiesMetaObject = QQmlPrivate::attachedPropertiesMetaObject(); \ + rt->parserStatusCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueSourceCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueInterceptorCast = QQmlPrivate::StaticCastSelector::cast(); \ + break + + +// The ctor. +QPyQuickItem::QPyQuickItem(QQuickItem *parent) : sipQQuickItem(parent) +{ +} + + +// Add a new Python type and return its number. +QQmlPrivate::RegisterType *QPyQuickItem::addType(PyTypeObject *type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name) +{ + int type_nr = pyqt_types.size(); + + // Check we have a spare canned type. + if (type_nr >= NrOfQuickItemTypes) + { + PyErr_Format(PyExc_TypeError, + "a maximum of %d QQuickItem types may be registered with QML", + NrOfQuickItemTypes); + return 0; + } + + pyqt_types.append(type); + + QQmlPrivate::RegisterType *rt = &canned_types[type_nr]; + + // Initialise those members that depend on the C++ type. + switch (type_nr) + { + QPYQUICKITEM_INIT(0); + QPYQUICKITEM_INIT(1); + QPYQUICKITEM_INIT(2); + QPYQUICKITEM_INIT(3); + QPYQUICKITEM_INIT(4); + QPYQUICKITEM_INIT(5); + QPYQUICKITEM_INIT(6); + QPYQUICKITEM_INIT(7); + QPYQUICKITEM_INIT(8); + QPYQUICKITEM_INIT(9); + QPYQUICKITEM_INIT(10); + QPYQUICKITEM_INIT(11); + QPYQUICKITEM_INIT(12); + QPYQUICKITEM_INIT(13); + QPYQUICKITEM_INIT(14); + QPYQUICKITEM_INIT(15); + QPYQUICKITEM_INIT(16); + QPYQUICKITEM_INIT(17); + QPYQUICKITEM_INIT(18); + QPYQUICKITEM_INIT(19); + QPYQUICKITEM_INIT(20); + QPYQUICKITEM_INIT(21); + QPYQUICKITEM_INIT(22); + QPYQUICKITEM_INIT(23); + QPYQUICKITEM_INIT(24); + QPYQUICKITEM_INIT(25); + QPYQUICKITEM_INIT(26); + QPYQUICKITEM_INIT(27); + QPYQUICKITEM_INIT(28); + QPYQUICKITEM_INIT(29); + QPYQUICKITEM_INIT(30); + QPYQUICKITEM_INIT(31); + QPYQUICKITEM_INIT(32); + QPYQUICKITEM_INIT(33); + QPYQUICKITEM_INIT(34); + QPYQUICKITEM_INIT(35); + QPYQUICKITEM_INIT(36); + QPYQUICKITEM_INIT(37); + QPYQUICKITEM_INIT(38); + QPYQUICKITEM_INIT(39); + QPYQUICKITEM_INIT(40); + QPYQUICKITEM_INIT(41); + QPYQUICKITEM_INIT(42); + QPYQUICKITEM_INIT(43); + QPYQUICKITEM_INIT(44); + QPYQUICKITEM_INIT(45); + QPYQUICKITEM_INIT(46); + QPYQUICKITEM_INIT(47); + QPYQUICKITEM_INIT(48); + QPYQUICKITEM_INIT(49); + QPYQUICKITEM_INIT(50); + QPYQUICKITEM_INIT(51); + QPYQUICKITEM_INIT(52); + QPYQUICKITEM_INIT(53); + QPYQUICKITEM_INIT(54); + QPYQUICKITEM_INIT(55); + QPYQUICKITEM_INIT(56); + QPYQUICKITEM_INIT(57); + QPYQUICKITEM_INIT(58); + QPYQUICKITEM_INIT(59); + } + + return rt; +} + + +// Create the Python instance. +void QPyQuickItem::createPyObject(QQuickItem *parent) +{ + SIP_BLOCK_THREADS + + // Assume C++ owns everything. + PyObject *obj = sipConvertFromNewPyType(this, pyqt_types.at(typeNr()), + NULL, &sipPySelf, "D", parent, sipType_QQuickItem, NULL); + + if (!obj) + pyqt6_qtquick_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// The canned type implementations. +#define QPYQUICKITEM_IMPL(n) \ +QPyQuickItem##n::QPyQuickItem##n(QQuickItem *parent) : QPyQuickItem(parent) \ +{ \ + createPyObject(parent); \ +} \ +const QMetaObject *QPyQuickItem##n::metaObject() const \ +{ \ + return qpyquick_pick_metaobject(QPyQuickItem::metaObject(), &staticMetaObject); \ +} \ +QMetaObject QPyQuickItem##n::staticMetaObject + + +QPYQUICKITEM_IMPL(0); +QPYQUICKITEM_IMPL(1); +QPYQUICKITEM_IMPL(2); +QPYQUICKITEM_IMPL(3); +QPYQUICKITEM_IMPL(4); +QPYQUICKITEM_IMPL(5); +QPYQUICKITEM_IMPL(6); +QPYQUICKITEM_IMPL(7); +QPYQUICKITEM_IMPL(8); +QPYQUICKITEM_IMPL(9); +QPYQUICKITEM_IMPL(10); +QPYQUICKITEM_IMPL(11); +QPYQUICKITEM_IMPL(12); +QPYQUICKITEM_IMPL(13); +QPYQUICKITEM_IMPL(14); +QPYQUICKITEM_IMPL(15); +QPYQUICKITEM_IMPL(16); +QPYQUICKITEM_IMPL(17); +QPYQUICKITEM_IMPL(18); +QPYQUICKITEM_IMPL(19); +QPYQUICKITEM_IMPL(20); +QPYQUICKITEM_IMPL(21); +QPYQUICKITEM_IMPL(22); +QPYQUICKITEM_IMPL(23); +QPYQUICKITEM_IMPL(24); +QPYQUICKITEM_IMPL(25); +QPYQUICKITEM_IMPL(26); +QPYQUICKITEM_IMPL(27); +QPYQUICKITEM_IMPL(28); +QPYQUICKITEM_IMPL(29); +QPYQUICKITEM_IMPL(30); +QPYQUICKITEM_IMPL(31); +QPYQUICKITEM_IMPL(32); +QPYQUICKITEM_IMPL(33); +QPYQUICKITEM_IMPL(34); +QPYQUICKITEM_IMPL(35); +QPYQUICKITEM_IMPL(36); +QPYQUICKITEM_IMPL(37); +QPYQUICKITEM_IMPL(38); +QPYQUICKITEM_IMPL(39); +QPYQUICKITEM_IMPL(40); +QPYQUICKITEM_IMPL(41); +QPYQUICKITEM_IMPL(42); +QPYQUICKITEM_IMPL(43); +QPYQUICKITEM_IMPL(44); +QPYQUICKITEM_IMPL(45); +QPYQUICKITEM_IMPL(46); +QPYQUICKITEM_IMPL(47); +QPYQUICKITEM_IMPL(48); +QPYQUICKITEM_IMPL(49); +QPYQUICKITEM_IMPL(50); +QPYQUICKITEM_IMPL(51); +QPYQUICKITEM_IMPL(52); +QPYQUICKITEM_IMPL(53); +QPYQUICKITEM_IMPL(54); +QPYQUICKITEM_IMPL(55); +QPYQUICKITEM_IMPL(56); +QPYQUICKITEM_IMPL(57); +QPYQUICKITEM_IMPL(58); +QPYQUICKITEM_IMPL(59); diff --git a/qpy/QtQuick/qpyquickitem.h b/qpy/QtQuick/qpyquickitem.h new file mode 100644 index 0000000..cf0af24 --- /dev/null +++ b/qpy/QtQuick/qpyquickitem.h @@ -0,0 +1,128 @@ +// This is the definition of the QPyQuickItem classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQUICKITEM_H +#define _QPYQUICKITEM_H + + +#include + +#include +#include +#include +#include + +#include "sipAPIQtQuick.h" + + +class QPyQuickItem : public sipQQuickItem +{ +public: + QPyQuickItem(QQuickItem *parent = 0); + + virtual int typeNr() const = 0; + + static QQmlPrivate::RegisterType *addType(PyTypeObject *type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name); + void createPyObject(QQuickItem *parent); + +private: + QPyQuickItem(const QPyQuickItem &); +}; + + +// The canned type declarations. +#define QPYQUICKITEM_DECL(n) \ +class QPyQuickItem##n : public QPyQuickItem \ +{ \ +public: \ + QPyQuickItem##n(QQuickItem *parent = 0); \ + static QMetaObject staticMetaObject; \ + virtual const QMetaObject *metaObject() const; \ + virtual int typeNr() const {return n##U;} \ +private: \ + QPyQuickItem##n(const QPyQuickItem##n &); \ +} + + +QPYQUICKITEM_DECL(0); +QPYQUICKITEM_DECL(1); +QPYQUICKITEM_DECL(2); +QPYQUICKITEM_DECL(3); +QPYQUICKITEM_DECL(4); +QPYQUICKITEM_DECL(5); +QPYQUICKITEM_DECL(6); +QPYQUICKITEM_DECL(7); +QPYQUICKITEM_DECL(8); +QPYQUICKITEM_DECL(9); +QPYQUICKITEM_DECL(10); +QPYQUICKITEM_DECL(11); +QPYQUICKITEM_DECL(12); +QPYQUICKITEM_DECL(13); +QPYQUICKITEM_DECL(14); +QPYQUICKITEM_DECL(15); +QPYQUICKITEM_DECL(16); +QPYQUICKITEM_DECL(17); +QPYQUICKITEM_DECL(18); +QPYQUICKITEM_DECL(19); +QPYQUICKITEM_DECL(20); +QPYQUICKITEM_DECL(21); +QPYQUICKITEM_DECL(22); +QPYQUICKITEM_DECL(23); +QPYQUICKITEM_DECL(24); +QPYQUICKITEM_DECL(25); +QPYQUICKITEM_DECL(26); +QPYQUICKITEM_DECL(27); +QPYQUICKITEM_DECL(28); +QPYQUICKITEM_DECL(29); +QPYQUICKITEM_DECL(30); +QPYQUICKITEM_DECL(31); +QPYQUICKITEM_DECL(32); +QPYQUICKITEM_DECL(33); +QPYQUICKITEM_DECL(34); +QPYQUICKITEM_DECL(35); +QPYQUICKITEM_DECL(36); +QPYQUICKITEM_DECL(37); +QPYQUICKITEM_DECL(38); +QPYQUICKITEM_DECL(39); +QPYQUICKITEM_DECL(40); +QPYQUICKITEM_DECL(41); +QPYQUICKITEM_DECL(42); +QPYQUICKITEM_DECL(43); +QPYQUICKITEM_DECL(44); +QPYQUICKITEM_DECL(45); +QPYQUICKITEM_DECL(46); +QPYQUICKITEM_DECL(47); +QPYQUICKITEM_DECL(48); +QPYQUICKITEM_DECL(49); +QPYQUICKITEM_DECL(50); +QPYQUICKITEM_DECL(51); +QPYQUICKITEM_DECL(52); +QPYQUICKITEM_DECL(53); +QPYQUICKITEM_DECL(54); +QPYQUICKITEM_DECL(55); +QPYQUICKITEM_DECL(56); +QPYQUICKITEM_DECL(57); +QPYQUICKITEM_DECL(58); +QPYQUICKITEM_DECL(59); + + +#endif diff --git a/qpy/QtQuick/qpyquickpainteditem.cpp b/qpy/QtQuick/qpyquickpainteditem.cpp new file mode 100644 index 0000000..a78bf14 --- /dev/null +++ b/qpy/QtQuick/qpyquickpainteditem.cpp @@ -0,0 +1,184 @@ +// This is the implementation of the QPyQuickPaintedItem classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpyquickpainteditem.h" + +#include "sipAPIQtQuick.h" + + +// The maximum number of Python QQuickPaintedItem types. +const int NrOfQuickPaintedItemTypes = 30; + +// The list of registered Python types. +static QList pyqt_types; + +// The registration data for the canned types. +static QQmlPrivate::RegisterType canned_types[NrOfQuickPaintedItemTypes]; + +// External declarations. +extern const QMetaObject *qpyquick_pick_metaobject(const QMetaObject *super_mo, + const QMetaObject *static_mo); + + +#define QPYQUICKPAINTEDITEM_INIT(n) \ + case n##U: \ + QPyQuickPaintedItem##n::staticMetaObject = *mo; \ + rt->typeId = QQmlPrivate::QmlMetaType::self(); \ + rt->listId = QQmlPrivate::QmlMetaType::list(); \ + rt->objectSize = sizeof(QPyQuickPaintedItem##n); \ + rt->create = QQmlPrivate::createInto; \ + rt->metaObject = mo; \ + rt->attachedPropertiesFunction = QQmlPrivate::attachedPropertiesFunc(); \ + rt->attachedPropertiesMetaObject = QQmlPrivate::attachedPropertiesMetaObject(); \ + rt->parserStatusCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueSourceCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueInterceptorCast = QQmlPrivate::StaticCastSelector::cast(); \ + break + + +// The ctor. +QPyQuickPaintedItem::QPyQuickPaintedItem(QQuickItem *parent) + : sipQQuickPaintedItem(parent) +{ +} + + +// Add a new Python type and return its number. +QQmlPrivate::RegisterType *QPyQuickPaintedItem::addType(PyTypeObject *type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name) +{ + int type_nr = pyqt_types.size(); + + // Check we have a spare canned type. + if (type_nr >= NrOfQuickPaintedItemTypes) + { + PyErr_Format(PyExc_TypeError, + "a maximum of %d QQuickPaintedItem types may be registered with QML", + NrOfQuickPaintedItemTypes); + return 0; + } + + pyqt_types.append(type); + + QQmlPrivate::RegisterType *rt = &canned_types[type_nr]; + + // Initialise those members that depend on the C++ type. + switch (type_nr) + { + QPYQUICKPAINTEDITEM_INIT(0); + QPYQUICKPAINTEDITEM_INIT(1); + QPYQUICKPAINTEDITEM_INIT(2); + QPYQUICKPAINTEDITEM_INIT(3); + QPYQUICKPAINTEDITEM_INIT(4); + QPYQUICKPAINTEDITEM_INIT(5); + QPYQUICKPAINTEDITEM_INIT(6); + QPYQUICKPAINTEDITEM_INIT(7); + QPYQUICKPAINTEDITEM_INIT(8); + QPYQUICKPAINTEDITEM_INIT(9); + QPYQUICKPAINTEDITEM_INIT(10); + QPYQUICKPAINTEDITEM_INIT(11); + QPYQUICKPAINTEDITEM_INIT(12); + QPYQUICKPAINTEDITEM_INIT(13); + QPYQUICKPAINTEDITEM_INIT(14); + QPYQUICKPAINTEDITEM_INIT(15); + QPYQUICKPAINTEDITEM_INIT(16); + QPYQUICKPAINTEDITEM_INIT(17); + QPYQUICKPAINTEDITEM_INIT(18); + QPYQUICKPAINTEDITEM_INIT(19); + QPYQUICKPAINTEDITEM_INIT(20); + QPYQUICKPAINTEDITEM_INIT(21); + QPYQUICKPAINTEDITEM_INIT(22); + QPYQUICKPAINTEDITEM_INIT(23); + QPYQUICKPAINTEDITEM_INIT(24); + QPYQUICKPAINTEDITEM_INIT(25); + QPYQUICKPAINTEDITEM_INIT(26); + QPYQUICKPAINTEDITEM_INIT(27); + QPYQUICKPAINTEDITEM_INIT(28); + QPYQUICKPAINTEDITEM_INIT(29); + } + + return rt; +} + + +// Create the Python instance. +void QPyQuickPaintedItem::createPyObject(QQuickItem *parent) +{ + SIP_BLOCK_THREADS + + // Assume C++ owns everything. + PyObject *obj = sipConvertFromNewPyType(this, pyqt_types.at(typeNr()), + NULL, &sipPySelf, "D", parent, sipType_QQuickItem, NULL); + + if (!obj) + pyqt6_qtquick_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// The canned type implementations. +#define QPYQUICKPAINTEDITEM_IMPL(n) \ +QPyQuickPaintedItem##n::QPyQuickPaintedItem##n(QQuickItem *parent) : QPyQuickPaintedItem(parent) \ +{ \ + createPyObject(parent); \ +} \ +const QMetaObject *QPyQuickPaintedItem##n::metaObject() const \ +{ \ + return qpyquick_pick_metaobject(QPyQuickPaintedItem::metaObject(), &staticMetaObject); \ +} \ +QMetaObject QPyQuickPaintedItem##n::staticMetaObject + + +QPYQUICKPAINTEDITEM_IMPL(0); +QPYQUICKPAINTEDITEM_IMPL(1); +QPYQUICKPAINTEDITEM_IMPL(2); +QPYQUICKPAINTEDITEM_IMPL(3); +QPYQUICKPAINTEDITEM_IMPL(4); +QPYQUICKPAINTEDITEM_IMPL(5); +QPYQUICKPAINTEDITEM_IMPL(6); +QPYQUICKPAINTEDITEM_IMPL(7); +QPYQUICKPAINTEDITEM_IMPL(8); +QPYQUICKPAINTEDITEM_IMPL(9); +QPYQUICKPAINTEDITEM_IMPL(10); +QPYQUICKPAINTEDITEM_IMPL(11); +QPYQUICKPAINTEDITEM_IMPL(12); +QPYQUICKPAINTEDITEM_IMPL(13); +QPYQUICKPAINTEDITEM_IMPL(14); +QPYQUICKPAINTEDITEM_IMPL(15); +QPYQUICKPAINTEDITEM_IMPL(16); +QPYQUICKPAINTEDITEM_IMPL(17); +QPYQUICKPAINTEDITEM_IMPL(18); +QPYQUICKPAINTEDITEM_IMPL(19); +QPYQUICKPAINTEDITEM_IMPL(20); +QPYQUICKPAINTEDITEM_IMPL(21); +QPYQUICKPAINTEDITEM_IMPL(22); +QPYQUICKPAINTEDITEM_IMPL(23); +QPYQUICKPAINTEDITEM_IMPL(24); +QPYQUICKPAINTEDITEM_IMPL(25); +QPYQUICKPAINTEDITEM_IMPL(26); +QPYQUICKPAINTEDITEM_IMPL(27); +QPYQUICKPAINTEDITEM_IMPL(28); +QPYQUICKPAINTEDITEM_IMPL(29); diff --git a/qpy/QtQuick/qpyquickpainteditem.h b/qpy/QtQuick/qpyquickpainteditem.h new file mode 100644 index 0000000..904d399 --- /dev/null +++ b/qpy/QtQuick/qpyquickpainteditem.h @@ -0,0 +1,98 @@ +// This is the definition of the QPyQuickPaintedItem classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQUICKPAINTEDITEM_H +#define _QPYQUICKPAINTEDITEM_H + + +#include + +#include +#include +#include +#include + +#include "sipAPIQtQuick.h" + + +class QPyQuickPaintedItem : public sipQQuickPaintedItem +{ +public: + QPyQuickPaintedItem(QQuickItem *parent = 0); + + virtual int typeNr() const = 0; + + static QQmlPrivate::RegisterType *addType(PyTypeObject *type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name); + void createPyObject(QQuickItem *parent); + +private: + QPyQuickPaintedItem(const QPyQuickPaintedItem &); +}; + + +// The canned type declarations. +#define QPYQUICKPAINTEDITEM_DECL(n) \ +class QPyQuickPaintedItem##n : public QPyQuickPaintedItem \ +{ \ +public: \ + QPyQuickPaintedItem##n(QQuickItem *parent = 0); \ + static QMetaObject staticMetaObject; \ + virtual const QMetaObject *metaObject() const; \ + virtual int typeNr() const {return n##U;} \ +private: \ + QPyQuickPaintedItem##n(const QPyQuickPaintedItem##n &); \ +} + + +QPYQUICKPAINTEDITEM_DECL(0); +QPYQUICKPAINTEDITEM_DECL(1); +QPYQUICKPAINTEDITEM_DECL(2); +QPYQUICKPAINTEDITEM_DECL(3); +QPYQUICKPAINTEDITEM_DECL(4); +QPYQUICKPAINTEDITEM_DECL(5); +QPYQUICKPAINTEDITEM_DECL(6); +QPYQUICKPAINTEDITEM_DECL(7); +QPYQUICKPAINTEDITEM_DECL(8); +QPYQUICKPAINTEDITEM_DECL(9); +QPYQUICKPAINTEDITEM_DECL(10); +QPYQUICKPAINTEDITEM_DECL(11); +QPYQUICKPAINTEDITEM_DECL(12); +QPYQUICKPAINTEDITEM_DECL(13); +QPYQUICKPAINTEDITEM_DECL(14); +QPYQUICKPAINTEDITEM_DECL(15); +QPYQUICKPAINTEDITEM_DECL(16); +QPYQUICKPAINTEDITEM_DECL(17); +QPYQUICKPAINTEDITEM_DECL(18); +QPYQUICKPAINTEDITEM_DECL(19); +QPYQUICKPAINTEDITEM_DECL(20); +QPYQUICKPAINTEDITEM_DECL(21); +QPYQUICKPAINTEDITEM_DECL(22); +QPYQUICKPAINTEDITEM_DECL(23); +QPYQUICKPAINTEDITEM_DECL(24); +QPYQUICKPAINTEDITEM_DECL(25); +QPYQUICKPAINTEDITEM_DECL(26); +QPYQUICKPAINTEDITEM_DECL(27); +QPYQUICKPAINTEDITEM_DECL(28); +QPYQUICKPAINTEDITEM_DECL(29); + + +#endif diff --git a/qpy/QtQuick/qpyquickview.cpp b/qpy/QtQuick/qpyquickview.cpp new file mode 100644 index 0000000..eee9232 --- /dev/null +++ b/qpy/QtQuick/qpyquickview.cpp @@ -0,0 +1,163 @@ +// This is the implementation of the QPyQuickWindow classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpyquickview.h" + +#include "sipAPIQtQuick.h" + + +// The maximum number of Python QQuickView types. +const int NrOfQuickViewTypes = 20; + +// The list of registered Python types. +static QList pyqt_types; + +// The registration data for the canned types. +static QQmlPrivate::RegisterType canned_types[NrOfQuickViewTypes]; + +// External declarations. +extern const QMetaObject *qpyquick_pick_metaobject(const QMetaObject *super_mo, + const QMetaObject *static_mo); + + +#define QPYQUICKVIEW_INIT(n) \ + case n##U: \ + QPyQuickView##n::staticMetaObject = *mo; \ + rt->typeId = QQmlPrivate::QmlMetaType::self(); \ + rt->listId = QQmlPrivate::QmlMetaType::list(); \ + rt->objectSize = sizeof(QPyQuickView##n); \ + rt->create = QQmlPrivate::createInto; \ + rt->metaObject = mo; \ + rt->attachedPropertiesFunction = QQmlPrivate::attachedPropertiesFunc(); \ + rt->attachedPropertiesMetaObject = QQmlPrivate::attachedPropertiesMetaObject(); \ + rt->parserStatusCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueSourceCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueInterceptorCast = QQmlPrivate::StaticCastSelector::cast(); \ + break + + +// The ctor. +QPyQuickView::QPyQuickView(QWindow *parent) : sipQQuickView(parent) +{ +} + + +// Add a new Python type and return its number. +QQmlPrivate::RegisterType *QPyQuickView::addType(PyTypeObject *type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name) +{ + int type_nr = pyqt_types.size(); + + // Check we have a spare canned type. + if (type_nr >= NrOfQuickViewTypes) + { + PyErr_Format(PyExc_TypeError, + "a maximum of %d QQuickView types may be registered with QML", + NrOfQuickViewTypes); + return 0; + } + + pyqt_types.append(type); + + QQmlPrivate::RegisterType *rt = &canned_types[type_nr]; + + // Initialise those members that depend on the C++ type. + switch (type_nr) + { + QPYQUICKVIEW_INIT(0); + QPYQUICKVIEW_INIT(1); + QPYQUICKVIEW_INIT(2); + QPYQUICKVIEW_INIT(3); + QPYQUICKVIEW_INIT(4); + QPYQUICKVIEW_INIT(5); + QPYQUICKVIEW_INIT(6); + QPYQUICKVIEW_INIT(7); + QPYQUICKVIEW_INIT(8); + QPYQUICKVIEW_INIT(9); + QPYQUICKVIEW_INIT(10); + QPYQUICKVIEW_INIT(11); + QPYQUICKVIEW_INIT(12); + QPYQUICKVIEW_INIT(13); + QPYQUICKVIEW_INIT(14); + QPYQUICKVIEW_INIT(15); + QPYQUICKVIEW_INIT(16); + QPYQUICKVIEW_INIT(17); + QPYQUICKVIEW_INIT(18); + QPYQUICKVIEW_INIT(19); + } + + return rt; +} + + +// Create the Python instance. +void QPyQuickView::createPyObject(QWindow *parent) +{ + SIP_BLOCK_THREADS + + // Assume C++ owns everything. + PyObject *obj = sipConvertFromNewPyType(this, pyqt_types.at(typeNr()), + NULL, &sipPySelf, "D", parent, sipType_QWindow, NULL); + + if (!obj) + pyqt6_qtquick_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// The canned type implementations. +#define QPYQUICKVIEW_IMPL(n) \ +QPyQuickView##n::QPyQuickView##n(QWindow *parent) : QPyQuickView(parent) \ +{ \ + createPyObject(parent); \ +} \ +const QMetaObject *QPyQuickView##n::metaObject() const \ +{ \ + return qpyquick_pick_metaobject(QPyQuickView::metaObject(), &staticMetaObject); \ +} \ +QMetaObject QPyQuickView##n::staticMetaObject + + +QPYQUICKVIEW_IMPL(0); +QPYQUICKVIEW_IMPL(1); +QPYQUICKVIEW_IMPL(2); +QPYQUICKVIEW_IMPL(3); +QPYQUICKVIEW_IMPL(4); +QPYQUICKVIEW_IMPL(5); +QPYQUICKVIEW_IMPL(6); +QPYQUICKVIEW_IMPL(7); +QPYQUICKVIEW_IMPL(8); +QPYQUICKVIEW_IMPL(9); +QPYQUICKVIEW_IMPL(10); +QPYQUICKVIEW_IMPL(11); +QPYQUICKVIEW_IMPL(12); +QPYQUICKVIEW_IMPL(13); +QPYQUICKVIEW_IMPL(14); +QPYQUICKVIEW_IMPL(15); +QPYQUICKVIEW_IMPL(16); +QPYQUICKVIEW_IMPL(17); +QPYQUICKVIEW_IMPL(18); +QPYQUICKVIEW_IMPL(19); diff --git a/qpy/QtQuick/qpyquickview.h b/qpy/QtQuick/qpyquickview.h new file mode 100644 index 0000000..1d22d90 --- /dev/null +++ b/qpy/QtQuick/qpyquickview.h @@ -0,0 +1,88 @@ +// This is the definition of the QPyQuickView classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQUICKVIEW_H +#define _QPYQUICKVIEW_H + + +#include + +#include +#include +#include +#include + +#include "sipAPIQtQuick.h" + + +class QPyQuickView : public sipQQuickView +{ +public: + QPyQuickView(QWindow *parent = 0); + + virtual int typeNr() const = 0; + + static QQmlPrivate::RegisterType *addType(PyTypeObject *type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name); + void createPyObject(QWindow *parent); + +private: + QPyQuickView(const QPyQuickView &); +}; + + +// The canned type declarations. +#define QPYQUICKVIEW_DECL(n) \ +class QPyQuickView##n : public QPyQuickView \ +{ \ +public: \ + QPyQuickView##n(QWindow *parent = 0); \ + static QMetaObject staticMetaObject; \ + virtual const QMetaObject *metaObject() const; \ + virtual int typeNr() const {return n##U;} \ +private: \ + QPyQuickView##n(const QPyQuickView##n &); \ +} + + +QPYQUICKVIEW_DECL(0); +QPYQUICKVIEW_DECL(1); +QPYQUICKVIEW_DECL(2); +QPYQUICKVIEW_DECL(3); +QPYQUICKVIEW_DECL(4); +QPYQUICKVIEW_DECL(5); +QPYQUICKVIEW_DECL(6); +QPYQUICKVIEW_DECL(7); +QPYQUICKVIEW_DECL(8); +QPYQUICKVIEW_DECL(9); +QPYQUICKVIEW_DECL(10); +QPYQUICKVIEW_DECL(11); +QPYQUICKVIEW_DECL(12); +QPYQUICKVIEW_DECL(13); +QPYQUICKVIEW_DECL(14); +QPYQUICKVIEW_DECL(15); +QPYQUICKVIEW_DECL(16); +QPYQUICKVIEW_DECL(17); +QPYQUICKVIEW_DECL(18); +QPYQUICKVIEW_DECL(19); + + +#endif diff --git a/qpy/QtQuick/qpyquickwindow.cpp b/qpy/QtQuick/qpyquickwindow.cpp new file mode 100644 index 0000000..bd7ad29 --- /dev/null +++ b/qpy/QtQuick/qpyquickwindow.cpp @@ -0,0 +1,163 @@ +// This is the implementation of the QPyQuickWindow classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpyquickwindow.h" + +#include "sipAPIQtQuick.h" + + +// The maximum number of Python QQuickWindow types. +const int NrOfQuickWindowTypes = 20; + +// The list of registered Python types. +static QList pyqt_types; + +// The registration data for the canned types. +static QQmlPrivate::RegisterType canned_types[NrOfQuickWindowTypes]; + +// External declarations. +extern const QMetaObject *qpyquick_pick_metaobject(const QMetaObject *super_mo, + const QMetaObject *static_mo); + + +#define QPYQUICKWINDOW_INIT(n) \ + case n##U: \ + QPyQuickWindow##n::staticMetaObject = *mo; \ + rt->typeId = QQmlPrivate::QmlMetaType::self(); \ + rt->listId = QQmlPrivate::QmlMetaType::list(); \ + rt->objectSize = sizeof(QPyQuickWindow##n); \ + rt->create = QQmlPrivate::createInto; \ + rt->metaObject = mo; \ + rt->attachedPropertiesFunction = QQmlPrivate::attachedPropertiesFunc(); \ + rt->attachedPropertiesMetaObject = QQmlPrivate::attachedPropertiesMetaObject(); \ + rt->parserStatusCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueSourceCast = QQmlPrivate::StaticCastSelector::cast(); \ + rt->valueInterceptorCast = QQmlPrivate::StaticCastSelector::cast(); \ + break + + +// The ctor. +QPyQuickWindow::QPyQuickWindow(QWindow *parent) : sipQQuickWindow(parent) +{ +} + + +// Add a new Python type and return its number. +QQmlPrivate::RegisterType *QPyQuickWindow::addType(PyTypeObject *type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name) +{ + int type_nr = pyqt_types.size(); + + // Check we have a spare canned type. + if (type_nr >= NrOfQuickWindowTypes) + { + PyErr_Format(PyExc_TypeError, + "a maximum of %d QQuickWindow types may be registered with QML", + NrOfQuickWindowTypes); + return 0; + } + + pyqt_types.append(type); + + QQmlPrivate::RegisterType *rt = &canned_types[type_nr]; + + // Initialise those members that depend on the C++ type. + switch (type_nr) + { + QPYQUICKWINDOW_INIT(0); + QPYQUICKWINDOW_INIT(1); + QPYQUICKWINDOW_INIT(2); + QPYQUICKWINDOW_INIT(3); + QPYQUICKWINDOW_INIT(4); + QPYQUICKWINDOW_INIT(5); + QPYQUICKWINDOW_INIT(6); + QPYQUICKWINDOW_INIT(7); + QPYQUICKWINDOW_INIT(8); + QPYQUICKWINDOW_INIT(9); + QPYQUICKWINDOW_INIT(10); + QPYQUICKWINDOW_INIT(11); + QPYQUICKWINDOW_INIT(12); + QPYQUICKWINDOW_INIT(13); + QPYQUICKWINDOW_INIT(14); + QPYQUICKWINDOW_INIT(15); + QPYQUICKWINDOW_INIT(16); + QPYQUICKWINDOW_INIT(17); + QPYQUICKWINDOW_INIT(18); + QPYQUICKWINDOW_INIT(19); + } + + return rt; +} + + +// Create the Python instance. +void QPyQuickWindow::createPyObject(QWindow *parent) +{ + SIP_BLOCK_THREADS + + // Assume C++ owns everything. + PyObject *obj = sipConvertFromNewPyType(this, pyqt_types.at(typeNr()), + NULL, &sipPySelf, "D", parent, sipType_QWindow, NULL); + + if (!obj) + pyqt6_qtquick_err_print(); + + SIP_UNBLOCK_THREADS +} + + +// The canned type implementations. +#define QPYQUICKWINDOW_IMPL(n) \ +QPyQuickWindow##n::QPyQuickWindow##n(QWindow *parent) : QPyQuickWindow(parent) \ +{ \ + createPyObject(parent); \ +} \ +const QMetaObject *QPyQuickWindow##n::metaObject() const \ +{ \ + return qpyquick_pick_metaobject(QPyQuickWindow::metaObject(), &staticMetaObject); \ +} \ +QMetaObject QPyQuickWindow##n::staticMetaObject + + +QPYQUICKWINDOW_IMPL(0); +QPYQUICKWINDOW_IMPL(1); +QPYQUICKWINDOW_IMPL(2); +QPYQUICKWINDOW_IMPL(3); +QPYQUICKWINDOW_IMPL(4); +QPYQUICKWINDOW_IMPL(5); +QPYQUICKWINDOW_IMPL(6); +QPYQUICKWINDOW_IMPL(7); +QPYQUICKWINDOW_IMPL(8); +QPYQUICKWINDOW_IMPL(9); +QPYQUICKWINDOW_IMPL(10); +QPYQUICKWINDOW_IMPL(11); +QPYQUICKWINDOW_IMPL(12); +QPYQUICKWINDOW_IMPL(13); +QPYQUICKWINDOW_IMPL(14); +QPYQUICKWINDOW_IMPL(15); +QPYQUICKWINDOW_IMPL(16); +QPYQUICKWINDOW_IMPL(17); +QPYQUICKWINDOW_IMPL(18); +QPYQUICKWINDOW_IMPL(19); diff --git a/qpy/QtQuick/qpyquickwindow.h b/qpy/QtQuick/qpyquickwindow.h new file mode 100644 index 0000000..c648a3b --- /dev/null +++ b/qpy/QtQuick/qpyquickwindow.h @@ -0,0 +1,88 @@ +// This is the definition of the QPyQuickWindow classes. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYQUICKWINDOW_H +#define _QPYQUICKWINDOW_H + + +#include + +#include +#include +#include +#include + +#include "sipAPIQtQuick.h" + + +class QPyQuickWindow : public sipQQuickWindow +{ +public: + QPyQuickWindow(QWindow *parent = 0); + + virtual int typeNr() const = 0; + + static QQmlPrivate::RegisterType *addType(PyTypeObject *type, + const QMetaObject *mo, const QByteArray &ptr_name, + const QByteArray &list_name); + void createPyObject(QWindow *parent); + +private: + QPyQuickWindow(const QPyQuickWindow &); +}; + + +// The canned type declarations. +#define QPYQUICKWINDOW_DECL(n) \ +class QPyQuickWindow##n : public QPyQuickWindow \ +{ \ +public: \ + QPyQuickWindow##n(QWindow *parent = 0); \ + static QMetaObject staticMetaObject; \ + virtual const QMetaObject *metaObject() const; \ + virtual int typeNr() const {return n##U;} \ +private: \ + QPyQuickWindow##n(const QPyQuickWindow##n &); \ +} + + +QPYQUICKWINDOW_DECL(0); +QPYQUICKWINDOW_DECL(1); +QPYQUICKWINDOW_DECL(2); +QPYQUICKWINDOW_DECL(3); +QPYQUICKWINDOW_DECL(4); +QPYQUICKWINDOW_DECL(5); +QPYQUICKWINDOW_DECL(6); +QPYQUICKWINDOW_DECL(7); +QPYQUICKWINDOW_DECL(8); +QPYQUICKWINDOW_DECL(9); +QPYQUICKWINDOW_DECL(10); +QPYQUICKWINDOW_DECL(11); +QPYQUICKWINDOW_DECL(12); +QPYQUICKWINDOW_DECL(13); +QPYQUICKWINDOW_DECL(14); +QPYQUICKWINDOW_DECL(15); +QPYQUICKWINDOW_DECL(16); +QPYQUICKWINDOW_DECL(17); +QPYQUICKWINDOW_DECL(18); +QPYQUICKWINDOW_DECL(19); + + +#endif diff --git a/qpy/QtWidgets/qpywidgets_api.h b/qpy/QtWidgets/qpywidgets_api.h new file mode 100644 index 0000000..9f3cf7a --- /dev/null +++ b/qpy/QtWidgets/qpywidgets_api.h @@ -0,0 +1,29 @@ +// This defines the API provided by this library. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYWIDGETS_API_H +#define _QPYWIDGETS_API_H + + +// Initialisation. +void qpywidgets_post_init(); + + +#endif diff --git a/qpy/QtWidgets/qpywidgets_chimera_helpers.cpp b/qpy/QtWidgets/qpywidgets_chimera_helpers.cpp new file mode 100644 index 0000000..6594d7e --- /dev/null +++ b/qpy/QtWidgets/qpywidgets_chimera_helpers.cpp @@ -0,0 +1,53 @@ +// This is the implementation of the various Chimera helpers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include + +#include "qpywidgets_chimera_helpers.h" + +#include "sipAPIQtWidgets.h" + + +// Convert a Python object to a QVariant. +bool qpywidgets_to_qvariant_convertor(PyObject *obj, QVariant &var, bool *okp) +{ + // QGraphicsItem sub-classes aren't known to the meta-object system and, + // if we didn't do anything, would be interpreted as QObjects by the + // default convertion code. This would cause problems for Python + // reimplementations of QGraphicsItem::itemChange(). + + if (!sipCanConvertToType(obj, sipType_QGraphicsItem, SIP_NO_CONVERTORS)) + return false; + + int iserr = 0; + + QGraphicsItem *qgi = reinterpret_cast( + sipConvertToType(obj, sipType_QGraphicsItem, 0, SIP_NO_CONVERTORS, + 0, &iserr)); + + *okp = !iserr; + + if (!iserr) + var.setValue(qgi); + + return true; +} diff --git a/qpy/QtWidgets/qpywidgets_chimera_helpers.h b/qpy/QtWidgets/qpywidgets_chimera_helpers.h new file mode 100644 index 0000000..1472009 --- /dev/null +++ b/qpy/QtWidgets/qpywidgets_chimera_helpers.h @@ -0,0 +1,37 @@ +// This is the definition of the various Chimera helpers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYWIDGETS_CHIMERAHELPERS_H +#define _QPYWIDGETS_CHIMERAHELPERS_H + + +#include + +#include + + +// Keep these in sync. with those defined in the public API. +typedef bool (*ToQVariantConvertorFn)(PyObject *, QVariant &, bool *); + + +bool qpywidgets_to_qvariant_convertor(PyObject *obj, QVariant &var, bool *okp); + + +#endif diff --git a/qpy/QtWidgets/qpywidgets_post_init.cpp b/qpy/QtWidgets/qpywidgets_post_init.cpp new file mode 100644 index 0000000..360eda0 --- /dev/null +++ b/qpy/QtWidgets/qpywidgets_post_init.cpp @@ -0,0 +1,41 @@ +// This is the initialisation support code for the QtWidgets module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "qpywidgets_api.h" +#include "qpywidgets_chimera_helpers.h" +#include "qpywidgets_qaction_helpers.h" + +#include "sipAPIQtWidgets.h" + + +// Perform any required initialisation. +void qpywidgets_post_init() +{ + // Import the Chimera helper registration functions. + void (*register_to_qvariant_convertor)(ToQVariantConvertorFn); + register_to_qvariant_convertor = (void (*)(ToQVariantConvertorFn))sipImportSymbol("pyqt6_register_to_qvariant_convertor"); + Q_ASSERT(register_to_qvariant_convertor); + register_to_qvariant_convertor(qpywidgets_to_qvariant_convertor); + + // Export the QAction helpers. + sipExportSymbol("pyqt6_qaction_menu", (void *)qpywidgets_qaction_menu); + sipExportSymbol("pyqt6_qaction_set_menu", + (void *)qpywidgets_qaction_set_menu); +} diff --git a/qpy/QtWidgets/qpywidgets_qaction_helpers.cpp b/qpy/QtWidgets/qpywidgets_qaction_helpers.cpp new file mode 100644 index 0000000..e3c34ed --- /dev/null +++ b/qpy/QtWidgets/qpywidgets_qaction_helpers.cpp @@ -0,0 +1,35 @@ +// This is the implementation of the various QAction helpers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "qpywidgets_qaction_helpers.h" + + +// Implement QAction::menu(). +QMenu *qpywidgets_qaction_menu(const QAction *action) +{ + return action->menu(); +} + + +// Implement QAction::setMenu(). +void qpywidgets_qaction_set_menu(QAction *action, QMenu *menu) +{ + action->setMenu(menu); +} diff --git a/qpy/QtWidgets/qpywidgets_qaction_helpers.h b/qpy/QtWidgets/qpywidgets_qaction_helpers.h new file mode 100644 index 0000000..287ac99 --- /dev/null +++ b/qpy/QtWidgets/qpywidgets_qaction_helpers.h @@ -0,0 +1,33 @@ +// This is the definition of the various QAction helpers. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _QPYWIDGETS_QACTIONHELPERS_H +#define _QPYWIDGETS_QACTIONHELPERS_H + + +#include +#include + + +QMenu *qpywidgets_qaction_menu(const QAction *action); +void qpywidgets_qaction_set_menu(QAction *action, QMenu *menu); + + +#endif diff --git a/sip/QAxContainer/QAxContainermod.sip b/sip/QAxContainer/QAxContainermod.sip new file mode 100644 index 0000000..042cd41 --- /dev/null +++ b/sip/QAxContainer/QAxContainermod.sip @@ -0,0 +1,49 @@ +// This is the SIP interface definition for the QAxContainer module of PyQt6. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QAxContainer, keyword_arguments="Optional", use_limited_api=True) + +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qaxbase.sip +%Include qaxobject.sip +%Include qaxobjectinterface.sip +%Include qaxwidget.sip diff --git a/sip/QAxContainer/qaxbase.sip b/sip/QAxContainer/qaxbase.sip new file mode 100644 index 0000000..5dc8022 --- /dev/null +++ b/sip/QAxContainer/qaxbase.sip @@ -0,0 +1,151 @@ +// This is the SIP interface definition for QAxBase. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAxBase +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QAxBase(); + + QString control() const; + + //long queryInterface(const QUuid &, void **) const; + + // Note that the order of these overloads is significant. + QVariant dynamicCall(const char *, QList & /GetWrapper/); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipRes = new QVariant(sipCpp->dynamicCall(a0, *a1)); + Py_END_ALLOW_THREADS + + // Update the input list with the (possibly) new values. + for (Py_ssize_t i = 0; i < PyList_Size(a1Wrapper); ++i) + { + QVariant *v = new QVariant(a1->at(i)); + PyObject *v_obj = sipConvertFromNewType(v, sipType_QVariant, NULL); + + if (!v_obj) + { + delete v; + sipIsErr = 1; + break; + } + + if (PyList_SetItem(a1Wrapper, i, v_obj) < 0) + { + Py_DECREF(v_obj); + sipIsErr = 1; + break; + } + } +%End + + QVariant dynamicCall(const char *, + const QVariant &value1 = QVariant(), + const QVariant &value2 = QVariant(), + const QVariant &value3 = QVariant(), + const QVariant &value4 = QVariant(), + const QVariant &value5 = QVariant(), + const QVariant &value6 = QVariant(), + const QVariant &value7 = QVariant(), + const QVariant &value8 = QVariant()); + + // Note that the order of these overloads is significant. + QAxObject *querySubObject(const char *, QList & /GetWrapper/); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->querySubObject(a0, *a1); + Py_END_ALLOW_THREADS + + // Update the input list with the (possibly) new values. + for (Py_ssize_t i = 0; i < PyList_Size(a1Wrapper); ++i) + { + QVariant *v = new QVariant(a1->at(i)); + PyObject *v_obj = sipConvertFromNewType(v, sipType_QVariant, NULL); + + if (!v_obj) + { + delete v; + sipIsErr = 1; + break; + } + + if (PyList_SetItem(a1Wrapper, i, v_obj) < 0) + { + Py_DECREF(v_obj); + sipIsErr = 1; + break; + } + } +%End + + QAxObject *querySubObject(const char *, + const QVariant &value1 = QVariant(), + const QVariant &value2 = QVariant(), + const QVariant &value3 = QVariant(), + const QVariant &value4 = QVariant(), + const QVariant &value5 = QVariant(), + const QVariant &value6 = QVariant(), + const QVariant &value7 = QVariant(), + const QVariant &value8 = QVariant()); + + // SIP has a bug triggered by a template definition being the subject of + // multiple typedefs. It only really matters when building everything as + // one big module (the code that implements the type is duplicated in + // other cases). Until it is fixed we just avoid the problematic typedef. + //typedef QMap PropertyBag; + //PropertyBag propertyBag() const; + //void setPropertyBag(const PropertyBag &); + QVariantMap propertyBag() const; + void setPropertyBag(const QVariantMap &); + + QString generateDocumentation(); + + virtual bool propertyWritable(const char *) const; + virtual void setPropertyWritable(const char *, bool); + + bool isNull() const; + + QStringList verbs() const; + + QVariant asVariant() const; + + void clear(); + bool setControl(const QString &); + + void disableMetaObject(); + void disableClassInfo(); + void disableEventSink(); + + unsigned long classContext() const; + void setClassContext(unsigned long classContext); + +protected: + QAxBase(); + + //virtual bool initialize(IUnknown** ptr); + //bool initializeRemote(IUnknown** ptr); + //bool initializeLicensed(IUnknown** ptr); + //bool initializeActive(IUnknown** ptr); + //bool initializeFromFile(IUnknown** ptr); +}; diff --git a/sip/QAxContainer/qaxobject.sip b/sip/QAxContainer/qaxobject.sip new file mode 100644 index 0000000..f016a5c --- /dev/null +++ b/sip/QAxContainer/qaxobject.sip @@ -0,0 +1,89 @@ +// This is the SIP interface definition for QAxObject. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAxBaseObject : QObject, QAxObjectInterface +{ +%TypeHeaderCode +#include +%End + +signals: + void exception(int code, const QString &source, const QString &desc, const QString &help); + void propertyChanged(const QString &name); + void signal(const QString &name, int argc, void *argv); +}; + + +class QAxObject : QAxBaseObject, QAxBase +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAxObject(QObject *parent /TransferThis/ = 0); + explicit QAxObject(const QString &, QObject *parent /TransferThis/ = 0); + //explicit QAxObject(IUnknown *, QObject *parent /TransferThis/ = 0); + ~QAxObject(); + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QAxBaseObject, &sipType_QAxBaseObject, 2, 1}, + {sipName_QAxBaseWidget, &sipType_QAxBaseWidget, 3, -1}, + {sipName_QAxObject, &sipType_QAxObject, -1, -1}, + {sipName_QAxWidget, &sipType_QAxWidget, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + + unsigned long classContext() const; + void setClassContext(unsigned long classContext); + + QString control() const; + bool setControl(const QString &c); + void resetControl(); + + void clear(); + bool doVerb(const QString &); + +protected: + void connectNotify(const QMetaMethod &); +}; diff --git a/sip/QAxContainer/qaxobjectinterface.sip b/sip/QAxContainer/qaxobjectinterface.sip new file mode 100644 index 0000000..d14a257 --- /dev/null +++ b/sip/QAxContainer/qaxobjectinterface.sip @@ -0,0 +1,34 @@ +// This is the SIP interface definition for QAxObjectInterface. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAxObjectInterface +{ +%TypeHeaderCode +#include +%End + +public: + virtual unsigned long classContext() const = 0; + virtual void setClassContext(unsigned long classContext) = 0; + + virtual QString control() const = 0; + virtual bool setControl(const QString &c) = 0; + virtual void resetControl() = 0; +}; diff --git a/sip/QAxContainer/qaxwidget.sip b/sip/QAxContainer/qaxwidget.sip new file mode 100644 index 0000000..acb0766 --- /dev/null +++ b/sip/QAxContainer/qaxwidget.sip @@ -0,0 +1,73 @@ +// This is the SIP interface definition for QAxWidget. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAxBaseWidget : QWidget, QAxObjectInterface +{ +%TypeHeaderCode +#include +%End + +signals: + void exception(int code, const QString &source, const QString &desc, const QString &help); + void propertyChanged(const QString &name); + void signal(const QString &name, int argc, void *argv); +}; + + +class QAxWidget : QAxBaseWidget, QAxBase +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAxWidget(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + explicit QAxWidget(const QString &, QWidget *parent /TransferThis/ = 0, + Qt::WindowFlags flags = Qt::WindowFlags()); + //explicit QAxWidget(IUnknown *, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + ~QAxWidget(); + + unsigned long classContext() const; + void setClassContext(unsigned long classContext); + + QString control() const; + bool setControl(const QString &c); + void resetControl(); + + void clear(); + bool doVerb(const QString &); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + + //virtual QaxAggregated *createAggregate(); + +protected: + //bool initialize(IUnknown **); + virtual bool createHostWindow(bool); + bool createHostWindow(bool, const QByteArray &); + + void changeEvent(QEvent *); + void resizeEvent(QResizeEvent *); + + virtual bool translateKeyEvent(int,int) const; + + void connectNotify(const QMetaMethod &); +}; diff --git a/sip/QtBluetooth/QtBluetoothmod.sip b/sip/QtBluetooth/QtBluetoothmod.sip new file mode 100644 index 0000000..b6c48b8 --- /dev/null +++ b/sip/QtBluetooth/QtBluetoothmod.sip @@ -0,0 +1,71 @@ +// QtBluetoothmod.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtBluetooth, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qbluetooth.sip +%Include qbluetoothaddress.sip +%Include qbluetoothdevicediscoveryagent.sip +%Include qbluetoothdeviceinfo.sip +%Include qbluetoothhostinfo.sip +%Include qbluetoothlocaldevice.sip +%Include qbluetoothserver.sip +%Include qbluetoothservicediscoveryagent.sip +%Include qbluetoothserviceinfo.sip +%Include qbluetoothsocket.sip +%Include qbluetoothuuid.sip +%Include qlowenergyadvertisingdata.sip +%Include qlowenergyadvertisingparameters.sip +%Include qlowenergycharacteristic.sip +%Include qlowenergycharacteristicdata.sip +%Include qlowenergyconnectionparameters.sip +%Include qlowenergycontroller.sip +%Include qlowenergydescriptor.sip +%Include qlowenergydescriptordata.sip +%Include qlowenergyservice.sip +%Include qlowenergyservicedata.sip +%Include qpybluetooth_quint128.sip +%Include qpybluetooth_qmultihash.sip +%Include qpybluetooth_qlist.sip diff --git a/sip/QtBluetooth/qbluetooth.sip b/sip/QtBluetooth/qbluetooth.sip new file mode 100644 index 0000000..522f4e9 --- /dev/null +++ b/sip/QtBluetooth/qbluetooth.sip @@ -0,0 +1,55 @@ +// qbluetooth.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +namespace QBluetooth +{ +%TypeHeaderCode +#include +%End + + enum class Security /BaseType=Flag/ + { + NoSecurity, + Authorization, + Authentication, + Encryption, + Secure, + }; + + typedef QFlags SecurityFlags; + + enum class AttAccessConstraint /BaseType=Flag/ + { + AttAuthorizationRequired, + AttAuthenticationRequired, + AttEncryptionRequired, + }; + + typedef QFlags AttAccessConstraints; +}; + +%End +%If (Qt_6_2_0 -) +typedef quint16 QLowEnergyHandle; +%End diff --git a/sip/QtBluetooth/qbluetoothaddress.sip b/sip/QtBluetooth/qbluetoothaddress.sip new file mode 100644 index 0000000..3262d4c --- /dev/null +++ b/sip/QtBluetooth/qbluetoothaddress.sip @@ -0,0 +1,52 @@ +// qbluetoothaddress.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothAddress +{ +%TypeHeaderCode +#include +%End + +public: + QBluetoothAddress(); + explicit QBluetoothAddress(quint64 address); + explicit QBluetoothAddress(const QString &address); + QBluetoothAddress(const QBluetoothAddress &other); + ~QBluetoothAddress(); + bool isNull() const; + void clear(); + quint64 toUInt64() const; + QString toString() const; +}; + +%End +%If (Qt_6_2_0 -) +bool operator<(const QBluetoothAddress &a, const QBluetoothAddress &b); +%End +%If (Qt_6_2_0 -) +bool operator==(const QBluetoothAddress &a, const QBluetoothAddress &b); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QBluetoothAddress &a, const QBluetoothAddress &b); +%End diff --git a/sip/QtBluetooth/qbluetoothdevicediscoveryagent.sip b/sip/QtBluetooth/qbluetoothdevicediscoveryagent.sip new file mode 100644 index 0000000..09f103a --- /dev/null +++ b/sip/QtBluetooth/qbluetoothdevicediscoveryagent.sip @@ -0,0 +1,81 @@ +// qbluetoothdevicediscoveryagent.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothDeviceDiscoveryAgent : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + NoError, + InputOutputError, + PoweredOffError, + InvalidBluetoothAdapterError, + UnsupportedPlatformError, + UnsupportedDiscoveryMethod, + LocationServiceTurnedOffError, +%If (Qt_6_4_0 -) + MissingPermissionsError, +%End + UnknownError, + }; + + explicit QBluetoothDeviceDiscoveryAgent(QObject *parent /TransferThis/ = 0); + QBluetoothDeviceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent /TransferThis/ = 0); + virtual ~QBluetoothDeviceDiscoveryAgent(); + bool isActive() const; + QBluetoothDeviceDiscoveryAgent::Error error() const; + QString errorString() const; + QList discoveredDevices() const; + +public slots: + void start(); + void start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods method); + void stop(); + +signals: + void deviceDiscovered(const QBluetoothDeviceInfo &info); + void finished(); + void errorOccurred(QBluetoothDeviceDiscoveryAgent::Error error); + void canceled(); + void deviceUpdated(const QBluetoothDeviceInfo &info, QBluetoothDeviceInfo::Fields updatedFields); + +public: + enum DiscoveryMethod /BaseType=Flag/ + { + NoMethod, + ClassicMethod, + LowEnergyMethod, + }; + + typedef QFlags DiscoveryMethods; + void setLowEnergyDiscoveryTimeout(int msTimeout); + int lowEnergyDiscoveryTimeout() const; + static QBluetoothDeviceDiscoveryAgent::DiscoveryMethods supportedDiscoveryMethods(); +}; + +%End diff --git a/sip/QtBluetooth/qbluetoothdeviceinfo.sip b/sip/QtBluetooth/qbluetoothdeviceinfo.sip new file mode 100644 index 0000000..4e35aab --- /dev/null +++ b/sip/QtBluetooth/qbluetoothdeviceinfo.sip @@ -0,0 +1,245 @@ +// qbluetoothdeviceinfo.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothDeviceInfo +{ +%TypeHeaderCode +#include +%End + +public: + enum MajorDeviceClass + { + MiscellaneousDevice, + ComputerDevice, + PhoneDevice, + NetworkDevice, + AudioVideoDevice, + PeripheralDevice, + ImagingDevice, + WearableDevice, + ToyDevice, + HealthDevice, + UncategorizedDevice, + }; + + enum MinorMiscellaneousClass + { + UncategorizedMiscellaneous, + }; + + enum MinorComputerClass + { + UncategorizedComputer, + DesktopComputer, + ServerComputer, + LaptopComputer, + HandheldClamShellComputer, + HandheldComputer, + WearableComputer, + }; + + enum MinorPhoneClass + { + UncategorizedPhone, + CellularPhone, + CordlessPhone, + SmartPhone, + WiredModemOrVoiceGatewayPhone, + CommonIsdnAccessPhone, + }; + + enum MinorNetworkClass + { + NetworkFullService, + NetworkLoadFactorOne, + NetworkLoadFactorTwo, + NetworkLoadFactorThree, + NetworkLoadFactorFour, + NetworkLoadFactorFive, + NetworkLoadFactorSix, + NetworkNoService, + }; + + enum MinorAudioVideoClass + { + UncategorizedAudioVideoDevice, + WearableHeadsetDevice, + HandsFreeDevice, + Microphone, + Loudspeaker, + Headphones, + PortableAudioDevice, + CarAudio, + SetTopBox, + HiFiAudioDevice, + Vcr, + VideoCamera, + Camcorder, + VideoMonitor, + VideoDisplayAndLoudspeaker, + VideoConferencing, + GamingDevice, + }; + + enum MinorPeripheralClass + { + UncategorizedPeripheral, + KeyboardPeripheral, + PointingDevicePeripheral, + KeyboardWithPointingDevicePeripheral, + JoystickPeripheral, + GamepadPeripheral, + RemoteControlPeripheral, + SensingDevicePeripheral, + DigitizerTabletPeripheral, + CardReaderPeripheral, + }; + + enum MinorImagingClass + { + UncategorizedImagingDevice, + ImageDisplay, + ImageCamera, + ImageScanner, + ImagePrinter, + }; + + enum MinorWearableClass + { + UncategorizedWearableDevice, + WearableWristWatch, + WearablePager, + WearableJacket, + WearableHelmet, + WearableGlasses, + }; + + enum MinorToyClass + { + UncategorizedToy, + ToyRobot, + ToyVehicle, + ToyDoll, + ToyController, + ToyGame, + }; + + enum MinorHealthClass + { + UncategorizedHealthDevice, + HealthBloodPressureMonitor, + HealthThermometer, + HealthWeightScale, + HealthGlucoseMeter, + HealthPulseOximeter, + HealthDataDisplay, + HealthStepCounter, + }; + + enum ServiceClass /BaseType=Flag/ + { + NoService, + PositioningService, + NetworkingService, + RenderingService, + CapturingService, + ObjectTransferService, + AudioService, + TelephonyService, + InformationService, + AllServices, + }; + + typedef QFlags ServiceClasses; + QBluetoothDeviceInfo(); + QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name, quint32 classOfDevice); + QBluetoothDeviceInfo(const QBluetoothUuid &uuid, const QString &name, quint32 classOfDevice); + QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other); + ~QBluetoothDeviceInfo(); + bool isValid() const; + bool isCached() const; + void setCached(bool cached); + QBluetoothAddress address() const; + QString name() const; + QBluetoothDeviceInfo::ServiceClasses serviceClasses() const; + QBluetoothDeviceInfo::MajorDeviceClass majorDeviceClass() const; + quint8 minorDeviceClass() const; + qint16 rssi() const; + void setRssi(qint16 signal); + void setServiceUuids(const QList &uuids); + QList serviceUuids() const; + + enum CoreConfiguration /BaseType=Flag/ + { + UnknownCoreConfiguration, + LowEnergyCoreConfiguration, + BaseRateCoreConfiguration, + BaseRateAndLowEnergyCoreConfiguration, + }; + + typedef QFlags CoreConfigurations; + void setCoreConfigurations(QBluetoothDeviceInfo::CoreConfigurations coreConfigs); + QBluetoothDeviceInfo::CoreConfigurations coreConfigurations() const; + void setDeviceUuid(const QBluetoothUuid &uuid); + QBluetoothUuid deviceUuid() const; + + enum class Field /BaseType=Flag/ + { + None, + RSSI, + ManufacturerData, +%If (Qt_6_3_0 -) + ServiceData, +%End + All, + }; + + typedef QFlags Fields; + QList manufacturerIds() const; + QMultiHash manufacturerData() const; + QByteArray manufacturerData(quint16 manufacturerId) const; + bool setManufacturerData(quint16 manufacturerId, const QByteArray &data); + void setName(const QString &name); +%If (Qt_6_3_0 -) + QList serviceIds() const; +%End +%If (Qt_6_3_0 -) + QMultiHash serviceData() const; +%End +%If (Qt_6_3_0 -) + QByteArray serviceData(const QBluetoothUuid &serviceId) const; +%End +%If (Qt_6_3_0 -) + bool setServiceData(const QBluetoothUuid &serviceId, const QByteArray &data); +%End +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b); +%End diff --git a/sip/QtBluetooth/qbluetoothhostinfo.sip b/sip/QtBluetooth/qbluetoothhostinfo.sip new file mode 100644 index 0000000..1b2536c --- /dev/null +++ b/sip/QtBluetooth/qbluetoothhostinfo.sip @@ -0,0 +1,47 @@ +// qbluetoothhostinfo.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothHostInfo +{ +%TypeHeaderCode +#include +%End + +public: + QBluetoothHostInfo(); + QBluetoothHostInfo(const QBluetoothHostInfo &other); + ~QBluetoothHostInfo(); + QBluetoothAddress address() const; + void setAddress(const QBluetoothAddress &address); + QString name() const; + void setName(const QString &name); +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b); +%End diff --git a/sip/QtBluetooth/qbluetoothlocaldevice.sip b/sip/QtBluetooth/qbluetoothlocaldevice.sip new file mode 100644 index 0000000..02868fc --- /dev/null +++ b/sip/QtBluetooth/qbluetoothlocaldevice.sip @@ -0,0 +1,79 @@ +// qbluetoothlocaldevice.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothLocalDevice : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Pairing + { + Unpaired, + Paired, + AuthorizedPaired, + }; + + enum HostMode + { + HostPoweredOff, + HostConnectable, + HostDiscoverable, + HostDiscoverableLimitedInquiry, + }; + + enum Error + { + NoError, + PairingError, +%If (Qt_6_4_0 -) + MissingPermissionsError, +%End + UnknownError, + }; + + explicit QBluetoothLocalDevice(QObject *parent /TransferThis/ = 0); + QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent /TransferThis/ = 0); + virtual ~QBluetoothLocalDevice(); + bool isValid() const; + void requestPairing(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); + QBluetoothLocalDevice::Pairing pairingStatus(const QBluetoothAddress &address) const; + void setHostMode(QBluetoothLocalDevice::HostMode mode); + QBluetoothLocalDevice::HostMode hostMode() const; + void powerOn(); + QString name() const; + QBluetoothAddress address() const; + static QList allDevices(); + QList connectedDevices() const; + +signals: + void hostModeStateChanged(QBluetoothLocalDevice::HostMode state); + void pairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); + void errorOccurred(QBluetoothLocalDevice::Error error); + void deviceConnected(const QBluetoothAddress &address); + void deviceDisconnected(const QBluetoothAddress &address); +}; + +%End diff --git a/sip/QtBluetooth/qbluetoothserver.sip b/sip/QtBluetooth/qbluetoothserver.sip new file mode 100644 index 0000000..826f546 --- /dev/null +++ b/sip/QtBluetooth/qbluetoothserver.sip @@ -0,0 +1,101 @@ +// qbluetoothserver.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothServer : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QBluetoothDeviceDiscoveryAgent, &sipType_QBluetoothDeviceDiscoveryAgent, -1, 1}, + {sipName_QBluetoothLocalDevice, &sipType_QBluetoothLocalDevice, -1, 2}, + {sipName_QBluetoothServer, &sipType_QBluetoothServer, -1, 3}, + {sipName_QBluetoothServiceDiscoveryAgent, &sipType_QBluetoothServiceDiscoveryAgent, -1, 4}, + {sipName_QBluetoothSocket, &sipType_QBluetoothSocket, -1, 5}, + {sipName_QLowEnergyController, &sipType_QLowEnergyController, -1, 6}, + {sipName_QLowEnergyService, &sipType_QLowEnergyService, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum Error + { + NoError, + UnknownError, + PoweredOffError, + InputOutputError, + ServiceAlreadyRegisteredError, + UnsupportedProtocolError, +%If (Qt_6_4_0 -) + MissingPermissionsError, +%End + }; + + QBluetoothServer(QBluetoothServiceInfo::Protocol serverType, QObject *parent /TransferThis/ = 0); + virtual ~QBluetoothServer(); + void close() /ReleaseGIL/; + bool listen(const QBluetoothAddress &address = QBluetoothAddress(), quint16 port = 0) /ReleaseGIL/; + QBluetoothServiceInfo listen(const QBluetoothUuid &uuid, const QString &serviceName = QString()) /ReleaseGIL/; + bool isListening() const; + void setMaxPendingConnections(int numConnections); + int maxPendingConnections() const; + bool hasPendingConnections() const; + QBluetoothSocket *nextPendingConnection() /Factory/; + QBluetoothAddress serverAddress() const; + quint16 serverPort() const; + void setSecurityFlags(QBluetooth::SecurityFlags security); + QBluetooth::SecurityFlags securityFlags() const; + QBluetoothServiceInfo::Protocol serverType() const; + QBluetoothServer::Error error() const; + +signals: + void newConnection(); + void errorOccurred(QBluetoothServer::Error error); +}; + +%End diff --git a/sip/QtBluetooth/qbluetoothservicediscoveryagent.sip b/sip/QtBluetooth/qbluetoothservicediscoveryagent.sip new file mode 100644 index 0000000..d0559d0 --- /dev/null +++ b/sip/QtBluetooth/qbluetoothservicediscoveryagent.sip @@ -0,0 +1,75 @@ +// qbluetoothservicediscoveryagent.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothServiceDiscoveryAgent : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + NoError, + InputOutputError, + PoweredOffError, + InvalidBluetoothAdapterError, +%If (Qt_6_4_0 -) + MissingPermissionsError, +%End + UnknownError, + }; + + enum DiscoveryMode + { + MinimalDiscovery, + FullDiscovery, + }; + + explicit QBluetoothServiceDiscoveryAgent(QObject *parent /TransferThis/ = 0); + QBluetoothServiceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent /TransferThis/ = 0); + virtual ~QBluetoothServiceDiscoveryAgent(); + bool isActive() const; + QBluetoothServiceDiscoveryAgent::Error error() const; + QString errorString() const; + QList discoveredServices() const; + void setUuidFilter(const QList &uuids); + void setUuidFilter(const QBluetoothUuid &uuid); + QList uuidFilter() const; + bool setRemoteAddress(const QBluetoothAddress &address); + QBluetoothAddress remoteAddress() const; + +public slots: + void start(QBluetoothServiceDiscoveryAgent::DiscoveryMode mode = QBluetoothServiceDiscoveryAgent::MinimalDiscovery); + void stop(); + void clear(); + +signals: + void serviceDiscovered(const QBluetoothServiceInfo &info); + void finished(); + void canceled(); + void errorOccurred(QBluetoothServiceDiscoveryAgent::Error error); +}; + +%End diff --git a/sip/QtBluetooth/qbluetoothserviceinfo.sip b/sip/QtBluetooth/qbluetoothserviceinfo.sip new file mode 100644 index 0000000..7d891ca --- /dev/null +++ b/sip/QtBluetooth/qbluetoothserviceinfo.sip @@ -0,0 +1,95 @@ +// qbluetoothserviceinfo.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothServiceInfo +{ +%TypeHeaderCode +#include +%End + +public: + enum AttributeId + { + ServiceRecordHandle, + ServiceClassIds, + ServiceRecordState, + ServiceId, + ProtocolDescriptorList, + BrowseGroupList, + LanguageBaseAttributeIdList, + ServiceInfoTimeToLive, + ServiceAvailability, + BluetoothProfileDescriptorList, + DocumentationUrl, + ClientExecutableUrl, + IconUrl, + AdditionalProtocolDescriptorList, + PrimaryLanguageBase, + ServiceName, + ServiceDescription, + ServiceProvider, + }; + + enum Protocol + { + UnknownProtocol, + L2capProtocol, + RfcommProtocol, + }; + + QBluetoothServiceInfo(); + QBluetoothServiceInfo(const QBluetoothServiceInfo &other); + ~QBluetoothServiceInfo(); + bool isValid() const; + bool isComplete() const; + void setDevice(const QBluetoothDeviceInfo &info); + QBluetoothDeviceInfo device() const; + QVariant attribute(quint16 attributeId) const; + QList attributes() const; + bool contains(quint16 attributeId) const; + void removeAttribute(quint16 attributeId); + QBluetoothServiceInfo::Protocol socketProtocol() const; + int protocolServiceMultiplexer() const; + int serverChannel() const; + QBluetoothServiceInfo::Sequence protocolDescriptor(QBluetoothUuid::ProtocolUuid protocol) const; + bool isRegistered() const; + bool registerService(const QBluetoothAddress &localAdapter = QBluetoothAddress()); + bool unregisterService(); + void setAttribute(quint16 attributeId, const QBluetoothUuid &value); + void setAttribute(quint16 attributeId, const QBluetoothServiceInfo::Sequence &value); + void setAttribute(quint16 attributeId, const QVariant &value); + void setServiceName(const QString &name); + QString serviceName() const; + void setServiceDescription(const QString &description); + QString serviceDescription() const; + void setServiceProvider(const QString &provider); + QString serviceProvider() const; + void setServiceAvailability(quint8 availability); + quint8 serviceAvailability() const; + void setServiceUuid(const QBluetoothUuid &uuid); + QBluetoothUuid serviceUuid() const; + QList serviceClassUuids() const; +}; + +%End diff --git a/sip/QtBluetooth/qbluetoothsocket.sip b/sip/QtBluetooth/qbluetoothsocket.sip new file mode 100644 index 0000000..ab88dc7 --- /dev/null +++ b/sip/QtBluetooth/qbluetoothsocket.sip @@ -0,0 +1,140 @@ +// qbluetoothsocket.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothSocket : QIODevice +{ +%TypeHeaderCode +#include +%End + +public: + enum class SocketState + { + UnconnectedState, + ServiceLookupState, + ConnectingState, + ConnectedState, + BoundState, + ClosingState, + ListeningState, + }; + + enum class SocketError + { + NoSocketError, + UnknownSocketError, + RemoteHostClosedError, + HostNotFoundError, + ServiceNotFoundError, + NetworkError, + UnsupportedProtocolError, + OperationError, +%If (Qt_6_4_0 -) + MissingPermissionsError, +%End + }; + + QBluetoothSocket(QBluetoothServiceInfo::Protocol socketType, QObject *parent /TransferThis/ = 0); + explicit QBluetoothSocket(QObject *parent /TransferThis/ = 0); + virtual ~QBluetoothSocket(); + void abort(); + virtual void close() /ReleaseGIL/; + virtual bool isSequential() const; + virtual qint64 bytesAvailable() const; + virtual qint64 bytesToWrite() const; + virtual bool canReadLine() const; + void connectToService(const QBluetoothAddress &address, QBluetoothUuid::ServiceClassUuid uuid, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/; + void connectToService(const QBluetoothAddress &address, quint16 port, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/; + void connectToService(const QBluetoothAddress &address, const QBluetoothUuid &uuid, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/; + void connectToService(const QBluetoothServiceInfo &service, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/; + void disconnectFromService() /ReleaseGIL/; + QString localName() const; + QBluetoothAddress localAddress() const; + quint16 localPort() const; + QString peerName() const; + QBluetoothAddress peerAddress() const; + quint16 peerPort() const; + bool setSocketDescriptor(int socketDescriptor, QBluetoothServiceInfo::Protocol socketType, QBluetoothSocket::SocketState state = QBluetoothSocket::SocketState::ConnectedState, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite); + int socketDescriptor() const; + QBluetoothServiceInfo::Protocol socketType() const; + QBluetoothSocket::SocketState state() const; + QBluetoothSocket::SocketError error() const; + QString errorString() const; + +signals: + void connected(); + void disconnected(); + void errorOccurred(QBluetoothSocket::SocketError error); + void stateChanged(QBluetoothSocket::SocketState state); + +protected: + virtual SIP_PYOBJECT readData(qint64 maxlen) /TypeHint="bytes",ReleaseGIL/ [qint64 (char *data, qint64 maxSize)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QBluetoothSocket::readData(s, a0) : sipCpp->readData(s, a0); + #else + len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual qint64 writeData(const char *data /Array/, qint64 maxSize /ArraySize/) /ReleaseGIL/; + void setSocketState(QBluetoothSocket::SocketState state); + void setSocketError(QBluetoothSocket::SocketError error); + void doDeviceDiscovery(const QBluetoothServiceInfo &service, QIODeviceBase::OpenMode openMode); + +public: + void setPreferredSecurityFlags(QBluetooth::SecurityFlags flags); + QBluetooth::SecurityFlags preferredSecurityFlags() const; +}; + +%End diff --git a/sip/QtBluetooth/qbluetoothuuid.sip b/sip/QtBluetooth/qbluetoothuuid.sip new file mode 100644 index 0000000..d383dcd --- /dev/null +++ b/sip/QtBluetooth/qbluetoothuuid.sip @@ -0,0 +1,347 @@ +// qbluetoothuuid.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QBluetoothUuid : QUuid +{ +%TypeHeaderCode +#include +%End + +public: + enum class ProtocolUuid + { + Sdp, + Udp, + Rfcomm, + Tcp, + TcsBin, + TcsAt, + Att, + Obex, + Ip, + Ftp, + Http, + Wsp, + Bnep, + Upnp, + Hidp, + HardcopyControlChannel, + HardcopyDataChannel, + HardcopyNotification, + Avctp, + Avdtp, + Cmtp, + UdiCPlain, + McapControlChannel, + McapDataChannel, + L2cap, + }; + + enum class ServiceClassUuid + { + ServiceDiscoveryServer, + BrowseGroupDescriptor, + PublicBrowseGroup, + SerialPort, + LANAccessUsingPPP, + DialupNetworking, + IrMCSync, + ObexObjectPush, + OBEXFileTransfer, + IrMCSyncCommand, + Headset, + AudioSource, + AudioSink, + AV_RemoteControlTarget, + AdvancedAudioDistribution, + AV_RemoteControl, + AV_RemoteControlController, + HeadsetAG, + PANU, + NAP, + GN, + DirectPrinting, + ReferencePrinting, + BasicImage, + ImagingResponder, + ImagingAutomaticArchive, + ImagingReferenceObjects, + Handsfree, + HandsfreeAudioGateway, + DirectPrintingReferenceObjectsService, + ReflectedUI, + BasicPrinting, + PrintingStatus, + HumanInterfaceDeviceService, + HardcopyCableReplacement, + HCRPrint, + HCRScan, + SIMAccess, + PhonebookAccessPCE, + PhonebookAccessPSE, + PhonebookAccess, + HeadsetHS, + MessageAccessServer, + MessageNotificationServer, + MessageAccessProfile, + GNSS, + GNSSServer, + Display3D, + Glasses3D, + Synchronization3D, + MPSProfile, + MPSService, + PnPInformation, + GenericNetworking, + GenericFileTransfer, + GenericAudio, + GenericTelephony, + VideoSource, + VideoSink, + VideoDistribution, + HDP, + HDPSource, + HDPSink, + GenericAccess, + GenericAttribute, + ImmediateAlert, + LinkLoss, + TxPower, + CurrentTimeService, + ReferenceTimeUpdateService, + NextDSTChangeService, + Glucose, + HealthThermometer, + DeviceInformation, + HeartRate, + PhoneAlertStatusService, + BatteryService, + BloodPressure, + AlertNotificationService, + HumanInterfaceDevice, + ScanParameters, + RunningSpeedAndCadence, + CyclingSpeedAndCadence, + CyclingPower, + LocationAndNavigation, + EnvironmentalSensing, + BodyComposition, + UserData, + WeightScale, + BondManagement, + ContinuousGlucoseMonitoring, + }; + + enum class CharacteristicType + { + DeviceName, + Appearance, + PeripheralPrivacyFlag, + ReconnectionAddress, + PeripheralPreferredConnectionParameters, + ServiceChanged, + AlertLevel, + TxPowerLevel, + DateTime, + DayOfWeek, + DayDateTime, + ExactTime256, + DSTOffset, + TimeZone, + LocalTimeInformation, + TimeWithDST, + TimeAccuracy, + TimeSource, + ReferenceTimeInformation, + TimeUpdateControlPoint, + TimeUpdateState, + GlucoseMeasurement, + BatteryLevel, + TemperatureMeasurement, + TemperatureType, + IntermediateTemperature, + MeasurementInterval, + BootKeyboardInputReport, + SystemID, + ModelNumberString, + SerialNumberString, + FirmwareRevisionString, + HardwareRevisionString, + SoftwareRevisionString, + ManufacturerNameString, + IEEE1107320601RegulatoryCertificationDataList, + CurrentTime, + MagneticDeclination, + ScanRefresh, + BootKeyboardOutputReport, + BootMouseInputReport, + GlucoseMeasurementContext, + BloodPressureMeasurement, + IntermediateCuffPressure, + HeartRateMeasurement, + BodySensorLocation, + HeartRateControlPoint, + AlertStatus, + RingerControlPoint, + RingerSetting, + AlertCategoryIDBitMask, + AlertCategoryID, + AlertNotificationControlPoint, + UnreadAlertStatus, + NewAlert, + SupportedNewAlertCategory, + SupportedUnreadAlertCategory, + BloodPressureFeature, + HIDInformation, + ReportMap, + HIDControlPoint, + Report, + ProtocolMode, + ScanIntervalWindow, + PnPID, + GlucoseFeature, + RecordAccessControlPoint, + RSCMeasurement, + RSCFeature, + SCControlPoint, + CSCMeasurement, + CSCFeature, + SensorLocation, + CyclingPowerMeasurement, + CyclingPowerVector, + CyclingPowerFeature, + CyclingPowerControlPoint, + LocationAndSpeed, + Navigation, + PositionQuality, + LNFeature, + LNControlPoint, + Elevation, + Pressure, + Temperature, + Humidity, + TrueWindSpeed, + TrueWindDirection, + ApparentWindSpeed, + ApparentWindDirection, + GustFactor, + PollenConcentration, + UVIndex, + Irradiance, + Rainfall, + WindChill, + HeatIndex, + DewPoint, + DescriptorValueChanged, + AerobicHeartRateLowerLimit, + AerobicThreshold, + Age, + AnaerobicHeartRateLowerLimit, + AnaerobicHeartRateUpperLimit, + AnaerobicThreshold, + AerobicHeartRateUpperLimit, + DateOfBirth, + DateOfThresholdAssessment, + EmailAddress, + FatBurnHeartRateLowerLimit, + FatBurnHeartRateUpperLimit, + FirstName, + FiveZoneHeartRateLimits, + Gender, + HeartRateMax, + Height, + HipCircumference, + LastName, + MaximumRecommendedHeartRate, + RestingHeartRate, + SportTypeForAerobicAnaerobicThresholds, + ThreeZoneHeartRateLimits, + TwoZoneHeartRateLimits, + VO2Max, + WaistCircumference, + Weight, + DatabaseChangeIncrement, + UserIndex, + BodyCompositionFeature, + BodyCompositionMeasurement, + WeightMeasurement, + WeightScaleFeature, + UserControlPoint, + MagneticFluxDensity2D, + MagneticFluxDensity3D, + Language, + BarometricPressureTrend, + }; + + enum class DescriptorType + { + UnknownDescriptorType, + CharacteristicExtendedProperties, + CharacteristicUserDescription, + ClientCharacteristicConfiguration, + ServerCharacteristicConfiguration, + CharacteristicPresentationFormat, + CharacteristicAggregateFormat, + ValidRange, + ExternalReportReference, + ReportReference, + EnvironmentalSensingConfiguration, + EnvironmentalSensingMeasurement, + EnvironmentalSensingTriggerSetting, + }; + + QBluetoothUuid(); + QBluetoothUuid(QBluetoothUuid::ProtocolUuid uuid); + QBluetoothUuid(QBluetoothUuid::ServiceClassUuid uuid); + QBluetoothUuid(QBluetoothUuid::CharacteristicType uuid); + QBluetoothUuid(QBluetoothUuid::DescriptorType uuid); + explicit QBluetoothUuid(quint32 uuid); + explicit QBluetoothUuid(quint128 uuid); + explicit QBluetoothUuid(const QString &uuid); + QBluetoothUuid(const QBluetoothUuid &uuid); + QBluetoothUuid(const QUuid &uuid); + ~QBluetoothUuid(); + int minimumSize() const; + quint16 toUInt16(bool *ok = 0) const; + quint32 toUInt32(bool *ok = 0) const; + quint128 toUInt128() const; + static QString serviceClassToString(QBluetoothUuid::ServiceClassUuid uuid); + static QString protocolToString(QBluetoothUuid::ProtocolUuid uuid); + static QString characteristicToString(QBluetoothUuid::CharacteristicType uuid); + static QString descriptorToString(QBluetoothUuid::DescriptorType uuid); +}; + +%End +%If (Qt_6_2_0 -) +QDataStream &operator<<(QDataStream &s, const QBluetoothUuid &uuid) /ReleaseGIL/; +%End +%If (Qt_6_2_0 -) +QDataStream &operator>>(QDataStream &s, QBluetoothUuid &uuid /Constrained/) /ReleaseGIL/; +%End +%If (Qt_6_2_0 -) +bool operator==(const QBluetoothUuid &a, const QBluetoothUuid &b); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QBluetoothUuid &a, const QBluetoothUuid &b); +%End diff --git a/sip/QtBluetooth/qlowenergyadvertisingdata.sip b/sip/QtBluetooth/qlowenergyadvertisingdata.sip new file mode 100644 index 0000000..89d3ce9 --- /dev/null +++ b/sip/QtBluetooth/qlowenergyadvertisingdata.sip @@ -0,0 +1,66 @@ +// qlowenergyadvertisingdata.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyAdvertisingData +{ +%TypeHeaderCode +#include +%End + +public: + QLowEnergyAdvertisingData(); + QLowEnergyAdvertisingData(const QLowEnergyAdvertisingData &other); + ~QLowEnergyAdvertisingData(); + void setLocalName(const QString &name); + QString localName() const; + static quint16 invalidManufacturerId(); + void setManufacturerData(quint16 id, const QByteArray &data); + quint16 manufacturerId() const; + QByteArray manufacturerData() const; + void setIncludePowerLevel(bool doInclude); + bool includePowerLevel() const; + + enum Discoverability + { + DiscoverabilityNone, + DiscoverabilityLimited, + DiscoverabilityGeneral, + }; + + void setDiscoverability(QLowEnergyAdvertisingData::Discoverability mode); + QLowEnergyAdvertisingData::Discoverability discoverability() const; + void setServices(const QList &services); + QList services() const; + void setRawData(const QByteArray &data); + QByteArray rawData() const; + void swap(QLowEnergyAdvertisingData &other); +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QLowEnergyAdvertisingData &data1, const QLowEnergyAdvertisingData &data2); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QLowEnergyAdvertisingData &data1, const QLowEnergyAdvertisingData &data2); +%End diff --git a/sip/QtBluetooth/qlowenergyadvertisingparameters.sip b/sip/QtBluetooth/qlowenergyadvertisingparameters.sip new file mode 100644 index 0000000..df11761 --- /dev/null +++ b/sip/QtBluetooth/qlowenergyadvertisingparameters.sip @@ -0,0 +1,88 @@ +// qlowenergyadvertisingparameters.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyAdvertisingParameters +{ +%TypeHeaderCode +#include +%End + +public: + QLowEnergyAdvertisingParameters(); + QLowEnergyAdvertisingParameters(const QLowEnergyAdvertisingParameters &other); + ~QLowEnergyAdvertisingParameters(); + + enum Mode + { + AdvInd, + AdvScanInd, + AdvNonConnInd, + }; + + void setMode(QLowEnergyAdvertisingParameters::Mode mode); + QLowEnergyAdvertisingParameters::Mode mode() const; + + class AddressInfo + { +%TypeHeaderCode +#include +%End + + public: + AddressInfo(const QBluetoothAddress &addr, QLowEnergyController::RemoteAddressType t); + AddressInfo(); + QBluetoothAddress address; + QLowEnergyController::RemoteAddressType type; + }; + + enum FilterPolicy + { + IgnoreWhiteList, + UseWhiteListForScanning, + UseWhiteListForConnecting, + UseWhiteListForScanningAndConnecting, + }; + + void setWhiteList(const QList &whiteList, QLowEnergyAdvertisingParameters::FilterPolicy policy); + QList whiteList() const; + QLowEnergyAdvertisingParameters::FilterPolicy filterPolicy() const; + void setInterval(quint16 minimum, quint16 maximum); + int minimumInterval() const; + int maximumInterval() const; + void swap(QLowEnergyAdvertisingParameters &other); +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QLowEnergyAdvertisingParameters &p1, const QLowEnergyAdvertisingParameters &p2); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QLowEnergyAdvertisingParameters &p1, const QLowEnergyAdvertisingParameters &p2); +%End +%If (Qt_6_2_0 -) +bool operator==(const QLowEnergyAdvertisingParameters::AddressInfo &ai1, const QLowEnergyAdvertisingParameters::AddressInfo &ai2); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QLowEnergyAdvertisingParameters::AddressInfo &a, const QLowEnergyAdvertisingParameters::AddressInfo &b); +%End diff --git a/sip/QtBluetooth/qlowenergycharacteristic.sip b/sip/QtBluetooth/qlowenergycharacteristic.sip new file mode 100644 index 0000000..b3e2744 --- /dev/null +++ b/sip/QtBluetooth/qlowenergycharacteristic.sip @@ -0,0 +1,68 @@ +// qlowenergycharacteristic.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyCharacteristic +{ +%TypeHeaderCode +#include +%End + +public: + enum PropertyType /BaseType=Flag/ + { + Unknown, + Broadcasting, + Read, + WriteNoResponse, + Write, + Notify, + Indicate, + WriteSigned, + ExtendedProperty, + }; + + typedef QFlags PropertyTypes; + QLowEnergyCharacteristic(); + QLowEnergyCharacteristic(const QLowEnergyCharacteristic &other); + ~QLowEnergyCharacteristic(); + QString name() const; + QBluetoothUuid uuid() const; + QByteArray value() const; + QLowEnergyCharacteristic::PropertyTypes properties() const; + QLowEnergyDescriptor descriptor(const QBluetoothUuid &uuid) const; + QList descriptors() const; + bool isValid() const; + QLowEnergyDescriptor clientCharacteristicConfiguration() const; + static const QByteArray CCCDDisable; + static const QByteArray CCCDEnableNotification; + static const QByteArray CCCDEnableIndication; +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QLowEnergyCharacteristic &a, const QLowEnergyCharacteristic &b); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QLowEnergyCharacteristic &a, const QLowEnergyCharacteristic &b); +%End diff --git a/sip/QtBluetooth/qlowenergycharacteristicdata.sip b/sip/QtBluetooth/qlowenergycharacteristicdata.sip new file mode 100644 index 0000000..c98375d --- /dev/null +++ b/sip/QtBluetooth/qlowenergycharacteristicdata.sip @@ -0,0 +1,61 @@ +// qlowenergycharacteristicdata.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyCharacteristicData +{ +%TypeHeaderCode +#include +%End + +public: + QLowEnergyCharacteristicData(); + QLowEnergyCharacteristicData(const QLowEnergyCharacteristicData &other); + ~QLowEnergyCharacteristicData(); + QBluetoothUuid uuid() const; + void setUuid(const QBluetoothUuid &uuid); + QByteArray value() const; + void setValue(const QByteArray &value); + QLowEnergyCharacteristic::PropertyTypes properties() const; + void setProperties(QLowEnergyCharacteristic::PropertyTypes properties); + QList descriptors() const; + void setDescriptors(const QList &descriptors); + void addDescriptor(const QLowEnergyDescriptorData &descriptor); + void setReadConstraints(QBluetooth::AttAccessConstraints constraints); + QBluetooth::AttAccessConstraints readConstraints() const; + void setWriteConstraints(QBluetooth::AttAccessConstraints constraints); + QBluetooth::AttAccessConstraints writeConstraints() const; + void setValueLength(int minimum, int maximum); + int minimumValueLength() const; + int maximumValueLength() const; + bool isValid() const; + void swap(QLowEnergyCharacteristicData &other); +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QLowEnergyCharacteristicData &cd1, const QLowEnergyCharacteristicData &cd2); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QLowEnergyCharacteristicData &cd1, const QLowEnergyCharacteristicData &cd2); +%End diff --git a/sip/QtBluetooth/qlowenergyconnectionparameters.sip b/sip/QtBluetooth/qlowenergyconnectionparameters.sip new file mode 100644 index 0000000..87ef610 --- /dev/null +++ b/sip/QtBluetooth/qlowenergyconnectionparameters.sip @@ -0,0 +1,51 @@ +// qlowenergyconnectionparameters.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyConnectionParameters +{ +%TypeHeaderCode +#include +%End + +public: + QLowEnergyConnectionParameters(); + QLowEnergyConnectionParameters(const QLowEnergyConnectionParameters &other); + ~QLowEnergyConnectionParameters(); + void setIntervalRange(double minimum, double maximum); + double minimumInterval() const; + double maximumInterval() const; + void setLatency(int latency); + int latency() const; + void setSupervisionTimeout(int timeout); + int supervisionTimeout() const; + void swap(QLowEnergyConnectionParameters &other); +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QLowEnergyConnectionParameters &p1, const QLowEnergyConnectionParameters &p2); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QLowEnergyConnectionParameters &p1, const QLowEnergyConnectionParameters &p2); +%End diff --git a/sip/QtBluetooth/qlowenergycontroller.sip b/sip/QtBluetooth/qlowenergycontroller.sip new file mode 100644 index 0000000..aa94b39 --- /dev/null +++ b/sip/QtBluetooth/qlowenergycontroller.sip @@ -0,0 +1,125 @@ +// qlowenergycontroller.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyController : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + NoError, + UnknownError, + UnknownRemoteDeviceError, + NetworkError, + InvalidBluetoothAdapterError, + ConnectionError, + AdvertisingError, + RemoteHostClosedError, + AuthorizationError, +%If (Qt_6_4_0 -) + MissingPermissionsError, +%End +%If (Qt_6_5_0 -) + RssiReadError, +%End + }; + + enum ControllerState + { + UnconnectedState, + ConnectingState, + ConnectedState, + DiscoveringState, + DiscoveredState, + ClosingState, + AdvertisingState, + }; + + enum RemoteAddressType + { + PublicAddress, + RandomAddress, + }; + + virtual ~QLowEnergyController(); + QBluetoothAddress localAddress() const; + QBluetoothAddress remoteAddress() const; + QLowEnergyController::ControllerState state() const; + QLowEnergyController::RemoteAddressType remoteAddressType() const; + void setRemoteAddressType(QLowEnergyController::RemoteAddressType type); + void connectToDevice(); + void disconnectFromDevice(); + void discoverServices(); + QList services() const; + QLowEnergyService *createServiceObject(const QBluetoothUuid &service, QObject *parent /TransferThis/ = 0) /Factory/; + QLowEnergyController::Error error() const; + QString errorString() const; + QString remoteName() const; + int mtu() const; + +signals: + void connected(); + void disconnected(); + void stateChanged(QLowEnergyController::ControllerState state); + void errorOccurred(QLowEnergyController::Error newError); + void serviceDiscovered(const QBluetoothUuid &newService); + void discoveryFinished(); + void connectionUpdated(const QLowEnergyConnectionParameters ¶meters); + void mtuChanged(int mtu); + +public: + enum Role + { + CentralRole, + PeripheralRole, + }; + + static QLowEnergyController *createCentral(const QBluetoothDeviceInfo &remoteDevice, QObject *parent /TransferThis/ = 0) /Factory/; + static QLowEnergyController *createCentral(const QBluetoothDeviceInfo &remoteDevice, const QBluetoothAddress &localDevice, QObject *parent /TransferThis/ = 0) /Factory/; + static QLowEnergyController *createPeripheral(const QBluetoothAddress &localDevice, QObject *parent /TransferThis/ = 0) /Factory/; + static QLowEnergyController *createPeripheral(QObject *parent /TransferThis/ = 0) /Factory/; + void startAdvertising(const QLowEnergyAdvertisingParameters ¶meters, const QLowEnergyAdvertisingData &advertisingData, const QLowEnergyAdvertisingData &scanResponseData = QLowEnergyAdvertisingData()); + void stopAdvertising(); + QLowEnergyService *addService(const QLowEnergyServiceData &service, QObject *parent /TransferThis/ = 0) /Factory/; + void requestConnectionUpdate(const QLowEnergyConnectionParameters ¶meters); + QLowEnergyController::Role role() const; + QBluetoothUuid remoteDeviceUuid() const; +%If (Qt_6_5_0 -) + void readRssi(); +%End + +signals: +%If (Qt_6_5_0 -) + void rssiRead(qint16 rssi); +%End + +private: + QLowEnergyController(const QBluetoothDeviceInfo &remoteDevice, const QBluetoothAddress &localDevice, QObject *parent = 0); + QLowEnergyController(const QBluetoothAddress &localDevice, QObject *parent = 0); +}; + +%End diff --git a/sip/QtBluetooth/qlowenergydescriptor.sip b/sip/QtBluetooth/qlowenergydescriptor.sip new file mode 100644 index 0000000..78a80ab --- /dev/null +++ b/sip/QtBluetooth/qlowenergydescriptor.sip @@ -0,0 +1,48 @@ +// qlowenergydescriptor.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyDescriptor +{ +%TypeHeaderCode +#include +%End + +public: + QLowEnergyDescriptor(); + QLowEnergyDescriptor(const QLowEnergyDescriptor &other); + ~QLowEnergyDescriptor(); + bool isValid() const; + QByteArray value() const; + QBluetoothUuid uuid() const; + QString name() const; + QBluetoothUuid::DescriptorType type() const; +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b); +%End diff --git a/sip/QtBluetooth/qlowenergydescriptordata.sip b/sip/QtBluetooth/qlowenergydescriptordata.sip new file mode 100644 index 0000000..ffaf2ab --- /dev/null +++ b/sip/QtBluetooth/qlowenergydescriptordata.sip @@ -0,0 +1,56 @@ +// qlowenergydescriptordata.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyDescriptorData +{ +%TypeHeaderCode +#include +%End + +public: + QLowEnergyDescriptorData(); + QLowEnergyDescriptorData(const QBluetoothUuid &uuid, const QByteArray &value); + QLowEnergyDescriptorData(const QLowEnergyDescriptorData &other); + ~QLowEnergyDescriptorData(); + QByteArray value() const; + void setValue(const QByteArray &value); + QBluetoothUuid uuid() const; + void setUuid(const QBluetoothUuid &uuid); + bool isValid() const; + void setReadPermissions(bool readable, QBluetooth::AttAccessConstraints constraints = QBluetooth::AttAccessConstraints()); + bool isReadable() const; + QBluetooth::AttAccessConstraints readConstraints() const; + void setWritePermissions(bool writable, QBluetooth::AttAccessConstraints constraints = QBluetooth::AttAccessConstraints()); + bool isWritable() const; + QBluetooth::AttAccessConstraints writeConstraints() const; + void swap(QLowEnergyDescriptorData &other); +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QLowEnergyDescriptorData &d1, const QLowEnergyDescriptorData &d12); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QLowEnergyDescriptorData &d1, const QLowEnergyDescriptorData &d2); +%End diff --git a/sip/QtBluetooth/qlowenergyservice.sip b/sip/QtBluetooth/qlowenergyservice.sip new file mode 100644 index 0000000..fc08193 --- /dev/null +++ b/sip/QtBluetooth/qlowenergyservice.sip @@ -0,0 +1,107 @@ +// qlowenergyservice.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyService : QObject /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum DiscoveryMode + { + FullDiscovery, + SkipValueDiscovery, + }; + + enum ServiceType /BaseType=Flag/ + { + PrimaryService, + IncludedService, + }; + + typedef QFlags ServiceTypes; + + enum ServiceError + { + NoError, + OperationError, + CharacteristicWriteError, + DescriptorWriteError, + CharacteristicReadError, + DescriptorReadError, + UnknownError, + }; + + enum ServiceState + { + InvalidService, + DiscoveryRequired, + ServiceDiscovered, + LocalService, + RemoteService, + RemoteServiceDiscovering, + RemoteServiceDiscovered, + DiscoveringService, + }; + + enum WriteMode + { + WriteWithResponse, + WriteWithoutResponse, + WriteSigned, + }; + + virtual ~QLowEnergyService(); + QList includedServices() const; + QLowEnergyService::ServiceTypes type() const; + QLowEnergyService::ServiceState state() const; + QLowEnergyCharacteristic characteristic(const QBluetoothUuid &uuid) const; + QList characteristics() const; + QBluetoothUuid serviceUuid() const; + QString serviceName() const; + void discoverDetails(QLowEnergyService::DiscoveryMode mode = QLowEnergyService::FullDiscovery); + QLowEnergyService::ServiceError error() const; + bool contains(const QLowEnergyCharacteristic &characteristic) const; + bool contains(const QLowEnergyDescriptor &descriptor) const; + void writeCharacteristic(const QLowEnergyCharacteristic &characteristic, const QByteArray &newValue, QLowEnergyService::WriteMode mode = QLowEnergyService::WriteWithResponse); + void writeDescriptor(const QLowEnergyDescriptor &descriptor, const QByteArray &newValue); + +signals: + void stateChanged(QLowEnergyService::ServiceState newState); + void characteristicChanged(const QLowEnergyCharacteristic &info, const QByteArray &value); + void characteristicWritten(const QLowEnergyCharacteristic &info, const QByteArray &value); + void descriptorWritten(const QLowEnergyDescriptor &info, const QByteArray &value); + void errorOccurred(QLowEnergyService::ServiceError error); + +public: + void readCharacteristic(const QLowEnergyCharacteristic &characteristic); + void readDescriptor(const QLowEnergyDescriptor &descriptor); + +signals: + void characteristicRead(const QLowEnergyCharacteristic &info, const QByteArray &value); + void descriptorRead(const QLowEnergyDescriptor &info, const QByteArray &value); +}; + +%End diff --git a/sip/QtBluetooth/qlowenergyservicedata.sip b/sip/QtBluetooth/qlowenergyservicedata.sip new file mode 100644 index 0000000..9572854 --- /dev/null +++ b/sip/QtBluetooth/qlowenergyservicedata.sip @@ -0,0 +1,62 @@ +// qlowenergyservicedata.sip generated by MetaSIP +// +// This file is part of the QtBluetooth Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLowEnergyServiceData +{ +%TypeHeaderCode +#include +%End + +public: + QLowEnergyServiceData(); + QLowEnergyServiceData(const QLowEnergyServiceData &other); + ~QLowEnergyServiceData(); + + enum ServiceType + { + ServiceTypePrimary, + ServiceTypeSecondary, + }; + + QLowEnergyServiceData::ServiceType type() const; + void setType(QLowEnergyServiceData::ServiceType type); + QBluetoothUuid uuid() const; + void setUuid(const QBluetoothUuid &uuid); + QList includedServices() const; + void setIncludedServices(const QList &services); + void addIncludedService(QLowEnergyService *service); + QList characteristics() const; + void setCharacteristics(const QList &characteristics); + void addCharacteristic(const QLowEnergyCharacteristicData &characteristic); + bool isValid() const; + void swap(QLowEnergyServiceData &other); +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QLowEnergyServiceData &sd1, const QLowEnergyServiceData &sd2); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QLowEnergyServiceData &sd1, const QLowEnergyServiceData &sd2); +%End diff --git a/sip/QtBluetooth/qpybluetooth_qlist.sip b/sip/QtBluetooth/qpybluetooth_qlist.sip new file mode 100644 index 0000000..99a53cd --- /dev/null +++ b/sip/QtBluetooth/qpybluetooth_qlist.sip @@ -0,0 +1,133 @@ +// This is the SIP interface definition for the QList based mapped types +// specific to the QtBluetooth module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +// QBluetoothServiceInfo::Sequence is actually a sub-class of QList. +// Note that QBluetoothServiceInfo::Alternative is identical and they are both +// syntactic sugar. By ignoring methods using the latter then everything works +// as expected. +%MappedType QBluetoothServiceInfo::Sequence + /TypeHintIn="Iterable[QVariant]", TypeHintOut="List[QVariant]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + QVariant *t = new QVariant(sipCpp->at(i)); + PyObject *tobj = sipConvertFromNewType(t, sipType_QVariant, + sipTransferObj); + + if (!tobj) + { + delete t; + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, tobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QBluetoothServiceInfo::Sequence *ql = new QBluetoothServiceInfo::Sequence; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int state; + QVariant *t = reinterpret_cast( + sipForceConvertToType(itm, sipType_QVariant, sipTransferObj, + SIP_NOT_NONE, &state, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but '_TYPE_' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + + return 0; + } + + ql->append(*t); + + sipReleaseType(t, sipType_QVariant, state); + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + +%End diff --git a/sip/QtBluetooth/qpybluetooth_qmultihash.sip b/sip/QtBluetooth/qpybluetooth_qmultihash.sip new file mode 100644 index 0000000..0133e53 --- /dev/null +++ b/sip/QtBluetooth/qpybluetooth_qmultihash.sip @@ -0,0 +1,183 @@ +// This is the SIP interface definition for the QNultiHash based mapped types. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +template +%MappedType QMultiHash + /TypeHint="Dict[int, _TYPE_]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QMultiHash::const_iterator it = sipCpp->constBegin(); + QMultiHash::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + PyObject *kobj = PyLong_FromLong(it.key()); + + if (!kobj) + { + Py_DECREF(d); + + return 0; + } + + QList<_TYPE_> values = sipCpp->values(it.key()); + + PyObject *py_values = PyList_New(values.size()); + + if (!py_values) + { + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + int rc = PyDict_SetItem(d, kobj, py_values); + + Py_DECREF(py_values); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + for (int i = 0; i < values.size(); ++i) + { + _TYPE_ *v = new _TYPE_(values.at(i)); + PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE_, + sipTransferObj); + + if (!vobj) + { + delete v; + Py_DECREF(d); + + return 0; + } + + PyList_SetItem(py_values, i, vobj); + } + + ++it; + } + + return d; +%End +}; + +%End + + +%If (Qt_6_3_0 -) + +template<_TYPE1_, _TYPE2_> +%MappedType QMultiHash<_TYPE1_, _TYPE2_> + /TypeHint="Dict[_TYPE1_, _TYPE2_]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QMultiHash<_TYPE1_, _TYPE2_>::const_iterator it = sipCpp->constBegin(); + QMultiHash<_TYPE1_, _TYPE2_>::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + _TYPE1_ *k = new _TYPE1_(it.key()); + PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_, + sipTransferObj); + + if (!kobj) + { + delete k; + Py_DECREF(d); + + return 0; + } + + QList<_TYPE2_> values = sipCpp->values(it.key()); + + PyObject *py_values = PyList_New(values.size()); + + if (!py_values) + { + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + int rc = PyDict_SetItem(d, kobj, py_values); + + Py_DECREF(py_values); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + for (int i = 0; i < values.size(); ++i) + { + _TYPE2_ *v = new _TYPE2_(values.at(i)); + PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE2_, + sipTransferObj); + + if (!vobj) + { + delete v; + Py_DECREF(d); + + return 0; + } + + PyList_SetItem(py_values, i, vobj); + } + + ++it; + } + + return d; +%End +}; + +%End diff --git a/sip/QtBluetooth/qpybluetooth_quint128.sip b/sip/QtBluetooth/qpybluetooth_quint128.sip new file mode 100644 index 0000000..0b64d82 --- /dev/null +++ b/sip/QtBluetooth/qpybluetooth_quint128.sip @@ -0,0 +1,115 @@ +// This is the SIP interface definition for the quint128 mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +%MappedType quint128 /TypeHint="Tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *t = PyTuple_New(16); + + if (!t) + return 0; + + for (Py_ssize_t i = 0; i < 16; ++i) + { + // Convert to a Python long to make sure it doesn't get interpreted as + // a signed value. + PyObject *pobj = PyLong_FromUnsignedLong(sipCpp->data[i]); + + if (!pobj) + { + Py_DECREF(t); + + return 0; + } + + PyTuple_SetItem(t, i, pobj); + } + + return t; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy)); + + Py_ssize_t len = PySequence_Size(sipPy); + + if (len != 16) + { + // A negative length should only be an internal error so let the + // original exception stand. + if (len >= 0) + PyErr_Format(PyExc_TypeError, + "sequence has %zd elements but 16 elements are expected", + len); + + *sipIsErr = 1; + + return 0; + } + + quint128 *qv = new quint128; + + for (Py_ssize_t i = 0; i < 16; ++i) + { + PyObject *itm = PySequence_GetItem(sipPy, i); + + if (!itm) + { + delete qv; + *sipIsErr = 1; + + return 0; + } + + PyErr_Clear(); + unsigned long val = PyLong_AsUnsignedLongMask(itm); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "element %zd has type '%s' but 'int' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete qv; + *sipIsErr = 1; + + return 0; + } + + qv->data[i] = val; + + Py_DECREF(itm); + } + + *sipCppPtr = qv; + + return sipGetState(sipTransferObj); +%End +}; + +%End diff --git a/sip/QtCore/QtCoremod.sip b/sip/QtCore/QtCoremod.sip new file mode 100644 index 0000000..bca834b --- /dev/null +++ b/sip/QtCore/QtCoremod.sip @@ -0,0 +1,214 @@ +// QtCoremod.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtCore, call_super_init=True, default_VirtualErrorHandler=PyQt6, keyword_arguments="Optional", use_limited_api=True, py_ssize_t_clean=True) + +%Timeline {Qt_6_0_0 Qt_6_1_0 Qt_6_2_0 Qt_6_3_0 Qt_6_4_0 Qt_6_5_0} + +%Platforms {Android iOS Linux macOS WebAssembly Windows} + +%Feature PyQt_Accessibility +%Feature PyQt_SessionManager +%Feature PyQt_SSL +%Feature PyQt_qreal_double +%Feature PyQt_PrintDialog +%Feature PyQt_Printer +%Feature PyQt_PrintPreviewWidget +%Feature PyQt_PrintPreviewDialog +%Feature PyQt_RawFont +%Feature PyQt_OpenGL +%Feature PyQt_OpenGL_ES2 +%Feature PyQt_Process +%Feature PyQt_WebChannel +%Feature PyQt_DTLS +%Feature PyQt_Permissions + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%Plugin PyQt6 + +%DefaultEncoding "ASCII" + +%Include(name=pyqt-internal.sip5, optional=True) +%Include(name=pyqt-gpl.sip5, optional=True) +%Include(name=pyqt-commercial.sip5, optional=True) + +%DefaultSupertype PyQt6.sip.simplewrapper + +int PYQT_VERSION; +const char *PYQT_VERSION_STR; + +%ModuleCode +static int PYQT_VERSION = 0x060502; +static const char *PYQT_VERSION_STR = "6.5.2"; +%End + +%Include qglobal.sip +%Include qtenvironmentvariables.sip +%Include qtversion.sip +%Include qnamespace.sip +%Include qabstractanimation.sip +%Include qabstracteventdispatcher.sip +%Include qabstractitemmodel.sip +%Include qabstractnativeeventfilter.sip +%Include qabstractproxymodel.sip +%Include qanimationgroup.sip +%Include qbasictimer.sip +%Include qbitarray.sip +%Include qbuffer.sip +%Include qbytearray.sip +%Include qbytearrayalgorithms.sip +%Include qbytearraymatcher.sip +%Include qcalendar.sip +%Include qcborcommon.sip +%Include qcborstreamreader.sip +%Include qcborstreamwriter.sip +%Include qcollator.sip +%Include qcommandlineoption.sip +%Include qcommandlineparser.sip +%Include qconcatenatetablesproxymodel.sip +%Include qcoreapplication.sip +%Include qcoreevent.sip +%Include qcryptographichash.sip +%Include qdatastream.sip +%Include qdatetime.sip +%Include qdeadlinetimer.sip +%Include qdir.sip +%Include qdiriterator.sip +%Include qeasingcurve.sip +%Include qelapsedtimer.sip +%Include qeventloop.sip +%Include qfile.sip +%Include qfiledevice.sip +%Include qfileinfo.sip +%Include qfileselector.sip +%Include qfilesystemwatcher.sip +%Include qidentityproxymodel.sip +%Include qiodevice.sip +%Include qiodevicebase.sip +%Include qitemselectionmodel.sip +%Include qjsondocument.sip +%Include qjsonvalue.sip +%Include qlibrary.sip +%Include qlibraryinfo.sip +%Include qline.sip +%Include qlocale.sip +%Include qlockfile.sip +%Include qlogging.sip +%Include qloggingcategory.sip +%Include qmargins.sip +%Include qmessageauthenticationcode.sip +%Include qmetaobject.sip +%Include qmetatype.sip +%Include qmimedata.sip +%Include qmimedatabase.sip +%Include qmimetype.sip +%Include qmutex.sip +%Include qnumeric.sip +%Include qobject.sip +%Include qobjectcleanuphandler.sip +%Include qobjectdefs.sip +%Include qoperatingsystemversion.sip +%Include qparallelanimationgroup.sip +%Include qpauseanimation.sip +%Include qpermissions.sip +%Include qpropertyanimation.sip +%Include qpluginloader.sip +%Include qpoint.sip +%Include qprocess.sip +%Include qrandom.sip +%Include qreadwritelock.sip +%Include qrect.sip +%Include qregularexpression.sip +%Include qresource.sip +%Include qrunnable.sip +%Include qsavefile.sip +%Include qsemaphore.sip +%Include qsequentialanimationgroup.sip +%Include qsettings.sip +%Include qsharedmemory.sip +%Include qsignalmapper.sip +%Include qsize.sip +%Include qsocketnotifier.sip +%Include qsortfilterproxymodel.sip +%Include qstandardpaths.sip +%Include qstorageinfo.sip +%Include qstringconverter_base.sip +%Include qstringconverter.sip +%Include qstringlistmodel.sip +%Include qsysinfo.sip +%Include qsystemsemaphore.sip +%Include qtemporarydir.sip +%Include qtemporaryfile.sip +%Include qtextboundaryfinder.sip +%Include qtextstream.sip +%Include qthread.sip +%Include qthreadpool.sip +%Include qtimeline.sip +%Include qtimer.sip +%Include qtimezone.sip +%Include qtranslator.sip +%Include qtransposeproxymodel.sip +%Include qtypes.sip +%Include qurl.sip +%Include qurlquery.sip +%Include quuid.sip +%Include qvariant.sip +%Include qvariantanimation.sip +%Include qversionnumber.sip +%Include qwaitcondition.sip +%Include qxmlstream.sip +%Include qanystringview.sip +%Include qflags.sip +%Include qstring.sip +%Include qbytearraylist.sip +%Include qjsonobject.sip +%Include qpycore_std_pair.sip +%Include qpycore_qset.sip +%Include qstringview.sip +%Include qchar.sip +%Include qpycore_qlist.sip +%Include qwineventnotifier.sip +%Include qstringlist.sip +%Include qjsonarray.sip +%Include qpycore_virtual_error_handler.sip +%Include qpycore_qmap.sip +%Include qbytearrayview.sip +%Include qpycore_qhash.sip +%Include qmutexlocker.sip diff --git a/sip/QtCore/qabstractanimation.sip b/sip/QtCore/qabstractanimation.sip new file mode 100644 index 0000000..20a4bd1 --- /dev/null +++ b/sip/QtCore/qabstractanimation.sip @@ -0,0 +1,82 @@ +// qabstractanimation.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractAnimation : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Direction + { + Forward, + Backward, + }; + + enum State + { + Stopped, + Paused, + Running, + }; + + enum DeletionPolicy + { + KeepWhenStopped, + DeleteWhenStopped, + }; + + QAbstractAnimation(QObject *parent /TransferThis/ = 0); + virtual ~QAbstractAnimation(); + QAbstractAnimation::State state() const; + QAnimationGroup *group() const; + QAbstractAnimation::Direction direction() const; + void setDirection(QAbstractAnimation::Direction direction); + int currentTime() const; + int currentLoopTime() const; + int loopCount() const; + void setLoopCount(int loopCount); + int currentLoop() const; + virtual int duration() const = 0; + int totalDuration() const; + +signals: + void finished(); + void stateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + void currentLoopChanged(int currentLoop); + void directionChanged(QAbstractAnimation::Direction); + +public slots: + void start(QAbstractAnimation::DeletionPolicy policy = QAbstractAnimation::KeepWhenStopped); + void pause(); + void resume(); + void setPaused(bool); + void stop(); + void setCurrentTime(int msecs); + +protected: + virtual bool event(QEvent *event); + virtual void updateCurrentTime(int currentTime) = 0; + virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + virtual void updateDirection(QAbstractAnimation::Direction direction); +}; diff --git a/sip/QtCore/qabstracteventdispatcher.sip b/sip/QtCore/qabstracteventdispatcher.sip new file mode 100644 index 0000000..95a7904 --- /dev/null +++ b/sip/QtCore/qabstracteventdispatcher.sip @@ -0,0 +1,63 @@ +// qabstracteventdispatcher.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractEventDispatcher : QObject /Abstract/ +{ +%TypeHeaderCode +#include +%End + +public: + struct TimerInfo + { +%TypeHeaderCode +#include +%End + + int timerId; + int interval; + Qt::TimerType timerType; + TimerInfo(int id, int i, Qt::TimerType t); + }; + + explicit QAbstractEventDispatcher(QObject *parent /TransferThis/ = 0); + virtual ~QAbstractEventDispatcher(); + static QAbstractEventDispatcher *instance(QThread *thread = 0); + virtual bool processEvents(QEventLoop::ProcessEventsFlags flags) = 0 /ReleaseGIL/; + int registerTimer(qint64 interval, Qt::TimerType timerType, QObject *object); + virtual void registerTimer(int timerId, qint64 interval, Qt::TimerType timerType, QObject *object) = 0; + virtual bool unregisterTimer(int timerId) = 0; + virtual bool unregisterTimers(QObject *object) = 0; + virtual QList registeredTimers(QObject *object) const = 0; + virtual void wakeUp() = 0; + virtual void interrupt() = 0; + virtual void startingUp(); + virtual void closingDown(); + virtual int remainingTime(int timerId) = 0; + void installNativeEventFilter(QAbstractNativeEventFilter *filterObj); + void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj); + bool filterNativeEvent(const QByteArray &eventType, void *message, qintptr *result /Out/); + +signals: + void aboutToBlock(); + void awake(); +}; diff --git a/sip/QtCore/qabstractitemmodel.sip b/sip/QtCore/qabstractitemmodel.sip new file mode 100644 index 0000000..72b2db5 --- /dev/null +++ b/sip/QtCore/qabstractitemmodel.sip @@ -0,0 +1,317 @@ +// qabstractitemmodel.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QModelIndex +{ +%TypeHeaderCode +#include +%End + +public: + QModelIndex(); + int row() const; + int column() const; + QVariant data(int role = Qt::DisplayRole) const; + Qt::ItemFlags flags() const; + SIP_PYOBJECT internalPointer() const; +%MethodCode + sipRes = reinterpret_cast(sipCpp->internalPointer()); + + if (!sipRes) + sipRes = Py_None; + + Py_INCREF(sipRes); +%End + + SIP_PYOBJECT internalId() const /TypeHint="int"/; +%MethodCode + // Python needs to treat the result as an unsigned value (which may not happen + // on 64 bit systems). Instead we get the real value as it is stored (as a + // void *) and let Python convert that. + sipRes = PyLong_FromVoidPtr(sipCpp->internalPointer()); +%End + + const QAbstractItemModel *model() const; + bool isValid() const; + QModelIndex parent() const; + QModelIndex sibling(int arow, int acolumn) const; + QModelIndex siblingAtColumn(int column) const; + QModelIndex siblingAtRow(int row) const; + bool operator==(const QModelIndex &other) const; + bool operator<(const QModelIndex &other) const; + bool operator!=(const QModelIndex &other) const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +class QPersistentModelIndex +{ +%TypeHeaderCode +#include +%End + +public: + QPersistentModelIndex(); + QPersistentModelIndex(const QModelIndex &index); + QPersistentModelIndex(const QPersistentModelIndex &other); + ~QPersistentModelIndex(); + int row() const; + int column() const; + QVariant data(int role = Qt::DisplayRole) const; + Qt::ItemFlags flags() const; + QModelIndex parent() const; + QModelIndex sibling(int row, int column) const; + const QAbstractItemModel *model() const; + bool isValid() const; + void swap(QPersistentModelIndex &other /Constrained/); + operator QModelIndex() const; + bool operator<(const QPersistentModelIndex &other) const; + bool operator==(const QPersistentModelIndex &other) const; + bool operator==(const QModelIndex &other) const; + bool operator!=(const QPersistentModelIndex &other) const; + bool operator!=(const QModelIndex &other) const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +typedef QList QModelIndexList; + +class QAbstractItemModel : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum LayoutChangeHint + { + NoLayoutChangeHint, + VerticalSortHint, + HorizontalSortHint, + }; + + explicit QAbstractItemModel(QObject *parent /TransferThis/ = 0); + virtual ~QAbstractItemModel(); + bool hasIndex(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const = 0; + virtual QModelIndex parent(const QModelIndex &child) const = 0; + QObject *parent() const; + virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const = 0; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0; + virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); + virtual QMap itemData(const QModelIndex &index) const; + virtual bool setItemData(const QModelIndex &index, const QMap &roles); + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + virtual Qt::DropActions supportedDropActions() const; + virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual void fetchMore(const QModelIndex &parent); + virtual bool canFetchMore(const QModelIndex &parent) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + virtual QModelIndex buddy(const QModelIndex &index) const; + virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const; + virtual QSize span(const QModelIndex &index) const; + +signals: + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList &roles = QList()); + void headerDataChanged(Qt::Orientation orientation, int first, int last); + void layoutAboutToBeChanged(const QList &parents = QList(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint); + void layoutChanged(const QList &parents = QList(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint); + void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last); + void rowsInserted(const QModelIndex &parent, int first, int last); + void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); + void rowsRemoved(const QModelIndex &parent, int first, int last); + void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last); + void columnsInserted(const QModelIndex &parent, int first, int last); + void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last); + void columnsRemoved(const QModelIndex &parent, int first, int last); + void modelAboutToBeReset(); + void modelReset(); + +public slots: + virtual bool submit(); + virtual void revert(); + +protected: + void encodeData(const QModelIndexList &indexes, QDataStream &stream) const; + bool decodeData(int row, int column, const QModelIndex &parent, QDataStream &stream); + void beginInsertRows(const QModelIndex &parent, int first, int last); + void endInsertRows(); + void beginRemoveRows(const QModelIndex &parent, int first, int last); + void endRemoveRows(); + void beginInsertColumns(const QModelIndex &parent, int first, int last); + void endInsertColumns(); + void beginRemoveColumns(const QModelIndex &parent, int first, int last); + void endRemoveColumns(); + QModelIndexList persistentIndexList() const; + void changePersistentIndex(const QModelIndex &from, const QModelIndex &to); + void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to); + +public: + bool insertRow(int row, const QModelIndex &parent = QModelIndex()); + bool insertColumn(int column, const QModelIndex &parent = QModelIndex()); + bool removeRow(int row, const QModelIndex &parent = QModelIndex()); + bool removeColumn(int column, const QModelIndex &parent = QModelIndex()); + virtual Qt::DropActions supportedDragActions() const; + virtual QHash roleNames() const; + +protected: + QModelIndex createIndex(int row, int column, SIP_PYOBJECT object = 0) const [QModelIndex (int row, int column, const void *object = 0)]; +%MethodCode + // The Qt API is broken (and won't be fixed as it would break binary + // compatibility) regarding the internal id of a model index on different + // architectures (32 vs 64 bits). We choose to work around the breakage as it + // is fairly subtle and continues to catch people out. Instead of letting Qt + // convert betweed an integer id and a pointer id (the internal format used by + // Qt) we let Python do it. + + void *ptr; + + if (a2) + { + // Try and convert it to a Python long and fallback to the object's + // address if it fails. + ptr = PyLong_AsVoidPtr(a2); + + if (PyErr_Occurred()) + { + PyErr_Clear(); + ptr = a2; + } + } + else + { + ptr = 0; + } + + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = new QModelIndex(sipCpp->createIndex(a0, a1, ptr)); + #else + sipRes = new QModelIndex(sipCpp->sipProtect_createIndex(a0, a1, ptr)); + #endif +%End + +signals: + void rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow); + void rowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row); + void columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn); + void columnsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column); + +protected: + bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow); + void endMoveRows(); + bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn); + void endMoveColumns(); + void beginResetModel() /ReleaseGIL/; + void endResetModel() /ReleaseGIL/; + +protected slots: + virtual void resetInternalData(); + +public: + virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const; + virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild); + virtual bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild); + bool moveRow(const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild); + bool moveColumn(const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild); + + enum class CheckIndexOption /BaseType=Flag/ + { + NoOption, + IndexIsValid, + DoNotUseParent, + ParentIsInvalid, + }; + + typedef QFlags CheckIndexOptions; + bool checkIndex(const QModelIndex &index, QAbstractItemModel::CheckIndexOptions options = QAbstractItemModel::CheckIndexOption::NoOption) const; + virtual bool clearItemData(const QModelIndex &index); +}; + +class QAbstractTableModel : QAbstractItemModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAbstractTableModel(QObject *parent /TransferThis/ = 0); + virtual ~QAbstractTableModel(); + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + QObject *parent() const; + virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const; + +private: + virtual bool hasChildren(const QModelIndex &parent) const; + virtual QModelIndex parent(const QModelIndex &child) const; +}; + +class QAbstractListModel : QAbstractItemModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAbstractListModel(QObject *parent /TransferThis/ = 0); + virtual ~QAbstractListModel(); + virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + QObject *parent() const; + virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const; + +private: + virtual int columnCount(const QModelIndex &parent) const; + virtual bool hasChildren(const QModelIndex &parent) const; + virtual QModelIndex parent(const QModelIndex &child) const; +}; + +class QModelRoleData +{ +%TypeHeaderCode +#include +%End + +public: + explicit QModelRoleData(int role); + int role() const; + const QVariant &data() const; + void setData(const QVariant &data); + void clearData(); +}; diff --git a/sip/QtCore/qabstractnativeeventfilter.sip b/sip/QtCore/qabstractnativeeventfilter.sip new file mode 100644 index 0000000..cd5b58c --- /dev/null +++ b/sip/QtCore/qabstractnativeeventfilter.sip @@ -0,0 +1,36 @@ +// qabstractnativeeventfilter.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractNativeEventFilter +{ +%TypeHeaderCode +#include +%End + +public: + QAbstractNativeEventFilter(); + virtual ~QAbstractNativeEventFilter(); + virtual bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result /Out/) = 0; + +private: + QAbstractNativeEventFilter(const QAbstractNativeEventFilter &); +}; diff --git a/sip/QtCore/qabstractproxymodel.sip b/sip/QtCore/qabstractproxymodel.sip new file mode 100644 index 0000000..3bfe7c2 --- /dev/null +++ b/sip/QtCore/qabstractproxymodel.sip @@ -0,0 +1,67 @@ +// qabstractproxymodel.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractProxyModel : QAbstractItemModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAbstractProxyModel(QObject *parent /TransferThis/ = 0); + virtual ~QAbstractProxyModel(); + virtual void setSourceModel(QAbstractItemModel *sourceModel /KeepReference/); + QAbstractItemModel *sourceModel() const; + virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const = 0; + virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const = 0; + virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const; + virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const; + virtual bool submit(); + virtual void revert(); + virtual QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); + virtual QMap itemData(const QModelIndex &index) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual bool setItemData(const QModelIndex &index, const QMap &roles); + virtual QModelIndex buddy(const QModelIndex &index) const; + virtual bool canFetchMore(const QModelIndex &parent) const; + virtual void fetchMore(const QModelIndex &parent); + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + virtual QSize span(const QModelIndex &index) const; + virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/; + virtual QStringList mimeTypes() const; + virtual Qt::DropActions supportedDropActions() const; + virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const; + +signals: + void sourceModelChanged(); + +public: + virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + virtual Qt::DropActions supportedDragActions() const; + virtual bool clearItemData(const QModelIndex &index); + virtual QHash roleNames() const; +}; diff --git a/sip/QtCore/qanimationgroup.sip b/sip/QtCore/qanimationgroup.sip new file mode 100644 index 0000000..5bce4e1 --- /dev/null +++ b/sip/QtCore/qanimationgroup.sip @@ -0,0 +1,43 @@ +// qanimationgroup.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAnimationGroup : QAbstractAnimation +{ +%TypeHeaderCode +#include +%End + +public: + QAnimationGroup(QObject *parent /TransferThis/ = 0); + virtual ~QAnimationGroup(); + QAbstractAnimation *animationAt(int index) const; + int animationCount() const; + int indexOfAnimation(QAbstractAnimation *animation) const; + void addAnimation(QAbstractAnimation *animation /Transfer/); + void insertAnimation(int index, QAbstractAnimation *animation /Transfer/); + void removeAnimation(QAbstractAnimation *animation /TransferBack/); + QAbstractAnimation *takeAnimation(int index) /TransferBack/; + void clear(); + +protected: + virtual bool event(QEvent *event); +}; diff --git a/sip/QtCore/qanystringview.sip b/sip/QtCore/qanystringview.sip new file mode 100644 index 0000000..b8fc605 --- /dev/null +++ b/sip/QtCore/qanystringview.sip @@ -0,0 +1,92 @@ +// This is the SIP interface definition for the QAnyStringView mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_4_0 -) + +%MappedType QAnyStringView /AllowNone, TypeHint="Union[QByteArray, QString]",TypeHintValue="''"/ +{ +%TypeHeaderCode +#include +%End + +%TypeCode +struct PyQtAnyStringState +{ + const sipTypeDef *instance_type; // The instance's generated type. + void *instance; // Either the QByteArray or QString. + int instance_state; // The state of the instance conversion. +}; +%End + +%ConvertToTypeCode +if (sipIsErr == NULL) + return sipCanConvertToType(sipPy, sipType_QString, 0) || + sipCanConvertToType(sipPy, sipType_QByteArray, SIP_NOT_NONE); + +PyQtAnyStringState *state = new PyQtAnyStringState; + +if (sipCanConvertToType(sipPy, sipType_QString, 0)) +{ + QString *qs = reinterpret_cast( + sipConvertToType(sipPy, sipType_QString, sipTransferObj, 0, + &state->instance_state, sipIsErr)); + + if (*sipIsErr) + return 0; + + *sipCppPtr = new QAnyStringView(*qs); + state->instance_type = sipType_QString; + state->instance = qs; +} +else +{ + QByteArray *qba = reinterpret_cast( + sipConvertToType(sipPy, sipType_QByteArray, sipTransferObj, + SIP_NOT_NONE, &state->instance_state, sipIsErr)); + + if (*sipIsErr) + return 0; + + *sipCppPtr = new QAnyStringView(*qba); + state->instance_type = sipType_QByteArray; + state->instance = qba; +} + +*sipUserStatePtr = state; + +return sipGetState(sipTransferObj); +%End + +%ConvertFromTypeCode + return qpycore_PyObject_FromQString(sipCpp->toString()); +%End + +%ReleaseCode +delete sipCpp; + +PyQtAnyStringState *state = reinterpret_cast(sipUserState); + +sipReleaseType(state->instance, state->instance_type, state->instance_state); + +delete state; +%End +}; + +%End diff --git a/sip/QtCore/qbasictimer.sip b/sip/QtCore/qbasictimer.sip new file mode 100644 index 0000000..4b0c3c3 --- /dev/null +++ b/sip/QtCore/qbasictimer.sip @@ -0,0 +1,41 @@ +// qbasictimer.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QBasicTimer +{ +%TypeHeaderCode +#include +%End + +public: + QBasicTimer(); + ~QBasicTimer(); + bool isActive() const; + int timerId() const; + void start(int msec, Qt::TimerType timerType, QObject *obj); + void start(int msec, QObject *obj); + void stop(); + void swap(QBasicTimer &other /Constrained/); + +private: + QBasicTimer(const QBasicTimer &); +}; diff --git a/sip/QtCore/qbitarray.sip b/sip/QtCore/qbitarray.sip new file mode 100644 index 0000000..3015dd6 --- /dev/null +++ b/sip/QtCore/qbitarray.sip @@ -0,0 +1,82 @@ +// qbitarray.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QBitArray +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// This is needed by __hash__(). +#include +%End + +public: + QBitArray(); + QBitArray(qsizetype size, bool value = false); + QBitArray(const QBitArray &other); + qsizetype size() const; + qsizetype count() const /__len__/; + qsizetype count(bool on) const; + bool isEmpty() const; + bool isNull() const; + void resize(qsizetype size); + void detach(); + bool isDetached() const; + void clear(); + QBitArray &operator&=(const QBitArray &); + QBitArray &operator|=(const QBitArray &); + QBitArray &operator^=(const QBitArray &); + QBitArray operator~() const; + bool operator==(const QBitArray &a) const; + bool operator!=(const QBitArray &a) const; + void fill(bool val, qsizetype first, qsizetype last); + bool fill(bool val, qsizetype size = -1); + void truncate(qsizetype pos); + bool testBit(qsizetype i) const; + void setBit(qsizetype i); + void setBit(qsizetype i, bool val); + void clearBit(qsizetype i); + bool toggleBit(qsizetype i); + bool operator[](qsizetype i) const; + bool at(qsizetype i) const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + void swap(QBitArray &other /Constrained/); + SIP_PYOBJECT bits() const /TypeHint="bytes"/; +%MethodCode + return PyBytes_FromStringAndSize(sipCpp->bits(), (sipCpp->size() + 7) / 8); +%End + + static QBitArray fromBits(const char *data /Encoding="None"/, Py_ssize_t len) [QBitArray (const char *data, qsizetype len)]; + quint32 toUInt32(QSysInfo::Endian endianness, bool *ok = 0) const; +}; + +QBitArray operator&(const QBitArray &, const QBitArray &); +QBitArray operator|(const QBitArray &, const QBitArray &); +QBitArray operator^(const QBitArray &, const QBitArray &); +QDataStream &operator<<(QDataStream &, const QBitArray &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QBitArray & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtCore/qbuffer.sip b/sip/QtCore/qbuffer.sip new file mode 100644 index 0000000..9b6c101 --- /dev/null +++ b/sip/QtCore/qbuffer.sip @@ -0,0 +1,114 @@ +// qbuffer.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QBuffer : QIODevice +{ +%TypeHeaderCode +#include +%End + +public: + explicit QBuffer(QObject *parent /TransferThis/ = 0); + QBuffer(QByteArray *byteArray /Constrained/, QObject *parent /TransferThis/ = 0); + virtual ~QBuffer(); + QByteArray &buffer(); + const QByteArray &data() const; + void setBuffer(QByteArray *a /Constrained/); + void setData(const QByteArray &data); +%If (- Qt_6_5_0) + void setData(const char *adata /Array/, int alen /ArraySize/); +%End +%If (Qt_6_5_0 -) + void setData(const char *data /Array/, qsizetype len /ArraySize/); +%End + virtual bool open(QIODeviceBase::OpenMode openMode); + virtual void close(); + virtual qint64 size() const; + virtual qint64 pos() const; + virtual bool seek(qint64 off); + virtual bool atEnd() const; + virtual bool canReadLine() const; + +protected: + virtual SIP_PYOBJECT readData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QBuffer::readData(s, a0) : sipCpp->readData(s, a0); + #else + len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)]; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipSelfWasArg ? + sipCpp->QBuffer::writeData(reinterpret_cast(bi.bi_buf), bi.bi_len) : + sipCpp->writeData(reinterpret_cast(bi.bi_buf), bi.bi_len); + #else + sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast(bi.bi_buf), + bi.bi_len); + #endif + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End +}; diff --git a/sip/QtCore/qbytearray.sip b/sip/QtCore/qbytearray.sip new file mode 100644 index 0000000..a9fb072 --- /dev/null +++ b/sip/QtCore/qbytearray.sip @@ -0,0 +1,451 @@ +// qbytearray.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QByteArray /TypeHintIn="Union[QByteArray, bytes, bytearray, memoryview]"/ +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// This is needed by __hash__(). +#include + + +// Convenience function for converting a QByteArray to a Python str object. +static PyObject *QByteArrayToPyStr(QByteArray *ba) +{ + char *data = ba->data(); + + if (data) + // QByteArrays may have embedded '\0's so set the size explicitly. + return PyBytes_FromStringAndSize(data, ba->size()); + + return PyBytes_FromString(""); +} +%End + +%ConvertToTypeCode +// Accept anything that implements the buffer protocol (including QByteArray +// itself). + +if (sipIsErr == NULL) + return sipGetBufferInfo(sipPy, NULL); + + +// If it is already a QByteArray then use it rather than make an unnecessary +// copy of the data. +if (sipCanConvertToType(sipPy, sipType_QByteArray, SIP_NO_CONVERTORS)) +{ + *sipCppPtr = reinterpret_cast( + sipConvertToType(sipPy, sipType_QByteArray, sipTransferObj, + SIP_NO_CONVERTORS, 0, sipIsErr)); + + return 0; +} + +// Create a QByteArray from the data. +sipBufferInfoDef buffer_info; + +if (sipGetBufferInfo(sipPy, &buffer_info) > 0) +{ + // Check that the buffer is compatible with one defined by + // PyBuffer_FillInfo() as used by QByteArray and the standard Python byte + // objects. + if (buffer_info.bi_format == NULL || buffer_info.bi_format[0] == 'B') + { + *sipCppPtr = new QByteArray( + reinterpret_cast(buffer_info.bi_buf), + (qsizetype)buffer_info.bi_len); + + sipReleaseBufferInfo(&buffer_info); + + // We don't support transfer of ownership. + return SIP_TEMPORARY; + } + + PyErr_Format(PyExc_TypeError, "unsupported buffer format '%s'", + buffer_info.bi_format); + + sipReleaseBufferInfo(&buffer_info); +} + +*sipIsErr = 1; + +return 0; +%End + +%BIGetBufferCode + // We may be building against a debug Python build. + + #if defined(Py_LIMITED_API) + Q_UNUSED(sipSelf); + + sipBuffer->bd_buffer = sipCpp->data(); + sipBuffer->bd_length = sipCpp->size(); + sipBuffer->bd_readonly = 0; + + sipRes = 0; + #else + sipRes = PyBuffer_FillInfo(sipBuffer, sipSelf, sipCpp->data(), + sipCpp->size(), 0, sipFlags); + #endif +%End + +%PickleCode + sipRes = Py_BuildValue("(y#)", sipCpp->data(), static_cast(sipCpp->size())); +%End + +public: + QByteArray(); + QByteArray(qsizetype size, char c /Encoding="None"/); + QByteArray(const QByteArray &a); + ~QByteArray(); + void resize(qsizetype size); +%If (Qt_6_4_0 -) + void resize(qsizetype size, char c); +%End + QByteArray &fill(char c /Encoding="None"/, qsizetype size = -1); + void clear(); + qsizetype indexOf(QByteArrayView bv, qsizetype from = 0) const; + qsizetype lastIndexOf(QByteArrayView bv, qsizetype from = -1) const; + qsizetype count(QByteArrayView bv) const; + QByteArray left(qsizetype len) const; + QByteArray right(qsizetype len) const; + QByteArray mid(qsizetype index, qsizetype length = -1) const; + QByteArray first(qsizetype n) const; + QByteArray last(qsizetype n) const; + bool startsWith(QByteArrayView bv) const; + bool endsWith(QByteArrayView bv) const; + void truncate(qsizetype pos); + void chop(qsizetype n); + QByteArray toLower() const; + QByteArray toUpper() const; + QByteArray trimmed() const; + QByteArray simplified() const; + QByteArray leftJustified(qsizetype width, char fill /Encoding="None"/ = ' ', bool truncate = false) const; + QByteArray rightJustified(qsizetype width, char fill /Encoding="None"/ = ' ', bool truncate = false) const; + QByteArray &prepend(QByteArrayView a); + QByteArray &prepend(qsizetype count, char c /Encoding="None"/); + QByteArray &append(QByteArrayView a); + QByteArray &append(qsizetype count, char c /Encoding="None"/); + QByteArray &insert(qsizetype i, QByteArrayView data); + QByteArray &insert(qsizetype i, qsizetype count, char c /Encoding="None"/); + QByteArray &remove(qsizetype index, qsizetype len); + QByteArray &replace(QByteArrayView before, QByteArrayView after); + QByteArray &replace(qsizetype index, qsizetype len, QByteArrayView s); + QList split(char sep /Encoding="None"/) const; + QByteArray &operator+=(QByteArrayView a); + bool operator==(const QString &s2) const; + bool operator!=(const QString &s2) const; + bool operator<(const QString &s2) const; + bool operator>(const QString &s2) const; + bool operator<=(const QString &s2) const; + bool operator>=(const QString &s2) const; + short toShort(bool *ok = 0, int base = 10) const; + ushort toUShort(bool *ok = 0, int base = 10) const; + int toInt(bool *ok = 0, int base = 10) const; + uint toUInt(bool *ok = 0, int base = 10) const; + long toLong(bool *ok = 0, int base = 10) const; + ulong toULong(bool *ok = 0, int base = 10) const; + qlonglong toLongLong(bool *ok = 0, int base = 10) const; + qulonglong toULongLong(bool *ok = 0, int base = 10) const; + float toFloat(bool *ok = 0) const; + double toDouble(bool *ok = 0) const; + QByteArray toBase64(QByteArray::Base64Options options = QByteArray::Base64Encoding) const; + QByteArray &setNum(double n /Constrained/, char format = 'g', int precision = 6); + QByteArray &setNum(SIP_PYOBJECT n /TypeHint="int"/, int base = 10); +%MethodCode + qlonglong val = sipLong_AsLongLong(a0); + + if (!PyErr_Occurred()) + { + sipRes = &sipCpp->setNum(val, a1); + } + else + { + // If it is positive then it might fit an unsigned long long. + + qulonglong uval = sipLong_AsUnsignedLongLong(a0); + + if (!PyErr_Occurred()) + { + sipRes = &sipCpp->setNum(uval, a1); + } + else + { + sipError = (PyErr_ExceptionMatches(PyExc_OverflowError) + ? sipErrorFail : sipErrorContinue); + } + } +%End + + static QByteArray number(double n /Constrained/, char format = 'g', int precision = 6); + static QByteArray number(SIP_PYOBJECT n /TypeHint="int"/, int base = 10); +%MethodCode + qlonglong val = sipLong_AsLongLong(a0); + + if (!PyErr_Occurred()) + { + sipRes = new QByteArray(QByteArray::number(val, a1)); + } + else + { + // If it is positive then it might fit an unsigned long long. + + qulonglong uval = sipLong_AsUnsignedLongLong(a0); + + if (!PyErr_Occurred()) + { + sipRes = new QByteArray(QByteArray::number(uval, a1)); + } + else + { + sipError = (PyErr_ExceptionMatches(PyExc_OverflowError) + ? sipErrorFail : sipErrorContinue); + } + } +%End + + static QByteArray fromBase64(const QByteArray &base64, QByteArray::Base64Options options = QByteArray::Base64Encoding); + static QByteArray fromHex(const QByteArray &hexEncoded); + qsizetype count() const; + qsizetype length() const; + bool isNull() const; + qsizetype size() const /__len__/; + char at(qsizetype i) const /Encoding="None"/; + char operator[](qsizetype i) const /Encoding="None"/; +%MethodCode + Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->size()); + + if (idx < 0) + sipIsErr = 1; + else + sipRes = sipCpp->operator[]((qsizetype)idx); +%End + + QByteArray operator[](SIP_PYSLICE slice) const; +%MethodCode + Py_ssize_t start, stop, step, slicelength; + + if (sipConvertFromSliceObject(a0, sipCpp->size(), &start, &stop, &step, &slicelength) < 0) + { + sipIsErr = 1; + } + else + { + sipRes = new QByteArray(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + sipRes->append(sipCpp->at((qsizetype)start)); + start += step; + } + } +%End + + int __contains__(const QByteArrayView bv) const; +%MethodCode + sipRes = sipCpp->contains(*a0); +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + SIP_PYOBJECT __str__() const /TypeHint="str"/; +%MethodCode + sipRes = QByteArrayToPyStr(sipCpp); + + PyObject *repr = PyObject_Repr(sipRes); + + if (repr) + { + Py_DECREF(sipRes); + sipRes = repr; + } +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QByteArray()"); + } + else + { + PyObject *str = QByteArrayToPyStr(sipCpp); + + if (str) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QByteArray(%R)", str); + + Py_DECREF(str); + } + } +%End + + QByteArray operator*(int m) const; +%MethodCode + sipRes = new QByteArray(); + + while (a0-- > 0) + *sipRes += *sipCpp; +%End + + QByteArray &operator*=(int m); +%MethodCode + QByteArray orig(*sipCpp); + + sipCpp->clear(); + + while (a0-- > 0) + *sipCpp += orig; +%End + + bool isEmpty() const; + SIP_PYOBJECT data() /TypeHint="bytes"/; +%MethodCode + // QByteArrays may contain embedded '\0's so set the size explicitly. + + char *res = sipCpp->data(); + qsizetype len = sipCpp->size(); + + if (res) + { + if ((sipRes = PyBytes_FromStringAndSize(res, (Py_ssize_t)len)) == NULL) + sipIsErr = 1; + } + else + { + Py_INCREF(Py_None); + sipRes = Py_None; + } +%End + + qsizetype capacity() const; + void reserve(qsizetype size); + void squeeze(); + void push_back(QByteArrayView a); + void push_front(QByteArrayView a); + bool contains(QByteArrayView bv) const; + QByteArray toHex(char separator /Encoding="None"/ = '\x00') const; + QByteArray toPercentEncoding(const QByteArray &exclude = QByteArray(), const QByteArray &include = QByteArray(), char percent = '%') const; + static QByteArray fromPercentEncoding(const QByteArray &input, char percent = '%'); + QByteArray repeated(qsizetype times) const; + void swap(QByteArray &other /Constrained/); + + enum Base64Option /BaseType=Flag/ + { + Base64Encoding, + Base64UrlEncoding, + KeepTrailingEquals, + OmitTrailingEquals, + IgnoreBase64DecodingErrors, + AbortOnBase64DecodingErrors, + }; + + typedef QFlags Base64Options; + QByteArray chopped(qsizetype len) const; + int compare(QByteArrayView a, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + bool isUpper() const; + bool isLower() const; + + enum class Base64DecodingStatus + { + Ok, + IllegalInputLength, + IllegalCharacter, + IllegalPadding, + }; + + static QByteArray::FromBase64Result fromBase64Encoding(const QByteArray &base64, QByteArray::Base64Options options = QByteArray::Base64Encoding); + + class FromBase64Result + { +%TypeHeaderCode +#include +%End + + public: + QByteArray decoded; + QByteArray::Base64DecodingStatus decodingStatus; + void swap(QByteArray::FromBase64Result &other /Constrained/); + operator bool() const; +%MethodCode + // This is required because SIP doesn't handle operator bool() properly. + sipRes = sipCpp->operator bool(); +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + }; + + QByteArray sliced(qsizetype pos) const; + QByteArray sliced(qsizetype pos, qsizetype n) const; +%If (Qt_6_3_0 -) + bool isValidUtf8() const; +%End +%If (Qt_6_4_0 -) + QByteArray percentDecoded(char percent = '%') const; +%End +%If (Qt_6_5_0 -) + QByteArray &removeAt(qsizetype pos); +%End +%If (Qt_6_5_0 -) + QByteArray &removeFirst(); +%End +%If (Qt_6_5_0 -) + QByteArray &removeLast(); +%End +}; + +bool operator==(const QByteArray &a1, const QByteArray &a2); +bool operator!=(const QByteArray &a1, const QByteArray &a2); +bool operator<(const QByteArray &a1, const QByteArray &a2); +bool operator<=(const QByteArray &a1, const QByteArray &a2); +bool operator>(const QByteArray &a1, const QByteArray &a2); +bool operator>=(const QByteArray &a1, const QByteArray &a2); +%If (Qt_6_5_0 -) +QByteArray operator+(const QByteArray &a1, const QByteArray &a2); +%End +%If (- Qt_6_5_0) +const QByteArray operator+(const QByteArray &a1, const QByteArray &a2); +%End +QDataStream &operator<<(QDataStream &, const QByteArray & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QByteArray & /Constrained/) /ReleaseGIL/; +QByteArray qCompress(const uchar *data /Array/, qsizetype nbytes /ArraySize/, int compressionLevel = -1); +QByteArray qCompress(const QByteArray &data, int compressionLevel = -1); +QByteArray qUncompress(const uchar *data /Array/, qsizetype nbytes /ArraySize/); +QByteArray qUncompress(const QByteArray &data); +%If (- Qt_6_2_0) +quint16 qChecksum(QByteArrayView data, Qt::ChecksumType standard = Qt::ChecksumIso3309); +%End +bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs); +bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs); diff --git a/sip/QtCore/qbytearrayalgorithms.sip b/sip/QtCore/qbytearrayalgorithms.sip new file mode 100644 index 0000000..70bb8da --- /dev/null +++ b/sip/QtCore/qbytearrayalgorithms.sip @@ -0,0 +1,31 @@ +// qbytearrayalgorithms.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) +%ModuleCode +#include +%End +%End + +%If (Qt_6_2_0 -) +quint16 qChecksum(QByteArrayView data, Qt::ChecksumType standard = Qt::ChecksumIso3309); +%End diff --git a/sip/QtCore/qbytearraylist.sip b/sip/QtCore/qbytearraylist.sip new file mode 100644 index 0000000..f7ad317 --- /dev/null +++ b/sip/QtCore/qbytearraylist.sip @@ -0,0 +1,124 @@ +// This is the SIP interface definition for the QByteArrayList mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QByteArrayList + /TypeHintIn="Iterable[QByteArray]", TypeHintOut="List[QByteArray]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + QByteArray *t = new QByteArray(sipCpp->at(i)); + PyObject *tobj = sipConvertFromNewType(t, sipType_QByteArray, + sipTransferObj); + + if (!tobj) + { + delete t; + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, tobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QByteArrayList *ql = new QByteArrayList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int state; + QByteArray *t = reinterpret_cast( + sipForceConvertToType(itm, sipType_QByteArray, sipTransferObj, + SIP_NOT_NONE, &state, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'str' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + + return 0; + } + + ql->append(*t); + + sipReleaseType(t, sipType_QByteArray, state); + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtCore/qbytearraymatcher.sip b/sip/QtCore/qbytearraymatcher.sip new file mode 100644 index 0000000..b536cee --- /dev/null +++ b/sip/QtCore/qbytearraymatcher.sip @@ -0,0 +1,56 @@ +// qbytearraymatcher.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QByteArrayMatcher +{ +%TypeHeaderCode +#include +%End + +public: +%If (Qt_6_3_0 -) + QByteArrayMatcher(const char *pattern /Encoding="None"/, qsizetype length = -1); +%End +%If (- Qt_6_3_0) + QByteArrayMatcher(const char *pattern /Encoding="None"/, qsizetype length); +%End +%If (Qt_6_3_0 -) + explicit QByteArrayMatcher(QByteArrayView pattern); +%End +%If (- Qt_6_3_0) +%If (Qt_6_4_0 -) + explicit QByteArrayMatcher(const QByteArray &pattern); +%End +%End + QByteArrayMatcher(); + QByteArrayMatcher(const QByteArrayMatcher &other); + ~QByteArrayMatcher(); + void setPattern(const QByteArray &pattern); +%If (Qt_6_3_0 -) + qsizetype indexIn(QByteArrayView data, qsizetype from = 0) const; +%End +%If (- Qt_6_3_0) + qsizetype indexIn(const QByteArray &ba, qsizetype from = 0) const; +%End + qsizetype indexIn(const char *str /Encoding="None"/, qsizetype len, qsizetype from = 0) const; + QByteArray pattern() const; +}; diff --git a/sip/QtCore/qbytearrayview.sip b/sip/QtCore/qbytearrayview.sip new file mode 100644 index 0000000..994ac74 --- /dev/null +++ b/sip/QtCore/qbytearrayview.sip @@ -0,0 +1,79 @@ +// This is the SIP interface definition for the QByteArrayView mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QByteArrayView /TypeHint="QByteArray"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +if (sipIsErr == NULL) +{ + // Note that we choose to use QByteArray's implementation of the buffer + // protocol. + return sipGetBufferInfo(sipPy, NULL); +} + +sipBufferInfoDef *buffer_info = (sipBufferInfoDef *)sipMalloc( + sizeof (sipBufferInfoDef)); + +if (buffer_info) +{ + if (sipGetBufferInfo(sipPy, buffer_info) > 0) + { + // Check that the buffer is compatible with one defined by + // PyBuffer_FillInfo() as used by QByteArray and the standard Python + // byte objects. + if (buffer_info->bi_format == NULL || buffer_info->bi_format[0] == 'B') + { + *sipCppPtr = new QByteArrayView( + reinterpret_cast( + buffer_info->bi_buf), + (qsizetype)buffer_info->bi_len); + + *sipUserStatePtr = buffer_info; + + // We don't support transfer of ownership. + return SIP_TEMPORARY; + } + + PyErr_Format(PyExc_TypeError, "unsupported buffer format '%s'", + buffer_info->bi_format); + + sipReleaseBufferInfo(buffer_info); + } + + sipFree(buffer_info); +} + +*sipIsErr = 1; + +return 0; +%End + +%ReleaseCode +delete sipCpp; + +sipBufferInfoDef *buffer_info = reinterpret_cast(sipUserState); +sipReleaseBufferInfo(buffer_info); +sipFree(buffer_info); +%End +}; diff --git a/sip/QtCore/qcalendar.sip b/sip/QtCore/qcalendar.sip new file mode 100644 index 0000000..0a18e61 --- /dev/null +++ b/sip/QtCore/qcalendar.sip @@ -0,0 +1,96 @@ +// qcalendar.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCalendar +{ +%TypeHeaderCode +#include +%End + +public: + enum + { + Unspecified, + }; + + struct YearMonthDay + { +%TypeHeaderCode +#include +%End + + YearMonthDay(); + YearMonthDay(int year, int month = 1, int day = 1); + bool isValid() const; + int year; + int month; + int day; + }; + + enum class System + { + Gregorian, + Julian, + Milankovic, + Jalali, + IslamicCivil, + }; + + QCalendar(); + explicit QCalendar(QCalendar::System system); +%If (Qt_6_4_0 -) + explicit QCalendar(QAnyStringView name); +%End +%If (- Qt_6_4_0) + explicit QCalendar(const char *name /Encoding="Latin-1"/) [(QLatin1String name)]; +%MethodCode + // This is currently the only occurence of a QLatin1String argument. + sipCpp = new QCalendar(QLatin1String(a0)); +%End + +%End + int daysInMonth(int month, int year = QCalendar::Unspecified) const; + int daysInYear(int year) const; + int monthsInYear(int year) const; + bool isDateValid(int year, int month, int day) const; + bool isLeapYear(int year) const; + bool isGregorian() const; + bool isLunar() const; + bool isLuniSolar() const; + bool isSolar() const; + bool isProleptic() const; + bool hasYearZero() const; + int maximumDaysInMonth() const; + int minimumDaysInMonth() const; + int maximumMonthsInYear() const; + QString name() const; + QDate dateFromParts(int year, int month, int day) const; + QDate dateFromParts(const QCalendar::YearMonthDay &parts) const; + QCalendar::YearMonthDay partsFromDate(QDate date) const; + int dayOfWeek(QDate date) const; + QString monthName(const QLocale &locale, int month, int year = QCalendar::Unspecified, QLocale::FormatType format = QLocale::LongFormat) const; + QString standaloneMonthName(const QLocale &locale, int month, int year = QCalendar::Unspecified, QLocale::FormatType format = QLocale::LongFormat) const; + QString weekDayName(const QLocale &locale, int day, QLocale::FormatType format = QLocale::LongFormat) const; + QString standaloneWeekDayName(const QLocale &locale, int day, QLocale::FormatType format = QLocale::LongFormat) const; + QString dateTimeToString(QStringView format, const QDateTime &datetime, QDate dateOnly, QTime timeOnly, const QLocale &locale) const; + static QStringList availableCalendars(); +}; diff --git a/sip/QtCore/qcborcommon.sip b/sip/QtCore/qcborcommon.sip new file mode 100644 index 0000000..8416899 --- /dev/null +++ b/sip/QtCore/qcborcommon.sip @@ -0,0 +1,99 @@ +// qcborcommon.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +// // Handwritten implementation of QCborSimpleType. +// Cast-XML has a bug which means that it places this definition in qmetatype.h +// (where it is first declared). + +enum class QCborSimpleType { + False /PyName=False_/, + True /PyName=True_/, + Null, + Undefined +}; + +struct QCborError +{ +%TypeHeaderCode +#include +%End + + enum Code + { + UnknownError, + AdvancePastEnd, + InputOutputError, + GarbageAtEnd, + EndOfFile, + UnexpectedBreak, + UnknownType, + IllegalType, + IllegalNumber, + IllegalSimpleType, + InvalidUtf8String, + DataTooLarge, + NestingTooDeep, + UnsupportedType, + NoError, + }; + +// Error code access +// This class is currently undocumented. Access to the error code is via a +// cast (which SIP doesn't support) or a badly named instance variable. To be +// safe we implement a more Qt-typical solution. +QCborError::Code code() const; +%MethodCode + sipRes = sipCpp->c; +%End + QString toString() const; +}; + +enum class QCborKnownTags +{ + DateTimeString, + UnixTime_t, + PositiveBignum, + NegativeBignum, + Decimal, + Bigfloat, + COSE_Encrypt0, + COSE_Mac0, + COSE_Sign1, + ExpectedBase64url, + ExpectedBase64, + ExpectedBase16, + EncodedCbor, + Url, + Base64url, + Base64, + RegularExpression, + MimeMessage, + Uuid, + COSE_Encrypt, + COSE_Mac, + COSE_Sign, + Signature, +}; diff --git a/sip/QtCore/qcborstreamreader.sip b/sip/QtCore/qcborstreamreader.sip new file mode 100644 index 0000000..dbed7d1 --- /dev/null +++ b/sip/QtCore/qcborstreamreader.sip @@ -0,0 +1,128 @@ +// qcborstreamreader.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCborStreamReader +{ +%TypeHeaderCode +#include +%End + +public: + enum Type + { + UnsignedInteger, + NegativeInteger, + ByteString, + ByteArray, + TextString, + String, + Array, + Map, + Tag, + SimpleType, + HalfFloat, + Float16, + Float, + Double, + Invalid, + }; + + enum StringResultCode + { + EndOfString, + Ok, + Error, + }; + + QCborStreamReader(); + explicit QCborStreamReader(const QByteArray &data); + explicit QCborStreamReader(QIODevice *device); + ~QCborStreamReader(); + void setDevice(QIODevice *device); + QIODevice *device() const; + void addData(const QByteArray &data); + void reparse(); + void clear(); + void reset(); + QCborError lastError(); + qint64 currentOffset() const; + bool isValid() const; + int containerDepth() const; + QCborStreamReader::Type parentContainerType() const; + bool hasNext() const; + bool next(int maxRecursion = 10000); + QCborStreamReader::Type type() const; + bool isUnsignedInteger() const; + bool isNegativeInteger() const; + bool isInteger() const; + bool isByteArray() const; + bool isString() const; + bool isArray() const; + bool isMap() const; + bool isTag() const; + bool isSimpleType() const; + bool isFloat16() const; + bool isFloat() const; + bool isDouble() const; + bool isInvalid() const; + bool isSimpleType(QCborSimpleType st) const; + bool isFalse() const; + bool isTrue() const; + bool isBool() const; + bool isNull() const; + bool isUndefined() const; + bool isLengthKnown() const; + quint64 length() const /__len__/; + bool isContainer() const; + bool enterContainer(); + bool leaveContainer(); + SIP_PYTUPLE readString() /TypeHint="Tuple[str, QCborStreamReader.StringResultCode]"/; +%MethodCode + QCborStreamReader::StringResult res = sipCpp->readString(); + + QString *qs = new QString; + if (res.status != QCborStreamReader::Error) + *qs = res.data; + + sipRes = sipBuildResult(NULL, "NF", qs, sipType_QString, NULL, res.status, sipType_QCborStreamReader_StringResultCode); +%End + + SIP_PYTUPLE readByteArray() /TypeHint="Tuple[QByteArray, QCborStreamReader.StringResultCode]"/; +%MethodCode + QCborStreamReader::StringResult res = sipCpp->readByteArray(); + + QByteArray *qba = new QByteArray; + if (res.status != QCborStreamReader::Error) + *qba = res.data; + + sipRes = sipBuildResult(NULL, "NF", qba, sipType_QByteArray, NULL, res.status, sipType_QCborStreamReader_StringResultCode); +%End + + bool toBool() const; + quint64 toUnsignedInteger() const; + QCborSimpleType toSimpleType() const; + double toDouble() const; + qint64 toInteger() const; + +private: + QCborStreamReader(const QCborStreamReader &); +}; diff --git a/sip/QtCore/qcborstreamwriter.sip b/sip/QtCore/qcborstreamwriter.sip new file mode 100644 index 0000000..6c32b83 --- /dev/null +++ b/sip/QtCore/qcborstreamwriter.sip @@ -0,0 +1,81 @@ +// qcborstreamwriter.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCborStreamWriter +{ +%TypeHeaderCode +#include +%End + +public: + explicit QCborStreamWriter(QIODevice *device); + explicit QCborStreamWriter(QByteArray *data /Constrained/); + ~QCborStreamWriter(); + void setDevice(QIODevice *device); + QIODevice *device() const; + void append(const QByteArray &ba); + void append(QStringView str); + void append(QCborKnownTags tag); + void append(QCborSimpleType st); + void append(bool b /Constrained/); + void append(double d /Constrained/); + void append(SIP_PYOBJECT /TypeHint="int"/); +%MethodCode + static PyObject *zero = 0; + + if (!zero) + zero = PyLong_FromLong(0); + + if (PyObject_RichCompareBool(a0, zero, Py_LT) > 0) + { + PyErr_Clear(); + qint64 val = sipLong_AsLongLong(a0); + + if (PyErr_Occurred()) + sipError = sipErrorFail; + else + sipCpp->append(val); + } + else + { + PyErr_Clear(); + quint64 val = sipLong_AsUnsignedLongLong(a0); + + if (PyErr_Occurred()) + sipError = sipErrorFail; + else + sipCpp->append(val); + } +%End + + void appendNull(); + void appendUndefined(); + void startArray(); + void startArray(quint64 count); + bool endArray(); + void startMap(); + void startMap(quint64 count); + bool endMap(); + +private: + QCborStreamWriter(const QCborStreamWriter &); +}; diff --git a/sip/QtCore/qchar.sip b/sip/QtCore/qchar.sip new file mode 100644 index 0000000..6ebdc55 --- /dev/null +++ b/sip/QtCore/qchar.sip @@ -0,0 +1,51 @@ +// This is the SIP interface definition for the QChar mapped types. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QChar /TypeHint="str",TypeHintValue="''"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +if (sipIsErr == NULL) + return PyUnicode_Check(sipPy); + +// TODO: review replacing with something more efficient. +QString qs = qpycore_PyObject_AsQString(sipPy); + +if (qs.size() != 1) +{ + PyErr_SetString(PyExc_ValueError, "string of length 1 expected"); + *sipIsErr = 1; + return 0; +} + +*sipCppPtr = new QChar(qs.at(0)); + +return sipGetState(sipTransferObj); +%End + +%ConvertFromTypeCode + // TODO: replace with... + // return PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, sipCpp, 1); + return qpycore_PyObject_FromQString(QString(*sipCpp)); +%End +}; diff --git a/sip/QtCore/qcollator.sip b/sip/QtCore/qcollator.sip new file mode 100644 index 0000000..111e21b --- /dev/null +++ b/sip/QtCore/qcollator.sip @@ -0,0 +1,69 @@ +// qcollator.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCollatorSortKey +{ +%TypeHeaderCode +#include +%End + +public: + QCollatorSortKey(const QCollatorSortKey &other); + ~QCollatorSortKey(); + void swap(QCollatorSortKey &other /Constrained/); + int compare(const QCollatorSortKey &key) const; + +private: + QCollatorSortKey(); +}; + +bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs); + +class QCollator +{ +%TypeHeaderCode +#include +%End + +public: + QCollator(); + explicit QCollator(const QLocale &locale); + QCollator(const QCollator &); + ~QCollator(); + void swap(QCollator &other /Constrained/); + void setLocale(const QLocale &locale); + QLocale locale() const; + Qt::CaseSensitivity caseSensitivity() const; + void setCaseSensitivity(Qt::CaseSensitivity cs); + void setNumericMode(bool on); + bool numericMode() const; + void setIgnorePunctuation(bool on); + bool ignorePunctuation() const; + int compare(const QString &s1, const QString &s2) const; + QCollatorSortKey sortKey(const QString &string) const; +%If (Qt_6_3_0 -) + static int defaultCompare(QStringView s1, QStringView s2); +%End +%If (Qt_6_3_0 -) + static QCollatorSortKey defaultSortKey(QStringView key); +%End +}; diff --git a/sip/QtCore/qcommandlineoption.sip b/sip/QtCore/qcommandlineoption.sip new file mode 100644 index 0000000..f116262 --- /dev/null +++ b/sip/QtCore/qcommandlineoption.sip @@ -0,0 +1,55 @@ +// qcommandlineoption.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCommandLineOption +{ +%TypeHeaderCode +#include +%End + +public: + explicit QCommandLineOption(const QString &name); + explicit QCommandLineOption(const QStringList &names); + QCommandLineOption(const QString &name, const QString &description, const QString &valueName = QString(), const QString &defaultValue = QString()); + QCommandLineOption(const QStringList &names, const QString &description, const QString &valueName = QString(), const QString &defaultValue = QString()); + QCommandLineOption(const QCommandLineOption &other); + ~QCommandLineOption(); + void swap(QCommandLineOption &other /Constrained/); + QStringList names() const; + void setValueName(const QString &name); + QString valueName() const; + void setDescription(const QString &description); + QString description() const; + void setDefaultValue(const QString &defaultValue); + void setDefaultValues(const QStringList &defaultValues); + QStringList defaultValues() const; + + enum Flag /BaseType=Flag/ + { + HiddenFromHelp, + ShortOptionStyle, + }; + + typedef QFlags Flags; + QCommandLineOption::Flags flags() const; + void setFlags(QCommandLineOption::Flags aflags); +}; diff --git a/sip/QtCore/qcommandlineparser.sip b/sip/QtCore/qcommandlineparser.sip new file mode 100644 index 0000000..af0ef66 --- /dev/null +++ b/sip/QtCore/qcommandlineparser.sip @@ -0,0 +1,75 @@ +// qcommandlineparser.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCommandLineParser +{ +%TypeHeaderCode +#include +%End + +public: + QCommandLineParser(); + ~QCommandLineParser(); + + enum SingleDashWordOptionMode + { + ParseAsCompactedShortOptions, + ParseAsLongOptions, + }; + + void setSingleDashWordOptionMode(QCommandLineParser::SingleDashWordOptionMode parsingMode); + bool addOption(const QCommandLineOption &commandLineOption); + QCommandLineOption addVersionOption(); + QCommandLineOption addHelpOption(); + void setApplicationDescription(const QString &description); + QString applicationDescription() const; + void addPositionalArgument(const QString &name, const QString &description, const QString &syntax = QString()); + void clearPositionalArguments(); + void process(const QStringList &arguments) /ReleaseGIL/; + void process(const QCoreApplication &app) /ReleaseGIL/; + bool parse(const QStringList &arguments); + QString errorText() const; + bool isSet(const QString &name) const; + QString value(const QString &name) const; + QStringList values(const QString &name) const; + bool isSet(const QCommandLineOption &option) const; + QString value(const QCommandLineOption &option) const; + QStringList values(const QCommandLineOption &option) const; + QStringList positionalArguments() const; + QStringList optionNames() const; + QStringList unknownOptionNames() const; + void showHelp(int exitCode = 0) /ReleaseGIL/; + QString helpText() const; + bool addOptions(const QList &options); + void showVersion(); + + enum OptionsAfterPositionalArgumentsMode + { + ParseAsOptions, + ParseAsPositionalArguments, + }; + + void setOptionsAfterPositionalArgumentsMode(QCommandLineParser::OptionsAfterPositionalArgumentsMode mode); + +private: + QCommandLineParser(const QCommandLineParser &); +}; diff --git a/sip/QtCore/qconcatenatetablesproxymodel.sip b/sip/QtCore/qconcatenatetablesproxymodel.sip new file mode 100644 index 0000000..d5249b3 --- /dev/null +++ b/sip/QtCore/qconcatenatetablesproxymodel.sip @@ -0,0 +1,90 @@ +// qconcatenatetablesproxymodel.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QConcatenateTablesProxyModel : QAbstractItemModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QConcatenateTablesProxyModel(QObject *parent /TransferThis/ = 0); + virtual ~QConcatenateTablesProxyModel(); + void addSourceModel(QAbstractItemModel *sourceModel /GetWrapper/); +%MethodCode + // We want to keep a reference to the model but this is in addition to the + // existing ones and does not replace them - so we can't use /KeepReference/. + sipCpp->addSourceModel(a0); + + // Use the user object as a list of the references. + PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf); + + if (!user) + { + user = PyList_New(0); + sipSetUserObject((sipSimpleWrapper *)sipSelf, user); + } + + if (user) + PyList_Append(user, a0Wrapper); +%End + + void removeSourceModel(QAbstractItemModel *sourceModel /GetWrapper/); +%MethodCode + // Discard the extra model reference that we took in addSourceModel(). + sipCpp->removeSourceModel(a0); + + // Use the user object as a list of the references. + PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf); + + if (user) + { + Py_ssize_t i = 0; + + // Note that we deal with an object appearing in the list more than once. + while (i < PyList_Size(user)) + if (PyList_GetItem(user, i) == a0Wrapper) + PyList_SetSlice(user, i, i + 1, NULL); + else + ++i; + } +%End + + QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; + QModelIndex mapToSource(const QModelIndex &proxyIndex) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + virtual QMap itemData(const QModelIndex &proxyIndex) const; + virtual bool setItemData(const QModelIndex &index, const QMap &roles); + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex parent(const QModelIndex &index) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/; + virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + virtual QSize span(const QModelIndex &index) const; + QList sourceModels() const; +}; diff --git a/sip/QtCore/qcoreapplication.sip b/sip/QtCore/qcoreapplication.sip new file mode 100644 index 0000000..a93ccfa --- /dev/null +++ b/sip/QtCore/qcoreapplication.sip @@ -0,0 +1,407 @@ +// qcoreapplication.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QCoreApplication : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QCoreApplication(SIP_PYLIST argv /TypeHint="List[str]"/) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, int = QCoreApplication::ApplicationFlags)]; +%MethodCode + // The Python interface is a list of argument strings that is modified. + + int argc; + char **argv; + + // Convert the list. + if ((argv = pyqt6_from_argv_list(a0, argc)) == NULL) + sipIsErr = 1; + else + { + // Create it now the arguments are right. + static int nargc; + nargc = argc; + + Py_BEGIN_ALLOW_THREADS + sipCpp = new sipQCoreApplication(nargc, argv, QT_VERSION); + Py_END_ALLOW_THREADS + + // Now modify the original list. + pyqt6_update_argv_list(a0, argc, argv); + } +%End + + virtual ~QCoreApplication() /ReleaseGIL/; +%MethodCode + pyqt6_cleanup_qobjects(); +%End + + static void setOrganizationDomain(const QString &orgDomain); + static QString organizationDomain(); + static void setOrganizationName(const QString &orgName); + static QString organizationName(); + static void setApplicationName(const QString &application); + static QString applicationName(); + static QStringList arguments(); + static QCoreApplication *instance(); + static int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; + static void processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) /ReleaseGIL/; + static void processEvents(QEventLoop::ProcessEventsFlags flags, int maxtime) /ReleaseGIL/; + static bool sendEvent(QObject *receiver, QEvent *event) /ReleaseGIL/; + static void postEvent(QObject *receiver, QEvent *event /Transfer/, int priority = Qt::NormalEventPriority); + static void sendPostedEvents(QObject *receiver = 0, int eventType = 0) /ReleaseGIL/; + static void removePostedEvents(QObject *receiver, int eventType = 0); + virtual bool notify(QObject *, QEvent *) /ReleaseGIL/; + static bool startingUp(); + static bool closingDown(); + static QString applicationDirPath(); + static QString applicationFilePath(); + static void setLibraryPaths(const QStringList &); + static QStringList libraryPaths(); + static void addLibraryPath(const QString &); + static void removeLibraryPath(const QString &); + static bool installTranslator(QTranslator *messageFile); + static bool removeTranslator(QTranslator *messageFile); + static QString translate(const char *context, const char *sourceText /Encoding="UTF-8"/, const char *disambiguation = 0, int n = -1); + static void setAttribute(Qt::ApplicationAttribute attribute, bool on = true); + static bool testAttribute(Qt::ApplicationAttribute attribute); + +public slots: + static void quit(); +%If (Qt_6_1_0 -) + static void exit(int returnCode = 0); +%End + +public: +%If (- Qt_6_1_0) + static void exit(int returnCode = 0); +%End + +signals: + void aboutToQuit(); + +protected: + virtual bool event(QEvent *); + +public: + static void setApplicationVersion(const QString &version); + static QString applicationVersion(); + static qint64 applicationPid(); + static QAbstractEventDispatcher *eventDispatcher(); + static void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher /Transfer/); + static bool isQuitLockEnabled(); + static void setQuitLockEnabled(bool enabled); + void installNativeEventFilter(QAbstractNativeEventFilter *filterObj); + void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj); + static void setSetuidAllowed(bool allow); + static bool isSetuidAllowed(); + SIP_PYOBJECT __enter__(); +%MethodCode + // Just return a reference to self. + sipRes = sipSelf; + Py_INCREF(sipRes); +%End + + void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback); +%MethodCode + // Make sure the QCoreApplication is destroyed. + delete sipCpp; +%End + +%If (Qt_6_5_0 -) +%If (PyQt_Permissions) + Qt::PermissionStatus checkPermission(const QPermission &permission); +%End +%End +%If (Qt_6_5_0 -) +%If (PyQt_Permissions) + void requestPermission(const QPermission &permission, SIP_PYCALLABLE handler /TypeHint="Callable[[QPermission], None]"/) /ReleaseGIL/; +%MethodCode + // Make sure the callable doesn't get garbage collected until it is invoked. + Py_INCREF(a1); + + Py_BEGIN_ALLOW_THREADS + + sipCpp->requestPermission(*a0, [a1](const QPermission &arg0) { + SIP_BLOCK_THREADS + + PyObject *res; + + res = sipCallMethod(NULL, a1, "N", new QPermission(arg0), sipType_QPermission, NULL); + + Py_DECREF(a1); + + if (!res) + pyqt6_err_print(); + else + Py_DECREF(res); + + SIP_UNBLOCK_THREADS + }); + + Py_END_ALLOW_THREADS +%End + +%End +%End +}; + +void qAddPostRoutine(SIP_PYCALLABLE); +%MethodCode + // Add it to the list of post routines if it already exists. + if (qtcore_PostRoutines != NULL) + { + // See if there is an empty slot. + bool app = true; + + for (Py_ssize_t i = 0; i < PyList_Size(qtcore_PostRoutines); ++i) + if (PyList_GetItem(qtcore_PostRoutines, i) == Py_None) + { + Py_INCREF(a0); + PyList_SetItem(qtcore_PostRoutines, i, a0); + + app = false; + + break; + } + + if (app && PyList_Append(qtcore_PostRoutines, a0) < 0) + sipIsErr = 1; + } + else if ((qtcore_PostRoutines = PyList_New(1)) != NULL) + { + Py_INCREF(a0); + PyList_SetItem(qtcore_PostRoutines, 0, a0); + + qAddPostRoutine(qtcore_CallPostRoutines); + } + else + { + sipIsErr = 1; + } +%End + +void qRemovePostRoutine(SIP_PYCALLABLE); +%MethodCode + // Remove it from the list of post routines if it exists. + if (qtcore_PostRoutines != NULL) + for (Py_ssize_t i = 0; i < PyList_Size(qtcore_PostRoutines); ++i) + if (PyList_GetItem(qtcore_PostRoutines, i) == a0) + { + Py_INCREF(Py_None); + PyList_SetItem(qtcore_PostRoutines, i, Py_None); + + break; + } +%End + +void qAddPreRoutine(SIP_PYCALLABLE routine /TypeHint="Callable[[], None]"/); +%MethodCode + // Add it to the list of pre routines if it already exists. + if (qtcore_PreRoutines != NULL) + { + if (PyList_Append(qtcore_PreRoutines, a0) < 0) + sipIsErr = 1; + } + else if ((qtcore_PreRoutines = PyList_New(1)) != NULL) + { + Py_INCREF(a0); + PyList_SetItem(qtcore_PreRoutines, 0, a0); + + qAddPreRoutine(qtcore_CallPreRoutines); + } + else + { + sipIsErr = 1; + } +%End + +// Module code needed by qAddPreRoutine, qAddPostRoutine() and qRemovePostRoutine(). +%ModuleCode +// The list of Python pre routines. +static PyObject *qtcore_PreRoutines = NULL; + +// Call all of the registered Python pre routines. +static void qtcore_CallPreRoutines() +{ + for (Py_ssize_t i = 0; i < PyList_Size(qtcore_PreRoutines); ++i) + { + PyObject *pr = PyList_GetItem(qtcore_PreRoutines, i); + + if (pr != Py_None) + { + PyObject *res = PyObject_CallObject(pr, NULL); + + Py_XDECREF(res); + } + } +} + + +// The list of Python post routines. +static PyObject *qtcore_PostRoutines = NULL; + +// Call all of the registered Python post routines. +static void qtcore_CallPostRoutines() +{ + for (Py_ssize_t i = 0; i < PyList_Size(qtcore_PostRoutines); ++i) + { + PyObject *pr = PyList_GetItem(qtcore_PostRoutines, i); + + if (pr != Py_None) + { + PyObject *res = PyObject_CallObject(pr, NULL); + + Py_XDECREF(res); + } + } +} +%End +void pyqtRemoveInputHook(); +%MethodCode + // Clear the Python input hook installed when the module was initialised. + PyOS_InputHook = 0; +%End + +void pyqtRestoreInputHook(); +%MethodCode + // Restore the input hook. + PyOS_InputHook = qtcore_input_hook; +%End + +%ModuleCode +#include +#include +#include + +#if defined(Q_OS_WIN) +#include +#include +#else +#include +#endif + +// This is the input hook that will process events while the interpreter is +// waiting for interactive input. +extern "C" {static int qtcore_input_hook();} + +static int qtcore_input_hook() +{ + QCoreApplication *app = QCoreApplication::instance(); + + if (app && app->thread() == QThread::currentThread()) + { + QEventLoop loop; +#if defined(Q_OS_WIN) + QTimer timer; + QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + + while (!_kbhit()) + { + // The delay is based on feedback from users. + timer.start(35); + loop.exec(); + timer.stop(); + } + + QObject::disconnect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); +#else + QSocketNotifier notifier(0, QSocketNotifier::Read, 0); + QObject::connect(¬ifier, SIGNAL(activated(int)), &loop, SLOT(quit())); + loop.exec(); + QObject::disconnect(¬ifier, SIGNAL(activated(int)), &loop, SLOT(quit())); +#endif + } + + return 0; +} +%End + +%PostInitialisationCode +// Process events from the input hook. +PyOS_InputHook = qtcore_input_hook; +%End + +%ExportedTypeHintCode +# Support for QDate, QDateTime and QTime. +import datetime + +# Convenient type aliases. +PYQT_SIGNAL = typing.Union[QtCore.pyqtSignal, QtCore.pyqtBoundSignal] +PYQT_SLOT = typing.Union[typing.Callable[..., Any], QtCore.pyqtBoundSignal] +%End + +%TypeHintCode +# Support for QDate, QDateTime and QTime. +import datetime + + +# Support for new-style signals and slots. +class pyqtSignal: + + signatures = ... # type: typing.Tuple[str, ...] + + def __init__(self, *types: typing.Any, name: str = ...) -> None: ... + + @typing.overload + def __get__(self, instance: None, owner: typing.Type['QObject']) -> 'pyqtSignal': ... + + @typing.overload + def __get__(self, instance: 'QObject', owner: typing.Type['QObject']) -> 'pyqtBoundSignal': ... + + + +class pyqtBoundSignal: + + signal = ... # type: str + + def __getitem__(self, key: object) -> 'pyqtBoundSignal': ... + + def connect(self, slot: 'PYQT_SLOT') -> 'QMetaObject.Connection': ... + + @typing.overload + def disconnect(self) -> None: ... + + @typing.overload + def disconnect(self, slot: typing.Union['PYQT_SLOT', 'QMetaObject.Connection']) -> None: ... + + def emit(self, *args: typing.Any) -> None: ... + + +FuncT = typing.TypeVar('FuncT', bound=typing.Callable) +def pyqtSlot(*types, name: typing.Optional[str] = ..., result: typing.Optional[str] = ...) -> typing.Callable[[FuncT], FuncT]: ... + + +# For QObject.findChild() and QObject.findChildren(). +QObjectT = typing.TypeVar('QObjectT', bound=QObject) + + +# Convenient type aliases. +PYQT_SIGNAL = typing.Union[pyqtSignal, pyqtBoundSignal] +PYQT_SLOT = typing.Union[typing.Callable[..., Any], pyqtBoundSignal] +%End diff --git a/sip/QtCore/qcoreevent.sip b/sip/QtCore/qcoreevent.sip new file mode 100644 index 0000000..d0bc2bd --- /dev/null +++ b/sip/QtCore/qcoreevent.sip @@ -0,0 +1,278 @@ +// qcoreevent.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QEvent /NoDefaultCtors,Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + switch (sipCpp->type()) + { + case QEvent::Timer: + sipType = sipType_QTimerEvent; + break; + + case QEvent::ChildAdded: + case QEvent::ChildPolished: + case QEvent::ChildRemoved: + sipType = sipType_QChildEvent; + break; + + case QEvent::DynamicPropertyChange: + sipType = sipType_QDynamicPropertyChangeEvent; + break; + + default: + sipType = 0; + } +%End + +public: + enum Type /BaseType=IntEnum/ + { + None, + Timer, + MouseButtonPress, + MouseButtonRelease, + MouseButtonDblClick, + MouseMove, + KeyPress, + KeyRelease, + FocusIn, + FocusOut, + Enter, + Leave, + Paint, + Move, + Resize, + Show, + Hide, + Close, + Quit, + ParentChange, + ParentAboutToChange, + ThreadChange, + WindowActivate, + WindowDeactivate, + ShowToParent, + HideToParent, + Wheel, + WindowTitleChange, + WindowIconChange, + ApplicationWindowIconChange, + ApplicationFontChange, + ApplicationLayoutDirectionChange, + ApplicationPaletteChange, + PaletteChange, + Clipboard, + MetaCall, + SockAct, + WinEventAct, + DeferredDelete, + DragEnter, + DragMove, + DragLeave, + Drop, + ChildAdded, + ChildPolished, + ChildRemoved, + PolishRequest, + Polish, + LayoutRequest, + UpdateRequest, + UpdateLater, + ContextMenu, + InputMethod, + TabletMove, + LocaleChange, + LanguageChange, + LayoutDirectionChange, + TabletPress, + TabletRelease, + OkRequest, + IconDrag, + FontChange, + EnabledChange, + ActivationChange, + StyleChange, + IconTextChange, + ModifiedChange, + MouseTrackingChange, + WindowBlocked, + WindowUnblocked, + WindowStateChange, + ToolTip, + WhatsThis, + StatusTip, + ActionChanged, + ActionAdded, + ActionRemoved, + FileOpen, + Shortcut, + ShortcutOverride, + WhatsThisClicked, + ToolBarChange, + ApplicationActivate, + ApplicationActivated, + ApplicationDeactivate, + ApplicationDeactivated, + QueryWhatsThis, + EnterWhatsThisMode, + LeaveWhatsThisMode, + ZOrderChange, + HoverEnter, + HoverLeave, + HoverMove, + GraphicsSceneMouseMove, + GraphicsSceneMousePress, + GraphicsSceneMouseRelease, + GraphicsSceneMouseDoubleClick, + GraphicsSceneContextMenu, + GraphicsSceneHoverEnter, + GraphicsSceneHoverMove, + GraphicsSceneHoverLeave, + GraphicsSceneHelp, + GraphicsSceneDragEnter, + GraphicsSceneDragMove, + GraphicsSceneDragLeave, + GraphicsSceneDrop, + GraphicsSceneWheel, + GraphicsSceneResize, + GraphicsSceneMove, + KeyboardLayoutChange, + DynamicPropertyChange, + TabletEnterProximity, + TabletLeaveProximity, + NonClientAreaMouseMove, + NonClientAreaMouseButtonPress, + NonClientAreaMouseButtonRelease, + NonClientAreaMouseButtonDblClick, + MacSizeChange, + ContentsRectChange, + CursorChange, + ToolTipChange, + GrabMouse, + UngrabMouse, + GrabKeyboard, + UngrabKeyboard, + StateMachineSignal, + StateMachineWrapped, + TouchBegin, + TouchUpdate, + TouchEnd, + NativeGesture, + RequestSoftwareInputPanel, + CloseSoftwareInputPanel, + WinIdChange, + Gesture, + GestureOverride, + FocusAboutToChange, + ScrollPrepare, + Scroll, + Expose, + InputMethodQuery, + OrientationChange, + TouchCancel, + PlatformPanel, + ApplicationStateChange, + ReadOnlyChange, + PlatformSurface, + TabletTrackingChange, + GraphicsSceneLeave, + EnterEditFocus, + LeaveEditFocus, + User, + MaxUser, + }; + + explicit QEvent(QEvent::Type type); + QEvent(int type) /Deprecated, NoDerived/; +%MethodCode + // This overload allows an int to be passed as is rather than being wrapped in + // a QEvent.Type. This was usefull before enums supported missing members and + // is now deprecated. + + sipCpp = new sipQEvent(static_cast(a0)); +%End + + virtual ~QEvent(); + QEvent::Type type() const; + bool spontaneous() const; + virtual void setAccepted(bool accepted); + bool isAccepted() const; + void accept(); + void ignore(); + static int registerEventType(int hint = -1); + bool isInputEvent() const; + bool isPointerEvent() const; + bool isSinglePointEvent() const; + virtual QEvent *clone() const /Factory/; +}; + +class QTimerEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTimerEvent(int timerId); + virtual ~QTimerEvent(); + int timerId() const; + virtual QTimerEvent *clone() const /Factory/; +}; + +class QChildEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QChildEvent(QEvent::Type type, QObject *child); + QChildEvent(int type, QObject *child) /NoDerived/; +%MethodCode + sipCpp = new sipQChildEvent(static_cast(a0), a1); +%End + + virtual ~QChildEvent(); + QObject *child() const; + bool added() const; + bool polished() const; + bool removed() const; + virtual QChildEvent *clone() const /Factory/; +}; + +class QDynamicPropertyChangeEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QDynamicPropertyChangeEvent(const QByteArray &name); + virtual ~QDynamicPropertyChangeEvent(); + QByteArray propertyName() const; + virtual QDynamicPropertyChangeEvent *clone() const /Factory/; +}; diff --git a/sip/QtCore/qcryptographichash.sip b/sip/QtCore/qcryptographichash.sip new file mode 100644 index 0000000..b4d5b29 --- /dev/null +++ b/sip/QtCore/qcryptographichash.sip @@ -0,0 +1,91 @@ +// qcryptographichash.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCryptographicHash +{ +%TypeHeaderCode +#include +%End + +public: + enum Algorithm + { + Md4, + Md5, + Sha1, + Sha224, + Sha256, + Sha384, + Sha512, + Sha3_224, + Sha3_256, + Sha3_384, + Sha3_512, + Keccak_224, + Keccak_256, + Keccak_384, + Keccak_512, + Blake2b_160, + Blake2b_256, + Blake2b_384, + Blake2b_512, + Blake2s_128, + Blake2s_160, + Blake2s_224, + Blake2s_256, + }; + + explicit QCryptographicHash(QCryptographicHash::Algorithm method); + ~QCryptographicHash(); + void reset(); +%If (Qt_6_3_0 -) + void addData(QByteArrayView data); +%End +%If (- Qt_6_3_0) + void addData(const QByteArray &data); +%End + void addData(const char *data /Array/, qsizetype length /ArraySize/); + bool addData(QIODevice *device); + QByteArray result() const; +%If (Qt_6_3_0 -) + QByteArrayView resultView() const; +%End +%If (Qt_6_3_0 -) + static QByteArray hash(QByteArrayView data, QCryptographicHash::Algorithm method); +%End +%If (- Qt_6_3_0) + static QByteArray hash(const QByteArray &data, QCryptographicHash::Algorithm method); +%End + static int hashLength(QCryptographicHash::Algorithm method); +%If (Qt_6_5_0 -) + void swap(QCryptographicHash &other /Constrained/); +%End +%If (Qt_6_5_0 -) + QCryptographicHash::Algorithm algorithm() const; +%End +%If (Qt_6_5_0 -) + static bool supportsAlgorithm(QCryptographicHash::Algorithm method); +%End + +private: + QCryptographicHash(const QCryptographicHash &); +}; diff --git a/sip/QtCore/qdatastream.sip b/sip/QtCore/qdatastream.sip new file mode 100644 index 0000000..bd60237 --- /dev/null +++ b/sip/QtCore/qdatastream.sip @@ -0,0 +1,512 @@ +// qdatastream.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDataStream : QIODeviceBase +{ +%TypeHeaderCode +#include +%End + +public: + enum Version /BaseType=IntEnum/ + { + Qt_1_0, + Qt_2_0, + Qt_2_1, + Qt_3_0, + Qt_3_1, + Qt_3_3, + Qt_4_0, + Qt_4_1, + Qt_4_2, + Qt_4_3, + Qt_4_4, + Qt_4_5, + Qt_4_6, + Qt_4_7, + Qt_4_8, + Qt_4_9, + Qt_5_0, + Qt_5_1, + Qt_5_2, + Qt_5_3, + Qt_5_4, + Qt_5_5, + Qt_5_6, + Qt_5_7, + Qt_5_8, + Qt_5_9, + Qt_5_10, + Qt_5_11, + Qt_5_12, + Qt_5_13, + Qt_5_14, + Qt_5_15, + Qt_6_0, +%If (Qt_6_1_0 -) + Qt_6_1, +%End +%If (Qt_6_2_0 -) + Qt_6_2, +%End +%If (Qt_6_3_0 -) + Qt_6_3, +%End +%If (Qt_6_4_0 -) + Qt_6_4, +%End +%If (Qt_6_5_0 -) + Qt_6_5, +%End + }; + + enum ByteOrder + { + BigEndian, + LittleEndian, + }; + + enum Status + { + Ok, + ReadPastEnd, + ReadCorruptData, + WriteFailed, + }; + + enum FloatingPointPrecision + { + SinglePrecision, + DoublePrecision, + }; + + QDataStream(); + explicit QDataStream(QIODevice *); + QDataStream(QByteArray * /Constrained/, QIODeviceBase::OpenMode flags); + QDataStream(const QByteArray &); + ~QDataStream(); + QIODevice *device() const; + void setDevice(QIODevice *); + bool atEnd() const; + QDataStream::Status status() const; + void setStatus(QDataStream::Status status); + void resetStatus(); + QDataStream::FloatingPointPrecision floatingPointPrecision() const; + void setFloatingPointPrecision(QDataStream::FloatingPointPrecision precision); + QDataStream::ByteOrder byteOrder() const; + void setByteOrder(QDataStream::ByteOrder); + int version() const; + void setVersion(int); + SIP_PYOBJECT readBytes() /ReleaseGIL,TypeHint="bytes"/; +%MethodCode + char *s; + uint l; + + Py_BEGIN_ALLOW_THREADS + sipCpp->readBytes(s, l); + Py_END_ALLOW_THREADS + + if ((sipRes = PyBytes_FromStringAndSize(s, l)) == NULL) + sipIsErr = 1; + + if (s) + delete[] s; +%End + + SIP_PYOBJECT readRawData(int len) /Encoding="None",ReleaseGIL,TypeHint="bytes"/; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + int len; + + Py_BEGIN_ALLOW_THREADS + len = sipCpp->readRawData(s, a0); + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + QDataStream &writeBytes(SIP_PYBUFFER) /ReleaseGIL/; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + sipRes = &sipCpp->writeBytes(reinterpret_cast(bi.bi_buf), + bi.bi_len); + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + + int writeRawData(SIP_PYBUFFER) /ReleaseGIL/; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->writeRawData(reinterpret_cast(bi.bi_buf), + bi.bi_len); + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + + int skipRawData(int len) /ReleaseGIL/; + void startTransaction(); + bool commitTransaction(); + void rollbackTransaction(); + void abortTransaction(); +// Extra methods to give explicit control over the simple data types being read and written. +int readInt() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +qint8 readInt8() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +quint8 readUInt8() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +qint16 readInt16() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +quint16 readUInt16() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +qint32 readInt32() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +quint32 readUInt32() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +qint64 readInt64() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +quint64 readUInt64() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +bool readBool() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +float readFloat() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +double readDouble() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp >> sipRes; + Py_END_ALLOW_THREADS +%End + +SIP_PYOBJECT readString() /ReleaseGIL,TypeHint="bytes"/; +%MethodCode + // Note that this should really be called readCString(). + + char *s; + + Py_BEGIN_ALLOW_THREADS + *sipCpp >> s; + Py_END_ALLOW_THREADS + + if (s) + { + sipRes = PyBytes_FromString(s); + delete[] s; + } + else + { + sipRes = Py_None; + Py_INCREF(Py_None); + } +%End + +void writeInt(int i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeInt8(qint8 i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeUInt8(quint8 i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeInt16(qint16 i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeUInt16(quint16 i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeInt32(qint32 i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeUInt32(quint32 i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeInt64(qint64 i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeUInt64(quint64 i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeBool(bool i) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeFloat(float f) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeDouble(double f) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +void writeString(const char *str /Encoding="None"/) /ReleaseGIL/; +%MethodCode + // Note that this should really be called writeCString(). + Py_BEGIN_ALLOW_THREADS + *sipCpp << a0; + Py_END_ALLOW_THREADS +%End + +QString readQString() /ReleaseGIL/; +%MethodCode + sipRes = new QString; + + Py_BEGIN_ALLOW_THREADS + *sipCpp >> *sipRes; + Py_END_ALLOW_THREADS +%End + +void writeQString(const QString &qstr) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << *a0; + Py_END_ALLOW_THREADS +%End + +QStringList readQStringList() /ReleaseGIL/; +%MethodCode + sipRes = new QStringList; + + Py_BEGIN_ALLOW_THREADS + *sipCpp >> *sipRes; + Py_END_ALLOW_THREADS +%End + +void writeQStringList(const QStringList &qstrlst) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << *a0; + Py_END_ALLOW_THREADS +%End + +QVariant readQVariant() /ReleaseGIL/; +%MethodCode + sipRes = new QVariant; + + Py_BEGIN_ALLOW_THREADS + *sipCpp >> *sipRes; + Py_END_ALLOW_THREADS +%End + +void writeQVariant(const QVariant &qvar) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << *a0; + Py_END_ALLOW_THREADS +%End + +QVariantList readQVariantList() /ReleaseGIL/; +%MethodCode + sipRes = new QVariantList; + + Py_BEGIN_ALLOW_THREADS + *sipCpp >> *sipRes; + Py_END_ALLOW_THREADS +%End + +void writeQVariantList(const QVariantList &qvarlst) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << *a0; + Py_END_ALLOW_THREADS +%End + +QVariantMap readQVariantMap() /ReleaseGIL/; +%MethodCode + sipRes = new QVariantMap; + + Py_BEGIN_ALLOW_THREADS + *sipCpp >> *sipRes; + Py_END_ALLOW_THREADS +%End + +void writeQVariantMap(const QVariantMap &qvarmap) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << *a0; + Py_END_ALLOW_THREADS +%End + +QVariantHash readQVariantHash() /ReleaseGIL/; +%MethodCode + sipRes = new QVariantHash; + + Py_BEGIN_ALLOW_THREADS + *sipCpp >> *sipRes; + Py_END_ALLOW_THREADS +%End + +void writeQVariantHash(const QVariantHash &qvarhash) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + *sipCpp << *a0; + Py_END_ALLOW_THREADS +%End + +private: + QDataStream(const QDataStream &); +}; + +QDataStream &operator>>(QDataStream &s, QKeyCombination &combination /Constrained/) /ReleaseGIL/; +QDataStream &operator<<(QDataStream &s, QKeyCombination combination) /ReleaseGIL/; diff --git a/sip/QtCore/qdatetime.sip b/sip/QtCore/qdatetime.sip new file mode 100644 index 0000000..2e95893 --- /dev/null +++ b/sip/QtCore/qdatetime.sip @@ -0,0 +1,467 @@ +// qdatetime.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDate /TypeHintIn="Union[QDate, datetime.date]"/ +{ +%TypeHeaderCode +#include +%End + +%TypeCode +#include +%End + +%ConvertToTypeCode +// Allow a Python date object whenever a QDate is expected. + +if (sipIsErr == NULL) + return (sipGetDate(sipPy, 0) || + sipCanConvertToType(sipPy, sipType_QDate, SIP_NO_CONVERTORS)); + +sipDateDef py_date; + +if (sipGetDate(sipPy, &py_date)) +{ + *sipCppPtr = new QDate(py_date.pd_year, + py_date.pd_month, + py_date.pd_day); + + return sipGetState(sipTransferObj); +} + +*sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, sipType_QDate, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + +return 0; +%End + +%PickleCode + sipRes = Py_BuildValue("iii", sipCpp->year(), sipCpp->month(), sipCpp->day()); +%End + +public: + QDate(); + QDate(int y, int m, int d); + QDate(int y, int m, int d, QCalendar cal); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QDate()"); + } + else + { + sipRes = PyUnicode_FromFormat( + "PyQt6.QtCore.QDate(%i, %i, %i)", sipCpp->year(), + sipCpp->month(), sipCpp->day()); + } +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(sipCpp->toString(Qt::ISODate)); +%End + + SIP_PYOBJECT toPyDate() const /TypeHint="datetime.date"/; +%MethodCode + // Convert to a Python date object. + sipDateDef py_date; + + py_date.pd_year = sipCpp->year(); + py_date.pd_month = sipCpp->month(); + py_date.pd_day = sipCpp->day(); + + sipRes = sipFromDate(&py_date); +%End + + bool isNull() const; + int __bool__() const; +%MethodCode + sipRes = !sipCpp->isNull(); +%End + + bool isValid() const; + int year() const; + int year(QCalendar cal) const; + int month() const; + int month(QCalendar cal) const; + int day() const; + int day(QCalendar cal) const; + int dayOfWeek() const; + int dayOfWeek(QCalendar cal) const; + int dayOfYear() const; + int dayOfYear(QCalendar cal) const; + int daysInMonth() const; + int daysInMonth(QCalendar cal) const; + int daysInYear() const; + int daysInYear(QCalendar cal) const; + int weekNumber(int *yearNumber = 0) const; + QString toString(Qt::DateFormat format = Qt::TextDate) const; + QDate addDays(qint64 days) const; + QDate addMonths(int months) const; + QDate addMonths(int months, QCalendar cal) const; + QDate addYears(int years) const; + QDate addYears(int years, QCalendar cal) const; + static QDate currentDate(); + static QDate fromString(const QString &string, Qt::DateFormat format = Qt::TextDate); + static bool isValid(int y, int m, int d); + static bool isLeapYear(int year); + static QDate fromJulianDay(qint64 jd); + qint64 toJulianDay() const; + bool setDate(int year, int month, int date); + void getDate(int *year, int *month, int *day) const; + QDateTime startOfDay(Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0) const; + QDateTime endOfDay(Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0) const; + QDateTime startOfDay(const QTimeZone &zone) const; + QDateTime endOfDay(const QTimeZone &zone) const; + bool setDate(int year, int month, int day, QCalendar cal); + QString toString(const QString &format, QCalendar cal = QCalendar()) const; + qint64 daysTo(QDate d) const; + static QDate fromString(const QString &string, const QString &format, QCalendar cal = QCalendar()); +}; + +class QTime /TypeHintIn="Union[QTime, datetime.time]"/ +{ +%TypeHeaderCode +#include +%End + +%TypeCode +#include +%End + +%ConvertToTypeCode +// Allow a Python time object whenever a QTime is expected. + +if (sipIsErr == NULL) + return (sipGetTime(sipPy, 0) || + sipCanConvertToType(sipPy, sipType_QTime, SIP_NO_CONVERTORS)); + +sipTimeDef py_time; + +if (sipGetTime(sipPy, &py_time)) +{ + *sipCppPtr = new QTime(py_time.pt_hour, + py_time.pt_minute, + py_time.pt_second, + py_time.pt_microsecond / 1000); + + return sipGetState(sipTransferObj); +} + +*sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, sipType_QTime, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + +return 0; +%End + +%PickleCode + sipRes = Py_BuildValue("iiii", sipCpp->hour(), sipCpp->minute(), sipCpp->second(), sipCpp->msec()); +%End + +public: + QTime(); + QTime(int h, int m, int second = 0, int msec = 0); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QTime()"); + } + else + { + sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QTime(%i, %i", sipCpp->hour(), + sipCpp->minute()); + + if (sipCpp->second() || sipCpp->msec()) + { + qpycore_Unicode_ConcatAndDel(&sipRes, + PyUnicode_FromFormat(", %i", sipCpp->second())); + + if (sipCpp->msec()) + qpycore_Unicode_ConcatAndDel(&sipRes, + PyUnicode_FromFormat(", %i", sipCpp->msec())); + } + + qpycore_Unicode_ConcatAndDel(&sipRes, PyUnicode_FromString(")")); + } +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(sipCpp->toString(Qt::ISODate)); +%End + + SIP_PYOBJECT toPyTime() const /TypeHint="datetime.time"/; +%MethodCode + // Convert to a Python time object. + sipTimeDef py_time; + + py_time.pt_hour = sipCpp->hour(); + py_time.pt_minute = sipCpp->minute(); + py_time.pt_second = sipCpp->second(); + py_time.pt_microsecond = sipCpp->msec() * 1000; + + sipRes = sipFromTime(&py_time); +%End + + bool isNull() const; + int __bool__() const; +%MethodCode + sipRes = !sipCpp->isNull(); +%End + + bool isValid() const; + int hour() const; + int minute() const; + int second() const; + int msec() const; + QString toString(Qt::DateFormat format = Qt::TextDate) const; + QString toString(const QString &format) const; + bool setHMS(int h, int m, int s, int msec = 0); + QTime addSecs(int secs) const; + QTime addMSecs(int ms) const; + static QTime currentTime(); + static QTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate); + static QTime fromString(const QString &s, const QString &format); + static bool isValid(int h, int m, int s, int msec = 0); + static QTime fromMSecsSinceStartOfDay(int msecs); + int msecsSinceStartOfDay() const; + int secsTo(QTime t) const; + int msecsTo(QTime t) const; +}; + +class QDateTime /TypeHintIn="Union[QDateTime, datetime.datetime]"/ +{ +%TypeHeaderCode +#include +%End + +%TypeCode +#include +%End + +%ConvertToTypeCode +// Allow a Python datetime object whenever a QDateTime is expected. + +if (sipIsErr == NULL) + return (sipGetDateTime(sipPy, 0, 0) || + sipCanConvertToType(sipPy, sipType_QDateTime, SIP_NO_CONVERTORS)); + +sipDateDef py_date; +sipTimeDef py_time; + +if (sipGetDateTime(sipPy, &py_date, &py_time)) +{ + QDate qdate(py_date.pd_year, + py_date.pd_month, + py_date.pd_day); + + QTime qtime(py_time.pt_hour, + py_time.pt_minute, + py_time.pt_second, + py_time.pt_microsecond / 1000); + + QDateTime *qdt = new QDateTime(qdate, qtime); + + *sipCppPtr = qdt; + + return sipGetState(sipTransferObj); +} + +*sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, sipType_QDateTime, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + +return 0; +%End + +%PickleCode + QDate qd = sipCpp->date(); + QTime qt = sipCpp->time(); + + sipRes = Py_BuildValue("iiiiiiii", qd.year(), qd.month(), qd.day(), + qt.hour(), qt.minute(), qt.second(), qt.msec(), + (int)sipCpp->timeSpec()); +%End + +public: + QDateTime(); + QDateTime(const QDateTime &other); + QDateTime(int year, int month, int day, int hour, int minute, int second = 0, int msec = 0, int timeSpec = 0) /NoDerived/; +%MethodCode + // This ctor is mainly supplied to allow pickling. + QDate qd(a0, a1, a2); + QTime qt(a3, a4, a5, a6); + + sipCpp = new QDateTime(qd, qt, (Qt::TimeSpec)a7); +%End + + QDateTime(QDate date, QTime time, Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0); + QDateTime(QDate date, QTime time, const QTimeZone &timeZone); + ~QDateTime(); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QDateTime()"); + } + else + { + QDate qd = sipCpp->date(); + QTime qt = sipCpp->time(); + + sipRes = PyUnicode_FromFormat( + "PyQt6.QtCore.QDateTime(%i, %i, %i, %i, %i", + qd.year(), qd.month(), qd.day(), qt.hour(), qt.minute()); + + if (qt.second() || qt.msec() || sipCpp->timeSpec() != Qt::LocalTime) + { + qpycore_Unicode_ConcatAndDel(&sipRes, + PyUnicode_FromFormat(", %i", qt.second())); + + if (qt.msec() || sipCpp->timeSpec() != Qt::LocalTime) + { + qpycore_Unicode_ConcatAndDel(&sipRes, + PyUnicode_FromFormat(", %i", qt.msec())); + + if (sipCpp->timeSpec() != Qt::LocalTime) + qpycore_Unicode_ConcatAndDel(&sipRes, + PyUnicode_FromFormat(", PyQt6.QtCore.Qt.TimeSpec(%i)", + (int)sipCpp->timeSpec())); + } + } + + qpycore_Unicode_ConcatAndDel(&sipRes, PyUnicode_FromString(")")); + } +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(sipCpp->toString(Qt::ISODate)); +%End + + SIP_PYOBJECT toPyDateTime() const /TypeHint="datetime.datetime"/; +%MethodCode + // Convert to a Python datetime object. + sipDateDef py_date; + QDate qd = sipCpp->date(); + + py_date.pd_year = qd.year(); + py_date.pd_month = qd.month(); + py_date.pd_day = qd.day(); + + sipTimeDef py_time; + QTime qt = sipCpp->time(); + + py_time.pt_hour = qt.hour(); + py_time.pt_minute = qt.minute(); + py_time.pt_second = qt.second(); + py_time.pt_microsecond = qt.msec() * 1000; + + sipRes = sipFromDateTime(&py_date, &py_time); +%End + + bool isNull() const; + int __bool__() const; +%MethodCode + sipRes = !sipCpp->isNull(); +%End + + bool isValid() const; + QDate date() const; + QTime time() const; + Qt::TimeSpec timeSpec() const; + void setTimeSpec(Qt::TimeSpec spec); + QString toString(Qt::DateFormat format = Qt::TextDate) const; + QDateTime addDays(qint64 days) const; + QDateTime addMonths(int months) const; + QDateTime addYears(int years) const; + QDateTime addSecs(qint64 secs) const; + QDateTime addMSecs(qint64 msecs) const; + QDateTime toTimeSpec(Qt::TimeSpec spec) const; + QDateTime toLocalTime() const; + QDateTime toUTC() const; + qint64 daysTo(const QDateTime &) const; + qint64 secsTo(const QDateTime &) const; + static QDateTime currentDateTime(); +%If (Qt_6_5_0 -) + static QDateTime currentDateTime(const QTimeZone &zone); +%End + static QDateTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate); + qint64 toMSecsSinceEpoch() const; + void setMSecsSinceEpoch(qint64 msecs); + qint64 msecsTo(const QDateTime &) const; + static QDateTime currentDateTimeUtc(); + static qint64 currentMSecsSinceEpoch(); + void swap(QDateTime &other /Constrained/); + int offsetFromUtc() const; + QTimeZone timeZone() const; + QString timeZoneAbbreviation() const; + bool isDaylightTime() const; + void setOffsetFromUtc(int offsetSeconds); + void setTimeZone(const QTimeZone &toZone); + QDateTime toOffsetFromUtc(int offsetSeconds) const; + QDateTime toTimeZone(const QTimeZone &toZone) const; + static QDateTime fromMSecsSinceEpoch(qint64 msecs, const QTimeZone &timeZone); + static QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0); + qint64 toSecsSinceEpoch() const; + void setSecsSinceEpoch(qint64 secs); + static QDateTime fromSecsSinceEpoch(qint64 secs, Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0); + static QDateTime fromSecsSinceEpoch(qint64 secs, const QTimeZone &timeZone); + static qint64 currentSecsSinceEpoch(); + + enum class YearRange + { + First, + Last, + }; + + void setDate(QDate date); + void setTime(QTime time); + QString toString(const QString &format, QCalendar cal = QCalendar()) const; + static QDateTime fromString(const QString &string, const QString &format, QCalendar cal = QCalendar()); +%If (Qt_6_5_0 -) + QTimeZone timeRepresentation() const; +%End +}; + +QDataStream &operator<<(QDataStream &, QDate) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QDate & /Constrained/) /ReleaseGIL/; +QDataStream &operator<<(QDataStream &, QTime) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QTime & /Constrained/) /ReleaseGIL/; +QDataStream &operator<<(QDataStream &, const QDateTime &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QDateTime & /Constrained/) /ReleaseGIL/; +bool operator==(const QDateTime &lhs, const QDateTime &rhs); +bool operator==(QTime lhs, QTime rhs); +bool operator==(QDate lhs, QDate rhs); +bool operator!=(const QDateTime &lhs, const QDateTime &rhs); +bool operator!=(QTime lhs, QTime rhs); +bool operator!=(QDate lhs, QDate rhs); +bool operator<(const QDateTime &lhs, const QDateTime &rhs); +bool operator<(QTime lhs, QTime rhs); +bool operator<(QDate lhs, QDate rhs); +bool operator<=(const QDateTime &lhs, const QDateTime &rhs); +bool operator<=(QTime lhs, QTime rhs); +bool operator<=(QDate lhs, QDate rhs); +bool operator>(const QDateTime &lhs, const QDateTime &rhs); +bool operator>(QTime lhs, QTime rhs); +bool operator>(QDate lhs, QDate rhs); +bool operator>=(const QDateTime &lhs, const QDateTime &rhs); +bool operator>=(QTime lhs, QTime rhs); +bool operator>=(QDate lhs, QDate rhs); diff --git a/sip/QtCore/qdeadlinetimer.sip b/sip/QtCore/qdeadlinetimer.sip new file mode 100644 index 0000000..98b67f2 --- /dev/null +++ b/sip/QtCore/qdeadlinetimer.sip @@ -0,0 +1,66 @@ +// qdeadlinetimer.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDeadlineTimer +{ +%TypeHeaderCode +#include +%End + +public: + enum ForeverConstant + { + Forever, + }; + + QDeadlineTimer(Qt::TimerType type = Qt::CoarseTimer); + QDeadlineTimer(QDeadlineTimer::ForeverConstant, Qt::TimerType type = Qt::CoarseTimer); + QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer); + void swap(QDeadlineTimer &other /Constrained/); + bool isForever() const; + bool hasExpired() const; + Qt::TimerType timerType() const; + void setTimerType(Qt::TimerType type); + qint64 remainingTime() const; + qint64 remainingTimeNSecs() const; + void setRemainingTime(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer); + void setPreciseRemainingTime(qint64 secs, qint64 nsecs = 0, Qt::TimerType type = Qt::CoarseTimer); + qint64 deadline() const; + qint64 deadlineNSecs() const; + void setDeadline(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer); + void setPreciseDeadline(qint64 secs, qint64 nsecs = 0, Qt::TimerType type = Qt::CoarseTimer); + static QDeadlineTimer addNSecs(QDeadlineTimer dt, qint64 nsecs); + static QDeadlineTimer current(Qt::TimerType type = Qt::CoarseTimer); + QDeadlineTimer &operator+=(qint64 msecs); + QDeadlineTimer &operator-=(qint64 msecs); +}; + +bool operator==(QDeadlineTimer d1, QDeadlineTimer d2); +bool operator!=(QDeadlineTimer d1, QDeadlineTimer d2); +bool operator<(QDeadlineTimer d1, QDeadlineTimer d2); +bool operator<=(QDeadlineTimer d1, QDeadlineTimer d2); +bool operator>(QDeadlineTimer d1, QDeadlineTimer d2); +bool operator>=(QDeadlineTimer d1, QDeadlineTimer d2); +QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs); +QDeadlineTimer operator+(qint64 msecs, QDeadlineTimer dt); +QDeadlineTimer operator-(QDeadlineTimer dt, qint64 msecs); +qint64 operator-(QDeadlineTimer dt1, QDeadlineTimer dt2); diff --git a/sip/QtCore/qdir.sip b/sip/QtCore/qdir.sip new file mode 100644 index 0000000..d07ba97 --- /dev/null +++ b/sip/QtCore/qdir.sip @@ -0,0 +1,201 @@ +// qdir.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDir +{ +%TypeHeaderCode +#include +%End + +public: + enum Filter /BaseType=Flag/ + { + Dirs, + Files, + Drives, + NoSymLinks, + AllEntries, + TypeMask, + Readable, + Writable, + Executable, + PermissionMask, + Modified, + Hidden, + System, + AccessMask, + AllDirs, + CaseSensitive, + NoDotAndDotDot, + NoFilter, + NoDot, + NoDotDot, + }; + + typedef QFlags Filters; + + enum SortFlag /BaseType=Flag/ + { + Name, + Time, + Size, + Unsorted, + SortByMask, + DirsFirst, + Reversed, + IgnoreCase, + DirsLast, + LocaleAware, + Type, + NoSort, + }; + + typedef QFlags SortFlags; + QDir(const QString &path, const QString &nameFilter, QDir::SortFlags sort = QDir::SortFlags(QDir::Name | QDir::IgnoreCase), QDir::Filters filters = QDir::AllEntries); + QDir(const QDir &); + QDir(const QString &path = QString()); + ~QDir(); + void setPath(const QString &path); + QString path() const; + QString absolutePath() const; + QString canonicalPath() const; + QString dirName() const; + QString filePath(const QString &fileName) const; + QString absoluteFilePath(const QString &fileName) const; + QString relativeFilePath(const QString &fileName) const; + bool cd(const QString &dirName); + bool cdUp(); + QStringList nameFilters() const; + void setNameFilters(const QStringList &nameFilters); + QDir::Filters filter() const; + void setFilter(QDir::Filters filter); + QDir::SortFlags sorting() const; + void setSorting(QDir::SortFlags sort); +%If (Qt_6_5_0 -) + qsizetype count() const /__len__/; +%MethodCode + sipRes = sipCpp->count(Qt::Disambiguated); +%End + +%End +%If (- Qt_6_5_0) + uint count() const /__len__/; +%End +%If (Qt_6_5_0 -) + QString operator[](qsizetype) const; +%MethodCode + Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); + + if (idx < 0) + sipIsErr = 1; + else + sipRes = new QString(sipCpp->operator[]((qsizetype)idx)); +%End + +%End +%If (- Qt_6_5_0) + QString operator[](int) const; +%MethodCode + Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); + + if (idx < 0) + sipIsErr = 1; + else + sipRes = new QString(sipCpp->operator[]((int)idx)); +%End + +%End + QStringList operator[](SIP_PYSLICE) const; +%MethodCode + Py_ssize_t start, stop, step, slicelength; + + if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) + { + sipIsErr = 1; + } + else + { + sipRes = new QStringList(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + (*sipRes) += (*sipCpp)[start]; + start += step; + } + } +%End + + int __contains__(const QString &) const; +%MethodCode + sipRes = bool(sipCpp->entryList().contains(*a0)); +%End + + static QStringList nameFiltersFromString(const QString &nameFilter); + QStringList entryList(QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const; + QStringList entryList(const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const; + QFileInfoList entryInfoList(QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const; + QFileInfoList entryInfoList(const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const; +%If (Qt_6_3_0 -) + bool mkdir(const QString &dirName, QFileDevice::Permissions permissions) const; +%End + bool mkdir(const QString &dirName) const; + bool rmdir(const QString &dirName) const; + bool mkpath(const QString &dirPath) const; + bool rmpath(const QString &dirPath) const; + bool isReadable() const; + bool exists() const; + bool isRoot() const; + static bool isRelativePath(const QString &path); + static bool isAbsolutePath(const QString &path); + bool isRelative() const; + bool isAbsolute() const; + bool makeAbsolute(); + bool operator==(const QDir &dir) const; + bool operator!=(const QDir &dir) const; + bool remove(const QString &fileName); + bool rename(const QString &oldName, const QString &newName); + bool exists(const QString &name) const; + void refresh() const; + static QFileInfoList drives(); + static QChar separator(); + static bool setCurrent(const QString &path); + static QDir current(); + static QString currentPath(); + static QDir home(); + static QString homePath(); + static QDir root(); + static QString rootPath(); + static QDir temp(); + static QString tempPath(); + static bool match(const QStringList &filters, const QString &fileName); + static bool match(const QString &filter, const QString &fileName); + static QString cleanPath(const QString &path); + static QString toNativeSeparators(const QString &pathName); + static QString fromNativeSeparators(const QString &pathName); + static void setSearchPaths(const QString &prefix, const QStringList &searchPaths); + static void addSearchPath(const QString &prefix, const QString &path); + static QStringList searchPaths(const QString &prefix); + bool removeRecursively(); + void swap(QDir &other /Constrained/); + static QChar listSeparator(); + bool isEmpty(QDir::Filters filters = QDir::Filters(QDir::AllEntries | QDir::NoDotAndDotDot)) const; +}; diff --git a/sip/QtCore/qdiriterator.sip b/sip/QtCore/qdiriterator.sip new file mode 100644 index 0000000..b29150b --- /dev/null +++ b/sip/QtCore/qdiriterator.sip @@ -0,0 +1,55 @@ +// qdiriterator.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDirIterator +{ +%TypeHeaderCode +#include +%End + +public: + enum IteratorFlag /BaseType=Flag/ + { + NoIteratorFlags, + FollowSymlinks, + Subdirectories, + }; + + typedef QFlags IteratorFlags; + QDirIterator(const QDir &dir, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags); + QDirIterator(const QString &path, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags); + QDirIterator(const QString &path, QDir::Filters filter, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags); + QDirIterator(const QString &path, const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags); + ~QDirIterator(); + QString next(); +%If (Qt_6_3_0 -) + QFileInfo nextFileInfo(); +%End + bool hasNext() const; + QString fileName() const; + QString filePath() const; + QFileInfo fileInfo() const; + QString path() const; + +private: + QDirIterator(const QDirIterator &); +}; diff --git a/sip/QtCore/qeasingcurve.sip b/sip/QtCore/qeasingcurve.sip new file mode 100644 index 0000000..b605ac4 --- /dev/null +++ b/sip/QtCore/qeasingcurve.sip @@ -0,0 +1,288 @@ +// qeasingcurve.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QEasingCurve /TypeHintIn="Union[QEasingCurve, QEasingCurve.Type]"/ +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// The EasingFunction callback doesn't provide a context so we support a fixed +// number of different functions. + +const int ec_nr_custom_types = 10; + +struct ec_custom_type { + PyObject *py_func; + QEasingCurve::EasingFunction func; +}; + +static qreal ec_call(int ec, qreal v); + +static qreal ec_func_0(qreal v) +{ + return ec_call(0, v); +} + +static qreal ec_func_1(qreal v) +{ + return ec_call(1, v); +} + +static qreal ec_func_2(qreal v) +{ + return ec_call(2, v); +} + +static qreal ec_func_3(qreal v) +{ + return ec_call(3, v); +} + +static qreal ec_func_4(qreal v) +{ + return ec_call(4, v); +} + +static qreal ec_func_5(qreal v) +{ + return ec_call(5, v); +} + +static qreal ec_func_6(qreal v) +{ + return ec_call(6, v); +} + +static qreal ec_func_7(qreal v) +{ + return ec_call(7, v); +} + +static qreal ec_func_8(qreal v) +{ + return ec_call(8, v); +} + +static qreal ec_func_9(qreal v) +{ + return ec_call(9, v); +} + +static ec_custom_type ec_custom_types[ec_nr_custom_types] = { + {0, ec_func_0}, + {0, ec_func_1}, + {0, ec_func_2}, + {0, ec_func_3}, + {0, ec_func_4}, + {0, ec_func_5}, + {0, ec_func_6}, + {0, ec_func_7}, + {0, ec_func_8}, + {0, ec_func_9}, +}; + +static qreal ec_call(int ec, qreal v) +{ + PyObject *res_obj; + qreal res = 0.0; + + SIP_BLOCK_THREADS + + res_obj = PyObject_CallFunction(ec_custom_types[ec].py_func, (char *)"(d)", (double)v); + + if (res_obj) + { + PyErr_Clear(); + + res = PyFloat_AsDouble(res_obj); + Py_DECREF(res_obj); + + if (PyErr_Occurred()) + res_obj = 0; + } + + if (!res_obj) + pyqt6_err_print(); + + SIP_UNBLOCK_THREADS + + return res; +} +%End + +%ConvertToTypeCode +// Allow a QEasingCurve::Type whenever a QEasingCurve is expected. + +bool is_ec_type = true; +int ec_type = sipConvertToEnum(sipPy, sipType_QEasingCurve_Type); + +if (PyErr_Occurred()) +{ + PyErr_Clear(); + is_ec_type = false; +} + +if (sipIsErr == NULL) + return (is_ec_type || + sipCanConvertToType(sipPy, sipType_QEasingCurve, SIP_NO_CONVERTORS)); + +if (is_ec_type) +{ + *sipCppPtr = new QEasingCurve(static_cast(ec_type)); + + return sipGetState(sipTransferObj); +} + +*sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, + sipType_QEasingCurve, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + +return 0; +%End + +public: + enum Type + { + Linear, + InQuad, + OutQuad, + InOutQuad, + OutInQuad, + InCubic, + OutCubic, + InOutCubic, + OutInCubic, + InQuart, + OutQuart, + InOutQuart, + OutInQuart, + InQuint, + OutQuint, + InOutQuint, + OutInQuint, + InSine, + OutSine, + InOutSine, + OutInSine, + InExpo, + OutExpo, + InOutExpo, + OutInExpo, + InCirc, + OutCirc, + InOutCirc, + OutInCirc, + InElastic, + OutElastic, + InOutElastic, + OutInElastic, + InBack, + OutBack, + InOutBack, + OutInBack, + InBounce, + OutBounce, + InOutBounce, + OutInBounce, + InCurve, + OutCurve, + SineCurve, + CosineCurve, + BezierSpline, + TCBSpline, + Custom, + }; + + QEasingCurve(QEasingCurve::Type type = QEasingCurve::Linear); + QEasingCurve(const QEasingCurve &other); + ~QEasingCurve(); + bool operator==(const QEasingCurve &other) const; + bool operator!=(const QEasingCurve &other) const; + qreal amplitude() const; + void setAmplitude(qreal amplitude); + qreal period() const; + void setPeriod(qreal period); + qreal overshoot() const; + void setOvershoot(qreal overshoot); + QEasingCurve::Type type() const; + void setType(QEasingCurve::Type type); + void setCustomType(SIP_PYCALLABLE func /TypeHint="Callable[[float], float]"/); +%MethodCode + int i; + ec_custom_type *ct; + + for (i = 0; i < ec_nr_custom_types; ++i) + { + ct = &ec_custom_types[i]; + + if (!ct->py_func || ct->py_func == a0) + break; + } + + if (i == ec_nr_custom_types) + { + PyErr_Format(PyExc_ValueError, "a maximum of %d different easing functions are supported", ec_nr_custom_types); + sipError = sipErrorFail; + } + else + { + if (!ct->py_func) + { + ct->py_func = a0; + Py_INCREF(a0); + } + + sipCpp->setCustomType(ct->func); + } +%End + + SIP_PYCALLABLE customType() const /TypeHint="Callable[[float], float]"/; +%MethodCode + QEasingCurve::EasingFunction func = sipCpp->customType(); + + sipRes = Py_None; + + if (func) + { + for (int i = 0; i < ec_nr_custom_types; ++i) + { + if (ec_custom_types[i].func == func) + { + sipRes = ec_custom_types[i].py_func; + break; + } + } + } + + Py_INCREF(sipRes); +%End + + qreal valueForProgress(qreal progress) const; + void swap(QEasingCurve &other /Constrained/); + void addCubicBezierSegment(const QPointF &c1, const QPointF &c2, const QPointF &endPoint); + void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b); + QList toCubicSpline() const; +}; + +QDataStream &operator<<(QDataStream &, const QEasingCurve & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QEasingCurve & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtCore/qelapsedtimer.sip b/sip/QtCore/qelapsedtimer.sip new file mode 100644 index 0000000..f4bc9be --- /dev/null +++ b/sip/QtCore/qelapsedtimer.sip @@ -0,0 +1,57 @@ +// qelapsedtimer.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QElapsedTimer +{ +%TypeHeaderCode +#include +%End + +public: + QElapsedTimer(); + + enum ClockType + { + SystemTime, + MonotonicClock, + TickCounter, + MachAbsoluteTime, + PerformanceCounter, + }; + + static QElapsedTimer::ClockType clockType(); + static bool isMonotonic(); + void start(); + qint64 restart(); + void invalidate(); + bool isValid() const; + qint64 elapsed() const; + bool hasExpired(qint64 timeout) const; + qint64 msecsSinceReference() const; + qint64 msecsTo(const QElapsedTimer &other) const; + qint64 secsTo(const QElapsedTimer &other) const; + qint64 nsecsElapsed() const; +}; + +bool operator<(const QElapsedTimer &v1, const QElapsedTimer &v2); +bool operator==(const QElapsedTimer &lhs, const QElapsedTimer &rhs); +bool operator!=(const QElapsedTimer &lhs, const QElapsedTimer &rhs); diff --git a/sip/QtCore/qeventloop.sip b/sip/QtCore/qeventloop.sip new file mode 100644 index 0000000..c3ba2bf --- /dev/null +++ b/sip/QtCore/qeventloop.sip @@ -0,0 +1,70 @@ +// qeventloop.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QEventLoop : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QEventLoop(QObject *parent /TransferThis/ = 0); + virtual ~QEventLoop(); + + enum ProcessEventsFlag /BaseType=Flag/ + { + AllEvents, + ExcludeUserInputEvents, + ExcludeSocketNotifiers, + WaitForMoreEvents, + }; + + typedef QFlags ProcessEventsFlags; + bool processEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) /ReleaseGIL/; + void processEvents(QEventLoop::ProcessEventsFlags flags, int maximumTime) /ReleaseGIL/; + int exec(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; + void exit(int returnCode = 0); + bool isRunning() const; + void wakeUp(); + +public slots: + void quit(); + +public: + virtual bool event(QEvent *event); +}; + +class QEventLoopLocker +{ +%TypeHeaderCode +#include +%End + +public: + QEventLoopLocker() /ReleaseGIL/; + explicit QEventLoopLocker(QEventLoop *loop) /ReleaseGIL/; + explicit QEventLoopLocker(QThread *thread) /ReleaseGIL/; + ~QEventLoopLocker(); + +private: + QEventLoopLocker(const QEventLoopLocker &); +}; diff --git a/sip/QtCore/qfile.sip b/sip/QtCore/qfile.sip new file mode 100644 index 0000000..aa16a67 --- /dev/null +++ b/sip/QtCore/qfile.sip @@ -0,0 +1,66 @@ +// qfile.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFile : QFileDevice +{ +%TypeHeaderCode +#include +%End + +public: + QFile(); + QFile(const QString &name); + explicit QFile(QObject *parent /TransferThis/); + QFile(const QString &name, QObject *parent /TransferThis/); + virtual ~QFile(); + virtual QString fileName() const; + void setFileName(const QString &name); + static QByteArray encodeName(const QString &fileName); + static QString decodeName(const QByteArray &localFileName); + static QString decodeName(const char *localFileName /Encoding="ASCII"/); + bool exists() const; + static bool exists(const QString &fileName); + QString symLinkTarget() const; + static QString symLinkTarget(const QString &fileName); + bool remove() /ReleaseGIL/; + static bool remove(const QString &fileName) /ReleaseGIL/; + bool rename(const QString &newName) /ReleaseGIL/; + static bool rename(const QString &oldName, const QString &newName) /ReleaseGIL/; + bool link(const QString &newName) /ReleaseGIL/; + static bool link(const QString &oldname, const QString &newName) /ReleaseGIL/; + bool copy(const QString &newName) /ReleaseGIL/; + static bool copy(const QString &fileName, const QString &newName) /ReleaseGIL/; +%If (Qt_6_3_0 -) + bool open(QIODeviceBase::OpenMode flags, QFileDevice::Permissions permissions) /ReleaseGIL/; +%End + virtual bool open(QIODeviceBase::OpenMode flags) /ReleaseGIL/; + bool open(int fd, QIODeviceBase::OpenMode ioFlags, QFileDevice::FileHandleFlags handleFlags = QFileDevice::DontCloseHandle) /ReleaseGIL/; + virtual qint64 size() const; + virtual bool resize(qint64 sz); + static bool resize(const QString &filename, qint64 sz); + virtual QFileDevice::Permissions permissions() const; + static QFileDevice::Permissions permissions(const QString &filename); + virtual bool setPermissions(QFileDevice::Permissions permissionSpec); + static bool setPermissions(const QString &filename, QFileDevice::Permissions permissionSpec); + bool moveToTrash(); + static bool moveToTrash(const QString &fileName, QString *pathInTrash /Out/ = 0); +}; diff --git a/sip/QtCore/qfiledevice.sip b/sip/QtCore/qfiledevice.sip new file mode 100644 index 0000000..6114da1 --- /dev/null +++ b/sip/QtCore/qfiledevice.sip @@ -0,0 +1,213 @@ +// qfiledevice.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFileDevice : QIODevice /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum FileError + { + NoError, + ReadError, + WriteError, + FatalError, + ResourceError, + OpenError, + AbortError, + TimeOutError, + UnspecifiedError, + RemoveError, + RenameError, + PositionError, + ResizeError, + PermissionsError, + CopyError, + }; + + enum Permission /BaseType=Flag/ + { + ReadOwner, + WriteOwner, + ExeOwner, + ReadUser, + WriteUser, + ExeUser, + ReadGroup, + WriteGroup, + ExeGroup, + ReadOther, + WriteOther, + ExeOther, + }; + + typedef QFlags Permissions; + + enum FileHandleFlag /BaseType=Flag/ + { + AutoCloseHandle, + DontCloseHandle, + }; + + typedef QFlags FileHandleFlags; + virtual ~QFileDevice(); + QFileDevice::FileError error() const; + void unsetError(); + virtual void close() /ReleaseGIL/; + virtual bool isSequential() const; + int handle() const; + virtual QString fileName() const; + virtual qint64 pos() const; + virtual bool seek(qint64 offset) /ReleaseGIL/; + virtual bool atEnd() const; + bool flush() /ReleaseGIL/; + virtual qint64 size() const; + virtual bool resize(qint64 sz); + virtual QFileDevice::Permissions permissions() const; + virtual bool setPermissions(QFileDevice::Permissions permissionSpec); + void *map(qint64 offset, qint64 size /ResultSize/, QFileDevice::MemoryMapFlags flags = QFileDevice::NoOptions) [uchar * (qint64 offset, qint64 size, QFileDevice::MemoryMapFlags flags = QFileDevice::NoOptions)]; + bool unmap(void *address) [bool (uchar *address)]; + +protected: + virtual SIP_PYOBJECT readData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QFileDevice::readData(s, a0) : sipCpp->readData(s, a0); + #else + len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual SIP_PYOBJECT readLineData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QFileDevice::readLineData(s, a0) : sipCpp->readLineData(s, a0); + #else + len = sipCpp->sipProtectVirt_readLineData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)]; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipSelfWasArg ? + sipCpp->QFileDevice::writeData(reinterpret_cast(bi.bi_buf), bi.bi_len) : + sipCpp->writeData(reinterpret_cast(bi.bi_buf), bi.bi_len); + #else + sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast(bi.bi_buf), + bi.bi_len); + #endif + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + +public: + enum FileTime + { + FileAccessTime, + FileBirthTime, + FileMetadataChangeTime, + FileModificationTime, + }; + + QDateTime fileTime(QFileDevice::FileTime time) const; + bool setFileTime(const QDateTime &newDate, QFileDevice::FileTime fileTime); + + enum MemoryMapFlag /BaseType=Flag/ + { + NoOptions, + MapPrivateOption, + }; + + typedef QFlags MemoryMapFlags; +}; diff --git a/sip/QtCore/qfileinfo.sip b/sip/QtCore/qfileinfo.sip new file mode 100644 index 0000000..1982851 --- /dev/null +++ b/sip/QtCore/qfileinfo.sip @@ -0,0 +1,104 @@ +// qfileinfo.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFileInfo +{ +%TypeHeaderCode +#include +%End + +public: + QFileInfo(); + explicit QFileInfo(const QFileDevice &file); + explicit QFileInfo(const QString &file); + QFileInfo(const QDir &dir, const QString &file); + QFileInfo(const QFileInfo &fileinfo); + ~QFileInfo(); + bool operator==(const QFileInfo &fileinfo) const; + bool operator!=(const QFileInfo &fileinfo) const; + void setFile(const QString &file); + void setFile(const QFileDevice &file); + void setFile(const QDir &dir, const QString &file); + bool exists() const; + void refresh(); + QString filePath() const; + SIP_PYOBJECT __fspath__(); +%MethodCode + sipRes = qpycore_PyObject_FromQString(QDir::toNativeSeparators(sipCpp->filePath())); +%End + + QString absoluteFilePath() const; + QString canonicalFilePath() const; + QString fileName() const; + QString baseName() const; + QString completeBaseName() const; + QString suffix() const; + QString completeSuffix() const; + QString path() const; + QString absolutePath() const; + QString canonicalPath() const; + QDir dir() const; + QDir absoluteDir() const; + bool isReadable() const; + bool isWritable() const; + bool isExecutable() const; + bool isHidden() const; + bool isRelative() const; + bool isAbsolute() const; + bool makeAbsolute(); + bool isFile() const; + bool isDir() const; + bool isSymLink() const; + bool isRoot() const; + QString owner() const; + uint ownerId() const; + QString group() const; + uint groupId() const; + bool permission(QFileDevice::Permissions permissions) const; + QFileDevice::Permissions permissions() const; + qint64 size() const; + QDateTime lastModified() const; + QDateTime lastRead() const; + bool caching() const; + void setCaching(bool on); + QString symLinkTarget() const; + QString bundleName() const; + bool isBundle() const; + bool isNativePath() const; + void swap(QFileInfo &other /Constrained/); + static bool exists(const QString &file); + QDateTime birthTime() const; + QDateTime metadataChangeTime() const; + QDateTime fileTime(QFileDevice::FileTime time) const; + bool isSymbolicLink() const; + bool isShortcut() const; + bool isJunction() const; + void stat(); +%If (Qt_6_2_0 -) + QString junctionTarget() const; +%End +%If (Qt_6_4_0 -) + bool isAlias() const; +%End +}; + +typedef QList QFileInfoList; diff --git a/sip/QtCore/qfileselector.sip b/sip/QtCore/qfileselector.sip new file mode 100644 index 0000000..7089b0a --- /dev/null +++ b/sip/QtCore/qfileselector.sip @@ -0,0 +1,37 @@ +// qfileselector.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFileSelector : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QFileSelector(QObject *parent /TransferThis/ = 0); + virtual ~QFileSelector(); + QString select(const QString &filePath) const; + QUrl select(const QUrl &filePath) const; + QStringList extraSelectors() const; + void setExtraSelectors(const QStringList &list); + QStringList allSelectors() const; +}; diff --git a/sip/QtCore/qfilesystemwatcher.sip b/sip/QtCore/qfilesystemwatcher.sip new file mode 100644 index 0000000..ef8413f --- /dev/null +++ b/sip/QtCore/qfilesystemwatcher.sip @@ -0,0 +1,43 @@ +// qfilesystemwatcher.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFileSystemWatcher : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QFileSystemWatcher(QObject *parent /TransferThis/ = 0); + QFileSystemWatcher(const QStringList &paths, QObject *parent /TransferThis/ = 0); + virtual ~QFileSystemWatcher(); + bool addPath(const QString &file); + QStringList addPaths(const QStringList &files); + QStringList directories() const; + QStringList files() const; + bool removePath(const QString &file); + QStringList removePaths(const QStringList &files); + +signals: + void directoryChanged(const QString &path); + void fileChanged(const QString &path); +}; diff --git a/sip/QtCore/qflags.sip b/sip/QtCore/qflags.sip new file mode 100644 index 0000000..d9718f2 --- /dev/null +++ b/sip/QtCore/qflags.sip @@ -0,0 +1,49 @@ +// This is the SIP interface definition for the QFlags based mapped types. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +template +%MappedType QFlags /PyQtFlags=1, TypeHint="ENUM"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +bool is_enm = true; +unsigned enm = (unsigned)sipConvertToEnum(sipPy, sipType_ENUM); + +if (PyErr_Occurred()) +{ + PyErr_Clear(); + is_enm = false; +} + +if (sipIsErr == NULL) + return is_enm; + +*sipCppPtr = new QFlags(static_cast(enm)); + +return sipGetState(sipTransferObj); +%End + +%ConvertFromTypeCode +return sipConvertFromEnum(sipCpp->operator::QFlags::Int(), sipType_ENUM); +%End +}; diff --git a/sip/QtCore/qglobal.sip b/sip/QtCore/qglobal.sip new file mode 100644 index 0000000..d04e6d8 --- /dev/null +++ b/sip/QtCore/qglobal.sip @@ -0,0 +1,198 @@ +// qglobal.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +const int QT_VERSION; +const char *QT_VERSION_STR; +%If (- Qt_6_5_0) +const char *qVersion(); +%End +%If (- Qt_6_5_0) +typedef signed char qint8 /PyInt/; +%End +%If (- Qt_6_5_0) +typedef unsigned char quint8 /PyInt/; +%End +%If (- Qt_6_5_0) +typedef short qint16; +%End +%If (- Qt_6_5_0) +typedef unsigned short quint16; +%End +%If (- Qt_6_5_0) +typedef int qint32; +%End +%If (- Qt_6_5_0) +typedef unsigned int quint32; +%End +%If (- Qt_6_5_0) +typedef long long qint64; +%End +%If (- Qt_6_5_0) +typedef unsigned long long quint64; +%End +%If (- Qt_6_5_0) +typedef qint64 qlonglong; +%End +%If (- Qt_6_5_0) +typedef quint64 qulonglong; +%End +%If (- Qt_6_5_0) +%If (PyQt_qreal_double) +typedef double qreal; +%End +%End +%If (- Qt_6_5_0) +%If (!PyQt_qreal_double) +typedef float qreal; +%End +%End +%If (- Qt_6_5_0) +typedef unsigned char uchar; +%End +%If (- Qt_6_5_0) +typedef unsigned short ushort; +%End +%If (- Qt_6_5_0) +typedef unsigned int uint; +%End +%If (- Qt_6_5_0) +typedef unsigned long ulong; +%End +%If (- Qt_6_5_0) +typedef long long qsizetype; +%End +%If (- Qt_6_5_0) +double qAbs(const double &t); +%End +%If (- Qt_6_5_0) +int qRound(qreal d); +%End +%If (- Qt_6_5_0) +qint64 qRound64(qreal d); +%End +%If (- Qt_6_5_0) +bool qFuzzyCompare(double p1, double p2); +%End +typedef void *QFunctionPointer; +// Minimal support for the Qt resource system to help porting from PyQt5. +%ModuleCode +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 +%End + +bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); +bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); +// Mapped type for qintptr. +// Map qintptr onto sip.voidptr. This means either an address (on Windows) or +// an integer file descriptor (on everything else) can be used. +%MappedType qintptr /TypeHint="PyQt6.sip.voidptr"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode + qintptr ptr = (qintptr)sipConvertToVoidPtr(sipPy); + + if (!sipIsErr) + return !PyErr_Occurred(); + + // Mapped types deal with pointers, so create one on the heap. + qintptr *heap = new qintptr; + *heap = ptr; + + *sipCppPtr = heap; + + // Make sure the pointer doesn't leak. + return SIP_TEMPORARY; +%End + +%ConvertFromTypeCode + return sipConvertFromVoidPtr((void *)*sipCpp); +%End +}; +// Mapped type for quintptr. +// Map quintptr onto sip.voidptr. This means either an address (on Windows) or +// an integer file descriptor (on everything else) can be used. +%MappedType quintptr /TypeHint="PyQt6.sip.voidptr"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode + quintptr ptr = (quintptr)sipConvertToVoidPtr(sipPy); + + if (!sipIsErr) + return !PyErr_Occurred(); + + // Mapped types deal with pointers, so create one on the heap. + quintptr *heap = new quintptr; + *heap = ptr; + + *sipCppPtr = heap; + + // Make sure the pointer doesn't leak. + return SIP_TEMPORARY; +%End + +%ConvertFromTypeCode + return sipConvertFromVoidPtr((void *)*sipCpp); +%End +}; +// Implementations of pyqt[Set]PickleProtocol(). +void pyqtSetPickleProtocol(SIP_PYOBJECT /TypeHint="Optional[int]"/); +%MethodCode + Py_XDECREF(qpycore_pickle_protocol); + qpycore_pickle_protocol = a0; + Py_INCREF(qpycore_pickle_protocol); +%End + +SIP_PYOBJECT pyqtPickleProtocol() /TypeHint="Optional[int]"/; +%MethodCode + sipRes = qpycore_pickle_protocol; + if (!sipRes) + sipRes = Py_None; + + Py_INCREF(sipRes); +%End +%If (- Qt_6_5_0) +bool qEnvironmentVariableIsEmpty(const char *varName); +%End +%If (- Qt_6_5_0) +bool qEnvironmentVariableIsSet(const char *varName); +%End +%If (- Qt_6_5_0) +QString qEnvironmentVariable(const char *varName); +%End +%If (- Qt_6_5_0) +QString qEnvironmentVariable(const char *varName, const QString &defaultValue); +%End +%If (- Qt_6_5_0) +int qEnvironmentVariableIntValue(const char *varName, bool *ok = 0); +%End diff --git a/sip/QtCore/qidentityproxymodel.sip b/sip/QtCore/qidentityproxymodel.sip new file mode 100644 index 0000000..e6e9e6b --- /dev/null +++ b/sip/QtCore/qidentityproxymodel.sip @@ -0,0 +1,51 @@ +// qidentityproxymodel.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QIdentityProxyModel : QAbstractProxyModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QIdentityProxyModel(QObject *parent /TransferThis/ = 0); + virtual ~QIdentityProxyModel(); + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; + virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const; + virtual QModelIndex parent(const QModelIndex &child) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const; + virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const; + virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const; + virtual void setSourceModel(QAbstractItemModel *sourceModel /KeepReference/); + virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const; + virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild); + virtual bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild); +}; diff --git a/sip/QtCore/qiodevice.sip b/sip/QtCore/qiodevice.sip new file mode 100644 index 0000000..2b9c430 --- /dev/null +++ b/sip/QtCore/qiodevice.sip @@ -0,0 +1,429 @@ +// qiodevice.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QIODevice : QObject, QIODeviceBase +{ +%TypeHeaderCode +#include +%End + +public: + QIODevice(); + explicit QIODevice(QObject *parent /TransferThis/); + virtual ~QIODevice(); + QIODeviceBase::OpenMode openMode() const; + void setTextModeEnabled(bool enabled); + bool isTextModeEnabled() const; + bool isOpen() const; + bool isReadable() const; + bool isWritable() const; + virtual bool isSequential() const; + int readChannelCount() const; + int writeChannelCount() const; + int currentReadChannel() const; + void setCurrentReadChannel(int channel); + int currentWriteChannel() const; + void setCurrentWriteChannel(int channel); + virtual bool open(QIODeviceBase::OpenMode mode) /ReleaseGIL/; + virtual void close() /ReleaseGIL/; + virtual qint64 pos() const; + virtual qint64 size() const; + virtual bool seek(qint64 pos) /ReleaseGIL/; + virtual bool atEnd() const; + virtual bool reset(); + virtual qint64 bytesAvailable() const; + virtual qint64 bytesToWrite() const; + SIP_PYOBJECT read(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + len = sipCpp->read(s, a0); + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + SIP_PYOBJECT readLine(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/; +%MethodCode + // Return a bytes object or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + len = sipCpp->readLine(s, a0); + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + QByteArray readLine() /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipRes = new QByteArray(sipCpp->readLine()); + Py_END_ALLOW_THREADS +%End + + QByteArray readAll() /ReleaseGIL/; + virtual bool canReadLine() const; + void startTransaction(); + void commitTransaction(); + void rollbackTransaction(); + bool isTransactionStarted() const; + qint64 write(SIP_PYBUFFER) /ReleaseGIL/; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->write(reinterpret_cast(bi.bi_buf), bi.bi_len); + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + + SIP_PYOBJECT peek(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + len = sipCpp->peek(s, a0); + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + qint64 skip(qint64 maxSize) /ReleaseGIL/; + virtual bool waitForReadyRead(int msecs) /ReleaseGIL/; + virtual bool waitForBytesWritten(int msecs) /ReleaseGIL/; + void ungetChar(char c /Encoding="None"/); + bool putChar(char c /Encoding="None"/) /ReleaseGIL/; + bool getChar(char *c /Encoding="None",Out/) /ReleaseGIL/; + QString errorString() const; + +signals: + void aboutToClose(); + void bytesWritten(qint64 bytes); + void channelBytesWritten(int channel, qint64 bytes); + void channelReadyRead(int channel); + void readChannelFinished(); + void readyRead(); + +protected: + virtual SIP_PYOBJECT readData(qint64 maxlen) = 0 /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipCpp->readData(s, a0); + #else + len = sipCpp->sipProtect_readData(s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + +%VirtualCatcherCode + PyObject *result = sipCallMethod(&sipIsErr, sipMethod, "n", a1); + + if (result) + { + PyObject *buf; + + if (sipParseResult(&sipIsErr, sipMethod, result, "$", &buf) == 0) + { + if (buf == Py_None) + { + sipRes = -1L; + } + else + { + sipBufferInfoDef bi; + + if (sipGetBufferInfo(buf, &bi) < 0) + { + sipBadCatcherResult(sipMethod); + sipIsErr = 1; + } + else + { + sipRes = (a1 < bi.bi_len) ? a1 : bi.bi_len; + memcpy(a0, bi.bi_buf, sipRes); + + sipReleaseBufferInfo(&bi); + } + } + + Py_DECREF(buf); + } + + Py_DECREF(result); + } +%End + + virtual SIP_PYOBJECT readLineData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QIODevice::readLineData(s, a0) : sipCpp->readLineData(s, a0); + #else + len = sipCpp->sipProtectVirt_readLineData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + +%VirtualCatcherCode + PyObject *result = sipCallMethod(&sipIsErr, sipMethod, "n", a1); + + if (result) + { + PyObject *buf; + + if (sipParseResult(&sipIsErr, sipMethod, result, "$", &buf) == 0) + { + if (buf == Py_None) + { + sipRes = -1L; + } + else + { + sipBufferInfoDef bi; + + if (sipGetBufferInfo(buf, &bi) < 0) + { + sipBadCatcherResult(sipMethod); + sipIsErr = 1; + } + else + { + sipRes = (a1 < bi.bi_len) ? a1 : bi.bi_len; + memcpy(a0, bi.bi_buf, sipRes); + + sipReleaseBufferInfo(&bi); + } + } + + Py_DECREF(buf); + } + + Py_DECREF(result); + } +%End + + virtual qint64 writeData(SIP_PYBUFFER) = 0 /ReleaseGIL/ [qint64 (const char *data, qint64 len)]; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipCpp->writeData(reinterpret_cast(bi.bi_buf), bi.bi_len); + #else + sipRes = sipCpp->sipProtect_writeData(reinterpret_cast(bi.bi_buf), + bi.bi_len); + #endif + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + +%VirtualCatcherCode + PyObject *result = sipCallMethod(&sipIsErr, sipMethod, "n", a1); + + if (result) + { + PyObject *buf; + + if (sipParseResult(&sipIsErr, sipMethod, result, "$", &buf) == 0) + { + if (buf == Py_None) + { + sipRes = -1L; + } + else + { + sipBufferInfoDef bi; + + if (sipGetBufferInfo(buf, &bi) < 0) + { + sipBadCatcherResult(sipMethod); + sipIsErr = 1; + } + else + { + if (bi.bi_readonly) + { + sipBadCatcherResult(sipMethod); + sipIsErr = 1; + } + else + { + sipRes = (a1 < bi.bi_len) ? a1 : bi.bi_len; + memcpy(bi.bi_buf, a0, sipRes); + } + + sipReleaseBufferInfo(&bi); + } + } + + Py_DECREF(buf); + } + + Py_DECREF(result); + } +%End + + virtual qint64 skipData(qint64 maxSize) /ReleaseGIL/; + void setOpenMode(QIODeviceBase::OpenMode openMode); + void setErrorString(const QString &errorString); +}; diff --git a/sip/QtCore/qiodevicebase.sip b/sip/QtCore/qiodevicebase.sip new file mode 100644 index 0000000..1e1b1fb --- /dev/null +++ b/sip/QtCore/qiodevicebase.sip @@ -0,0 +1,50 @@ +// qiodevicebase.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QIODeviceBase +{ +%TypeHeaderCode +#include +%End + +public: + enum OpenModeFlag /BaseType=Flag/ + { + NotOpen, + ReadOnly, + WriteOnly, + ReadWrite, + Append, + Truncate, + Text, + Unbuffered, + NewOnly, + ExistingOnly, + }; + + typedef QFlags OpenMode; + +protected: +%If (Qt_6_3_0 -) + ~QIODeviceBase(); +%End +}; diff --git a/sip/QtCore/qitemselectionmodel.sip b/sip/QtCore/qitemselectionmodel.sip new file mode 100644 index 0000000..f999be4 --- /dev/null +++ b/sip/QtCore/qitemselectionmodel.sip @@ -0,0 +1,263 @@ +// qitemselectionmodel.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QItemSelectionRange +{ +%TypeHeaderCode +#include +%End + +public: + QItemSelectionRange(); + QItemSelectionRange(const QModelIndex &atopLeft, const QModelIndex &abottomRight); + explicit QItemSelectionRange(const QModelIndex &index); + int top() const; + int left() const; + int bottom() const; + int right() const; + int width() const; + int height() const; + const QPersistentModelIndex &topLeft() const; + const QPersistentModelIndex &bottomRight() const; + QModelIndex parent() const; + const QAbstractItemModel *model() const; + bool contains(const QModelIndex &index) const; + bool contains(int row, int column, const QModelIndex &parentIndex) const; + bool intersects(const QItemSelectionRange &other) const; + bool operator==(const QItemSelectionRange &other) const; + bool operator!=(const QItemSelectionRange &other) const; + bool isValid() const; + QModelIndexList indexes() const; + QItemSelectionRange intersected(const QItemSelectionRange &other) const; + bool isEmpty() const; + void swap(QItemSelectionRange &other /Constrained/); +}; + +class QItemSelectionModel : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum SelectionFlag /BaseType=Flag/ + { + NoUpdate, + Clear, + Select, + Deselect, + Toggle, + Current, + Rows, + Columns, + SelectCurrent, + ToggleCurrent, + ClearAndSelect, + }; + + typedef QFlags SelectionFlags; + explicit QItemSelectionModel(QAbstractItemModel *model /TransferThis/ = 0); + QItemSelectionModel(QAbstractItemModel *model, QObject *parent /TransferThis/); + virtual ~QItemSelectionModel(); + QModelIndex currentIndex() const; + bool isSelected(const QModelIndex &index) const; + bool isRowSelected(int row, const QModelIndex &parent = QModelIndex()) const; + bool isColumnSelected(int column, const QModelIndex &parent = QModelIndex()) const; + bool rowIntersectsSelection(int row, const QModelIndex &parent = QModelIndex()) const; + bool columnIntersectsSelection(int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndexList selectedIndexes() const; + const QItemSelection selection() const; + QAbstractItemModel *model(); + +public slots: + virtual void clear(); + void clearSelection(); + virtual void reset(); + virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command); + virtual void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command); + virtual void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command); + virtual void clearCurrentIndex(); + +signals: + void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + void currentRowChanged(const QModelIndex ¤t, const QModelIndex &previous); + void currentColumnChanged(const QModelIndex ¤t, const QModelIndex &previous); + +protected: + void emitSelectionChanged(const QItemSelection &newSelection, const QItemSelection &oldSelection); + +public: + bool hasSelection() const; + QModelIndexList selectedRows(int column = 0) const; + QModelIndexList selectedColumns(int row = 0) const; + void setModel(QAbstractItemModel *model); + +signals: + void modelChanged(QAbstractItemModel *model); +}; + +class QItemSelection +{ +%TypeHeaderCode +#include +%End + +public: + QItemSelection(); + QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void select(const QModelIndex &topLeft, const QModelIndex &bottomRight); + bool contains(const QModelIndex &index) const; + int __contains__(const QModelIndex &index); +%MethodCode + // It looks like you can't assign QBool to int. + sipRes = bool(sipCpp->contains(*a0)); +%End + + QModelIndexList indexes() const; + void merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command); + static void split(const QItemSelectionRange &range, const QItemSelectionRange &other, QItemSelection *result); + void __setitem__(int i, const QItemSelectionRange &range); +%MethodCode + int len; + + len = sipCpp->count(); + + if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0) + sipIsErr = 1; + else + (*sipCpp)[a0] = *a1; +%End + + void __setitem__(SIP_PYSLICE slice, const QItemSelection &list); +%MethodCode + Py_ssize_t start, stop, step, slicelength; + + if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) + { + sipIsErr = 1; + } + else + { + int vlen = a1->count(); + + if (vlen != slicelength) + { + sipBadLengthForSlice(vlen, slicelength); + sipIsErr = 1; + } + else + { + QItemSelection::const_iterator it = a1->begin(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + (*sipCpp)[start] = *it; + start += step; + ++it; + } + } + } +%End + + void __delitem__(int i); +%MethodCode + if ((a0 = (int)sipConvertFromSequenceIndex(a0, sipCpp->count())) < 0) + sipIsErr = 1; + else + sipCpp->removeAt(a0); +%End + + void __delitem__(SIP_PYSLICE slice); +%MethodCode + Py_ssize_t start, stop, step, slicelength; + + if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) + { + sipIsErr = 1; + } + else + { + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + sipCpp->removeAt(start); + start += step - 1; + } + } +%End + + QItemSelectionRange operator[](int i); +%MethodCode + Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); + + if (idx < 0) + sipIsErr = 1; + else + sipRes = new QItemSelectionRange(sipCpp->operator[]((int)idx)); +%End + + QItemSelection operator[](SIP_PYSLICE slice); +%MethodCode + Py_ssize_t start, stop, step, slicelength; + + if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) + { + sipIsErr = 1; + } + else + { + sipRes = new QItemSelection(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + (*sipRes) += (*sipCpp)[start]; + start += step; + } + } +%End + +// Methods inherited from QList. +bool operator!=(const QItemSelection &other) const; +bool operator==(const QItemSelection &other) const; + +// Keep the following in sync with QStringList (except for mid()). +void clear(); +bool isEmpty() const; +void append(const QItemSelectionRange &range); +void prepend(const QItemSelectionRange &range); +void insert(int i, const QItemSelectionRange &range); +void replace(int i, const QItemSelectionRange &range); +void removeAt(int i); +int removeAll(const QItemSelectionRange &range); +QItemSelectionRange takeAt(int i); +QItemSelectionRange takeFirst(); +QItemSelectionRange takeLast(); +void move(int from, int to); +int count(const QItemSelectionRange &range) const; +int count() const /__len__/; +QItemSelectionRange &first(); +QItemSelectionRange &last(); +int indexOf(const QItemSelectionRange &value, int from = 0) const; +int lastIndexOf(const QItemSelectionRange &value, int from = -1) const; +QItemSelection &operator+=(const QItemSelection &other); +QItemSelection &operator+=(const QItemSelectionRange &value); +}; diff --git a/sip/QtCore/qjsonarray.sip b/sip/QtCore/qjsonarray.sip new file mode 100644 index 0000000..db75d5f --- /dev/null +++ b/sip/QtCore/qjsonarray.sip @@ -0,0 +1,129 @@ +// This is the SIP interface definition for the QJsonArray mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +// Note that we assume any iterable can be converted to a QJsonArray. However, +// because QJsonValue is an iterable and QJsonObject is implemented as a dict +// (which is also an iterable), then any overloads that handle one or more of +// them must be ordered so that QJsonArray is checked last. + +%MappedType QJsonArray + /TypeHintIn="Iterable[QJsonValue]", TypeHintOut="List[QJsonValue]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + QJsonValue *t = new QJsonValue(sipCpp->at(i)); + PyObject *tobj = sipConvertFromNewType(t, sipType_QJsonValue, + sipTransferObj); + + if (!tobj) + { + delete t; + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, tobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QJsonArray *ql = new QJsonArray; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int state; + QJsonValue *t = reinterpret_cast( + sipForceConvertToType(itm, sipType_QJsonValue, sipTransferObj, + SIP_NOT_NONE, &state, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QJsonValue' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + + return 0; + } + + ql->append(*t); + + sipReleaseType(t, sipType_QJsonValue, state); + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtCore/qjsondocument.sip b/sip/QtCore/qjsondocument.sip new file mode 100644 index 0000000..32a2a28 --- /dev/null +++ b/sip/QtCore/qjsondocument.sip @@ -0,0 +1,92 @@ +// qjsondocument.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +struct QJsonParseError +{ +%TypeHeaderCode +#include +%End + + enum ParseError + { + NoError, + UnterminatedObject, + MissingNameSeparator, + UnterminatedArray, + MissingValueSeparator, + IllegalValue, + TerminationByNumber, + IllegalNumber, + IllegalEscapeSequence, + IllegalUTF8String, + UnterminatedString, + MissingObject, + DeepNesting, + DocumentTooLarge, + GarbageAtEnd, + }; + + QString errorString() const; + int offset; + QJsonParseError::ParseError error; +}; + +class QJsonDocument +{ +%TypeHeaderCode +#include +%End + +public: + QJsonDocument(); + explicit QJsonDocument(const QJsonObject &object); + explicit QJsonDocument(const QJsonArray &array); + QJsonDocument(const QJsonDocument &other); + ~QJsonDocument(); + static QJsonDocument fromVariant(const QVariant &variant); + QVariant toVariant() const; + + enum JsonFormat + { + Indented, + Compact, + }; + + static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = 0); + QByteArray toJson(QJsonDocument::JsonFormat format = QJsonDocument::Indented) const; + bool isEmpty() const; + bool isArray() const; + bool isObject() const; + QJsonObject object() const; + QJsonArray array() const; + void setObject(const QJsonObject &object); + void setArray(const QJsonArray &array); + bool operator==(const QJsonDocument &other) const; + bool operator!=(const QJsonDocument &other) const; + bool isNull() const; + void swap(QJsonDocument &other /Constrained/); + const QJsonValue operator[](qsizetype i) const; + const QJsonValue operator[](const QString &key) const; +}; + +QDataStream &operator<<(QDataStream &, const QJsonDocument & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QJsonDocument & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtCore/qjsonobject.sip b/sip/QtCore/qjsonobject.sip new file mode 100644 index 0000000..5c7f2e1 --- /dev/null +++ b/sip/QtCore/qjsonobject.sip @@ -0,0 +1,136 @@ +// This is the SIP interface definition for the QJsonObject mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QJsonObject + /TypeHint="Dict[QString, QJsonValue]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QJsonObject::const_iterator it = sipCpp->constBegin(); + QJsonObject::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + QString *k = new QString(it.key()); + PyObject *kobj = sipConvertFromNewType(k, sipType_QString, + sipTransferObj); + + if (!kobj) + { + delete k; + Py_DECREF(d); + + return 0; + } + + QJsonValue *v = new QJsonValue(it.value()); + PyObject *vobj = sipConvertFromNewType(v, sipType_QJsonValue, + sipTransferObj); + + if (!vobj) + { + delete v; + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + int rc = PyDict_SetItem(d, kobj, vobj); + + Py_DECREF(vobj); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + ++it; + } + + return d; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return PyDict_Check(sipPy); + + QJsonObject *jo = new QJsonObject; + + Py_ssize_t pos = 0; + PyObject *kobj, *vobj; + + while (PyDict_Next(sipPy, &pos, &kobj, &vobj)) + { + int kstate; + QString *k = reinterpret_cast( + sipForceConvertToType(kobj, sipType_QString, sipTransferObj, + SIP_NOT_NONE, &kstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a key has type '%s' but 'str' is expected", + sipPyTypeName(Py_TYPE(kobj))); + + delete jo; + + return 0; + } + + int vstate; + QJsonValue *v = reinterpret_cast( + sipForceConvertToType(vobj, sipType_QJsonValue, sipTransferObj, + SIP_NOT_NONE, &vstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a value has type '%s' but 'QJsonValue' is expected", + sipPyTypeName(Py_TYPE(vobj))); + + sipReleaseType(k, sipType_QString, kstate); + delete jo; + + return 0; + } + + jo->insert(*k, *v); + + sipReleaseType(v, sipType_QJsonValue, vstate); + sipReleaseType(k, sipType_QString, kstate); + } + + *sipCppPtr = jo; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtCore/qjsonvalue.sip b/sip/QtCore/qjsonvalue.sip new file mode 100644 index 0000000..fdc8e28 --- /dev/null +++ b/sip/QtCore/qjsonvalue.sip @@ -0,0 +1,83 @@ +// qjsonvalue.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QJsonValue /AllowNone,TypeHintIn="Union[QJsonValue, QJsonValue.Type, QJsonArray, QJsonObject, bool, int, float, None, QString]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +if (!sipIsErr) + return qpycore_canConvertTo_QJsonValue(sipPy); + +return qpycore_convertTo_QJsonValue(sipPy, sipTransferObj, sipCppPtr, sipIsErr); +%End + +public: + enum Type + { + Null, + Bool, + Double, + String, + Array, + Object, + Undefined, + }; + + QJsonValue(QJsonValue::Type type /Constrained/ = QJsonValue::Null); + QJsonValue(const QJsonValue &other); + ~QJsonValue(); + static QJsonValue fromVariant(const QVariant &variant); + QVariant toVariant() const; + QJsonValue::Type type() const; + bool isNull() const; + bool isBool() const; + bool isDouble() const; + bool isString() const; + bool isArray() const; + bool isObject() const; + bool isUndefined() const; + bool toBool(bool defaultValue = false) const; + int toInt(int defaultValue = 0) const; + qint64 toInteger(qint64 defaultValue = 0) const; + double toDouble(double defaultValue = 0) const; + QJsonArray toArray() const; + QJsonArray toArray(const QJsonArray &defaultValue) const; + QJsonObject toObject() const; + QJsonObject toObject(const QJsonObject &defaultValue) const; + bool operator==(const QJsonValue &other) const; + bool operator!=(const QJsonValue &other) const; + QString toString() const; + QString toString(const QString &defaultValue) const; + void swap(QJsonValue &other /Constrained/); + const QJsonValue operator[](qsizetype i) const; + const QJsonValue operator[](const QString &key) const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +QDataStream &operator<<(QDataStream &, const QJsonValue & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QJsonValue & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtCore/qlibrary.sip b/sip/QtCore/qlibrary.sip new file mode 100644 index 0000000..3df3982 --- /dev/null +++ b/sip/QtCore/qlibrary.sip @@ -0,0 +1,60 @@ +// qlibrary.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLibrary : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum LoadHint /BaseType=Flag/ + { + ResolveAllSymbolsHint, + ExportExternalSymbolsHint, + LoadArchiveMemberHint, + PreventUnloadHint, + DeepBindHint, + }; + + typedef QFlags LoadHints; + explicit QLibrary(QObject *parent /TransferThis/ = 0); + QLibrary(const QString &fileName, QObject *parent /TransferThis/ = 0); + QLibrary(const QString &fileName, int verNum, QObject *parent /TransferThis/ = 0); + QLibrary(const QString &fileName, const QString &version, QObject *parent /TransferThis/ = 0); + virtual ~QLibrary(); + QString errorString() const; + QString fileName() const; + bool isLoaded() const; + bool load(); + QLibrary::LoadHints loadHints() const; + QFunctionPointer resolve(const char *symbol); + static QFunctionPointer resolve(const QString &fileName, const char *symbol); + static QFunctionPointer resolve(const QString &fileName, int verNum, const char *symbol); + static QFunctionPointer resolve(const QString &fileName, const QString &version, const char *symbol); + bool unload(); + static bool isLibrary(const QString &fileName); + void setFileName(const QString &fileName); + void setFileNameAndVersion(const QString &fileName, int verNum); + void setFileNameAndVersion(const QString &fileName, const QString &version); + void setLoadHints(QLibrary::LoadHints hints); +}; diff --git a/sip/QtCore/qlibraryinfo.sip b/sip/QtCore/qlibraryinfo.sip new file mode 100644 index 0000000..b87a8fa --- /dev/null +++ b/sip/QtCore/qlibraryinfo.sip @@ -0,0 +1,61 @@ +// qlibraryinfo.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLibraryInfo +{ +%TypeHeaderCode +#include +%End + +public: + static bool isDebugBuild(); +%If (Qt_6_5_0 -) + static bool isSharedBuild(); +%End + static QString path(QLibraryInfo::LibraryPath p) /ReleaseGIL/; + static QVersionNumber version(); + +private: + QLibraryInfo(); + +public: + enum LibraryPath + { + PrefixPath, + DocumentationPath, + HeadersPath, + LibrariesPath, + LibraryExecutablesPath, + BinariesPath, + PluginsPath, + Qml2ImportsPath, + ArchDataPath, + DataPath, + TranslationsPath, + ExamplesPath, + TestsPath, + SettingsPath, +%If (Qt_6_2_0 -) + QmlImportsPath, +%End + }; +}; diff --git a/sip/QtCore/qline.sip b/sip/QtCore/qline.sip new file mode 100644 index 0000000..c5b9bed --- /dev/null +++ b/sip/QtCore/qline.sip @@ -0,0 +1,171 @@ +// qline.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLine +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("iiii", sipCpp->x1(), sipCpp->y1(), sipCpp->x2(), sipCpp->y2()); +%End + +public: + bool operator!=(const QLine &d) const; + QLine(); + QLine(const QPoint &pt1_, const QPoint &pt2_); + QLine(int x1pos, int y1pos, int x2pos, int y2pos); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QLine()"); + } + else + { + sipRes = PyUnicode_FromFormat( + "PyQt6.QtCore.QLine(%i, %i, %i, %i)", + sipCpp->x1(), sipCpp->y1(), sipCpp->x2(), sipCpp->y2()); + } +%End + + bool isNull() const; + int __bool__() const; +%MethodCode + sipRes = !sipCpp->isNull(); +%End + + int x1() const; + int y1() const; + int x2() const; + int y2() const; + QPoint p1() const; + QPoint p2() const; + int dx() const; + int dy() const; + void translate(const QPoint &point); + void translate(int adx, int ady); + bool operator==(const QLine &d) const; + QLine translated(const QPoint &p) const; + QLine translated(int adx, int ady) const; + void setP1(const QPoint &aP1); + void setP2(const QPoint &aP2); + void setPoints(const QPoint &aP1, const QPoint &aP2); + void setLine(int aX1, int aY1, int aX2, int aY2); + QPoint center() const; +%If (Qt_6_4_0 -) + QLineF toLineF() const; +%End +}; + +QDataStream &operator<<(QDataStream &, const QLine &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QLine & /Constrained/) /ReleaseGIL/; + +class QLineF +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("dddd", sipCpp->x1(), sipCpp->y1(), sipCpp->x2(), sipCpp->y2()); +%End + +public: + enum IntersectionType + { + NoIntersection, + BoundedIntersection, + UnboundedIntersection, + }; + + QLineF(const QLine &line); + bool isNull() const; + int __bool__() const; +%MethodCode + sipRes = !sipCpp->isNull(); +%End + + qreal length() const; + QLineF unitVector() const; + QLineF::IntersectionType intersects(const QLineF &l, QPointF *intersectionPoint /Out/ = 0) const; + bool operator!=(const QLineF &d) const; + QLineF(); + QLineF(const QPointF &apt1, const QPointF &apt2); + QLineF(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QLineF()"); + } + else + { + PyObject *x1 = PyFloat_FromDouble(sipCpp->x1()); + PyObject *y1 = PyFloat_FromDouble(sipCpp->y1()); + PyObject *x2 = PyFloat_FromDouble(sipCpp->x2()); + PyObject *y2 = PyFloat_FromDouble(sipCpp->y2()); + + if (x1 && y1 && x2 && y2) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QLineF(%R, %R, %R, %R)", + x1, y1, x2, y2); + } + + Py_XDECREF(x1); + Py_XDECREF(y1); + Py_XDECREF(x2); + Py_XDECREF(y2); + } +%End + + qreal x1() const; + qreal y1() const; + qreal x2() const; + qreal y2() const; + QPointF p1() const; + QPointF p2() const; + qreal dx() const; + qreal dy() const; + QLineF normalVector() const; + void translate(const QPointF &point); + void translate(qreal adx, qreal ady); + void setLength(qreal len); + QPointF pointAt(qreal t) const; + QLine toLine() const; + bool operator==(const QLineF &d) const; + static QLineF fromPolar(qreal length, qreal angle); + qreal angle() const; + void setAngle(qreal angle); + qreal angleTo(const QLineF &l) const; + QLineF translated(const QPointF &p) const; + QLineF translated(qreal adx, qreal ady) const; + void setP1(const QPointF &aP1); + void setP2(const QPointF &aP2); + void setPoints(const QPointF &aP1, const QPointF &aP2); + void setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2); + QPointF center() const; +}; + +QDataStream &operator<<(QDataStream &, const QLineF & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QLineF & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtCore/qlocale.sip b/sip/QtCore/qlocale.sip new file mode 100644 index 0000000..c41973a --- /dev/null +++ b/sip/QtCore/qlocale.sip @@ -0,0 +1,1169 @@ +// qlocale.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLocale +{ +%TypeHeaderCode +#include +%End + +public: + enum Language + { + C, + Abkhazian, + Afan, + Afar, + Afrikaans, + Albanian, + Amharic, + Arabic, + Armenian, + Assamese, + Aymara, + Azerbaijani, + Bashkir, + Basque, + Bengali, + Bhutani, + Bislama, + Breton, + Bulgarian, + Burmese, + Byelorussian, + Cambodian, + Catalan, + Chinese, + Corsican, + Croatian, + Czech, + Danish, + Dutch, + English, + Esperanto, + Estonian, + Faroese, + Finnish, + French, + Frisian, + Gaelic, + Galician, + Georgian, + German, + Greek, + Greenlandic, + Guarani, + Gujarati, + Hausa, + Hebrew, + Hindi, + Hungarian, + Icelandic, + Indonesian, + Interlingua, + Interlingue, + Inuktitut, + Inupiak, + Irish, + Italian, + Japanese, + Javanese, + Kannada, + Kashmiri, + Kazakh, + Kinyarwanda, + Kirghiz, + Korean, + Kurdish, + Kurundi, + Latin, + Latvian, + Lingala, + Lithuanian, + Macedonian, + Malagasy, + Malay, + Malayalam, + Maltese, + Maori, + Marathi, + Mongolian, + NauruLanguage, + Nepali, + Occitan, + Oriya, + Pashto, + Persian, + Polish, + Portuguese, + Punjabi, + Quechua, + RhaetoRomance, + Romanian, + Russian, + Samoan, + Sanskrit, + Serbian, + Shona, + Sindhi, + Slovak, + Slovenian, + Somali, + Spanish, + Sundanese, + Swahili, + Swedish, + Tajik, + Tamil, + Tatar, + Telugu, + Thai, + Tibetan, + Tigrinya, + Tsonga, + Turkish, + Turkmen, + Uigur, + Ukrainian, + Urdu, + Uzbek, + Vietnamese, + Volapuk, + Welsh, + Wolof, + Xhosa, + Yiddish, + Yoruba, + Zhuang, + Zulu, + Bosnian, + Divehi, + Manx, + Cornish, + LastLanguage, + NorwegianBokmal, + NorwegianNynorsk, + Akan, + Konkani, + Ga, + Igbo, + Kamba, + Syriac, + Blin, + Geez, + Koro, + Sidamo, + Atsam, + Tigre, + Jju, + Friulian, + Venda, + Ewe, + Walamo, + Hawaiian, + Tyap, + Chewa, + Filipino, + SwissGerman, + SichuanYi, + Kpelle, + LowGerman, + SouthNdebele, + NorthernSotho, + NorthernSami, + Taroko, + Gusii, + Taita, + Fulah, + Kikuyu, + Samburu, + Sena, + NorthNdebele, + Rombo, + Tachelhit, + Kabyle, + Nyankole, + Bena, + Vunjo, + Bambara, + Embu, + Cherokee, + Morisyen, + Makonde, + Langi, + Ganda, + Bemba, + Kabuverdianu, + Meru, + Kalenjin, + Nama, + Machame, + Colognian, + Masai, + Soga, + Luyia, + Asu, + Teso, + Saho, + KoyraChiini, + Rwa, + Luo, + Chiga, + CentralMoroccoTamazight, + KoyraboroSenni, + Shambala, + AnyLanguage, + Rundi, + Bodo, + Aghem, + Basaa, + Zarma, + Duala, + JolaFonyi, + Ewondo, + Bafia, + LubaKatanga, + MakhuwaMeetto, + Mundang, + Kwasio, + Nuer, + Sakha, + Sangu, + Tasawaq, + Vai, + Walser, + Yangben, + Oromo, + Dzongkha, + Belarusian, + Khmer, + Fijian, + WesternFrisian, + Lao, + Marshallese, + Romansh, + Sango, + Ossetic, + SouthernSotho, + Tswana, + Sinhala, + Swati, + Sardinian, + Tongan, + Tahitian, + Nyanja, + Avaric, + Chamorro, + Chechen, + Church, + Chuvash, + Cree, + Haitian, + Herero, + HiriMotu, + Kanuri, + Komi, + Kongo, + Kwanyama, + Limburgish, + Luxembourgish, + Navaho, + Ndonga, + Ojibwa, + Pali, + Walloon, + Avestan, + Asturian, + Ngomba, + Kako, + Meta, + Ngiemboon, + Uighur, + Aragonese, + Akkadian, + AncientEgyptian, + AncientGreek, + Aramaic, + Balinese, + Bamun, + BatakToba, + Buginese, + Chakma, + Coptic, + Dogri, + Gothic, + Ingush, + Mandingo, + Manipuri, + OldIrish, + OldNorse, + OldPersian, + Pahlavi, + Phoenician, + Santali, + Saurashtra, + TaiDam, + Ugaritic, + Akoose, + Lakota, + StandardMoroccanTamazight, + Mapuche, + CentralKurdish, + LowerSorbian, + UpperSorbian, + Kenyang, + Mohawk, + Nko, + Prussian, + Kiche, + SouthernSami, + LuleSami, + InariSami, + SkoltSami, + Warlpiri, + Mende, + Lezghian, + Maithili, + AmericanSignLanguage, + Bhojpuri, + LiteraryChinese, + Mazanderani, + Newari, + NorthernLuri, + Palauan, + Papiamento, + TokelauLanguage, + TokPisin, + TuvaluLanguage, + Cantonese, + Osage, + Ido, + Lojban, + Sicilian, + SouthernKurdish, + WesternBalochi, + Cebuano, + Erzya, + Chickasaw, + Muscogee, + Silesian, + NigerianPidgin, + Bangla, + CentralAtlasTamazight, + Inupiaq, + Kalaallisut, + Kuanyama, + Kyrgyz, + Navajo, + Odia, + Uyghur, + Wolaytta, +%If (Qt_6_3_0 -) + Kaingang, +%End +%If (Qt_6_3_0 -) + Nheengatu, +%End +%If (Qt_6_5_0 -) + Haryanvi, +%End +%If (Qt_6_5_0 -) + NorthernFrisian, +%End +%If (Qt_6_5_0 -) + Rajasthani, +%End +%If (Qt_6_5_0 -) + Moksha, +%End +%If (Qt_6_5_0 -) + TokiPona, +%End +%If (Qt_6_5_0 -) + Pijin, +%End +%If (Qt_6_5_0 -) + Obolo, +%End + }; + + enum Country + { + AnyCountry, +%If (Qt_6_2_0 -) + AnyTerritory, +%End + Afghanistan, + Albania, + Algeria, + AmericanSamoa, + Andorra, + Angola, + Anguilla, + Antarctica, + AntiguaAndBarbuda, + Argentina, + Armenia, + Aruba, + Australia, + Austria, + Azerbaijan, + Bahamas, + Bahrain, + Bangladesh, + Barbados, + Belarus, + Belgium, + Belize, + Benin, + Bermuda, + Bhutan, + Bolivia, + BosniaAndHerzegowina, + Botswana, + BouvetIsland, + Brazil, + BritishIndianOceanTerritory, + Bulgaria, + BurkinaFaso, + Burundi, + Cambodia, + Cameroon, + Canada, + CapeVerde, + CaymanIslands, + CentralAfricanRepublic, + Chad, + Chile, + China, + ChristmasIsland, + CocosIslands, + Colombia, + Comoros, + DemocraticRepublicOfCongo, + PeoplesRepublicOfCongo, + CookIslands, + CostaRica, + IvoryCoast, + Croatia, + Cuba, + Cyprus, + CzechRepublic, + Denmark, + Djibouti, + Dominica, + DominicanRepublic, + EastTimor, + Ecuador, + Egypt, + ElSalvador, + EquatorialGuinea, + Eritrea, + Estonia, + Ethiopia, + FalklandIslands, + FaroeIslands, + Finland, + France, + FrenchGuiana, + FrenchPolynesia, + FrenchSouthernTerritories, + Gabon, + Gambia, + Georgia, + Germany, + Ghana, + Gibraltar, + Greece, + Greenland, + Grenada, + Guadeloupe, + Guam, + Guatemala, + Guinea, + GuineaBissau, + Guyana, + Haiti, + HeardAndMcDonaldIslands, + Honduras, + HongKong, + Hungary, + Iceland, + India, + Indonesia, + Iran, + Iraq, + Ireland, + Israel, + Italy, + Jamaica, + Japan, + Jordan, + Kazakhstan, + Kenya, + Kiribati, + DemocraticRepublicOfKorea, + RepublicOfKorea, + Kuwait, + Kyrgyzstan, + Latvia, + Lebanon, + Lesotho, + Liberia, + Liechtenstein, + Lithuania, + Luxembourg, + Macau, + Macedonia, + Madagascar, + Malawi, + Malaysia, + Maldives, + Mali, + Malta, + MarshallIslands, + Martinique, + Mauritania, + Mauritius, + Mayotte, + Mexico, + Micronesia, + Moldova, + Monaco, + Mongolia, + Montserrat, + Morocco, + Mozambique, + Myanmar, + Namibia, + NauruCountry, + Nepal, + Netherlands, + NewCaledonia, + NewZealand, + Nicaragua, + Niger, + Nigeria, + Niue, + NorfolkIsland, + NorthernMarianaIslands, + Norway, + Oman, + Pakistan, + Palau, + Panama, + PapuaNewGuinea, + Paraguay, + Peru, + Philippines, + Pitcairn, + Poland, + Portugal, + PuertoRico, + Qatar, + Reunion, + Romania, + RussianFederation, + Rwanda, + SaintKittsAndNevis, + Samoa, + SanMarino, + SaoTomeAndPrincipe, + SaudiArabia, + Senegal, + Seychelles, + SierraLeone, + Singapore, + Slovakia, + Slovenia, + SolomonIslands, + Somalia, + SouthAfrica, + SouthGeorgiaAndTheSouthSandwichIslands, + Spain, + SriLanka, + Sudan, + Suriname, + SvalbardAndJanMayenIslands, + Swaziland, + Sweden, + Switzerland, + SyrianArabRepublic, + Taiwan, + Tajikistan, + Tanzania, + Thailand, + Togo, + TrinidadAndTobago, + Tunisia, + Turkey, + Turkmenistan, + TurksAndCaicosIslands, + Uganda, + Ukraine, + UnitedArabEmirates, + UnitedKingdom, + UnitedStates, + UnitedStatesMinorOutlyingIslands, + Uruguay, + Uzbekistan, + Vanuatu, + VaticanCityState, + Venezuela, + BritishVirginIslands, + WallisAndFutunaIslands, + WesternSahara, + Yemen, + Zambia, + Zimbabwe, + Montenegro, + Serbia, + SaintBarthelemy, + SaintMartin, + LatinAmericaAndTheCaribbean, + LastCountry, + Brunei, + CongoKinshasa, + CongoBrazzaville, + Fiji, + Guernsey, + NorthKorea, + SouthKorea, + Laos, + Libya, + CuraSao, + PalestinianTerritories, + Russia, + SaintLucia, + SaintVincentAndTheGrenadines, + SaintHelena, + SaintPierreAndMiquelon, + Syria, + Tonga, + Vietnam, + UnitedStatesVirginIslands, + CanaryIslands, + ClippertonIsland, + AscensionIsland, + AlandIslands, + DiegoGarcia, + CeutaAndMelilla, + IsleOfMan, + Jersey, + TristanDaCunha, + SouthSudan, + Bonaire, + SintMaarten, + Kosovo, + TokelauCountry, + TuvaluCountry, + EuropeanUnion, + OutlyingOceania, + LatinAmerica, + World, + Europe, + BosniaAndHerzegovina, + CaribbeanNetherlands, + Curacao, + Czechia, + Eswatini, + Macao, + SaintVincentAndGrenadines, + SouthGeorgiaAndSouthSandwichIslands, + SvalbardAndJanMayen, + TimorLeste, + UnitedStatesOutlyingIslands, + VaticanCity, + WallisAndFutuna, +%If (Qt_6_2_0 -) + NauruTerritory, +%End +%If (Qt_6_2_0 -) + TokelauTerritory, +%End +%If (Qt_6_2_0 -) + TuvaluTerritory, +%End + }; + + enum NumberOption /BaseType=Flag/ + { + OmitGroupSeparator, + RejectGroupSeparator, + DefaultNumberOptions, + OmitLeadingZeroInExponent, + RejectLeadingZeroInExponent, + IncludeTrailingZeroesAfterDot, + RejectTrailingZeroesAfterDot, + }; + + typedef QFlags NumberOptions; + QLocale(); + explicit QLocale(const QString &name); + QLocale(QLocale::Language language, QLocale::Country country = QLocale::AnyCountry); + QLocale(QLocale::Language language, QLocale::Script script, QLocale::Country country); + QLocale(const QLocale &other); + ~QLocale(); + QLocale::Language language() const; + QLocale::Country country() const; + QString name() const; + short toShort(const QString &s, bool *ok = 0) const; + ushort toUShort(const QString &s, bool *ok = 0) const; + int toInt(const QString &s, bool *ok = 0) const; + uint toUInt(const QString &s, bool *ok = 0) const; + qlonglong toLongLong(const QString &s, bool *ok = 0) const; + qulonglong toULongLong(const QString &s, bool *ok = 0) const; + float toFloat(const QString &s, bool *ok = 0) const; + double toDouble(const QString &s, bool *ok = 0) const; + QString toString(QDate date, QLocale::FormatType format, QCalendar cal) const; + QString toString(QDate date, QStringView formatStr, QCalendar cal) const; + QString toString(QDate date, QLocale::FormatType format = QLocale::LongFormat) const; + QString toString(QDate date, QStringView formatStr) const; + QString toString(QTime time, QLocale::FormatType format = QLocale::LongFormat) const; + QString toString(QTime time, QStringView formatStr) const; + QString toString(double i /Constrained/, char format = 'g', int precision = 6) const; + static QString languageToString(QLocale::Language language); + static QString countryToString(QLocale::Country country); + static void setDefault(const QLocale &locale); + static QLocale c(); + static QLocale system(); + + enum FormatType + { + LongFormat, + ShortFormat, + NarrowFormat, + }; + + QString toString(const QDateTime &dateTime, QLocale::FormatType format, QCalendar cal) const; + QString toString(const QDateTime &dateTime, const QString &format) const; + QString toString(const QDateTime &dateTime, const QString &formatStr, QCalendar cal) const; +%MethodCode + // QStringView has issues being implemented as a mapped type. + sipRes = new QString(sipCpp->toString(*a0, QStringView(*a1), *a2)); +%End + + QString toString(const QDateTime &dateTime, QLocale::FormatType format = QLocale::LongFormat) const; + QString dateFormat(QLocale::FormatType format = QLocale::LongFormat) const; + QString timeFormat(QLocale::FormatType format = QLocale::LongFormat) const; + QString dateTimeFormat(QLocale::FormatType format = QLocale::LongFormat) const; + QDate toDate(const QString &string, QLocale::FormatType format = QLocale::LongFormat) const; + QDate toDate(const QString &string, const QString &format) const; + QTime toTime(const QString &string, QLocale::FormatType format = QLocale::LongFormat) const; + QTime toTime(const QString &string, const QString &format) const; + QDateTime toDateTime(const QString &string, QLocale::FormatType format = QLocale::LongFormat) const; + QDateTime toDateTime(const QString &string, const QString &format) const; + QString decimalPoint() const; + QString groupSeparator() const; + QString percent() const; + QString zeroDigit() const; + QString negativeSign() const; + QString exponential() const; + QString monthName(int, QLocale::FormatType format = QLocale::LongFormat) const; + QString dayName(int, QLocale::FormatType format = QLocale::LongFormat) const; + void setNumberOptions(QLocale::NumberOptions options); + QLocale::NumberOptions numberOptions() const; + + enum MeasurementSystem + { + MetricSystem, + ImperialSystem, + ImperialUSSystem, + ImperialUKSystem, + }; + + QLocale::MeasurementSystem measurementSystem() const; + QString positiveSign() const; + QString standaloneMonthName(int, QLocale::FormatType format = QLocale::LongFormat) const; + QString standaloneDayName(int, QLocale::FormatType format = QLocale::LongFormat) const; + QString amText() const; + QString pmText() const; + Qt::LayoutDirection textDirection() const; + + enum Script + { + AnyScript, + ArabicScript, + CyrillicScript, + DeseretScript, + GurmukhiScript, + SimplifiedHanScript, + TraditionalHanScript, + LatinScript, + MongolianScript, + TifinaghScript, + SimplifiedChineseScript, + TraditionalChineseScript, + ArmenianScript, + BengaliScript, + CherokeeScript, + DevanagariScript, + EthiopicScript, + GeorgianScript, + GreekScript, + GujaratiScript, + HebrewScript, + JapaneseScript, + KhmerScript, + KannadaScript, + KoreanScript, + LaoScript, + MalayalamScript, + MyanmarScript, + OriyaScript, + TamilScript, + TeluguScript, + ThaanaScript, + ThaiScript, + TibetanScript, + SinhalaScript, + SyriacScript, + YiScript, + VaiScript, + AvestanScript, + BalineseScript, + BamumScript, + BatakScript, + BopomofoScript, + BrahmiScript, + BugineseScript, + BuhidScript, + CanadianAboriginalScript, + CarianScript, + ChakmaScript, + ChamScript, + CopticScript, + CypriotScript, + EgyptianHieroglyphsScript, + FraserScript, + GlagoliticScript, + GothicScript, + HanScript, + HangulScript, + HanunooScript, + ImperialAramaicScript, + InscriptionalPahlaviScript, + InscriptionalParthianScript, + JavaneseScript, + KaithiScript, + KatakanaScript, + KayahLiScript, + KharoshthiScript, + LannaScript, + LepchaScript, + LimbuScript, + LinearBScript, + LycianScript, + LydianScript, + MandaeanScript, + MeiteiMayekScript, + MeroiticScript, + MeroiticCursiveScript, + NkoScript, + NewTaiLueScript, + OghamScript, + OlChikiScript, + OldItalicScript, + OldPersianScript, + OldSouthArabianScript, + OrkhonScript, + OsmanyaScript, + PhagsPaScript, + PhoenicianScript, + PollardPhoneticScript, + RejangScript, + RunicScript, + SamaritanScript, + SaurashtraScript, + SharadaScript, + ShavianScript, + SoraSompengScript, + CuneiformScript, + SundaneseScript, + SylotiNagriScript, + TagalogScript, + TagbanwaScript, + TaiLeScript, + TaiVietScript, + TakriScript, + UgariticScript, + BrailleScript, + HiraganaScript, + CaucasianAlbanianScript, + BassaVahScript, + DuployanScript, + ElbasanScript, + GranthaScript, + PahawhHmongScript, + KhojkiScript, + LinearAScript, + MahajaniScript, + ManichaeanScript, + MendeKikakuiScript, + ModiScript, + MroScript, + OldNorthArabianScript, + NabataeanScript, + PalmyreneScript, + PauCinHauScript, + OldPermicScript, + PsalterPahlaviScript, + SiddhamScript, + KhudawadiScript, + TirhutaScript, + VarangKshitiScript, + AhomScript, + AnatolianHieroglyphsScript, + HatranScript, + MultaniScript, + OldHungarianScript, + SignWritingScript, + AdlamScript, + BhaiksukiScript, + MarchenScript, + NewaScript, + OsageScript, + TangutScript, + HanWithBopomofoScript, + JamoScript, + BanglaScript, + MendeScript, + OdiaScript, + }; + + enum CurrencySymbolFormat + { + CurrencyIsoCode, + CurrencySymbol, + CurrencyDisplayName, + }; + + QLocale::Script script() const; + QString bcp47Name() const; + QString nativeLanguageName() const; + QString nativeCountryName() const; + Qt::DayOfWeek firstDayOfWeek() const; + QList weekdays() const; + QString toUpper(const QString &str) const; + QString toLower(const QString &str) const; + QString currencySymbol(QLocale::CurrencySymbolFormat format = QLocale::CurrencySymbol) const; + QString toCurrencyString(double, const QString &symbol = QString(), int precision = -1) const; + QStringList uiLanguages() const; + static QString scriptToString(QLocale::Script script); +%If (Qt_6_2_0 -) + static QList matchingLocales(QLocale::Language language, QLocale::Script script, QLocale::Territory territory); +%End +%If (- Qt_6_2_0) + static QList matchingLocales(QLocale::Language language, QLocale::Script script, QLocale::Country country); +%End + + enum QuotationStyle + { + StandardQuotation, + AlternateQuotation, + }; + + QString quoteString(QStringView str, QLocale::QuotationStyle style = QLocale::StandardQuotation) const; + QString createSeparatedList(const QStringList &list) const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + enum FloatingPointPrecisionOption /BaseType=IntEnum/ + { + FloatingPointShortest, + }; + + void swap(QLocale &other /Constrained/); + QString toString(SIP_PYOBJECT i /TypeHint="int"/) const; +%MethodCode + // Convert a Python int avoiding overflow as much as possible. + + static PyObject *zero = 0; + if (!zero) + zero = PyLong_FromLong(0); + + int rc = PyObject_RichCompareBool(a0, zero, Py_LT); + + PyErr_Clear(); + + if (rc < 0) + { + sipError = sipBadCallableArg(0, a0); + } + else if (rc) + { + long long value = PyLong_AsLongLong(a0); + + if (PyErr_Occurred() && !PyErr_ExceptionMatches(PyExc_OverflowError)) + { + sipError = sipBadCallableArg(0, a0); + } + else + { + sipRes = new QString(sipCpp->toString(value)); + } + } + else + { + unsigned long long value = PyLong_AsUnsignedLongLongMask(a0); + + if (PyErr_Occurred() && !PyErr_ExceptionMatches(PyExc_OverflowError)) + { + sipError = sipBadCallableArg(0, a0); + } + else + { + sipRes = new QString(sipCpp->toString(value)); + } + } +%End + + QString toCurrencyString(SIP_PYOBJECT value /TypeHint="int"/, const QString &symbol = QString()) const; +%MethodCode + // Convert a Python int avoiding overflow as much as possible. + + static PyObject *zero = 0; + if (!zero) + zero = PyLong_FromLong(0); + + int rc = PyObject_RichCompareBool(a0, zero, Py_LT); + + PyErr_Clear(); + + if (rc < 0) + { + sipError = sipBadCallableArg(0, a0); + } + else if (rc) + { + long long value = PyLong_AsLongLong(a0); + + if (PyErr_Occurred() && !PyErr_ExceptionMatches(PyExc_OverflowError)) + { + sipError = sipBadCallableArg(0, a0); + } + else + { + sipRes = new QString(sipCpp->toCurrencyString(value, *a1)); + } + } + else + { + unsigned long long value = PyLong_AsUnsignedLongLongMask(a0); + + if (PyErr_Occurred() && !PyErr_ExceptionMatches(PyExc_OverflowError)) + { + sipError = sipBadCallableArg(0, a0); + } + else + { + sipRes = new QString(sipCpp->toCurrencyString(value, *a1)); + } + } +%End + + enum DataSizeFormat /BaseType=Flag/ + { + DataSizeIecFormat, + DataSizeTraditionalFormat, + DataSizeSIFormat, + }; + + typedef QFlags DataSizeFormats; + QString formattedDataSize(qint64 bytes, int precision = 2, QLocale::DataSizeFormats format = QLocale::DataSizeIecFormat) const; + long toLong(const QString &s, bool *ok = 0) const; + ulong toULong(const QString &s, bool *ok = 0) const; + QDate toDate(const QString &string, QLocale::FormatType format, QCalendar cal) const; + QDateTime toDateTime(const QString &string, QLocale::FormatType format, QCalendar cal) const; + QDate toDate(const QString &string, const QString &format, QCalendar cal) const; + QDateTime toDateTime(const QString &string, const QString &format, QCalendar cal) const; + QLocale collation() const; +%If (Qt_6_3_0 -) + static QString languageToCode(QLocale::Language language, QLocale::LanguageCodeTypes codeTypes = QLocale::AnyLanguageCode); +%End +%If (Qt_6_1_0 - Qt_6_3_0) + static QString languageToCode(QLocale::Language language); +%End +%If (Qt_6_3_0 -) + static QLocale::Language codeToLanguage(QStringView languageCode, QLocale::LanguageCodeTypes codeTypes = QLocale::AnyLanguageCode); +%End +%If (Qt_6_1_0 - Qt_6_3_0) + static QLocale::Language codeToLanguage(QStringView languageCode); +%End +%If (Qt_6_1_0 -) + static QString countryToCode(QLocale::Country country); +%End +%If (Qt_6_1_0 -) + static QLocale::Country codeToCountry(QStringView countryCode); +%End +%If (Qt_6_1_0 -) + static QString scriptToCode(QLocale::Script script); +%End +%If (Qt_6_1_0 -) + static QLocale::Script codeToScript(QStringView scriptCode); +%End +%If (Qt_6_2_0 -) + typedef QLocale::Country Territory; +%End +%If (Qt_6_2_0 -) + QLocale::Territory territory() const; +%End +%If (Qt_6_2_0 -) + QString nativeTerritoryName() const; +%End +%If (Qt_6_2_0 -) + static QString territoryToCode(QLocale::Territory territory); +%End +%If (Qt_6_2_0 -) + static QLocale::Territory codeToTerritory(QStringView territoryCode); +%End +%If (Qt_6_2_0 -) + static QString territoryToString(QLocale::Territory territory); +%End +%If (Qt_6_3_0 -) + + enum LanguageCodeType /BaseType=IntFlag/ + { + ISO639Part1, + ISO639Part2B, + ISO639Part2T, + ISO639Part3, + LegacyLanguageCode, + ISO639Part2, + ISO639Alpha2, + ISO639Alpha3, + ISO639, + AnyLanguageCode, + }; + +%End +%If (Qt_6_3_0 -) + typedef QFlags LanguageCodeTypes; +%End +}; + +QDataStream &operator<<(QDataStream &, const QLocale &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QLocale & /Constrained/) /ReleaseGIL/; +bool operator==(const QLocale &lhs, const QLocale &rhs); +bool operator!=(const QLocale &lhs, const QLocale &rhs); diff --git a/sip/QtCore/qlockfile.sip b/sip/QtCore/qlockfile.sip new file mode 100644 index 0000000..19b9177 --- /dev/null +++ b/sip/QtCore/qlockfile.sip @@ -0,0 +1,54 @@ +// qlockfile.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLockFile +{ +%TypeHeaderCode +#include +%End + +public: + QLockFile(const QString &fileName); + ~QLockFile(); + bool lock() /ReleaseGIL/; + bool tryLock(int timeout = 0) /ReleaseGIL/; + void unlock() /ReleaseGIL/; + void setStaleLockTime(int); + int staleLockTime() const; + bool isLocked() const /ReleaseGIL/; + bool getLockInfo(qint64 *pid /Out/, QString *hostname /Out/, QString *appname /Out/) const; + bool removeStaleLockFile() /ReleaseGIL/; + + enum LockError + { + NoError, + LockFailedError, + PermissionError, + UnknownError, + }; + + QLockFile::LockError error() const; + QString fileName() const; + +private: + QLockFile(const QLockFile &); +}; diff --git a/sip/QtCore/qlogging.sip b/sip/QtCore/qlogging.sip new file mode 100644 index 0000000..b6d949a --- /dev/null +++ b/sip/QtCore/qlogging.sip @@ -0,0 +1,233 @@ +// qlogging.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +enum QtMsgType +{ + QtDebugMsg, + QtWarningMsg, + QtCriticalMsg, + QtFatalMsg, + QtSystemMsg, + QtInfoMsg, +}; + +class QMessageLogContext /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + int line; + const char *file; + const char *function; + const char *category; +}; + +class QMessageLogger +{ +%TypeHeaderCode +#include +%End + +public: + QMessageLogger(); + QMessageLogger(const char *file, int line, const char *function); + QMessageLogger(const char *file, int line, const char *function, const char *category); + void debug(const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->debug("%s", a0); + Py_END_ALLOW_THREADS +%End + + void debug(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->debug(*a0, "%s", a1); + Py_END_ALLOW_THREADS +%End + + void info(const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->info("%s", a0); + Py_END_ALLOW_THREADS +%End + + void info(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->info(*a0, "%s", a1); + Py_END_ALLOW_THREADS +%End + + void warning(const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->warning("%s", a0); + Py_END_ALLOW_THREADS +%End + + void warning(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->warning(*a0, "%s", a1); + Py_END_ALLOW_THREADS +%End + + void critical(const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->critical("%s", a0); + Py_END_ALLOW_THREADS +%End + + void critical(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->critical(*a0, "%s", a1); + Py_END_ALLOW_THREADS +%End + + void fatal(const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->fatal("%s", a0); + Py_END_ALLOW_THREADS +%End + +%If (Qt_6_5_0 -) + void fatal(const QLoggingCategory &cat, const char *msg) const /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->fatal(*a0, "%s", a1); + Py_END_ALLOW_THREADS +%End + +%End + +private: + QMessageLogger(const QMessageLogger &); +}; + +void qCritical(const char *msg) /ReleaseGIL/; +%MethodCode + const char *file, *function; + int line = qpycore_current_context(&file, &function); + + Py_BEGIN_ALLOW_THREADS + QMessageLogger(file, line, function).critical("%s", a0); + Py_END_ALLOW_THREADS +%End + +void qDebug(const char *msg) /ReleaseGIL/; +%MethodCode + const char *file, *function; + int line = qpycore_current_context(&file, &function); + + Py_BEGIN_ALLOW_THREADS + QMessageLogger(file, line, function).debug("%s", a0); + Py_END_ALLOW_THREADS +%End + +void qFatal(const char *msg) /ReleaseGIL/; +%MethodCode + const char *file, *function; + int line = qpycore_current_context(&file, &function); + + Py_BEGIN_ALLOW_THREADS + QMessageLogger(file, line, function).fatal("%s", a0); + Py_END_ALLOW_THREADS +%End + +void qInfo(const char *msg) /ReleaseGIL/; +%MethodCode + const char *file, *function; + int line = qpycore_current_context(&file, &function); + + Py_BEGIN_ALLOW_THREADS + QMessageLogger(file, line, function).info("%s", a0); + Py_END_ALLOW_THREADS +%End + +void qWarning(const char *msg) /ReleaseGIL/; +%MethodCode + const char *file, *function; + int line = qpycore_current_context(&file, &function); + + Py_BEGIN_ALLOW_THREADS + QMessageLogger(file, line, function).warning("%s", a0); + Py_END_ALLOW_THREADS +%End + +SIP_PYCALLABLE qInstallMessageHandler(SIP_PYCALLABLE /AllowNone,TypeHint="Optional[Callable[[QtMsgType, QMessageLogContext, QString], None]]"/) /TypeHint="Optional[Callable[[QtMsgType, QMessageLogContext, QString], None]]"/; +%MethodCode + // Treat None as the default handler. + QtMessageHandler old = qInstallMessageHandler((a0 != Py_None) ? qtcore_MessageHandler : 0); + + // If we recognise the old handler, then return it. Otherwise return + // the default handler. This doesn't exactly mimic the Qt behaviour + // but it is probably close enough for the way it will be used. + sipRes = (old == qtcore_MessageHandler) ? qtcore_PyMessageHandler : Py_None; + Py_INCREF(sipRes); + + // Save the new Python handler. + Py_XDECREF(qtcore_PyMessageHandler); + qtcore_PyMessageHandler = a0; + Py_INCREF(qtcore_PyMessageHandler); +%End + +// Module code needed by qInstallMessageHandler(). +%ModuleCode +// The user supplied Python handler. +static PyObject *qtcore_PyMessageHandler = 0; + +// The C++ wrapper around the Python handler. +static void qtcore_MessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + PyObject *res; + + SIP_BLOCK_THREADS + + res = sipCallMethod(0, qtcore_PyMessageHandler, "FDD", type, sipType_QtMsgType, &context, sipType_QMessageLogContext, NULL, &msg, sipType_QString, NULL); + + Py_XDECREF(res); + + if (res != NULL && res != Py_None) + { + PyErr_SetString(PyExc_TypeError, "invalid result type from PyQt message handler"); + res = NULL; + } + + if (res == NULL) + pyqt6_err_print(); + + SIP_UNBLOCK_THREADS +} +%End +void qSetMessagePattern(const QString &messagePattern); +QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, const QString &buf); diff --git a/sip/QtCore/qloggingcategory.sip b/sip/QtCore/qloggingcategory.sip new file mode 100644 index 0000000..6ad43ec --- /dev/null +++ b/sip/QtCore/qloggingcategory.sip @@ -0,0 +1,45 @@ +// qloggingcategory.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLoggingCategory +{ +%TypeHeaderCode +#include +%End + +public: + QLoggingCategory(const char *category, QtMsgType severityLevel = QtDebugMsg); + ~QLoggingCategory(); + bool isEnabled(QtMsgType type) const; + void setEnabled(QtMsgType type, bool enable); + bool isDebugEnabled() const; + bool isInfoEnabled() const; + bool isWarningEnabled() const; + bool isCriticalEnabled() const; + const char *categoryName() const; + QLoggingCategory &operator()(); + static QLoggingCategory *defaultCategory(); + static void setFilterRules(const QString &rules); + +private: + QLoggingCategory(const QLoggingCategory &); +}; diff --git a/sip/QtCore/qmargins.sip b/sip/QtCore/qmargins.sip new file mode 100644 index 0000000..e4e9fde --- /dev/null +++ b/sip/QtCore/qmargins.sip @@ -0,0 +1,113 @@ +// qmargins.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMargins +{ +%TypeHeaderCode +#include +%End + +public: + QMargins(); + QMargins(int aleft, int atop, int aright, int abottom); + bool isNull() const; + int left() const; + int top() const; + int right() const; + int bottom() const; + void setLeft(int aleft); + void setTop(int atop); + void setRight(int aright); + void setBottom(int abottom); + QMargins &operator+=(const QMargins &margins); + QMargins &operator-=(const QMargins &margins); + QMargins &operator*=(int factor /Constrained/); + QMargins &operator/=(int divisor /Constrained/); + QMargins &operator*=(qreal factor); + QMargins &operator/=(qreal divisor); + QMargins &operator+=(int margin); + QMargins &operator-=(int margin); +%If (Qt_6_4_0 -) + QMarginsF toMarginsF() const; +%End +}; + +bool operator==(const QMargins &m1, const QMargins &m2); +bool operator!=(const QMargins &m1, const QMargins &m2); +QDataStream &operator<<(QDataStream &, const QMargins & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMargins & /Constrained/) /ReleaseGIL/; +QMargins operator+(const QMargins &m1, const QMargins &m2); +QMargins operator-(const QMargins &m1, const QMargins &m2); +QMargins operator*(const QMargins &margins, int factor /Constrained/); +QMargins operator*(const QMargins &margins, qreal factor); +QMargins operator/(const QMargins &margins, int divisor /Constrained/); +QMargins operator/(const QMargins &margins, qreal divisor); +QMargins operator+(const QMargins &lhs, int rhs); +QMargins operator+(int lhs, const QMargins &rhs); +QMargins operator-(const QMargins &lhs, int rhs); +QMargins operator+(const QMargins &margins); +QMargins operator-(const QMargins &margins); +QMargins operator|(const QMargins &m1, const QMargins &m2); + +class QMarginsF +{ +%TypeHeaderCode +#include +%End + +public: + QMarginsF(); + QMarginsF(qreal aleft, qreal atop, qreal aright, qreal abottom); + QMarginsF(const QMargins &margins); + bool isNull() const; + qreal left() const; + qreal top() const; + qreal right() const; + qreal bottom() const; + void setLeft(qreal aleft); + void setTop(qreal atop); + void setRight(qreal aright); + void setBottom(qreal abottom); + QMarginsF &operator+=(const QMarginsF &margins); + QMarginsF &operator-=(const QMarginsF &margins); + QMarginsF &operator+=(qreal addend); + QMarginsF &operator-=(qreal subtrahend); + QMarginsF &operator*=(qreal factor); + QMarginsF &operator/=(qreal divisor); + QMargins toMargins() const; +}; + +QDataStream &operator<<(QDataStream &, const QMarginsF & /Constrained/); +QDataStream &operator>>(QDataStream &, QMarginsF & /Constrained/); +bool operator==(const QMarginsF &lhs, const QMarginsF &rhs); +bool operator!=(const QMarginsF &lhs, const QMarginsF &rhs); +QMarginsF operator+(const QMarginsF &lhs, const QMarginsF &rhs); +QMarginsF operator-(const QMarginsF &lhs, const QMarginsF &rhs); +QMarginsF operator+(const QMarginsF &lhs, qreal rhs); +QMarginsF operator+(qreal lhs, const QMarginsF &rhs); +QMarginsF operator-(const QMarginsF &lhs, qreal rhs); +QMarginsF operator*(const QMarginsF &lhs, qreal rhs); +QMarginsF operator*(qreal lhs, const QMarginsF &rhs); +QMarginsF operator/(const QMarginsF &lhs, qreal divisor); +QMarginsF operator+(const QMarginsF &margins); +QMarginsF operator-(const QMarginsF &margins); +QMarginsF operator|(const QMarginsF &m1, const QMarginsF &m2); diff --git a/sip/QtCore/qmessageauthenticationcode.sip b/sip/QtCore/qmessageauthenticationcode.sip new file mode 100644 index 0000000..00944d7 --- /dev/null +++ b/sip/QtCore/qmessageauthenticationcode.sip @@ -0,0 +1,55 @@ +// qmessageauthenticationcode.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMessageAuthenticationCode +{ +%TypeHeaderCode +#include +%End + +public: + QMessageAuthenticationCode(QCryptographicHash::Algorithm method, const QByteArray &key = QByteArray()); + ~QMessageAuthenticationCode(); + void reset(); + void setKey(const QByteArray &key); + void addData(SIP_PYBUFFER); +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + sipCpp->addData(reinterpret_cast(bi.bi_buf), bi.bi_len); + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + + bool addData(QIODevice *device); + QByteArray result() const; + static QByteArray hash(const QByteArray &message, const QByteArray &key, QCryptographicHash::Algorithm method); + +private: + QMessageAuthenticationCode(const QMessageAuthenticationCode &); +}; diff --git a/sip/QtCore/qmetaobject.sip b/sip/QtCore/qmetaobject.sip new file mode 100644 index 0000000..2a0333f --- /dev/null +++ b/sip/QtCore/qmetaobject.sip @@ -0,0 +1,270 @@ +// qmetaobject.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMetaMethod +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// Raise an exception when QMetaMethod::invoke() returns false. +static void qtcore_invoke_exception() +{ + PyErr_SetString(PyExc_RuntimeError, "QMetaMethod.invoke() call failed"); +} +%End + +public: + QMetaMethod(); + const char *typeName() const; + QList parameterTypes() const; + QList parameterNames() const; + const char *tag() const; + + enum Access + { + Private, + Protected, + Public, + }; + + QMetaMethod::Access access() const; + + enum MethodType + { + Method, + Signal, + Slot, + Constructor, + }; + + QMetaMethod::MethodType methodType() const; + SIP_PYOBJECT invoke(QObject *object, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const; +%MethodCode + // Raise an exception if the call failed. + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = sipCpp->invoke(a0, *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10); + Py_END_ALLOW_THREADS + + if (ok) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + qtcore_invoke_exception(); + } +%End + + SIP_PYOBJECT invoke(QObject *object, Qt::ConnectionType connectionType, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const; +%MethodCode + // Raise an exception if the call failed. + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = sipCpp->invoke(a0, a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, *a11); + Py_END_ALLOW_THREADS + + if (ok) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + qtcore_invoke_exception(); + } +%End + + SIP_PYOBJECT invoke(QObject *object, QGenericReturnArgument returnValue /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const; +%MethodCode + // Raise an exception if the call failed. + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = sipCpp->invoke(a0, *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, + *a11); + Py_END_ALLOW_THREADS + + if (ok) + sipRes = qpycore_ReturnValue(a1Wrapper); + else + + qtcore_invoke_exception(); +%End + + SIP_PYOBJECT invoke(QObject *object, Qt::ConnectionType connectionType, QGenericReturnArgument returnValue /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const; +%MethodCode + // Raise an exception if the call failed. + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = sipCpp->invoke(a0, a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, *a11, + *a12); + Py_END_ALLOW_THREADS + + if (ok) + sipRes = qpycore_ReturnValue(a2Wrapper); + else + qtcore_invoke_exception(); +%End + + int methodIndex() const; + bool isValid() const; + QByteArray methodSignature() const; + QByteArray name() const; + int returnType() const; + int parameterCount() const; + int parameterType(int index) const; + QMetaType returnMetaType() const; + QMetaType parameterMetaType(int index) const; + QByteArray parameterTypeName(int index) const; + int relativeMethodIndex() const; +%If (Qt_6_2_0 -) + bool isConst() const; +%End +}; + +class QMetaEnum +{ +%TypeHeaderCode +#include +%End + +public: + QMetaEnum(); + const char *name() const; + bool isFlag() const; + int keyCount() const; + const char *key(int index) const; + int value(int index) const; + const char *scope() const; + int keyToValue(const char *key, bool *ok = 0) const; + const char *valueToKey(int value) const; + int keysToValue(const char *keys, bool *ok = 0) const; + QByteArray valueToKeys(int value) const; + bool isValid() const; + bool isScoped() const; + const char *enumName() const; +}; + +class QMetaProperty +{ +%TypeHeaderCode +#include +%End + +public: + QMetaProperty(); + const char *name() const; + const char *typeName() const; + bool isReadable() const; + bool isWritable() const; + bool isDesignable() const; + bool isScriptable() const; + bool isStored() const; + bool isFlagType() const; + bool isEnumType() const; + QMetaEnum enumerator() const; + SIP_PYOBJECT read(const QObject *obj) const /TypeHint="Any"/; +%MethodCode + // Make use of the QMetaProperty to provide the extra information to correctly + // handle enums. + sipRes = qpycore_PyObject_FromQVariant(*sipCpp, sipCpp->read(a0)); +%End + + bool write(QObject *obj, const QVariant &value) const; +%MethodCode + // If it looks like we are trying to write an int to an enum then we are + // probably trying to write to an unregistered enum. Converting the int to the + // name of the corresponding key should work (although this isn't a documented + // feature). + + QMetaEnum me = sipCpp->enumerator(); + if (me.isValid() && a1->typeId() == QMetaType::Int) + { + QString key; + + if (me.isFlag()) + { + key = QString(me.valueToKeys(a1->toInt())); + } + else + { + const char *key_s = me.valueToKey(a1->toInt()); + + if (key_s) + { + key = QString(key_s); + } + else + { + PyErr_Format(PyExc_ValueError, "%S is not a valid enum member", a1); + sipIsErr = 1; + } + } + + if (!sipIsErr) + *const_cast(a1) = QVariant(key); + } + + if (!sipIsErr) + sipRes = sipCpp->write(a0, *a1); +%End + + bool reset(QObject *obj) const; + bool hasStdCppSet() const; + bool isValid() const; + bool isResettable() const; + bool isUser() const; + int userType() const; + bool hasNotifySignal() const; + QMetaMethod notifySignal() const; + int notifySignalIndex() const; + int propertyIndex() const; + bool isConstant() const; + bool isFinal() const; + int relativePropertyIndex() const; + bool isRequired() const; + QMetaType metaType() const; + bool isBindable() const; + int typeId() const; +}; + +class QMetaClassInfo +{ +%TypeHeaderCode +#include +%End + +public: + QMetaClassInfo(); + const char *name() const; + const char *value() const; +}; + +bool operator==(const QMetaMethod &m1, const QMetaMethod &m2); +bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2); diff --git a/sip/QtCore/qmetatype.sip b/sip/QtCore/qmetatype.sip new file mode 100644 index 0000000..d0f664b --- /dev/null +++ b/sip/QtCore/qmetatype.sip @@ -0,0 +1,191 @@ +// qmetatype.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMetaType +{ +%TypeHeaderCode +#include +%End + +public: + enum Type + { + UnknownType, + Void, + Bool, + Int, + UInt, + LongLong, + ULongLong, + Double, + QChar, + QVariantMap, + QVariantList, + QVariantHash, + QString, + QStringList, + QByteArray, + QBitArray, + QDate, + QTime, + QDateTime, + QUrl, + QLocale, + QRect, + QRectF, + QSize, + QSizeF, + QLine, + QLineF, + QPoint, + QPointF, + LastCoreType, + FirstGuiType, + QFont, + QPixmap, + QBrush, + QColor, + QPalette, + QIcon, + QImage, + QPolygon, + QRegion, + QBitmap, + QCursor, + QSizePolicy, + QKeySequence, + QPen, + QTextLength, + QTextFormat, + QTransform, + VoidStar, + Long, + Short, + Char, + Char16, + Char32, + ULong, + UShort, + UChar, + Float, +%If (Qt_6_5_0 -) + Float16, +%End + QObjectStar, + QMatrix4x4, + QVector2D, + QVector3D, + QVector4D, + QQuaternion, + QEasingCurve, + QVariant, + QUuid, + QModelIndex, + QPolygonF, + SChar, + QRegularExpression, + QJsonValue, + QJsonObject, + QJsonArray, + QJsonDocument, + QByteArrayList, + QPersistentModelIndex, + QCborSimpleType, + QCborValue, + QCborArray, + QCborMap, + QColorSpace, + QVariantPair, + User, + }; + + static bool isRegistered(int type); + QMetaType(); + explicit QMetaType(int type); + + enum TypeFlag /BaseType=Flag/ + { + NeedsConstruction, + NeedsDestruction, + PointerToQObject, + IsEnumeration, + IsUnsignedEnumeration, + IsPointer, + RelocatableType, + IsQmlList, +%If (Qt_6_2_0 -) + IsConst, +%End +%If (Qt_6_5_0 -) + NeedsCopyConstruction, +%End +%If (Qt_6_5_0 -) + NeedsMoveConstruction, +%End + }; + + typedef QFlags TypeFlags; + qsizetype sizeOf() const; + QMetaType::TypeFlags flags() const; + bool isValid() const; + bool isRegistered() const; + int id() const; +%If (Qt_6_1_0 -) + bool hasRegisteredDataStreamOperators() const; +%End + bool hasRegisteredDebugStreamOperator() const; + const char *name() const /Encoding="None"/; + qsizetype alignOf() const; + bool isEqualityComparable() const; + bool isOrdered() const; + static QMetaType fromName(QByteArrayView name); + static bool canConvert(QMetaType fromType, QMetaType toType); + static bool canView(QMetaType fromType, QMetaType toType); +%If (Qt_6_4_0 -) + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + +%End +%If (Qt_6_5_0 -) + void registerType() const; +%End +%If (Qt_6_5_0 -) + bool isDefaultConstructible() const; +%End +%If (Qt_6_5_0 -) + bool isCopyConstructible() const; +%End +%If (Qt_6_5_0 -) + bool isMoveConstructible() const; +%End +%If (Qt_6_5_0 -) + bool isDestructible() const; +%End + +private: + QMetaType(const QMetaType &); +}; + +bool operator==(QMetaType a, QMetaType b); +bool operator!=(QMetaType a, QMetaType b); diff --git a/sip/QtCore/qmimedata.sip b/sip/QtCore/qmimedata.sip new file mode 100644 index 0000000..a8ddc91 --- /dev/null +++ b/sip/QtCore/qmimedata.sip @@ -0,0 +1,56 @@ +// qmimedata.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMimeData : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QMimeData(); + virtual ~QMimeData(); + QList urls() const; + void setUrls(const QList &urls); + bool hasUrls() const; + QString text() const; + void setText(const QString &text); + bool hasText() const; + QString html() const; + void setHtml(const QString &html); + bool hasHtml() const; + QVariant imageData() const; + void setImageData(const QVariant &image); + bool hasImage() const; + QVariant colorData() const; + void setColorData(const QVariant &color); + bool hasColor() const; + QByteArray data(const QString &mimetype) const; + void setData(const QString &mimetype, const QByteArray &data); + virtual bool hasFormat(const QString &mimetype) const; + virtual QStringList formats() const; + void clear(); + void removeFormat(const QString &mimetype); + +protected: + virtual QVariant retrieveData(const QString &mimetype, QMetaType preferredType) const; +}; diff --git a/sip/QtCore/qmimedatabase.sip b/sip/QtCore/qmimedatabase.sip new file mode 100644 index 0000000..40c401f --- /dev/null +++ b/sip/QtCore/qmimedatabase.sip @@ -0,0 +1,54 @@ +// qmimedatabase.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMimeDatabase +{ +%TypeHeaderCode +#include +%End + +public: + QMimeDatabase(); + ~QMimeDatabase(); + QMimeType mimeTypeForName(const QString &nameOrAlias) const; + + enum MatchMode + { + MatchDefault, + MatchExtension, + MatchContent, + }; + + QMimeType mimeTypeForFile(const QString &fileName, QMimeDatabase::MatchMode mode = QMimeDatabase::MatchDefault) const; + QMimeType mimeTypeForFile(const QFileInfo &fileInfo, QMimeDatabase::MatchMode mode = QMimeDatabase::MatchDefault) const; + QList mimeTypesForFileName(const QString &fileName) const; + QMimeType mimeTypeForData(const QByteArray &data) const; + QMimeType mimeTypeForData(QIODevice *device) const; + QMimeType mimeTypeForUrl(const QUrl &url) const; + QMimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device) const; + QMimeType mimeTypeForFileNameAndData(const QString &fileName, const QByteArray &data) const; + QString suffixForFileName(const QString &fileName) const; + QList allMimeTypes() const; + +private: + QMimeDatabase(const QMimeDatabase &); +}; diff --git a/sip/QtCore/qmimetype.sip b/sip/QtCore/qmimetype.sip new file mode 100644 index 0000000..97e6901 --- /dev/null +++ b/sip/QtCore/qmimetype.sip @@ -0,0 +1,54 @@ +// qmimetype.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMimeType +{ +%TypeHeaderCode +#include +%End + +public: + QMimeType(); + QMimeType(const QMimeType &other); + ~QMimeType(); + void swap(QMimeType &other /Constrained/); + bool operator==(const QMimeType &other) const; + bool operator!=(const QMimeType &other) const; + bool isValid() const; + bool isDefault() const; + QString name() const; + QString comment() const; + QString genericIconName() const; + QString iconName() const; + QStringList globPatterns() const; + QStringList parentMimeTypes() const; + QStringList allAncestors() const; + QStringList aliases() const; + QStringList suffixes() const; + QString preferredSuffix() const; + bool inherits(const QString &mimeTypeName) const; + QString filterString() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; diff --git a/sip/QtCore/qmutex.sip b/sip/QtCore/qmutex.sip new file mode 100644 index 0000000..1f6d7f4 --- /dev/null +++ b/sip/QtCore/qmutex.sip @@ -0,0 +1,57 @@ +// qmutex.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMutex +{ +%TypeHeaderCode +#include +%End + +public: + QMutex(); + ~QMutex(); +// Methods from QBasicMutex. +void lock() /ReleaseGIL/; +bool tryLock() /ReleaseGIL/; +void unlock() /ReleaseGIL/; + bool tryLock(int timeout) /ReleaseGIL/; + +private: + QMutex(const QMutex &); +}; + +class QRecursiveMutex +{ +%TypeHeaderCode +#include +%End + +public: + QRecursiveMutex(); + ~QRecursiveMutex(); + void lock() /ReleaseGIL/; + bool tryLock(int timeout = 0) /ReleaseGIL/; + void unlock() /ReleaseGIL/; + +private: + QRecursiveMutex(const QRecursiveMutex &); +}; diff --git a/sip/QtCore/qmutexlocker.sip b/sip/QtCore/qmutexlocker.sip new file mode 100644 index 0000000..cc17a6b --- /dev/null +++ b/sip/QtCore/qmutexlocker.sip @@ -0,0 +1,65 @@ +// This is the SIP interface definition for the QMutexLocker class. +// +// In Qt6 this is a template so we wrap our own class that implements the Qt5 +// API. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class PyQtMutexLocker /PyName=QMutexLocker/ +{ +%TypeHeaderCode +#include "qpycore_pyqtmutexlocker.h" +%End + +public: + PyQtMutexLocker(QMutex *mutex /GetWrapper/) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp = new PyQtMutexLocker(a0, a0Wrapper); + Py_END_ALLOW_THREADS +%End + + PyQtMutexLocker(QRecursiveMutex *mutex /GetWrapper/) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp = new PyQtMutexLocker(a0, a0Wrapper); + Py_END_ALLOW_THREADS +%End + + ~PyQtMutexLocker(); + + SIP_PYOBJECT mutex() /TypeHint="Union[QMutex, QRecursiveMutex]"/; + void unlock() /ReleaseGIL/; + void relock() /ReleaseGIL/; + + SIP_PYOBJECT __enter__(); +%MethodCode + // Just return a reference to self. + sipRes = sipSelf; + Py_INCREF(sipRes); +%End + + void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback); +%MethodCode + sipCpp->unlock(); +%End + +private: + PyQtMutexLocker(const PyQtMutexLocker &); +}; diff --git a/sip/QtCore/qnamespace.sip b/sip/QtCore/qnamespace.sip new file mode 100644 index 0000000..cabbe2e --- /dev/null +++ b/sip/QtCore/qnamespace.sip @@ -0,0 +1,1610 @@ +// qnamespace.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +namespace Qt +{ +%TypeHeaderCode +#include +%End + + enum GlobalColor + { + color0, + color1, + black, + white, + darkGray, + gray, + lightGray, + red, + green, + blue, + cyan, + magenta, + yellow, + darkRed, + darkGreen, + darkBlue, + darkCyan, + darkMagenta, + darkYellow, + transparent, + }; + + enum KeyboardModifier /BaseType=Flag/ + { + NoModifier, + ShiftModifier, + ControlModifier, + AltModifier, + MetaModifier, + KeypadModifier, + GroupSwitchModifier, + KeyboardModifierMask, + }; + + typedef QFlags KeyboardModifiers; + + enum Modifier /BaseType=Flag/ + { + META, + SHIFT, + CTRL, + ALT, + MODIFIER_MASK, + }; + + typedef QFlags Modifiers; + + enum MouseButton /BaseType=Flag/ + { + NoButton, + AllButtons, + LeftButton, + RightButton, + MiddleButton, + XButton1, + XButton2, + BackButton, + ExtraButton1, + ForwardButton, + ExtraButton2, + TaskButton, + ExtraButton3, + ExtraButton4, + ExtraButton5, + ExtraButton6, + ExtraButton7, + ExtraButton8, + ExtraButton9, + ExtraButton10, + ExtraButton11, + ExtraButton12, + ExtraButton13, + ExtraButton14, + ExtraButton15, + ExtraButton16, + ExtraButton17, + ExtraButton18, + ExtraButton19, + ExtraButton20, + ExtraButton21, + ExtraButton22, + ExtraButton23, + ExtraButton24, + }; + + typedef QFlags MouseButtons; + + enum Orientation /BaseType=Flag/ + { + Horizontal, + Vertical, + }; + + typedef QFlags Orientations; + + enum FocusPolicy /BaseType=IntFlag/ + { + NoFocus, + TabFocus, + ClickFocus, + StrongFocus, + WheelFocus, + }; + + enum SortOrder + { + AscendingOrder, + DescendingOrder, + }; + + enum AlignmentFlag /BaseType=IntFlag/ + { + AlignLeft, + AlignLeading, + AlignRight, + AlignTrailing, + AlignHCenter, + AlignJustify, + AlignAbsolute, + AlignHorizontal_Mask, + AlignTop, + AlignBottom, + AlignVCenter, + AlignVertical_Mask, + AlignCenter, + AlignBaseline, + }; + + typedef QFlags Alignment; + + enum TextFlag /BaseType=IntFlag/ + { + TextSingleLine, + TextDontClip, + TextExpandTabs, + TextShowMnemonic, + TextWordWrap, + TextWrapAnywhere, + TextDontPrint, + TextIncludeTrailingSpaces, + TextHideMnemonic, + TextJustificationForced, + }; + + enum TextElideMode + { + ElideLeft, + ElideRight, + ElideMiddle, + ElideNone, + }; + + enum WindowType /BaseType=IntFlag/ + { + Widget, + Window, + Dialog, + Sheet, + Drawer, + Popup, + Tool, + ToolTip, + SplashScreen, + Desktop, + SubWindow, + WindowType_Mask, + MSWindowsFixedSizeDialogHint, + MSWindowsOwnDC, + X11BypassWindowManagerHint, + FramelessWindowHint, + CustomizeWindowHint, + WindowTitleHint, + WindowSystemMenuHint, + WindowMinimizeButtonHint, + WindowMaximizeButtonHint, + WindowMinMaxButtonsHint, + WindowContextHelpButtonHint, + WindowShadeButtonHint, + WindowStaysOnTopHint, + WindowStaysOnBottomHint, + WindowCloseButtonHint, + MacWindowToolBarButtonHint, + BypassGraphicsProxyWidget, + WindowTransparentForInput, + WindowOverridesSystemGestures, + WindowDoesNotAcceptFocus, + NoDropShadowWindowHint, + WindowFullscreenButtonHint, + ForeignWindow, + BypassWindowManagerHint, + CoverWindow, + MaximizeUsingFullscreenGeometryHint, + }; + + typedef QFlags WindowFlags; + + enum WindowState /BaseType=Flag/ + { + WindowNoState, + WindowMinimized, + WindowMaximized, + WindowFullScreen, + WindowActive, + }; + + typedef QFlags WindowStates; + + enum WidgetAttribute + { + WA_Disabled, + WA_UnderMouse, + WA_MouseTracking, + WA_OpaquePaintEvent, + WA_StaticContents, + WA_LaidOut, + WA_PaintOnScreen, + WA_NoSystemBackground, + WA_UpdatesDisabled, + WA_Mapped, + WA_InputMethodEnabled, + WA_WState_Visible, + WA_WState_Hidden, + WA_ForceDisabled, + WA_KeyCompression, + WA_PendingMoveEvent, + WA_PendingResizeEvent, + WA_SetPalette, + WA_SetFont, + WA_SetCursor, + WA_NoChildEventsFromChildren, + WA_WindowModified, + WA_Resized, + WA_Moved, + WA_PendingUpdate, + WA_InvalidSize, + WA_CustomWhatsThis, + WA_LayoutOnEntireRect, + WA_OutsideWSRange, + WA_GrabbedShortcut, + WA_TransparentForMouseEvents, + WA_PaintUnclipped, + WA_SetWindowIcon, + WA_NoMouseReplay, + WA_DeleteOnClose, + WA_RightToLeft, + WA_SetLayoutDirection, + WA_NoChildEventsForParent, + WA_ForceUpdatesDisabled, + WA_WState_Created, + WA_WState_CompressKeys, + WA_WState_InPaintEvent, + WA_WState_Reparented, + WA_WState_ConfigPending, + WA_WState_Polished, + WA_WState_OwnSizePolicy, + WA_WState_ExplicitShowHide, + WA_MouseNoMask, + WA_NoMousePropagation, + WA_Hover, + WA_InputMethodTransparent, + WA_QuitOnClose, + WA_KeyboardFocusChange, + WA_AcceptDrops, + WA_WindowPropagation, + WA_NoX11EventCompression, + WA_TintedBackground, + WA_X11OpenGLOverlay, + WA_AttributeCount, + WA_AlwaysShowToolTips, + WA_MacOpaqueSizeGrip, + WA_SetStyle, + WA_SetLocale, + WA_MacShowFocusRect, + WA_MacNormalSize, + WA_MacSmallSize, + WA_MacMiniSize, + WA_LayoutUsesWidgetRect, + WA_StyledBackground, + WA_MacAlwaysShowToolWindow, + WA_StyleSheet, + WA_ShowWithoutActivating, + WA_NativeWindow, + WA_DontCreateNativeAncestors, + WA_DontShowOnScreen, + WA_X11NetWmWindowTypeDesktop, + WA_X11NetWmWindowTypeDock, + WA_X11NetWmWindowTypeToolBar, + WA_X11NetWmWindowTypeMenu, + WA_X11NetWmWindowTypeUtility, + WA_X11NetWmWindowTypeSplash, + WA_X11NetWmWindowTypeDialog, + WA_X11NetWmWindowTypeDropDownMenu, + WA_X11NetWmWindowTypePopupMenu, + WA_X11NetWmWindowTypeToolTip, + WA_X11NetWmWindowTypeNotification, + WA_X11NetWmWindowTypeCombo, + WA_X11NetWmWindowTypeDND, + WA_TranslucentBackground, + WA_AcceptTouchEvents, + WA_TouchPadAcceptSingleTouchEvents, + WA_X11DoNotAcceptFocus, + WA_AlwaysStackOnTop, + WA_TabletTracking, + WA_ContentsMarginsRespectsSafeArea, + WA_StyleSheetTarget, + }; + + enum ImageConversionFlag /BaseType=Flag/ + { + AutoColor, + ColorOnly, + MonoOnly, + ThresholdAlphaDither, + OrderedAlphaDither, + DiffuseAlphaDither, + DiffuseDither, + OrderedDither, + ThresholdDither, + AutoDither, + PreferDither, + AvoidDither, + NoOpaqueDetection, + NoFormatConversion, + }; + + typedef QFlags ImageConversionFlags; + + enum BGMode + { + TransparentMode, + OpaqueMode, + }; + + enum Key /BaseType=IntEnum/ + { + Key_Escape, + Key_Tab, + Key_Backtab, + Key_Backspace, + Key_Return, + Key_Enter, + Key_Insert, + Key_Delete, + Key_Pause, + Key_Print, + Key_SysReq, + Key_Clear, + Key_Home, + Key_End, + Key_Left, + Key_Up, + Key_Right, + Key_Down, + Key_PageUp, + Key_PageDown, + Key_Shift, + Key_Control, + Key_Meta, + Key_Alt, + Key_CapsLock, + Key_NumLock, + Key_ScrollLock, + Key_F1, + Key_F2, + Key_F3, + Key_F4, + Key_F5, + Key_F6, + Key_F7, + Key_F8, + Key_F9, + Key_F10, + Key_F11, + Key_F12, + Key_F13, + Key_F14, + Key_F15, + Key_F16, + Key_F17, + Key_F18, + Key_F19, + Key_F20, + Key_F21, + Key_F22, + Key_F23, + Key_F24, + Key_F25, + Key_F26, + Key_F27, + Key_F28, + Key_F29, + Key_F30, + Key_F31, + Key_F32, + Key_F33, + Key_F34, + Key_F35, + Key_Super_L, + Key_Super_R, + Key_Menu, + Key_Hyper_L, + Key_Hyper_R, + Key_Help, + Key_Direction_L, + Key_Direction_R, + Key_Space, + Key_Any, + Key_Exclam, + Key_QuoteDbl, + Key_NumberSign, + Key_Dollar, + Key_Percent, + Key_Ampersand, + Key_Apostrophe, + Key_ParenLeft, + Key_ParenRight, + Key_Asterisk, + Key_Plus, + Key_Comma, + Key_Minus, + Key_Period, + Key_Slash, + Key_0, + Key_1, + Key_2, + Key_3, + Key_4, + Key_5, + Key_6, + Key_7, + Key_8, + Key_9, + Key_Colon, + Key_Semicolon, + Key_Less, + Key_Equal, + Key_Greater, + Key_Question, + Key_At, + Key_A, + Key_B, + Key_C, + Key_D, + Key_E, + Key_F, + Key_G, + Key_H, + Key_I, + Key_J, + Key_K, + Key_L, + Key_M, + Key_N, + Key_O, + Key_P, + Key_Q, + Key_R, + Key_S, + Key_T, + Key_U, + Key_V, + Key_W, + Key_X, + Key_Y, + Key_Z, + Key_BracketLeft, + Key_Backslash, + Key_BracketRight, + Key_AsciiCircum, + Key_Underscore, + Key_QuoteLeft, + Key_BraceLeft, + Key_Bar, + Key_BraceRight, + Key_AsciiTilde, + Key_nobreakspace, + Key_exclamdown, + Key_cent, + Key_sterling, + Key_currency, + Key_yen, + Key_brokenbar, + Key_section, + Key_diaeresis, + Key_copyright, + Key_ordfeminine, + Key_guillemotleft, + Key_notsign, + Key_hyphen, + Key_registered, + Key_macron, + Key_degree, + Key_plusminus, + Key_twosuperior, + Key_threesuperior, + Key_acute, + Key_mu, + Key_paragraph, + Key_periodcentered, + Key_cedilla, + Key_onesuperior, + Key_masculine, + Key_guillemotright, + Key_onequarter, + Key_onehalf, + Key_threequarters, + Key_questiondown, + Key_Agrave, + Key_Aacute, + Key_Acircumflex, + Key_Atilde, + Key_Adiaeresis, + Key_Aring, + Key_AE, + Key_Ccedilla, + Key_Egrave, + Key_Eacute, + Key_Ecircumflex, + Key_Ediaeresis, + Key_Igrave, + Key_Iacute, + Key_Icircumflex, + Key_Idiaeresis, + Key_ETH, + Key_Ntilde, + Key_Ograve, + Key_Oacute, + Key_Ocircumflex, + Key_Otilde, + Key_Odiaeresis, + Key_multiply, + Key_Ooblique, + Key_Ugrave, + Key_Uacute, + Key_Ucircumflex, + Key_Udiaeresis, + Key_Yacute, + Key_THORN, + Key_ssharp, + Key_division, + Key_ydiaeresis, + Key_AltGr, + Key_Multi_key, + Key_Codeinput, + Key_SingleCandidate, + Key_MultipleCandidate, + Key_PreviousCandidate, + Key_Mode_switch, + Key_Kanji, + Key_Muhenkan, + Key_Henkan, + Key_Romaji, + Key_Hiragana, + Key_Katakana, + Key_Hiragana_Katakana, + Key_Zenkaku, + Key_Hankaku, + Key_Zenkaku_Hankaku, + Key_Touroku, + Key_Massyo, + Key_Kana_Lock, + Key_Kana_Shift, + Key_Eisu_Shift, + Key_Eisu_toggle, + Key_Hangul, + Key_Hangul_Start, + Key_Hangul_End, + Key_Hangul_Hanja, + Key_Hangul_Jamo, + Key_Hangul_Romaja, + Key_Hangul_Jeonja, + Key_Hangul_Banja, + Key_Hangul_PreHanja, + Key_Hangul_PostHanja, + Key_Hangul_Special, + Key_Dead_Grave, + Key_Dead_Acute, + Key_Dead_Circumflex, + Key_Dead_Tilde, + Key_Dead_Macron, + Key_Dead_Breve, + Key_Dead_Abovedot, + Key_Dead_Diaeresis, + Key_Dead_Abovering, + Key_Dead_Doubleacute, + Key_Dead_Caron, + Key_Dead_Cedilla, + Key_Dead_Ogonek, + Key_Dead_Iota, + Key_Dead_Voiced_Sound, + Key_Dead_Semivoiced_Sound, + Key_Dead_Belowdot, + Key_Dead_Hook, + Key_Dead_Horn, + Key_Back, + Key_Forward, + Key_Stop, + Key_Refresh, + Key_VolumeDown, + Key_VolumeMute, + Key_VolumeUp, + Key_BassBoost, + Key_BassUp, + Key_BassDown, + Key_TrebleUp, + Key_TrebleDown, + Key_MediaPlay, + Key_MediaStop, + Key_MediaPrevious, + Key_MediaNext, + Key_MediaRecord, + Key_HomePage, + Key_Favorites, + Key_Search, + Key_Standby, + Key_OpenUrl, + Key_LaunchMail, + Key_LaunchMedia, + Key_Launch0, + Key_Launch1, + Key_Launch2, + Key_Launch3, + Key_Launch4, + Key_Launch5, + Key_Launch6, + Key_Launch7, + Key_Launch8, + Key_Launch9, + Key_LaunchA, + Key_LaunchB, + Key_LaunchC, + Key_LaunchD, + Key_LaunchE, + Key_LaunchF, + Key_MediaLast, + Key_Select, + Key_Yes, + Key_No, + Key_Context1, + Key_Context2, + Key_Context3, + Key_Context4, + Key_Call, + Key_Hangup, + Key_Flip, + Key_unknown, + Key_Execute, + Key_Printer, + Key_Play, + Key_Sleep, + Key_Zoom, + Key_Cancel, + Key_MonBrightnessUp, + Key_MonBrightnessDown, + Key_KeyboardLightOnOff, + Key_KeyboardBrightnessUp, + Key_KeyboardBrightnessDown, + Key_PowerOff, + Key_WakeUp, + Key_Eject, + Key_ScreenSaver, + Key_WWW, + Key_Memo, + Key_LightBulb, + Key_Shop, + Key_History, + Key_AddFavorite, + Key_HotLinks, + Key_BrightnessAdjust, + Key_Finance, + Key_Community, + Key_AudioRewind, + Key_BackForward, + Key_ApplicationLeft, + Key_ApplicationRight, + Key_Book, + Key_CD, + Key_Calculator, + Key_ToDoList, + Key_ClearGrab, + Key_Close, + Key_Copy, + Key_Cut, + Key_Display, + Key_DOS, + Key_Documents, + Key_Excel, + Key_Explorer, + Key_Game, + Key_Go, + Key_iTouch, + Key_LogOff, + Key_Market, + Key_Meeting, + Key_MenuKB, + Key_MenuPB, + Key_MySites, + Key_News, + Key_OfficeHome, + Key_Option, + Key_Paste, + Key_Phone, + Key_Calendar, + Key_Reply, + Key_Reload, + Key_RotateWindows, + Key_RotationPB, + Key_RotationKB, + Key_Save, + Key_Send, + Key_Spell, + Key_SplitScreen, + Key_Support, + Key_TaskPane, + Key_Terminal, + Key_Tools, + Key_Travel, + Key_Video, + Key_Word, + Key_Xfer, + Key_ZoomIn, + Key_ZoomOut, + Key_Away, + Key_Messenger, + Key_WebCam, + Key_MailForward, + Key_Pictures, + Key_Music, + Key_Battery, + Key_Bluetooth, + Key_WLAN, + Key_UWB, + Key_AudioForward, + Key_AudioRepeat, + Key_AudioRandomPlay, + Key_Subtitle, + Key_AudioCycleTrack, + Key_Time, + Key_Hibernate, + Key_View, + Key_TopMenu, + Key_PowerDown, + Key_Suspend, + Key_ContrastAdjust, + Key_MediaPause, + Key_MediaTogglePlayPause, + Key_LaunchG, + Key_LaunchH, + Key_ToggleCallHangup, + Key_VoiceDial, + Key_LastNumberRedial, + Key_Camera, + Key_CameraFocus, + Key_TouchpadToggle, + Key_TouchpadOn, + Key_TouchpadOff, + Key_MicMute, + Key_Red, + Key_Green, + Key_Yellow, + Key_Blue, + Key_ChannelUp, + Key_ChannelDown, + Key_Guide, + Key_Info, + Key_Settings, + Key_Exit, + Key_MicVolumeUp, + Key_MicVolumeDown, + Key_New, + Key_Open, + Key_Find, + Key_Undo, + Key_Redo, + Key_Dead_Stroke, + Key_Dead_Abovecomma, + Key_Dead_Abovereversedcomma, + Key_Dead_Doublegrave, + Key_Dead_Belowring, + Key_Dead_Belowmacron, + Key_Dead_Belowcircumflex, + Key_Dead_Belowtilde, + Key_Dead_Belowbreve, + Key_Dead_Belowdiaeresis, + Key_Dead_Invertedbreve, + Key_Dead_Belowcomma, + Key_Dead_Currency, + Key_Dead_a, + Key_Dead_A, + Key_Dead_e, + Key_Dead_E, + Key_Dead_i, + Key_Dead_I, + Key_Dead_o, + Key_Dead_O, + Key_Dead_u, + Key_Dead_U, + Key_Dead_Small_Schwa, + Key_Dead_Capital_Schwa, + Key_Dead_Greek, + Key_Dead_Lowline, + Key_Dead_Aboveverticalline, + Key_Dead_Belowverticalline, + Key_Dead_Longsolidusoverlay, + }; + + enum ArrowType + { + NoArrow, + UpArrow, + DownArrow, + LeftArrow, + RightArrow, + }; + + enum PenStyle + { + NoPen, + SolidLine, + DashLine, + DotLine, + DashDotLine, + DashDotDotLine, + CustomDashLine, + }; + + enum PenCapStyle + { + FlatCap, + SquareCap, + RoundCap, + }; + + enum PenJoinStyle + { + MiterJoin, + BevelJoin, + RoundJoin, + MPenJoinStyle, + SvgMiterJoin, + }; + + enum BrushStyle + { + NoBrush, + SolidPattern, + Dense1Pattern, + Dense2Pattern, + Dense3Pattern, + Dense4Pattern, + Dense5Pattern, + Dense6Pattern, + Dense7Pattern, + HorPattern, + VerPattern, + CrossPattern, + BDiagPattern, + FDiagPattern, + DiagCrossPattern, + LinearGradientPattern, + RadialGradientPattern, + ConicalGradientPattern, + TexturePattern, + }; + + enum UIEffect + { + UI_General, + UI_AnimateMenu, + UI_FadeMenu, + UI_AnimateCombo, + UI_AnimateTooltip, + UI_FadeTooltip, + UI_AnimateToolBox, + }; + + enum CursorShape + { + ArrowCursor, + UpArrowCursor, + CrossCursor, + WaitCursor, + IBeamCursor, + SizeVerCursor, + SizeHorCursor, + SizeBDiagCursor, + SizeFDiagCursor, + SizeAllCursor, + BlankCursor, + SplitVCursor, + SplitHCursor, + PointingHandCursor, + ForbiddenCursor, + OpenHandCursor, + ClosedHandCursor, + WhatsThisCursor, + BusyCursor, + LastCursor, + BitmapCursor, + CustomCursor, + DragCopyCursor, + DragMoveCursor, + DragLinkCursor, + }; + + enum TextFormat + { + PlainText, + RichText, + AutoText, + MarkdownText, + }; + + enum AspectRatioMode + { + IgnoreAspectRatio, + KeepAspectRatio, + KeepAspectRatioByExpanding, + }; + + enum DockWidgetArea /BaseType=Flag/ + { + LeftDockWidgetArea, + RightDockWidgetArea, + TopDockWidgetArea, + BottomDockWidgetArea, + AllDockWidgetAreas, + NoDockWidgetArea, + }; + + typedef QFlags DockWidgetAreas; + + enum TimerType + { + PreciseTimer, + CoarseTimer, + VeryCoarseTimer, + }; + + enum ToolBarArea /BaseType=Flag/ + { + LeftToolBarArea, + RightToolBarArea, + TopToolBarArea, + BottomToolBarArea, + AllToolBarAreas, + NoToolBarArea, + }; + + typedef QFlags ToolBarAreas; + + enum DateFormat + { + TextDate, + ISODate, + ISODateWithMs, + RFC2822Date, + }; + + enum TimeSpec + { + LocalTime, + UTC, + OffsetFromUTC, + TimeZone, + }; + + enum DayOfWeek + { + Monday, + Tuesday, + Wednesday, + Thursday, + Friday, + Saturday, + Sunday, + }; + + enum ScrollBarPolicy + { + ScrollBarAsNeeded, + ScrollBarAlwaysOff, + ScrollBarAlwaysOn, + }; + + enum CaseSensitivity + { + CaseInsensitive, + CaseSensitive, + }; + + enum Corner + { + TopLeftCorner, + TopRightCorner, + BottomLeftCorner, + BottomRightCorner, + }; + + enum ConnectionType + { + AutoConnection, + DirectConnection, + QueuedConnection, + BlockingQueuedConnection, + UniqueConnection, + SingleShotConnection, + }; + + enum ShortcutContext + { + WidgetShortcut, + WindowShortcut, + ApplicationShortcut, + WidgetWithChildrenShortcut, + }; + + enum FillRule + { + OddEvenFill, + WindingFill, + }; + + enum ClipOperation + { + NoClip, + ReplaceClip, + IntersectClip, + }; + + enum TransformationMode + { + FastTransformation, + SmoothTransformation, + }; + + enum FocusReason + { + MouseFocusReason, + TabFocusReason, + BacktabFocusReason, + ActiveWindowFocusReason, + PopupFocusReason, + ShortcutFocusReason, + MenuBarFocusReason, + OtherFocusReason, + NoFocusReason, + }; + + enum ContextMenuPolicy + { + NoContextMenu, + PreventContextMenu, + DefaultContextMenu, + ActionsContextMenu, + CustomContextMenu, + }; + + enum InputMethodQuery /BaseType=Flag/ + { + ImFont, + ImCursorPosition, + ImSurroundingText, + ImCurrentSelection, + ImMaximumTextLength, + ImAnchorPosition, + ImEnabled, + ImCursorRectangle, + ImHints, + ImPreferredLanguage, + ImPlatformData, + ImQueryInput, + ImQueryAll, + ImAbsolutePosition, + ImTextBeforeCursor, + ImTextAfterCursor, + ImEnterKeyType, + ImAnchorRectangle, + ImInputItemClipRectangle, +%If (Qt_6_2_0 -) + ImReadOnly, +%End + }; + + typedef QFlags InputMethodQueries; + + enum ToolButtonStyle + { + ToolButtonIconOnly, + ToolButtonTextOnly, + ToolButtonTextBesideIcon, + ToolButtonTextUnderIcon, + ToolButtonFollowStyle, + }; + + enum LayoutDirection + { + LeftToRight, + RightToLeft, + LayoutDirectionAuto, + }; + + enum DropAction /BaseType=Flag/ + { + CopyAction, + MoveAction, + LinkAction, + ActionMask, + TargetMoveAction, + IgnoreAction, + }; + + typedef QFlags DropActions; + + enum CheckState + { + Unchecked, + PartiallyChecked, + Checked, + }; + + enum ItemDataRole /BaseType=IntEnum/ + { + DisplayRole, + DecorationRole, + EditRole, + ToolTipRole, + StatusTipRole, + WhatsThisRole, + FontRole, + TextAlignmentRole, + BackgroundRole, + ForegroundRole, + CheckStateRole, + AccessibleTextRole, + AccessibleDescriptionRole, + SizeHintRole, + InitialSortOrderRole, + UserRole, + }; + + enum ItemFlag /BaseType=Flag/ + { + NoItemFlags, + ItemIsSelectable, + ItemIsEditable, + ItemIsDragEnabled, + ItemIsDropEnabled, + ItemIsUserCheckable, + ItemIsEnabled, + ItemNeverHasChildren, + ItemIsUserTristate, + ItemIsAutoTristate, + }; + + typedef QFlags ItemFlags; + + enum MatchFlag /BaseType=Flag/ + { + MatchExactly, + MatchFixedString, + MatchContains, + MatchStartsWith, + MatchEndsWith, + MatchWildcard, + MatchCaseSensitive, + MatchWrap, + MatchRecursive, + MatchRegularExpression, + }; + + typedef QFlags MatchFlags; + typedef void *HANDLE; + + enum WindowModality + { + NonModal, + WindowModal, + ApplicationModal, + }; + + enum ApplicationAttribute + { + AA_DontShowIconsInMenus, + AA_NativeWindows, + AA_DontCreateNativeWidgetSiblings, + AA_DontUseNativeMenuBar, + AA_MacDontSwapCtrlAndMeta, + AA_Use96Dpi, + AA_SynthesizeTouchForUnhandledMouseEvents, + AA_SynthesizeMouseForUnhandledTouchEvents, + AA_ForceRasterWidgets, + AA_UseDesktopOpenGL, + AA_UseOpenGLES, + AA_UseSoftwareOpenGL, + AA_ShareOpenGLContexts, + AA_SetPalette, + AA_PluginApplication, + AA_UseStyleSheetPropagationInWidgetStyles, + AA_DontUseNativeDialogs, + AA_SynthesizeMouseForUnhandledTabletEvents, + AA_CompressHighFrequencyEvents, + AA_DontCheckOpenGLContextThreadAffinity, + AA_DisableShaderDiskCache, + AA_DontShowShortcutsInContextMenus, + AA_CompressTabletEvents, + AA_DisableSessionManager, + AA_DisableNativeVirtualKeyboard, + }; + + enum ItemSelectionMode + { + ContainsItemShape, + IntersectsItemShape, + ContainsItemBoundingRect, + IntersectsItemBoundingRect, + }; + + enum TextInteractionFlag /BaseType=Flag/ + { + NoTextInteraction, + TextSelectableByMouse, + TextSelectableByKeyboard, + LinksAccessibleByMouse, + LinksAccessibleByKeyboard, + TextEditable, + TextEditorInteraction, + TextBrowserInteraction, + }; + + typedef QFlags TextInteractionFlags; + + enum MaskMode + { + MaskInColor, + MaskOutColor, + }; + + enum Axis + { + XAxis, + YAxis, + ZAxis, + }; + + enum EventPriority + { + HighEventPriority, + NormalEventPriority, + LowEventPriority, + }; + + enum SizeMode + { + AbsoluteSize, + RelativeSize, + }; + + enum SizeHint + { + MinimumSize, + PreferredSize, + MaximumSize, + MinimumDescent, + }; + + enum WindowFrameSection + { + NoSection, + LeftSection, + TopLeftSection, + TopSection, + TopRightSection, + RightSection, + BottomRightSection, + BottomSection, + BottomLeftSection, + TitleBarArea, + }; + + enum TileRule + { + StretchTile, + RepeatTile, + RoundTile, + }; + + enum InputMethodHint /BaseType=Flag/ + { + ImhNone, + ImhHiddenText, + ImhNoAutoUppercase, + ImhPreferNumbers, + ImhPreferUppercase, + ImhPreferLowercase, + ImhNoPredictiveText, + ImhDigitsOnly, + ImhFormattedNumbersOnly, + ImhUppercaseOnly, + ImhLowercaseOnly, + ImhDialableCharactersOnly, + ImhEmailCharactersOnly, + ImhUrlCharactersOnly, + ImhExclusiveInputMask, + ImhSensitiveData, + ImhDate, + ImhTime, + ImhPreferLatin, + ImhLatinOnly, + ImhMultiLine, + ImhNoEditMenu, + ImhNoTextHandles, + }; + + typedef QFlags InputMethodHints; + + enum AnchorPoint + { + AnchorLeft, + AnchorHorizontalCenter, + AnchorRight, + AnchorTop, + AnchorVerticalCenter, + AnchorBottom, + }; + + enum CoordinateSystem + { + DeviceCoordinates, + LogicalCoordinates, + }; + + enum TouchPointState /BaseType=Flag/ + { + TouchPointUnknownState, + TouchPointPressed, + TouchPointMoved, + TouchPointStationary, + TouchPointReleased, + }; + + typedef QFlags TouchPointStates; + + enum GestureState + { + GestureStarted, + GestureUpdated, + GestureFinished, + GestureCanceled, + }; + + enum GestureType /BaseType=IntEnum/ + { + TapGesture, + TapAndHoldGesture, + PanGesture, + PinchGesture, + SwipeGesture, + CustomGesture, + }; + + enum GestureFlag /BaseType=Flag/ + { + DontStartGestureOnChildren, + ReceivePartialGestures, + IgnoredGesturesPropagateToParent, + }; + + typedef QFlags GestureFlags; + + enum NavigationMode + { + NavigationModeNone, + NavigationModeKeypadTabOrder, + NavigationModeKeypadDirectional, + NavigationModeCursorAuto, + NavigationModeCursorForceVisible, + }; + + enum CursorMoveStyle + { + LogicalMoveStyle, + VisualMoveStyle, + }; + + enum ScreenOrientation /BaseType=Flag/ + { + PrimaryOrientation, + PortraitOrientation, + LandscapeOrientation, + InvertedPortraitOrientation, + InvertedLandscapeOrientation, + }; + + typedef QFlags ScreenOrientations; + + enum FindChildOption /BaseType=Flag/ + { + FindDirectChildrenOnly, + FindChildrenRecursively, + }; + + typedef QFlags FindChildOptions; + + enum WhiteSpaceMode + { + WhiteSpaceNormal, + WhiteSpacePre, + WhiteSpaceNoWrap, + WhiteSpaceModeUndefined, + }; + + enum HitTestAccuracy + { + ExactHit, + FuzzyHit, + }; + + enum ApplicationState /BaseType=Flag/ + { + ApplicationSuspended, + ApplicationHidden, + ApplicationInactive, + ApplicationActive, + }; + + typedef QFlags ApplicationStates; + + enum Edge /BaseType=Flag/ + { + TopEdge, + LeftEdge, + RightEdge, + BottomEdge, + }; + + typedef QFlags Edges; + + enum NativeGestureType + { + BeginNativeGesture, + EndNativeGesture, + PanNativeGesture, + ZoomNativeGesture, + SmartZoomNativeGesture, + RotateNativeGesture, + SwipeNativeGesture, + }; + + enum ScrollPhase + { + ScrollBegin, + ScrollUpdate, + ScrollEnd, + NoScrollPhase, + ScrollMomentum, + }; + + enum MouseEventSource + { + MouseEventNotSynthesized, + MouseEventSynthesizedBySystem, + MouseEventSynthesizedByQt, + MouseEventSynthesizedByApplication, + }; + + enum MouseEventFlag /BaseType=Flag/ + { + MouseEventCreatedDoubleClick, + }; + + typedef QFlags MouseEventFlags; + + enum TabFocusBehavior + { + NoTabFocus, + TabFocusTextControls, + TabFocusListControls, + TabFocusAllControls, + }; + + enum ItemSelectionOperation + { + ReplaceSelection, + AddToSelection, + }; + + enum EnterKeyType + { + EnterKeyDefault, + EnterKeyReturn, + EnterKeyDone, + EnterKeyGo, + EnterKeySend, + EnterKeySearch, + EnterKeyNext, + EnterKeyPrevious, + }; + + enum ChecksumType + { + ChecksumIso3309, + ChecksumItuV41, + }; + + enum class HighDpiScaleFactorRoundingPolicy + { + Round, + Ceil, + Floor, + RoundPreferFloor, + PassThrough, + }; + +%If (Qt_6_5_0 -) + + enum class ColorScheme + { + Unknown, + Light, + Dark, + }; + +%End +%If (Qt_6_5_0 -) + + enum class PermissionStatus + { + Undetermined, + Granted, + Denied, + }; + +%End +}; + +class QKeyCombination +{ +%TypeHeaderCode +#include +%End + +public: + QKeyCombination(Qt::Key key = Qt::Key_unknown); + QKeyCombination(Qt::Modifiers modifiers, Qt::Key key = Qt::Key_unknown); + QKeyCombination(Qt::KeyboardModifiers modifiers, Qt::Key key = Qt::Key_unknown); + Qt::KeyboardModifiers keyboardModifiers() const; + Qt::Key key() const; + static QKeyCombination fromCombined(int combined); + int toCombined() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +bool operator==(QKeyCombination lhs, QKeyCombination rhs); +bool operator!=(QKeyCombination lhs, QKeyCombination rhs); +QKeyCombination operator|(Qt::Key key, Qt::KeyboardModifiers modifiers); +%MethodCode + sipRes = new QKeyCombination(*a1, a0); +%End + +QKeyCombination operator|(Qt::Key key, Qt::Modifiers modifiers); +%MethodCode + sipRes = new QKeyCombination(*a1, a0); +%End + +QKeyCombination operator|(Qt::KeyboardModifier modifier, Qt::Key key); +%MethodCode + sipRes = new QKeyCombination(a0, a1); +%End + +Qt::KeyboardModifiers operator|(Qt::KeyboardModifier, Qt::KeyboardModifier); +QKeyCombination operator|(Qt::Modifier modifier, Qt::Key key); +%MethodCode + sipRes = new QKeyCombination(a0, a1); +%End + +Qt::Modifiers operator|(Qt::Modifier, Qt::Modifier); diff --git a/sip/QtCore/qnumeric.sip b/sip/QtCore/qnumeric.sip new file mode 100644 index 0000000..df22b24 --- /dev/null +++ b/sip/QtCore/qnumeric.sip @@ -0,0 +1,48 @@ +// qnumeric.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +bool qIsInf(double d); +bool qIsFinite(double d); +bool qIsNaN(double d); +double qInf(); +double qSNaN(); +double qQNaN(); +quint64 qFloatDistance(double a, double b); +%If (Qt_6_5_0 -) +double qAbs(const double &t); +%End +%If (Qt_6_5_0 -) +int qRound(double d); +%End +%If (Qt_6_5_0 -) +qint64 qRound64(double d); +%End +%If (Qt_6_5_0 -) +bool qFuzzyCompare(double p1, double p2); +%End +%If (Qt_6_5_0 -) +bool qFuzzyIsNull(double d); +%End diff --git a/sip/QtCore/qobject.sip b/sip/QtCore/qobject.sip new file mode 100644 index 0000000..a6563ad --- /dev/null +++ b/sip/QtCore/qobject.sip @@ -0,0 +1,624 @@ +// qobject.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +typedef QList QObjectList; + +class QObject /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// This is needed by the tr() handwritten implementation. +#include + + +// These are the helper functions for QObject::findChild() and +// QObject::findChildren. + +// Wrap the given type in a 1-tuple. +static PyObject *qtcore_type_to_tuple(PyObject *type) +{ + PyObject *tuple = PyTuple_New(1); + + if (tuple) + { + Py_INCREF(type); + PyTuple_SetItem(tuple, 0, type); + } + + return tuple; +} + + +// Check all elements of a given tuple are type objects and return a new +// reference to the tuple if so. +static PyObject *qtcore_check_tuple_types(PyObject *types) +{ + for (Py_ssize_t i = 0; i < PyTuple_Size(types); ++i) + if (!PyObject_TypeCheck(PyTuple_GetItem(types, i), &PyType_Type)) + { + PyErr_SetString(PyExc_TypeError, + "all elements of the types argument must be type objects"); + return 0; + } + + Py_INCREF(types); + return types; +} + + +// Do the main work of finding a child. +static PyObject *qtcore_do_find_child(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options) +{ + const QObjectList &children = parent->children(); + int i; + + for (i = 0; i < children.size(); ++i) + { + QObject *obj = children.at(i); + PyObject *pyo = sipConvertFromType(obj, sipType_QObject, 0); + + if (!pyo) + return 0; + + // Allow for proxies. + QObject *resolved = reinterpret_cast(sipGetAddress((sipSimpleWrapper *)pyo)); + + if (name.isNull() || resolved->objectName() == name) + for (Py_ssize_t t = 0; t < PyTuple_Size(types); ++t) + if (PyType_IsSubtype(Py_TYPE(pyo), (PyTypeObject *)PyTuple_GetItem(types, t))) + return pyo; + + Py_DECREF(pyo); + } + + if (options == Qt::FindChildrenRecursively) + for (i = 0; i < children.size(); ++i) + { + PyObject *pyo = qtcore_do_find_child(children.at(i), types, name, options); + + if (pyo != Py_None) + return pyo; + + Py_DECREF(pyo); + } + + Py_INCREF(Py_None); + return Py_None; +} + + +// Find a child that is one of a number of types and with an optional name. +static PyObject *qtcore_FindChild(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options) +{ + // Check that the types checking was successful. + if (!types) + return 0; + + PyObject *child = qtcore_do_find_child(parent, types, name, options); + + Py_DECREF(types); + + return child; +} + + +// Do the main work of finding the children with a string name. +static bool qtcore_do_find_children(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options, PyObject *list) +{ + const QObjectList &children = parent->children(); + int i; + + for (i = 0; i < children.size(); ++i) + { + QObject *obj = children.at(i); + PyObject *pyo = sipConvertFromType(obj, sipType_QObject, 0); + + if (!pyo) + return false; + + // Allow for proxies. + QObject *resolved = reinterpret_cast(sipGetAddress((sipSimpleWrapper *)pyo)); + + if (name.isNull() || resolved->objectName() == name) + for (Py_ssize_t t = 0; t < PyTuple_Size(types); ++t) + if (PyType_IsSubtype(Py_TYPE(pyo), (PyTypeObject *)PyTuple_GetItem(types, t))) + if (PyList_Append(list, pyo) < 0) + { + Py_DECREF(pyo); + return false; + } + + Py_DECREF(pyo); + + if (options == Qt::FindChildrenRecursively) + { + bool ok = qtcore_do_find_children(obj, types, name, options, list); + + if (!ok) + return false; + } + } + + return true; +} + + +// Find a child that is one of a number of types and with an optional string +// name. +static PyObject *qtcore_FindChildren(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options) +{ + // Check that the types checking was successful. + if (!types) + return 0; + + PyObject *list = PyList_New(0); + + if (list) + if (!qtcore_do_find_children(parent, types, name, options, list)) + Py_DECREF(list); + + Py_DECREF(types); + + return list; +} + + +// Do the main work of finding the children with a QRegularExpression name. +static bool qtcore_do_find_children(const QObject *parent, PyObject *types, const QRegularExpression &re, Qt::FindChildOptions options, PyObject *list) +{ + const QObjectList &children = parent->children(); + int i; + + for (i = 0; i < children.size(); ++i) + { + QObject *obj = children.at(i); + PyObject *pyo = sipConvertFromType(obj, sipType_QObject, 0); + + if (!pyo) + return false; + + QRegularExpressionMatch m = re.match(obj->objectName()); + + if (m.hasMatch()) + for (Py_ssize_t t = 0; t < PyTuple_Size(types); ++t) + if (PyType_IsSubtype(Py_TYPE(pyo), (PyTypeObject *)PyTuple_GetItem(types, t))) + if (PyList_Append(list, pyo) < 0) + { + Py_DECREF(pyo); + return false; + } + + Py_DECREF(pyo); + + if (options == Qt::FindChildrenRecursively) + { + bool ok = qtcore_do_find_children(obj, types, re, options, list); + + if (!ok) + return false; + } + } + + return true; +} + + +// Find a child that is one of a number of types and with an optional +// QRegularExpression name. +static PyObject *qtcore_FindChildren(const QObject *parent, PyObject *types, const QRegularExpression &re, Qt::FindChildOptions options) +{ + // Check that the types checking was successful. + if (!types) + return 0; + + PyObject *list = PyList_New(0); + + if (list) + if (!qtcore_do_find_children(parent, types, re, options, list)) + Py_DECREF(list); + + Py_DECREF(types); + + return list; +} +%End + +%FinalisationCode + return qpycore_qobject_finalisation(sipSelf, sipCpp, sipKwds, sipUnused); +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QAbstractAnimation, &sipType_QAbstractAnimation, 23, 1}, + {sipName_QAbstractEventDispatcher, &sipType_QAbstractEventDispatcher, -1, 2}, + {sipName_QAbstractItemModel, &sipType_QAbstractItemModel, 29, 3}, + {sipName_QIODevice, &sipType_QIODevice, 37, 4}, + {sipName_QCoreApplication, &sipType_QCoreApplication, -1, 5}, + {sipName_QEventLoop, &sipType_QEventLoop, -1, 6}, + {sipName_QFileSelector, &sipType_QFileSelector, -1, 7}, + {sipName_QFileSystemWatcher, &sipType_QFileSystemWatcher, -1, 8}, + {sipName_QItemSelectionModel, &sipType_QItemSelectionModel, -1, 9}, + {sipName_QLibrary, &sipType_QLibrary, -1, 10}, + {sipName_QMimeData, &sipType_QMimeData, -1, 11}, + {sipName_QObjectCleanupHandler, &sipType_QObjectCleanupHandler, -1, 12}, + {sipName_QPluginLoader, &sipType_QPluginLoader, -1, 13}, + {sipName_QSettings, &sipType_QSettings, -1, 14}, + {sipName_QSharedMemory, &sipType_QSharedMemory, -1, 15}, + {sipName_QSignalMapper, &sipType_QSignalMapper, -1, 16}, + {sipName_QSocketNotifier, &sipType_QSocketNotifier, -1, 17}, + {sipName_QThread, &sipType_QThread, -1, 18}, + {sipName_QThreadPool, &sipType_QThreadPool, -1, 19}, + {sipName_QTimeLine, &sipType_QTimeLine, -1, 20}, + {sipName_QTimer, &sipType_QTimer, -1, 21}, + {sipName_QTranslator, &sipType_QTranslator, -1, 22}, + #if defined(Q_OS_WIN) + {sipName_QWinEventNotifier, &sipType_QWinEventNotifier, -1, -1}, + #else + {0, 0, -1, -1}, + #endif + {sipName_QAnimationGroup, &sipType_QAnimationGroup, 26, 24}, + {sipName_QPauseAnimation, &sipType_QPauseAnimation, -1, 25}, + {sipName_QVariantAnimation, &sipType_QVariantAnimation, 28, -1}, + {sipName_QParallelAnimationGroup, &sipType_QParallelAnimationGroup, -1, 27}, + {sipName_QSequentialAnimationGroup, &sipType_QSequentialAnimationGroup, -1, -1}, + {sipName_QPropertyAnimation, &sipType_QPropertyAnimation, -1, -1}, + {sipName_QAbstractListModel, &sipType_QAbstractListModel, 33, 30}, + {sipName_QAbstractProxyModel, &sipType_QAbstractProxyModel, 34, 31}, + {sipName_QAbstractTableModel, &sipType_QAbstractTableModel, -1, 32}, + {sipName_QConcatenateTablesProxyModel, &sipType_QConcatenateTablesProxyModel, -1, -1}, + {sipName_QStringListModel, &sipType_QStringListModel, -1, -1}, + {sipName_QIdentityProxyModel, &sipType_QIdentityProxyModel, -1, 35}, + {sipName_QSortFilterProxyModel, &sipType_QSortFilterProxyModel, -1, 36}, + {sipName_QTransposeProxyModel, &sipType_QTransposeProxyModel, -1, -1}, + {sipName_QBuffer, &sipType_QBuffer, -1, 38}, + {sipName_QFileDevice, &sipType_QFileDevice, 40, 39}, + #if !defined(QT_NO_PROCESS) + {sipName_QProcess, &sipType_QProcess, -1, -1}, + #else + {0, 0, -1, -1}, + #endif + {sipName_QFile, &sipType_QFile, 42, 41}, + {sipName_QSaveFile, &sipType_QSaveFile, -1, -1}, + {sipName_QTemporaryFile, &sipType_QTemporaryFile, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +%GCTraverseCode + // Traverse any saved slots we might be connected to. + sipRes = qpycore_visitSlotProxies(sipCpp, sipVisit, sipArg); +%End + +%GCClearCode + // Clear any saved slots we might be connected to. + sipRes = qpycore_clearSlotProxies(sipCpp); +%End + +public: + static const QMetaObject staticMetaObject { +%GetCode + sipPy = qpycore_qobject_staticmetaobject(sipPyType); +%End + + }; + const QMetaObject *metaObject() const; + explicit QObject(QObject *parent /TransferThis/ = 0); + virtual ~QObject(); + void pyqtConfigure(SIP_PYOBJECT) /NoArgParser/; +%Docstring +QObject.pyqtConfigure(...) + +Each keyword argument is either the name of a Qt property or a Qt signal. +For properties the property is set to the given value which should be of an +appropriate type. +For signals the signal is connected to the given value which should be a +callable. +%End + +%MethodCode + return qpycore_pyqtconfigure(sipSelf, sipArgs, sipKwds); +%End + + SIP_PYOBJECT __getattr__(const char *name /Encoding="UTF-8"/) const /NoTypeHint/; +%MethodCode + sipRes = qpycore_qobject_getattr(sipCpp, sipSelf, a0); +%End + + virtual bool event(QEvent *); + virtual bool eventFilter(QObject *, QEvent *); + static QString tr(const char *sourceText /Encoding="UTF-8"/, const char *disambiguation = 0, int n = -1); +%MethodCode + sipRes = new QString(QCoreApplication::translate(sipPyTypeName((PyTypeObject *)sipSelf), a0, a1, a2)); +%End + + SIP_PYOBJECT findChild(SIP_PYTYPE type /TypeHint="Type[QObjectT]"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="QObjectT"/; +%MethodCode + sipRes = qtcore_FindChild(sipCpp, qtcore_type_to_tuple(a0), *a1, *a2); + + if (!sipRes) + sipIsErr = 1; +%End + + SIP_PYOBJECT findChild(SIP_PYTUPLE types /TypeHint="Tuple[Type[QObjectT], ...]", TypeHintValue="()"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="QObjectT"/; +%MethodCode + sipRes = qtcore_FindChild(sipCpp, qtcore_check_tuple_types(a0), *a1, *a2); + + if (!sipRes) + sipIsErr = 1; +%End + + SIP_PYLIST findChildren(SIP_PYTYPE type /TypeHint="Type[QObjectT]"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/; +%MethodCode + sipRes = qtcore_FindChildren(sipCpp, qtcore_type_to_tuple(a0), *a1, *a2); + + if (!sipRes) + sipIsErr = 1; +%End + + SIP_PYLIST findChildren(SIP_PYTUPLE types /TypeHint="Tuple[Type[QObjectT], ...]", TypeHintValue="()"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/; +%MethodCode + sipRes = qtcore_FindChildren(sipCpp, qtcore_check_tuple_types(a0), *a1, *a2); + + if (!sipRes) + sipIsErr = 1; +%End + + SIP_PYLIST findChildren(SIP_PYTYPE type /TypeHint="Type[QObjectT]"/, const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/; +%MethodCode + sipRes = qtcore_FindChildren(sipCpp, qtcore_type_to_tuple(a0), *a1, *a2); + + if (!sipRes) + sipIsErr = 1; +%End + + SIP_PYLIST findChildren(SIP_PYTUPLE types /TypeHint="Tuple[Type[QObjectT], ...]", TypeHintValue="()"/, const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/; +%MethodCode + sipRes = qtcore_FindChildren(sipCpp, qtcore_check_tuple_types(a0), *a1, *a2); + + if (!sipRes) + sipIsErr = 1; +%End + + QString objectName() const; +%If (Qt_6_4_0 -) + void setObjectName(QAnyStringView name); +%End +%If (- Qt_6_4_0) + void setObjectName(const QString &name); +%End + bool isWidgetType() const; + bool isWindowType() const; + bool signalsBlocked() const; + bool blockSignals(bool b); + QThread *thread() const; + void moveToThread(QThread *thread); + int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer); + void killTimer(int id); + const QObjectList &children() const; + void setParent(QObject * /TransferThis/); + void installEventFilter(QObject *); + void removeEventFilter(QObject *); + void dumpObjectInfo() const; + void dumpObjectTree() const; + QList dynamicPropertyNames() const; + bool setProperty(const char *name, const QVariant &value); + QVariant property(const char *name) const; + +signals: + void destroyed(QObject *object = 0); + void objectNameChanged(const QString &objectName); + +public: + QObject *parent() const; + bool inherits(const char *classname) const; + +public slots: + void deleteLater() /TransferThis/; + +protected: + QObject *sender() const /ReleaseGIL/; +%MethodCode + // sender() must be called without the GIL to avoid possible deadlocks between + // the GIL and Qt's internal thread data mutex. + + Py_BEGIN_ALLOW_THREADS + + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipCpp->sender(); + #else + sipRes = sipCpp->sipProtect_sender(); + #endif + + Py_END_ALLOW_THREADS + + if (!sipRes) + { + typedef QObject *(*qtcore_qobject_sender_t)(); + + static qtcore_qobject_sender_t qtcore_qobject_sender = 0; + + if (!qtcore_qobject_sender) + { + qtcore_qobject_sender = (qtcore_qobject_sender_t)sipImportSymbol("qtcore_qobject_sender"); + Q_ASSERT(qtcore_qobject_sender); + } + + sipRes = qtcore_qobject_sender(); + } +%End + + int receivers(SIP_PYOBJECT signal /TypeHint="PYQT_SIGNAL"/) const [int (const char *signal)]; +%MethodCode + // We need to handle the signal object. Import the helper if it hasn't already + // been done. + typedef sipErrorState (*pyqt6_get_signal_signature_t)(PyObject *, const QObject *, const QByteArray &); + + static pyqt6_get_signal_signature_t pyqt6_get_signal_signature = 0; + + if (!pyqt6_get_signal_signature) + { + pyqt6_get_signal_signature = (pyqt6_get_signal_signature_t)sipImportSymbol("pyqt6_get_signal_signature"); + Q_ASSERT(pyqt6_get_signal_signature); + } + + QByteArray signal_signature; + + #if defined(SIP_PROTECTED_IS_PUBLIC) + if ((sipError = pyqt6_get_signal_signature(a0, sipCpp, signal_signature)) == sipErrorNone) + { + sipRes = sipCpp->receivers(signal_signature.constData()); + } + #else + if ((sipError = pyqt6_get_signal_signature(a0, static_cast(sipCpp), signal_signature)) == sipErrorNone) + { + sipRes = sipCpp->sipProtect_receivers(signal_signature.constData()); + } + #endif + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + + virtual void timerEvent(QTimerEvent *); + virtual void childEvent(QChildEvent *); + virtual void customEvent(QEvent *); + virtual void connectNotify(const QMetaMethod &signal); + virtual void disconnectNotify(const QMetaMethod &signal); + int senderSignalIndex() const; + bool isSignalConnected(const QMetaMethod &signal) const; + +public: + static bool disconnect(const QMetaObject::Connection &); + SIP_PYOBJECT disconnect() const /TypeHint=""/; +%MethodCode + sipRes = qpycore_qobject_disconnect(sipCpp); +%End + +%If (Qt_6_4_0 -) + bool isQuickItemType() const; +%End + +private: + QObject(const QObject &); +}; + +SIP_PYOBJECT pyqtClassInfo(const char *, const char *) /NoArgParser, TypeHint=""/; +%MethodCode + return qpycore_pyqtClassInfo(sipArgs, sipKwds); +%End + +SIP_PYOBJECT pyqtEnum(SIP_PYENUM = 0) /TypeHint=""/; +%MethodCode + sipRes = qpycore_pyqtEnum(a0); +%End + +SIP_PYOBJECT pyqtSlot(... types, const char *name = 0, const char *result = 0) /NoArgParser, NoTypeHint/; +%Docstring +@pyqtSlot(*types, name: typing.Optional[str], result: typing.Optional[str]) + +This is a decorator applied to Python methods of a QObject that marks them +as Qt slots. +The non-keyword arguments are the types of the slot arguments and each may +be a Python type object or a string specifying a C++ type. +name is the name of the slot and defaults to the name of the method. +result is type of the value returned by the slot. +%End + +%MethodCode + return qpycore_pyqtslot(sipArgs, sipKwds); +%End + +SIP_PYOBJECT QT_TR_NOOP(SIP_PYOBJECT /TypeHint="str"/) /TypeHint="str"/; +%MethodCode + Py_INCREF(a0); + sipRes = a0; +%End + +SIP_PYOBJECT QT_TRANSLATE_NOOP(SIP_PYOBJECT /TypeHint="str"/, SIP_PYOBJECT /TypeHint="str"/) /TypeHint="str"/; +%MethodCode + Py_INCREF(a1); + sipRes = a1; +%End + +class QSignalBlocker +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSignalBlocker(QObject *o); + ~QSignalBlocker(); + void reblock(); + void unblock(); + SIP_PYOBJECT __enter__(); +%MethodCode + // Just return a reference to self. + sipRes = sipSelf; + Py_INCREF(sipRes); +%End + + void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback); +%MethodCode + sipCpp->unblock(); +%End + +private: + QSignalBlocker(const QSignalBlocker &); +}; + +%ModuleHeaderCode +#include "qpycore_api.h" +%End + +%InitialisationCode +qpycore_init(); +%End + +%PostInitialisationCode +qpycore_post_init(sipModuleDict); +%End diff --git a/sip/QtCore/qobjectcleanuphandler.sip b/sip/QtCore/qobjectcleanuphandler.sip new file mode 100644 index 0000000..bf7b489 --- /dev/null +++ b/sip/QtCore/qobjectcleanuphandler.sip @@ -0,0 +1,36 @@ +// qobjectcleanuphandler.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QObjectCleanupHandler : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QObjectCleanupHandler(); + virtual ~QObjectCleanupHandler(); + QObject *add(QObject *object); + void remove(QObject *object); + bool isEmpty() const; + void clear(); +}; diff --git a/sip/QtCore/qobjectdefs.sip b/sip/QtCore/qobjectdefs.sip new file mode 100644 index 0000000..1d3e323 --- /dev/null +++ b/sip/QtCore/qobjectdefs.sip @@ -0,0 +1,197 @@ +// qobjectdefs.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +struct QMetaObject +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// Raise an exception when QMetaObject::invokeMethod() returns false. +static void qtcore_invokeMethod_exception() +{ + PyErr_SetString(PyExc_RuntimeError, "QMetaObject.invokeMethod() call failed"); +} +%End + +%If (Qt_6_2_0 -) + QMetaType metaType() const; +%End + const char *className() const; + const QMetaObject *superClass() const; + QMetaProperty userProperty() const; + int methodOffset() const; + int enumeratorOffset() const; + int propertyOffset() const; + int classInfoOffset() const; + int methodCount() const; + int enumeratorCount() const; + int propertyCount() const; + int classInfoCount() const; + int indexOfMethod(const char *method) const; + int indexOfSignal(const char *signal) const; + int indexOfSlot(const char *slot) const; + int indexOfEnumerator(const char *name) const; + int indexOfProperty(const char *name) const; + int indexOfClassInfo(const char *name) const; + QMetaMethod method(int index) const; + QMetaEnum enumerator(int index) const; + QMetaProperty property(int index) const; + QMetaClassInfo classInfo(int index) const; + static bool checkConnectArgs(const char *signal, const char *method); + static void connectSlotsByName(QObject *o /GetWrapper/); +%MethodCode + qpycore_qmetaobject_connectslotsbyname(a0, a0Wrapper); + + // Make sure there is no (benign) Python exception. + PyErr_Clear(); +%End + + static QByteArray normalizedSignature(const char *method); + static QByteArray normalizedType(const char *type); + static SIP_PYOBJECT invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()); +%MethodCode + // Raise an exception if the call failed. + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = QMetaObject::invokeMethod(a0,a1,a2,*a3,*a4,*a5,*a6,*a7,*a8,*a9,*a10,*a11,*a12,*a13); + Py_END_ALLOW_THREADS + + if (ok) + sipRes = qpycore_ReturnValue(a3Wrapper); + else + qtcore_invokeMethod_exception(); +%End + + static SIP_PYOBJECT invokeMethod(QObject *obj, const char *member, QGenericReturnArgument ret /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()); +%MethodCode + // Raise an exception if the call failed. + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = QMetaObject::invokeMethod(a0,a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8,*a9,*a10,*a11,*a12); + Py_END_ALLOW_THREADS + + if (ok) + sipRes = qpycore_ReturnValue(a2Wrapper); + else + qtcore_invokeMethod_exception(); +%End + + static SIP_PYOBJECT invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()); +%MethodCode + // Raise an exception if the call failed. + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = QMetaObject::invokeMethod(a0,a1,a2,*a3,*a4,*a5,*a6,*a7,*a8,*a9,*a10,*a11,*a12); + Py_END_ALLOW_THREADS + + if (ok) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + qtcore_invokeMethod_exception(); + } +%End + + static SIP_PYOBJECT invokeMethod(QObject *obj, const char *member, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()); +%MethodCode + // Raise an exception if the call failed. + bool ok; + + Py_BEGIN_ALLOW_THREADS + ok = QMetaObject::invokeMethod(a0,a1,*a2,*a3,*a4,*a5,*a6,*a7,*a8,*a9,*a10,*a11); + Py_END_ALLOW_THREADS + + if (ok) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + qtcore_invokeMethod_exception(); + } +%End + +%If (Qt_6_5_0 -) + QObject *newInstance(QGenericArgument value0, QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const; +%End + int constructorCount() const; + int indexOfConstructor(const char *constructor) const; + QMetaMethod constructor(int index) const; + static bool checkConnectArgs(const QMetaMethod &signal, const QMetaMethod &method); + bool inherits(const QMetaObject *metaObject) const; + + class Connection + { +%TypeHeaderCode +#include +%End + + public: + Connection(); + Connection(const QMetaObject::Connection &other); + ~Connection(); + void swap(QMetaObject::Connection &o /Constrained/); + }; +}; + +// The support for Q_ARG(), Q_RETURN_ARG() and supporting classes. +class QGenericArgument /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + ~QGenericArgument(); +}; + + +SIP_PYOBJECT Q_ARG(SIP_PYOBJECT type, SIP_PYOBJECT data) /TypeHint="QGenericArgument"/; +%MethodCode + sipRes = qpycore_ArgumentFactory(a0, a1); +%End + + +class QGenericReturnArgument /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + ~QGenericReturnArgument(); +}; + + +SIP_PYOBJECT Q_RETURN_ARG(SIP_PYOBJECT type) /TypeHint="QGenericReturnArgument"/; +%MethodCode + sipRes = qpycore_ReturnFactory(a0); +%End diff --git a/sip/QtCore/qoperatingsystemversion.sip b/sip/QtCore/qoperatingsystemversion.sip new file mode 100644 index 0000000..0c139d6 --- /dev/null +++ b/sip/QtCore/qoperatingsystemversion.sip @@ -0,0 +1,223 @@ +// qoperatingsystemversion.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_3_0 -) + +class QOperatingSystemVersionBase +{ +%TypeHeaderCode +#include +%End + +protected: + QOperatingSystemVersionBase(); +}; + +%End +%If (Qt_6_3_0 -) + +class QOperatingSystemVersion : QOperatingSystemVersionBase +{ +%TypeHeaderCode +#include +%End + +public: + enum OSType + { + Unknown, + Windows, + MacOS, + IOS, + TvOS, + WatchOS, + Android, + }; + + static const QOperatingSystemVersion Windows7; + static const QOperatingSystemVersion Windows8; + static const QOperatingSystemVersion Windows8_1; + static const QOperatingSystemVersion Windows10; + static const QOperatingSystemVersion OSXMavericks; + static const QOperatingSystemVersion OSXYosemite; + static const QOperatingSystemVersion OSXElCapitan; + static const QOperatingSystemVersion MacOSSierra; + static const QOperatingSystemVersion MacOSHighSierra; + static const QOperatingSystemVersion MacOSMojave; + static const QOperatingSystemVersion MacOSCatalina; + static const QOperatingSystemVersion MacOSBigSur; + static const QOperatingSystemVersion MacOSMonterey; +%If (Qt_6_5_0 -) + static const QOperatingSystemVersionBase MacOSVentura; +%End + static const QOperatingSystemVersion AndroidJellyBean; + static const QOperatingSystemVersion AndroidJellyBean_MR1; + static const QOperatingSystemVersion AndroidJellyBean_MR2; + static const QOperatingSystemVersion AndroidKitKat; + static const QOperatingSystemVersion AndroidLollipop; + static const QOperatingSystemVersion AndroidLollipop_MR1; + static const QOperatingSystemVersion AndroidMarshmallow; + static const QOperatingSystemVersion AndroidNougat; + static const QOperatingSystemVersion AndroidNougat_MR1; + static const QOperatingSystemVersion AndroidOreo; + static const QOperatingSystemVersion AndroidOreo_MR1; + static const QOperatingSystemVersion AndroidPie; + static const QOperatingSystemVersion Android10; + static const QOperatingSystemVersion Android11; +%If (Qt_6_5_0 -) + static const QOperatingSystemVersionBase Android12; +%End +%If (Qt_6_5_0 -) + static const QOperatingSystemVersionBase Android12L; +%End +%If (Qt_6_5_0 -) + static const QOperatingSystemVersionBase Android13; +%End + static const QOperatingSystemVersionBase Windows10_1809; + static const QOperatingSystemVersionBase Windows10_1903; + static const QOperatingSystemVersionBase Windows10_1909; + static const QOperatingSystemVersionBase Windows10_2004; + static const QOperatingSystemVersionBase Windows10_20H2; + static const QOperatingSystemVersionBase Windows10_21H1; + static const QOperatingSystemVersionBase Windows10_21H2; +%If (Qt_6_5_0 -) + static const QOperatingSystemVersionBase Windows10_22H2; +%End + static const QOperatingSystemVersionBase Windows11; +%If (Qt_6_4_0 -) + static const QOperatingSystemVersionBase Windows11_21H2; +%End +%If (Qt_6_4_0 -) + static const QOperatingSystemVersionBase Windows11_22H2; +%End + QOperatingSystemVersion(QOperatingSystemVersion::OSType osType, int vmajor, int vminor = -1, int vmicro = -1); + static QOperatingSystemVersion current(); + static QOperatingSystemVersion::OSType currentType(); + QVersionNumber version() const; + int majorVersion() const; + int minorVersion() const; + int microVersion() const; + int segmentCount() const; + QOperatingSystemVersion::OSType type() const; + QString name() const; + +private: + QOperatingSystemVersion(); +}; + +%End +%If (- Qt_6_3_0) + +class QOperatingSystemVersion +{ +%TypeHeaderCode +#include +%End + +public: + enum OSType + { + Unknown, + Windows, + MacOS, + IOS, + TvOS, + WatchOS, + Android, + }; + + static const QOperatingSystemVersion Windows7; + static const QOperatingSystemVersion Windows8; + static const QOperatingSystemVersion Windows8_1; + static const QOperatingSystemVersion Windows10; + static const QOperatingSystemVersion OSXMavericks; + static const QOperatingSystemVersion OSXYosemite; + static const QOperatingSystemVersion OSXElCapitan; + static const QOperatingSystemVersion MacOSSierra; + static const QOperatingSystemVersion MacOSHighSierra; + static const QOperatingSystemVersion MacOSMojave; + static const QOperatingSystemVersion MacOSCatalina; + static const QOperatingSystemVersion MacOSBigSur; + static const QOperatingSystemVersion AndroidJellyBean; + static const QOperatingSystemVersion AndroidJellyBean_MR1; + static const QOperatingSystemVersion AndroidJellyBean_MR2; + static const QOperatingSystemVersion AndroidKitKat; + static const QOperatingSystemVersion AndroidLollipop; + static const QOperatingSystemVersion AndroidLollipop_MR1; + static const QOperatingSystemVersion AndroidMarshmallow; + static const QOperatingSystemVersion AndroidNougat; + static const QOperatingSystemVersion AndroidNougat_MR1; + static const QOperatingSystemVersion AndroidOreo; +%If (Qt_6_1_0 -) + static const QOperatingSystemVersion AndroidOreo_MR1; +%End +%If (Qt_6_1_0 -) + static const QOperatingSystemVersion AndroidPie; +%End +%If (Qt_6_1_0 -) + static const QOperatingSystemVersion Android11; +%End +%If (Qt_6_1_0 -) + static const QOperatingSystemVersion Android10; +%End + QOperatingSystemVersion(QOperatingSystemVersion::OSType osType, int vmajor, int vminor = -1, int vmicro = -1); + static QOperatingSystemVersion current(); + static QOperatingSystemVersion::OSType currentType(); +%If (Qt_6_1_0 -) + QVersionNumber version() const; +%End + int majorVersion() const; + int minorVersion() const; + int microVersion() const; + int segmentCount() const; + QOperatingSystemVersion::OSType type() const; + QString name() const; + +private: + QOperatingSystemVersion(); +}; + +%End +%If (Qt_6_3_0 -) +bool operator>(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs); +%End +%If (- Qt_6_3_0) +bool operator>(const QOperatingSystemVersion &lhs, const QOperatingSystemVersion &rhs); +%End +%If (Qt_6_3_0 -) +bool operator>=(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs); +%End +%If (- Qt_6_3_0) +bool operator>=(const QOperatingSystemVersion &lhs, const QOperatingSystemVersion &rhs); +%End +%If (Qt_6_3_0 -) +bool operator<(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs); +%End +%If (- Qt_6_3_0) +bool operator<(const QOperatingSystemVersion &lhs, const QOperatingSystemVersion &rhs); +%End +%If (Qt_6_3_0 -) +bool operator<=(QOperatingSystemVersionBase lhs, QOperatingSystemVersionBase rhs); +%End +%If (- Qt_6_3_0) +bool operator<=(const QOperatingSystemVersion &lhs, const QOperatingSystemVersion &rhs); +%End diff --git a/sip/QtCore/qparallelanimationgroup.sip b/sip/QtCore/qparallelanimationgroup.sip new file mode 100644 index 0000000..687abd6 --- /dev/null +++ b/sip/QtCore/qparallelanimationgroup.sip @@ -0,0 +1,39 @@ +// qparallelanimationgroup.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QParallelAnimationGroup : QAnimationGroup +{ +%TypeHeaderCode +#include +%End + +public: + QParallelAnimationGroup(QObject *parent /TransferThis/ = 0); + virtual ~QParallelAnimationGroup(); + virtual int duration() const; + +protected: + virtual bool event(QEvent *event); + virtual void updateCurrentTime(int currentTime); + virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + virtual void updateDirection(QAbstractAnimation::Direction direction); +}; diff --git a/sip/QtCore/qpauseanimation.sip b/sip/QtCore/qpauseanimation.sip new file mode 100644 index 0000000..c3a11c8 --- /dev/null +++ b/sip/QtCore/qpauseanimation.sip @@ -0,0 +1,39 @@ +// qpauseanimation.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPauseAnimation : QAbstractAnimation +{ +%TypeHeaderCode +#include +%End + +public: + QPauseAnimation(QObject *parent /TransferThis/ = 0); + QPauseAnimation(int msecs, QObject *parent /TransferThis/ = 0); + virtual ~QPauseAnimation(); + virtual int duration() const; + void setDuration(int msecs); + +protected: + virtual bool event(QEvent *e); + virtual void updateCurrentTime(int); +}; diff --git a/sip/QtCore/qpermissions.sip b/sip/QtCore/qpermissions.sip new file mode 100644 index 0000000..6c681f6 --- /dev/null +++ b/sip/QtCore/qpermissions.sip @@ -0,0 +1,292 @@ +// qpermissions.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) +%If (PyQt_Permissions) + +class QPermission /TypeHintIn="Union[QBluetoothPermission, QCalendarPermission, QCameraPermission, QContactsPermission, QLocationPermission, QMicrophonePermission]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +// Note that we don't allow sub-classes of the typed permissions. +const sipTypeDef *td = sipTypeFromPyTypeObject(Py_TYPE(sipPy)); + +if (!sipIsErr) + return (td == sipType_QBluetoothPermission || + td == sipType_QCalendarPermission || + td == sipType_QCameraPermission || + td == sipType_QContactsPermission || + td == sipType_QLocationPermission || + td == sipType_QMicrophonePermission); + +void *cpp = sipConvertToType(sipPy, td, sipTransferObj, SIP_NOT_NONE, NULL, sipIsErr); + +if (*sipIsErr) + return 0; + +if (td == sipType_QBluetoothPermission) + *sipCppPtr = new QPermission(*reinterpret_cast(cpp)); + +else if (td == sipType_QCalendarPermission) + *sipCppPtr = new QPermission(*reinterpret_cast(cpp)); + +else if (td == sipType_QCameraPermission) + *sipCppPtr = new QPermission(*reinterpret_cast(cpp)); + +else if (td == sipType_QContactsPermission) + *sipCppPtr = new QPermission(*reinterpret_cast(cpp)); + +else if (td == sipType_QLocationPermission) + *sipCppPtr = new QPermission(*reinterpret_cast(cpp)); + +else if (td == sipType_QMicrophonePermission) + *sipCppPtr = new QPermission(*reinterpret_cast(cpp)); + +return sipGetState(sipTransferObj); +%End + +public: + QPermission(); + Qt::PermissionStatus status() const; + QMetaType type() const; + SIP_PYOBJECT value() const; +%MethodCode + const sipTypeDef *td = SIP_NULLPTR; + void *perm = SIP_NULLPTR; + QMetaType mt = sipCpp->type(); + + if (mt == QMetaType::fromType()) + { + std::optional opt_perm = sipCpp->value(); + + if (opt_perm) + { + perm = new QBluetoothPermission(opt_perm.value()); + td = sipType_QBluetoothPermission; + } + } + else if (mt == QMetaType::fromType()) + { + std::optional opt_perm = sipCpp->value(); + + if (opt_perm) + { + perm = new QCalendarPermission(opt_perm.value()); + td = sipType_QCalendarPermission; + } + } + else if (mt == QMetaType::fromType()) + { + std::optional opt_perm = sipCpp->value(); + + if (opt_perm) + { + perm = new QCameraPermission(opt_perm.value()); + td = sipType_QCameraPermission; + } + } + else if (mt == QMetaType::fromType()) + { + std::optional opt_perm = sipCpp->value(); + + if (opt_perm) + { + perm = new QContactsPermission(opt_perm.value()); + td = sipType_QContactsPermission; + } + } + else if (mt == QMetaType::fromType()) + { + std::optional opt_perm = sipCpp->value(); + + if (opt_perm) + { + perm = new QLocationPermission(opt_perm.value()); + td = sipType_QLocationPermission; + } + } + else if (mt == QMetaType::fromType()) + { + std::optional opt_perm = sipCpp->value(); + + if (opt_perm) + { + perm = new QMicrophonePermission(opt_perm.value()); + td = sipType_QMicrophonePermission; + } + } + + if (perm) + { + sipRes = sipConvertFromNewType(perm, td, SIP_NULLPTR); + } + else + { + sipRes = Py_None; + Py_INCREF(sipRes); + } +%End +}; + +%End +%End +%If (Qt_6_5_0 -) +%If (PyQt_Permissions) + +class QLocationPermission +{ +%TypeHeaderCode +#include +%End + +public: + QLocationPermission(); + QLocationPermission(const QLocationPermission &other); + ~QLocationPermission(); + + enum Accuracy + { + Approximate, + Precise, + }; + + void setAccuracy(QLocationPermission::Accuracy accuracy); + QLocationPermission::Accuracy accuracy() const; + + enum Availability + { + WhenInUse, + Always, + }; + + void setAvailability(QLocationPermission::Availability availability); + QLocationPermission::Availability availability() const; +}; + +%End +%End +%If (Qt_6_5_0 -) +%If (PyQt_Permissions) + +class QCalendarPermission +{ +%TypeHeaderCode +#include +%End + +public: + QCalendarPermission(); + QCalendarPermission(const QCalendarPermission &other); + ~QCalendarPermission(); + + enum AccessMode + { + ReadOnly, + ReadWrite, + }; + + void setAccessMode(QCalendarPermission::AccessMode mode); + QCalendarPermission::AccessMode accessMode() const; +}; + +%End +%End +%If (Qt_6_5_0 -) +%If (PyQt_Permissions) + +class QContactsPermission +{ +%TypeHeaderCode +#include +%End + +public: + QContactsPermission(); + QContactsPermission(const QContactsPermission &other); + ~QContactsPermission(); + + enum AccessMode + { + ReadOnly, + ReadWrite, + }; + + void setAccessMode(QContactsPermission::AccessMode mode); + QContactsPermission::AccessMode accessMode() const; +}; + +%End +%End +%If (Qt_6_5_0 -) +%If (PyQt_Permissions) + +class QCameraPermission +{ +%TypeHeaderCode +#include +%End + +public: + QCameraPermission(); + QCameraPermission(const QCameraPermission &other); + ~QCameraPermission(); +}; + +%End +%End +%If (Qt_6_5_0 -) +%If (PyQt_Permissions) + +class QMicrophonePermission +{ +%TypeHeaderCode +#include +%End + +public: + QMicrophonePermission(); + QMicrophonePermission(const QMicrophonePermission &other); + ~QMicrophonePermission(); +}; + +%End +%End +%If (Qt_6_5_0 -) +%If (PyQt_Permissions) + +class QBluetoothPermission +{ +%TypeHeaderCode +#include +%End + +public: + QBluetoothPermission(); + QBluetoothPermission(const QBluetoothPermission &other); + ~QBluetoothPermission(); +}; + +%End +%End diff --git a/sip/QtCore/qpluginloader.sip b/sip/QtCore/qpluginloader.sip new file mode 100644 index 0000000..681d01f --- /dev/null +++ b/sip/QtCore/qpluginloader.sip @@ -0,0 +1,43 @@ +// qpluginloader.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPluginLoader : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QPluginLoader(QObject *parent /TransferThis/ = 0); + QPluginLoader(const QString &fileName, QObject *parent /TransferThis/ = 0); + virtual ~QPluginLoader(); + QObject *instance(); + static QObjectList staticInstances(); + bool load(); + bool unload(); + bool isLoaded() const; + void setFileName(const QString &fileName); + QString fileName() const; + QString errorString() const; + void setLoadHints(QLibrary::LoadHints loadHints); + QLibrary::LoadHints loadHints() const; +}; diff --git a/sip/QtCore/qpoint.sip b/sip/QtCore/qpoint.sip new file mode 100644 index 0000000..fcad29a --- /dev/null +++ b/sip/QtCore/qpoint.sip @@ -0,0 +1,154 @@ +// qpoint.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPoint +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("ii", sipCpp->x(), sipCpp->y()); +%End + +public: + int manhattanLength() const; + QPoint(); + QPoint(int xpos, int ypos); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QPoint()"); + } + else + { + sipRes = PyUnicode_FromFormat( + "PyQt6.QtCore.QPoint(%i, %i)", sipCpp->x(), sipCpp->y()); + } +%End + + bool isNull() const; + int __bool__() const; +%MethodCode + sipRes = !sipCpp->isNull(); +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + int x() const; + int y() const; + void setX(int xpos); + void setY(int ypos); + QPoint &operator+=(const QPoint &p); + QPoint &operator-=(const QPoint &p); + QPoint &operator*=(int c /Constrained/); + QPoint &operator*=(double c); + QPoint &operator/=(qreal c); + static int dotProduct(const QPoint &p1, const QPoint &p2); + QPoint transposed() const; +%If (Qt_6_4_0 -) + QPointF toPointF() const; +%End +}; + +QDataStream &operator<<(QDataStream &, const QPoint &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QPoint & /Constrained/) /ReleaseGIL/; +bool operator==(const QPoint &p1, const QPoint &p2); +bool operator!=(const QPoint &p1, const QPoint &p2); +QPoint operator+(const QPoint &p); +QPoint operator+(const QPoint &p1, const QPoint &p2); +QPoint operator-(const QPoint &p); +QPoint operator-(const QPoint &p1, const QPoint &p2); +QPoint operator*(const QPoint &p, int factor /Constrained/); +QPoint operator*(int factor /Constrained/, const QPoint &p); +QPoint operator*(const QPoint &p, double factor); +QPoint operator*(double factor, const QPoint &p); +QPoint operator/(const QPoint &p, qreal c); + +class QPointF +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("dd", sipCpp->x(), sipCpp->y()); +%End + +public: + QPointF(); + QPointF(qreal xpos, qreal ypos); + QPointF(const QPoint &p); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QPointF()"); + } + else + { + PyObject *x = PyFloat_FromDouble(sipCpp->x()); + PyObject *y = PyFloat_FromDouble(sipCpp->y()); + + if (x && y) + sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QPointF(%R, %R)", x, y); + + Py_XDECREF(x); + Py_XDECREF(y); + } +%End + + bool isNull() const; + int __bool__() const; +%MethodCode + sipRes = !sipCpp->isNull(); +%End + + qreal x() const; + qreal y() const; + void setX(qreal xpos); + void setY(qreal ypos); + QPointF &operator+=(const QPointF &p); + QPointF &operator-=(const QPointF &p); + QPointF &operator*=(qreal c); + QPointF &operator/=(qreal c); + QPoint toPoint() const; + qreal manhattanLength() const; + static qreal dotProduct(const QPointF &p1, const QPointF &p2); + QPointF transposed() const; +}; + +QDataStream &operator<<(QDataStream &, const QPointF &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QPointF & /Constrained/) /ReleaseGIL/; +bool operator==(const QPointF &p1, const QPointF &p2); +bool operator!=(const QPointF &p1, const QPointF &p2); +QPointF operator+(const QPointF &p); +QPointF operator+(const QPointF &p1, const QPointF &p2); +QPointF operator-(const QPointF &p); +QPointF operator-(const QPointF &p1, const QPointF &p2); +QPointF operator*(const QPointF &p, qreal c); +QPointF operator*(qreal c, const QPointF &p); +QPointF operator/(const QPointF &p, qreal divisor); diff --git a/sip/QtCore/qprocess.sip b/sip/QtCore/qprocess.sip new file mode 100644 index 0000000..5be6005 --- /dev/null +++ b/sip/QtCore/qprocess.sip @@ -0,0 +1,245 @@ +// qprocess.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_Process) + +class QProcess : QIODevice +{ +%TypeHeaderCode +#include +%End + +public: + enum ExitStatus + { + NormalExit, + CrashExit, + }; + + enum ProcessError + { + FailedToStart, + Crashed, + Timedout, + ReadError, + WriteError, + UnknownError, + }; + + enum ProcessState + { + NotRunning, + Starting, + Running, + }; + + enum ProcessChannel + { + StandardOutput, + StandardError, + }; + + enum ProcessChannelMode + { + SeparateChannels, + MergedChannels, + ForwardedChannels, + ForwardedOutputChannel, + ForwardedErrorChannel, + }; + + explicit QProcess(QObject *parent /TransferThis/ = 0); + virtual ~QProcess(); + void start(const QString &program, const QStringList &arguments = {}, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /HoldGIL/; + void start(QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /HoldGIL/; + void startCommand(const QString &command, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /HoldGIL/; + QProcess::ProcessChannel readChannel() const; + void setReadChannel(QProcess::ProcessChannel channel); + void closeReadChannel(QProcess::ProcessChannel channel); + void closeWriteChannel(); + QString workingDirectory() const; + void setWorkingDirectory(const QString &dir); + QProcess::ProcessError error() const; + QProcess::ProcessState state() const; + bool waitForStarted(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForReadyRead(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForBytesWritten(int msecs = 30000) /ReleaseGIL/; + bool waitForFinished(int msecs = 30000) /ReleaseGIL/; + QByteArray readAllStandardOutput() /ReleaseGIL/; + QByteArray readAllStandardError() /ReleaseGIL/; + int exitCode() const; + QProcess::ExitStatus exitStatus() const; + virtual qint64 bytesToWrite() const; + virtual bool isSequential() const; + virtual void close(); + static int execute(const QString &program, const QStringList &arguments = {}) /ReleaseGIL/; + static bool startDetached(const QString &program, const QStringList &arguments = {}, const QString &workingDirectory = QString(), qint64 *pid = 0); + bool startDetached(qint64 *pid = 0); + static QStringList systemEnvironment(); + QProcess::ProcessChannelMode processChannelMode() const; + void setProcessChannelMode(QProcess::ProcessChannelMode mode); + void setStandardInputFile(const QString &fileName); + void setStandardOutputFile(const QString &fileName, QIODeviceBase::OpenMode mode = QIODeviceBase::Truncate); + void setStandardErrorFile(const QString &fileName, QIODeviceBase::OpenMode mode = QIODeviceBase::Truncate); + void setStandardOutputProcess(QProcess *destination); + +public slots: + void terminate(); + void kill(); + +signals: + void started(); + void finished(int exitCode, QProcess::ExitStatus exitStatus = QProcess::NormalExit); + void stateChanged(QProcess::ProcessState state); + void readyReadStandardOutput(); + void readyReadStandardError(); + void errorOccurred(QProcess::ProcessError error); + +protected: + void setProcessState(QProcess::ProcessState state); + virtual SIP_PYOBJECT readData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxlen)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QProcess::readData(s, a0) : sipCpp->readData(s, a0); + #else + len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)]; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipSelfWasArg ? + sipCpp->QProcess::writeData(reinterpret_cast(bi.bi_buf), bi.bi_len) : + sipCpp->writeData(reinterpret_cast(bi.bi_buf), bi.bi_len); + #else + sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast(bi.bi_buf), + bi.bi_len); + #endif + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + +public: + void setProcessEnvironment(const QProcessEnvironment &environment); + QProcessEnvironment processEnvironment() const; + QString program() const; + void setProgram(const QString &program); + QStringList arguments() const; + void setArguments(const QStringList &arguments); + virtual bool open(QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/; + + enum InputChannelMode + { + ManagedInputChannel, + ForwardedInputChannel, + }; + + QProcess::InputChannelMode inputChannelMode() const; + void setInputChannelMode(QProcess::InputChannelMode mode); + static QString nullDevice(); + qint64 processId() const; +}; + +%End +%If (PyQt_Process) + +class QProcessEnvironment +{ +%TypeHeaderCode +#include +%End + +public: +%If (Qt_6_3_0 -) + + enum Initialization + { + InheritFromParent, + }; + +%End +%If (Qt_6_3_0 -) + QProcessEnvironment(QProcessEnvironment::Initialization); +%End + QProcessEnvironment(); + QProcessEnvironment(const QProcessEnvironment &other); + ~QProcessEnvironment(); + bool operator==(const QProcessEnvironment &other) const; + bool operator!=(const QProcessEnvironment &other) const; + bool isEmpty() const; + void clear(); + bool contains(const QString &name) const; + void insert(const QString &name, const QString &value); + void insert(const QProcessEnvironment &e); + void remove(const QString &name); + QString value(const QString &name, const QString &defaultValue = QString()) const; + QStringList toStringList() const; + static QProcessEnvironment systemEnvironment(); + QStringList keys() const; + void swap(QProcessEnvironment &other /Constrained/); +%If (Qt_6_3_0 -) + bool inheritsFromParent() const; +%End +}; + +%End diff --git a/sip/QtCore/qpropertyanimation.sip b/sip/QtCore/qpropertyanimation.sip new file mode 100644 index 0000000..5e71d7c --- /dev/null +++ b/sip/QtCore/qpropertyanimation.sip @@ -0,0 +1,42 @@ +// qpropertyanimation.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPropertyAnimation : QVariantAnimation +{ +%TypeHeaderCode +#include +%End + +public: + QPropertyAnimation(QObject *parent /TransferThis/ = 0); + QPropertyAnimation(QObject *target /KeepReference=0/, const QByteArray &propertyName, QObject *parent /TransferThis/ = 0); + virtual ~QPropertyAnimation(); + QObject *targetObject() const; + void setTargetObject(QObject *target /KeepReference=0/); + QByteArray propertyName() const; + void setPropertyName(const QByteArray &propertyName); + +protected: + virtual bool event(QEvent *event); + virtual void updateCurrentValue(const QVariant &value); + virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); +}; diff --git a/sip/QtCore/qpycore_qhash.sip b/sip/QtCore/qpycore_qhash.sip new file mode 100644 index 0000000..4290393 --- /dev/null +++ b/sip/QtCore/qpycore_qhash.sip @@ -0,0 +1,489 @@ +// This is the SIP interface definition for the majority of the QHash based +// mapped types. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +template<_TYPE1_, _TYPE2_> +%MappedType QHash<_TYPE1_, _TYPE2_> + /TypeHint="Dict[_TYPE1_, _TYPE2_]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QHash<_TYPE1_, _TYPE2_>::const_iterator it = sipCpp->constBegin(); + QHash<_TYPE1_, _TYPE2_>::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + _TYPE1_ *k = new _TYPE1_(it.key()); + PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_, + sipTransferObj); + + if (!kobj) + { + delete k; + Py_DECREF(d); + + return 0; + } + + _TYPE2_ *v = new _TYPE2_(it.value()); + PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE2_, + sipTransferObj); + + if (!vobj) + { + delete v; + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + int rc = PyDict_SetItem(d, kobj, vobj); + + Py_DECREF(vobj); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + ++it; + } + + return d; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return PyDict_Check(sipPy); + + QHash<_TYPE1_, _TYPE2_> *qh = new QHash<_TYPE1_, _TYPE2_>; + + Py_ssize_t pos = 0; + PyObject *kobj, *vobj; + + while (PyDict_Next(sipPy, &pos, &kobj, &vobj)) + { + int kstate; + _TYPE1_ *k = reinterpret_cast<_TYPE1_ *>( + sipForceConvertToType(kobj, sipType__TYPE1_, sipTransferObj, + SIP_NOT_NONE, &kstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict key has type '%s' but '_TYPE1_' is expected", + sipPyTypeName(Py_TYPE(kobj))); + + delete qh; + + return 0; + } + + int vstate; + _TYPE2_ *v = reinterpret_cast<_TYPE2_ *>( + sipForceConvertToType(vobj, sipType__TYPE2_, sipTransferObj, + SIP_NOT_NONE, &vstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict value has type '%s' but '_TYPE2_' is expected", + sipPyTypeName(Py_TYPE(vobj))); + + sipReleaseType(k, sipType__TYPE1_, kstate); + delete qh; + + return 0; + } + + qh->insert(*k, *v); + + sipReleaseType(v, sipType__TYPE2_, vstate); + sipReleaseType(k, sipType__TYPE1_, kstate); + } + + *sipCppPtr = qh; + + return sipGetState(sipTransferObj); +%End +}; + + +// This is only needed for QtWebChannel but is sufficiently generic that we +// include it here. + +template<_TYPE1_, _TYPE2_ *> +%MappedType QHash<_TYPE1_, _TYPE2_ *> + /TypeHint="Dict[_TYPE1_, _TYPE2_]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + int gc_enabled = sipEnableGC(0); + PyObject *d = PyDict_New(); + + if (d) + { + QHash<_TYPE1_, _TYPE2_ *>::const_iterator it = sipCpp->constBegin(); + QHash<_TYPE1_, _TYPE2_ *>::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + _TYPE1_ *k = new _TYPE1_(it.key()); + PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_, + sipTransferObj); + + if (!kobj) + { + delete k; + Py_DECREF(d); + d = 0; + + break; + } + + _TYPE2_ *v = it.value(); + PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE2_, + sipTransferObj); + + if (!vobj) + { + Py_DECREF(kobj); + Py_DECREF(d); + d = 0; + + break; + } + + int rc = PyDict_SetItem(d, kobj, vobj); + + Py_DECREF(vobj); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + d = 0; + + break; + } + + ++it; + } + } + + sipEnableGC(gc_enabled); + + return d; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return PyDict_Check(sipPy); + + QHash<_TYPE1_, _TYPE2_ *> *qh = new QHash<_TYPE1_, _TYPE2_ *>; + + Py_ssize_t pos = 0; + PyObject *kobj, *vobj; + + while (PyDict_Next(sipPy, &pos, &kobj, &vobj)) + { + int kstate; + _TYPE1_ *k = reinterpret_cast<_TYPE1_ *>( + sipForceConvertToType(kobj, sipType__TYPE1_, sipTransferObj, + SIP_NOT_NONE, &kstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict key has type '%s' but '_TYPE1_' is expected", + sipPyTypeName(Py_TYPE(kobj))); + + delete qh; + + return 0; + } + + _TYPE2_ *v = reinterpret_cast<_TYPE2_ *>( + sipForceConvertToType(vobj, sipType__TYPE2_, sipTransferObj, 0, + 0, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict value has type '%s' but '_TYPE2_' is expected", + sipPyTypeName(Py_TYPE(vobj))); + + sipReleaseType(k, sipType__TYPE1_, kstate); + delete qh; + + return 0; + } + + qh->insert(*k, v); + + sipReleaseType(k, sipType__TYPE1_, kstate); + } + + *sipCppPtr = qh; + + return sipGetState(sipTransferObj); +%End +}; + + +template +%MappedType QHash + /TypeHint="Dict[int, _TYPE_]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QHash::const_iterator it = sipCpp->constBegin(); + QHash::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + PyObject *kobj = PyLong_FromLong(it.key()); + + if (!kobj) + { + Py_DECREF(d); + + return 0; + } + + _TYPE_ *v = new _TYPE_(it.value()); + PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE_, + sipTransferObj); + + if (!vobj) + { + delete v; + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + int rc = PyDict_SetItem(d, kobj, vobj); + + Py_DECREF(vobj); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + ++it; + } + + return d; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return PyDict_Check(sipPy); + + QHash *qh = new QHash; + + Py_ssize_t pos = 0; + PyObject *kobj, *vobj; + + while (PyDict_Next(sipPy, &pos, &kobj, &vobj)) + { + int k = sipLong_AsInt(kobj); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "a dict key has type '%s' but 'int' is expected", + sipPyTypeName(Py_TYPE(kobj))); + + delete qh; + *sipIsErr = 1; + + return 0; + } + + int vstate; + _TYPE_ *v = reinterpret_cast<_TYPE_ *>( + sipForceConvertToType(vobj, sipType__TYPE_, sipTransferObj, + SIP_NOT_NONE, &vstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict value has type '%s' but '_TYPE_' is expected", + sipPyTypeName(Py_TYPE(vobj))); + + delete qh; + + return 0; + } + + qh->insert(k, *v); + + sipReleaseType(v, sipType__TYPE_, vstate); + } + + *sipCppPtr = qh; + + return sipGetState(sipTransferObj); +%End +}; + + +template +%MappedType QHash + /TypeHint="Dict[int, _TYPE_]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QHash::const_iterator it = sipCpp->constBegin(); + QHash::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + PyObject *kobj = PyLong_FromLong(it.key()); + + if (!kobj) + { + Py_DECREF(d); + + return 0; + } + + _TYPE_ *v = new _TYPE_(it.value()); + PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE_, + sipTransferObj); + + if (!vobj) + { + delete v; + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + int rc = PyDict_SetItem(d, kobj, vobj); + + Py_DECREF(vobj); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + ++it; + } + + return d; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return PyDict_Check(sipPy); + + QHash *qh = new QHash; + + Py_ssize_t pos = 0; + PyObject *kobj, *vobj; + + while (PyDict_Next(sipPy, &pos, &kobj, &vobj)) + { + quint16 k = sipLong_AsUnsignedShort(kobj); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "a dict key has type '%s' but 'int' is expected", + sipPyTypeName(Py_TYPE(kobj))); + + delete qh; + *sipIsErr = 1; + + return 0; + } + + int vstate; + _TYPE_ *v = reinterpret_cast<_TYPE_ *>( + sipForceConvertToType(vobj, sipType__TYPE_, sipTransferObj, + SIP_NOT_NONE, &vstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict value has type '%s' but '_TYPE_' is expected", + sipPyTypeName(Py_TYPE(vobj))); + + delete qh; + + return 0; + } + + qh->insert(k, *v); + + sipReleaseType(v, sipType__TYPE_, vstate); + } + + *sipCppPtr = qh; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtCore/qpycore_qlist.sip b/sip/QtCore/qpycore_qlist.sip new file mode 100644 index 0000000..233478c --- /dev/null +++ b/sip/QtCore/qpycore_qlist.sip @@ -0,0 +1,1492 @@ +// This is the SIP interface definition for the majority of the QList based +// mapped types. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +template<_TYPE_> +%MappedType QList<_TYPE_> + /TypeHintIn="Iterable[_TYPE_]", TypeHintOut="List[_TYPE_]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + _TYPE_ *t = new _TYPE_(sipCpp->at(i)); + PyObject *tobj = sipConvertFromNewType(t, sipType__TYPE_, + sipTransferObj); + + if (!tobj) + { + delete t; + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, tobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList<_TYPE_> *ql = new QList<_TYPE_>; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int state; + _TYPE_ *t = reinterpret_cast<_TYPE_ *>( + sipForceConvertToType(itm, sipType__TYPE_, sipTransferObj, + SIP_NOT_NONE, &state, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but '_TYPE_' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + + return 0; + } + + ql->append(*t); + + sipReleaseType(t, sipType__TYPE_, state); + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +template<_TYPE_> +%MappedType QList<_TYPE_ *> + /TypeHintIn="Iterable[_TYPE_]", TypeHintOut="List[_TYPE_]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + int gc_enabled = sipEnableGC(0); + PyObject *l = PyList_New(sipCpp->size()); + + if (l) + { + for (int i = 0; i < sipCpp->size(); ++i) + { + _TYPE_ *t = sipCpp->at(i); + + // The explicit (void *) cast allows _TYPE_ to be const. + PyObject *tobj = sipConvertFromType((void *)t, sipType__TYPE_, + sipTransferObj); + + if (!tobj) + { + Py_DECREF(l); + l = 0; + + break; + } + + PyList_SetItem(l, i, tobj); + } + } + + sipEnableGC(gc_enabled); + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList<_TYPE_ *> *ql = new QList<_TYPE_ *>; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + _TYPE_ *t = reinterpret_cast<_TYPE_ *>( + sipForceConvertToType(itm, sipType__TYPE_, sipTransferObj, 0, + 0, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but '_TYPE_' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + + return 0; + } + + ql->append(t); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +template<_TYPE1_, _TYPE2_> +%MappedType QList > + /TypeHintIn="Iterable[Tuple[_TYPE1_, _TYPE2_]]", + TypeHintOut="List[Tuple[_TYPE1_, _TYPE2_]]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + const std::pair<_TYPE1_, _TYPE2_> &p = sipCpp->at(i); + _TYPE1_ *s1 = new _TYPE1_(p.first); + _TYPE2_ *s2 = new _TYPE2_(p.second); + PyObject *pobj = sipBuildResult(NULL, "(NN)", s1, sipType__TYPE1_, + sipTransferObj, s2, sipType__TYPE2_, sipTransferObj); + + if (!pobj) + { + delete s1; + delete s2; + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList > *ql = new QList >; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *seq = PyIter_Next(iter); + + if (!seq) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + Py_ssize_t sub_len; + + if (PySequence_Check(seq) && !PyBytes_Check(sipPy) && !PyUnicode_Check(seq)) + sub_len = PySequence_Size(seq); + else + sub_len = -1; + + if (sub_len != 2) + { + if (sub_len < 0) + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but a 2 element non-string sequence is expected", + i, sipPyTypeName(Py_TYPE(seq))); + else + PyErr_Format(PyExc_TypeError, + "index %zd is a sequence of %zd sub-elements but 2 sub-elements are expected", + i, sub_len); + + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + PyObject *itm1 = PySequence_GetItem(seq, 0); + + if (!itm1) + { + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + int state1; + _TYPE1_ *s1 = reinterpret_cast<_TYPE1_ *>( + sipForceConvertToType(itm1, sipType__TYPE1_, sipTransferObj, + SIP_NOT_NONE, &state1, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "the first sub-element of index %zd has type '%s' but '_TYPE1_' is expected", + i, sipPyTypeName(Py_TYPE(itm1))); + + Py_DECREF(itm1); + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + + return 0; + } + + PyObject *itm2 = PySequence_GetItem(seq, 1); + + if (!itm2) + { + sipReleaseType(s1, sipType__TYPE1_, state1); + Py_DECREF(itm1); + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + int state2; + _TYPE2_ *s2 = reinterpret_cast<_TYPE2_ *>( + sipForceConvertToType(itm2, sipType__TYPE2_, sipTransferObj, + SIP_NOT_NONE, &state2, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "the second sub-element of index %zd has type '%s' but '_TYPE2_' is expected", + i, sipPyTypeName(Py_TYPE(itm2))); + + Py_DECREF(itm2); + sipReleaseType(s1, sipType__TYPE1_, state1); + Py_DECREF(itm1); + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + + return 0; + } + + ql->append(std::pair<_TYPE1_, _TYPE2_>(*s1, *s2)); + + sipReleaseType(s2, sipType__TYPE2_, state2); + Py_DECREF(itm2); + sipReleaseType(s1, sipType__TYPE1_, state1); + Py_DECREF(itm1); + Py_DECREF(seq); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +template +%MappedType QList > + /TypeHintIn="Iterable[Tuple[float, _TYPE_]]", + TypeHintOut="List[Tuple[float, _TYPE_]]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + const std::pair &p = sipCpp->at(i); + _TYPE_ *s2 = new _TYPE_(p.second); + PyObject *pobj = sipBuildResult(NULL, "(dN)", (double)p.first, s2, + sipType__TYPE_, sipTransferObj); + + if (!pobj) + { + delete s2; + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList > *qv = new QList >; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *seq = PyIter_Next(iter); + + if (!seq) + { + if (PyErr_Occurred()) + { + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + Py_ssize_t sub_len; + + if (PySequence_Check(seq) && !PyBytes_Check(sipPy) && !PyUnicode_Check(seq)) + sub_len = PySequence_Size(seq); + else + sub_len = -1; + + if (sub_len != 2) + { + if (sub_len < 0) + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but a 2 element non-string sequence is expected", + i, sipPyTypeName(Py_TYPE(seq))); + else + PyErr_Format(PyExc_TypeError, + "index %zd is a sequence of %zd sub-elements but 2 sub-elements are expected", + i, sub_len); + + Py_DECREF(seq); + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + PyObject *itm1 = PySequence_GetItem(seq, 0); + + if (!itm1) + { + Py_DECREF(seq); + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + PyErr_Clear(); + qreal s1 = PyFloat_AsDouble(itm1); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "the first sub-element of index %zd has type '%s' but 'float' is expected", + i, sipPyTypeName(Py_TYPE(itm1))); + + Py_DECREF(itm1); + Py_DECREF(seq); + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + PyObject *itm2 = PySequence_GetItem(seq, 1); + + if (!itm2) + { + Py_DECREF(itm1); + Py_DECREF(seq); + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + int state2; + _TYPE_ *s2 = reinterpret_cast<_TYPE_ *>( + sipForceConvertToType(itm2, sipType__TYPE_, sipTransferObj, + SIP_NOT_NONE, &state2, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "the second sub-element of index %zd has type '%s' but '_TYPE_' is expected", + i, sipPyTypeName(Py_TYPE(itm2))); + + Py_DECREF(itm2); + Py_DECREF(itm1); + Py_DECREF(seq); + delete qv; + Py_DECREF(iter); + + return 0; + } + + qv->append(std::pair(s1, *s2)); + + sipReleaseType(s2, sipType__TYPE_, state2); + Py_DECREF(itm2); + Py_DECREF(itm1); + Py_DECREF(seq); + } + + Py_DECREF(iter); + + *sipCppPtr = qv; + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType QList > + /TypeHintIn="Iterable[Tuple[int, int]]", + TypeHintOut="List[Tuple[int, int]]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + const std::pair &p = sipCpp->at(i); + PyObject *pobj = Py_BuildValue((char *)"ii", p.first, p.second); + + if (!pobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList > *ql = new QList >; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *seq = PyIter_Next(iter); + + if (!seq) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + Py_ssize_t sub_len; + + if (PySequence_Check(seq) && !PyBytes_Check(sipPy) && !PyUnicode_Check(seq)) + sub_len = PySequence_Size(seq); + else + sub_len = -1; + + if (sub_len != 2) + { + if (sub_len < 0) + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but a 2 element non-string sequence is expected", + i, sipPyTypeName(Py_TYPE(seq))); + else + PyErr_Format(PyExc_TypeError, + "index %zd is a sequence of %zd sub-elements but 2 sub-elements are expected", + i, sub_len); + + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + PyObject *itm1 = PySequence_GetItem(seq, 0); + + if (!itm1) + { + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + int first = sipLong_AsInt(itm1); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "the first sub-element of index %zd has type '%s' but 'int' is expected", + i, sipPyTypeName(Py_TYPE(itm1))); + + Py_DECREF(itm1); + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + PyObject *itm2 = PySequence_GetItem(seq, 1); + + if (!itm2) + { + Py_DECREF(itm1); + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + int second = sipLong_AsInt(itm2); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "the second sub-element of index %zd has type '%s' but 'int' is expected", + i, sipPyTypeName(Py_TYPE(itm2))); + + Py_DECREF(itm2); + Py_DECREF(itm1); + Py_DECREF(seq); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(std::pair(first, second)); + + Py_DECREF(itm2); + Py_DECREF(itm1); + Py_DECREF(seq); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType QList + /TypeHintIn="Iterable[int]", TypeHintOut="List[int]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *pobj = PyLong_FromLong(sipCpp->value(i)); + + if (!pobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int val = sipLong_AsInt(itm); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'int' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(val); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType QList + /TypeHintIn="Iterable[int]", TypeHintOut="List[int]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + // Convert to a Python long to make sure it doesn't get interpreted as + // a signed value. + PyObject *pobj = PyLong_FromUnsignedLong(sipCpp->value(i)); + + if (!pobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *qv = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + PyErr_Clear(); + unsigned int val = sipLong_AsUnsignedInt(itm); + + if (PyErr_Occurred()) + { + Py_DECREF(itm); + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + qv->append(val); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = qv; + + return sipGetState(sipTransferObj); +%End +}; + + +%If (Qt_6_1_0 -) + +%MappedType QList + /TypeHintIn="Iterable[int]", TypeHintOut="List[int]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + // Convert to a Python long to make sure it doesn't get interpreted as + // a signed value. + PyObject *pobj = PyLong_FromUnsignedLong(sipCpp->value(i)); + + if (!pobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *qv = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + PyErr_Clear(); + unsigned short val = sipLong_AsUnsignedShort(itm); + + if (PyErr_Occurred()) + { + Py_DECREF(itm); + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + qv->append(val); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = qv; + + return sipGetState(sipTransferObj); +%End +}; + +%End + + +%If (Qt_6_5_0 -) + +%MappedType QList + /TypeHintIn="Iterable[int]", TypeHintOut="List[int]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *pobj = PyLong_FromLongLong(sipCpp->value(i)); + + if (!pobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + PyErr_Clear(); + qsizetype val = PyLong_AsLongLong(itm); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'int' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(val); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + +%End + + +%MappedType QList + /TypeHintIn="Iterable[float]", TypeHintOut="List[float]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *pobj = PyFloat_FromDouble(sipCpp->value(i)); + + if (!pobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + PyErr_Clear(); + double val = PyFloat_AsDouble(itm); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'float' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(val); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType QList + /TypeHintIn="Iterable[float]", TypeHintOut="List[float]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *pobj = PyFloat_FromDouble(sipCpp->value(i)); + + if (!pobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + PyErr_Clear(); + double val = PyFloat_AsDouble(itm); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'float' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(val); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType QList + /TypeHintIn="Iterable[Qt.DayOfWeek]", TypeHintOut="List[Qt.DayOfWeek]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(sipCpp->at(i), + sipType_Qt_DayOfWeek); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_Qt_DayOfWeek); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'Qt.DayOfWeek' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtCore/qpycore_qmap.sip b/sip/QtCore/qpycore_qmap.sip new file mode 100644 index 0000000..4e12fe1 --- /dev/null +++ b/sip/QtCore/qpycore_qmap.sip @@ -0,0 +1,425 @@ +// This is the SIP interface definition for the majority of the QMap and +// QMultiMap based mapped types. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +template<_TYPE1_, _TYPE2_> +%MappedType QMap<_TYPE1_, _TYPE2_> + /TypeHint="Dict[_TYPE1_, _TYPE2_]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QMap<_TYPE1_, _TYPE2_>::const_iterator it = sipCpp->constBegin(); + QMap<_TYPE1_, _TYPE2_>::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + _TYPE1_ *k = new _TYPE1_(it.key()); + PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_, + sipTransferObj); + + if (!kobj) + { + delete k; + Py_DECREF(d); + + return 0; + } + + _TYPE2_ *v = new _TYPE2_(it.value()); + PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE2_, + sipTransferObj); + + if (!vobj) + { + delete v; + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + int rc = PyDict_SetItem(d, kobj, vobj); + + Py_DECREF(vobj); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + ++it; + } + + return d; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return PyDict_Check(sipPy); + + QMap<_TYPE1_, _TYPE2_> *qm = new QMap<_TYPE1_, _TYPE2_>; + + Py_ssize_t pos = 0; + PyObject *kobj, *vobj; + + while (PyDict_Next(sipPy, &pos, &kobj, &vobj)) + { + int kstate; + _TYPE1_ *k = reinterpret_cast<_TYPE1_ *>( + sipForceConvertToType(kobj, sipType__TYPE1_, sipTransferObj, + SIP_NOT_NONE, &kstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict key has type '%s' but '_TYPE1_' is expected", + sipPyTypeName(Py_TYPE(kobj))); + + delete qm; + + return 0; + } + + int vstate; + _TYPE2_ *v = reinterpret_cast<_TYPE2_ *>( + sipForceConvertToType(vobj, sipType__TYPE2_, sipTransferObj, + SIP_NOT_NONE, &vstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict value has type '%s' but '_TYPE2_' is expected", + sipPyTypeName(Py_TYPE(vobj))); + + sipReleaseType(k, sipType__TYPE1_, kstate); + delete qm; + + return 0; + } + + qm->insert(*k, *v); + + sipReleaseType(v, sipType__TYPE2_, vstate); + sipReleaseType(k, sipType__TYPE1_, kstate); + } + + *sipCppPtr = qm; + + return sipGetState(sipTransferObj); +%End +}; + + +template +%MappedType QMap + /TypeHint="Dict[int, _TYPE_]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QMap::const_iterator it = sipCpp->constBegin(); + QMap::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + PyObject *kobj = PyLong_FromLong(it.key()); + + if (!kobj) + { + Py_DECREF(d); + + return 0; + } + + _TYPE_ *v = new _TYPE_(it.value()); + PyObject *vobj = sipConvertFromNewType(v, sipType__TYPE_, + sipTransferObj); + + if (!vobj) + { + delete v; + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + int rc = PyDict_SetItem(d, kobj, vobj); + + Py_DECREF(vobj); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + ++it; + } + + return d; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return PyDict_Check(sipPy); + + QMap *qm = new QMap; + + Py_ssize_t pos = 0; + PyObject *kobj, *vobj; + + while (PyDict_Next(sipPy, &pos, &kobj, &vobj)) + { + int k = sipLong_AsInt(kobj); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "a dict key has type '%s' but 'int' is expected", + sipPyTypeName(Py_TYPE(kobj))); + + delete qm; + *sipIsErr = 1; + + return 0; + } + + int vstate; + _TYPE_ *v = reinterpret_cast<_TYPE_ *>( + sipForceConvertToType(vobj, sipType__TYPE_, sipTransferObj, + SIP_NOT_NONE, &vstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict value has type '%s' but '_TYPE_' is expected", + sipPyTypeName(Py_TYPE(vobj))); + + delete qm; + + return 0; + } + + qm->insert(k, *v); + + sipReleaseType(v, sipType__TYPE_, vstate); + } + + *sipCppPtr = qm; + + return sipGetState(sipTransferObj); +%End +}; + + +template<_TYPE1_, _TYPE2_> +%MappedType QMultiMap<_TYPE1_, _TYPE2_> + /TypeHintOut="Dict[_TYPE1_, List[_TYPE2_]]", TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QList<_TYPE1_> keys = sipCpp->keys(); + QList<_TYPE1_>::const_iterator kit = keys.constBegin(); + QList<_TYPE1_>::const_iterator kit_end = keys.constEnd(); + + while (kit != kit_end) + { + _TYPE1_ *k = new _TYPE1_(*kit); + PyObject *kobj = sipConvertFromNewType(k, sipType__TYPE1_, + sipTransferObj); + + if (!kobj) + { + delete k; + Py_DECREF(d); + + return 0; + } + + // Create a Python list as the dictionary value. + QList<_TYPE2_> values = sipCpp->values(*kit); + PyObject *vobj = PyList_New(values.count()); + + if (!vobj) + { + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + QList<_TYPE2_>::const_iterator vit = values.constBegin(); + QList<_TYPE2_>::const_iterator vit_end = values.constEnd(); + + for (int i = 0; vit != vit_end; ++i) + { + _TYPE2_ *sv = new _TYPE2_(*vit); + PyObject *svobj = sipConvertFromNewType(sv, sipType__TYPE2_, + sipTransferObj); + + if (!svobj) + { + delete sv; + Py_DECREF(vobj); + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + PyList_SetItem(vobj, i, svobj); + + ++vit; + } + + int rc = PyDict_SetItem(d, kobj, vobj); + + Py_DECREF(vobj); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + ++kit; + } + + return d; +%End + +%ConvertToTypeCode + if (sipIsErr == NULL) + return PyDict_Check(sipPy); + + QMultiMap<_TYPE1_, _TYPE2_> *qm = new QMultiMap<_TYPE1_, _TYPE2_>; + + Py_ssize_t i = 0; + PyObject *kobj, *vobj; + + while (PyDict_Next(sipPy, &i, &kobj, &vobj)) + { + int kstate; + + _TYPE1_ *k = reinterpret_cast<_TYPE1_ *>(sipConvertToType(kobj, sipType__TYPE1_, sipTransferObj, SIP_NOT_NONE, &kstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a dict key has type '%s' but '_TYPE1_' is expected", + sipPyTypeName(Py_TYPE(kobj))); + + delete qm; + + return 0; + } + + Py_ssize_t vi = PySequence_Size(vobj); + + if (vi < 0) + { + PyErr_Format(PyExc_TypeError, + "a dict value has type '%s' but a sequence is expected", + sipPyTypeName(Py_TYPE(vobj))); + + *sipIsErr = 1; + sipReleaseType(k, sipType__TYPE1_, kstate); + delete qm; + + return 0; + } + + // We go through the sequence backwards to maintain the Qt semantics of + // later items appearing first. + while (vi--) + { + PyObject *itm_obj = PySequence_GetItem(vobj, vi); + + if (!itm_obj) + { + *sipIsErr = 1; + sipReleaseType(k, sipType__TYPE1_, kstate); + delete qm; + + return 0; + } + + int itm_state; + + _TYPE2_ *itm = reinterpret_cast<_TYPE2_ *>(sipConvertToType(itm_obj, sipType__TYPE2_, sipTransferObj, SIP_NOT_NONE, &itm_state, sipIsErr)); + + Py_DECREF(itm_obj); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "a sequence element has type '%s' but '_TYPE2_' is expected", + sipPyTypeName(Py_TYPE(itm_obj))); + + sipReleaseType(k, sipType__TYPE1_, kstate); + delete qm; + + return 0; + } + + qm->insert(*k, *itm); + sipReleaseType(itm, sipType__TYPE2_, itm_state); + } + + sipReleaseType(k, sipType__TYPE1_, kstate); + } + + *sipCppPtr = qm; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtCore/qpycore_qset.sip b/sip/QtCore/qpycore_qset.sip new file mode 100644 index 0000000..ad8fa99 --- /dev/null +++ b/sip/QtCore/qpycore_qset.sip @@ -0,0 +1,244 @@ +// This is the SIP interface definition for the majority of the QSet based +// mapped types. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +template<_TYPE_> +%MappedType QSet<_TYPE_> + /TypeHintIn="Iterable[_TYPE_]", TypeHintOut="Set[_TYPE_]", + TypeHintValue="set()"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *s = PySet_New(0); + + if (!s) + return 0; + + QSet<_TYPE_>::const_iterator it = sipCpp->constBegin(); + QSet<_TYPE_>::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + _TYPE_ *t = new _TYPE_(*it); + PyObject *tobj = sipConvertFromNewType(t, sipType__TYPE_, + sipTransferObj); + + if (!tobj) + { + delete t; + Py_DECREF(s); + + return 0; + } + + PySet_Add(s, tobj); + + ++it; + } + + return s; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QSet<_TYPE_> *qs = new QSet<_TYPE_>; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete qs; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int state; + _TYPE_ *t = reinterpret_cast<_TYPE_ *>( + sipForceConvertToType(itm, sipType__TYPE_, sipTransferObj, + SIP_NOT_NONE, &state, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but '_TYPE_' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete qs; + Py_DECREF(iter); + + return 0; + } + + qs->insert(*t); + + sipReleaseType(t, sipType__TYPE_, state); + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = qs; + + return sipGetState(sipTransferObj); +%End +}; + + +template<_TYPE_> +%MappedType QSet<_TYPE_ *> + /TypeHintIn="Iterable[_TYPE_]", TypeHintOut="Set[_TYPE_]", + TypeHintValue="set()"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + int gc_enabled = sipEnableGC(0); + PyObject *s = PySet_New(0); + + if (s) + { + QSet<_TYPE_ *>::const_iterator it = sipCpp->constBegin(); + QSet<_TYPE_ *>::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + // The explicit (void *) cast allows _TYPE_ to be const. + PyObject *tobj = sipConvertFromType((void *)*it, sipType__TYPE_, + sipTransferObj); + + if (!tobj) + { + Py_DECREF(s); + s = 0; + + break; + } + + PySet_Add(s, tobj); + + ++it; + } + } + + sipEnableGC(gc_enabled); + + return s; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QSet<_TYPE_ *> *qs = new QSet<_TYPE_ *>; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete qs; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + _TYPE_ *t = reinterpret_cast<_TYPE_ *>( + sipForceConvertToType(itm, sipType__TYPE_, sipTransferObj, 0, + 0, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but '_TYPE_' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete qs; + Py_DECREF(iter); + + return 0; + } + + qs->insert(t); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = qs; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtCore/qpycore_std_pair.sip b/sip/QtCore/qpycore_std_pair.sip new file mode 100644 index 0000000..f6c4da2 --- /dev/null +++ b/sip/QtCore/qpycore_std_pair.sip @@ -0,0 +1,503 @@ +// This is the SIP interface definition for the majority of the std::pair based +// mapped types. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +template<_TYPE1_, _TYPE2_> +%MappedType std::pair<_TYPE1_, _TYPE2_> /TypeHint="Tuple[_TYPE1_, _TYPE2_]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + _TYPE1_ *first = new _TYPE1_(sipCpp->first); + _TYPE2_ *second = new _TYPE2_(sipCpp->second); + PyObject *t = sipBuildResult(NULL, "(NN)", first, sipType__TYPE1_, + sipTransferObj, second, sipType__TYPE2_, sipTransferObj); + + if (!t) + { + delete first; + delete second; + + return 0; + } + + return t; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy)); + + Py_ssize_t len = PySequence_Size(sipPy); + + if (len != 2) + { + // A negative length should only be an internal error so let the + // original exception stand. + if (len >= 0) + PyErr_Format(PyExc_TypeError, + "sequence has %zd elements but 2 elements are expected", + len); + + *sipIsErr = 1; + + return 0; + } + + PyObject *firstobj = PySequence_GetItem(sipPy, 0); + + if (!firstobj) + { + *sipIsErr = 1; + + return 0; + } + + int firststate; + _TYPE1_ *first = reinterpret_cast<_TYPE1_ *>( + sipForceConvertToType(firstobj, sipType__TYPE1_, sipTransferObj, + SIP_NOT_NONE, &firststate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "the first element has type '%s' but '_TYPE1_' is expected", + sipPyTypeName(Py_TYPE(firstobj))); + + return 0; + } + + PyObject *secondobj = PySequence_GetItem(sipPy, 1); + + if (!secondobj) + { + sipReleaseType(first, sipType__TYPE1_, firststate); + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + int secondstate; + _TYPE2_ *second = reinterpret_cast<_TYPE2_ *>( + sipForceConvertToType(secondobj, sipType__TYPE2_, sipTransferObj, + SIP_NOT_NONE, &secondstate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "the second element has type '%s' but '_TYPE2_' is expected", + sipPyTypeName(Py_TYPE(secondobj))); + + Py_DECREF(secondobj); + sipReleaseType(first, sipType__TYPE1_, firststate); + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + *sipCppPtr = new std::pair<_TYPE1_, _TYPE2_>(*first, *second); + + sipReleaseType(second, sipType__TYPE2_, secondstate); + Py_DECREF(secondobj); + sipReleaseType(first, sipType__TYPE1_, firststate); + Py_DECREF(firstobj); + + return sipGetState(sipTransferObj); +%End +}; + + +template<_TYPE_> +%MappedType std::pair<_TYPE_, int> /TypeHint="Tuple[_TYPE_, int]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + _TYPE_ *first = new _TYPE_(sipCpp->first); + PyObject *t = sipBuildResult(NULL, "(Ni)", first, sipType__TYPE_, + sipTransferObj, sipCpp->second); + + if (!t) + { + delete first; + + return 0; + } + + return t; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy)); + + Py_ssize_t len = PySequence_Size(sipPy); + + if (len != 2) + { + // A negative length should only be an internal error so let the + // original exception stand. + if (len >= 0) + PyErr_Format(PyExc_TypeError, + "sequence has %zd elements but 2 elements are expected", + len); + + *sipIsErr = 1; + + return 0; + } + + PyObject *firstobj = PySequence_GetItem(sipPy, 0); + + if (!firstobj) + { + *sipIsErr = 1; + + return 0; + } + + int firststate; + _TYPE_ *first = reinterpret_cast<_TYPE_ *>( + sipForceConvertToType(firstobj, sipType__TYPE_, sipTransferObj, + SIP_NOT_NONE, &firststate, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "the first element has type '%s' but '_TYPE_' is expected", + sipPyTypeName(Py_TYPE(firstobj))); + + return 0; + } + + PyObject *secondobj = PySequence_GetItem(sipPy, 1); + + if (!secondobj) + { + sipReleaseType(first, sipType__TYPE_, firststate); + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + int second = sipLong_AsInt(secondobj); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "the second element has type '%s' but 'int' is expected", + sipPyTypeName(Py_TYPE(secondobj))); + + Py_DECREF(secondobj); + sipReleaseType(first, sipType__TYPE_, firststate); + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + *sipCppPtr = new std::pair<_TYPE_, int>(*first, second); + + Py_DECREF(secondobj); + sipReleaseType(first, sipType__TYPE_, firststate); + Py_DECREF(firstobj); + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType std::pair /TypeHint="Tuple[int, int]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + return Py_BuildValue("(ii)", sipCpp->first, sipCpp->second); +%End + +%ConvertToTypeCode + if (!sipIsErr) + return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy)); + + Py_ssize_t len = PySequence_Size(sipPy); + + if (len != 2) + { + // A negative length should only be an internal error so let the + // original exception stand. + if (len >= 0) + PyErr_Format(PyExc_TypeError, + "sequence has %zd elements but 2 elements are expected", + len); + + *sipIsErr = 1; + + return 0; + } + + PyObject *firstobj = PySequence_GetItem(sipPy, 0); + + if (!firstobj) + { + *sipIsErr = 1; + + return 0; + } + + int first = sipLong_AsInt(firstobj); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "the first element has type '%s' but 'int' is expected", + sipPyTypeName(Py_TYPE(firstobj))); + + *sipIsErr = 1; + + return 0; + } + + PyObject *secondobj = PySequence_GetItem(sipPy, 1); + + if (!secondobj) + { + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + int second = sipLong_AsInt(secondobj); + + if (PyErr_Occurred()) + { + if (PyErr_ExceptionMatches(PyExc_TypeError)) + PyErr_Format(PyExc_TypeError, + "the second element has type '%s' but 'int' is expected", + sipPyTypeName(Py_TYPE(secondobj))); + + Py_DECREF(secondobj); + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + *sipCppPtr = new std::pair(first, second); + + Py_DECREF(secondobj); + Py_DECREF(firstobj); + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType std::pair /TypeHint="Tuple[float, float]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + return Py_BuildValue("(ff)", sipCpp->first, sipCpp->second); +%End + +%ConvertToTypeCode + if (!sipIsErr) + return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy)); + + Py_ssize_t len = PySequence_Size(sipPy); + + if (len != 2) + { + // A negative length should only be an internal error so let the + // original exception stand. + if (len >= 0) + PyErr_Format(PyExc_TypeError, + "sequence has %zd elements but 2 elements are expected", + len); + + *sipIsErr = 1; + + return 0; + } + + PyObject *firstobj = PySequence_GetItem(sipPy, 0); + + if (!firstobj) + { + *sipIsErr = 1; + + return 0; + } + + PyErr_Clear(); + double first = PyFloat_AsDouble(firstobj); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "the first element has type '%s' but 'float' is expected", + sipPyTypeName(Py_TYPE(firstobj))); + + *sipIsErr = 1; + + return 0; + } + + PyObject *secondobj = PySequence_GetItem(sipPy, 1); + + if (!secondobj) + { + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + PyErr_Clear(); + double second = PyFloat_AsDouble(secondobj); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "the second element has type '%s' but 'float' is expected", + sipPyTypeName(Py_TYPE(secondobj))); + + Py_DECREF(secondobj); + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + *sipCppPtr = new std::pair(first, second);; + + Py_DECREF(secondobj); + Py_DECREF(firstobj); + + return sipGetState(sipTransferObj); +%End +}; + + +%If (Qt_6_2_0 -) + +%MappedType std::pair /TypeHint="Tuple[float, float]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + return Py_BuildValue("(ff)", sipCpp->first, sipCpp->second); +%End + +%ConvertToTypeCode + if (!sipIsErr) + return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy)); + + Py_ssize_t len = PySequence_Size(sipPy); + + if (len != 2) + { + // A negative length should only be an internal error so let the + // original exception stand. + if (len >= 0) + PyErr_Format(PyExc_TypeError, + "sequence has %zd elements but 2 elements are expected", + len); + + *sipIsErr = 1; + + return 0; + } + + PyObject *firstobj = PySequence_GetItem(sipPy, 0); + + if (!firstobj) + { + *sipIsErr = 1; + + return 0; + } + + PyErr_Clear(); + double first = PyFloat_AsDouble(firstobj); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "the first element has type '%s' but 'float' is expected", + sipPyTypeName(Py_TYPE(firstobj))); + + *sipIsErr = 1; + + return 0; + } + + PyObject *secondobj = PySequence_GetItem(sipPy, 1); + + if (!secondobj) + { + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + PyErr_Clear(); + double second = PyFloat_AsDouble(secondobj); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "the second element has type '%s' but 'float' is expected", + sipPyTypeName(Py_TYPE(secondobj))); + + Py_DECREF(secondobj); + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + *sipCppPtr = new std::pair(first, second);; + + Py_DECREF(secondobj); + Py_DECREF(firstobj); + + return sipGetState(sipTransferObj); +%End +}; + +%End diff --git a/sip/QtCore/qpycore_virtual_error_handler.sip b/sip/QtCore/qpycore_virtual_error_handler.sip new file mode 100644 index 0000000..0274690 --- /dev/null +++ b/sip/QtCore/qpycore_virtual_error_handler.sip @@ -0,0 +1,23 @@ +// This is the implementation of the PyQt-specific virtual error handler. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%VirtualErrorHandler PyQt6 + pyqt6_err_print(); +%End diff --git a/sip/QtCore/qrandom.sip b/sip/QtCore/qrandom.sip new file mode 100644 index 0000000..6d5e8ed --- /dev/null +++ b/sip/QtCore/qrandom.sip @@ -0,0 +1,50 @@ +// qrandom.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QRandomGenerator +{ +%TypeHeaderCode +#include +%End + +public: + QRandomGenerator(quint32 seed = 1); + QRandomGenerator(const QRandomGenerator &other); + quint32 generate(); + quint64 generate64(); + double generateDouble(); + double bounded(double highest /Constrained/); + qint64 bounded(qint64 lowest, qint64 highest); + qint64 bounded(qint64 highest); + typedef quint32 result_type; + QRandomGenerator::result_type operator()(); + void seed(quint32 seed = 1); + void discard(unsigned long long z); + static QRandomGenerator::result_type min(); + static QRandomGenerator::result_type max(); + static QRandomGenerator *system(); + static QRandomGenerator *global(); + static QRandomGenerator securelySeeded(); +}; + +bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2); +bool operator!=(const QRandomGenerator &rng1, const QRandomGenerator &rng2); diff --git a/sip/QtCore/qreadwritelock.sip b/sip/QtCore/qreadwritelock.sip new file mode 100644 index 0000000..daef0bc --- /dev/null +++ b/sip/QtCore/qreadwritelock.sip @@ -0,0 +1,104 @@ +// qreadwritelock.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QReadWriteLock +{ +%TypeHeaderCode +#include +%End + +public: + enum RecursionMode + { + NonRecursive, + Recursive, + }; + + explicit QReadWriteLock(QReadWriteLock::RecursionMode recursionMode = QReadWriteLock::NonRecursive); + ~QReadWriteLock(); + void lockForRead() /ReleaseGIL/; + bool tryLockForRead(); + bool tryLockForRead(int timeout) /ReleaseGIL/; + void lockForWrite() /ReleaseGIL/; + bool tryLockForWrite(); + bool tryLockForWrite(int timeout) /ReleaseGIL/; + void unlock(); + +private: + QReadWriteLock(const QReadWriteLock &); +}; + +class QReadLocker +{ +%TypeHeaderCode +#include +%End + +public: + QReadLocker(QReadWriteLock *areadWriteLock) /ReleaseGIL/; + ~QReadLocker(); + void unlock(); + void relock() /ReleaseGIL/; + QReadWriteLock *readWriteLock() const; + SIP_PYOBJECT __enter__(); +%MethodCode + // Just return a reference to self. + sipRes = sipSelf; + Py_INCREF(sipRes); +%End + + void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback); +%MethodCode + sipCpp->unlock(); +%End + +private: + QReadLocker(const QReadLocker &); +}; + +class QWriteLocker +{ +%TypeHeaderCode +#include +%End + +public: + QWriteLocker(QReadWriteLock *areadWriteLock) /ReleaseGIL/; + ~QWriteLocker(); + void unlock(); + void relock() /ReleaseGIL/; + QReadWriteLock *readWriteLock() const; + SIP_PYOBJECT __enter__(); +%MethodCode + // Just return a reference to self. + sipRes = sipSelf; + Py_INCREF(sipRes); +%End + + void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback); +%MethodCode + sipCpp->unlock(); +%End + +private: + QWriteLocker(const QWriteLocker &); +}; diff --git a/sip/QtCore/qrect.sip b/sip/QtCore/qrect.sip new file mode 100644 index 0000000..b4258c4 --- /dev/null +++ b/sip/QtCore/qrect.sip @@ -0,0 +1,286 @@ +// qrect.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QRect +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("iiii", sipCpp->x(), sipCpp->y(), sipCpp->width(), sipCpp->height()); +%End + +public: + QRect(); + QRect normalized() const; + void moveCenter(const QPoint &p); + QRect operator|(const QRect &r) const; + QRect operator&(const QRect &r) const; + bool contains(const QPoint &point, bool proper = false) const; + int __contains__(const QPoint &p) const; +%MethodCode + sipRes = sipCpp->contains(*a0); +%End + + bool contains(const QRect &rectangle, bool proper = false) const; + int __contains__(const QRect &r) const; +%MethodCode + sipRes = sipCpp->contains(*a0); +%End + + bool intersects(const QRect &r) const; + QRect(int aleft, int atop, int awidth, int aheight); + QRect(const QPoint &atopLeft, const QPoint &abottomRight); + QRect(const QPoint &atopLeft, const QSize &asize); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QRect()"); + } + else + { + sipRes = PyUnicode_FromFormat( + "PyQt6.QtCore.QRect(%i, %i, %i, %i)", sipCpp->left(), + sipCpp->top(), sipCpp->width(), sipCpp->height()); + } +%End + + bool isNull() const; + bool isEmpty() const; + bool isValid() const; + int __bool__() const; +%MethodCode + sipRes = sipCpp->isValid(); +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + int left() const; + int top() const; + int right() const; + int bottom() const; + int x() const; + int y() const; + void setLeft(int pos); + void setTop(int pos); + void setRight(int pos); + void setBottom(int pos); + void setTopLeft(const QPoint &p); + void setBottomRight(const QPoint &p); + void setTopRight(const QPoint &p); + void setBottomLeft(const QPoint &p); + void setX(int ax); + void setY(int ay); + QPoint topLeft() const; + QPoint bottomRight() const; + QPoint topRight() const; + QPoint bottomLeft() const; + QPoint center() const; + int width() const; + int height() const; + QSize size() const; + void translate(int dx, int dy); + void translate(const QPoint &p); + QRect translated(int dx, int dy) const; + QRect translated(const QPoint &p) const; + void moveTo(int ax, int ay); + void moveTo(const QPoint &p); + void moveLeft(int pos); + void moveTop(int pos); + void moveRight(int pos); + void moveBottom(int pos); + void moveTopLeft(const QPoint &p); + void moveBottomRight(const QPoint &p); + void moveTopRight(const QPoint &p); + void moveBottomLeft(const QPoint &p); + void getRect(int *ax, int *ay, int *aw, int *ah) const; + void setRect(int ax, int ay, int aw, int ah); + void getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const; + void setCoords(int xp1, int yp1, int xp2, int yp2); + QRect adjusted(int xp1, int yp1, int xp2, int yp2) const; + void adjust(int dx1, int dy1, int dx2, int dy2); + void setWidth(int w); + void setHeight(int h); + void setSize(const QSize &s); + bool contains(int ax, int ay, bool aproper) const; + bool contains(int ax, int ay) const; + QRect &operator|=(const QRect &r); + QRect &operator&=(const QRect &r); + QRect intersected(const QRect &other) const; + QRect united(const QRect &r) const; + QRect marginsAdded(const QMargins &margins) const; + QRect marginsRemoved(const QMargins &margins) const; + QRect &operator+=(const QMargins &margins); + QRect &operator-=(const QMargins &margins); + QRect transposed() const; + static QRect span(const QPoint &p1, const QPoint &p2); +%If (Qt_6_4_0 -) + QRectF toRectF() const; +%End +}; + +QDataStream &operator<<(QDataStream &, const QRect &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QRect & /Constrained/) /ReleaseGIL/; +bool operator==(const QRect &r1, const QRect &r2); +bool operator!=(const QRect &r1, const QRect &r2); + +class QRectF +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("dddd", sipCpp->x(), sipCpp->y(), sipCpp->width(), sipCpp->height()); +%End + +public: + QRectF(); + QRectF(const QPointF &atopLeft, const QSizeF &asize); + QRectF(const QPointF &atopLeft, const QPointF &abottomRight); + QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight); + QRectF(const QRect &r); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QRectF()"); + } + else + { + PyObject *l = PyFloat_FromDouble(sipCpp->left()); + PyObject *t = PyFloat_FromDouble(sipCpp->top()); + PyObject *w = PyFloat_FromDouble(sipCpp->width()); + PyObject *h = PyFloat_FromDouble(sipCpp->height()); + + if (l && t && w && h) + sipRes = PyUnicode_FromFormat( + "PyQt6.QtCore.QRectF(%R, %R, %R, %R)", l, t, w, h); + + Py_XDECREF(l); + Py_XDECREF(t); + Py_XDECREF(w); + Py_XDECREF(h); + } +%End + + QRectF normalized() const; + qreal left() const; + qreal top() const; + qreal right() const; + qreal bottom() const; + void setX(qreal pos); + void setY(qreal pos); + QPointF topLeft() const; + QPointF bottomRight() const; + QPointF topRight() const; + QPointF bottomLeft() const; + QRectF operator|(const QRectF &r) const; + QRectF operator&(const QRectF &r) const; + bool contains(const QPointF &p) const; + int __contains__(const QPointF &p) const; +%MethodCode + sipRes = sipCpp->contains(*a0); +%End + + bool contains(const QRectF &r) const; + int __contains__(const QRectF &r) const; +%MethodCode + sipRes = sipCpp->contains(*a0); +%End + + bool intersects(const QRectF &r) const; + bool isNull() const; + bool isEmpty() const; + bool isValid() const; + int __bool__() const; +%MethodCode + sipRes = sipCpp->isValid(); +%End + + qreal x() const; + qreal y() const; + void setLeft(qreal pos); + void setRight(qreal pos); + void setTop(qreal pos); + void setBottom(qreal pos); + void setTopLeft(const QPointF &p); + void setTopRight(const QPointF &p); + void setBottomLeft(const QPointF &p); + void setBottomRight(const QPointF &p); + QPointF center() const; + void moveLeft(qreal pos); + void moveTop(qreal pos); + void moveRight(qreal pos); + void moveBottom(qreal pos); + void moveTopLeft(const QPointF &p); + void moveTopRight(const QPointF &p); + void moveBottomLeft(const QPointF &p); + void moveBottomRight(const QPointF &p); + void moveCenter(const QPointF &p); + qreal width() const; + qreal height() const; + QSizeF size() const; + void translate(qreal dx, qreal dy); + void translate(const QPointF &p); + void moveTo(qreal ax, qreal ay); + void moveTo(const QPointF &p); + QRectF translated(qreal dx, qreal dy) const; + QRectF translated(const QPointF &p) const; + void getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const; + void setRect(qreal ax, qreal ay, qreal aaw, qreal aah); + void getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const; + void setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2); + void adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2); + QRectF adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const; + void setWidth(qreal aw); + void setHeight(qreal ah); + void setSize(const QSizeF &s); + bool contains(qreal ax, qreal ay) const; + QRectF &operator|=(const QRectF &r); + QRectF &operator&=(const QRectF &r); + QRectF intersected(const QRectF &r) const; + QRectF united(const QRectF &r) const; + QRect toAlignedRect() const; + QRect toRect() const; + QRectF marginsAdded(const QMarginsF &margins) const; + QRectF marginsRemoved(const QMarginsF &margins) const; + QRectF &operator+=(const QMarginsF &margins); + QRectF &operator-=(const QMarginsF &margins); + QRectF transposed() const; +}; + +QDataStream &operator<<(QDataStream &, const QRectF &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QRectF & /Constrained/) /ReleaseGIL/; +bool operator==(const QRectF &r1, const QRectF &r2); +bool operator!=(const QRectF &r1, const QRectF &r2); +QRect operator+(const QRect &rectangle, const QMargins &margins); +QRect operator+(const QMargins &margins, const QRect &rectangle); +QRect operator-(const QRect &lhs, const QMargins &rhs); +QRectF operator+(const QRectF &lhs, const QMarginsF &rhs); +QRectF operator+(const QMarginsF &lhs, const QRectF &rhs); +QRectF operator-(const QRectF &lhs, const QMarginsF &rhs); diff --git a/sip/QtCore/qregularexpression.sip b/sip/QtCore/qregularexpression.sip new file mode 100644 index 0000000..78bc8c1 --- /dev/null +++ b/sip/QtCore/qregularexpression.sip @@ -0,0 +1,186 @@ +// qregularexpression.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QRegularExpression +{ +%TypeHeaderCode +#include +%End + +public: + enum PatternOption /BaseType=Flag/ + { + NoPatternOption, + CaseInsensitiveOption, + DotMatchesEverythingOption, + MultilineOption, + ExtendedPatternSyntaxOption, + InvertedGreedinessOption, + DontCaptureOption, + UseUnicodePropertiesOption, + }; + + typedef QFlags PatternOptions; + QRegularExpression::PatternOptions patternOptions() const; + void setPatternOptions(QRegularExpression::PatternOptions options); + QRegularExpression(); + QRegularExpression(const QString &pattern, QRegularExpression::PatternOptions options = QRegularExpression::NoPatternOption); + QRegularExpression(const QRegularExpression &re); + ~QRegularExpression(); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + PyObject *uni = qpycore_PyObject_FromQString(sipCpp->pattern()); + + if (uni) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QRegularExpression(%R", uni); + + if (sipCpp->patternOptions() != QRegularExpression::NoPatternOption) + { + qpycore_Unicode_ConcatAndDel(&sipRes, + PyUnicode_FromFormat( + ", PyQt6.QtCore.QRegularExpression.PatternOptions(%i)", + (int)sipCpp->patternOptions())); + } + + qpycore_Unicode_ConcatAndDel(&sipRes, PyUnicode_FromString(")")); + + Py_DECREF(uni); + } + else + { + sipRes = 0; + } +%End + + void swap(QRegularExpression &re /Constrained/); + QString pattern() const; + void setPattern(const QString &pattern); + bool isValid() const; + qsizetype patternErrorOffset() const; + QString errorString() const; + int captureCount() const; + + enum MatchType + { + NormalMatch, + PartialPreferCompleteMatch, + PartialPreferFirstMatch, + NoMatch, + }; + + enum MatchOption /BaseType=Flag/ + { + NoMatchOption, + AnchorAtOffsetMatchOption, + DontCheckSubjectStringMatchOption, + }; + + typedef QFlags MatchOptions; + QRegularExpressionMatch match(const QString &subject, qsizetype offset = 0, QRegularExpression::MatchType matchType = QRegularExpression::NormalMatch, QRegularExpression::MatchOptions matchOptions = QRegularExpression::NoMatchOption) const; +%If (Qt_6_5_0 -) + QRegularExpressionMatch matchView(QStringView subjectView, qsizetype offset = 0, QRegularExpression::MatchType matchType = QRegularExpression::NormalMatch, QRegularExpression::MatchOptions matchOptions = QRegularExpression::NoMatchOption) const; +%End + QRegularExpressionMatchIterator globalMatch(const QString &subject, qsizetype offset = 0, QRegularExpression::MatchType matchType = QRegularExpression::NormalMatch, QRegularExpression::MatchOptions matchOptions = QRegularExpression::NoMatchOption) const; +%If (Qt_6_5_0 -) + QRegularExpressionMatchIterator globalMatchView(QStringView subjectView, qsizetype offset = 0, QRegularExpression::MatchType matchType = QRegularExpression::NormalMatch, QRegularExpression::MatchOptions matchOptions = QRegularExpression::NoMatchOption) const; +%End + static QString escape(const QString &str); + QStringList namedCaptureGroups() const; + bool operator==(const QRegularExpression &re) const; + bool operator!=(const QRegularExpression &re) const; + void optimize() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + static QString wildcardToRegularExpression(QStringView str, QRegularExpression::WildcardConversionOptions options = QRegularExpression::DefaultWildcardConversion); + static QString anchoredPattern(const QString &expression); + + enum WildcardConversionOption /BaseType=Flag/ + { + DefaultWildcardConversion, + UnanchoredWildcardConversion, + }; + + typedef QFlags WildcardConversionOptions; + static QRegularExpression fromWildcard(QStringView pattern, Qt::CaseSensitivity cs = Qt::CaseInsensitive, QRegularExpression::WildcardConversionOptions options = QRegularExpression::DefaultWildcardConversion); +}; + +QDataStream &operator<<(QDataStream &out, const QRegularExpression &re /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &in, QRegularExpression &re /Constrained/) /ReleaseGIL/; + +class QRegularExpressionMatch +{ +%TypeHeaderCode +#include +%End + +public: + QRegularExpressionMatch(); + ~QRegularExpressionMatch(); + QRegularExpressionMatch(const QRegularExpressionMatch &match); + void swap(QRegularExpressionMatch &match /Constrained/); + QRegularExpression regularExpression() const; + QRegularExpression::MatchType matchType() const; + QRegularExpression::MatchOptions matchOptions() const; + bool hasMatch() const; + bool hasPartialMatch() const; + bool isValid() const; + int lastCapturedIndex() const; + QString captured(int nth = 0) const; + QString captured(const QString &name) const; + QStringList capturedTexts() const; + qsizetype capturedStart(QStringView name) const; + qsizetype capturedStart(int nth = 0) const; + qsizetype capturedLength(QStringView name) const; + qsizetype capturedLength(int nth = 0) const; + qsizetype capturedEnd(QStringView name) const; + qsizetype capturedEnd(int nth = 0) const; +%If (Qt_6_3_0 -) + bool hasCaptured(int nth) const; +%End +%If (Qt_6_3_0 -) + bool hasCaptured(const QString &name) const; +%End +}; + +class QRegularExpressionMatchIterator +{ +%TypeHeaderCode +#include +%End + +public: + QRegularExpressionMatchIterator(); + ~QRegularExpressionMatchIterator(); + QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator &iterator); + void swap(QRegularExpressionMatchIterator &iterator /Constrained/); + bool isValid() const; + bool hasNext() const; + QRegularExpressionMatch next(); + QRegularExpressionMatch peekNext() const; + QRegularExpression regularExpression() const; + QRegularExpression::MatchType matchType() const; + QRegularExpression::MatchOptions matchOptions() const; +}; diff --git a/sip/QtCore/qresource.sip b/sip/QtCore/qresource.sip new file mode 100644 index 0000000..9366b08 --- /dev/null +++ b/sip/QtCore/qresource.sip @@ -0,0 +1,81 @@ +// qresource.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QResource +{ +%TypeHeaderCode +#include +%End + +public: + QResource(const QString &fileName = QString(), const QLocale &locale = QLocale()); + ~QResource(); + QString absoluteFilePath() const; + SIP_PYOBJECT data() const /TypeHint="bytes"/; +%MethodCode + // The data may contain embedded '\0's so set the size explicitly. + + if (sipCpp->data()) + { + if ((sipRes = PyBytes_FromStringAndSize((char *)sipCpp->data(), sipCpp->size())) == NULL) + sipIsErr = 1; + } + else + { + Py_INCREF(Py_None); + sipRes = Py_None; + } +%End + + QString fileName() const; + bool isValid() const; + QLocale locale() const; + void setFileName(const QString &file); + void setLocale(const QLocale &locale); + qint64 size() const; + static bool registerResource(const QString &rccFileName, const QString &mapRoot = QString()); + static bool registerResource(const uchar *rccData, const QString &mapRoot = QString()) /PyName=registerResourceData/; + static bool unregisterResource(const QString &rccFileName, const QString &mapRoot = QString()); + static bool unregisterResource(const uchar *rccData, const QString &mapRoot = QString()) /PyName=unregisterResourceData/; + +protected: + QStringList children() const; + bool isDir() const; + bool isFile() const; + +public: + QDateTime lastModified() const; + + enum Compression + { + NoCompression, + ZlibCompression, + ZstdCompression, + }; + + QResource::Compression compressionAlgorithm() const; + qint64 uncompressedSize() const; + QByteArray uncompressedData() const; + +private: + QResource(const QResource &); +}; diff --git a/sip/QtCore/qrunnable.sip b/sip/QtCore/qrunnable.sip new file mode 100644 index 0000000..2b2a998 --- /dev/null +++ b/sip/QtCore/qrunnable.sip @@ -0,0 +1,55 @@ +// qrunnable.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QRunnable /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + QRunnable(); + virtual ~QRunnable(); + virtual void run() = 0 /NewThread/; + bool autoDelete() const; + void setAutoDelete(bool _autoDelete); + static QRunnable *create(SIP_PYCALLABLE functionToRun /KeepReference,TypeHint="Callable[[], None]"/) /Factory/; +%MethodCode + sipRes = QRunnable::create([a0]() { + SIP_BLOCK_THREADS + + PyObject *res; + + res = PyObject_CallObject(a0, NULL); + + if (res) + Py_DECREF(res); + else + pyqt6_err_print(); + + SIP_UNBLOCK_THREADS + }); +%End + +private: + QRunnable(const QRunnable &); +}; diff --git a/sip/QtCore/qsavefile.sip b/sip/QtCore/qsavefile.sip new file mode 100644 index 0000000..a0f1e9f --- /dev/null +++ b/sip/QtCore/qsavefile.sip @@ -0,0 +1,70 @@ +// qsavefile.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSaveFile : QFileDevice +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSaveFile(const QString &name); + explicit QSaveFile(QObject *parent /TransferThis/ = 0); + QSaveFile(const QString &name, QObject *parent /TransferThis/); + virtual ~QSaveFile(); + virtual QString fileName() const; + void setFileName(const QString &name); + virtual bool open(QIODeviceBase::OpenMode flags) /ReleaseGIL/; + bool commit(); + void cancelWriting(); + void setDirectWriteFallback(bool enabled); + bool directWriteFallback() const; + +protected: + virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)]; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipSelfWasArg ? + sipCpp->QSaveFile::writeData(reinterpret_cast(bi.bi_buf), bi.bi_len) : + sipCpp->writeData(reinterpret_cast(bi.bi_buf), bi.bi_len); + #else + sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast(bi.bi_buf), + bi.bi_len); + #endif + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + +private: + virtual void close(); +}; diff --git a/sip/QtCore/qsemaphore.sip b/sip/QtCore/qsemaphore.sip new file mode 100644 index 0000000..d53bb78 --- /dev/null +++ b/sip/QtCore/qsemaphore.sip @@ -0,0 +1,55 @@ +// qsemaphore.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSemaphore +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSemaphore(int n = 0); + ~QSemaphore(); + void acquire(int n = 1) /ReleaseGIL/; + bool tryAcquire(int n = 1); + bool tryAcquire(int n, int timeout) /ReleaseGIL/; + void release(int n = 1); + int available() const; + +private: + QSemaphore(const QSemaphore &); +}; + +class QSemaphoreReleaser /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QSemaphoreReleaser(); + QSemaphoreReleaser(QSemaphore *sem, int n = 1); + ~QSemaphoreReleaser(); + void swap(QSemaphoreReleaser &other); + QSemaphore *semaphore() const; + QSemaphore *cancel(); +}; diff --git a/sip/QtCore/qsequentialanimationgroup.sip b/sip/QtCore/qsequentialanimationgroup.sip new file mode 100644 index 0000000..5cad8dd --- /dev/null +++ b/sip/QtCore/qsequentialanimationgroup.sip @@ -0,0 +1,45 @@ +// qsequentialanimationgroup.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSequentialAnimationGroup : QAnimationGroup +{ +%TypeHeaderCode +#include +%End + +public: + QSequentialAnimationGroup(QObject *parent /TransferThis/ = 0); + virtual ~QSequentialAnimationGroup(); + QPauseAnimation *addPause(int msecs); + QPauseAnimation *insertPause(int index, int msecs); + QAbstractAnimation *currentAnimation() const; + virtual int duration() const; + +signals: + void currentAnimationChanged(QAbstractAnimation *current); + +protected: + virtual bool event(QEvent *event); + virtual void updateCurrentTime(int); + virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + virtual void updateDirection(QAbstractAnimation::Direction direction); +}; diff --git a/sip/QtCore/qsettings.sip b/sip/QtCore/qsettings.sip new file mode 100644 index 0000000..b975090 --- /dev/null +++ b/sip/QtCore/qsettings.sip @@ -0,0 +1,153 @@ +// qsettings.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSettings : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Status + { + NoError, + AccessError, + FormatError, + }; + + enum Format + { + NativeFormat, + IniFormat, + InvalidFormat, + }; + + enum Scope + { + UserScope, + SystemScope, + }; + + QSettings(const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QSettings(QSettings::Scope scope, const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QSettings(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application = QString(), QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QSettings(const QString &fileName, QSettings::Format format, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QSettings(QSettings::Scope scope, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + explicit QSettings(QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + virtual ~QSettings() /ReleaseGIL/; + void clear() /ReleaseGIL/; + void sync() /ReleaseGIL/; + QSettings::Status status() const; +%If (Qt_6_4_0 -) + void beginGroup(QAnyStringView prefix); +%End +%If (- Qt_6_4_0) + void beginGroup(const QString &prefix); +%End + void endGroup(); + QString group() const; +%If (Qt_6_4_0 -) + int beginReadArray(QAnyStringView prefix); +%End +%If (- Qt_6_4_0) + int beginReadArray(const QString &prefix); +%End +%If (Qt_6_4_0 -) + void beginWriteArray(QAnyStringView prefix, int size = -1); +%End +%If (- Qt_6_4_0) + void beginWriteArray(const QString &prefix, int size = -1); +%End + void endArray(); + void setArrayIndex(int i); + QStringList allKeys() const /ReleaseGIL/; + QStringList childKeys() const /ReleaseGIL/; + QStringList childGroups() const /ReleaseGIL/; + bool isWritable() const; +%If (Qt_6_4_0 -) + void setValue(QAnyStringView key, const QVariant &value) /ReleaseGIL/; +%End +%If (- Qt_6_4_0) + void setValue(const QString &key, const QVariant &value) /ReleaseGIL/; +%End +%If (Qt_6_4_0 -) + SIP_PYOBJECT value(const QAnyStringView &key, const QVariant &defaultValue = QVariant(), SIP_PYOBJECT type /TypeHint="type", TypeHintValue="None"/ = 0) const /ReleaseGIL/; +%MethodCode + QVariant value; + + // QSettings has an internal mutex so release the GIL to avoid the possibility + // of deadlocks. + Py_BEGIN_ALLOW_THREADS + value = sipCpp->value(*a0, *a1); + Py_END_ALLOW_THREADS + + sipRes = pyqt6_from_qvariant_by_type(value, a2); + + sipIsErr = !sipRes; +%End + +%End +%If (- Qt_6_4_0) + SIP_PYOBJECT value(const QString &key, const QVariant &defaultValue = QVariant(), SIP_PYOBJECT type /TypeHint="type", TypeHintValue="None"/ = 0) const /ReleaseGIL/; +%MethodCode + QVariant value; + + // QSettings has an internal mutex so release the GIL to avoid the possibility + // of deadlocks. + Py_BEGIN_ALLOW_THREADS + value = sipCpp->value(*a0, *a1); + Py_END_ALLOW_THREADS + + sipRes = pyqt6_from_qvariant_by_type(value, a2); + + sipIsErr = !sipRes; +%End + +%End +%If (Qt_6_4_0 -) + void remove(QAnyStringView key) /ReleaseGIL/; +%End +%If (- Qt_6_4_0) + void remove(const QString &key) /ReleaseGIL/; +%End +%If (Qt_6_4_0 -) + bool contains(QAnyStringView key) const /ReleaseGIL/; +%End +%If (- Qt_6_4_0) + bool contains(const QString &key) const /ReleaseGIL/; +%End + void setFallbacksEnabled(bool b); + bool fallbacksEnabled() const; + QString fileName() const; + static void setPath(QSettings::Format format, QSettings::Scope scope, const QString &path) /ReleaseGIL/; + QSettings::Format format() const; + QSettings::Scope scope() const; + QString organizationName() const; + QString applicationName() const; + static void setDefaultFormat(QSettings::Format format); + static QSettings::Format defaultFormat(); + bool isAtomicSyncRequired() const; + void setAtomicSyncRequired(bool enable); + +protected: + virtual bool event(QEvent *event); +}; diff --git a/sip/QtCore/qsharedmemory.sip b/sip/QtCore/qsharedmemory.sip new file mode 100644 index 0000000..0278a64 --- /dev/null +++ b/sip/QtCore/qsharedmemory.sip @@ -0,0 +1,75 @@ +// qsharedmemory.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSharedMemory : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum AccessMode + { + ReadOnly, + ReadWrite, + }; + + enum SharedMemoryError + { + NoError, + PermissionDenied, + InvalidSize, + KeyError, + AlreadyExists, + NotFound, + LockError, + OutOfResources, + UnknownError, + }; + + QSharedMemory(QObject *parent /TransferThis/ = 0); + QSharedMemory(const QString &key, QObject *parent /TransferThis/ = 0); + virtual ~QSharedMemory(); + void setKey(const QString &key); + QString key() const; + bool create(qsizetype size, QSharedMemory::AccessMode mode = QSharedMemory::ReadWrite); + qsizetype size() const; + bool attach(QSharedMemory::AccessMode mode = QSharedMemory::ReadWrite); + bool isAttached() const; + bool detach(); + SIP_PYOBJECT data() /TypeHint="PyQt6.sip.voidptr"/; +%MethodCode + sipRes = sipConvertFromVoidPtrAndSize(sipCpp->data(), sipCpp->size()); +%End + + SIP_PYOBJECT constData() const /TypeHint="PyQt6.sip.voidptr"/; +%MethodCode + sipRes = sipConvertFromConstVoidPtrAndSize(sipCpp->constData(), sipCpp->size()); +%End + + bool lock(); + bool unlock(); + QSharedMemory::SharedMemoryError error() const; + QString errorString() const; + void setNativeKey(const QString &key); + QString nativeKey() const; +}; diff --git a/sip/QtCore/qsignalmapper.sip b/sip/QtCore/qsignalmapper.sip new file mode 100644 index 0000000..ba27498 --- /dev/null +++ b/sip/QtCore/qsignalmapper.sip @@ -0,0 +1,48 @@ +// qsignalmapper.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSignalMapper : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSignalMapper(QObject *parent /TransferThis/ = 0); + virtual ~QSignalMapper(); + void setMapping(QObject *sender, int id); + void setMapping(QObject *sender, const QString &text); + void setMapping(QObject *sender, QObject *object); + void removeMappings(QObject *sender); + QObject *mapping(int id) const; + QObject *mapping(const QString &text) const; + QObject *mapping(QObject *object) const; + +signals: + void mappedInt(int); + void mappedString(const QString &); + void mappedObject(QObject *); + +public slots: + void map(); + void map(QObject *sender); +}; diff --git a/sip/QtCore/qsize.sip b/sip/QtCore/qsize.sip new file mode 100644 index 0000000..2e9f0e6 --- /dev/null +++ b/sip/QtCore/qsize.sip @@ -0,0 +1,166 @@ +// qsize.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSize +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("ii", sipCpp->width(), sipCpp->height()); +%End + +public: + void transpose(); + void scale(const QSize &s, Qt::AspectRatioMode mode); + QSize(); + QSize(int w, int h); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QSize()"); + } + else + { + sipRes = PyUnicode_FromFormat( + "PyQt6.QtCore.QSize(%i, %i)", sipCpp->width(), sipCpp->height()); + } +%End + + bool isNull() const; + bool isEmpty() const; + bool isValid() const; + int __bool__() const; +%MethodCode + sipRes = sipCpp->isValid(); +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + int width() const; + int height() const; + void setWidth(int w); + void setHeight(int h); + void scale(int w, int h, Qt::AspectRatioMode mode); + QSize &operator+=(const QSize &s); + QSize &operator-=(const QSize &s); + QSize &operator*=(qreal c); + QSize &operator/=(qreal c); + QSize expandedTo(const QSize &otherSize) const; + QSize boundedTo(const QSize &otherSize) const; + QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const; + QSize scaled(int w, int h, Qt::AspectRatioMode mode) const; + QSize transposed() const; + QSize grownBy(QMargins m) const; + QSize shrunkBy(QMargins m) const; +%If (Qt_6_4_0 -) + QSizeF toSizeF() const; +%End +}; + +QDataStream &operator<<(QDataStream &, const QSize &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QSize & /Constrained/) /ReleaseGIL/; +bool operator==(const QSize &s1, const QSize &s2); +bool operator!=(const QSize &s1, const QSize &s2); +QSize operator+(const QSize &s1, const QSize &s2); +QSize operator-(const QSize &s1, const QSize &s2); +QSize operator*(const QSize &s, qreal c); +QSize operator*(qreal c, const QSize &s); +QSize operator/(const QSize &s, qreal c); + +class QSizeF +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("dd", sipCpp->width(), sipCpp->height()); +%End + +public: + void transpose(); + void scale(const QSizeF &s, Qt::AspectRatioMode mode); + QSizeF(); + QSizeF(const QSize &sz); + QSizeF(qreal w, qreal h); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + if (sipCpp->isNull()) + { + sipRes = PyUnicode_FromString("PyQt6.QtCore.QSizeF()"); + } + else + { + PyObject *w = PyFloat_FromDouble(sipCpp->width()); + PyObject *h = PyFloat_FromDouble(sipCpp->height()); + + if (w && h) + sipRes = PyUnicode_FromFormat( + "PyQt6.QtCore.QSizeF(%R, %R)", w, h); + + Py_XDECREF(w); + Py_XDECREF(h); + } +%End + + bool isNull() const; + bool isEmpty() const; + bool isValid() const; + int __bool__() const; +%MethodCode + sipRes = sipCpp->isValid(); +%End + + qreal width() const; + qreal height() const; + void setWidth(qreal w); + void setHeight(qreal h); + void scale(qreal w, qreal h, Qt::AspectRatioMode mode); + QSizeF &operator+=(const QSizeF &s); + QSizeF &operator-=(const QSizeF &s); + QSizeF &operator*=(qreal c); + QSizeF &operator/=(qreal c); + QSizeF expandedTo(const QSizeF &otherSize) const; + QSizeF boundedTo(const QSizeF &otherSize) const; + QSize toSize() const; + QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const; + QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const; + QSizeF transposed() const; + QSizeF grownBy(QMarginsF m) const; + QSizeF shrunkBy(QMarginsF m) const; +}; + +QDataStream &operator<<(QDataStream &, const QSizeF &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QSizeF & /Constrained/) /ReleaseGIL/; +bool operator==(const QSizeF &s1, const QSizeF &s2); +bool operator!=(const QSizeF &s1, const QSizeF &s2); +QSizeF operator+(const QSizeF &s1, const QSizeF &s2); +QSizeF operator-(const QSizeF &s1, const QSizeF &s2); +QSizeF operator*(const QSizeF &s, qreal c); +QSizeF operator*(qreal c, const QSizeF &s); +QSizeF operator/(const QSizeF &s, qreal c); diff --git a/sip/QtCore/qsocketnotifier.sip b/sip/QtCore/qsocketnotifier.sip new file mode 100644 index 0000000..ad2b5fb --- /dev/null +++ b/sip/QtCore/qsocketnotifier.sip @@ -0,0 +1,58 @@ +// qsocketnotifier.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSocketNotifier : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Type + { + Read, + Write, + Exception, + }; + +%If (Qt_6_1_0 -) + QSocketNotifier(QSocketNotifier::Type, QObject *parent /TransferThis/ = 0); +%End + QSocketNotifier(qintptr socket, QSocketNotifier::Type, QObject *parent /TransferThis/ = 0); + virtual ~QSocketNotifier(); + qintptr socket() const; + QSocketNotifier::Type type() const; + bool isEnabled() const; + void setEnabled(bool); +%If (Qt_6_1_0 -) + void setSocket(qintptr socket); +%End +%If (Qt_6_1_0 -) + bool isValid() const; +%End + +signals: + void activated(int socket); + +protected: + virtual bool event(QEvent *); +}; diff --git a/sip/QtCore/qsortfilterproxymodel.sip b/sip/QtCore/qsortfilterproxymodel.sip new file mode 100644 index 0000000..ae9e4f4 --- /dev/null +++ b/sip/QtCore/qsortfilterproxymodel.sip @@ -0,0 +1,119 @@ +// qsortfilterproxymodel.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSortFilterProxyModel : QAbstractProxyModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSortFilterProxyModel(QObject *parent /TransferThis/ = 0); + virtual ~QSortFilterProxyModel(); + virtual void setSourceModel(QAbstractItemModel *sourceModel /KeepReference/); + virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const; + virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; + virtual QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const; + virtual QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const; + QRegularExpression filterRegularExpression() const; + int filterKeyColumn() const; + void setFilterKeyColumn(int column); + Qt::CaseSensitivity filterCaseSensitivity() const; + void setFilterCaseSensitivity(Qt::CaseSensitivity cs); + +public slots: + void invalidate(); + void setFilterFixedString(const QString &pattern); + void setFilterRegularExpression(const QRegularExpression ®ularExpression); + void setFilterRegularExpression(const QString &pattern); + void setFilterWildcard(const QString &pattern); + +protected: + virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; + virtual bool filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const; + virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const; + +public: + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex parent(const QModelIndex &child) const; + QObject *parent() const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); + virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual void fetchMore(const QModelIndex &parent); + virtual bool canFetchMore(const QModelIndex &parent) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QModelIndex buddy(const QModelIndex &index) const; + virtual QSize span(const QModelIndex &index) const; + virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const; + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + Qt::CaseSensitivity sortCaseSensitivity() const; + void setSortCaseSensitivity(Qt::CaseSensitivity cs); + bool dynamicSortFilter() const; + void setDynamicSortFilter(bool enable); + int sortRole() const; + void setSortRole(int role); + int sortColumn() const; + Qt::SortOrder sortOrder() const; + int filterRole() const; + void setFilterRole(int role); + virtual QStringList mimeTypes() const; + virtual Qt::DropActions supportedDropActions() const; + bool isSortLocaleAware() const; + void setSortLocaleAware(bool on); + virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const; + bool isRecursiveFilteringEnabled() const; + void setRecursiveFilteringEnabled(bool recursive); + +protected: + void invalidateFilter(); + +signals: + void dynamicSortFilterChanged(bool dynamicSortFilter); + void filterCaseSensitivityChanged(Qt::CaseSensitivity filterCaseSensitivity); + void sortCaseSensitivityChanged(Qt::CaseSensitivity sortCaseSensitivity); + void sortLocaleAwareChanged(bool sortLocaleAware); + void sortRoleChanged(int sortRole); + void filterRoleChanged(int filterRole); + void recursiveFilteringEnabledChanged(bool recursiveFilteringEnabled); + +public: + bool autoAcceptChildRows() const; + void setAutoAcceptChildRows(bool accept); + +protected: + void invalidateRowsFilter(); + void invalidateColumnsFilter(); + +signals: + void autoAcceptChildRowsChanged(bool autoAcceptChildRows); +}; diff --git a/sip/QtCore/qstandardpaths.sip b/sip/QtCore/qstandardpaths.sip new file mode 100644 index 0000000..468a403 --- /dev/null +++ b/sip/QtCore/qstandardpaths.sip @@ -0,0 +1,78 @@ +// qstandardpaths.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStandardPaths +{ +%TypeHeaderCode +#include +%End + +public: + enum StandardLocation + { + DesktopLocation, + DocumentsLocation, + FontsLocation, + ApplicationsLocation, + MusicLocation, + MoviesLocation, + PicturesLocation, + TempLocation, + HomeLocation, + CacheLocation, + GenericDataLocation, + RuntimeLocation, + ConfigLocation, + DownloadLocation, + GenericCacheLocation, + GenericConfigLocation, + AppDataLocation, + AppLocalDataLocation, + AppConfigLocation, +%If (Qt_6_4_0 -) + PublicShareLocation, +%End +%If (Qt_6_4_0 -) + TemplatesLocation, +%End + }; + + static QString writableLocation(QStandardPaths::StandardLocation type); + static QStringList standardLocations(QStandardPaths::StandardLocation type); + + enum LocateOption /BaseType=Flag/ + { + LocateFile, + LocateDirectory, + }; + + typedef QFlags LocateOptions; + static QString locate(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options = QStandardPaths::LocateFile); + static QStringList locateAll(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options = QStandardPaths::LocateFile); + static QString displayName(QStandardPaths::StandardLocation type); + static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList()); + static void setTestModeEnabled(bool testMode); + +private: + QStandardPaths(); + ~QStandardPaths(); +}; diff --git a/sip/QtCore/qstorageinfo.sip b/sip/QtCore/qstorageinfo.sip new file mode 100644 index 0000000..5e13469 --- /dev/null +++ b/sip/QtCore/qstorageinfo.sip @@ -0,0 +1,57 @@ +// qstorageinfo.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStorageInfo +{ +%TypeHeaderCode +#include +%End + +public: + QStorageInfo(); + explicit QStorageInfo(const QString &path); + explicit QStorageInfo(const QDir &dir); + QStorageInfo(const QStorageInfo &other); + ~QStorageInfo(); + void swap(QStorageInfo &other /Constrained/); + void setPath(const QString &path); + QString rootPath() const; + QByteArray device() const; + QByteArray fileSystemType() const; + QString name() const; + QString displayName() const; + qint64 bytesTotal() const; + qint64 bytesFree() const; + qint64 bytesAvailable() const; + bool isReadOnly() const; + bool isReady() const; + bool isValid() const; + void refresh(); + static QList mountedVolumes(); + static QStorageInfo root(); + bool isRoot() const; + int blockSize() const; + QByteArray subvolume() const; +}; + +bool operator==(const QStorageInfo &first, const QStorageInfo &second); +bool operator!=(const QStorageInfo &first, const QStorageInfo &second); diff --git a/sip/QtCore/qstring.sip b/sip/QtCore/qstring.sip new file mode 100644 index 0000000..f4fc40f --- /dev/null +++ b/sip/QtCore/qstring.sip @@ -0,0 +1,47 @@ +// This is the SIP interface definition for the QString mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QString /AllowNone, TypeHintIn="Optional[str]", TypeHintOut="str", TypeHintValue="''"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +if (sipIsErr == NULL) + return (sipPy == Py_None || PyUnicode_Check(sipPy)); + +if (sipPy == Py_None) +{ + // None is the only way to create a null (as opposed to empty) QString. + *sipCppPtr = new QString(); + + return sipGetState(sipTransferObj); +} + +*sipCppPtr = new QString(qpycore_PyObject_AsQString(sipPy)); + +return sipGetState(sipTransferObj); +%End + +%ConvertFromTypeCode + return qpycore_PyObject_FromQString(*sipCpp); +%End +}; diff --git a/sip/QtCore/qstringconverter.sip b/sip/QtCore/qstringconverter.sip new file mode 100644 index 0000000..cb5fa97 --- /dev/null +++ b/sip/QtCore/qstringconverter.sip @@ -0,0 +1,113 @@ +// qstringconverter.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (- Qt_6_4_0) + +class QStringConverterBase +{ +%TypeHeaderCode +#include +%End + +public: + enum class Flag /BaseType=Flag/ + { + Default, + Stateless, + ConvertInvalidToNull, + WriteBom, + ConvertInitialBom, + }; + + typedef QFlags Flags; +}; + +%End +%If (- Qt_6_4_0) + +class QStringConverter : QStringConverterBase +{ +%TypeHeaderCode +#include +%End + +public: + enum Encoding + { + Utf8, + Utf16, + Utf16LE, + Utf16BE, + Utf32, + Utf32LE, + Utf32BE, + Latin1, + System, + }; + +protected: + QStringConverter(); + QStringConverter(QStringConverter::Encoding encoding, QStringConverterBase::Flags f); + QStringConverter(const char *name, QStringConverterBase::Flags f); + +public: + bool isValid() const; + void resetState(); + bool hasError() const; + const char *name() const; + +private: + QStringConverter(const QStringConverter &); +}; + +%End + +class QStringEncoder : QStringConverter +{ +%TypeHeaderCode +#include +%End + +public: + QStringEncoder(); + QStringEncoder(QStringConverter::Encoding encoding, QStringConverterBase::Flags flags = QStringConverterBase::Flag::Default); + QStringEncoder(const char *name, QStringConverterBase::Flags flags = QStringConverterBase::Flag::Default); + QByteArray operator()(QStringView in) [QStringEncoder::DecodedData (QStringView in)]; + QByteArray encode(QStringView in) [QStringEncoder::DecodedData (QStringView in)]; +}; + +class QStringDecoder : QStringConverter +{ +%TypeHeaderCode +#include +%End + +public: + QStringDecoder(QStringConverter::Encoding encoding, QStringConverterBase::Flags flags = QStringConverterBase::Flag::Default); + QStringDecoder(); + QStringDecoder(const char *name, QStringConverterBase::Flags flags = QStringConverterBase::Flag::Default); + QString operator()(QByteArrayView ba) [QStringDecoder::EncodedData (QByteArrayView ba)]; + QString decode(QByteArrayView ba) [QStringDecoder::EncodedData (QByteArrayView ba)]; +%If (Qt_6_4_0 -) + static QStringDecoder decoderForHtml(QByteArrayView data); +%End +}; diff --git a/sip/QtCore/qstringconverter_base.sip b/sip/QtCore/qstringconverter_base.sip new file mode 100644 index 0000000..e31cd2d --- /dev/null +++ b/sip/QtCore/qstringconverter_base.sip @@ -0,0 +1,88 @@ +// qstringconverter_base.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_4_0 -) + +class QStringConverterBase +{ +%TypeHeaderCode +#include +%End + +public: + enum class Flag /BaseType=Flag/ + { + Default, + Stateless, + ConvertInvalidToNull, + WriteBom, + ConvertInitialBom, + UsesIcu, + }; + + typedef QFlags Flags; + +protected: + ~QStringConverterBase(); +}; + +%End +%If (Qt_6_4_0 -) + +class QStringConverter : QStringConverterBase +{ +%TypeHeaderCode +#include +%End + +public: + enum Encoding + { + Utf8, + Utf16, + Utf16LE, + Utf16BE, + Utf32, + Utf32LE, + Utf32BE, + Latin1, + System, + }; + +protected: + QStringConverter(); + QStringConverter(QStringConverter::Encoding encoding, QStringConverterBase::Flags f); + QStringConverter(const char *name, QStringConverterBase::Flags f); + ~QStringConverter(); + +public: + bool isValid() const; + void resetState(); + bool hasError() const; + const char *name() const; + static const char *nameForEncoding(QStringConverter::Encoding e); + +private: + QStringConverter(const QStringConverter &); +}; + +%End diff --git a/sip/QtCore/qstringlist.sip b/sip/QtCore/qstringlist.sip new file mode 100644 index 0000000..d2d41e2 --- /dev/null +++ b/sip/QtCore/qstringlist.sip @@ -0,0 +1,124 @@ +// This is the SIP interface definition for the QStringList mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QStringList + /TypeHintIn="Iterable[QString]", TypeHintOut="List[QString]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + QString *t = new QString(sipCpp->at(i)); + PyObject *tobj = sipConvertFromNewType(t, sipType_QString, + sipTransferObj); + + if (!tobj) + { + delete t; + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, tobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QStringList *ql = new QStringList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int state; + QString *t = reinterpret_cast( + sipForceConvertToType(itm, sipType_QString, sipTransferObj, + SIP_NOT_NONE, &state, sipIsErr)); + + if (*sipIsErr) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'str' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + + return 0; + } + + ql->append(*t); + + sipReleaseType(t, sipType_QString, state); + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtCore/qstringlistmodel.sip b/sip/QtCore/qstringlistmodel.sip new file mode 100644 index 0000000..de7a281 --- /dev/null +++ b/sip/QtCore/qstringlistmodel.sip @@ -0,0 +1,47 @@ +// qstringlistmodel.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStringListModel : QAbstractListModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QStringListModel(QObject *parent /TransferThis/ = 0); + QStringListModel(const QStringList &strings, QObject *parent /TransferThis/ = 0); + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + QStringList stringList() const; + void setStringList(const QStringList &strings); + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + virtual Qt::DropActions supportedDropActions() const; + virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const; + virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild); + virtual QMap itemData(const QModelIndex &index) const; + virtual bool setItemData(const QModelIndex &index, const QMap &roles); + virtual bool clearItemData(const QModelIndex &index); +}; diff --git a/sip/QtCore/qstringview.sip b/sip/QtCore/qstringview.sip new file mode 100644 index 0000000..5657db5 --- /dev/null +++ b/sip/QtCore/qstringview.sip @@ -0,0 +1,48 @@ +// This is the SIP interface definition for the QStringView mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QStringView /TypeHint="str",TypeHintValue="''"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +if (sipIsErr == NULL) + return PyUnicode_Check(sipPy); + +// TODO: consider creating the view directly from the Python object if it is +// using UTF-16. +QString *qs = new QString(qpycore_PyObject_AsQString(sipPy)); +*sipCppPtr = new QStringView(*qs); +*sipUserStatePtr = qs; + +return sipGetState(sipTransferObj); +%End + +%ConvertFromTypeCode + return qpycore_PyObject_FromQString(sipCpp->toString()); +%End + +%ReleaseCode +delete sipCpp; +delete reinterpret_cast(sipUserState); +%End +}; diff --git a/sip/QtCore/qsysinfo.sip b/sip/QtCore/qsysinfo.sip new file mode 100644 index 0000000..8be3aa1 --- /dev/null +++ b/sip/QtCore/qsysinfo.sip @@ -0,0 +1,53 @@ +// qsysinfo.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSysInfo +{ +%TypeHeaderCode +#include +%End + +public: + enum Sizes + { + WordSize, + }; + + enum Endian + { + BigEndian, + LittleEndian, + ByteOrder, + }; + + static QString buildCpuArchitecture(); + static QString currentCpuArchitecture(); + static QString buildAbi(); + static QString kernelType(); + static QString kernelVersion(); + static QString productType(); + static QString productVersion(); + static QString prettyProductName(); + static QString machineHostName(); + static QByteArray machineUniqueId(); + static QByteArray bootUniqueId(); +}; diff --git a/sip/QtCore/qsystemsemaphore.sip b/sip/QtCore/qsystemsemaphore.sip new file mode 100644 index 0000000..9296546 --- /dev/null +++ b/sip/QtCore/qsystemsemaphore.sip @@ -0,0 +1,58 @@ +// qsystemsemaphore.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSystemSemaphore +{ +%TypeHeaderCode +#include +%End + +public: + enum AccessMode + { + Open, + Create, + }; + + enum SystemSemaphoreError + { + NoError, + PermissionDenied, + KeyError, + AlreadyExists, + NotFound, + OutOfResources, + UnknownError, + }; + + QSystemSemaphore(const QString &key, int initialValue = 0, QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open); + ~QSystemSemaphore(); + void setKey(const QString &key, int initialValue = 0, QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open); + QString key() const; + bool acquire(); + bool release(int n = 1); + QSystemSemaphore::SystemSemaphoreError error() const; + QString errorString() const; + +private: + QSystemSemaphore(const QSystemSemaphore &); +}; diff --git a/sip/QtCore/qtemporarydir.sip b/sip/QtCore/qtemporarydir.sip new file mode 100644 index 0000000..47eda1a --- /dev/null +++ b/sip/QtCore/qtemporarydir.sip @@ -0,0 +1,46 @@ +// qtemporarydir.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTemporaryDir +{ +%TypeHeaderCode +#include +%End + +public: + QTemporaryDir(); + explicit QTemporaryDir(const QString &templateName); + ~QTemporaryDir(); + bool isValid() const; + bool autoRemove() const; + void setAutoRemove(bool b); + bool remove(); + QString path() const; + QString errorString() const; + QString filePath(const QString &fileName) const; +%If (Qt_6_4_0 -) + void swap(QTemporaryDir &other); +%End + +private: + QTemporaryDir(const QTemporaryDir &); +}; diff --git a/sip/QtCore/qtemporaryfile.sip b/sip/QtCore/qtemporaryfile.sip new file mode 100644 index 0000000..c3f07b4 --- /dev/null +++ b/sip/QtCore/qtemporaryfile.sip @@ -0,0 +1,47 @@ +// qtemporaryfile.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTemporaryFile : QFile +{ +%TypeHeaderCode +#include +%End + +public: + QTemporaryFile(); + explicit QTemporaryFile(const QString &templateName); + explicit QTemporaryFile(QObject *parent /TransferThis/); + QTemporaryFile(const QString &templateName, QObject *parent /TransferThis/); + virtual ~QTemporaryFile(); + bool autoRemove() const; + void setAutoRemove(bool b); + bool open() /ReleaseGIL/; + virtual QString fileName() const; + QString fileTemplate() const; + void setFileTemplate(const QString &name); + static QTemporaryFile *createNativeFile(const QString &fileName) /Factory,ReleaseGIL/; + static QTemporaryFile *createNativeFile(QFile &file) /Factory,ReleaseGIL/; + bool rename(const QString &newName); + +protected: + virtual bool open(QIODeviceBase::OpenMode flags) /ReleaseGIL/; +}; diff --git a/sip/QtCore/qtenvironmentvariables.sip b/sip/QtCore/qtenvironmentvariables.sip new file mode 100644 index 0000000..8354191 --- /dev/null +++ b/sip/QtCore/qtenvironmentvariables.sip @@ -0,0 +1,43 @@ +// qtenvironmentvariables.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) +%ModuleCode +#include +%End +%End + +%If (Qt_6_5_0 -) +QString qEnvironmentVariable(const char *varName, const QString &defaultValue); +%End +%If (Qt_6_5_0 -) +QString qEnvironmentVariable(const char *varName); +%End +%If (Qt_6_5_0 -) +bool qEnvironmentVariableIsEmpty(const char *varName); +%End +%If (Qt_6_5_0 -) +bool qEnvironmentVariableIsSet(const char *varName); +%End +%If (Qt_6_5_0 -) +int qEnvironmentVariableIntValue(const char *varName, bool *ok = 0); +%End diff --git a/sip/QtCore/qtextboundaryfinder.sip b/sip/QtCore/qtextboundaryfinder.sip new file mode 100644 index 0000000..5e1d370 --- /dev/null +++ b/sip/QtCore/qtextboundaryfinder.sip @@ -0,0 +1,65 @@ +// qtextboundaryfinder.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextBoundaryFinder +{ +%TypeHeaderCode +#include +%End + +public: + enum BoundaryReason /BaseType=Flag/ + { + NotAtBoundary, + SoftHyphen, + BreakOpportunity, + StartOfItem, + EndOfItem, + MandatoryBreak, + }; + + typedef QFlags BoundaryReasons; + + enum BoundaryType + { + Grapheme, + Word, + Line, + Sentence, + }; + + QTextBoundaryFinder(); + QTextBoundaryFinder(const QTextBoundaryFinder &other); + QTextBoundaryFinder(QTextBoundaryFinder::BoundaryType type, const QString &string); + ~QTextBoundaryFinder(); + bool isValid() const; + QTextBoundaryFinder::BoundaryType type() const; + QString string() const; + void toStart(); + void toEnd(); + qsizetype position() const; + void setPosition(qsizetype position); + qsizetype toNextBoundary(); + qsizetype toPreviousBoundary(); + bool isAtBoundary() const; + QTextBoundaryFinder::BoundaryReasons boundaryReasons() const; +}; diff --git a/sip/QtCore/qtextstream.sip b/sip/QtCore/qtextstream.sip new file mode 100644 index 0000000..371cf86 --- /dev/null +++ b/sip/QtCore/qtextstream.sip @@ -0,0 +1,177 @@ +// qtextstream.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QTextStream : QIODeviceBase +{ +%TypeHeaderCode +#include +%End + +public: + enum RealNumberNotation + { + SmartNotation, + FixedNotation, + ScientificNotation, + }; + + enum FieldAlignment + { + AlignLeft, + AlignRight, + AlignCenter, + AlignAccountingStyle, + }; + + enum Status + { + Ok, + ReadPastEnd, + ReadCorruptData, + WriteFailed, + }; + + enum NumberFlag /BaseType=Flag/ + { + ShowBase, + ForcePoint, + ForceSign, + UppercaseBase, + UppercaseDigits, + }; + + typedef QFlags NumberFlags; + QTextStream(); + explicit QTextStream(QIODevice *device); + QTextStream(QByteArray *array /Constrained/, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite); + virtual ~QTextStream(); + void setEncoding(QStringConverter::Encoding encoding); + QStringConverter::Encoding encoding() const; + void setAutoDetectUnicode(bool enabled); + bool autoDetectUnicode() const; + void setGenerateByteOrderMark(bool generate); + bool generateByteOrderMark() const; + void setLocale(const QLocale &locale); + QLocale locale() const; + void setDevice(QIODevice *device); + QIODevice *device() const; + QTextStream::Status status() const; + void setStatus(QTextStream::Status status); + void resetStatus(); + bool atEnd() const; + void reset(); + void flush() /ReleaseGIL/; + bool seek(qint64 pos); + qint64 pos() const; + void skipWhiteSpace(); + QString readLine(qint64 maxLength = 0) /ReleaseGIL/; + QString readAll() /ReleaseGIL/; + QString read(qint64 maxlen) /ReleaseGIL/; + void setFieldAlignment(QTextStream::FieldAlignment alignment); + QTextStream::FieldAlignment fieldAlignment() const; + void setPadChar(QChar ch); + QChar padChar() const; + void setFieldWidth(int width); + int fieldWidth() const; + void setNumberFlags(QTextStream::NumberFlags flags); + QTextStream::NumberFlags numberFlags() const; + void setIntegerBase(int base); + int integerBase() const; + void setRealNumberNotation(QTextStream::RealNumberNotation notation); + QTextStream::RealNumberNotation realNumberNotation() const; + void setRealNumberPrecision(int precision); + int realNumberPrecision() const; + QTextStream &operator>>(QByteArray &array /Constrained/); + QTextStream &operator<<(QStringView s); + QTextStream &operator<<(const QByteArray &array); + QTextStream &operator<<(double f /Constrained/); + QTextStream &operator<<(SIP_PYOBJECT i /TypeHint="int"/); +%MethodCode + qlonglong val = sipLong_AsLongLong(a1); + + if (!PyErr_Occurred()) + { + sipRes = &(*a0 << val); + } + else + { + // If it is positive then it might fit an unsigned long long. + + qulonglong uval = sipLong_AsUnsignedLongLong(a1); + + if (!PyErr_Occurred()) + { + sipRes = &(*a0 << uval); + } + else + { + sipError = (PyErr_ExceptionMatches(PyExc_OverflowError) + ? sipErrorFail : sipErrorContinue); + } + } +%End + +private: + QTextStream(const QTextStream &); +}; + +class QTextStreamManipulator; +QTextStream &operator<<(QTextStream &s, QTextStreamManipulator m); +QTextStreamManipulator qSetFieldWidth(int width); +QTextStreamManipulator qSetPadChar(QChar ch); +QTextStreamManipulator qSetRealNumberPrecision(int precision); + +namespace Qt +{ +%TypeHeaderCode +#include +%End + + QTextStream &bin(QTextStream &s); + QTextStream &oct(QTextStream &s); + QTextStream &dec(QTextStream &s); + QTextStream &hex(QTextStream &s); + QTextStream &showbase(QTextStream &s); + QTextStream &forcesign(QTextStream &s); + QTextStream &forcepoint(QTextStream &s); + QTextStream &noshowbase(QTextStream &s); + QTextStream &noforcesign(QTextStream &s); + QTextStream &noforcepoint(QTextStream &s); + QTextStream &uppercasebase(QTextStream &s); + QTextStream &uppercasedigits(QTextStream &s); + QTextStream &lowercasebase(QTextStream &s); + QTextStream &lowercasedigits(QTextStream &s); + QTextStream &fixed(QTextStream &s); + QTextStream &scientific(QTextStream &s); + QTextStream &left(QTextStream &s); + QTextStream &right(QTextStream &s); + QTextStream ¢er(QTextStream &s); + QTextStream &endl(QTextStream &s); + QTextStream &flush(QTextStream &s); + QTextStream &reset(QTextStream &s); + QTextStream &bom(QTextStream &s); + QTextStream &ws(QTextStream &s); +}; diff --git a/sip/QtCore/qthread.sip b/sip/QtCore/qthread.sip new file mode 100644 index 0000000..ce68d46 --- /dev/null +++ b/sip/QtCore/qthread.sip @@ -0,0 +1,85 @@ +// qthread.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QThread : QObject +{ +%TypeHeaderCode +#include +%End + +public: + static QThread *currentThread(); + static Qt::HANDLE currentThreadId(); + static int idealThreadCount(); + static void yieldCurrentThread() /ReleaseGIL/; + explicit QThread(QObject *parent /TransferThis/ = 0); + virtual ~QThread(); + + enum Priority + { + IdlePriority, + LowestPriority, + LowPriority, + NormalPriority, + HighPriority, + HighestPriority, + TimeCriticalPriority, + InheritPriority, + }; + + bool isFinished() const; + bool isRunning() const; + void setPriority(QThread::Priority priority); + QThread::Priority priority() const; + void setStackSize(uint stackSize); + uint stackSize() const; + void exit(int returnCode = 0) /ReleaseGIL/; + +public slots: + void start(QThread::Priority priority = QThread::InheritPriority) /ReleaseGIL/; + void terminate(); + void quit(); + +public: + bool wait(QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)) /ReleaseGIL/; + bool wait(unsigned long time) /ReleaseGIL/; + +signals: + void started(); + void finished(); + +protected: + virtual void run() /NewThread,ReleaseGIL/; + int exec() /ReleaseGIL/; + static void setTerminationEnabled(bool enabled = true); + +public: + virtual bool event(QEvent *event); + static void sleep(unsigned long) /ReleaseGIL/; + static void msleep(unsigned long) /ReleaseGIL/; + static void usleep(unsigned long) /ReleaseGIL/; + QAbstractEventDispatcher *eventDispatcher() const; + void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher /Transfer/); + void requestInterruption(); + bool isInterruptionRequested() const; + int loopLevel() const; +}; diff --git a/sip/QtCore/qthreadpool.sip b/sip/QtCore/qthreadpool.sip new file mode 100644 index 0000000..03b9ba1 --- /dev/null +++ b/sip/QtCore/qthreadpool.sip @@ -0,0 +1,177 @@ +// qthreadpool.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QThreadPool : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QThreadPool(QObject *parent /TransferThis/ = 0); + virtual ~QThreadPool() /ReleaseGIL/; + static QThreadPool *globalInstance() /KeepReference/; + void start(QRunnable *runnable /GetWrapper/, int priority = 0) /ReleaseGIL/; +%MethodCode + // We have to handle the object ownership manually. + if (a0->autoDelete()) + sipTransferTo(a0Wrapper, sipSelf); + + Py_BEGIN_ALLOW_THREADS + sipCpp->start(a0, a1); + Py_END_ALLOW_THREADS +%End + + void start(SIP_PYCALLABLE functionToRun /TypeHint="Callable[[], None]"/, int priority = 0) /ReleaseGIL/; +%MethodCode + Py_INCREF(a0); + + Py_BEGIN_ALLOW_THREADS + + sipCpp->start([a0]() { + SIP_BLOCK_THREADS + + PyObject *res; + + res = PyObject_CallObject(a0, NULL); + + Py_DECREF(a0); + + if (res) + Py_DECREF(res); + else + pyqt6_err_print(); + + SIP_UNBLOCK_THREADS + }, a1); + + Py_END_ALLOW_THREADS +%End + + bool tryStart(QRunnable *runnable /GetWrapper/) /ReleaseGIL/; +%MethodCode + // We have to handle the object ownership manually. + if (a0->autoDelete()) + sipTransferTo(a0Wrapper, sipSelf); + + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->tryStart(a0); + Py_END_ALLOW_THREADS +%End + + bool tryStart(SIP_PYCALLABLE functionToRun /TypeHint="Callable[[], None]"/) /ReleaseGIL/; +%MethodCode + Py_INCREF(a0); + + Py_BEGIN_ALLOW_THREADS + + sipRes = sipCpp->tryStart([a0]() { + SIP_BLOCK_THREADS + + PyObject *res; + + res = PyObject_CallObject(a0, NULL); + + Py_DECREF(a0); + + if (res) + Py_DECREF(res); + else + pyqt6_err_print(); + + SIP_UNBLOCK_THREADS + }); + + Py_END_ALLOW_THREADS +%End + + bool tryTake(QRunnable *runnable /GetWrapper/) /ReleaseGIL/; +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->tryTake(a0); + Py_END_ALLOW_THREADS + + // We have to handle the object ownership manually. + if (sipRes) + sipTransferBack(a0Wrapper); +%End + + int expiryTimeout() const; + void setExpiryTimeout(int expiryTimeout); + int maxThreadCount() const; + void setMaxThreadCount(int maxThreadCount) /ReleaseGIL/; + int activeThreadCount() const /ReleaseGIL/; + void reserveThread() /ReleaseGIL/; + void releaseThread() /ReleaseGIL/; + bool waitForDone(int msecs = -1) /ReleaseGIL/; + void clear() /ReleaseGIL/; + void setStackSize(uint stackSize); + uint stackSize() const; + bool contains(const QThread *thread) const; +%If (Qt_6_2_0 -) + void setThreadPriority(QThread::Priority priority); +%End +%If (Qt_6_2_0 -) + QThread::Priority threadPriority() const; +%End +%If (Qt_6_3_0 -) + void startOnReservedThread(QRunnable *runnable /GetWrapper/) /ReleaseGIL/; +%MethodCode + // We have to handle the object ownership manually. + if (a0->autoDelete()) + sipTransferTo(a0Wrapper, sipSelf); + + Py_BEGIN_ALLOW_THREADS + sipCpp->startOnReservedThread(a0); + Py_END_ALLOW_THREADS +%End + +%End +%If (Qt_6_3_0 -) + void startOnReservedThread(SIP_PYCALLABLE functionToRun /TypeHint="Callable[[], None]"/) /ReleaseGIL/; +%MethodCode + Py_INCREF(a0); + + Py_BEGIN_ALLOW_THREADS + + sipCpp->startOnReservedThread([a0]() { + SIP_BLOCK_THREADS + + PyObject *res; + + res = PyObject_CallObject(a0, NULL); + + Py_DECREF(a0); + + if (res) + Py_DECREF(res); + else + pyqt6_err_print(); + + SIP_UNBLOCK_THREADS + }); + + Py_END_ALLOW_THREADS +%End + +%End +}; diff --git a/sip/QtCore/qtimeline.sip b/sip/QtCore/qtimeline.sip new file mode 100644 index 0000000..1e37771 --- /dev/null +++ b/sip/QtCore/qtimeline.sip @@ -0,0 +1,85 @@ +// qtimeline.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTimeLine : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Direction + { + Forward, + Backward, + }; + + enum State + { + NotRunning, + Paused, + Running, + }; + + QTimeLine(int duration = 1000, QObject *parent /TransferThis/ = 0); + virtual ~QTimeLine(); + QTimeLine::State state() const; + int loopCount() const; + void setLoopCount(int count); + QTimeLine::Direction direction() const; + void setDirection(QTimeLine::Direction direction); + int duration() const; + void setDuration(int duration); + int startFrame() const; + void setStartFrame(int frame); + int endFrame() const; + void setEndFrame(int frame); + void setFrameRange(int startFrame, int endFrame); + int updateInterval() const; + void setUpdateInterval(int interval); + int currentTime() const; + int currentFrame() const; + qreal currentValue() const; + int frameForTime(int msec) const; + virtual qreal valueForTime(int msec) const; + +public slots: + void resume(); + void setCurrentTime(int msec); + void setPaused(bool paused); + void start(); + void stop(); + void toggleDirection(); + +signals: + void finished(); + void frameChanged(int); + void stateChanged(QTimeLine::State newState); + void valueChanged(qreal x); + +protected: + virtual void timerEvent(QTimerEvent *event); + +public: + QEasingCurve easingCurve() const; + void setEasingCurve(const QEasingCurve &curve); +}; diff --git a/sip/QtCore/qtimer.sip b/sip/QtCore/qtimer.sip new file mode 100644 index 0000000..a1e27e7 --- /dev/null +++ b/sip/QtCore/qtimer.sip @@ -0,0 +1,83 @@ +// qtimer.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTimer : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTimer(QObject *parent /TransferThis/ = 0); + virtual ~QTimer(); + bool isActive() const; + int timerId() const; + void setInterval(int msec); + int interval() const; + bool isSingleShot() const; + void setSingleShot(bool asingleShot); + static void singleShot(int msec, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_get_connection_parts(a1, 0, "()", true, &receiver, slot_signature)) == sipErrorNone) + { + QTimer::singleShot(a0, receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(1, a1); + } +%End + + static void singleShot(int msec, Qt::TimerType timerType, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_get_connection_parts(a2, 0, "()", true, &receiver, slot_signature)) == sipErrorNone) + { + QTimer::singleShot(a0, a1, receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(2, a2); + } +%End + +public slots: + void start(int msec); + void start(); + void stop(); + +signals: + void timeout(); + +protected: + virtual void timerEvent(QTimerEvent *); + +public: + void setTimerType(Qt::TimerType atype); + Qt::TimerType timerType() const; + int remainingTime() const; +}; diff --git a/sip/QtCore/qtimezone.sip b/sip/QtCore/qtimezone.sip new file mode 100644 index 0000000..e331ad2 --- /dev/null +++ b/sip/QtCore/qtimezone.sip @@ -0,0 +1,153 @@ +// qtimezone.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTimeZone +{ +%TypeHeaderCode +#include +%End + +public: + enum TimeType + { + StandardTime, + DaylightTime, + GenericTime, + }; + + enum NameType + { + DefaultName, + LongName, + ShortName, + OffsetName, + }; + + struct OffsetData + { +%TypeHeaderCode +#include +%End + + QString abbreviation; + QDateTime atUtc; + int offsetFromUtc; + int standardTimeOffset; + int daylightTimeOffset; + }; + + typedef QList OffsetDataList; +%If (Qt_6_5_0 -) + QTimeZone(QTimeZone::Initialization spec); +%End +%If (Qt_6_2_0 -) + QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name, const QString &abbreviation, QLocale::Territory territory = QLocale::AnyTerritory, const QString &comment = QString()); +%End +%If (- Qt_6_2_0) + QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name, const QString &abbreviation, QLocale::Country country = QLocale::AnyCountry, const QString &comment = QString()); +%End + explicit QTimeZone(const QByteArray &ianaId); + explicit QTimeZone(int offsetSeconds); + QTimeZone(const QTimeZone &other); + QTimeZone(); + ~QTimeZone(); + void swap(QTimeZone &other /Constrained/); + bool operator==(const QTimeZone &other) const; + bool operator!=(const QTimeZone &other) const; + bool isValid() const; + QByteArray id() const; + QLocale::Country country() const; +%If (Qt_6_2_0 -) + QLocale::Territory territory() const; +%End + QString comment() const; + QString displayName(const QDateTime &atDateTime, QTimeZone::NameType nameType = QTimeZone::DefaultName, const QLocale &locale = QLocale()) const; + QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType = QTimeZone::DefaultName, const QLocale &locale = QLocale()) const; + QString abbreviation(const QDateTime &atDateTime) const; + int offsetFromUtc(const QDateTime &atDateTime) const; + int standardTimeOffset(const QDateTime &atDateTime) const; + int daylightTimeOffset(const QDateTime &atDateTime) const; + bool hasDaylightTime() const; + bool isDaylightTime(const QDateTime &atDateTime) const; + QTimeZone::OffsetData offsetData(const QDateTime &forDateTime) const; + bool hasTransitions() const; + QTimeZone::OffsetData nextTransition(const QDateTime &afterDateTime) const; + QTimeZone::OffsetData previousTransition(const QDateTime &beforeDateTime) const; + QTimeZone::OffsetDataList transitions(const QDateTime &fromDateTime, const QDateTime &toDateTime) const; + static QByteArray systemTimeZoneId(); + static bool isTimeZoneIdAvailable(const QByteArray &ianaId); +%If (Qt_6_2_0 -) + static QList availableTimeZoneIds(QLocale::Territory territory /Constrained/); +%End +%If (- Qt_6_2_0) + static QList availableTimeZoneIds(QLocale::Country country /Constrained/); +%End + static QList availableTimeZoneIds(int offsetSeconds); + static QList availableTimeZoneIds(); + static QByteArray ianaIdToWindowsId(const QByteArray &ianaId); + static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId); +%If (Qt_6_2_0 -) + static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId, QLocale::Territory territory); +%End +%If (- Qt_6_2_0) + static QByteArray windowsIdToDefaultIanaId(const QByteArray &windowsId, QLocale::Country country); +%End + static QList windowsIdToIanaIds(const QByteArray &windowsId); +%If (Qt_6_2_0 -) + static QList windowsIdToIanaIds(const QByteArray &windowsId, QLocale::Territory territory); +%End +%If (- Qt_6_2_0) + static QList windowsIdToIanaIds(const QByteArray &windowsId, QLocale::Country country); +%End + static QTimeZone systemTimeZone(); + static QTimeZone utc(); +%If (Qt_6_5_0 -) + + enum Initialization + { + LocalTime, + UTC, + }; + +%End +%If (Qt_6_5_0 -) + static QTimeZone fromSecondsAheadOfUtc(int offset); +%End +%If (Qt_6_5_0 -) + Qt::TimeSpec timeSpec() const; +%End +%If (Qt_6_5_0 -) + int fixedSecondsAheadOfUtc() const; +%End +%If (Qt_6_5_0 -) + bool isUtcOrFixedOffset() const; +%End +%If (Qt_6_5_0 -) + static bool isUtcOrFixedOffset(Qt::TimeSpec spec); +%End +%If (Qt_6_5_0 -) + QTimeZone asBackendZone() const; +%End +}; + +QDataStream &operator<<(QDataStream &ds, const QTimeZone &tz) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &ds, QTimeZone &tz /Constrained/) /ReleaseGIL/; diff --git a/sip/QtCore/qtranslator.sip b/sip/QtCore/qtranslator.sip new file mode 100644 index 0000000..ed3c225 --- /dev/null +++ b/sip/QtCore/qtranslator.sip @@ -0,0 +1,39 @@ +// qtranslator.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTranslator : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTranslator(QObject *parent /TransferThis/ = 0); + virtual ~QTranslator(); + virtual QString translate(const char *context, const char *sourceText, const char *disambiguation = 0, int n = -1) const; + virtual bool isEmpty() const; + bool load(const QString &fileName, const QString &directory = QString(), const QString &searchDelimiters = QString(), const QString &suffix = QString()) /ReleaseGIL/; + bool load(const QLocale &locale, const QString &fileName, const QString &prefix = QString(), const QString &directory = QString(), const QString &suffix = QString()) /ReleaseGIL/; + bool load(const uchar *data /Array/, int len /ArraySize/, const QString &directory = QString()) /PyName=loadFromData,ReleaseGIL/; + QString language() const; + QString filePath() const; +}; diff --git a/sip/QtCore/qtransposeproxymodel.sip b/sip/QtCore/qtransposeproxymodel.sip new file mode 100644 index 0000000..b14eae2 --- /dev/null +++ b/sip/QtCore/qtransposeproxymodel.sip @@ -0,0 +1,51 @@ +// qtransposeproxymodel.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTransposeProxyModel : QAbstractProxyModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTransposeProxyModel(QObject *parent /TransferThis/ = 0); + virtual ~QTransposeProxyModel(); + virtual void setSourceModel(QAbstractItemModel *newSourceModel /KeepReference/); + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); + virtual bool setItemData(const QModelIndex &index, const QMap &roles); + virtual QSize span(const QModelIndex &index) const; + virtual QMap itemData(const QModelIndex &index) const; + virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; + virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const; + virtual QModelIndex parent(const QModelIndex &index) const; + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild); + virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild); + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); +}; diff --git a/sip/QtCore/qtversion.sip b/sip/QtCore/qtversion.sip new file mode 100644 index 0000000..2aa7f4f --- /dev/null +++ b/sip/QtCore/qtversion.sip @@ -0,0 +1,31 @@ +// qtversion.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) +%ModuleCode +#include +%End +%End + +%If (Qt_6_5_0 -) +const char *qVersion(); +%End diff --git a/sip/QtCore/qtypes.sip b/sip/QtCore/qtypes.sip new file mode 100644 index 0000000..f13019e --- /dev/null +++ b/sip/QtCore/qtypes.sip @@ -0,0 +1,77 @@ +// qtypes.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) +typedef unsigned char uchar; +%End +%If (Qt_6_5_0 -) +typedef unsigned short ushort; +%End +%If (Qt_6_5_0 -) +typedef unsigned int uint; +%End +%If (Qt_6_5_0 -) +typedef unsigned long ulong; +%End +%If (Qt_6_5_0 -) +typedef signed char qint8; +%End +%If (Qt_6_5_0 -) +typedef unsigned char quint8; +%End +%If (Qt_6_5_0 -) +typedef short qint16; +%End +%If (Qt_6_5_0 -) +typedef unsigned short quint16; +%End +%If (Qt_6_5_0 -) +typedef int qint32; +%End +%If (Qt_6_5_0 -) +typedef unsigned int quint32; +%End +%If (Qt_6_5_0 -) +typedef long long qint64; +%End +%If (Qt_6_5_0 -) +typedef unsigned long long quint64; +%End +%If (Qt_6_5_0 -) +typedef qint64 qlonglong; +%End +%If (Qt_6_5_0 -) +typedef quint64 qulonglong; +%End +%If (Qt_6_5_0 -) +%If (PyQt_qreal_double) +typedef double qreal; +%End +%End +%If (Qt_6_5_0 -) +%If (!PyQt_qreal_double) +typedef float qreal; +%End +%End +%If (Qt_6_5_0 -) +typedef long long qsizetype; +%End diff --git a/sip/QtCore/qurl.sip b/sip/QtCore/qurl.sip new file mode 100644 index 0000000..716953f --- /dev/null +++ b/sip/QtCore/qurl.sip @@ -0,0 +1,187 @@ +// qurl.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QUrl +{ +%TypeHeaderCode +#include +%End + +%TypeCode +#include +%End + +public: + enum ParsingMode + { + TolerantMode, + StrictMode, + DecodedMode, + }; + + QUrl(); + QUrl(const QString &url, QUrl::ParsingMode mode = QUrl::TolerantMode); + QUrl(const QUrl ©); + ~QUrl(); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + PyObject *uni = qpycore_PyObject_FromQString(sipCpp->toString()); + + if (uni) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QUrl(%R)", uni); + + Py_DECREF(uni); + } +%End + + enum UrlFormattingOption /BaseType=IntFlag/ + { + None, + RemoveScheme, + RemovePassword, + RemoveUserInfo, + RemovePort, + RemoveAuthority, + RemovePath, + RemoveQuery, + RemoveFragment, + PreferLocalFile, + StripTrailingSlash, + RemoveFilename, + NormalizePathSegments, + }; + + typedef QFlags FormattingOptions; + + enum ComponentFormattingOption /BaseType=IntFlag/ + { + PrettyDecoded, + EncodeSpaces, + EncodeUnicode, + EncodeDelimiters, + EncodeReserved, + DecodeReserved, + FullyEncoded, + FullyDecoded, + }; + + typedef QFlags ComponentFormattingOptions; + QString url(QUrl::FormattingOptions options = QUrl::FormattingOptions(QUrl::PrettyDecoded)) const; + void setUrl(const QString &url, QUrl::ParsingMode mode = QUrl::TolerantMode); + bool isValid() const; + bool isEmpty() const; + void clear(); + void setScheme(const QString &scheme); + QString scheme() const; + void setAuthority(const QString &authority, QUrl::ParsingMode mode = QUrl::TolerantMode); + QString authority(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const; + void setUserInfo(const QString &userInfo, QUrl::ParsingMode mode = QUrl::TolerantMode); + QString userInfo(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const; + void setUserName(const QString &userName, QUrl::ParsingMode mode = QUrl::DecodedMode); + QString userName(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const; + void setPassword(const QString &password, QUrl::ParsingMode mode = QUrl::DecodedMode); + QString password(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const; + void setHost(const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode); + QString host(QUrl::ComponentFormattingOptions = QUrl::FullyDecoded) const; + void setPort(int port); + int port(int defaultPort = -1) const; + void setPath(const QString &path, QUrl::ParsingMode mode = QUrl::DecodedMode); + QString path(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const; + void setFragment(const QString &fragment, QUrl::ParsingMode mode = QUrl::TolerantMode); + QString fragment(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const; + QUrl resolved(const QUrl &relative) const; + bool isRelative() const; + bool isParentOf(const QUrl &url) const; + static QUrl fromLocalFile(const QString &localfile); + QString toLocalFile() const; + QString toString(QUrl::FormattingOptions options = QUrl::FormattingOptions(QUrl::PrettyDecoded)) const; + QString toString(QUrl::ComponentFormattingOptions options) const; + QByteArray toEncoded(QUrl::FormattingOptions options = QUrl::FullyEncoded) const; + QByteArray toEncoded(QUrl::ComponentFormattingOptions options) const; + static QUrl fromEncoded(const QByteArray &u, QUrl::ParsingMode mode = QUrl::TolerantMode); + void detach(); + bool isDetached() const; + bool operator<(const QUrl &url) const; + bool operator==(const QUrl &url) const; + bool operator!=(const QUrl &url) const; + static QString fromPercentEncoding(const QByteArray &); + static QByteArray toPercentEncoding(const QString &input, const QByteArray &exclude = QByteArray(), const QByteArray &include = QByteArray()); + bool hasQuery() const; + bool hasFragment() const; + QString errorString() const; +%If (Qt_6_3_0 -) + static QString fromAce(const QByteArray &domain, QUrl::AceProcessingOptions options = {}); +%End +%If (- Qt_6_3_0) + static QString fromAce(const QByteArray &); +%End +%If (Qt_6_3_0 -) + static QByteArray toAce(const QString &domain, QUrl::AceProcessingOptions options = {}); +%End +%If (- Qt_6_3_0) + static QByteArray toAce(const QString &); +%End + static QStringList idnWhitelist(); + static void setIdnWhitelist(const QStringList &); + static QUrl fromUserInput(const QString &userInput, const QString &workingDirectory = QString(), QUrl::UserInputResolutionOptions options = QUrl::DefaultResolution); + void swap(QUrl &other /Constrained/); + bool isLocalFile() const; + QString toDisplayString(QUrl::FormattingOptions options = QUrl::FormattingOptions(QUrl::PrettyDecoded)) const; + QString toDisplayString(QUrl::ComponentFormattingOptions options) const; + void setQuery(const QString &query, QUrl::ParsingMode mode = QUrl::TolerantMode); + void setQuery(const QUrlQuery &query); + QString query(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const; + static QStringList toStringList(const QList &uris, QUrl::FormattingOptions options = QUrl::FormattingOptions(QUrl::PrettyDecoded)); + static QList fromStringList(const QStringList &uris, QUrl::ParsingMode mode = QUrl::TolerantMode); + QUrl adjusted(QUrl::FormattingOptions options) const; + QString fileName(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const; + bool matches(const QUrl &url, QUrl::FormattingOptions options) const; + + enum UserInputResolutionOption /BaseType=Flag/ + { + DefaultResolution, + AssumeLocalFile, + }; + + typedef QFlags UserInputResolutionOptions; +%If (Qt_6_3_0 -) + + enum AceProcessingOption /BaseType=Flag/ + { + IgnoreIDNWhitelist, + AceTransitionalProcessing, + }; + +%End +%If (Qt_6_3_0 -) + typedef QFlags AceProcessingOptions; +%End +}; + +QDataStream &operator<<(QDataStream &, const QUrl &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QUrl & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtCore/qurlquery.sip b/sip/QtCore/qurlquery.sip new file mode 100644 index 0000000..f22b46c --- /dev/null +++ b/sip/QtCore/qurlquery.sip @@ -0,0 +1,69 @@ +// qurlquery.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QUrlQuery +{ +%TypeHeaderCode +#include +%End + +public: + QUrlQuery(); + explicit QUrlQuery(const QUrl &url); + explicit QUrlQuery(const QString &queryString); + QUrlQuery(const QUrlQuery &other); + ~QUrlQuery(); + bool operator==(const QUrlQuery &other) const; + bool operator!=(const QUrlQuery &other) const; + void swap(QUrlQuery &other /Constrained/); + bool isEmpty() const; + bool isDetached() const; + void clear(); + QString query(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const; + void setQuery(const QString &queryString); + QString toString(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const; + void setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter); + QChar queryValueDelimiter() const; + QChar queryPairDelimiter() const; + void setQueryItems(const QList> &query); + QList> queryItems(QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const; + bool hasQueryItem(const QString &key) const; + void addQueryItem(const QString &key, const QString &value); + void removeQueryItem(const QString &key); + QString queryItemValue(const QString &key, QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const; + QStringList allQueryItemValues(const QString &key, QUrl::ComponentFormattingOptions options = QUrl::PrettyDecoded) const; + void removeAllQueryItems(const QString &key); + static QChar defaultQueryValueDelimiter(); +%MethodCode + sipRes = new QChar(QUrlQuery::defaultQueryValueDelimiter()); +%End + + static QChar defaultQueryPairDelimiter(); +%MethodCode + sipRes = new QChar(QUrlQuery::defaultQueryPairDelimiter()); +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; diff --git a/sip/QtCore/quuid.sip b/sip/QtCore/quuid.sip new file mode 100644 index 0000000..76dc6b4 --- /dev/null +++ b/sip/QtCore/quuid.sip @@ -0,0 +1,117 @@ +// quuid.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QUuid +{ +%TypeHeaderCode +#include +%End + +public: + enum Variant + { + VarUnknown, + NCS, + DCE, + Microsoft, + Reserved, + }; + + enum Version + { + VerUnknown, + Time, + EmbeddedPOSIX, + Md5, + Name, + Random, + Sha1, + }; + + enum StringFormat + { + WithBraces, + WithoutBraces, + Id128, + }; + + QUuid(); + QUuid(uint l, ushort w1, ushort w2, uchar b1 /PyInt/, uchar b2 /PyInt/, uchar b3 /PyInt/, uchar b4 /PyInt/, uchar b5 /PyInt/, uchar b6 /PyInt/, uchar b7 /PyInt/, uchar b8 /PyInt/); +%If (Qt_6_4_0 -) + explicit QUuid(QAnyStringView string); +%End +%If (- Qt_6_4_0) + explicit QUuid(const QString &); +%End +%If (- Qt_6_4_0) + explicit QUuid(const QByteArray &); +%End + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + PyObject *uni = qpycore_PyObject_FromQString(sipCpp->toString()); + + if (uni) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QUuid(%R)", uni); + + Py_DECREF(uni); + } +%End + + QString toString(QUuid::StringFormat mode = QUuid::WithBraces) const; + bool isNull() const; + bool operator==(const QUuid &orig) const; + bool operator!=(const QUuid &orig) const; + bool operator<(const QUuid &other) const; + bool operator>(const QUuid &other) const; + static QUuid createUuid(); + static QUuid createUuidV3(const QUuid &ns, const QByteArray &baseData); + static QUuid createUuidV5(const QUuid &ns, const QByteArray &baseData); + static QUuid createUuidV3(const QUuid &ns, const QString &baseData); + static QUuid createUuidV5(const QUuid &ns, const QString &baseData); + QUuid::Variant variant() const; + QUuid::Version version() const; + QByteArray toByteArray(QUuid::StringFormat mode = QUuid::WithBraces) const; + QByteArray toRfc4122() const; +%If (Qt_6_3_0 -) + static QUuid fromRfc4122(QByteArrayView); +%End +%If (- Qt_6_3_0) + static QUuid fromRfc4122(const QByteArray &); +%End +%If (Qt_6_4_0 -) + static QUuid fromString(QAnyStringView string); +%End +%If (- Qt_6_4_0) + static QUuid fromString(QStringView string); +%End +}; + +QDataStream &operator<<(QDataStream &, const QUuid & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QUuid & /Constrained/) /ReleaseGIL/; +bool operator<=(const QUuid &lhs, const QUuid &rhs); +bool operator>=(const QUuid &lhs, const QUuid &rhs); diff --git a/sip/QtCore/qvariant.sip b/sip/QtCore/qvariant.sip new file mode 100644 index 0000000..c65f1da --- /dev/null +++ b/sip/QtCore/qvariant.sip @@ -0,0 +1,99 @@ +// qvariant.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QVariant /AllowNone,TypeHint="Any",TypeHintValue="None"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +if (sipIsErr == NULL) + // We can convert everything to a QVariant. + return 1; + +// If it is already a QVariant then just return it. +if (Py_TYPE(sipPy) == sipTypeAsPyTypeObject(sipType_QVariant)) +{ + *sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, + sipType_QVariant, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + + return 0; +} + +// Convert it to a QVariant. +QVariant var = qpycore_PyObject_AsQVariant(sipPy, sipIsErr); + +if (*sipIsErr) + return 0; + +*sipCppPtr = new QVariant(var); + +return sipGetState(sipTransferObj); +%End + +%ConvertFromTypeCode +return qpycore_PyObject_FromQVariant(*sipCpp); +%End + +public: + QVariant(); + QVariant(SIP_PYOBJECT obj); +%MethodCode + int is_err = 0; + QVariant var = qpycore_PyObject_AsQVariant(a0, &is_err); + + if (is_err) + sipCpp = 0; + else + sipCpp = new QVariant(var); +%End + + ~QVariant(); + SIP_PYOBJECT value() const; +%MethodCode + sipRes = qpycore_PyObject_FromQVariant(*sipCpp); +%End + + int userType() const; + const char *typeName() const; + bool canConvert(QMetaType targetType) const; + bool convert(QMetaType type); + bool isValid() const; + bool isNull() const; + void clear(); + void load(QDataStream &ds) /ReleaseGIL/; + void save(QDataStream &ds) const /ReleaseGIL/; + void swap(QVariant &other /Constrained/); + QMetaType metaType() const; + bool canView(QMetaType targetType) const; + int typeId() const; +}; + +QDataStream &operator>>(QDataStream &s, QVariant &p /Constrained/) /ReleaseGIL/; +QDataStream &operator<<(QDataStream &s, const QVariant &p /Constrained/) /ReleaseGIL/; +bool operator==(const QVariant &a, const QVariant &b); +bool operator!=(const QVariant &a, const QVariant &b); +typedef QHash QVariantHash /TypeHint="Dict[QString, QVariant]"/; +typedef QList QVariantList /TypeHint="List[QVariant]"/; +typedef QMap QVariantMap /TypeHint="Dict[QString, QVariant]"/; +typedef std::pair QVariantPair /TypeHint="Tuple[QVariant, QVariant]"/; diff --git a/sip/QtCore/qvariantanimation.sip b/sip/QtCore/qvariantanimation.sip new file mode 100644 index 0000000..d731014 --- /dev/null +++ b/sip/QtCore/qvariantanimation.sip @@ -0,0 +1,56 @@ +// qvariantanimation.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QVariantAnimation : QAbstractAnimation +{ +%TypeHeaderCode +#include +%End + +public: + typedef QList > KeyValues; + QVariantAnimation(QObject *parent /TransferThis/ = 0); + virtual ~QVariantAnimation(); + QVariant startValue() const; + void setStartValue(const QVariant &value); + QVariant endValue() const; + void setEndValue(const QVariant &value); + QVariant keyValueAt(qreal step) const; + void setKeyValueAt(qreal step, const QVariant &value); + QVariantAnimation::KeyValues keyValues() const; + void setKeyValues(const QVariantAnimation::KeyValues &values); + QVariant currentValue() const; + virtual int duration() const; + void setDuration(int msecs); + QEasingCurve easingCurve() const; + void setEasingCurve(const QEasingCurve &easing); + +signals: + void valueChanged(const QVariant &value); + +protected: + virtual bool event(QEvent *event); + virtual void updateCurrentTime(int); + virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState); + virtual void updateCurrentValue(const QVariant &value); + virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const; +}; diff --git a/sip/QtCore/qversionnumber.sip b/sip/QtCore/qversionnumber.sip new file mode 100644 index 0000000..d04ced7 --- /dev/null +++ b/sip/QtCore/qversionnumber.sip @@ -0,0 +1,111 @@ +// qversionnumber.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +QDataStream &operator<<(QDataStream &out, const QTypeRevision &revision) /ReleaseGIL/; +QDataStream &operator<<(QDataStream &out, const QVersionNumber &version) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &in, QTypeRevision &revision /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &in, QVersionNumber &version /Constrained/) /ReleaseGIL/; + +class QVersionNumber +{ +%TypeHeaderCode +#include +%End + +public: + QVersionNumber(); + explicit QVersionNumber(const QList &seg); + explicit QVersionNumber(int maj); + QVersionNumber(int maj, int min); + QVersionNumber(int maj, int min, int mic); + bool isNull() const; + bool isNormalized() const; + int majorVersion() const; + int minorVersion() const; + int microVersion() const; + QVersionNumber normalized() const; + QList segments() const; +%If (Qt_6_4_0 -) + int segmentAt(qsizetype index) const; +%End +%If (- Qt_6_4_0) + int segmentAt(int index) const; +%End +%If (Qt_6_4_0 -) + qsizetype segmentCount() const; +%End +%If (- Qt_6_4_0) + int segmentCount() const; +%End + bool isPrefixOf(const QVersionNumber &other) const; + static int compare(const QVersionNumber &v1, const QVersionNumber &v2); + static QVersionNumber commonPrefix(const QVersionNumber &v1, const QVersionNumber &v2); + QString toString() const; +%If (Qt_6_4_0 -) + static QVersionNumber fromString(QAnyStringView string, qsizetype *suffixIndex = 0); +%End +%If (- Qt_6_4_0) + static QVersionNumber fromString(const QString &string, int *suffixIndex = 0); +%End + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +bool operator>(QTypeRevision lhs, QTypeRevision rhs); +bool operator>(const QVersionNumber &lhs, const QVersionNumber &rhs); +bool operator>=(QTypeRevision lhs, QTypeRevision rhs); +bool operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs); +bool operator<(QTypeRevision lhs, QTypeRevision rhs); +bool operator<(const QVersionNumber &lhs, const QVersionNumber &rhs); +bool operator<=(QTypeRevision lhs, QTypeRevision rhs); +bool operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs); +bool operator==(QTypeRevision lhs, QTypeRevision rhs); +bool operator==(const QVersionNumber &lhs, const QVersionNumber &rhs); +bool operator!=(QTypeRevision lhs, QTypeRevision rhs); +bool operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs); + +class QTypeRevision +{ +%TypeHeaderCode +#include +%End + +public: + static QTypeRevision zero(); + QTypeRevision(); + bool hasMajorVersion() const; + quint8 majorVersion() const; + bool hasMinorVersion() const; + quint8 minorVersion() const; + bool isValid() const; + unsigned short toEncodedVersion() const; +%MethodCode + sipRes = sipCpp->toEncodedVersion(); +%End + + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; diff --git a/sip/QtCore/qwaitcondition.sip b/sip/QtCore/qwaitcondition.sip new file mode 100644 index 0000000..a3ace0c --- /dev/null +++ b/sip/QtCore/qwaitcondition.sip @@ -0,0 +1,41 @@ +// qwaitcondition.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QWaitCondition +{ +%TypeHeaderCode +#include +%End + +public: + QWaitCondition(); + ~QWaitCondition(); + bool wait(QMutex *lockedMutex, QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)) /ReleaseGIL/; + bool wait(QMutex *lockedMutex, unsigned long time) /ReleaseGIL/; + bool wait(QReadWriteLock *lockedReadWriteLock, QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)) /ReleaseGIL/; + bool wait(QReadWriteLock *lockedReadWriteLock, unsigned long time) /ReleaseGIL/; + void wakeOne(); + void wakeAll(); + +private: + QWaitCondition(const QWaitCondition &); +}; diff --git a/sip/QtCore/qwineventnotifier.sip b/sip/QtCore/qwineventnotifier.sip new file mode 100644 index 0000000..0dea565 --- /dev/null +++ b/sip/QtCore/qwineventnotifier.sip @@ -0,0 +1,54 @@ +// This is the SIP specification of the QWinEventNotifier class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Windows) + +// This hack is for the activated() signal. +typedef Qt::HANDLE HANDLE; + +class QWinEventNotifier: QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QWinEventNotifier(QObject *parent /TransferThis/ = 0); + explicit QWinEventNotifier(Qt::HANDLE hEvent, QObject *parent /TransferThis/ = 0); + ~QWinEventNotifier(); + + Qt::HANDLE handle() const; + bool isEnabled() const; + void setHandle(Qt::HANDLE hEvent); + +public slots: + void setEnabled(bool enable); + +signals: + void activated(HANDLE hEvent); + +protected: + bool event(QEvent *e); + +private: + QWinEventNotifier(const QWinEventNotifier &); +}; + +%End diff --git a/sip/QtCore/qxmlstream.sip b/sip/QtCore/qxmlstream.sip new file mode 100644 index 0000000..ca5120e --- /dev/null +++ b/sip/QtCore/qxmlstream.sip @@ -0,0 +1,537 @@ +// qxmlstream.sip generated by MetaSIP +// +// This file is part of the QtCore Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QXmlStreamAttribute +{ +%TypeHeaderCode +#include +%End + +public: + QXmlStreamAttribute(); + QXmlStreamAttribute(const QString &qualifiedName, const QString &value); + QXmlStreamAttribute(const QString &namespaceUri, const QString &name, const QString &value); + QStringView namespaceUri() const; + QStringView name() const; + QStringView qualifiedName() const; + QStringView prefix() const; + QStringView value() const; + bool isDefault() const; + bool operator==(const QXmlStreamAttribute &other) const; + bool operator!=(const QXmlStreamAttribute &other) const; +}; + +class QXmlStreamNamespaceDeclaration +{ +%TypeHeaderCode +#include +%End + +public: + QXmlStreamNamespaceDeclaration(); + QXmlStreamNamespaceDeclaration(const QString &prefix, const QString &namespaceUri); + QStringView prefix() const; + QStringView namespaceUri() const; + bool operator==(const QXmlStreamNamespaceDeclaration &other) const; + bool operator!=(const QXmlStreamNamespaceDeclaration &other) const; +}; + +typedef QList QXmlStreamNamespaceDeclarations; + +class QXmlStreamNotationDeclaration +{ +%TypeHeaderCode +#include +%End + +public: + QXmlStreamNotationDeclaration(); + QStringView name() const; + QStringView systemId() const; + QStringView publicId() const; + bool operator==(const QXmlStreamNotationDeclaration &other) const; + bool operator!=(const QXmlStreamNotationDeclaration &other) const; +}; + +typedef QList QXmlStreamNotationDeclarations; + +class QXmlStreamEntityDeclaration +{ +%TypeHeaderCode +#include +%End + +public: + QXmlStreamEntityDeclaration(); + QStringView name() const; + QStringView notationName() const; + QStringView systemId() const; + QStringView publicId() const; + QStringView value() const; + bool operator==(const QXmlStreamEntityDeclaration &other) const; + bool operator!=(const QXmlStreamEntityDeclaration &other) const; +}; + +typedef QList QXmlStreamEntityDeclarations; + +class QXmlStreamEntityResolver +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QXmlStreamEntityResolver(); + virtual QString resolveUndeclaredEntity(const QString &name); +}; + +class QXmlStreamReader +{ +%TypeHeaderCode +#include +%End + +public: + enum TokenType + { + NoToken, + Invalid, + StartDocument, + EndDocument, + StartElement, + EndElement, + Characters, + Comment, + DTD, + EntityReference, + ProcessingInstruction, + }; + + QXmlStreamReader(); + explicit QXmlStreamReader(QIODevice *device); +%If (Qt_6_5_0 -) + explicit QXmlStreamReader(QAnyStringView data); +%End +%If (- Qt_6_5_0) + explicit QXmlStreamReader(const QByteArray &data); +%End +%If (- Qt_6_5_0) + explicit QXmlStreamReader(const QString &data); +%End + ~QXmlStreamReader(); + void setDevice(QIODevice *device); + QIODevice *device() const; +%If (Qt_6_5_0 -) + void addData(QAnyStringView data); +%End +%If (- Qt_6_5_0) + void addData(const QByteArray &data); +%End +%If (- Qt_6_5_0) + void addData(const QString &data); +%End + void clear(); + bool atEnd() const; + QXmlStreamReader::TokenType readNext(); + QXmlStreamReader::TokenType tokenType() const; + QString tokenString() const; + void setNamespaceProcessing(bool); + bool namespaceProcessing() const; + bool isStartDocument() const; + bool isEndDocument() const; + bool isStartElement() const; + bool isEndElement() const; + bool isCharacters() const; + bool isWhitespace() const; + bool isCDATA() const; + bool isComment() const; + bool isDTD() const; + bool isEntityReference() const; + bool isProcessingInstruction() const; + bool isStandaloneDocument() const; + QStringView documentVersion() const; + QStringView documentEncoding() const; + qint64 lineNumber() const; + qint64 columnNumber() const; + qint64 characterOffset() const; + QXmlStreamAttributes attributes() const; + + enum ReadElementTextBehaviour + { + ErrorOnUnexpectedElement, + IncludeChildElements, + SkipChildElements, + }; + + QString readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour = QXmlStreamReader::ErrorOnUnexpectedElement); + QStringView name() const; + QStringView namespaceUri() const; + QStringView qualifiedName() const; + QStringView prefix() const; + QStringView processingInstructionTarget() const; + QStringView processingInstructionData() const; + QStringView text() const; + QXmlStreamNamespaceDeclarations namespaceDeclarations() const; + void addExtraNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &extraNamespaceDeclaraction); + void addExtraNamespaceDeclarations(const QXmlStreamNamespaceDeclarations &extraNamespaceDeclaractions); + QXmlStreamNotationDeclarations notationDeclarations() const; + QXmlStreamEntityDeclarations entityDeclarations() const; + QStringView dtdName() const; + QStringView dtdPublicId() const; + QStringView dtdSystemId() const; + + enum Error + { + NoError, + UnexpectedElementError, + CustomError, + NotWellFormedError, + PrematureEndOfDocumentError, + }; + + void raiseError(const QString &message = QString()); + QString errorString() const; + QXmlStreamReader::Error error() const; + bool hasError() const; + void setEntityResolver(QXmlStreamEntityResolver *resolver /KeepReference/); + QXmlStreamEntityResolver *entityResolver() const; + bool readNextStartElement(); + void skipCurrentElement(); + int entityExpansionLimit() const; + void setEntityExpansionLimit(int limit); + +private: + QXmlStreamReader(const QXmlStreamReader &); +}; + +class QXmlStreamWriter +{ +%TypeHeaderCode +#include +%End + +public: + QXmlStreamWriter(); + explicit QXmlStreamWriter(QIODevice *device); + explicit QXmlStreamWriter(QByteArray *array); + ~QXmlStreamWriter(); + void setDevice(QIODevice *device); + QIODevice *device() const; + void setAutoFormatting(bool); + bool autoFormatting() const; + void setAutoFormattingIndent(int spaces); + int autoFormattingIndent() const; +%If (Qt_6_5_0 -) + void writeAttribute(QAnyStringView namespaceUri, QAnyStringView name, QAnyStringView value); +%End +%If (Qt_6_5_0 -) + void writeAttribute(QAnyStringView qualifiedName, QAnyStringView value); +%End +%If (- Qt_6_5_0) + void writeAttribute(const QString &qualifiedName, const QString &value); +%End +%If (- Qt_6_5_0) + void writeAttribute(const QString &namespaceUri, const QString &name, const QString &value); +%End + void writeAttribute(const QXmlStreamAttribute &attribute); + void writeAttributes(const QXmlStreamAttributes &attributes); +%If (Qt_6_5_0 -) + void writeCDATA(QAnyStringView text); +%End +%If (- Qt_6_5_0) + void writeCDATA(const QString &text); +%End +%If (Qt_6_5_0 -) + void writeCharacters(QAnyStringView text); +%End +%If (- Qt_6_5_0) + void writeCharacters(const QString &text); +%End +%If (Qt_6_5_0 -) + void writeComment(QAnyStringView text); +%End +%If (- Qt_6_5_0) + void writeComment(const QString &text); +%End +%If (Qt_6_5_0 -) + void writeDTD(QAnyStringView dtd); +%End +%If (- Qt_6_5_0) + void writeDTD(const QString &dtd); +%End +%If (Qt_6_5_0 -) + void writeEmptyElement(QAnyStringView namespaceUri, QAnyStringView name); +%End +%If (Qt_6_5_0 -) + void writeEmptyElement(QAnyStringView qualifiedName); +%End +%If (- Qt_6_5_0) + void writeEmptyElement(const QString &qualifiedName); +%End +%If (- Qt_6_5_0) + void writeEmptyElement(const QString &namespaceUri, const QString &name); +%End +%If (Qt_6_5_0 -) + void writeTextElement(QAnyStringView namespaceUri, QAnyStringView name, QAnyStringView text); +%End +%If (Qt_6_5_0 -) + void writeTextElement(QAnyStringView qualifiedName, QAnyStringView text); +%End +%If (- Qt_6_5_0) + void writeTextElement(const QString &qualifiedName, const QString &text); +%End +%If (- Qt_6_5_0) + void writeTextElement(const QString &namespaceUri, const QString &name, const QString &text); +%End + void writeEndDocument(); + void writeEndElement(); +%If (Qt_6_5_0 -) + void writeEntityReference(QAnyStringView name); +%End +%If (- Qt_6_5_0) + void writeEntityReference(const QString &name); +%End +%If (Qt_6_5_0 -) + void writeNamespace(QAnyStringView namespaceUri, QAnyStringView prefix = {}); +%End +%If (- Qt_6_5_0) + void writeNamespace(const QString &namespaceUri, const QString &prefix = QString()); +%End +%If (Qt_6_5_0 -) + void writeDefaultNamespace(QAnyStringView namespaceUri); +%End +%If (- Qt_6_5_0) + void writeDefaultNamespace(const QString &namespaceUri); +%End +%If (Qt_6_5_0 -) + void writeProcessingInstruction(QAnyStringView target, QAnyStringView data = {}); +%End +%If (- Qt_6_5_0) + void writeProcessingInstruction(const QString &target, const QString &data = QString()); +%End +%If (Qt_6_5_0 -) + void writeStartDocument(QAnyStringView version, bool standalone); +%End +%If (Qt_6_5_0 -) + void writeStartDocument(QAnyStringView version); +%End + void writeStartDocument(); +%If (- Qt_6_5_0) + void writeStartDocument(const QString &version); +%End +%If (- Qt_6_5_0) + void writeStartDocument(const QString &version, bool standalone); +%End +%If (Qt_6_5_0 -) + void writeStartElement(QAnyStringView namespaceUri, QAnyStringView name); +%End +%If (Qt_6_5_0 -) + void writeStartElement(QAnyStringView qualifiedName); +%End +%If (- Qt_6_5_0) + void writeStartElement(const QString &qualifiedName); +%End +%If (- Qt_6_5_0) + void writeStartElement(const QString &namespaceUri, const QString &name); +%End + void writeCurrentToken(const QXmlStreamReader &reader); + bool hasError() const; + +private: + QXmlStreamWriter(const QXmlStreamWriter &); +}; + +class QXmlStreamAttributes +{ +%TypeHeaderCode +#include +%End + +public: + QXmlStreamAttributes(); + QStringView value(const QString &namespaceUri, const QString &name) const; + QStringView value(const QString &qualifiedName) const; + void append(const QString &namespaceUri, const QString &name, const QString &value); + void append(const QString &qualifiedName, const QString &value); + bool hasAttribute(const QString &namespaceUri, const QString &name) const; + bool hasAttribute(const QString &qualifiedName) const; +// Methods inherited from QList and Python special methods. +// Keep in sync with QPolygon and QPolygonF. + + +void append(const QXmlStreamAttribute &value); + +const QXmlStreamAttribute &at(int i) const; +void clear(); +bool contains(const QXmlStreamAttribute &value) const; +int count(const QXmlStreamAttribute &value) const; +int count() const /__len__/; +void *data(); + +// Note the Qt return value is discarded as it would require handwritten code +// and seems pretty useless. +void fill(const QXmlStreamAttribute &value, int size = -1); + +QXmlStreamAttribute &first(); +int indexOf(const QXmlStreamAttribute &value, int from = 0) const; +void insert(int i, const QXmlStreamAttribute &value); +bool isEmpty() const; +QXmlStreamAttribute &last(); +int lastIndexOf(const QXmlStreamAttribute &value, int from = -1) const; + +// Note the Qt return type is QList. We can't do the +// usual trick because there is no QXmlStreamAttributes ctor that takes a +// QList argument. We could use handwritten code but we +// don't bother. +//QXmlStreamAttributes mid(int pos, int length = -1) const; + +void prepend(const QXmlStreamAttribute &value); +void remove(int i); +void remove(int i, int count); +void resize(qsizetype size); +void replace(int i, const QXmlStreamAttribute &value); +int size() const; + +// These are hidden by other implementations in QXmlStreamAttributes. +//QXmlStreamAttribute value(int i) const; +//QXmlStreamAttribute value(int i, const QXmlStreamAttribute &defaultValue) const; + +bool operator!=(const QXmlStreamAttributes &other) const; + +// Note the Qt return type is QList. We can't do the +// usual trick because there is no QXmlStreamAttributes ctor that takes a +// QList argument. We could use handwritten code but we +// don't bother. +//QXmlStreamAttributes operator+(const QXmlStreamAttributes &other) const; + +QXmlStreamAttributes &operator+=(const QXmlStreamAttributes &other); +QXmlStreamAttributes &operator+=(const QXmlStreamAttribute &value); + +bool operator==(const QXmlStreamAttributes &other) const; + +QXmlStreamAttribute &operator[](int i); +%MethodCode +Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); + +if (idx < 0) + sipIsErr = 1; +else + sipRes = &sipCpp->operator[]((int)idx); +%End + +// Some additional Python special methods. + +void __setitem__(int i, const QXmlStreamAttribute &value); +%MethodCode +int len; + +len = sipCpp->count(); + +if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0) + sipIsErr = 1; +else + (*sipCpp)[a0] = *a1; +%End + +void __setitem__(SIP_PYSLICE slice, const QXmlStreamAttributes &list); +%MethodCode +Py_ssize_t start, stop, step, slicelength; + +if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) +{ + sipIsErr = 1; +} +else +{ + int vlen = a1->count(); + + if (vlen != slicelength) + { + sipBadLengthForSlice(vlen, slicelength); + sipIsErr = 1; + } + else + { + QList::const_iterator it = a1->begin(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + (*sipCpp)[start] = *it; + start += step; + ++it; + } + } +} +%End + +void __delitem__(int i); +%MethodCode +if ((a0 = (int)sipConvertFromSequenceIndex(a0, sipCpp->count())) < 0) + sipIsErr = 1; +else + sipCpp->remove(a0); +%End + +void __delitem__(SIP_PYSLICE slice); +%MethodCode +Py_ssize_t start, stop, step, slicelength; + +if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) +{ + sipIsErr = 1; +} +else +{ + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + sipCpp->remove(start); + start += step - 1; + } +} +%End + +QXmlStreamAttributes operator[](SIP_PYSLICE slice); +%MethodCode +Py_ssize_t start, stop, step, slicelength; + +if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) +{ + sipIsErr = 1; +} +else +{ + sipRes = new QXmlStreamAttributes(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + (*sipRes) += (*sipCpp)[start]; + start += step; + } +} +%End + +int __contains__(const QXmlStreamAttribute &value); +%MethodCode +// It looks like you can't assign QBool to int. +sipRes = bool(sipCpp->contains(*a0)); +%End +}; diff --git a/sip/QtDBus/QtDBusmod.sip b/sip/QtDBus/QtDBusmod.sip new file mode 100644 index 0000000..266337b --- /dev/null +++ b/sip/QtDBus/QtDBusmod.sip @@ -0,0 +1,61 @@ +// QtDBusmod.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtDBus, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qdbusabstractadaptor.sip +%Include qdbusabstractinterface.sip +%Include qdbusargument.sip +%Include qdbusconnection.sip +%Include qdbusconnectioninterface.sip +%Include qdbuserror.sip +%Include qdbusextratypes.sip +%Include qdbusinterface.sip +%Include qdbusmessage.sip +%Include qdbuspendingcall.sip +%Include qdbusservicewatcher.sip +%Include qdbusunixfiledescriptor.sip +%Include qpydbusreply.sip +%Include qpydbuspendingreply.sip diff --git a/sip/QtDBus/qdbusabstractadaptor.sip b/sip/QtDBus/qdbusabstractadaptor.sip new file mode 100644 index 0000000..80a6179 --- /dev/null +++ b/sip/QtDBus/qdbusabstractadaptor.sip @@ -0,0 +1,38 @@ +// qdbusabstractadaptor.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusAbstractAdaptor : QObject +{ +%TypeHeaderCode +#include +%End + +protected: + explicit QDBusAbstractAdaptor(QObject *parent /TransferThis/); + +public: + virtual ~QDBusAbstractAdaptor(); + +protected: + void setAutoRelaySignals(bool enable); + bool autoRelaySignals() const; +}; diff --git a/sip/QtDBus/qdbusabstractinterface.sip b/sip/QtDBus/qdbusabstractinterface.sip new file mode 100644 index 0000000..582737f --- /dev/null +++ b/sip/QtDBus/qdbusabstractinterface.sip @@ -0,0 +1,224 @@ +// qdbusabstractinterface.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusAbstractInterface : QObject +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// Convert a Python tuple to a list of QVarients. +static QList QtDBus_marshal(PyObject *py_args, int *is_err) +{ + QList cpp_args; + Py_ssize_t nr_args = PyTuple_Size(py_args); + + for (Py_ssize_t i = 0; i < nr_args; ++i) + { + int state; + void *var; + + var = sipForceConvertToType(PyTuple_GetItem(py_args, i), sipType_QVariant, NULL, + 0, &state, is_err); + + if (*is_err) + break; + + cpp_args.append(*reinterpret_cast(var)); + sipReleaseType(var, sipType_QVariant, state); + } + + return cpp_args; +} +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QDBusPendingCallWatcher, &sipType_QDBusPendingCallWatcher, -1, 1}, + {sipName_QDBusAbstractAdaptor, &sipType_QDBusAbstractAdaptor, -1, 2}, + {sipName_QDBusAbstractInterface, &sipType_QDBusAbstractInterface, 4, 3}, + {sipName_QDBusServiceWatcher, &sipType_QDBusServiceWatcher, -1, -1}, + {sipName_QDBusConnectionInterface, &sipType_QDBusConnectionInterface, -1, 5}, + {sipName_QDBusInterface, &sipType_QDBusInterface, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + virtual ~QDBusAbstractInterface(); + bool isValid() const; + QDBusConnection connection() const; + QString service() const; + QString path() const; + QString interface() const; + QDBusError lastError() const; + void setTimeout(int timeout); + int timeout() const; + QDBusMessage call(const QString &method, ...); +%MethodCode + QList args; + + args = QtDBus_marshal(a1, &sipIsErr); + + if (!sipIsErr) + { + Py_BEGIN_ALLOW_THREADS + sipRes = new QDBusMessage(sipCpp->callWithArgumentList(QDBus::AutoDetect, *a0, args)); + Py_END_ALLOW_THREADS + } +%End + + QDBusMessage call(QDBus::CallMode mode, const QString &method, ...); +%MethodCode + QList args; + + args = QtDBus_marshal(a2, &sipIsErr); + + if (!sipIsErr) + { + Py_BEGIN_ALLOW_THREADS + sipRes = new QDBusMessage(sipCpp->callWithArgumentList(a0, *a1, args)); + Py_END_ALLOW_THREADS + } +%End + + QDBusMessage callWithArgumentList(QDBus::CallMode mode, const QString &method, const QList &args) /ReleaseGIL/; + bool callWithCallback(const QString &method, const QList &args, SIP_PYOBJECT returnMethod /TypeHint="PYQT_SLOT"/, SIP_PYOBJECT errorMethod /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray return_slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a2, &receiver, return_slot)) == sipErrorNone) + { + QObject *error_receiver; + QByteArray error_slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a3, &error_receiver, error_slot)) == sipErrorNone) + { + if (receiver == error_receiver) + { + sipRes = sipCpp->callWithCallback(*a0, *a1, receiver, return_slot.constData(), error_slot.constData()); + } + else + { + PyErr_SetString(PyExc_ValueError, + "the return and error methods must be bound to the same QObject instance"); + sipError = sipErrorFail; + } + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(3, a3); + } + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(2, a2); + } +%End + + bool callWithCallback(const QString &method, QList &args, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a2, &receiver, slot)) == sipErrorNone) + { + sipRes = sipCpp->callWithCallback(*a0, *a1, receiver, slot.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(2, a2); + } +%End + + QDBusPendingCall asyncCall(const QString &method, ...); +%MethodCode + QList args; + + args = QtDBus_marshal(a1, &sipIsErr); + + if (!sipIsErr) + { + Py_BEGIN_ALLOW_THREADS + sipRes = new QDBusPendingCall(sipCpp->asyncCallWithArgumentList(*a0, args)); + Py_END_ALLOW_THREADS + } +%End + + QDBusPendingCall asyncCallWithArgumentList(const QString &method, const QList &args); + +protected: + QDBusAbstractInterface(const QString &service, const QString &path, const char *interface, const QDBusConnection &connection, QObject *parent /TransferThis/); + virtual void connectNotify(const QMetaMethod &signal); + virtual void disconnectNotify(const QMetaMethod &signal); +}; + +%ModuleHeaderCode +#include "qpydbus_api.h" + +// Imports from QtCore. +typedef PyObject *(*pyqt6_qtdbus_from_qvariant_by_type_t)(QVariant &, PyObject *); +extern pyqt6_qtdbus_from_qvariant_by_type_t pyqt6_qtdbus_from_qvariant_by_type; + +typedef sipErrorState (*pyqt6_qtdbus_get_pyqtslot_parts_t)(PyObject *, QObject **, QByteArray &); +extern pyqt6_qtdbus_get_pyqtslot_parts_t pyqt6_qtdbus_get_pyqtslot_parts; +%End + +%ModuleCode +// Imports from QtCore. +pyqt6_qtdbus_from_qvariant_by_type_t pyqt6_qtdbus_from_qvariant_by_type; +pyqt6_qtdbus_get_pyqtslot_parts_t pyqt6_qtdbus_get_pyqtslot_parts; +%End + +%PostInitialisationCode +qpydbus_post_init(); + +// Imports from QtCore. +pyqt6_qtdbus_from_qvariant_by_type = (pyqt6_qtdbus_from_qvariant_by_type_t)sipImportSymbol("pyqt6_from_qvariant_by_type"); +Q_ASSERT(pyqt6_qtdbus_from_qvariant_by_type); + +pyqt6_qtdbus_get_pyqtslot_parts = (pyqt6_qtdbus_get_pyqtslot_parts_t)sipImportSymbol("pyqt6_get_pyqtslot_parts"); +Q_ASSERT(pyqt6_qtdbus_get_pyqtslot_parts); +%End diff --git a/sip/QtDBus/qdbusargument.sip b/sip/QtDBus/qdbusargument.sip new file mode 100644 index 0000000..7a8911a --- /dev/null +++ b/sip/QtDBus/qdbusargument.sip @@ -0,0 +1,175 @@ +// qdbusargument.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusArgument +{ +%TypeHeaderCode +#include +%End + +%TypeCode +#include + + +static PyObject *qdbusargument_add(QDBusArgument *arg, PyObject *obj, int mtype) +{ + int iserr = 0; + + if (PyLong_CheckExact(obj)) + { + if (mtype == QMetaType::UChar || mtype == QMetaType::UShort || mtype == QMetaType::UInt || mtype == QMetaType::ULongLong) + { + // Handle the unsigned values. + unsigned long long v = PyLong_AsUnsignedLongLongMask(obj); + + switch (mtype) + { + case QMetaType::UChar: + *arg << (uchar)v; + break; + + case QMetaType::UShort: + *arg << (ushort)v; + break; + + case QMetaType::UInt: + *arg << (uint)v; + break; + + case QMetaType::ULongLong: + *arg << (qulonglong)v; + break; + } + } + else if (mtype == QMetaType::Short || mtype == QMetaType::Int || mtype == QMetaType::LongLong) + { + // Handle the signed values. + long long v = PyLong_AsLongLong(obj); + + switch (mtype) + { + case QMetaType::Short: + *arg << (short)v; + break; + + case QMetaType::Int: + *arg << (int)v; + break; + + case QMetaType::LongLong: + *arg << (qlonglong)v; + break; + } + } + else + { + PyErr_Format(PyExc_ValueError, + "%d is an invalid QMetaType::Type for an integer object", + mtype); + iserr = 1; + } + } + else if (mtype == QMetaType::QStringList) + { + // A QStringList has to be handled explicitly to prevent it being seen + // as a vialiant list. + + int value_state; + + QStringList *qsl = reinterpret_cast( + sipForceConvertToType(obj, sipType_QStringList, 0, + SIP_NOT_NONE, &value_state, &iserr)); + + if (!iserr) + { + arg->beginArray(QMetaType::QString); + + for (int i = 0; i < qsl->count(); ++i) + *arg << qsl->at(i); + + arg->endArray(); + + sipReleaseType(qsl, sipType_QStringList, value_state); + } + } + else + { + int value_state; + + QVariant *qv = reinterpret_cast( + sipForceConvertToType(obj, sipType_QVariant, 0, SIP_NOT_NONE, + &value_state, &iserr)); + + if (!iserr) + { + // This is an internal method. If it proves to be a problem then we + // will have to handle each type explicitly. + arg->appendVariant(*qv); + sipReleaseType(qv, sipType_QVariant, value_state); + } + } + + if (iserr) + return 0; + + Py_INCREF(Py_None); + return Py_None; +} +%End + +public: + QDBusArgument(); + QDBusArgument(const QDBusArgument &other); + QDBusArgument(SIP_PYOBJECT arg, int id = QMetaType::Int); +%MethodCode + sipCpp = new QDBusArgument(); + PyObject *res = qdbusargument_add(sipCpp, a0, a1); + + if (res) + { + Py_DECREF(res); + } + else + { + delete sipCpp; + sipCpp = 0; + } +%End + + ~QDBusArgument(); + SIP_PYOBJECT add(SIP_PYOBJECT arg, int id = QMetaType::Int) /TypeHint=""/; +%MethodCode + sipRes = qdbusargument_add(sipCpp, a0, a1); +%End + + void beginStructure(); + void endStructure(); + void beginArray(QMetaType elementMetaType); + void beginArray(int id); + void endArray(); + void beginMap(QMetaType keyMetaType, QMetaType valueMetaType); + void beginMap(int kid, int vid); + void endMap(); + void beginMapEntry(); + void endMapEntry(); + void swap(QDBusArgument &other /Constrained/); +}; diff --git a/sip/QtDBus/qdbusconnection.sip b/sip/QtDBus/qdbusconnection.sip new file mode 100644 index 0000000..d972003 --- /dev/null +++ b/sip/QtDBus/qdbusconnection.sip @@ -0,0 +1,251 @@ +// qdbusconnection.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +namespace QDBus +{ +%TypeHeaderCode +#include +%End + + enum CallMode + { + NoBlock, + Block, + BlockWithGui, + AutoDetect, + }; +}; + +class QDBusConnection +{ +%TypeHeaderCode +#include +%End + +public: + enum BusType + { + SessionBus, + SystemBus, + ActivationBus, + }; + + enum RegisterOption /BaseType=Flag/ + { + ExportAdaptors, + ExportScriptableSlots, + ExportScriptableSignals, + ExportScriptableProperties, + ExportScriptableInvokables, + ExportScriptableContents, + ExportNonScriptableSlots, + ExportNonScriptableSignals, + ExportNonScriptableProperties, + ExportNonScriptableInvokables, + ExportNonScriptableContents, + ExportAllSlots, + ExportAllSignals, + ExportAllProperties, + ExportAllInvokables, + ExportAllContents, + ExportAllSignal, + ExportChildObjects, + }; + + typedef QFlags RegisterOptions; + + enum UnregisterMode + { + UnregisterNode, + UnregisterTree, + }; + + enum ConnectionCapability /BaseType=Flag/ + { + UnixFileDescriptorPassing, + }; + + typedef QFlags ConnectionCapabilities; + explicit QDBusConnection(const QString &name); + QDBusConnection(const QDBusConnection &other); + ~QDBusConnection(); + bool isConnected() const; + QString baseService() const; + QDBusError lastError() const; + QString name() const; + QDBusConnection::ConnectionCapabilities connectionCapabilities() const; + bool send(const QDBusMessage &message) const; + bool callWithCallback(const QDBusMessage &message, SIP_PYOBJECT returnMethod /TypeHint="PYQT_SLOT"/, SIP_PYOBJECT errorMethod /TypeHint="PYQT_SLOT"/, int timeout = -1) const; +%MethodCode + QObject *receiver; + QByteArray return_slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a1, &receiver, return_slot)) == sipErrorNone) + { + QObject *error_receiver; + QByteArray error_slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a2, &error_receiver, error_slot)) == sipErrorNone) + { + if (receiver == error_receiver) + { + sipRes = sipCpp->callWithCallback(*a0, receiver, return_slot.constData(), error_slot.constData(), a3); + } + else + { + PyErr_SetString(PyExc_ValueError, + "the return and error methods must be bound to the same QObject instance"); + sipError = sipErrorFail; + } + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(2, a2); + } + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(1, a1); + } +%End + + QDBusMessage call(const QDBusMessage &message, QDBus::CallMode mode = QDBus::Block, int timeout = -1) const /ReleaseGIL/; + QDBusPendingCall asyncCall(const QDBusMessage &message, int timeout = -1) const; + bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/; +%MethodCode + QObject *receiver; + QByteArray slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a4, &receiver, slot)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->connect(*a0, *a1, *a2, *a3, receiver, slot.constData()); + Py_END_ALLOW_THREADS + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(4, a4); + } +%End + + bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/; +%MethodCode + QObject *receiver; + QByteArray slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a5, &receiver, slot)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->connect(*a0, *a1, *a2, *a3, *a4, receiver, slot.constData()); + Py_END_ALLOW_THREADS + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(5, a5); + } +%End + + bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, const QStringList &argumentMatch, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/; +%MethodCode + QObject *receiver; + QByteArray slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a6, &receiver, slot)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->connect(*a0, *a1, *a2, *a3, *a4, *a5, receiver, slot.constData()); + Py_END_ALLOW_THREADS + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(6, a6); + } +%End + + bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/; +%MethodCode + QObject *receiver; + QByteArray slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a4, &receiver, slot)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->disconnect(*a0, *a1, *a2, *a3, receiver, slot.constData()); + Py_END_ALLOW_THREADS + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(4, a4); + } +%End + + bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/; +%MethodCode + QObject *receiver; + QByteArray slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a5, &receiver, slot)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->disconnect(*a0, *a1, *a2, *a3, *a4, receiver, slot.constData()); + Py_END_ALLOW_THREADS + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(5, a5); + } +%End + + bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, const QStringList &argumentMatch, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/; +%MethodCode + QObject *receiver; + QByteArray slot; + + if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a6, &receiver, slot)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->disconnect(*a0, *a1, *a2, *a3, *a4, *a5, receiver, slot.constData()); + Py_END_ALLOW_THREADS + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(6, a6); + } +%End + + bool registerObject(const QString &path, QObject *object, QDBusConnection::RegisterOptions options = QDBusConnection::ExportAdaptors); + bool registerObject(const QString &path, const QString &interface, QObject *object, QDBusConnection::RegisterOptions options = QDBusConnection::ExportAdaptors); + void unregisterObject(const QString &path, QDBusConnection::UnregisterMode mode = QDBusConnection::UnregisterNode); + QObject *objectRegisteredAt(const QString &path) const; + bool registerService(const QString &serviceName); + bool unregisterService(const QString &serviceName); + QDBusConnectionInterface *interface() const; + static QDBusConnection connectToBus(QDBusConnection::BusType type, const QString &name) /ReleaseGIL/; + static QDBusConnection connectToBus(const QString &address, const QString &name) /ReleaseGIL/; + static QDBusConnection connectToPeer(const QString &address, const QString &name) /ReleaseGIL/; + static void disconnectFromBus(const QString &name) /ReleaseGIL/; + static void disconnectFromPeer(const QString &name) /ReleaseGIL/; + static QByteArray localMachineId(); + static QDBusConnection sessionBus(); + static QDBusConnection systemBus(); + void swap(QDBusConnection &other /Constrained/); +}; diff --git a/sip/QtDBus/qdbusconnectioninterface.sip b/sip/QtDBus/qdbusconnectioninterface.sip new file mode 100644 index 0000000..81168ad --- /dev/null +++ b/sip/QtDBus/qdbusconnectioninterface.sip @@ -0,0 +1,72 @@ +// qdbusconnectioninterface.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusConnectionInterface : QDBusAbstractInterface +{ +%TypeHeaderCode +#include +%End + + QDBusConnectionInterface(const QDBusConnection &connection, QObject *parent /TransferThis/); + virtual ~QDBusConnectionInterface(); + +public: + enum ServiceQueueOptions + { + DontQueueService, + QueueService, + ReplaceExistingService, + }; + + enum ServiceReplacementOptions + { + DontAllowReplacement, + AllowReplacement, + }; + + enum RegisterServiceReply + { + ServiceNotRegistered, + ServiceRegistered, + ServiceQueued, + }; + + QDBusReply registeredServiceNames() const /ReleaseGIL/; + QDBusReply activatableServiceNames() const /ReleaseGIL/; + QDBusReply isServiceRegistered(const QString &serviceName) const /ReleaseGIL/; + QDBusReply serviceOwner(const QString &name) const /ReleaseGIL/; + QDBusReply unregisterService(const QString &serviceName) /ReleaseGIL/; + QDBusReply registerService(const QString &serviceName, QDBusConnectionInterface::ServiceQueueOptions qoption = QDBusConnectionInterface::DontQueueService, QDBusConnectionInterface::ServiceReplacementOptions roption = QDBusConnectionInterface::DontAllowReplacement) /ReleaseGIL/; + QDBusReply servicePid(const QString &serviceName) const /ReleaseGIL/; + QDBusReply serviceUid(const QString &serviceName) const /ReleaseGIL/; + QDBusReply startService(const QString &name) /ReleaseGIL/; + +signals: + void serviceRegistered(const QString &service); + void serviceUnregistered(const QString &service); + void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); + void callWithCallbackFailed(const QDBusError &error, const QDBusMessage &call); + +protected: + virtual void connectNotify(const QMetaMethod &); + virtual void disconnectNotify(const QMetaMethod &); +}; diff --git a/sip/QtDBus/qdbuserror.sip b/sip/QtDBus/qdbuserror.sip new file mode 100644 index 0000000..e1f202b --- /dev/null +++ b/sip/QtDBus/qdbuserror.sip @@ -0,0 +1,69 @@ +// qdbuserror.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusError +{ +%TypeHeaderCode +#include +%End + +public: + enum ErrorType + { + NoError, + Other, + Failed, + NoMemory, + ServiceUnknown, + NoReply, + BadAddress, + NotSupported, + LimitsExceeded, + AccessDenied, + NoServer, + Timeout, + NoNetwork, + AddressInUse, + Disconnected, + InvalidArgs, + UnknownMethod, + TimedOut, + InvalidSignature, + UnknownInterface, + InternalError, + UnknownObject, + InvalidService, + InvalidObjectPath, + InvalidInterface, + InvalidMember, + UnknownProperty, + PropertyReadOnly, + }; + + QDBusError(const QDBusError &other); + QDBusError::ErrorType type() const; + QString name() const; + QString message() const; + bool isValid() const; + static QString errorString(QDBusError::ErrorType error); + void swap(QDBusError &other /Constrained/); +}; diff --git a/sip/QtDBus/qdbusextratypes.sip b/sip/QtDBus/qdbusextratypes.sip new file mode 100644 index 0000000..3272df3 --- /dev/null +++ b/sip/QtDBus/qdbusextratypes.sip @@ -0,0 +1,83 @@ +// qdbusextratypes.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusObjectPath +{ +%TypeHeaderCode +#include +%End + +public: + QDBusObjectPath(); + explicit QDBusObjectPath(const QString &objectPath); + QString path() const; + void setPath(const QString &objectPath); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp, 0); +%End + + void swap(QDBusObjectPath &other /Constrained/); +}; + +bool operator==(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs); +bool operator!=(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs); +bool operator<(const QDBusObjectPath &lhs, const QDBusObjectPath &rhs); + +class QDBusSignature +{ +%TypeHeaderCode +#include +%End + +public: + QDBusSignature(); + explicit QDBusSignature(const QString &dBusSignature); + QString signature() const; + void setSignature(const QString &dBusSignature); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp, 0); +%End + + void swap(QDBusSignature &other /Constrained/); +}; + +bool operator==(const QDBusSignature &lhs, const QDBusSignature &rhs); +bool operator!=(const QDBusSignature &lhs, const QDBusSignature &rhs); +bool operator<(const QDBusSignature &lhs, const QDBusSignature &rhs); + +class QDBusVariant +{ +%TypeHeaderCode +#include +%End + +public: + QDBusVariant(); + explicit QDBusVariant(const QVariant &dBusVariant); + QVariant variant() const; + void setVariant(const QVariant &dBusVariant); + void swap(QDBusVariant &other /Constrained/); +}; + +bool operator==(const QDBusVariant &v1, const QDBusVariant &v2); diff --git a/sip/QtDBus/qdbusinterface.sip b/sip/QtDBus/qdbusinterface.sip new file mode 100644 index 0000000..4cccc7f --- /dev/null +++ b/sip/QtDBus/qdbusinterface.sip @@ -0,0 +1,32 @@ +// qdbusinterface.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusInterface : QDBusAbstractInterface +{ +%TypeHeaderCode +#include +%End + +public: + QDBusInterface(const QString &service, const QString &path, const QString &interface = QString(), const QDBusConnection &connection = QDBusConnection::sessionBus(), QObject *parent /TransferThis/ = 0); + virtual ~QDBusInterface(); +}; diff --git a/sip/QtDBus/qdbusmessage.sip b/sip/QtDBus/qdbusmessage.sip new file mode 100644 index 0000000..34bb382 --- /dev/null +++ b/sip/QtDBus/qdbusmessage.sip @@ -0,0 +1,72 @@ +// qdbusmessage.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusMessage +{ +%TypeHeaderCode +#include +%End + +public: + enum MessageType + { + InvalidMessage, + MethodCallMessage, + ReplyMessage, + ErrorMessage, + SignalMessage, + }; + + QDBusMessage(); + QDBusMessage(const QDBusMessage &other); + ~QDBusMessage(); + static QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name); + static QDBusMessage createMethodCall(const QString &service, const QString &path, const QString &interface, const QString &method); + static QDBusMessage createError(const QString &name, const QString &msg); + static QDBusMessage createError(const QDBusError &error); + static QDBusMessage createError(QDBusError::ErrorType type, const QString &msg); + QDBusMessage createReply(const QList &arguments = QList()) const; + QDBusMessage createReply(const QVariant &argument) const; + QDBusMessage createErrorReply(const QString &name, const QString &msg) const; + QDBusMessage createErrorReply(const QDBusError &error) const; + QDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const; + QString service() const; + QString path() const; + QString interface() const; + QString member() const; + QString errorName() const; + QString errorMessage() const; + QDBusMessage::MessageType type() const; + QString signature() const; + bool isReplyRequired() const; + void setDelayedReply(bool enable) const; + bool isDelayedReply() const; + void setAutoStartService(bool enable); + bool autoStartService() const; + void setArguments(const QList &arguments); + QList arguments() const; + QDBusMessage &operator<<(const QVariant &arg); + void swap(QDBusMessage &other /Constrained/); + static QDBusMessage createTargetedSignal(const QString &service, const QString &path, const QString &interface, const QString &name); + void setInteractiveAuthorizationAllowed(bool enable); + bool isInteractiveAuthorizationAllowed() const; +}; diff --git a/sip/QtDBus/qdbuspendingcall.sip b/sip/QtDBus/qdbuspendingcall.sip new file mode 100644 index 0000000..82e2ddd --- /dev/null +++ b/sip/QtDBus/qdbuspendingcall.sip @@ -0,0 +1,54 @@ +// qdbuspendingcall.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusPendingCall +{ +%TypeHeaderCode +#include +%End + +public: + QDBusPendingCall(const QDBusPendingCall &other); + ~QDBusPendingCall(); + static QDBusPendingCall fromError(const QDBusError &error); + static QDBusPendingCall fromCompletedCall(const QDBusMessage &message); + void swap(QDBusPendingCall &other /Constrained/); + +private: + QDBusPendingCall(); +}; + +class QDBusPendingCallWatcher : QObject, QDBusPendingCall +{ +%TypeHeaderCode +#include +%End + +public: + QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent /TransferThis/ = 0); + virtual ~QDBusPendingCallWatcher(); + bool isFinished() const; + void waitForFinished() /ReleaseGIL/; + +signals: + void finished(QDBusPendingCallWatcher *watcher = 0); +}; diff --git a/sip/QtDBus/qdbusservicewatcher.sip b/sip/QtDBus/qdbusservicewatcher.sip new file mode 100644 index 0000000..ce932d6 --- /dev/null +++ b/sip/QtDBus/qdbusservicewatcher.sip @@ -0,0 +1,54 @@ +// qdbusservicewatcher.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusServiceWatcher : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum WatchModeFlag /BaseType=Flag/ + { + WatchForRegistration, + WatchForUnregistration, + WatchForOwnerChange, + }; + + typedef QFlags WatchMode; + explicit QDBusServiceWatcher(QObject *parent /TransferThis/ = 0); + QDBusServiceWatcher(const QString &service, const QDBusConnection &connection, QDBusServiceWatcher::WatchMode watchMode = QDBusServiceWatcher::WatchForOwnerChange, QObject *parent /TransferThis/ = 0); + virtual ~QDBusServiceWatcher(); + QStringList watchedServices() const; + void setWatchedServices(const QStringList &services); + void addWatchedService(const QString &newService); + bool removeWatchedService(const QString &service); + QDBusServiceWatcher::WatchMode watchMode() const; + void setWatchMode(QDBusServiceWatcher::WatchMode mode); + QDBusConnection connection() const; + void setConnection(const QDBusConnection &connection); + +signals: + void serviceRegistered(const QString &service); + void serviceUnregistered(const QString &service); + void serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner); +}; diff --git a/sip/QtDBus/qdbusunixfiledescriptor.sip b/sip/QtDBus/qdbusunixfiledescriptor.sip new file mode 100644 index 0000000..a7a59da --- /dev/null +++ b/sip/QtDBus/qdbusunixfiledescriptor.sip @@ -0,0 +1,39 @@ +// qdbusunixfiledescriptor.sip generated by MetaSIP +// +// This file is part of the QtDBus Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDBusUnixFileDescriptor +{ +%TypeHeaderCode +#include +%End + +public: + QDBusUnixFileDescriptor(); + explicit QDBusUnixFileDescriptor(int fileDescriptor); + QDBusUnixFileDescriptor(const QDBusUnixFileDescriptor &other); + ~QDBusUnixFileDescriptor(); + bool isValid() const; + int fileDescriptor() const; + void setFileDescriptor(int fileDescriptor); + static bool isSupported(); + void swap(QDBusUnixFileDescriptor &other /Constrained/); +}; diff --git a/sip/QtDBus/qpydbuspendingreply.sip b/sip/QtDBus/qpydbuspendingreply.sip new file mode 100644 index 0000000..c022788 --- /dev/null +++ b/sip/QtDBus/qpydbuspendingreply.sip @@ -0,0 +1,44 @@ +// This is the SIP specification of the QPyDBusPendingReply class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPyDBusPendingReply : QDBusPendingCall /PyName=QDBusPendingReply/ +{ +%TypeHeaderCode +#include +%End + +public: + QPyDBusPendingReply(); + QPyDBusPendingReply(const QPyDBusPendingReply &other); + QPyDBusPendingReply(const QDBusPendingCall &call); + QPyDBusPendingReply(const QDBusMessage &reply); + + // The /ReleaseGIL/ annotation is needed because QDBusPendingCall has an + // internal mutex. + QVariant argumentAt(int index) const /ReleaseGIL/; + QDBusError error() const /ReleaseGIL/; + bool isError() const /ReleaseGIL/; + bool isFinished() const /ReleaseGIL/; + bool isValid() const /ReleaseGIL/; + QDBusMessage reply() const /ReleaseGIL/; + void waitForFinished() /ReleaseGIL/; + + SIP_PYOBJECT value(SIP_PYOBJECT type /TypeHintValue="None"/ = 0) const /HoldGIL/; +}; diff --git a/sip/QtDBus/qpydbusreply.sip b/sip/QtDBus/qpydbusreply.sip new file mode 100644 index 0000000..d2fe173 --- /dev/null +++ b/sip/QtDBus/qpydbusreply.sip @@ -0,0 +1,238 @@ +// This is the SIP specification of the QPyDBusReply class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPyDBusReply /PyName=QDBusReply/ +{ +%TypeHeaderCode +#include +%End + +public: + QPyDBusReply(const QDBusMessage &reply) /HoldGIL/; + QPyDBusReply(const QDBusPendingCall &call) /HoldGIL/; + QPyDBusReply(const QDBusError &error); + QPyDBusReply(const QPyDBusReply &other) /HoldGIL/; + ~QPyDBusReply() /HoldGIL/; + + const QDBusError &error() const /HoldGIL/; + bool isValid() const /HoldGIL/; + SIP_PYOBJECT value(SIP_PYOBJECT type /TypeHintValue="None"/ = 0) const /HoldGIL/; +}; + + +template +%MappedType QDBusReply /TypeHint="QDBusReply"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *value_obj; + + if (sipCpp->isValid()) + { + // Convert the value to a Python object. + TYPE *value = new TYPE(sipCpp->value()); + + if ((value_obj = sipConvertFromNewType(value, sipType_TYPE, NULL)) == NULL) + { + delete value; + return NULL; + } + } + else + { + value_obj = 0; + } + + QPyDBusReply *reply = new QPyDBusReply(value_obj, + sipCpp->isValid(), sipCpp->error()); + + PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, sipTransferObj); + + if (reply_obj == NULL) + { + delete reply; + return NULL; + } + + return reply_obj; +%End + +%ConvertToTypeCode + // We never create a QDBusReply from Python. + return 0; +%End +}; + + +%MappedType QDBusReply /TypeHint="QDBusReply"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + Py_INCREF(Py_None); + QPyDBusReply *reply = new QPyDBusReply(Py_None, + sipCpp->isValid(), sipCpp->error()); + + PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, sipTransferObj); + + if (reply_obj == NULL) + { + delete reply; + return NULL; + } + + return reply_obj; +%End + +%ConvertToTypeCode + // We never create a QDBusReply from Python. + return 0; +%End +}; + + +%MappedType QDBusReply /TypeHint="QDBusReply"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *value_obj; + + if (sipCpp->isValid()) + { + if ((value_obj = PyBool_FromLong(sipCpp->value())) == NULL) + return NULL; + } + else + { + value_obj = 0; + } + + QPyDBusReply *reply = new QPyDBusReply(value_obj, + sipCpp->isValid(), sipCpp->error()); + + PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, sipTransferObj); + + if (reply_obj == NULL) + { + delete reply; + return NULL; + } + + return reply_obj; +%End + +%ConvertToTypeCode + // We never create a QDBusReply from Python. + return 0; +%End +}; + + +%MappedType QDBusReply /TypeHint="QDBusReply"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *value_obj; + + if (sipCpp->isValid()) + { + if ((value_obj = PyLong_FromUnsignedLong(sipCpp->value())) == NULL) + return NULL; + } + else + { + value_obj = 0; + } + + QPyDBusReply *reply = new QPyDBusReply(value_obj, + sipCpp->isValid(), sipCpp->error()); + + PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, sipTransferObj); + + if (reply_obj == NULL) + { + delete reply; + return NULL; + } + + return reply_obj; +%End + +%ConvertToTypeCode + // We never create a QDBusReply from Python. + return 0; +%End +}; + + +%MappedType QDBusReply /TypeHint="QDBusReply"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *value_obj; + + if (sipCpp->isValid()) + { + if ((value_obj = sipConvertFromEnum(sipCpp->value(), sipType_QDBusConnectionInterface_RegisterServiceReply)) == NULL) + return NULL; + } + else + { + value_obj = 0; + } + + QPyDBusReply *reply = new QPyDBusReply(value_obj, + sipCpp->isValid(), sipCpp->error()); + + PyObject *reply_obj = sipConvertFromNewType(reply, sipType_QPyDBusReply, sipTransferObj); + + if (reply_obj == NULL) + { + delete reply; + return NULL; + } + + return reply_obj; +%End + +%ConvertToTypeCode + // We never create a QDBusReply from Python. + return 0; +%End +}; diff --git a/sip/QtDesigner/QtDesignermod.sip b/sip/QtDesigner/QtDesignermod.sip new file mode 100644 index 0000000..7b09c26 --- /dev/null +++ b/sip/QtDesigner/QtDesignermod.sip @@ -0,0 +1,73 @@ +// QtDesignermod.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtDesigner, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include abstractactioneditor.sip +%Include abstractformbuilder.sip +%Include abstractformeditor.sip +%Include abstractformwindow.sip +%Include abstractformwindowcursor.sip +%Include abstractformwindowmanager.sip +%Include abstractobjectinspector.sip +%Include abstractpropertyeditor.sip +%Include abstractwidgetbox.sip +%Include container.sip +%Include customwidget.sip +%Include default_extensionfactory.sip +%Include extension.sip +%Include formbuilder.sip +%Include membersheet.sip +%Include propertysheet.sip +%Include qextensionmanager.sip +%Include taskmenu.sip +%Include qpydesignercontainerextension.sip +%Include qpydesignercustomwidgetcollectionplugin.sip +%Include qpydesignercustomwidgetplugin.sip +%Include qpydesignertaskmenuextension.sip +%Include qpydesignerpropertysheetextension.sip +%Include qpydesignermembersheetextension.sip diff --git a/sip/QtDesigner/abstractactioneditor.sip b/sip/QtDesigner/abstractactioneditor.sip new file mode 100644 index 0000000..2103c52 --- /dev/null +++ b/sip/QtDesigner/abstractactioneditor.sip @@ -0,0 +1,38 @@ +// abstractactioneditor.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerActionEditorInterface : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QDesignerActionEditorInterface(QWidget *parent /TransferThis/, Qt::WindowFlags flags = {}); + virtual ~QDesignerActionEditorInterface(); + virtual QDesignerFormEditorInterface *core() const; + virtual void manageAction(QAction *action) = 0; + virtual void unmanageAction(QAction *action) = 0; + +public slots: + virtual void setFormWindow(QDesignerFormWindowInterface *formWindow /KeepReference/) = 0; +}; diff --git a/sip/QtDesigner/abstractformbuilder.sip b/sip/QtDesigner/abstractformbuilder.sip new file mode 100644 index 0000000..f614e91 --- /dev/null +++ b/sip/QtDesigner/abstractformbuilder.sip @@ -0,0 +1,40 @@ +// abstractformbuilder.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractFormBuilder +{ +%TypeHeaderCode +#include +%End + +public: + QAbstractFormBuilder(); + virtual ~QAbstractFormBuilder(); + virtual QWidget *load(QIODevice *device, QWidget *parent /TransferThis/ = 0) /Factory/; + virtual void save(QIODevice *dev, QWidget *widget); + void setWorkingDirectory(const QDir &directory); + QDir workingDirectory() const; + QString errorString() const; + +private: + QAbstractFormBuilder(const QAbstractFormBuilder &); +}; diff --git a/sip/QtDesigner/abstractformeditor.sip b/sip/QtDesigner/abstractformeditor.sip new file mode 100644 index 0000000..279e849 --- /dev/null +++ b/sip/QtDesigner/abstractformeditor.sip @@ -0,0 +1,46 @@ +// abstractformeditor.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerFormEditorInterface : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QDesignerFormEditorInterface(QObject *parent /TransferThis/ = 0); + virtual ~QDesignerFormEditorInterface(); + QExtensionManager *extensionManager() const; + QWidget *topLevel() const; + QDesignerWidgetBoxInterface *widgetBox() const; + QDesignerPropertyEditorInterface *propertyEditor() const; + QDesignerObjectInspectorInterface *objectInspector() const; + QDesignerFormWindowManagerInterface *formWindowManager() const; + QDesignerActionEditorInterface *actionEditor() const; + void setWidgetBox(QDesignerWidgetBoxInterface *widgetBox /KeepReference/); + void setPropertyEditor(QDesignerPropertyEditorInterface *propertyEditor /KeepReference/); + void setObjectInspector(QDesignerObjectInspectorInterface *objectInspector /KeepReference/); + void setActionEditor(QDesignerActionEditorInterface *actionEditor /KeepReference/); + +private: + QDesignerFormEditorInterface(const QDesignerFormEditorInterface &); +}; diff --git a/sip/QtDesigner/abstractformwindow.sip b/sip/QtDesigner/abstractformwindow.sip new file mode 100644 index 0000000..1929405 --- /dev/null +++ b/sip/QtDesigner/abstractformwindow.sip @@ -0,0 +1,106 @@ +// abstractformwindow.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerFormWindowInterface : QWidget /Abstract/ +{ +%TypeHeaderCode +#include +%End + +public: + enum FeatureFlag /BaseType=Flag/ + { + EditFeature, + GridFeature, + TabOrderFeature, + DefaultFeature, + }; + + typedef QFlags Feature; + QDesignerFormWindowInterface(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = {}); + virtual ~QDesignerFormWindowInterface(); + virtual QString fileName() const = 0; + virtual QDir absoluteDir() const = 0; + virtual QString contents() const = 0; + virtual bool setContents(QIODevice *dev, QString *errorMessage = 0) = 0; + virtual QDesignerFormWindowInterface::Feature features() const = 0; + virtual bool hasFeature(QDesignerFormWindowInterface::Feature f) const = 0; + virtual QString author() const = 0; + virtual void setAuthor(const QString &author) = 0; + virtual QString comment() const = 0; + virtual void setComment(const QString &comment) = 0; + virtual void layoutDefault(int *margin, int *spacing) = 0; + virtual void setLayoutDefault(int margin, int spacing) = 0; + virtual void layoutFunction(QString *margin /Out/, QString *spacing /Out/) = 0; + virtual void setLayoutFunction(const QString &margin, const QString &spacing) = 0; + virtual QString pixmapFunction() const = 0; + virtual void setPixmapFunction(const QString &pixmapFunction) = 0; + virtual QString exportMacro() const = 0; + virtual void setExportMacro(const QString &exportMacro) = 0; + virtual QStringList includeHints() const = 0; + virtual void setIncludeHints(const QStringList &includeHints) = 0; + virtual QDesignerFormEditorInterface *core() const; + virtual QDesignerFormWindowCursorInterface *cursor() const = 0; + virtual QPoint grid() const = 0; + virtual QWidget *mainContainer() const = 0; + virtual void setMainContainer(QWidget *mainContainer /KeepReference/) = 0; + virtual bool isManaged(QWidget *widget) const = 0; + virtual bool isDirty() const = 0; + static QDesignerFormWindowInterface *findFormWindow(QWidget *w); + static QDesignerFormWindowInterface *findFormWindow(QObject *obj); + virtual void emitSelectionChanged() = 0; + virtual QStringList resourceFiles() const = 0; + virtual void addResourceFile(const QString &path) = 0; + virtual void removeResourceFile(const QString &path) = 0; + +public slots: + virtual void manageWidget(QWidget *widget) = 0; + virtual void unmanageWidget(QWidget *widget) = 0; + virtual void setFeatures(QDesignerFormWindowInterface::Feature f) = 0; + virtual void setDirty(bool dirty) = 0; + virtual void clearSelection(bool update = true) = 0; + virtual void selectWidget(QWidget *widget, bool select = true) = 0; + virtual void setGrid(const QPoint &grid) = 0; + virtual void setFileName(const QString &fileName) = 0; + virtual bool setContents(const QString &contents) = 0; + +signals: + void mainContainerChanged(QWidget *mainContainer); + void fileNameChanged(const QString &fileName); + void featureChanged(QDesignerFormWindowInterface::Feature f /ScopesStripped=1/); + void selectionChanged(); + void geometryChanged(); + void resourceFilesChanged(); + void widgetManaged(QWidget *widget); + void widgetUnmanaged(QWidget *widget); + void aboutToUnmanageWidget(QWidget *widget); + void activated(QWidget *widget); + void changed(); + void widgetRemoved(QWidget *w); + void objectRemoved(QObject *o); + +public: + virtual QStringList checkContents() const = 0; + QStringList activeResourceFilePaths() const; + virtual QWidget *formContainer() const = 0; + void activateResourceFilePaths(const QStringList &paths, int *errorCount = 0, QString *errorMessages /Out/ = 0); +}; diff --git a/sip/QtDesigner/abstractformwindowcursor.sip b/sip/QtDesigner/abstractformwindowcursor.sip new file mode 100644 index 0000000..d63faf3 --- /dev/null +++ b/sip/QtDesigner/abstractformwindowcursor.sip @@ -0,0 +1,68 @@ +// abstractformwindowcursor.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerFormWindowCursorInterface +{ +%TypeHeaderCode +#include +%End + +public: + enum MoveOperation + { + NoMove, + Start, + End, + Next, + Prev, + Left, + Right, + Up, + Down, + }; + + enum MoveMode + { + MoveAnchor, + KeepAnchor, + }; + + QDesignerFormWindowCursorInterface(); + virtual ~QDesignerFormWindowCursorInterface(); + virtual QDesignerFormWindowInterface *formWindow() const = 0; + virtual bool movePosition(QDesignerFormWindowCursorInterface::MoveOperation op, QDesignerFormWindowCursorInterface::MoveMode mode = QDesignerFormWindowCursorInterface::MoveAnchor) = 0; + virtual int position() const = 0; + virtual void setPosition(int pos, QDesignerFormWindowCursorInterface::MoveMode mode = QDesignerFormWindowCursorInterface::MoveAnchor) = 0; + virtual QWidget *current() const = 0; + virtual int widgetCount() const = 0; + virtual QWidget *widget(int index) const = 0; + virtual bool hasSelection() const = 0; + virtual int selectedWidgetCount() const = 0; + virtual QWidget *selectedWidget(int index) const = 0; + virtual void setProperty(const QString &name, const QVariant &value) = 0; + virtual void setWidgetProperty(QWidget *widget, const QString &name, const QVariant &value) = 0; + virtual void resetWidgetProperty(QWidget *widget, const QString &name) = 0; + bool isWidgetSelected(QWidget *widget) const; + +private: + QDesignerFormWindowCursorInterface(const QDesignerFormWindowCursorInterface &); +}; diff --git a/sip/QtDesigner/abstractformwindowmanager.sip b/sip/QtDesigner/abstractformwindowmanager.sip new file mode 100644 index 0000000..8d84fe8 --- /dev/null +++ b/sip/QtDesigner/abstractformwindowmanager.sip @@ -0,0 +1,88 @@ +// abstractformwindowmanager.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerFormWindowManagerInterface : QObject /Abstract/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QDesignerFormWindowManagerInterface(QObject *parent /TransferThis/ = 0); + virtual ~QDesignerFormWindowManagerInterface(); + QAction *actionFormLayout() const /Transfer/; + QAction *actionSimplifyLayout() const /Transfer/; + virtual QDesignerFormWindowInterface *activeFormWindow() const = 0; + virtual int formWindowCount() const = 0; + virtual QDesignerFormWindowInterface *formWindow(int index) const = 0 /Transfer/; + virtual QDesignerFormWindowInterface *createFormWindow(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()) = 0; + virtual QDesignerFormEditorInterface *core() const = 0; + +signals: + void formWindowAdded(QDesignerFormWindowInterface *formWindow); + void formWindowRemoved(QDesignerFormWindowInterface *formWindow); + void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow); + void formWindowSettingsChanged(QDesignerFormWindowInterface *fw); + +public slots: + virtual void addFormWindow(QDesignerFormWindowInterface *formWindow) = 0; + virtual void removeFormWindow(QDesignerFormWindowInterface *formWindow) = 0; + virtual void setActiveFormWindow(QDesignerFormWindowInterface *formWindow) = 0; + +public: + enum Action + { + CutAction, + CopyAction, + PasteAction, + DeleteAction, + SelectAllAction, + LowerAction, + RaiseAction, + UndoAction, + RedoAction, + HorizontalLayoutAction, + VerticalLayoutAction, + SplitHorizontalAction, + SplitVerticalAction, + GridLayoutAction, + FormLayoutAction, + BreakLayoutAction, + AdjustSizeAction, + SimplifyLayoutAction, + DefaultPreviewAction, + FormWindowSettingsDialogAction, + }; + + enum ActionGroup + { + StyledPreviewActionGroup, + }; + + virtual QAction *action(QDesignerFormWindowManagerInterface::Action action) const = 0 /Transfer/; + virtual QActionGroup *actionGroup(QDesignerFormWindowManagerInterface::ActionGroup actionGroup) const = 0 /Transfer/; + +public slots: + virtual void showPreview() = 0; + virtual void closeAllPreviews() = 0; + virtual void showPluginDialog() = 0; +}; diff --git a/sip/QtDesigner/abstractobjectinspector.sip b/sip/QtDesigner/abstractobjectinspector.sip new file mode 100644 index 0000000..08b9c88 --- /dev/null +++ b/sip/QtDesigner/abstractobjectinspector.sip @@ -0,0 +1,36 @@ +// abstractobjectinspector.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerObjectInspectorInterface : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QDesignerObjectInspectorInterface(QWidget *parent /TransferThis/, Qt::WindowFlags flags = {}); + virtual ~QDesignerObjectInspectorInterface(); + virtual QDesignerFormEditorInterface *core() const; + +public slots: + virtual void setFormWindow(QDesignerFormWindowInterface *formWindow /KeepReference/) = 0; +}; diff --git a/sip/QtDesigner/abstractpropertyeditor.sip b/sip/QtDesigner/abstractpropertyeditor.sip new file mode 100644 index 0000000..93160fd --- /dev/null +++ b/sip/QtDesigner/abstractpropertyeditor.sip @@ -0,0 +1,44 @@ +// abstractpropertyeditor.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerPropertyEditorInterface : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QDesignerPropertyEditorInterface(QWidget *parent /TransferThis/, Qt::WindowFlags flags = {}); + virtual ~QDesignerPropertyEditorInterface(); + virtual QDesignerFormEditorInterface *core() const; + virtual bool isReadOnly() const = 0; + virtual QObject *object() const = 0; + virtual QString currentPropertyName() const = 0; + +signals: + void propertyChanged(const QString &name, const QVariant &value); + +public slots: + virtual void setObject(QObject *object /KeepReference/) = 0; + virtual void setPropertyValue(const QString &name, const QVariant &value, bool changed = true) = 0; + virtual void setReadOnly(bool readOnly) = 0; +}; diff --git a/sip/QtDesigner/abstractwidgetbox.sip b/sip/QtDesigner/abstractwidgetbox.sip new file mode 100644 index 0000000..c1ef7f2 --- /dev/null +++ b/sip/QtDesigner/abstractwidgetbox.sip @@ -0,0 +1,36 @@ +// abstractwidgetbox.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerWidgetBoxInterface : QWidget /Abstract/ +{ +%TypeHeaderCode +#include +%End + +public: + QDesignerWidgetBoxInterface(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QDesignerWidgetBoxInterface(); + virtual void setFileName(const QString &file_name) = 0; + virtual QString fileName() const = 0; + virtual bool load() = 0; + virtual bool save() = 0; +}; diff --git a/sip/QtDesigner/container.sip b/sip/QtDesigner/container.sip new file mode 100644 index 0000000..02e2fa7 --- /dev/null +++ b/sip/QtDesigner/container.sip @@ -0,0 +1,44 @@ +// container.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerContainerExtension +{ +%TypeHeaderCode +#include +%End + +public: + QDesignerContainerExtension(); + virtual ~QDesignerContainerExtension(); + virtual int count() const = 0 /__len__/; + virtual QWidget *widget(int index) const = 0; + virtual int currentIndex() const = 0; + virtual void setCurrentIndex(int index) = 0; + virtual void addWidget(QWidget *widget) = 0; + virtual void insertWidget(int index, QWidget *widget) = 0; + virtual void remove(int index) = 0; + virtual bool canAddWidget() const = 0; + virtual bool canRemove(int index) const = 0; + +private: + QDesignerContainerExtension(const QDesignerContainerExtension &); +}; diff --git a/sip/QtDesigner/customwidget.sip b/sip/QtDesigner/customwidget.sip new file mode 100644 index 0000000..6cb937a --- /dev/null +++ b/sip/QtDesigner/customwidget.sip @@ -0,0 +1,54 @@ +// customwidget.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerCustomWidgetInterface +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QDesignerCustomWidgetInterface(); + virtual QString name() const = 0; + virtual QString group() const = 0; + virtual QString toolTip() const = 0; + virtual QString whatsThis() const = 0; + virtual QString includeFile() const = 0; + virtual QIcon icon() const = 0; + virtual bool isContainer() const = 0; + virtual QWidget *createWidget(QWidget *parent /TransferThis/) = 0 /Factory/; + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + virtual QString codeTemplate() const; +}; + +class QDesignerCustomWidgetCollectionInterface +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QDesignerCustomWidgetCollectionInterface(); + virtual QList customWidgets() const = 0; +}; diff --git a/sip/QtDesigner/default_extensionfactory.sip b/sip/QtDesigner/default_extensionfactory.sip new file mode 100644 index 0000000..b133bd8 --- /dev/null +++ b/sip/QtDesigner/default_extensionfactory.sip @@ -0,0 +1,36 @@ +// default_extensionfactory.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QExtensionFactory : QObject, QAbstractExtensionFactory +{ +%TypeHeaderCode +#include +%End + +public: + explicit QExtensionFactory(QExtensionManager *parent /TransferThis/ = 0); + virtual QObject *extension(QObject *object, const QString &iid) const; + QExtensionManager *extensionManager() const; + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent /TransferThis/) const /Factory/; +}; diff --git a/sip/QtDesigner/extension.sip b/sip/QtDesigner/extension.sip new file mode 100644 index 0000000..92352f9 --- /dev/null +++ b/sip/QtDesigner/extension.sip @@ -0,0 +1,45 @@ +// extension.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractExtensionFactory +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QAbstractExtensionFactory(); + virtual QObject *extension(QObject *object, const QString &iid) const = 0; +}; + +class QAbstractExtensionManager +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QAbstractExtensionManager(); + virtual void registerExtensions(QAbstractExtensionFactory *factory, const QString &iid) = 0; + virtual void unregisterExtensions(QAbstractExtensionFactory *factory, const QString &iid) = 0; + virtual QObject *extension(QObject *object, const QString &iid) const = 0; +}; diff --git a/sip/QtDesigner/formbuilder.sip b/sip/QtDesigner/formbuilder.sip new file mode 100644 index 0000000..ddd943e --- /dev/null +++ b/sip/QtDesigner/formbuilder.sip @@ -0,0 +1,37 @@ +// formbuilder.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFormBuilder : QAbstractFormBuilder +{ +%TypeHeaderCode +#include +%End + +public: + QFormBuilder(); + virtual ~QFormBuilder(); + QStringList pluginPaths() const; + void clearPluginPaths(); + void addPluginPath(const QString &pluginPath); + void setPluginPath(const QStringList &pluginPaths); + QList customWidgets() const; +}; diff --git a/sip/QtDesigner/membersheet.sip b/sip/QtDesigner/membersheet.sip new file mode 100644 index 0000000..6ccb58a --- /dev/null +++ b/sip/QtDesigner/membersheet.sip @@ -0,0 +1,49 @@ +// membersheet.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerMemberSheetExtension +{ +%TypeHeaderCode +#include +%End + +public: + QDesignerMemberSheetExtension(); + virtual ~QDesignerMemberSheetExtension(); + virtual int count() const = 0 /__len__/; + virtual int indexOf(const QString &name) const = 0; + virtual QString memberName(int index) const = 0; + virtual QString memberGroup(int index) const = 0; + virtual void setMemberGroup(int index, const QString &group) = 0; + virtual bool isVisible(int index) const = 0; + virtual void setVisible(int index, bool b) = 0; + virtual bool isSignal(int index) const = 0; + virtual bool isSlot(int index) const = 0; + virtual bool inheritedFromWidget(int index) const = 0; + virtual QString declaredInClass(int index) const = 0; + virtual QString signature(int index) const = 0; + virtual QList parameterTypes(int index) const = 0; + virtual QList parameterNames(int index) const = 0; + +private: + QDesignerMemberSheetExtension(const QDesignerMemberSheetExtension &); +}; diff --git a/sip/QtDesigner/propertysheet.sip b/sip/QtDesigner/propertysheet.sip new file mode 100644 index 0000000..80cb25e --- /dev/null +++ b/sip/QtDesigner/propertysheet.sip @@ -0,0 +1,51 @@ +// propertysheet.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerPropertySheetExtension +{ +%TypeHeaderCode +#include +%End + +public: + QDesignerPropertySheetExtension(); + virtual ~QDesignerPropertySheetExtension(); + virtual int count() const = 0 /__len__/; + virtual int indexOf(const QString &name) const = 0; + virtual QString propertyName(int index) const = 0; + virtual QString propertyGroup(int index) const = 0; + virtual void setPropertyGroup(int index, const QString &group) = 0; + virtual bool hasReset(int index) const = 0; + virtual bool reset(int index) = 0; + virtual bool isVisible(int index) const = 0; + virtual void setVisible(int index, bool b) = 0; + virtual bool isAttribute(int index) const = 0; + virtual void setAttribute(int index, bool b) = 0; + virtual QVariant property(int index) const = 0; + virtual void setProperty(int index, const QVariant &value) = 0; + virtual bool isChanged(int index) const = 0; + virtual void setChanged(int index, bool changed) = 0; + virtual bool isEnabled(int index) const = 0; + +private: + QDesignerPropertySheetExtension(const QDesignerPropertySheetExtension &); +}; diff --git a/sip/QtDesigner/qextensionmanager.sip b/sip/QtDesigner/qextensionmanager.sip new file mode 100644 index 0000000..cd8e003 --- /dev/null +++ b/sip/QtDesigner/qextensionmanager.sip @@ -0,0 +1,77 @@ +// qextensionmanager.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QExtensionManager : QObject, QAbstractExtensionManager +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QPyDesignerCustomWidgetPlugin, &sipType_QPyDesignerCustomWidgetPlugin, -1, 1}, + {sipName_QExtensionFactory, &sipType_QExtensionFactory, -1, 2}, + {sipName_QPyDesignerMemberSheetExtension, &sipType_QPyDesignerMemberSheetExtension, -1, 3}, + {sipName_QDesignerFormEditorInterface, &sipType_QDesignerFormEditorInterface, -1, 4}, + {sipName_QDesignerWidgetBoxInterface, &sipType_QDesignerWidgetBoxInterface, -1, 5}, + {sipName_QDesignerFormWindowInterface, &sipType_QDesignerFormWindowInterface, -1, 6}, + {sipName_QDesignerActionEditorInterface, &sipType_QDesignerActionEditorInterface, -1, 7}, + {sipName_QPyDesignerContainerExtension, &sipType_QPyDesignerContainerExtension, -1, 8}, + {sipName_QDesignerPropertyEditorInterface, &sipType_QDesignerPropertyEditorInterface, -1, 9}, + {sipName_QDesignerFormWindowManagerInterface, &sipType_QDesignerFormWindowManagerInterface, -1, 10}, + {sipName_QPyDesignerTaskMenuExtension, &sipType_QPyDesignerTaskMenuExtension, -1, 11}, + {sipName_QPyDesignerPropertySheetExtension, &sipType_QPyDesignerPropertySheetExtension, -1, 12}, + {sipName_QDesignerObjectInspectorInterface, &sipType_QDesignerObjectInspectorInterface, -1, 13}, + {sipName_QPyDesignerCustomWidgetCollectionPlugin, &sipType_QPyDesignerCustomWidgetCollectionPlugin, -1, 14}, + {sipName_QExtensionManager, &sipType_QExtensionManager, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + explicit QExtensionManager(QObject *parent /TransferThis/ = 0); + virtual ~QExtensionManager(); + virtual void registerExtensions(QAbstractExtensionFactory *factory, const QString &iid = QString()); + virtual void unregisterExtensions(QAbstractExtensionFactory *factory, const QString &iid = QString()); + virtual QObject *extension(QObject *object, const QString &iid) const; +}; diff --git a/sip/QtDesigner/qpydesignercontainerextension.sip b/sip/QtDesigner/qpydesignercontainerextension.sip new file mode 100644 index 0000000..26426e7 --- /dev/null +++ b/sip/QtDesigner/qpydesignercontainerextension.sip @@ -0,0 +1,32 @@ +// This is the SIP specification of the QPyDesignerContainerExtension class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPyDesignerContainerExtension : QObject, QDesignerContainerExtension +{ +%TypeHeaderCode +#include +%End + +public: + QPyDesignerContainerExtension(QObject *parent /TransferThis/); + +private: + QPyDesignerContainerExtension(const QPyDesignerContainerExtension &); +}; diff --git a/sip/QtDesigner/qpydesignercustomwidgetcollectionplugin.sip b/sip/QtDesigner/qpydesignercustomwidgetcollectionplugin.sip new file mode 100644 index 0000000..28f67a9 --- /dev/null +++ b/sip/QtDesigner/qpydesignercustomwidgetcollectionplugin.sip @@ -0,0 +1,33 @@ +// This is the SIP specification of the QPyDesignerCustomWidgetCollectionPlugin +// class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPyDesignerCustomWidgetCollectionPlugin : QObject, QDesignerCustomWidgetCollectionInterface +{ +%TypeHeaderCode +#include +%End + +public: + QPyDesignerCustomWidgetCollectionPlugin(QObject *parent /TransferThis/ = 0); + +private: + QPyDesignerCustomWidgetCollectionPlugin(const QPyDesignerCustomWidgetCollectionPlugin &); +}; diff --git a/sip/QtDesigner/qpydesignercustomwidgetplugin.sip b/sip/QtDesigner/qpydesignercustomwidgetplugin.sip new file mode 100644 index 0000000..c8002bd --- /dev/null +++ b/sip/QtDesigner/qpydesignercustomwidgetplugin.sip @@ -0,0 +1,32 @@ +// This is the SIP specification of the QPyDesignerCustomWidgetPlugin class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPyDesignerCustomWidgetPlugin : QObject, QDesignerCustomWidgetInterface +{ +%TypeHeaderCode +#include +%End + +public: + QPyDesignerCustomWidgetPlugin(QObject *parent /TransferThis/ = 0); + +private: + QPyDesignerCustomWidgetPlugin(const QPyDesignerCustomWidgetPlugin &); +}; diff --git a/sip/QtDesigner/qpydesignermembersheetextension.sip b/sip/QtDesigner/qpydesignermembersheetextension.sip new file mode 100644 index 0000000..9a0b4bb --- /dev/null +++ b/sip/QtDesigner/qpydesignermembersheetextension.sip @@ -0,0 +1,32 @@ +// This is the SIP specification of the QPyDesignerMemberSheetExtension class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPyDesignerMemberSheetExtension : QObject, QDesignerMemberSheetExtension +{ +%TypeHeaderCode +#include +%End + +public: + QPyDesignerMemberSheetExtension(QObject *parent /TransferThis/); + +private: + QPyDesignerMemberSheetExtension(const QPyDesignerMemberSheetExtension &); +}; diff --git a/sip/QtDesigner/qpydesignerpropertysheetextension.sip b/sip/QtDesigner/qpydesignerpropertysheetextension.sip new file mode 100644 index 0000000..f9814e1 --- /dev/null +++ b/sip/QtDesigner/qpydesignerpropertysheetextension.sip @@ -0,0 +1,33 @@ +// This is the SIP specification of the QPyDesignerPropertySheetExtension +// class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPyDesignerPropertySheetExtension : QObject, QDesignerPropertySheetExtension +{ +%TypeHeaderCode +#include +%End + +public: + QPyDesignerPropertySheetExtension(QObject *parent /TransferThis/); + +private: + QPyDesignerPropertySheetExtension(const QPyDesignerPropertySheetExtension &); +}; diff --git a/sip/QtDesigner/qpydesignertaskmenuextension.sip b/sip/QtDesigner/qpydesignertaskmenuextension.sip new file mode 100644 index 0000000..fdfe7e5 --- /dev/null +++ b/sip/QtDesigner/qpydesignertaskmenuextension.sip @@ -0,0 +1,32 @@ +// This is the SIP specification of the QPyDesignerTaskMenuExtension class. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPyDesignerTaskMenuExtension : QObject, QDesignerTaskMenuExtension +{ +%TypeHeaderCode +#include +%End + +public: + QPyDesignerTaskMenuExtension(QObject *parent /TransferThis/); + +private: + QPyDesignerTaskMenuExtension(const QPyDesignerTaskMenuExtension &); +}; diff --git a/sip/QtDesigner/taskmenu.sip b/sip/QtDesigner/taskmenu.sip new file mode 100644 index 0000000..9f19ca4 --- /dev/null +++ b/sip/QtDesigner/taskmenu.sip @@ -0,0 +1,37 @@ +// taskmenu.sip generated by MetaSIP +// +// This file is part of the QtDesigner Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesignerTaskMenuExtension +{ +%TypeHeaderCode +#include +%End + +public: + QDesignerTaskMenuExtension(); + virtual ~QDesignerTaskMenuExtension(); + virtual QList taskActions() const = 0; + virtual QAction *preferredEditAction() const; + +private: + QDesignerTaskMenuExtension(const QDesignerTaskMenuExtension &); +}; diff --git a/sip/QtGui/QtGuimod.sip b/sip/QtGui/QtGuimod.sip new file mode 100644 index 0000000..88a54d6 --- /dev/null +++ b/sip/QtGui/QtGuimod.sip @@ -0,0 +1,137 @@ +// QtGuimod.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtGui, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qabstractfileiconprovider.sip +%Include qabstracttextdocumentlayout.sip +%Include qaction.sip +%Include qactiongroup.sip +%Include qbackingstore.sip +%Include qbitmap.sip +%Include qcolor.sip +%Include qbrush.sip +%Include qclipboard.sip +%Include qcolorspace.sip +%Include qcolortransform.sip +%Include qcursor.sip +%Include qdesktopservices.sip +%Include qdrag.sip +%Include qevent.sip +%Include qeventpoint.sip +%Include qfilesystemmodel.sip +%Include qfont.sip +%Include qfontdatabase.sip +%Include qfontinfo.sip +%Include qfontmetrics.sip +%Include qgenericmatrix.sip +%Include qglyphrun.sip +%Include qguiapplication.sip +%Include qicon.sip +%Include qiconengine.sip +%Include qimage.sip +%Include qimageiohandler.sip +%Include qimagereader.sip +%Include qimagewriter.sip +%Include qinputdevice.sip +%Include qinputmethod.sip +%Include qkeysequence.sip +%Include qmatrix4x4.sip +%Include qmovie.sip +%Include qoffscreensurface.sip +%Include qopenglcontext.sip +%Include qpagedpaintdevice.sip +%Include qpagelayout.sip +%Include qpageranges.sip +%Include qpagesize.sip +%Include qpaintdevice.sip +%Include qpaintdevicewindow.sip +%Include qpaintengine.sip +%Include qpainter.sip +%Include qpainterpath.sip +%Include qpalette.sip +%Include qpdfwriter.sip +%Include qpen.sip +%Include qpicture.sip +%Include qpixelformat.sip +%Include qpixmap.sip +%Include qpixmapcache.sip +%Include qpointingdevice.sip +%Include qpolygon.sip +%Include qquaternion.sip +%Include qrasterwindow.sip +%Include qrawfont.sip +%Include qregion.sip +%Include qrgba64.sip +%Include qrgb.sip +%Include qscreen.sip +%Include qsessionmanager.sip +%Include qshortcut.sip +%Include qstandarditemmodel.sip +%Include qstatictext.sip +%Include qstylehints.sip +%Include qsurface.sip +%Include qsurfaceformat.sip +%Include qsyntaxhighlighter.sip +%Include qtextcursor.sip +%Include qtextdocument.sip +%Include qtextdocumentfragment.sip +%Include qtextdocumentwriter.sip +%Include qtextformat.sip +%Include qtextlayout.sip +%Include qtextlist.sip +%Include qtextobject.sip +%Include qtextoption.sip +%Include qtexttable.sip +%Include qtransform.sip +%Include qundogroup.sip +%Include qundostack.sip +%Include qutimimeconverter.sip +%Include qvalidator.sip +%Include qvectornd.sip +%Include qwindow.sip +%Include qwindowdefs.sip +%Include qpygui_qlist.sip +%Include opengl_types.sip diff --git a/sip/QtGui/opengl_types.sip b/sip/QtGui/opengl_types.sip new file mode 100644 index 0000000..a913a79 --- /dev/null +++ b/sip/QtGui/opengl_types.sip @@ -0,0 +1,43 @@ +// This implements the typedefs for the OpenGL data types. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_OpenGL) + +typedef char GLchar; +typedef qint8 GLbyte; +typedef quint8 GLubyte; +typedef quint8 GLboolean; +typedef qint16 GLshort; +typedef quint16 GLushort; +typedef qint32 GLint; +typedef qint32 GLsizei; +typedef quint32 GLuint; +typedef quint32 GLenum; +typedef quint32 GLbitfield; +%If (!PyQt_OpenGL_ES2) +typedef quint64 GLuint64; // This is in OpenGL ES v3. +typedef double GLdouble; +%End +typedef float GLfloat; +typedef float GLclampf; +typedef long GLintptr; +typedef long GLsizeiptr; + +%End diff --git a/sip/QtGui/qabstractfileiconprovider.sip b/sip/QtGui/qabstractfileiconprovider.sip new file mode 100644 index 0000000..d88dd1d --- /dev/null +++ b/sip/QtGui/qabstractfileiconprovider.sip @@ -0,0 +1,57 @@ +// qabstractfileiconprovider.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractFileIconProvider +{ +%TypeHeaderCode +#include +%End + +public: + enum IconType + { + Computer, + Desktop, + Trashcan, + Network, + Drive, + Folder, + File, + }; + + enum Option /BaseType=Flag/ + { + DontUseCustomDirectoryIcons, + }; + + typedef QFlags Options; + QAbstractFileIconProvider(); + virtual ~QAbstractFileIconProvider(); + virtual QIcon icon(QAbstractFileIconProvider::IconType) const; + virtual QIcon icon(const QFileInfo &) const; + virtual QString type(const QFileInfo &) const; + virtual void setOptions(QAbstractFileIconProvider::Options); + virtual QAbstractFileIconProvider::Options options() const; + +private: + QAbstractFileIconProvider(const QAbstractFileIconProvider &); +}; diff --git a/sip/QtGui/qabstracttextdocumentlayout.sip b/sip/QtGui/qabstracttextdocumentlayout.sip new file mode 100644 index 0000000..71c7a38 --- /dev/null +++ b/sip/QtGui/qabstracttextdocumentlayout.sip @@ -0,0 +1,99 @@ +// qabstracttextdocumentlayout.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractTextDocumentLayout : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAbstractTextDocumentLayout(QTextDocument *doc); + virtual ~QAbstractTextDocumentLayout(); + + struct Selection + { +%TypeHeaderCode +#include +%End + + QTextCursor cursor; + QTextCharFormat format; + }; + + struct PaintContext + { +%TypeHeaderCode +#include +%End + + PaintContext(); + int cursorPosition; + QPalette palette; + QRectF clip; + QList selections; + }; + + virtual void draw(QPainter *painter, const QAbstractTextDocumentLayout::PaintContext &context) = 0; + virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const = 0; + QString anchorAt(const QPointF &pos) const; + virtual int pageCount() const = 0; + virtual QSizeF documentSize() const = 0; + virtual QRectF frameBoundingRect(QTextFrame *frame) const = 0; + virtual QRectF blockBoundingRect(const QTextBlock &block) const = 0; + void setPaintDevice(QPaintDevice *device); + QPaintDevice *paintDevice() const; + QTextDocument *document() const; + void registerHandler(int objectType, QObject *component); + void unregisterHandler(int objectType, QObject *component = 0); + QTextObjectInterface *handlerForObject(int objectType) const; + +signals: + void update(const QRectF &rect = QRectF(0., 0., 1.0E+9, 1.0E+9)); + void documentSizeChanged(const QSizeF &newSize); + void pageCountChanged(int newPages); + void updateBlock(const QTextBlock &block); + +protected: + virtual void documentChanged(int from, int charsRemoved, int charsAdded) = 0; + virtual void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format); + virtual void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format); + virtual void drawInlineObject(QPainter *painter, const QRectF &rect, QTextInlineObject object, int posInDocument, const QTextFormat &format); + QTextCharFormat format(int pos); + +public: + QString imageAt(const QPointF &pos) const; + QTextFormat formatAt(const QPointF &pos) const; + QTextBlock blockWithMarkerAt(const QPointF &pos) const; +}; + +class QTextObjectInterface /Mixin,PyQtInterface="org.qt-project.Qt.QTextObjectInterface"/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QTextObjectInterface(); + virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; + virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; +}; diff --git a/sip/QtGui/qaction.sip b/sip/QtGui/qaction.sip new file mode 100644 index 0000000..54664c5 --- /dev/null +++ b/sip/QtGui/qaction.sip @@ -0,0 +1,154 @@ +// qaction.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMenu /External/; + +class QAction : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAction(QObject *parent /TransferThis/ = 0); + QAction(const QString &text, QObject *parent /TransferThis/ = 0); + QAction(const QIcon &icon, const QString &text, QObject *parent /TransferThis/ = 0); + virtual ~QAction(); + void setActionGroup(QActionGroup *group /KeepReference/); + QActionGroup *actionGroup() const; + void setIcon(const QIcon &icon); + QIcon icon() const; + void setText(const QString &text); + QString text() const; + void setIconText(const QString &text); + QString iconText() const; + void setToolTip(const QString &tip); + QString toolTip() const; + void setStatusTip(const QString &statusTip); + QString statusTip() const; + void setWhatsThis(const QString &what); + QString whatsThis() const; + void setSeparator(bool b); + bool isSeparator() const; + void setShortcut(const QKeySequence &shortcut); + QKeySequence shortcut() const; + void setShortcutContext(Qt::ShortcutContext context); + Qt::ShortcutContext shortcutContext() const; + void setFont(const QFont &font); + QFont font() const; + void setCheckable(bool); + bool isCheckable() const; + QVariant data() const; + void setData(const QVariant &var); + bool isChecked() const; + bool isEnabled() const; + bool isVisible() const; + + enum ActionEvent + { + Trigger, + Hover, + }; + + void activate(QAction::ActionEvent event); + bool showStatusText(QObject *object = 0); + +protected: + virtual bool event(QEvent *); + +public slots: + void trigger(); + void hover(); + void setChecked(bool); + void toggle(); + void setEnabled(bool); + void setDisabled(bool b); + void setVisible(bool); + +signals: + void changed(); + void triggered(bool checked = false); + void hovered(); + void toggled(bool); + +public: + enum MenuRole + { + NoRole, + TextHeuristicRole, + ApplicationSpecificRole, + AboutQtRole, + AboutRole, + PreferencesRole, + QuitRole, + }; + + void setShortcuts(const QList &shortcuts); + void setShortcuts(QKeySequence::StandardKey); + QList shortcuts() const; + void setAutoRepeat(bool); + bool autoRepeat() const; + void setMenuRole(QAction::MenuRole menuRole); + QAction::MenuRole menuRole() const; + QMenu *menu() const; +%MethodCode + typedef QMenu *(*pyqt6_qtgui_qaction_menu_t)(const QAction *); + + pyqt6_qtgui_qaction_menu_t pyqt6_qtgui_qaction_menu = (pyqt6_qtgui_qaction_menu_t)sipImportSymbol("pyqt6_qaction_menu"); + + sipRes = (pyqt6_qtgui_qaction_menu ? pyqt6_qtgui_qaction_menu(sipCpp) : SIP_NULLPTR); +%End + + void setMenu(QMenu *menu); +%MethodCode + typedef void *(*pyqt6_qtgui_qaction_set_menu_t)(QAction *, QMenu *); + + pyqt6_qtgui_qaction_set_menu_t pyqt6_qtgui_qaction_set_menu = (pyqt6_qtgui_qaction_set_menu_t)sipImportSymbol("pyqt6_qaction_set_menu"); + + if (pyqt6_qtgui_qaction_set_menu) + pyqt6_qtgui_qaction_set_menu(sipCpp, a0); +%End + + void setIconVisibleInMenu(bool visible); + bool isIconVisibleInMenu() const; + + enum Priority + { + LowPriority, + NormalPriority, + HighPriority, + }; + + void setPriority(QAction::Priority priority); + QAction::Priority priority() const; + void setShortcutVisibleInContextMenu(bool show); + bool isShortcutVisibleInContextMenu() const; + QList associatedObjects() const; + +public slots: + void resetEnabled(); + +signals: + void enabledChanged(bool enabled); + void checkableChanged(bool checkable); + void visibleChanged(); +}; diff --git a/sip/QtGui/qactiongroup.sip b/sip/QtGui/qactiongroup.sip new file mode 100644 index 0000000..1e63a3a --- /dev/null +++ b/sip/QtGui/qactiongroup.sip @@ -0,0 +1,61 @@ +// qactiongroup.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QActionGroup : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QActionGroup(QObject *parent /TransferThis/); + virtual ~QActionGroup(); + QAction *addAction(QAction *a /Transfer/); + QAction *addAction(const QString &text) /Transfer/; + QAction *addAction(const QIcon &icon, const QString &text) /Transfer/; + void removeAction(QAction *a /TransferBack/); + QList actions() const; + QAction *checkedAction() const; + bool isExclusive() const; + bool isEnabled() const; + bool isVisible() const; + + enum class ExclusionPolicy + { + None, + Exclusive, + ExclusiveOptional, + }; + + QActionGroup::ExclusionPolicy exclusionPolicy() const; + +public slots: + void setEnabled(bool); + void setDisabled(bool b); + void setVisible(bool); + void setExclusive(bool); + void setExclusionPolicy(QActionGroup::ExclusionPolicy policy); + +signals: + void triggered(QAction *); + void hovered(QAction *); +}; diff --git a/sip/QtGui/qbackingstore.sip b/sip/QtGui/qbackingstore.sip new file mode 100644 index 0000000..6163a4e --- /dev/null +++ b/sip/QtGui/qbackingstore.sip @@ -0,0 +1,43 @@ +// qbackingstore.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QBackingStore /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QBackingStore(QWindow *window); + ~QBackingStore(); + QWindow *window() const; + QPaintDevice *paintDevice(); + void flush(const QRegion ®ion, QWindow *window = 0, const QPoint &offset = QPoint()); + void resize(const QSize &size); + QSize size() const; + bool scroll(const QRegion &area, int dx, int dy); + void beginPaint(const QRegion &); + void endPaint(); + void setStaticContents(const QRegion ®ion); + QRegion staticContents() const; + bool hasStaticContents() const; +}; diff --git a/sip/QtGui/qbitmap.sip b/sip/QtGui/qbitmap.sip new file mode 100644 index 0000000..b42a3e7 --- /dev/null +++ b/sip/QtGui/qbitmap.sip @@ -0,0 +1,51 @@ +// qbitmap.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QBitmap : QPixmap +{ +%TypeHeaderCode +#include +%End + +public: + QBitmap(); + QBitmap(int w, int h); + explicit QBitmap(const QSize &); + QBitmap(const QString &fileName, const char *format = 0); + QBitmap(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new sipQBitmap(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + +%If (Qt_6_3_0 -) + virtual ~QBitmap(); +%End + void clear(); + static QBitmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); + static QBitmap fromPixmap(const QPixmap &pixmap); + static QBitmap fromData(const QSize &size, const uchar *bits, QImage::Format format = QImage::Format_MonoLSB); + QBitmap transformed(const QTransform &matrix) const; + void swap(QBitmap &other /Constrained/); +}; diff --git a/sip/QtGui/qbrush.sip b/sip/QtGui/qbrush.sip new file mode 100644 index 0000000..70ec866 --- /dev/null +++ b/sip/QtGui/qbrush.sip @@ -0,0 +1,422 @@ +// qbrush.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QBrush /TypeHintIn="Union[QBrush, QColor, QGradient]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +// SIP doesn't support automatic type convertors so we explicitly allow a +// QColor or a QGradient to be used whenever a QBrush is expected. Note that +// SIP must process QColor before QBrush so that the former's QVariant cast +// operator is applied before the latter's. + +if (sipIsErr == NULL) + return (sipCanConvertToType(sipPy, sipType_QBrush, SIP_NO_CONVERTORS) || + sipCanConvertToType(sipPy, sipType_QColor, 0) || + sipCanConvertToType(sipPy, sipType_QGradient, 0)); + +if (sipCanConvertToType(sipPy, sipType_QBrush, SIP_NO_CONVERTORS)) +{ + *sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, sipType_QBrush, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + + return 0; +} + +int state; + +if (sipCanConvertToType(sipPy, sipType_QColor, 0)) +{ + QColor *c = reinterpret_cast(sipConvertToType(sipPy, sipType_QColor, 0, 0, &state, sipIsErr)); + + if (*sipIsErr) + { + sipReleaseType(c, sipType_QColor, state); + return 0; + } + + *sipCppPtr = new QBrush(*c); + + sipReleaseType(c, sipType_QColor, state); + + return sipGetState(sipTransferObj); +} + +QGradient *g = reinterpret_cast(sipConvertToType(sipPy, sipType_QGradient, 0, 0, &state, sipIsErr)); + +if (*sipIsErr) +{ + sipReleaseType(g, sipType_QGradient, state); + return 0; +} + +*sipCppPtr = new QBrush(*g); + +sipReleaseType(g, sipType_QGradient, state); + +return sipGetState(sipTransferObj); +%End + +public: + QBrush(); + QBrush(Qt::BrushStyle bs); + QBrush(const QColor &color, Qt::BrushStyle style = Qt::SolidPattern); + QBrush(const QColor &color, const QPixmap &pixmap); + QBrush(const QPixmap &pixmap); + QBrush(const QImage &image); + QBrush(const QBrush &brush); + QBrush(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QBrush(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + ~QBrush(); + void setStyle(Qt::BrushStyle); + QPixmap texture() const; + void setTexture(const QPixmap &pixmap); + void setColor(const QColor &color); + const QGradient *gradient() const; + bool isOpaque() const; + bool operator==(const QBrush &b) const; + bool operator!=(const QBrush &b) const; + void setColor(Qt::GlobalColor acolor); + Qt::BrushStyle style() const; + const QColor &color() const; + void setTextureImage(const QImage &image); + QImage textureImage() const; + void setTransform(const QTransform &); + QTransform transform() const; + void swap(QBrush &other /Constrained/); +}; + +QDataStream &operator>>(QDataStream &, QBrush & /Constrained/) /ReleaseGIL/; +QDataStream &operator<<(QDataStream &, const QBrush & /Constrained/) /ReleaseGIL/; +typedef QList> QGradientStops; + +class QGradient +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + switch (sipCpp->type()) + { + case QGradient::ConicalGradient: + sipType = sipType_QConicalGradient; + break; + + case QGradient::LinearGradient: + sipType = sipType_QLinearGradient; + break; + + case QGradient::RadialGradient: + sipType = sipType_QRadialGradient; + break; + + default: + sipType = 0; + } +%End + +public: + enum CoordinateMode + { + LogicalMode, + StretchToDeviceMode, + ObjectBoundingMode, + ObjectMode, + }; + + enum Type + { + LinearGradient, + RadialGradient, + ConicalGradient, + NoGradient, + }; + + enum Spread + { + PadSpread, + ReflectSpread, + RepeatSpread, + }; + + enum Preset + { + WarmFlame, + NightFade, + SpringWarmth, + JuicyPeach, + YoungPassion, + LadyLips, + SunnyMorning, + RainyAshville, + FrozenDreams, + WinterNeva, + DustyGrass, + TemptingAzure, + HeavyRain, + AmyCrisp, + MeanFruit, + DeepBlue, + RipeMalinka, + CloudyKnoxville, + MalibuBeach, + NewLife, + TrueSunset, + MorpheusDen, + RareWind, + NearMoon, + WildApple, + SaintPetersburg, + PlumPlate, + EverlastingSky, + HappyFisher, + Blessing, + SharpeyeEagle, + LadogaBottom, + LemonGate, + ItmeoBranding, + ZeusMiracle, + OldHat, + StarWine, + HappyAcid, + AwesomePine, + NewYork, + ShyRainbow, + MixedHopes, + FlyHigh, + StrongBliss, + FreshMilk, + SnowAgain, + FebruaryInk, + KindSteel, + SoftGrass, + GrownEarly, + SharpBlues, + ShadyWater, + DirtyBeauty, + GreatWhale, + TeenNotebook, + PoliteRumors, + SweetPeriod, + WideMatrix, + SoftCherish, + RedSalvation, + BurningSpring, + NightParty, + SkyGlider, + HeavenPeach, + PurpleDivision, + AquaSplash, + SpikyNaga, + LoveKiss, + CleanMirror, + PremiumDark, + ColdEvening, + CochitiLake, + SummerGames, + PassionateBed, + MountainRock, + DesertHump, + JungleDay, + PhoenixStart, + OctoberSilence, + FarawayRiver, + AlchemistLab, + OverSun, + PremiumWhite, + MarsParty, + EternalConstance, + JapanBlush, + SmilingRain, + CloudyApple, + BigMango, + HealthyWater, + AmourAmour, + RiskyConcrete, + StrongStick, + ViciousStance, + PaloAlto, + HappyMemories, + MidnightBloom, + Crystalline, + PartyBliss, + ConfidentCloud, + LeCocktail, + RiverCity, + FrozenBerry, + ChildCare, + FlyingLemon, + NewRetrowave, + HiddenJaguar, + AboveTheSky, + Nega, + DenseWater, + Seashore, + MarbleWall, + CheerfulCaramel, + NightSky, + MagicLake, + YoungGrass, + ColorfulPeach, + GentleCare, + PlumBath, + HappyUnicorn, + AfricanField, + SolidStone, + OrangeJuice, + GlassWater, + NorthMiracle, + FruitBlend, + MillenniumPine, + HighFlight, + MoleHall, + SpaceShift, + ForestInei, + RoyalGarden, + RichMetal, + JuicyCake, + SmartIndigo, + SandStrike, + NorseBeauty, + AquaGuidance, + SunVeggie, + SeaLord, + BlackSea, + GrassShampoo, + LandingAircraft, + WitchDance, + SleeplessNight, + AngelCare, + CrystalRiver, + SoftLipstick, + SaltMountain, + PerfectWhite, + FreshOasis, + StrictNovember, + MorningSalad, + DeepRelief, + SeaStrike, + NightCall, + SupremeSky, + LightBlue, + MindCrawl, + LilyMeadow, + SugarLollipop, + SweetDessert, + MagicRay, + TeenParty, + FrozenHeat, + GagarinView, + FabledSunset, + PerfectBlue, + NumPresets, + }; + + QGradient(); + QGradient(QGradient::Preset); + ~QGradient(); + QGradient::Type type() const; + QGradient::Spread spread() const; + void setColorAt(qreal pos, const QColor &color); + void setStops(const QGradientStops &stops); + QGradientStops stops() const; + bool operator==(const QGradient &gradient) const; + bool operator!=(const QGradient &other) const; + void setSpread(QGradient::Spread aspread); + QGradient::CoordinateMode coordinateMode() const; + void setCoordinateMode(QGradient::CoordinateMode mode); +}; + +class QLinearGradient : QGradient +{ +%TypeHeaderCode +#include +%End + +public: + QLinearGradient(); + QLinearGradient(const QPointF &start, const QPointF &finalStop); + QLinearGradient(qreal xStart, qreal yStart, qreal xFinalStop, qreal yFinalStop); + ~QLinearGradient(); + QPointF start() const; + QPointF finalStop() const; + void setStart(const QPointF &start); + void setStart(qreal x, qreal y); + void setFinalStop(const QPointF &stop); + void setFinalStop(qreal x, qreal y); +}; + +class QRadialGradient : QGradient +{ +%TypeHeaderCode +#include +%End + +public: + QRadialGradient(); + QRadialGradient(const QPointF ¢er, qreal radius, const QPointF &focalPoint); + QRadialGradient(const QPointF ¢er, qreal centerRadius, const QPointF &focalPoint, qreal focalRadius); + QRadialGradient(const QPointF ¢er, qreal radius); + QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qreal fy); + QRadialGradient(qreal cx, qreal cy, qreal centerRadius, qreal fx, qreal fy, qreal focalRadius); + QRadialGradient(qreal cx, qreal cy, qreal radius); + ~QRadialGradient(); + QPointF center() const; + QPointF focalPoint() const; + qreal radius() const; + void setCenter(const QPointF ¢er); + void setCenter(qreal x, qreal y); + void setFocalPoint(const QPointF &focalPoint); + void setFocalPoint(qreal x, qreal y); + void setRadius(qreal radius); + qreal centerRadius() const; + void setCenterRadius(qreal radius); + qreal focalRadius() const; + void setFocalRadius(qreal radius); +}; + +class QConicalGradient : QGradient +{ +%TypeHeaderCode +#include +%End + +public: + QConicalGradient(); + QConicalGradient(const QPointF ¢er, qreal startAngle); + QConicalGradient(qreal cx, qreal cy, qreal startAngle); + ~QConicalGradient(); + QPointF center() const; + qreal angle() const; + void setCenter(const QPointF ¢er); + void setCenter(qreal x, qreal y); + void setAngle(qreal angle); +}; diff --git a/sip/QtGui/qclipboard.sip b/sip/QtGui/qclipboard.sip new file mode 100644 index 0000000..e706de6 --- /dev/null +++ b/sip/QtGui/qclipboard.sip @@ -0,0 +1,92 @@ +// qclipboard.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QClipboard : QObject +{ +%TypeHeaderCode +#include +%End + + explicit QClipboard(QObject *parent /TransferThis/); + virtual ~QClipboard(); + +public: + enum Mode + { + Clipboard, + Selection, + FindBuffer, + }; + + void clear(QClipboard::Mode mode = QClipboard::Clipboard); + bool supportsFindBuffer() const; + bool supportsSelection() const; + bool ownsClipboard() const; + bool ownsFindBuffer() const; + bool ownsSelection() const; + QString text(QClipboard::Mode mode = QClipboard::Clipboard) const; + SIP_PYTUPLE text(const QString &subtype, QClipboard::Mode mode = QClipboard::Clipboard) const /TypeHint="Tuple[QString, QString]"/; +%MethodCode + QString *text; + QString *subtype = new QString(*a0); + + Py_BEGIN_ALLOW_THREADS + text = new QString(sipCpp->text(*subtype, a1)); + Py_END_ALLOW_THREADS + + PyObject *text_obj = sipConvertFromNewType(text, sipType_QString, NULL); + PyObject *subtype_obj = sipConvertFromNewType(subtype, sipType_QString, NULL); + + if (text_obj && subtype_obj) + sipRes = PyTuple_Pack(2, text_obj, subtype_obj); + + Py_XDECREF(text_obj); + Py_XDECREF(subtype_obj); +%End + + void setText(const QString &, QClipboard::Mode mode = QClipboard::Clipboard); + const QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) const; + void setMimeData(QMimeData *data /GetWrapper/, QClipboard::Mode mode = QClipboard::Clipboard); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->setMimeData(a0, a1); + Py_END_ALLOW_THREADS + + // Transfer ownership to C++ and make sure the Python object stays alive by + // giving it a reference to itself. The cycle will be broken by QMimeData's + // virtual dtor. The reason we don't do the obvious and just use /Transfer/ is + // that the QClipboard Python object we would transfer ownership to is likely + // to be garbage collected immediately afterwards. + sipTransferTo(a0Wrapper, a0Wrapper); +%End + + QImage image(QClipboard::Mode mode = QClipboard::Clipboard) const; + QPixmap pixmap(QClipboard::Mode mode = QClipboard::Clipboard) const; + void setImage(const QImage &, QClipboard::Mode mode = QClipboard::Clipboard); + void setPixmap(const QPixmap &, QClipboard::Mode mode = QClipboard::Clipboard); + +signals: + void changed(QClipboard::Mode mode); + void dataChanged(); + void findBufferChanged(); + void selectionChanged(); +}; diff --git a/sip/QtGui/qcolor.sip b/sip/QtGui/qcolor.sip new file mode 100644 index 0000000..7a3d00d --- /dev/null +++ b/sip/QtGui/qcolor.sip @@ -0,0 +1,397 @@ +// qcolor.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QColor /TypeHintIn="Union[QColor, Qt.GlobalColor, int]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +// SIP doesn't support automatic type convertors so we explicitly allow a +// Qt::GlobalColor or an (unsigned) int to be used whenever a QColor is +// expected. Note that SIP must process QColor before QBrush so that the +// former's QVariant cast operator is applied before the latter's. + +if (PyLong_Check(sipPy)) +{ + if (sipIsErr == NULL) + return 1; + + unsigned long argb = PyLong_AsUnsignedLong(sipPy); + + if (PyErr_Occurred()) + { + PyErr_Clear(); + *sipIsErr = 1; + return 0; + } + + *sipCppPtr = new QColor(static_cast(argb)); + + return sipGetState(sipTransferObj); +} + +bool is_global_color = true; +int global_color = sipConvertToEnum(sipPy, sipType_Qt_GlobalColor); + +if (PyErr_Occurred()) +{ + PyErr_Clear(); + is_global_color = false; +} + +if (sipIsErr == NULL) + return (is_global_color || + sipCanConvertToType(sipPy, sipType_QColor, SIP_NO_CONVERTORS)); + +if (is_global_color) +{ + *sipCppPtr = new QColor(static_cast(global_color)); + + return sipGetState(sipTransferObj); +} + +*sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, sipType_QColor, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + +return 0; +%End + +%PickleCode + sipRes = Py_BuildValue("iiii", sipCpp->red(), sipCpp->green(), sipCpp->blue(), sipCpp->alpha()); +%End + +public: + enum Spec + { + Invalid, + Rgb, + Hsv, + Cmyk, + Hsl, + ExtendedRgb, + }; + + QColor(Qt::GlobalColor color); + QColor(QRgb rgb); + QColor(QRgba64 rgba64); + QColor(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QColor(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + QString name(QColor::NameFormat format = QColor::HexRgb) const; + void setNamedColor(QStringView name); + static QStringList colorNames(); + QColor::Spec spec() const; + int alpha() const; + void setAlpha(int alpha); + float alphaF() const; + void setAlphaF(float alpha); + int red() const; + int green() const; + int blue() const; + void setRed(int red); + void setGreen(int green); + void setBlue(int blue); + float redF() const; + float greenF() const; + float blueF() const; + void setRedF(float red); + void setGreenF(float green); + void setBlueF(float blue); + void getRgb(int *r, int *g, int *b, int *alpha = 0) const; + void setRgb(int r, int g, int b, int alpha = 255); + void getRgbF(float *r, float *g, float *b, float *alpha = 0) const; + void setRgbF(float r, float g, float b, float alpha = 1.); + QRgb rgba() const; + void setRgba(QRgb rgba); + QRgb rgb() const; + void setRgb(QRgb rgb); + int hue() const; + int saturation() const; + int value() const; + float hueF() const; + float saturationF() const; + float valueF() const; + void getHsv(int *h, int *s, int *v, int *alpha = 0) const; + void setHsv(int h, int s, int v, int alpha = 255); + void getHsvF(float *h, float *s, float *v, float *alpha = 0) const; + void setHsvF(float h, float s, float v, float alpha = 1.); + int cyan() const; + int magenta() const; + int yellow() const; + int black() const; + float cyanF() const; + float magentaF() const; + float yellowF() const; + float blackF() const; + void getCmyk(int *c, int *m, int *y, int *k, int *alpha = 0) const; + void setCmyk(int c, int m, int y, int k, int alpha = 255); + void getCmykF(float *c, float *m, float *y, float *k, float *alpha = 0) const; + void setCmykF(float c, float m, float y, float k, float alpha = 1.); + QColor toRgb() const; + QColor toHsv() const; + QColor toCmyk() const; + QColor convertTo(QColor::Spec colorSpec) const; + static QColor fromRgb(QRgb rgb); + static QColor fromRgba(QRgb rgba); + static QColor fromRgb(int r, int g, int b, int alpha = 255); + static QColor fromRgbF(float r, float g, float b, float alpha = 1.); + static QColor fromHsv(int h, int s, int v, int alpha = 255); + static QColor fromHsvF(float h, float s, float v, float alpha = 1.); + static QColor fromCmyk(int c, int m, int y, int k, int alpha = 255); + static QColor fromCmykF(float c, float m, float y, float k, float alpha = 1.); + bool operator==(const QColor &c) const; + bool operator!=(const QColor &c) const; + QColor(); + QColor(int r, int g, int b, int alpha = 255); + explicit QColor(QStringView name); + bool isValid() const; + QColor lighter(int factor = 150) const; + QColor darker(int factor = 200) const; + int hsvHue() const; + int hsvSaturation() const; + float hsvHueF() const; + float hsvSaturationF() const; + int hslHue() const; + int hslSaturation() const; + int lightness() const; + float hslHueF() const; + float hslSaturationF() const; + float lightnessF() const; + void getHsl(int *h, int *s, int *l, int *alpha = 0) const; + void setHsl(int h, int s, int l, int alpha = 255); + void getHslF(float *h, float *s, float *l, float *alpha = 0) const; + void setHslF(float h, float s, float l, float alpha = 1.); + QColor toHsl() const; + static QColor fromHsl(int h, int s, int l, int alpha = 255); + static QColor fromHslF(float h, float s, float l, float alpha = 1.); + static bool isValidColor(const QString &name); + + enum NameFormat + { + HexRgb, + HexArgb, + }; + + QRgba64 rgba64() const; + void setRgba64(QRgba64 rgba); + static QColor fromRgba64(ushort r, ushort g, ushort b, ushort alpha = USHRT_MAX); + static QColor fromRgba64(QRgba64 rgba); + QColor toExtendedRgb() const; +%If (Qt_6_4_0 -) + static QColor fromString(QAnyStringView name); +%End +%If (Qt_6_4_0 -) + static bool isValidColorName(QAnyStringView); +%End +}; + +QDataStream &operator<<(QDataStream &, const QColor &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QColor & /Constrained/) /ReleaseGIL/; + +namespace QColorConstants +{ +%TypeHeaderCode +#include +%End + + const QColor Color0; + const QColor Color1; + const QColor Black; + const QColor White; + const QColor DarkGray; + const QColor Gray; + const QColor LightGray; + const QColor Red; + const QColor Green; + const QColor Blue; + const QColor Cyan; + const QColor Magenta; + const QColor Yellow; + const QColor DarkRed; + const QColor DarkGreen; + const QColor DarkBlue; + const QColor DarkCyan; + const QColor DarkMagenta; + const QColor DarkYellow; + const QColor Transparent; + + namespace Svg + { +%TypeHeaderCode +#include +%End + + const QColor aliceblue; + const QColor antiquewhite; + const QColor aqua; + const QColor aquamarine; + const QColor azure; + const QColor beige; + const QColor bisque; + const QColor black; + const QColor blanchedalmond; + const QColor blue; + const QColor blueviolet; + const QColor brown; + const QColor burlywood; + const QColor cadetblue; + const QColor chartreuse; + const QColor chocolate; + const QColor coral; + const QColor cornflowerblue; + const QColor cornsilk; + const QColor crimson; + const QColor cyan; + const QColor darkblue; + const QColor darkcyan; + const QColor darkgoldenrod; + const QColor darkgray; + const QColor darkgreen; + const QColor darkgrey; + const QColor darkkhaki; + const QColor darkmagenta; + const QColor darkolivegreen; + const QColor darkorange; + const QColor darkorchid; + const QColor darkred; + const QColor darksalmon; + const QColor darkseagreen; + const QColor darkslateblue; + const QColor darkslategray; + const QColor darkslategrey; + const QColor darkturquoise; + const QColor darkviolet; + const QColor deeppink; + const QColor deepskyblue; + const QColor dimgray; + const QColor dimgrey; + const QColor dodgerblue; + const QColor firebrick; + const QColor floralwhite; + const QColor forestgreen; + const QColor fuchsia; + const QColor gainsboro; + const QColor ghostwhite; + const QColor gold; + const QColor goldenrod; + const QColor gray; + const QColor green; + const QColor greenyellow; + const QColor grey; + const QColor honeydew; + const QColor hotpink; + const QColor indianred; + const QColor indigo; + const QColor ivory; + const QColor khaki; + const QColor lavender; + const QColor lavenderblush; + const QColor lawngreen; + const QColor lemonchiffon; + const QColor lightblue; + const QColor lightcoral; + const QColor lightcyan; + const QColor lightgoldenrodyellow; + const QColor lightgray; + const QColor lightgreen; + const QColor lightgrey; + const QColor lightpink; + const QColor lightsalmon; + const QColor lightseagreen; + const QColor lightskyblue; + const QColor lightslategray; + const QColor lightslategrey; + const QColor lightsteelblue; + const QColor lightyellow; + const QColor lime; + const QColor limegreen; + const QColor linen; + const QColor magenta; + const QColor maroon; + const QColor mediumaquamarine; + const QColor mediumblue; + const QColor mediumorchid; + const QColor mediumpurple; + const QColor mediumseagreen; + const QColor mediumslateblue; + const QColor mediumspringgreen; + const QColor mediumturquoise; + const QColor mediumvioletred; + const QColor midnightblue; + const QColor mintcream; + const QColor mistyrose; + const QColor moccasin; + const QColor navajowhite; + const QColor navy; + const QColor oldlace; + const QColor olive; + const QColor olivedrab; + const QColor orange; + const QColor orangered; + const QColor orchid; + const QColor palegoldenrod; + const QColor palegreen; + const QColor paleturquoise; + const QColor palevioletred; + const QColor papayawhip; + const QColor peachpuff; + const QColor peru; + const QColor pink; + const QColor plum; + const QColor powderblue; + const QColor purple; + const QColor red; + const QColor rosybrown; + const QColor royalblue; + const QColor saddlebrown; + const QColor salmon; + const QColor sandybrown; + const QColor seagreen; + const QColor seashell; + const QColor sienna; + const QColor silver; + const QColor skyblue; + const QColor slateblue; + const QColor slategray; + const QColor slategrey; + const QColor snow; + const QColor springgreen; + const QColor steelblue; + const QColor tan; + const QColor teal; + const QColor thistle; + const QColor tomato; + const QColor turquoise; + const QColor violet; + const QColor wheat; + const QColor white; + const QColor whitesmoke; + const QColor yellow; + const QColor yellowgreen; + }; +}; diff --git a/sip/QtGui/qcolorspace.sip b/sip/QtGui/qcolorspace.sip new file mode 100644 index 0000000..d98a878 --- /dev/null +++ b/sip/QtGui/qcolorspace.sip @@ -0,0 +1,108 @@ +// qcolorspace.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QColorSpace +{ +%TypeHeaderCode +#include +%End + +public: + enum NamedColorSpace + { + SRgb, + SRgbLinear, + AdobeRgb, + DisplayP3, + ProPhotoRgb, + }; + + enum class Primaries + { + Custom, + SRgb, + AdobeRgb, + DciP3D65, + ProPhotoRgb, + }; + + enum class TransferFunction + { + Custom, + Linear, + Gamma, + SRgb, + ProPhotoRgb, + }; + + QColorSpace(); + QColorSpace(QColorSpace::NamedColorSpace namedColorSpace); + QColorSpace(QColorSpace::Primaries primaries, QColorSpace::TransferFunction fun, float gamma = 0.F); + QColorSpace(QColorSpace::Primaries primaries, float gamma); +%If (Qt_6_1_0 -) + QColorSpace(QColorSpace::Primaries primaries, const QList &transferFunctionTable); +%End + QColorSpace(const QPointF &whitePoint, const QPointF &redPoint, const QPointF &greenPoint, const QPointF &bluePoint, QColorSpace::TransferFunction fun, float gamma = 0.F); +%If (Qt_6_1_0 -) + QColorSpace(const QPointF &whitePoint, const QPointF &redPoint, const QPointF &greenPoint, const QPointF &bluePoint, const QList &redTransferFunctionTable, const QList &greenTransferFunctionTable, const QList &blueTransferFunctionTable); +%End +%If (Qt_6_1_0 -) + QColorSpace(const QPointF &whitePoint, const QPointF &redPoint, const QPointF &greenPoint, const QPointF &bluePoint, const QList &transferFunctionTable); +%End + QColorSpace(const QColorSpace &colorSpace); + ~QColorSpace(); + void swap(QColorSpace &colorSpace /Constrained/); + QColorSpace::Primaries primaries() const; + QColorSpace::TransferFunction transferFunction() const; + float gamma() const; + void setTransferFunction(QColorSpace::TransferFunction transferFunction, float gamma = 0.F); +%If (Qt_6_1_0 -) + void setTransferFunction(const QList &transferFunctionTable); +%End +%If (Qt_6_1_0 -) + void setTransferFunctions(const QList &redTransferFunctionTable, const QList &greenTransferFunctionTable, const QList &blueTransferFunctionTable); +%End +%If (Qt_6_1_0 -) + QColorSpace withTransferFunction(const QList &transferFunctionTable) const; +%End + QColorSpace withTransferFunction(QColorSpace::TransferFunction transferFunction, float gamma = 0.F) const; +%If (Qt_6_1_0 -) + QColorSpace withTransferFunctions(const QList &redTransferFunctionTable, const QList &greenTransferFunctionTable, const QList &blueTransferFunctionTable) const; +%End + void setPrimaries(QColorSpace::Primaries primariesId); + void setPrimaries(const QPointF &whitePoint, const QPointF &redPoint, const QPointF &greenPoint, const QPointF &bluePoint); + bool isValid() const; + static QColorSpace fromIccProfile(const QByteArray &iccProfile); + QByteArray iccProfile() const; + QColorTransform transformationToColorSpace(const QColorSpace &colorspace) const; +%If (Qt_6_2_0 -) + QString description() const; +%End +%If (Qt_6_2_0 -) + void setDescription(const QString &description); +%End +}; + +bool operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2); +bool operator!=(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2); +QDataStream &operator<<(QDataStream &, const QColorSpace & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QColorSpace & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qcolortransform.sip b/sip/QtGui/qcolortransform.sip new file mode 100644 index 0000000..04ac105 --- /dev/null +++ b/sip/QtGui/qcolortransform.sip @@ -0,0 +1,47 @@ +// qcolortransform.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QColorTransform +{ +%TypeHeaderCode +#include +%End + +public: + QColorTransform(); + QColorTransform(const QColorTransform &colorTransform); + ~QColorTransform(); + void swap(QColorTransform &other /Constrained/); + QRgb map(QRgb argb) const; + QRgba64 map(QRgba64 rgba64) const; + QColor map(const QColor &color) const; +%If (Qt_6_4_0 -) + bool isIdentity() const; +%End +}; + +%If (Qt_6_4_0 -) +bool operator==(const QColorTransform &ct1, const QColorTransform &ct2); +%End +%If (Qt_6_4_0 -) +bool operator!=(const QColorTransform &ct1, const QColorTransform &ct2); +%End diff --git a/sip/QtGui/qcursor.sip b/sip/QtGui/qcursor.sip new file mode 100644 index 0000000..16d6832 --- /dev/null +++ b/sip/QtGui/qcursor.sip @@ -0,0 +1,90 @@ +// qcursor.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCursor /TypeHintIn="Union[QCursor, Qt.CursorShape]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +// SIP doesn't support automatic type convertors so we explicitly allow a +// Qt::CursorShape to be used whenever a QCursor is expected. + +bool is_cursor_shape = true; +int cursor_shape = sipConvertToEnum(sipPy, sipType_Qt_CursorShape); + +if (PyErr_Occurred()) +{ + PyErr_Clear(); + is_cursor_shape = false; +} + +if (sipIsErr == NULL) + return (is_cursor_shape || + sipCanConvertToType(sipPy, sipType_QCursor, SIP_NO_CONVERTORS)); + +if (is_cursor_shape) +{ + *sipCppPtr = new QCursor(static_cast(cursor_shape)); + + return sipGetState(sipTransferObj); +} + +*sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, sipType_QCursor, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + +return 0; +%End + +public: + QCursor(); + QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX = -1, int hotY = -1); + QCursor(const QPixmap &pixmap, int hotX = -1, int hotY = -1); + QCursor(const QCursor &cursor); + QCursor(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QCursor(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + ~QCursor(); + Qt::CursorShape shape() const; + void setShape(Qt::CursorShape newShape); + QBitmap bitmap() const; + QBitmap mask() const; + QPixmap pixmap() const; + QPoint hotSpot() const; + static QPoint pos(); + static void setPos(int x, int y); + static void setPos(const QPoint &p); + static QPoint pos(const QScreen *screen); + static void setPos(QScreen *screen, int x, int y); + static void setPos(QScreen *screen, const QPoint &p); + void swap(QCursor &other); +}; + +QDataStream &operator<<(QDataStream &outS, const QCursor &cursor) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &inS, QCursor &cursor /Constrained/) /ReleaseGIL/; +bool operator==(const QCursor &lhs, const QCursor &rhs); +bool operator!=(const QCursor &lhs, const QCursor &rhs); diff --git a/sip/QtGui/qdesktopservices.sip b/sip/QtGui/qdesktopservices.sip new file mode 100644 index 0000000..9d69592 --- /dev/null +++ b/sip/QtGui/qdesktopservices.sip @@ -0,0 +1,67 @@ +// qdesktopservices.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDesktopServices +{ +%TypeHeaderCode +#include +%End + +public: + static bool openUrl(const QUrl &url) /ReleaseGIL/; + static void setUrlHandler(const QString &scheme, QObject *receiver, const char *method); + static void setUrlHandler(const QString &scheme, SIP_PYCALLABLE method /TypeHint="Callable[[QUrl], None]"/); +%MethodCode + // Allow a callable that must be a slot of a QObject, although we never tell + // the user if it isn't. + sipMethodDef pm; + + if (sipGetMethod(a1, &pm)) + { + int iserr = 0; + QObject *receiver = reinterpret_cast(sipForceConvertToType( + pm.pm_self, sipType_QObject, NULL, SIP_NOT_NONE, NULL, &iserr)); + + if (!iserr) + { + PyObject *f_name_obj = PyObject_GetAttrString(pm.pm_function, "__name__"); + + if (f_name_obj) + { + // We only want a borrowed reference. + Py_DECREF(f_name_obj); + + const char *f_name = sipString_AsASCIIString(&f_name_obj); + + if (f_name) + { + QDesktopServices::setUrlHandler(*a0, receiver, f_name); + + Py_DECREF(f_name_obj); + } + } + } + } +%End + + static void unsetUrlHandler(const QString &scheme); +}; diff --git a/sip/QtGui/qdrag.sip b/sip/QtGui/qdrag.sip new file mode 100644 index 0000000..5ec9dec --- /dev/null +++ b/sip/QtGui/qdrag.sip @@ -0,0 +1,55 @@ +// qdrag.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDrag : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QDrag(QObject *dragSource /TransferThis/); + virtual ~QDrag(); + Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction) /ReleaseGIL/; + Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultDropAction) /ReleaseGIL/; + void setMimeData(QMimeData *data /Transfer/); + QMimeData *mimeData() const; + void setPixmap(const QPixmap &); + QPixmap pixmap() const; + void setHotSpot(const QPoint &hotspot); + QPoint hotSpot() const; + QObject *source() const; + QObject *target() const; + void setDragCursor(const QPixmap &cursor, Qt::DropAction action); + +signals: + void actionChanged(Qt::DropAction action); + void targetChanged(QObject *newTarget); + +public: + QPixmap dragCursor(Qt::DropAction action) const; + Qt::DropActions supportedActions() const; + Qt::DropAction defaultAction() const; +%If (Android || Linux || WebAssembly || Windows) + static void cancel(); +%End +}; diff --git a/sip/QtGui/qevent.sip b/sip/QtGui/qevent.sip new file mode 100644 index 0000000..0945591 --- /dev/null +++ b/sip/QtGui/qevent.sip @@ -0,0 +1,850 @@ +// qevent.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QInputEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + switch (sipCpp->type()) + { + case QEvent::ActionAdded: + case QEvent::ActionChanged: + case QEvent::ActionRemoved: + sipType = sipType_QActionEvent; + break; + + case QEvent::Close: + sipType = sipType_QCloseEvent; + break; + + case QEvent::ContextMenu: + sipType = sipType_QContextMenuEvent; + break; + + case QEvent::DragEnter: + sipType = sipType_QDragEnterEvent; + break; + + case QEvent::DragLeave: + sipType = sipType_QDragLeaveEvent; + break; + + case QEvent::DragMove: + sipType = sipType_QDragMoveEvent; + break; + + case QEvent::Drop: + sipType = sipType_QDropEvent; + break; + + case QEvent::Enter: + sipType = sipType_QEnterEvent; + break; + + case QEvent::FileOpen: + sipType = sipType_QFileOpenEvent; + break; + + case QEvent::FocusIn: + case QEvent::FocusOut: + sipType = sipType_QFocusEvent; + break; + + case QEvent::Hide: + sipType = sipType_QHideEvent; + break; + + case QEvent::HoverEnter: + case QEvent::HoverLeave: + case QEvent::HoverMove: + sipType = sipType_QHoverEvent; + break; + + case QEvent::IconDrag: + sipType = sipType_QIconDragEvent; + break; + + case QEvent::InputMethod: + sipType = sipType_QInputMethodEvent; + break; + + case QEvent::KeyPress: + case QEvent::KeyRelease: + case QEvent::ShortcutOverride: + sipType = sipType_QKeyEvent; + break; + + case QEvent::MouseButtonDblClick: + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + sipType = sipType_QMouseEvent; + break; + + case QEvent::Move: + sipType = sipType_QMoveEvent; + break; + + case QEvent::Paint: + sipType = sipType_QPaintEvent; + break; + + case QEvent::Resize: + sipType = sipType_QResizeEvent; + break; + + case QEvent::Shortcut: + sipType = sipType_QShortcutEvent; + break; + + case QEvent::Show: + sipType = sipType_QShowEvent; + break; + + case QEvent::StatusTip: + sipType = sipType_QStatusTipEvent; + break; + + case QEvent::TabletMove: + case QEvent::TabletPress: + case QEvent::TabletRelease: + case QEvent::TabletEnterProximity: + case QEvent::TabletLeaveProximity: + sipType = sipType_QTabletEvent; + break; + + case QEvent::ToolTip: + case QEvent::WhatsThis: + sipType = sipType_QHelpEvent; + break; + + case QEvent::WhatsThisClicked: + sipType = sipType_QWhatsThisClickedEvent; + break; + + case QEvent::Wheel: + sipType = sipType_QWheelEvent; + break; + + case QEvent::WindowStateChange: + sipType = sipType_QWindowStateChangeEvent; + break; + + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: + case QEvent::TouchCancel: + sipType = sipType_QTouchEvent; + break; + + case QEvent::InputMethodQuery: + sipType = sipType_QInputMethodQueryEvent; + break; + + case QEvent::Expose: + sipType = sipType_QExposeEvent; + break; + + case QEvent::ScrollPrepare: + sipType = sipType_QScrollPrepareEvent; + break; + + case QEvent::Scroll: + sipType = sipType_QScrollEvent; + break; + + case QEvent::NativeGesture: + sipType = sipType_QNativeGestureEvent; + break; + + case QEvent::PlatformSurface: + sipType = sipType_QPlatformSurfaceEvent; + break; + + default: + sipType = 0; + } +%End + +public: + virtual ~QInputEvent(); + Qt::KeyboardModifiers modifiers() const; + quint64 timestamp() const; + const QInputDevice *device() const; + QInputDevice::DeviceType deviceType() const; + virtual QInputEvent *clone() const /Factory/; + +private: + QInputEvent(const QInputEvent &); +}; + +class QKeyEvent : QInputEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text = QString(), bool autorep = false, quint16 count = 1, const QInputDevice *device = QInputDevice::primaryKeyboard()); + QKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text = QString(), bool autorep = false, quint16 count = 1); + virtual ~QKeyEvent(); + int key() const; + Qt::KeyboardModifiers modifiers() const; + QString text() const; + bool isAutoRepeat() const; + int count() const /__len__/; + bool matches(QKeySequence::StandardKey key) const; + quint32 nativeModifiers() const; + quint32 nativeScanCode() const; + quint32 nativeVirtualKey() const; + QKeyCombination keyCombination() const; + virtual QKeyEvent *clone() const /Factory/; +}; + +bool operator==(QKeyEvent *e, QKeySequence::StandardKey key); +bool operator==(QKeySequence::StandardKey key, QKeyEvent *e); + +class QFocusEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QFocusEvent(QEvent::Type type, Qt::FocusReason reason = Qt::OtherFocusReason); + virtual ~QFocusEvent(); + bool gotFocus() const; + bool lostFocus() const; + Qt::FocusReason reason() const; + virtual QFocusEvent *clone() const /Factory/; +}; + +class QPaintEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QPaintEvent(const QRegion &paintRegion); + explicit QPaintEvent(const QRect &paintRect); + virtual ~QPaintEvent(); + const QRect &rect() const; + const QRegion ®ion() const; + virtual QPaintEvent *clone() const /Factory/; +}; + +class QMoveEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QMoveEvent(const QPoint &pos, const QPoint &oldPos); + virtual ~QMoveEvent(); + const QPoint &pos() const; + const QPoint &oldPos() const; + virtual QMoveEvent *clone() const /Factory/; +}; + +class QResizeEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QResizeEvent(const QSize &size, const QSize &oldSize); + virtual ~QResizeEvent(); + const QSize &size() const; + const QSize &oldSize() const; + virtual QResizeEvent *clone() const /Factory/; +}; + +class QCloseEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QCloseEvent(); + virtual ~QCloseEvent(); +%If (Qt_6_4_0 -) + virtual QCloseEvent *clone() const /Factory/; +%End +}; + +class QIconDragEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QIconDragEvent(); + virtual ~QIconDragEvent(); +%If (Qt_6_4_0 -) + virtual QIconDragEvent *clone() const /Factory/; +%End +}; + +class QShowEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QShowEvent(); + virtual ~QShowEvent(); +%If (Qt_6_4_0 -) + virtual QShowEvent *clone() const /Factory/; +%End +}; + +class QHideEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QHideEvent(); + virtual ~QHideEvent(); +%If (Qt_6_4_0 -) + virtual QHideEvent *clone() const /Factory/; +%End +}; + +class QContextMenuEvent : QInputEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum Reason + { + Mouse, + Keyboard, + Other, + }; + + QContextMenuEvent(QContextMenuEvent::Reason reason, const QPoint &pos, const QPoint &globalPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier); + QContextMenuEvent(QContextMenuEvent::Reason reason, const QPoint &pos); + virtual ~QContextMenuEvent(); + int x() const; + int y() const; + int globalX() const; + int globalY() const; + const QPoint &pos() const; + const QPoint &globalPos() const; + QContextMenuEvent::Reason reason() const; + virtual QContextMenuEvent *clone() const /Factory/; +}; + +class QInputMethodEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum AttributeType + { + TextFormat, + Cursor, + Language, + Ruby, + Selection, + }; + + class Attribute + { +%TypeHeaderCode +#include +%End + + public: + Attribute(QInputMethodEvent::AttributeType t, int s, int l, QVariant val); + Attribute(QInputMethodEvent::AttributeType typ, int s, int l); + QInputMethodEvent::AttributeType type; + int start; + int length; + QVariant value; + }; + + QInputMethodEvent(); + QInputMethodEvent(const QString &preeditText, const QList &attributes); + virtual ~QInputMethodEvent(); + void setCommitString(const QString &commitString, int from = 0, int length = 0); + const QList &attributes() const; + const QString &preeditString() const; + const QString &commitString() const; + int replacementStart() const; + int replacementLength() const; + virtual QInputMethodEvent *clone() const /Factory/; +}; + +bool operator==(const QInputMethodEvent::Attribute &lhs, const QInputMethodEvent::Attribute &rhs); +bool operator!=(const QInputMethodEvent::Attribute &lhs, const QInputMethodEvent::Attribute &rhs); + +class QInputMethodQueryEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries); + virtual ~QInputMethodQueryEvent(); + Qt::InputMethodQueries queries() const; + void setValue(Qt::InputMethodQuery query, const QVariant &value); + QVariant value(Qt::InputMethodQuery query) const; + virtual QInputMethodQueryEvent *clone() const /Factory/; +}; + +class QDropEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QDropEvent(const QPointF &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QEvent::Type type = QEvent::Drop); + virtual ~QDropEvent(); + Qt::DropActions possibleActions() const; + Qt::DropAction proposedAction() const; + void acceptProposedAction(); + Qt::DropAction dropAction() const; + void setDropAction(Qt::DropAction action); + QObject *source() const; + const QMimeData *mimeData() const; + QPointF position() const; + Qt::MouseButtons buttons() const; + Qt::KeyboardModifiers modifiers() const; + virtual QDropEvent *clone() const /Factory/; +}; + +class QDragMoveEvent : QDropEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, QEvent::Type type = QEvent::DragMove); + virtual ~QDragMoveEvent(); + QRect answerRect() const; + void accept(); + void ignore(); + void accept(const QRect &r); + void ignore(const QRect &r); + virtual QDragMoveEvent *clone() const /Factory/; +}; + +class QDragEnterEvent : QDragMoveEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); + virtual ~QDragEnterEvent(); +%If (Qt_6_4_0 -) + virtual QDragEnterEvent *clone() const /Factory/; +%End +}; + +class QDragLeaveEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QDragLeaveEvent(); + virtual ~QDragLeaveEvent(); +%If (Qt_6_4_0 -) + virtual QDragLeaveEvent *clone() const /Factory/; +%End +}; + +class QHelpEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QHelpEvent(QEvent::Type type, const QPoint &pos, const QPoint &globalPos); + virtual ~QHelpEvent(); + int x() const; + int y() const; + int globalX() const; + int globalY() const; + const QPoint &pos() const; + const QPoint &globalPos() const; + virtual QHelpEvent *clone() const /Factory/; +}; + +class QStatusTipEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QStatusTipEvent(const QString &tip); + virtual ~QStatusTipEvent(); + QString tip() const; + virtual QStatusTipEvent *clone() const /Factory/; +}; + +class QWhatsThisClickedEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QWhatsThisClickedEvent(const QString &href); + virtual ~QWhatsThisClickedEvent(); + QString href() const; + virtual QWhatsThisClickedEvent *clone() const /Factory/; +}; + +class QActionEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QActionEvent(int type, QAction *action, QAction *before = 0); + virtual ~QActionEvent(); + QAction *action() const; + QAction *before() const; + virtual QActionEvent *clone() const /Factory/; +}; + +class QFileOpenEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QFileOpenEvent(); + QString file() const; + QUrl url() const; + bool openFile(QFile &file, QIODeviceBase::OpenMode flags) const /ReleaseGIL/; + virtual QFileOpenEvent *clone() const /Factory/; + +private: + QFileOpenEvent(const QFileOpenEvent &); +}; + +class QShortcutEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false); +%If (Qt_6_5_0 -) + QShortcutEvent(const QKeySequence &key, const QShortcut *shortcut = 0, bool ambiguous = false); +%End + virtual ~QShortcutEvent(); + bool isAmbiguous() const; + const QKeySequence &key() const; + int shortcutId() const; + virtual QShortcutEvent *clone() const /Factory/; +}; + +class QWindowStateChangeEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QWindowStateChangeEvent(); + Qt::WindowStates oldState() const; + virtual QWindowStateChangeEvent *clone() const /Factory/; + +private: + QWindowStateChangeEvent(const QWindowStateChangeEvent &); +}; + +class QExposeEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QExposeEvent(const QRegion &rgn); + virtual ~QExposeEvent(); + virtual QExposeEvent *clone() const /Factory/; +}; + +class QScrollPrepareEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QScrollPrepareEvent(const QPointF &startPos); + virtual ~QScrollPrepareEvent(); + QPointF startPos() const; + QSizeF viewportSize() const; + QRectF contentPosRange() const; + QPointF contentPos() const; + void setViewportSize(const QSizeF &size); + void setContentPosRange(const QRectF &rect); + void setContentPos(const QPointF &pos); + virtual QScrollPrepareEvent *clone() const /Factory/; +}; + +class QScrollEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum ScrollState + { + ScrollStarted, + ScrollUpdated, + ScrollFinished, + }; + + QScrollEvent(const QPointF &contentPos, const QPointF &overshoot, QScrollEvent::ScrollState scrollState); + virtual ~QScrollEvent(); + QPointF contentPos() const; + QPointF overshootDistance() const; + QScrollEvent::ScrollState scrollState() const; + virtual QScrollEvent *clone() const /Factory/; +}; + +class QPlatformSurfaceEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum SurfaceEventType + { + SurfaceCreated, + SurfaceAboutToBeDestroyed, + }; + + explicit QPlatformSurfaceEvent(QPlatformSurfaceEvent::SurfaceEventType surfaceEventType); + virtual ~QPlatformSurfaceEvent(); + QPlatformSurfaceEvent::SurfaceEventType surfaceEventType() const; + virtual QPlatformSurfaceEvent *clone() const /Factory/; +}; + +class QPointerEvent : QInputEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QPointerEvent(); + const QPointingDevice *pointingDevice() const; + QPointingDevice::PointerType pointerType() const; + qsizetype pointCount() const; + QEventPoint &point(qsizetype i); + const QList &points() const; + QEventPoint *pointById(int id); + virtual bool isBeginEvent() const; + virtual bool isUpdateEvent() const; + virtual bool isEndEvent() const; + bool allPointsAccepted() const; + virtual void setAccepted(bool accepted); + virtual QPointerEvent *clone() const /Factory/; + +private: + QPointerEvent(const QPointerEvent &); +}; + +class QSinglePointEvent : QPointerEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: +%If (Qt_6_4_0 -) + virtual ~QSinglePointEvent(); +%End + Qt::MouseButton button() const; + Qt::MouseButtons buttons() const; + QPointF position() const; + QPointF scenePosition() const; + QPointF globalPosition() const; + virtual bool isBeginEvent() const; + virtual bool isUpdateEvent() const; + virtual bool isEndEvent() const; + QObject *exclusivePointGrabber() const; + void setExclusivePointGrabber(QObject *exclusiveGrabber); + virtual QSinglePointEvent *clone() const /Factory/; + +private: + QSinglePointEvent(const QSinglePointEvent &); +}; + +class QEnterEvent : QSinglePointEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QEnterEvent(const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); + virtual ~QEnterEvent(); + virtual QEnterEvent *clone() const /Factory/; +}; + +class QMouseEvent : QSinglePointEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QMouseEvent(QEvent::Type type, const QPointF &localPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); + QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); + QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); + virtual ~QMouseEvent(); + QPoint pos() const; + Qt::MouseEventFlags flags() const; + virtual QMouseEvent *clone() const /Factory/; +}; + +class QHoverEvent : QSinglePointEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: +%If (Qt_6_3_0 -) + QHoverEvent(QEvent::Type type, const QPointF &pos, const QPointF &globalPos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier, const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); +%End + QHoverEvent(QEvent::Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier, const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); + virtual ~QHoverEvent(); + virtual bool isUpdateEvent() const; + QPoint oldPos() const; + QPointF oldPosF() const; + virtual QHoverEvent *clone() const /Factory/; +}; + +class QWheelEvent : QSinglePointEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, bool inverted, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized, const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); + virtual ~QWheelEvent(); + QPoint pixelDelta() const; + QPoint angleDelta() const; + Qt::ScrollPhase phase() const; + bool inverted() const; + virtual bool isBeginEvent() const; + virtual bool isUpdateEvent() const; + virtual bool isEndEvent() const; + virtual QWheelEvent *clone() const /Factory/; +}; + +class QTabletEvent : QSinglePointEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QTabletEvent(QEvent::Type t, const QPointingDevice *device, const QPointF &pos, const QPointF &globalPos, qreal pressure, float xTilt, float yTilt, float tangentialPressure, qreal rotation, float z, Qt::KeyboardModifiers keyState, Qt::MouseButton button, Qt::MouseButtons buttons); + virtual ~QTabletEvent(); + qreal pressure() const; + qreal rotation() const; + qreal z() const; + qreal tangentialPressure() const; + qreal xTilt() const; + qreal yTilt() const; + virtual QTabletEvent *clone() const /Factory/; +}; + +class QNativeGestureEvent : QSinglePointEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: +%If (Qt_6_2_0 -) + QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *dev, int fingerCount, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, qreal value, const QPointF &delta, quint64 sequenceId = UINT64_MAX); +%End + QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *dev, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, qreal value, quint64 sequenceId, quint64 intArgument); + virtual ~QNativeGestureEvent(); + Qt::NativeGestureType gestureType() const; + qreal value() const; + virtual QNativeGestureEvent *clone() const /Factory/; +%If (Qt_6_2_0 -) + int fingerCount() const; +%End +%If (Qt_6_2_0 -) + QPointF delta() const; +%End +}; + +class QTouchEvent : QPointerEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QTouchEvent(QEvent::Type eventType, const QPointingDevice *device = 0, Qt::KeyboardModifiers modifiers = Qt::NoModifier, const QList &touchPoints = {}); + virtual ~QTouchEvent(); + QObject *target() const; + QEventPoint::States touchPointStates() const; + virtual bool isBeginEvent() const; + virtual bool isUpdateEvent() const; + virtual bool isEndEvent() const; + virtual QTouchEvent *clone() const /Factory/; +}; diff --git a/sip/QtGui/qeventpoint.sip b/sip/QtGui/qeventpoint.sip new file mode 100644 index 0000000..5ac7ac6 --- /dev/null +++ b/sip/QtGui/qeventpoint.sip @@ -0,0 +1,73 @@ +// qeventpoint.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QEventPoint +{ +%TypeHeaderCode +#include +%End + +public: + enum State /BaseType=Flag/ + { + Unknown, + Stationary, + Pressed, + Updated, + Released, + }; + + typedef QFlags States; + QEventPoint(int pointId, QEventPoint::State state, const QPointF &scenePosition, const QPointF &globalPosition); + QEventPoint(const QEventPoint &other); + bool operator==(const QEventPoint &other) const; + bool operator!=(const QEventPoint &other) const; + ~QEventPoint(); + void swap(QEventPoint &other /Constrained/); + QPointF position() const; + QPointF pressPosition() const; + QPointF grabPosition() const; + QPointF lastPosition() const; + QPointF scenePosition() const; + QPointF scenePressPosition() const; + QPointF sceneGrabPosition() const; + QPointF sceneLastPosition() const; + QPointF globalPosition() const; + QPointF globalPressPosition() const; + QPointF globalGrabPosition() const; + QPointF globalLastPosition() const; + QPointF normalizedPosition() const; + QVector2D velocity() const; + QEventPoint::State state() const; + const QPointingDevice *device() const; + int id() const; + QPointingDeviceUniqueId uniqueId() const; + ulong timestamp() const; + ulong lastTimestamp() const; + ulong pressTimestamp() const; + qreal timeHeld() const; + qreal pressure() const; + qreal rotation() const; + QSizeF ellipseDiameters() const; + bool isAccepted() const; + void setAccepted(bool accepted = true); +}; diff --git a/sip/QtGui/qfilesystemmodel.sip b/sip/QtGui/qfilesystemmodel.sip new file mode 100644 index 0000000..294e852 --- /dev/null +++ b/sip/QtGui/qfilesystemmodel.sip @@ -0,0 +1,111 @@ +// qfilesystemmodel.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFileSystemModel : QAbstractItemModel +{ +%TypeHeaderCode +#include +%End + +public: + enum Roles /BaseType=IntEnum/ + { + FileIconRole, + FilePathRole, + FileNameRole, + FilePermissions, + }; + + explicit QFileSystemModel(QObject *parent /TransferThis/ = 0); + virtual ~QFileSystemModel(); + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex index(const QString &path, int column = 0) const; + virtual QModelIndex parent(const QModelIndex &child) const; + virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + virtual bool canFetchMore(const QModelIndex &parent) const; + virtual void fetchMore(const QModelIndex &parent); + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + QVariant myComputer(int role = Qt::DisplayRole) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QModelIndexList &indexes) const; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + virtual Qt::DropActions supportedDropActions() const; + QModelIndex setRootPath(const QString &path); + QString rootPath() const; + QDir rootDirectory() const; + void setIconProvider(QAbstractFileIconProvider *provider /KeepReference/); + QAbstractFileIconProvider *iconProvider() const; + void setFilter(QDir::Filters filters); + QDir::Filters filter() const; + void setResolveSymlinks(bool enable); + bool resolveSymlinks() const; + void setReadOnly(bool enable); + bool isReadOnly() const; + void setNameFilterDisables(bool enable); + bool nameFilterDisables() const; + void setNameFilters(const QStringList &filters); + QStringList nameFilters() const; + QString filePath(const QModelIndex &index) const; + bool isDir(const QModelIndex &index) const; + qint64 size(const QModelIndex &index) const; + QString type(const QModelIndex &index) const; + QDateTime lastModified(const QModelIndex &index) const; + QModelIndex mkdir(const QModelIndex &parent, const QString &name); + QFileDevice::Permissions permissions(const QModelIndex &index) const; + bool rmdir(const QModelIndex &index); + QString fileName(const QModelIndex &aindex) const; + QIcon fileIcon(const QModelIndex &aindex) const; + QFileInfo fileInfo(const QModelIndex &aindex) const; + bool remove(const QModelIndex &index); + +signals: + void fileRenamed(const QString &path, const QString &oldName, const QString &newName); + void rootPathChanged(const QString &newPath); + void directoryLoaded(const QString &path); + +protected: + virtual bool event(QEvent *event); + virtual void timerEvent(QTimerEvent *event); + +public: + virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const; + + enum Option /BaseType=Flag/ + { + DontWatchForChanges, + DontResolveSymlinks, + DontUseCustomDirectoryIcons, + }; + + typedef QFlags Options; + void setOption(QFileSystemModel::Option option, bool on = true); + bool testOption(QFileSystemModel::Option option) const; + void setOptions(QFileSystemModel::Options options); + QFileSystemModel::Options options() const; + virtual QHash roleNames() const; +}; diff --git a/sip/QtGui/qfont.sip b/sip/QtGui/qfont.sip new file mode 100644 index 0000000..2c0eb37 --- /dev/null +++ b/sip/QtGui/qfont.sip @@ -0,0 +1,214 @@ +// qfont.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFont +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleHint + { + Helvetica, + SansSerif, + Times, + Serif, + Courier, + TypeWriter, + OldEnglish, + Decorative, + System, + AnyStyle, + Cursive, + Monospace, + Fantasy, + }; + + enum StyleStrategy /BaseType=Flag/ + { + PreferDefault, + PreferBitmap, + PreferDevice, + PreferOutline, + ForceOutline, + PreferMatch, + PreferQuality, + PreferAntialias, + NoAntialias, + NoSubpixelAntialias, + NoFontMerging, + PreferNoShaping, + }; + + enum Weight /BaseType=IntEnum/ + { + Thin, + ExtraLight, + Light, + Normal, + Medium, + DemiBold, + Bold, + ExtraBold, + Black, + }; + + enum Style + { + StyleNormal, + StyleItalic, + StyleOblique, + }; + + enum Stretch /BaseType=IntEnum/ + { + AnyStretch, + UltraCondensed, + ExtraCondensed, + Condensed, + SemiCondensed, + Unstretched, + SemiExpanded, + Expanded, + ExtraExpanded, + UltraExpanded, + }; + + QFont(); +%If (Qt_6_1_0 -) + QFont(const QStringList &families, int pointSize = -1, int weight = -1, bool italic = false); +%End + QFont(const QString &family, int pointSize = -1, int weight = -1, bool italic = false); + QFont(const QFont &); + QFont(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QFont(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + ~QFont(); + QString family() const; + void setFamily(const QString &); + int pointSize() const; + void setPointSize(int); + qreal pointSizeF() const; + void setPointSizeF(qreal); + int pixelSize() const; + void setPixelSize(int); + int weight() const [QFont::Weight ()]; + void setWeight(int weight); +%MethodCode + sipCpp->setWeight(QFont::Weight(a0)); +%End + + void setStyle(QFont::Style style); + QFont::Style style() const; + bool underline() const; + void setUnderline(bool); + bool overline() const; + void setOverline(bool); + bool strikeOut() const; + void setStrikeOut(bool); + bool fixedPitch() const; + void setFixedPitch(bool); + bool kerning() const; + void setKerning(bool); + QFont::StyleHint styleHint() const; + QFont::StyleStrategy styleStrategy() const; + void setStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault); + void setStyleStrategy(QFont::StyleStrategy s); + int stretch() const; + void setStretch(int); + bool exactMatch() const; + bool operator==(const QFont &) const; + bool operator!=(const QFont &) const; + bool operator<(const QFont &) const; + bool isCopyOf(const QFont &) const; + QString key() const; + QString toString() const; + bool fromString(const QString &); + static QString substitute(const QString &); + static QStringList substitutes(const QString &); + static QStringList substitutions(); + static void insertSubstitution(const QString &, const QString &); + static void insertSubstitutions(const QString &, const QStringList &); + static void removeSubstitutions(const QString &); + static void initialize(); + static void cleanup(); + static void cacheStatistics(); + QString defaultFamily() const; + QFont resolve(const QFont &) const; + bool bold() const; + void setBold(bool enable); + bool italic() const; + void setItalic(bool b); + + enum Capitalization + { + MixedCase, + AllUppercase, + AllLowercase, + SmallCaps, + Capitalize, + }; + + enum SpacingType + { + PercentageSpacing, + AbsoluteSpacing, + }; + + qreal letterSpacing() const; + QFont::SpacingType letterSpacingType() const; + void setLetterSpacing(QFont::SpacingType type, qreal spacing); + qreal wordSpacing() const; + void setWordSpacing(qreal spacing); + void setCapitalization(QFont::Capitalization); + QFont::Capitalization capitalization() const; + + enum HintingPreference + { + PreferDefaultHinting, + PreferNoHinting, + PreferVerticalHinting, + PreferFullHinting, + }; + + QString styleName() const; + void setStyleName(const QString &styleName); + void setHintingPreference(QFont::HintingPreference hintingPreference); + QFont::HintingPreference hintingPreference() const; + void swap(QFont &other /Constrained/); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + QStringList families() const; + void setFamilies(const QStringList &); +}; + +QDataStream &operator<<(QDataStream &, const QFont &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QFont & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qfontdatabase.sip b/sip/QtGui/qfontdatabase.sip new file mode 100644 index 0000000..891c574 --- /dev/null +++ b/sip/QtGui/qfontdatabase.sip @@ -0,0 +1,107 @@ +// qfontdatabase.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFontDatabase +{ +%TypeHeaderCode +#include +%End + +public: + enum WritingSystem + { + Any, + Latin, + Greek, + Cyrillic, + Armenian, + Hebrew, + Arabic, + Syriac, + Thaana, + Devanagari, + Bengali, + Gurmukhi, + Gujarati, + Oriya, + Tamil, + Telugu, + Kannada, + Malayalam, + Sinhala, + Thai, + Lao, + Tibetan, + Myanmar, + Georgian, + Khmer, + SimplifiedChinese, + TraditionalChinese, + Japanese, + Korean, + Vietnamese, + Other, + Symbol, + Ogham, + Runic, + Nko, + }; + + static QList standardSizes(); + static QList writingSystems(const QString &family); + static QList writingSystems(); + static QStringList families(QFontDatabase::WritingSystem writingSystem = QFontDatabase::Any); + static QStringList styles(const QString &family); + static QList pointSizes(const QString &family, const QString &style = QString()); + static QList smoothSizes(const QString &family, const QString &style); + static QString styleString(const QFontInfo &fontInfo); + static QString styleString(const QFont &font); + static QFont font(const QString &family, const QString &style, int pointSize); + static bool isBitmapScalable(const QString &family, const QString &style = QString()); + static bool isSmoothlyScalable(const QString &family, const QString &style = QString()); + static bool isScalable(const QString &family, const QString &style = QString()); + static bool isFixedPitch(const QString &family, const QString &style = QString()); + static bool italic(const QString &family, const QString &style); + static bool bold(const QString &family, const QString &style); + static int weight(const QString &family, const QString &style); + static QString writingSystemName(QFontDatabase::WritingSystem writingSystem); + static QString writingSystemSample(QFontDatabase::WritingSystem writingSystem); + static int addApplicationFont(const QString &fileName); + static int addApplicationFontFromData(const QByteArray &fontData); + static QStringList applicationFontFamilies(int id); + static bool removeApplicationFont(int id); + static bool removeAllApplicationFonts(); + + enum SystemFont + { + GeneralFont, + FixedFont, + TitleFont, + SmallestReadableFont, + }; + + static QFont systemFont(QFontDatabase::SystemFont type); + static bool isPrivateFamily(const QString &family); + +private: + QFontDatabase(); +}; diff --git a/sip/QtGui/qfontinfo.sip b/sip/QtGui/qfontinfo.sip new file mode 100644 index 0000000..82a6c63 --- /dev/null +++ b/sip/QtGui/qfontinfo.sip @@ -0,0 +1,46 @@ +// qfontinfo.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFontInfo +{ +%TypeHeaderCode +#include +%End + +public: + QFontInfo(const QFont &); + QFontInfo(const QFontInfo &); + ~QFontInfo(); + QString family() const; + int pixelSize() const; + int pointSize() const; + qreal pointSizeF() const; + bool italic() const; + QFont::Style style() const; + int weight() const; + bool bold() const; + bool fixedPitch() const; + QFont::StyleHint styleHint() const; + bool exactMatch() const; + QString styleName() const; + void swap(QFontInfo &other /Constrained/); +}; diff --git a/sip/QtGui/qfontmetrics.sip b/sip/QtGui/qfontmetrics.sip new file mode 100644 index 0000000..960c0fa --- /dev/null +++ b/sip/QtGui/qfontmetrics.sip @@ -0,0 +1,197 @@ +// qfontmetrics.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFontMetrics +{ +%TypeHeaderCode +#include +%End + +public: + explicit QFontMetrics(const QFont &); + QFontMetrics(const QFont &font, const QPaintDevice *pd); + QFontMetrics(const QFontMetrics &); + ~QFontMetrics(); + int ascent() const; + int descent() const; + int height() const; + int leading() const; + int lineSpacing() const; + int minLeftBearing() const; + int minRightBearing() const; + int maxWidth() const; + int xHeight() const; + bool inFont(QChar) const; + int leftBearing(QChar) const; + int rightBearing(QChar) const; +%If (Qt_6_3_0 -) + QRect boundingRect(const QString &text, const QTextOption &textOption) const; +%End + QRect boundingRect(QChar) const /PyName=boundingRectChar/; + QRect boundingRect(const QString &text) const; + QRect boundingRect(const QRect &rect, int flags, const QString &text, int tabStops = 0, SIP_PYLIST tabArray /AllowNone,TypeHint="Optional[List[int]]"/ = 0) const; +%MethodCode + int *tabarray = qtgui_tabarray(a4); + + sipRes = new QRect(sipCpp->boundingRect(*a0, a1, *a2, a3, tabarray)); + + if (!tabarray) + delete[] tabarray; +%End + + QRect boundingRect(int x, int y, int width, int height, int flags, const QString &text, int tabStops = 0, SIP_PYLIST tabArray /AllowNone,TypeHint="Optional[List[int]]"/ = 0) const; +%MethodCode + int *tabarray = qtgui_tabarray(a7); + + sipRes = new QRect(sipCpp->boundingRect(a0, a1, a2, a3, a4, *a5, a6, tabarray)); + + if (!tabarray) + delete[] tabarray; +%End + + QSize size(int flags, const QString &text, int tabStops = 0, SIP_PYLIST tabArray /AllowNone,TypeHint="Optional[List[int]]"/ = 0) const; +%MethodCode + int *tabarray = qtgui_tabarray(a3); + + sipRes = new QSize(sipCpp->size(a0, *a1, a2, tabarray)); + + if (!tabarray) + delete[] tabarray; +%End + + int underlinePos() const; + int overlinePos() const; + int strikeOutPos() const; + int lineWidth() const; + int averageCharWidth() const; + QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags = 0) const; + bool operator==(const QFontMetrics &other) const; + bool operator!=(const QFontMetrics &other) const; +%If (Qt_6_3_0 -) + QRect tightBoundingRect(const QString &text, const QTextOption &textOption) const; +%End + QRect tightBoundingRect(const QString &text) const; + bool inFontUcs4(uint character) const; + void swap(QFontMetrics &other /Constrained/); + int capHeight() const; +%If (Qt_6_3_0 -) + int horizontalAdvance(const QString &, const QTextOption &textOption) const; +%End + int horizontalAdvance(const QString &, int length = -1) const; + qreal fontDpi() const; +}; + +class QFontMetricsF +{ +%TypeHeaderCode +#include +%End + +public: + explicit QFontMetricsF(const QFont &); + QFontMetricsF(const QFont &font, const QPaintDevice *pd); + QFontMetricsF(const QFontMetrics &); + QFontMetricsF(const QFontMetricsF &); + ~QFontMetricsF(); + qreal ascent() const; + qreal descent() const; + qreal height() const; + qreal leading() const; + qreal lineSpacing() const; + qreal minLeftBearing() const; + qreal minRightBearing() const; + qreal maxWidth() const; + qreal xHeight() const; + bool inFont(QChar) const; + qreal leftBearing(QChar) const; + qreal rightBearing(QChar) const; +%If (Qt_6_3_0 -) + QRectF boundingRect(const QString &text, const QTextOption &textOption) const; +%End + QRectF boundingRect(QChar) const /PyName=boundingRectChar/; + QRectF boundingRect(const QString &string) const; + QRectF boundingRect(const QRectF &rect, int flags, const QString &text, int tabStops = 0, SIP_PYLIST tabArray /AllowNone,TypeHint="Optional[List[int]]"/ = 0) const; +%MethodCode + int *tabarray = qtgui_tabarray(a4); + + sipRes = new QRectF(sipCpp->boundingRect(*a0, a1, *a2, a3, tabarray)); + + if (!tabarray) + delete[] tabarray; +%End + + QSizeF size(int flags, const QString &text, int tabStops = 0, SIP_PYLIST tabArray /AllowNone,TypeHint="Optional[List[int]]"/ = 0) const; +%MethodCode + int *tabarray = qtgui_tabarray(a3); + + sipRes = new QSizeF(sipCpp->size(a0, *a1, a2, tabarray)); + + if (!tabarray) + delete[] tabarray; +%End + + qreal underlinePos() const; + qreal overlinePos() const; + qreal strikeOutPos() const; + qreal lineWidth() const; + qreal averageCharWidth() const; + QString elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags = 0) const; + bool operator==(const QFontMetricsF &other) const; + bool operator!=(const QFontMetricsF &other) const; +%If (Qt_6_3_0 -) + QRectF tightBoundingRect(const QString &text, const QTextOption &textOption) const; +%End + QRectF tightBoundingRect(const QString &text) const; + bool inFontUcs4(uint character) const; + void swap(QFontMetricsF &other /Constrained/); + qreal capHeight() const; +%If (Qt_6_3_0 -) + qreal horizontalAdvance(const QString &string, const QTextOption &textOption) const; +%End + qreal horizontalAdvance(const QString &string, int length = -1) const; + qreal fontDpi() const; +}; + +%ModuleHeaderCode +// Used by QFontMetrics and QFontMetricsF. +int *qtgui_tabarray(PyObject *l); +%End + +%ModuleCode +// Convert an optional Python list to a 0 terminated array of integers on the +// heap. +int *qtgui_tabarray(PyObject *l) +{ + if (!l || l == Py_None) + return 0; + + int *arr = new int[PyList_Size(l) + 1]; + Py_ssize_t i; + + for (i = 0; i < PyList_Size(l); ++i) + arr[i] = PyLong_AsLong(PyList_GetItem(l, i)); + + arr[i] = 0; + + return arr; +} +%End diff --git a/sip/QtGui/qgenericmatrix.sip b/sip/QtGui/qgenericmatrix.sip new file mode 100644 index 0000000..74e44e3 --- /dev/null +++ b/sip/QtGui/qgenericmatrix.sip @@ -0,0 +1,942 @@ +// qgenericmatrix.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +// The implementation of QMatrix4x3. +class QMatrix4x3 +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PYQT_FLOAT data[12]; + + // We want the data in row-major order. + sipCpp->copyDataTo(data); + + sipRes = Py_BuildValue("dddddddddddd", + (double)data[0], (double)data[1], (double)data[2], + (double)data[3], (double)data[4], (double)data[5], + (double)data[6], (double)data[7], (double)data[8], + (double)data[9], (double)data[10], (double)data[11]); +%End + +public: + QMatrix4x3(); + QMatrix4x3(const QMatrix4x3 &other); + explicit QMatrix4x3(SIP_PYOBJECT values /TypeHint="Sequence[float]"/); +%MethodCode + PYQT_FLOAT values[12]; + + if ((sipError = qtgui_matrixDataFromSequence(a0, 12, values)) == sipErrorNone) + sipCpp = new QMatrix4x3(values); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + bool bad = false; + int i; + PyObject *m[12]; + PYQT_FLOAT data[12]; + + // The raw data is in column-major order but we want row-major order. + sipCpp->copyDataTo(data); + + for (i = 0; i < 12; ++i) + { + m[i] = PyFloat_FromDouble(data[i]); + + if (!m[i]) + bad = true; + } + + if (!bad) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix4x3(" + "%R, %R, %R, " + "%R, %R, %R, " + "%R, %R, %R, " + "%R, %R, %R)", + m[0], m[1], m[2], + m[3], m[4], m[5], + m[6], m[7], m[8], + m[9], m[10], m[11]); + } + + for (i = 0; i < 12; ++i) + Py_XDECREF(m[i]); +%End + + SIP_PYLIST data() /TypeHint="List[float]"/; +%MethodCode + sipError = qtgui_matrixDataAsList(12, sipCpp->constData(), &sipRes); +%End + + SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/; +%MethodCode + PYQT_FLOAT values[12]; + + sipCpp->copyDataTo(values); + sipError = qtgui_matrixDataAsList(12, values, &sipRes); +%End + + SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const; +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 4, 3, &row, &column)) == sipErrorNone) + { + sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column)); + + if (!sipRes) + sipError = sipErrorFail; + } +%End + + void __setitem__(SIP_PYOBJECT, float); +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 4, 3, &row, &column)) == sipErrorNone) + sipCpp->operator()(row, column) = a1; +%End + + bool isIdentity() const; + void setToIdentity(); + + void fill(float value); + + QMatrix3x4 transposed() const; + + QMatrix4x3 &operator+=(const QMatrix4x3 &); + QMatrix4x3 &operator-=(const QMatrix4x3 &); + QMatrix4x3 &operator*=(float); + QMatrix4x3 &operator/=(float); + + bool operator==(const QMatrix4x3 &) const; + bool operator!=(const QMatrix4x3 &) const; +}; + +QDataStream &operator<<(QDataStream &, const QMatrix4x3 &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMatrix4x3 & /Constrained/) /ReleaseGIL/; +// The implementation of QMatrix4x2. +class QMatrix4x2 +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PYQT_FLOAT data[8]; + + // We want the data in row-major order. + sipCpp->copyDataTo(data); + + sipRes = Py_BuildValue("dddddddd", + (double)data[0], (double)data[1], + (double)data[2], (double)data[3], + (double)data[4], (double)data[5], + (double)data[6], (double)data[7]); +%End + +public: + QMatrix4x2(); + QMatrix4x2(const QMatrix4x2 &other); + explicit QMatrix4x2(SIP_PYOBJECT values /TypeHint="Sequence[float]"/); +%MethodCode + PYQT_FLOAT values[8]; + + if ((sipError = qtgui_matrixDataFromSequence(a0, 8, values)) == sipErrorNone) + sipCpp = new QMatrix4x2(values); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + bool bad = false; + int i; + PyObject *m[8]; + PYQT_FLOAT data[8]; + + // The raw data is in column-major order but we want row-major order. + sipCpp->copyDataTo(data); + + for (i = 0; i < 8; ++i) + { + m[i] = PyFloat_FromDouble(data[i]); + + if (!m[i]) + bad = true; + } + + if (!bad) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix4x2(" + "%R, %R, " + "%R, %R, " + "%R, %R, " + "%R, %R)", + m[0], m[1], + m[2], m[3], + m[4], m[5], + m[6], m[7]); + } + + for (i = 0; i < 8; ++i) + Py_XDECREF(m[i]); +%End + + SIP_PYLIST data() /TypeHint="List[float]"/; +%MethodCode + sipError = qtgui_matrixDataAsList(8, sipCpp->constData(), &sipRes); +%End + + SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/; +%MethodCode + PYQT_FLOAT values[8]; + + sipCpp->copyDataTo(values); + sipError = qtgui_matrixDataAsList(8, values, &sipRes); +%End + + SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const; +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 4, 2, &row, &column)) == sipErrorNone) + { + sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column)); + + if (!sipRes) + sipError = sipErrorFail; + } +%End + + void __setitem__(SIP_PYOBJECT, float); +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 4, 2, &row, &column)) == sipErrorNone) + sipCpp->operator()(row, column) = a1; +%End + + bool isIdentity() const; + void setToIdentity(); + + void fill(float value); + + QMatrix2x4 transposed() const; + + QMatrix4x2 &operator+=(const QMatrix4x2 &); + QMatrix4x2 &operator-=(const QMatrix4x2 &); + QMatrix4x2 &operator*=(float); + QMatrix4x2 &operator/=(float); + + bool operator==(const QMatrix4x2 &) const; + bool operator!=(const QMatrix4x2 &) const; +}; + +QDataStream &operator<<(QDataStream &, const QMatrix4x2 &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMatrix4x2 & /Constrained/) /ReleaseGIL/; +// The implementation of QMatrix3x4. +class QMatrix3x4 +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PYQT_FLOAT data[12]; + + // We want the data in row-major order. + sipCpp->copyDataTo(data); + + sipRes = Py_BuildValue("dddddddddddd", + (double)data[0], (double)data[1], (double)data[2], + (double)data[3], (double)data[4], (double)data[5], + (double)data[6], (double)data[7], (double)data[8], + (double)data[9], (double)data[10], (double)data[11]); +%End + +public: + QMatrix3x4(); + QMatrix3x4(const QMatrix3x4 &other); + explicit QMatrix3x4(SIP_PYOBJECT values /TypeHint="Sequence[float]"/); +%MethodCode + PYQT_FLOAT values[12]; + + if ((sipError = qtgui_matrixDataFromSequence(a0, 12, values)) == sipErrorNone) + sipCpp = new QMatrix3x4(values); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + bool bad = false; + int i; + PyObject *m[12]; + PYQT_FLOAT data[12]; + + // The raw data is in column-major order but we want row-major order. + sipCpp->copyDataTo(data); + + for (i = 0; i < 12; ++i) + { + m[i] = PyFloat_FromDouble(data[i]); + + if (!m[i]) + bad = true; + } + + if (!bad) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix3x4(" + "%R, %R, %R, " + "%R, %R, %R, " + "%R, %R, %R, " + "%R, %R, %R)", + m[0], m[1], m[2], + m[3], m[4], m[5], + m[6], m[7], m[8], + m[9], m[10], m[11]); + } + + for (i = 0; i < 12; ++i) + Py_XDECREF(m[i]); +%End + + SIP_PYLIST data() /TypeHint="List[float]"/; +%MethodCode + sipError = qtgui_matrixDataAsList(12, sipCpp->constData(), &sipRes); +%End + + SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/; +%MethodCode + PYQT_FLOAT values[12]; + + sipCpp->copyDataTo(values); + sipError = qtgui_matrixDataAsList(12, values, &sipRes); +%End + + SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const; +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 3, 4, &row, &column)) == sipErrorNone) + { + sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column)); + + if (!sipRes) + sipError = sipErrorFail; + } +%End + + void __setitem__(SIP_PYOBJECT, float); +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 3, 4, &row, &column)) == sipErrorNone) + sipCpp->operator()(row, column) = a1; +%End + + bool isIdentity() const; + void setToIdentity(); + + void fill(float value); + + QMatrix4x3 transposed() const; + + QMatrix3x4 &operator+=(const QMatrix3x4 &); + QMatrix3x4 &operator-=(const QMatrix3x4 &); + QMatrix3x4 &operator*=(float); + QMatrix3x4 &operator/=(float); + + bool operator==(const QMatrix3x4 &) const; + bool operator!=(const QMatrix3x4 &) const; +}; + +QDataStream &operator<<(QDataStream &, const QMatrix3x4 &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMatrix3x4 & /Constrained/) /ReleaseGIL/; +// The implementation of QMatrix3x3. +class QMatrix3x3 +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PYQT_FLOAT data[9]; + + // We want the data in row-major order. + sipCpp->copyDataTo(data); + + sipRes = Py_BuildValue("ddddddddd", + (double)data[0], (double)data[1], (double)data[2], + (double)data[3], (double)data[4], (double)data[5], + (double)data[6], (double)data[7], (double)data[8]); +%End + +public: + QMatrix3x3(); + QMatrix3x3(const QMatrix3x3 &other); + explicit QMatrix3x3(SIP_PYOBJECT values /TypeHint="Sequence[float]"/); +%MethodCode + PYQT_FLOAT values[9]; + + if ((sipError = qtgui_matrixDataFromSequence(a0, 9, values)) == sipErrorNone) + sipCpp = new QMatrix3x3(values); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + bool bad = false; + int i; + PyObject *m[9]; + PYQT_FLOAT data[9]; + + // The raw data is in column-major order but we want row-major order. + sipCpp->copyDataTo(data); + + for (i = 0; i < 9; ++i) + { + m[i] = PyFloat_FromDouble(data[i]); + + if (!m[i]) + bad = true; + } + + if (!bad) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix3x3(" + "%R, %R, %R, " + "%R, %R, %R, " + "%R, %R, %R)", + m[0], m[1], m[2], + m[3], m[4], m[5], + m[6], m[7], m[8]); + } + + for (i = 0; i < 9; ++i) + Py_XDECREF(m[i]); +%End + + SIP_PYLIST data() /TypeHint="List[float]"/; +%MethodCode + sipError = qtgui_matrixDataAsList(9, sipCpp->constData(), &sipRes); +%End + + SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/; +%MethodCode + PYQT_FLOAT values[9]; + + sipCpp->copyDataTo(values); + sipError = qtgui_matrixDataAsList(9, values, &sipRes); +%End + + SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const; +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 3, 3, &row, &column)) == sipErrorNone) + { + sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column)); + + if (!sipRes) + sipError = sipErrorFail; + } +%End + + void __setitem__(SIP_PYOBJECT, float); +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 3, 3, &row, &column)) == sipErrorNone) + sipCpp->operator()(row, column) = a1; +%End + + bool isIdentity() const; + void setToIdentity(); + + void fill(float value); + + QMatrix3x3 transposed() const; + + QMatrix3x3 &operator+=(const QMatrix3x3 &); + QMatrix3x3 &operator-=(const QMatrix3x3 &); + QMatrix3x3 &operator*=(float); + QMatrix3x3 &operator/=(float); + + bool operator==(const QMatrix3x3 &) const; + bool operator!=(const QMatrix3x3 &) const; +}; + +QDataStream &operator<<(QDataStream &, const QMatrix3x3 &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMatrix3x3 & /Constrained/) /ReleaseGIL/; +// The implementation of QMatrix3x2. +class QMatrix3x2 +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PYQT_FLOAT data[6]; + + // We want the data in row-major order. + sipCpp->copyDataTo(data); + + sipRes = Py_BuildValue("dddddd", + (double)data[0], (double)data[1], + (double)data[2], (double)data[3], + (double)data[4], (double)data[5]); +%End + +public: + QMatrix3x2(); + QMatrix3x2(const QMatrix3x2 &other); + explicit QMatrix3x2(SIP_PYOBJECT values /TypeHint="Sequence[float]"/); +%MethodCode + PYQT_FLOAT values[6]; + + if ((sipError = qtgui_matrixDataFromSequence(a0, 6, values)) == sipErrorNone) + sipCpp = new QMatrix3x2(values); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + bool bad = false; + int i; + PyObject *m[6]; + PYQT_FLOAT data[6]; + + // The raw data is in column-major order but we want row-major order. + sipCpp->copyDataTo(data); + + for (i = 0; i < 6; ++i) + { + m[i] = PyFloat_FromDouble(data[i]); + + if (!m[i]) + bad = true; + } + + if (!bad) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix3x2(" + "%R, %R, " + "%R, %R, " + "%R, %R)", + m[0], m[1], + m[2], m[3], + m[4], m[5]); + } + + for (i = 0; i < 6; ++i) + Py_XDECREF(m[i]); +%End + + SIP_PYLIST data() /TypeHint="List[float]"/; +%MethodCode + sipError = qtgui_matrixDataAsList(6, sipCpp->constData(), &sipRes); +%End + + SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/; +%MethodCode + PYQT_FLOAT values[6]; + + sipCpp->copyDataTo(values); + sipError = qtgui_matrixDataAsList(6, values, &sipRes); +%End + + SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const; +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 3, 2, &row, &column)) == sipErrorNone) + { + sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column)); + + if (!sipRes) + sipError = sipErrorFail; + } +%End + + void __setitem__(SIP_PYOBJECT, float); +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 3, 2, &row, &column)) == sipErrorNone) + sipCpp->operator()(row, column) = a1; +%End + + bool isIdentity() const; + void setToIdentity(); + + void fill(float value); + + QMatrix2x3 transposed() const; + + QMatrix3x2 &operator+=(const QMatrix3x2 &); + QMatrix3x2 &operator-=(const QMatrix3x2 &); + QMatrix3x2 &operator*=(float); + QMatrix3x2 &operator/=(float); + + bool operator==(const QMatrix3x2 &) const; + bool operator!=(const QMatrix3x2 &) const; +}; + +QDataStream &operator<<(QDataStream &, const QMatrix3x2 &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMatrix3x2 & /Constrained/) /ReleaseGIL/; +// The implementation of QMatrix2x4. +class QMatrix2x4 +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PYQT_FLOAT data[8]; + + // We want the data in row-major order. + sipCpp->copyDataTo(data); + + sipRes = Py_BuildValue("dddddddd", + (double)data[0], (double)data[1], (double)data[2], (double)data[3], + (double)data[4], (double)data[5], (double)data[6], (double)data[7]); +%End + +public: + QMatrix2x4(); + QMatrix2x4(const QMatrix2x4 &other); + explicit QMatrix2x4(SIP_PYOBJECT values /TypeHint="Sequence[float]"/); +%MethodCode + PYQT_FLOAT values[8]; + + if ((sipError = qtgui_matrixDataFromSequence(a0, 8, values)) == sipErrorNone) + sipCpp = new QMatrix2x4(values); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + bool bad = false; + int i; + PyObject *m[8]; + PYQT_FLOAT data[8]; + + // The raw data is in column-major order but we want row-major order. + sipCpp->copyDataTo(data); + + for (i = 0; i < 8; ++i) + { + m[i] = PyFloat_FromDouble(data[i]); + + if (!m[i]) + bad = true; + } + + if (!bad) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix2x4(" + "%R, %R, %R, %R, " + "%R, %R, %R, %R)", + m[0], m[1], m[2], m[3], + m[4], m[5], m[6], m[7]); + } + + for (i = 0; i < 8; ++i) + Py_XDECREF(m[i]); +%End + + SIP_PYLIST data() /TypeHint="List[float]"/; +%MethodCode + sipError = qtgui_matrixDataAsList(8, sipCpp->constData(), &sipRes); +%End + + SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/; +%MethodCode + PYQT_FLOAT values[8]; + + sipCpp->copyDataTo(values); + sipError = qtgui_matrixDataAsList(8, values, &sipRes); +%End + + SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const; +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 2, 4, &row, &column)) == sipErrorNone) + { + sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column)); + + if (!sipRes) + sipError = sipErrorFail; + } +%End + + void __setitem__(SIP_PYOBJECT, float); +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 2, 4, &row, &column)) == sipErrorNone) + sipCpp->operator()(row, column) = a1; +%End + + bool isIdentity() const; + void setToIdentity(); + + void fill(float value); + + QMatrix4x2 transposed() const; + + QMatrix2x4 &operator+=(const QMatrix2x4 &); + QMatrix2x4 &operator-=(const QMatrix2x4 &); + QMatrix2x4 &operator*=(float); + QMatrix2x4 &operator/=(float); + + bool operator==(const QMatrix2x4 &) const; + bool operator!=(const QMatrix2x4 &) const; +}; + +QDataStream &operator<<(QDataStream &, const QMatrix2x4 &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMatrix2x4 & /Constrained/) /ReleaseGIL/; +// The implementation of QMatrix2x3. +class QMatrix2x3 +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PYQT_FLOAT data[6]; + + // We want the data in row-major order. + sipCpp->copyDataTo(data); + + sipRes = Py_BuildValue("dddddd", + (double)data[0], (double)data[1], (double)data[2], + (double)data[3], (double)data[4], (double)data[5]); +%End + +public: + QMatrix2x3(); + QMatrix2x3(const QMatrix2x3 &other); + explicit QMatrix2x3(SIP_PYOBJECT values /TypeHint="Sequence[float]"/); +%MethodCode + PYQT_FLOAT values[6]; + + if ((sipError = qtgui_matrixDataFromSequence(a0, 6, values)) == sipErrorNone) + sipCpp = new QMatrix2x3(values); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + bool bad = false; + int i; + PyObject *m[6]; + PYQT_FLOAT data[6]; + + // The raw data is in column-major order but we want row-major order. + sipCpp->copyDataTo(data); + + for (i = 0; i < 6; ++i) + { + m[i] = PyFloat_FromDouble(data[i]); + + if (!m[i]) + bad = true; + } + + if (!bad) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix2x3(" + "%R, %R, %R, " + "%R, %R, %R)", + m[0], m[1], m[2], + m[3], m[4], m[5]); + } + + for (i = 0; i < 6; ++i) + Py_XDECREF(m[i]); +%End + + SIP_PYLIST data() /TypeHint="List[float]"/; +%MethodCode + sipError = qtgui_matrixDataAsList(6, sipCpp->constData(), &sipRes); +%End + + SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/; +%MethodCode + PYQT_FLOAT values[6]; + + sipCpp->copyDataTo(values); + sipError = qtgui_matrixDataAsList(6, values, &sipRes); +%End + + SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const; +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 2, 3, &row, &column)) == sipErrorNone) + { + sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column)); + + if (!sipRes) + sipError = sipErrorFail; + } +%End + + void __setitem__(SIP_PYOBJECT, float); +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 2, 3, &row, &column)) == sipErrorNone) + sipCpp->operator()(row, column) = a1; +%End + + bool isIdentity() const; + void setToIdentity(); + + void fill(float value); + + QMatrix3x2 transposed() const; + + QMatrix2x3 &operator+=(const QMatrix2x3 &); + QMatrix2x3 &operator-=(const QMatrix2x3 &); + QMatrix2x3 &operator*=(float); + QMatrix2x3 &operator/=(float); + + bool operator==(const QMatrix2x3 &) const; + bool operator!=(const QMatrix2x3 &) const; +}; + +QDataStream &operator<<(QDataStream &, const QMatrix2x3 &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMatrix2x3 & /Constrained/) /ReleaseGIL/; +// The implementation of QMatrix2x2. +class QMatrix2x2 +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PYQT_FLOAT data[4]; + + // We want the data in row-major order. + sipCpp->copyDataTo(data); + + sipRes = Py_BuildValue("dddd", + (double)data[0], (double)data[1], + (double)data[2], (double)data[3]); +%End + +public: + QMatrix2x2(); + QMatrix2x2(const QMatrix2x2 &other); + explicit QMatrix2x2(SIP_PYOBJECT values /TypeHint="Sequence[float]"/); +%MethodCode + PYQT_FLOAT values[4]; + + if ((sipError = qtgui_matrixDataFromSequence(a0, 4, values)) == sipErrorNone) + sipCpp = new QMatrix2x2(values); +%End + + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + bool bad = false; + int i; + PyObject *m[4]; + PYQT_FLOAT data[4]; + + // The raw data is in column-major order but we want row-major order. + sipCpp->copyDataTo(data); + + for (i = 0; i < 4; ++i) + { + m[i] = PyFloat_FromDouble(data[i]); + + if (!m[i]) + bad = true; + } + + if (!bad) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix2x2(" + "%R, %R, " + "%R, %R)", + m[0], m[1], + m[2], m[3]); + } + + for (i = 0; i < 4; ++i) + Py_XDECREF(m[i]); +%End + + SIP_PYLIST data() /TypeHint="List[float]"/; +%MethodCode + sipError = qtgui_matrixDataAsList(4, sipCpp->constData(), &sipRes); +%End + + SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/; +%MethodCode + PYQT_FLOAT values[4]; + + sipCpp->copyDataTo(values); + sipError = qtgui_matrixDataAsList(4, values, &sipRes); +%End + + SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const; +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 2, 2, &row, &column)) == sipErrorNone) + { + sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column)); + + if (!sipRes) + sipError = sipErrorFail; + } +%End + + void __setitem__(SIP_PYOBJECT, float); +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 2, 2, &row, &column)) == sipErrorNone) + sipCpp->operator()(row, column) = a1; +%End + + bool isIdentity() const; + void setToIdentity(); + + void fill(float value); + + QMatrix2x2 transposed() const; + + QMatrix2x2 &operator+=(const QMatrix2x2 &); + QMatrix2x2 &operator-=(const QMatrix2x2 &); + QMatrix2x2 &operator*=(float); + QMatrix2x2 &operator/=(float); + + bool operator==(const QMatrix2x2 &) const; + bool operator!=(const QMatrix2x2 &) const; +}; + +QDataStream &operator<<(QDataStream &, const QMatrix2x2 &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMatrix2x2 & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qglyphrun.sip b/sip/QtGui/qglyphrun.sip new file mode 100644 index 0000000..420b903 --- /dev/null +++ b/sip/QtGui/qglyphrun.sip @@ -0,0 +1,84 @@ +// qglyphrun.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_RawFont) + +class QGlyphRun +{ +%TypeHeaderCode +#include +%End + +public: + QGlyphRun(); + QGlyphRun(const QGlyphRun &other); + ~QGlyphRun(); + QRawFont rawFont() const; + void setRawFont(const QRawFont &rawFont); + QList glyphIndexes() const; + void setGlyphIndexes(const QList &glyphIndexes); + QList positions() const; + void setPositions(const QList &positions); + void clear(); + bool operator==(const QGlyphRun &other) const; + bool operator!=(const QGlyphRun &other) const; + void setOverline(bool overline); + bool overline() const; + void setUnderline(bool underline); + bool underline() const; + void setStrikeOut(bool strikeOut); + bool strikeOut() const; + + enum GlyphRunFlag /BaseType=Flag/ + { + Overline, + Underline, + StrikeOut, + RightToLeft, + SplitLigature, + }; + + typedef QFlags GlyphRunFlags; + void setRightToLeft(bool on); + bool isRightToLeft() const; + void setFlag(QGlyphRun::GlyphRunFlag flag, bool enabled = true); + void setFlags(QGlyphRun::GlyphRunFlags flags); + QGlyphRun::GlyphRunFlags flags() const; + void setBoundingRect(const QRectF &boundingRect); + QRectF boundingRect() const; + bool isEmpty() const; + void swap(QGlyphRun &other /Constrained/); +%If (Qt_6_5_0 -) + QList stringIndexes() const; +%End +%If (Qt_6_5_0 -) + void setStringIndexes(const QList &stringIndexes); +%End +%If (Qt_6_5_0 -) + void setSourceString(const QString &sourceString); +%End +%If (Qt_6_5_0 -) + QString sourceString() const; +%End +}; + +%End diff --git a/sip/QtGui/qguiapplication.sip b/sip/QtGui/qguiapplication.sip new file mode 100644 index 0000000..3721877 --- /dev/null +++ b/sip/QtGui/qguiapplication.sip @@ -0,0 +1,261 @@ +// qguiapplication.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGuiApplication : QCoreApplication +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QAbstractTextDocumentLayout, &sipType_QAbstractTextDocumentLayout, -1, 1}, + {sipName_QAction, &sipType_QAction, -1, 2}, + {sipName_QActionGroup, &sipType_QActionGroup, -1, 3}, + {sipName_QClipboard, &sipType_QClipboard, -1, 4}, + {sipName_QValidator, &sipType_QValidator, 26, 5}, + {sipName_QDrag, &sipType_QDrag, -1, 6}, + {sipName_QFileSystemModel, &sipType_QFileSystemModel, -1, 7}, + {sipName_QGuiApplication, &sipType_QGuiApplication, -1, 8}, + {sipName_QInputDevice, &sipType_QInputDevice, 29, 9}, + {sipName_QInputMethod, &sipType_QInputMethod, -1, 10}, + {sipName_QMovie, &sipType_QMovie, -1, 11}, + {sipName_QOffscreenSurface, &sipType_QOffscreenSurface, -1, 12}, + #if defined(SIP_FEATURE_PyQt_OpenGL) + {sipName_QOpenGLContext, &sipType_QOpenGLContext, -1, 13}, + #else + {0, 0, -1, 13}, + #endif + #if defined(SIP_FEATURE_PyQt_OpenGL) + {sipName_QOpenGLContextGroup, &sipType_QOpenGLContextGroup, -1, 14}, + #else + {0, 0, -1, 14}, + #endif + {sipName_QWindow, &sipType_QWindow, 30, 15}, + {sipName_QPdfWriter, &sipType_QPdfWriter, -1, 16}, + {sipName_QScreen, &sipType_QScreen, -1, 17}, + #if defined(SIP_FEATURE_PyQt_SessionManager) + {sipName_QSessionManager, &sipType_QSessionManager, -1, 18}, + #else + {0, 0, -1, 18}, + #endif + {sipName_QShortcut, &sipType_QShortcut, -1, 19}, + {sipName_QStandardItemModel, &sipType_QStandardItemModel, -1, 20}, + {sipName_QStyleHints, &sipType_QStyleHints, -1, 21}, + {sipName_QSyntaxHighlighter, &sipType_QSyntaxHighlighter, -1, 22}, + {sipName_QTextObject, &sipType_QTextObject, 32, 23}, + {sipName_QTextDocument, &sipType_QTextDocument, -1, 24}, + {sipName_QUndoGroup, &sipType_QUndoGroup, -1, 25}, + {sipName_QUndoStack, &sipType_QUndoStack, -1, -1}, + {sipName_QDoubleValidator, &sipType_QDoubleValidator, -1, 27}, + {sipName_QIntValidator, &sipType_QIntValidator, -1, 28}, + {sipName_QRegularExpressionValidator, &sipType_QRegularExpressionValidator, -1, -1}, + {sipName_QPointingDevice, &sipType_QPointingDevice, -1, -1}, + {sipName_QPaintDeviceWindow, &sipType_QPaintDeviceWindow, 31, -1}, + {sipName_QRasterWindow, &sipType_QRasterWindow, -1, -1}, + {sipName_QTextBlockGroup, &sipType_QTextBlockGroup, 34, 33}, + {sipName_QTextFrame, &sipType_QTextFrame, 35, -1}, + {sipName_QTextList, &sipType_QTextList, -1, -1}, + {sipName_QTextTable, &sipType_QTextTable, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + QGuiApplication(SIP_PYLIST argv /TypeHint="List[str]"/) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, int = QCoreApplication::ApplicationFlags)]; +%MethodCode + // The Python interface is a list of argument strings that is modified. + + int argc; + char **argv; + + // Convert the list. + if ((argv = pyqt6_qtgui_from_argv_list(a0, argc)) == NULL) + sipIsErr = 1; + else + { + // Create it now the arguments are right. + static int nargc; + nargc = argc; + + Py_BEGIN_ALLOW_THREADS + sipCpp = new sipQGuiApplication(nargc, argv, QT_VERSION); + Py_END_ALLOW_THREADS + + // Now modify the original list. + pyqt6_qtgui_update_argv_list(a0, argc, argv); + } +%End + + virtual ~QGuiApplication() /ReleaseGIL/; +%MethodCode + pyqt6_qtgui_cleanup_qobjects(); +%End + + static QWindowList allWindows(); + static QWindowList topLevelWindows(); + static QWindow *topLevelAt(const QPoint &pos); + static QString platformName(); + static QWindow *focusWindow(); + static QObject *focusObject(); + static QScreen *primaryScreen(); + static QList screens(); + static QCursor *overrideCursor(); + static void setOverrideCursor(const QCursor &); + static void changeOverrideCursor(const QCursor &); + static void restoreOverrideCursor(); + static QFont font(); + static void setFont(const QFont &); + static QClipboard *clipboard(); + static QPalette palette(); + static void setPalette(const QPalette &pal); + static Qt::KeyboardModifiers keyboardModifiers(); + static Qt::KeyboardModifiers queryKeyboardModifiers(); + static Qt::MouseButtons mouseButtons(); + static void setLayoutDirection(Qt::LayoutDirection direction); + static Qt::LayoutDirection layoutDirection(); + static bool isRightToLeft(); + static bool isLeftToRight(); + static void setDesktopSettingsAware(bool on); + static bool desktopSettingsAware(); + static void setQuitOnLastWindowClosed(bool quit); + static bool quitOnLastWindowClosed(); + static int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; + virtual bool notify(QObject *, QEvent *); + +signals: + void fontDatabaseChanged(); + void screenAdded(QScreen *screen); + void lastWindowClosed(); + void focusObjectChanged(QObject *focusObject); +%If (PyQt_SessionManager) + void commitDataRequest(QSessionManager &sessionManager); +%End +%If (PyQt_SessionManager) + void saveStateRequest(QSessionManager &sessionManager); +%End + void focusWindowChanged(QWindow *focusWindow); + void applicationStateChanged(Qt::ApplicationState state); + void applicationDisplayNameChanged(); + +public: + static void setApplicationDisplayName(const QString &name); + static QString applicationDisplayName(); + static QWindow *modalWindow(); + static QStyleHints *styleHints(); + static QInputMethod *inputMethod(); + qreal devicePixelRatio() const; +%If (PyQt_SessionManager) + bool isSessionRestored() const; +%End +%If (PyQt_SessionManager) + QString sessionId() const; +%End +%If (PyQt_SessionManager) + QString sessionKey() const; +%End +%If (PyQt_SessionManager) + bool isSavingSession() const; +%End + static Qt::ApplicationState applicationState(); + static void sync(); + static void setWindowIcon(const QIcon &icon); + static QIcon windowIcon(); + +signals: + void screenRemoved(QScreen *screen); + void layoutDirectionChanged(Qt::LayoutDirection direction); + void primaryScreenChanged(QScreen *screen); + +public: + static void setDesktopFileName(const QString &name); + static QString desktopFileName(); + static QScreen *screenAt(const QPoint &point); + static void setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy policy); + static Qt::HighDpiScaleFactorRoundingPolicy highDpiScaleFactorRoundingPolicy(); +%If (Qt_6_5_0 -) + void setBadgeNumber(qint64 number); +%End + +protected: + virtual bool event(QEvent *); +}; + +%ModuleHeaderCode +// Imports from QtCore. +typedef void (*pyqt6_qtgui_cleanup_qobjects_t)(); +extern pyqt6_qtgui_cleanup_qobjects_t pyqt6_qtgui_cleanup_qobjects; + +typedef char **(*pyqt6_qtgui_from_argv_list_t)(PyObject *, int &); +extern pyqt6_qtgui_from_argv_list_t pyqt6_qtgui_from_argv_list; + +typedef void (*pyqt6_qtgui_update_argv_list_t)(PyObject *, int, char **); +extern pyqt6_qtgui_update_argv_list_t pyqt6_qtgui_update_argv_list; +%End + +%ModuleCode +// Imports from QtCore. +pyqt6_qtgui_cleanup_qobjects_t pyqt6_qtgui_cleanup_qobjects; +pyqt6_qtgui_from_argv_list_t pyqt6_qtgui_from_argv_list; +pyqt6_qtgui_update_argv_list_t pyqt6_qtgui_update_argv_list; + +// Forward declarations not in any header files but are part of the API. +void qt_set_sequence_auto_mnemonic(bool enable); +%End + +%InitialisationCode +// Export our own helpers. +sipExportSymbol("qtgui_wrap_ancestors", (void *)qtgui_wrap_ancestors); +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtgui_cleanup_qobjects = (pyqt6_qtgui_cleanup_qobjects_t)sipImportSymbol("pyqt6_cleanup_qobjects"); +Q_ASSERT(pyqt6_qtgui_cleanup_qobjects); + +pyqt6_qtgui_from_argv_list = (pyqt6_qtgui_from_argv_list_t)sipImportSymbol("pyqt6_from_argv_list"); +Q_ASSERT(pyqt6_qtgui_from_argv_list); + +pyqt6_qtgui_update_argv_list = (pyqt6_qtgui_update_argv_list_t)sipImportSymbol("pyqt6_update_argv_list"); +Q_ASSERT(pyqt6_qtgui_update_argv_list); +%End diff --git a/sip/QtGui/qicon.sip b/sip/QtGui/qicon.sip new file mode 100644 index 0000000..02ccc26 --- /dev/null +++ b/sip/QtGui/qicon.sip @@ -0,0 +1,99 @@ +// qicon.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QIcon /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + enum Mode + { + Normal, + Disabled, + Active, + Selected, + }; + + enum State + { + On, + Off, + }; + + QIcon(); + QIcon(const QPixmap &pixmap); + QIcon(const QIcon &other); + explicit QIcon(const QString &fileName); + explicit QIcon(QIconEngine *engine /GetWrapper/); +%MethodCode + sipCpp = new QIcon(a0); + + // The QIconEngine is implicitly shared by copies of the QIcon and is destroyed + // by C++ when the last copy is destroyed. Therefore we need to transfer + // ownership but not to associate it with this QIcon. The Python object will + // get tidied up when the virtual dtor gets called. + sipTransferTo(a0Wrapper, Py_None); +%End + + QIcon(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QIcon(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + ~QIcon(); + QPixmap pixmap(const QSize &size, qreal devicePixelRatio, QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const; + QPixmap pixmap(const QSize &size, QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const; + QPixmap pixmap(int w, int h, QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const; + QPixmap pixmap(int extent, QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const; + QSize actualSize(const QSize &size, QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const; + QList availableSizes(QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const; + void paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment = Qt::AlignCenter, QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const; + void paint(QPainter *painter, int x, int y, int w, int h, Qt::Alignment alignment = Qt::AlignCenter, QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const; + bool isNull() const; + bool isDetached() const; + void addPixmap(const QPixmap &pixmap, QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off); + void addFile(const QString &fileName, const QSize &size = QSize(), QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off); + qint64 cacheKey() const; + static QIcon fromTheme(const QString &name); + static QIcon fromTheme(const QString &name, const QIcon &fallback); + static bool hasThemeIcon(const QString &name); + static QStringList themeSearchPaths(); + static void setThemeSearchPaths(const QStringList &searchpath); + static QString themeName(); + static void setThemeName(const QString &path); + QString name() const; + void swap(QIcon &other /Constrained/); + void setIsMask(bool isMask); + bool isMask() const; + static QStringList fallbackSearchPaths(); + static void setFallbackSearchPaths(const QStringList &paths); + static QString fallbackThemeName(); + static void setFallbackThemeName(const QString &name); +}; + +QDataStream &operator<<(QDataStream &, const QIcon &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QIcon & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qiconengine.sip b/sip/QtGui/qiconengine.sip new file mode 100644 index 0000000..eb33a0b --- /dev/null +++ b/sip/QtGui/qiconengine.sip @@ -0,0 +1,70 @@ +// qiconengine.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QIconEngine /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + QIconEngine(); + +protected: + QIconEngine(const QIconEngine &other); + +public: + virtual ~QIconEngine(); + virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) = 0; + virtual QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state); + virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state); + virtual void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state); + virtual void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state); + virtual QString key() const; + virtual QIconEngine *clone() const = 0 /Factory/; + virtual bool read(QDataStream &in); + virtual bool write(QDataStream &out) const; + + enum IconEngineHook + { + IsNullHook, + ScaledPixmapHook, + }; + + virtual QList availableSizes(QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off); + virtual QString iconName(); + virtual bool isNull(); + virtual QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale); + + struct ScaledPixmapArgument + { +%TypeHeaderCode +#include +%End + + QSize size; + QIcon::Mode mode; + QIcon::State state; + qreal scale; + QPixmap pixmap; + }; +}; diff --git a/sip/QtGui/qimage.sip b/sip/QtGui/qimage.sip new file mode 100644 index 0000000..1b842c9 --- /dev/null +++ b/sip/QtGui/qimage.sip @@ -0,0 +1,398 @@ +// qimage.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Windows) +typedef struct HBITMAP__ *HBITMAP; +%End +%If (Windows) +typedef struct HICON__ *HICON; +%End + +class QImage : QPaintDevice +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// The C++ closure that is passed to the QImage ctor. +struct QtGui_QImage_closure +{ + PyObject *py_cleanup; + PyObject *py_closure; +}; + + +// Return the optional C++ closure for a QImage ctor. +static QtGui_QImage_closure *QtGui_QImage_buffer(PyObject *py_cleanup, + PyObject *py_closure) +{ + // The cleanup callable or nullptr if there isn't one. + if (py_cleanup == Py_None) + py_cleanup = nullptr; + + if (!py_cleanup) + return nullptr; + + QtGui_QImage_closure *closure = new QtGui_QImage_closure; + + Py_INCREF(py_cleanup); + + if (!py_closure) + py_closure = Py_None; + + Py_INCREF(py_closure); + + closure->py_cleanup = py_cleanup; + closure->py_closure = py_closure; + + return closure; +} + + +// The cleanup function for a QImage ctor. +static void QtGui_QImage_cleanup(void *c) +{ + SIP_BLOCK_THREADS + + QtGui_QImage_closure *closure = reinterpret_cast(c); + bool is_exception = false; + + PyObject *res = PyObject_CallFunctionObjArgs(closure->py_cleanup, + closure->py_closure, SIP_NULLPTR); + + Py_DECREF(closure->py_closure); + Py_DECREF(closure->py_cleanup); + + if (res) + Py_DECREF(res); + else + is_exception = true; + + delete closure; + + if (is_exception) + pyqt6_qtgui_err_print(); + + SIP_UNBLOCK_THREADS +} +%End + +public: + enum InvertMode + { + InvertRgb, + InvertRgba, + }; + + enum Format + { + Format_Invalid, + Format_Mono, + Format_MonoLSB, + Format_Indexed8, + Format_RGB32, + Format_ARGB32, + Format_ARGB32_Premultiplied, + Format_RGB16, + Format_ARGB8565_Premultiplied, + Format_RGB666, + Format_ARGB6666_Premultiplied, + Format_RGB555, + Format_ARGB8555_Premultiplied, + Format_RGB888, + Format_RGB444, + Format_ARGB4444_Premultiplied, + Format_RGBX8888, + Format_RGBA8888, + Format_RGBA8888_Premultiplied, + Format_BGR30, + Format_A2BGR30_Premultiplied, + Format_RGB30, + Format_A2RGB30_Premultiplied, + Format_Alpha8, + Format_Grayscale8, + Format_RGBX64, + Format_RGBA64, + Format_RGBA64_Premultiplied, + Format_Grayscale16, + Format_BGR888, +%If (Qt_6_2_0 -) + Format_RGBX16FPx4, +%End +%If (Qt_6_2_0 -) + Format_RGBA16FPx4, +%End +%If (Qt_6_2_0 -) + Format_RGBA16FPx4_Premultiplied, +%End +%If (Qt_6_2_0 -) + Format_RGBX32FPx4, +%End +%If (Qt_6_2_0 -) + Format_RGBA32FPx4, +%End +%If (Qt_6_2_0 -) + Format_RGBA32FPx4_Premultiplied, +%End + }; + + QImage(); + QImage(const QSize &size, QImage::Format format); + QImage(int width, int height, QImage::Format format); + QImage(const uchar *data /KeepReference/, int width, int height, QImage::Format format, SIP_PYCALLABLE cleanupFunction /AllowNone/ = 0, SIP_PYOBJECT cleanupInfo /AllowNone/ = 0) [(const uchar *data, int width, int height, QImage::Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0)]; +%MethodCode + QtGui_QImage_closure *closure = QtGui_QImage_buffer(a4, a5); + + sipCpp = new sipQImage(a0, a1, a2, a3, + (closure ? QtGui_QImage_cleanup : nullptr), closure); +%End + + QImage(const uchar *data /KeepReference/, int width, int height, qsizetype bytesPerLine, QImage::Format format, SIP_PYCALLABLE cleanupFunction /AllowNone/ = 0, SIP_PYOBJECT cleanupInfo /AllowNone/ = 0) [(const uchar *data, int width, int height, qsizetype bytesPerLine, QImage::Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0)]; +%MethodCode + QtGui_QImage_closure *closure = QtGui_QImage_buffer(a5, a6); + + sipCpp = new sipQImage(a0, a1, a2, a3, a4, + (closure ? QtGui_QImage_cleanup : nullptr), closure); +%End + + QImage(void *data /KeepReference/, int width, int height, QImage::Format format, SIP_PYCALLABLE cleanupFunction /AllowNone/ = 0, SIP_PYOBJECT cleanupInfo /AllowNone/ = 0) /NoTypeHint/ [(uchar *data, int width, int height, QImage::Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0)]; +%MethodCode + QtGui_QImage_closure *closure = QtGui_QImage_buffer(a4, a5); + + sipCpp = new sipQImage(reinterpret_cast(a0), a1, a2, a3, + (closure ? QtGui_QImage_cleanup : nullptr), closure); +%End + + QImage(void *data /KeepReference/, int width, int height, qsizetype bytesPerLine, QImage::Format format, SIP_PYCALLABLE cleanupFunction /AllowNone/ = 0, SIP_PYOBJECT cleanupInfo /AllowNone/ = 0) /NoTypeHint/ [(uchar *data, int width, int height, qsizetype bytesPerLine, QImage::Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0)]; +%MethodCode + QtGui_QImage_closure *closure = QtGui_QImage_buffer(a5, a6); + + sipCpp = new sipQImage(reinterpret_cast(a0), a1, a2, a3, a4, + (closure ? QtGui_QImage_cleanup : nullptr), closure); +%End + + explicit QImage(SIP_PYLIST xpm /TypeHint="List[str]"/) [(const char * const *xpm)]; +%MethodCode + // The Python interface is a list of ASCII strings that make up the image. + + const char **str = QtGui_ListToArray(a0); + + if (str) + { + sipCpp = new sipQImage(str); + QtGui_DeleteArray(str); + } + else + sipIsErr = 1; +%End + + QImage(const QString &fileName, const char *format = 0) /ReleaseGIL/; + QImage(const QImage &); + QImage(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new sipQImage(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + virtual ~QImage(); + bool isNull() const; + bool operator==(const QImage &) const; + bool operator!=(const QImage &) const; + QImage copy(const QRect &rect = QRect()) const; + QImage copy(int x, int y, int w, int h) const; + QImage::Format format() const; + QImage convertToFormat(QImage::Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const; + QImage convertToFormat(QImage::Format f, const QList &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const; +%If (Windows) + HBITMAP toHBITMAP() const; +%End +%If (Windows) + static QImage fromHBITMAP(HBITMAP hbitmap); +%End +%If (Windows) + HICON toHICON(const QImage &mask = {}) const; +%End +%If (Windows) + static QImage fromHICON(HICON hicon); +%End + int width() const; + int height() const; + QSize size() const; + QRect rect() const; + int depth() const; + QRgb color(int i) const; + void setColor(int i, QRgb c); + bool allGray() const; + bool isGrayscale() const; + void *bits() [uchar * ()]; + const void *constBits() const [const uchar * ()]; + void *scanLine(int) [uchar * (int)]; + const void *constScanLine(int) const [const uchar * (int)]; + qsizetype bytesPerLine() const; + bool valid(const QPoint &pt) const; + bool valid(int x, int y) const; + int pixelIndex(const QPoint &pt) const; + int pixelIndex(int x, int y) const; + QRgb pixel(const QPoint &pt) const; + QRgb pixel(int x, int y) const; + void setPixel(const QPoint &pt, uint index_or_rgb); + void setPixel(int x, int y, uint index_or_rgb); + QList colorTable() const; + void setColorTable(const QList &colors); + void fill(uint pixel); + void fill(Qt::GlobalColor color /Constrained/); + void fill(const QColor &color); + bool hasAlphaChannel() const; + void setAlphaChannel(const QImage &alphaChannel); + QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const; + QImage createHeuristicMask(bool clipTight = true) const; + QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const; + QImage scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const; + QImage scaledToWidth(int width, Qt::TransformationMode mode = Qt::FastTransformation) const; + QImage scaledToHeight(int height, Qt::TransformationMode mode = Qt::FastTransformation) const; + QImage mirrored(bool horizontal = false, bool vertical = true) const; + void mirror(bool horizontal = false, bool vertical = true); + QImage rgbSwapped() const; + void rgbSwap(); + void invertPixels(QImage::InvertMode mode = QImage::InvertRgb); + bool load(QIODevice *device, const char *format) /ReleaseGIL/; + bool load(const QString &fileName, const char *format = 0) /ReleaseGIL/; + bool loadFromData(const uchar *data /Array/, int len /ArraySize/, const char *format = 0); + bool loadFromData(const QByteArray &data, const char *format = 0); + bool save(const QString &fileName, const char *format = 0, int quality = -1) const /ReleaseGIL/; + bool save(QIODevice *device, const char *format = 0, int quality = -1) const /ReleaseGIL/; + static QImage fromData(const uchar *data /Array/, int size /ArraySize/, const char *format = 0); + static QImage fromData(const QByteArray &data, const char *format = 0); + virtual QPaintEngine *paintEngine() const; + int dotsPerMeterX() const; + int dotsPerMeterY() const; + void setDotsPerMeterX(int); + void setDotsPerMeterY(int); + QPoint offset() const; + void setOffset(const QPoint &); + QStringList textKeys() const; + QString text(const QString &key = QString()) const; + void setText(const QString &key, const QString &value); + QImage createMaskFromColor(QRgb color, Qt::MaskMode mode = Qt::MaskInColor) const; + QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QTransform trueMatrix(const QTransform &, int w, int h); + qint64 cacheKey() const; + int colorCount() const; + void setColorCount(int); + int bitPlaneCount() const; + void swap(QImage &other /Constrained/); + qreal devicePixelRatio() const; + void setDevicePixelRatio(qreal scaleFactor); + QPixelFormat pixelFormat() const; + static QPixelFormat toPixelFormat(QImage::Format format); + static QImage::Format toImageFormat(QPixelFormat format); + QColor pixelColor(int x, int y) const; + QColor pixelColor(const QPoint &pt) const; + void setPixelColor(int x, int y, const QColor &c); + void setPixelColor(const QPoint &pt, const QColor &c); + bool reinterpretAsFormat(QImage::Format f); + qsizetype sizeInBytes() const; + QImage convertedTo(QImage::Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const; + void convertTo(QImage::Format f, Qt::ImageConversionFlags flags = Qt::AutoColor); + QColorSpace colorSpace() const; + void setColorSpace(const QColorSpace &); + QImage convertedToColorSpace(const QColorSpace &) const; + void convertToColorSpace(const QColorSpace &); + void applyColorTransform(const QColorTransform &transform); +%If (Qt_6_2_0 -) + QSizeF deviceIndependentSize() const; +%End +%If (Qt_6_4_0 -) + QImage colorTransformed(const QColorTransform &transform) const; +%End +}; + +QDataStream &operator<<(QDataStream &, const QImage &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QImage & /Constrained/) /ReleaseGIL/; + +%ModuleHeaderCode +// Helpers for QImage and QPixmap ctors. +const char **QtGui_ListToArray(PyObject *lst); +void QtGui_DeleteArray(const char **arr); + +// Imports from QtCore. +typedef void (*pyqt6_qtgui_err_print_t)(); +extern pyqt6_qtgui_err_print_t pyqt6_qtgui_err_print; +%End + +%ModuleCode +// Convert a list of strings to an array of ASCII strings on the heap. Used by +// QImage and QPixmap. +const char **QtGui_ListToArray(PyObject *lst) +{ + Py_ssize_t nstr = PyList_Size(lst); + const char **arr = new const char *[nstr + 1]; + + for (Py_ssize_t i = 0; i < nstr; ++i) + { + PyObject *ascii_obj = PyList_GetItem(lst, i); + const char *ascii = sipString_AsASCIIString(&ascii_obj); + + if (!ascii) + { + while (i-- > 0) + delete[] arr[i]; + + delete[] arr; + + return 0; + } + + // Copy the string. + arr[i] = qstrdup(ascii); + + Py_DECREF(ascii_obj); + } + + // The sentinal. + arr[nstr] = 0; + + return arr; +} + + +// Return a string array created by QtGui_ListToArray() to the heap. +void QtGui_DeleteArray(const char **arr) +{ + for (Py_ssize_t i = 0; arr[i]; ++i) + delete[] arr[i]; + + delete[] arr; +} + +// Imports from QtCore. +pyqt6_qtgui_err_print_t pyqt6_qtgui_err_print; +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtgui_err_print = (pyqt6_qtgui_err_print_t)sipImportSymbol("pyqt6_err_print"); +Q_ASSERT(pyqt6_qtgui_err_print); +%End diff --git a/sip/QtGui/qimageiohandler.sip b/sip/QtGui/qimageiohandler.sip new file mode 100644 index 0000000..d1e1e1a --- /dev/null +++ b/sip/QtGui/qimageiohandler.sip @@ -0,0 +1,88 @@ +// qimageiohandler.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QImageIOHandler +{ +%TypeHeaderCode +#include +%End + +public: + enum ImageOption + { + Size, + ClipRect, + Description, + ScaledClipRect, + ScaledSize, + CompressionRatio, + Gamma, + Quality, + Name, + SubType, + IncrementalReading, + Endianness, + Animation, + BackgroundColor, + SupportedSubTypes, + OptimizedWrite, + ProgressiveScanWrite, + ImageTransformation, + }; + + QImageIOHandler(); + virtual ~QImageIOHandler(); + void setDevice(QIODevice *device); + QIODevice *device() const; + void setFormat(const QByteArray &format); + QByteArray format() const; + virtual bool canRead() const = 0; + virtual bool read(QImage *image) = 0; + virtual bool write(const QImage &image); + virtual QVariant option(QImageIOHandler::ImageOption option) const; + virtual void setOption(QImageIOHandler::ImageOption option, const QVariant &value); + virtual bool supportsOption(QImageIOHandler::ImageOption option) const; + virtual bool jumpToNextImage(); + virtual bool jumpToImage(int imageNumber); + virtual int loopCount() const; + virtual int imageCount() const; + virtual int nextImageDelay() const; + virtual int currentImageNumber() const; + virtual QRect currentImageRect() const; + + enum Transformation /BaseType=Flag/ + { + TransformationNone, + TransformationMirror, + TransformationFlip, + TransformationRotate180, + TransformationRotate90, + TransformationMirrorAndRotate90, + TransformationFlipAndRotate90, + TransformationRotate270, + }; + + typedef QFlags Transformations; + +private: + QImageIOHandler(const QImageIOHandler &); +}; diff --git a/sip/QtGui/qimagereader.sip b/sip/QtGui/qimagereader.sip new file mode 100644 index 0000000..e1d2fa1 --- /dev/null +++ b/sip/QtGui/qimagereader.sip @@ -0,0 +1,96 @@ +// qimagereader.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QImageReader +{ +%TypeHeaderCode +#include +%End + +public: + enum ImageReaderError + { + UnknownError, + FileNotFoundError, + DeviceError, + UnsupportedFormatError, + InvalidDataError, + }; + + QImageReader(); + QImageReader(QIODevice *device, const QByteArray &format = QByteArray()); + QImageReader(const QString &fileName, const QByteArray &format = QByteArray()); + ~QImageReader(); + void setFormat(const QByteArray &format); + QByteArray format() const; + void setDevice(QIODevice *device); + QIODevice *device() const; + void setFileName(const QString &fileName); + QString fileName() const; + QSize size() const; + void setClipRect(const QRect &rect); + QRect clipRect() const; + void setScaledSize(const QSize &size); + QSize scaledSize() const; + void setScaledClipRect(const QRect &rect); + QRect scaledClipRect() const; + bool canRead() const; + QImage read() /ReleaseGIL/; + bool read(QImage *image) /ReleaseGIL/; + bool jumpToNextImage(); + bool jumpToImage(int imageNumber); + int loopCount() const; + int imageCount() const; + int nextImageDelay() const; + int currentImageNumber() const; + QRect currentImageRect() const; + QImageReader::ImageReaderError error() const; + QString errorString() const; + static QByteArray imageFormat(const QString &fileName); + static QByteArray imageFormat(QIODevice *device); + static QList supportedImageFormats(); + QStringList textKeys() const; + QString text(const QString &key) const; + void setBackgroundColor(const QColor &color); + QColor backgroundColor() const; + bool supportsAnimation() const; + void setQuality(int quality); + int quality() const; + bool supportsOption(QImageIOHandler::ImageOption option) const; + void setAutoDetectImageFormat(bool enabled); + bool autoDetectImageFormat() const; + QImage::Format imageFormat() const; + void setDecideFormatFromContent(bool ignored); + bool decideFormatFromContent() const; + static QList supportedMimeTypes(); + QByteArray subType() const; + QList supportedSubTypes() const; + QImageIOHandler::Transformations transformation() const; + void setAutoTransform(bool enabled); + bool autoTransform() const; + static QList imageFormatsForMimeType(const QByteArray &mimeType); + static int allocationLimit(); + static void setAllocationLimit(int mbLimit); + +private: + QImageReader(const QImageReader &); +}; diff --git a/sip/QtGui/qimagewriter.sip b/sip/QtGui/qimagewriter.sip new file mode 100644 index 0000000..9300a02 --- /dev/null +++ b/sip/QtGui/qimagewriter.sip @@ -0,0 +1,73 @@ +// qimagewriter.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QImageWriter +{ +%TypeHeaderCode +#include +%End + +public: + enum ImageWriterError + { + UnknownError, + DeviceError, + UnsupportedFormatError, + InvalidImageError, + }; + + QImageWriter(); + QImageWriter(QIODevice *device, const QByteArray &format); + QImageWriter(const QString &fileName, const QByteArray &format = QByteArray()); + ~QImageWriter(); + void setFormat(const QByteArray &format); + QByteArray format() const; + void setDevice(QIODevice *device); + QIODevice *device() const; + void setFileName(const QString &fileName); + QString fileName() const; + void setQuality(int quality); + int quality() const; + bool canWrite() const; + bool write(const QImage &image) /ReleaseGIL/; + QImageWriter::ImageWriterError error() const; + QString errorString() const; + static QList supportedImageFormats(); + void setText(const QString &key, const QString &text); + bool supportsOption(QImageIOHandler::ImageOption option) const; + void setCompression(int compression); + int compression() const; + static QList supportedMimeTypes(); + void setSubType(const QByteArray &type); + QByteArray subType() const; + QList supportedSubTypes() const; + void setOptimizedWrite(bool optimize); + bool optimizedWrite() const; + void setProgressiveScanWrite(bool progressive); + bool progressiveScanWrite() const; + QImageIOHandler::Transformations transformation() const; + void setTransformation(QImageIOHandler::Transformations orientation); + static QList imageFormatsForMimeType(const QByteArray &mimeType); + +private: + QImageWriter(const QImageWriter &); +}; diff --git a/sip/QtGui/qinputdevice.sip b/sip/QtGui/qinputdevice.sip new file mode 100644 index 0000000..9780fcb --- /dev/null +++ b/sip/QtGui/qinputdevice.sip @@ -0,0 +1,89 @@ +// qinputdevice.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QInputDevice : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum class DeviceType /BaseType=Flag/ + { + Unknown, + Mouse, + TouchScreen, + TouchPad, + Puck, + Stylus, + Airbrush, + Keyboard, + AllDevices, + }; + + typedef QFlags DeviceTypes; + + enum class Capability /BaseType=Flag/ + { + None, + Position, + Area, + Pressure, + Velocity, + NormalizedPosition, + MouseEmulation, +%If (Qt_6_2_0 -) + PixelScroll, +%End + Scroll, + Hover, + Rotation, + XTilt, + YTilt, + TangentialPressure, + ZPosition, + All, + }; + + typedef QFlags Capabilities; + QInputDevice(const QString &name, qint64 systemId, QInputDevice::DeviceType type, const QString &seatName = QString(), QObject *parent /TransferThis/ = 0); + QInputDevice(QObject *parent /TransferThis/ = 0); + virtual ~QInputDevice(); + QString name() const; + QInputDevice::DeviceType type() const; + QInputDevice::Capabilities capabilities() const; + bool hasCapability(QInputDevice::Capability cap) const; + qint64 systemId() const; + QString seatName() const; + QRect availableVirtualGeometry() const; + static QList devices(); + static const QInputDevice *primaryKeyboard(const QString &seatName = QString()); + bool operator==(const QInputDevice &other) const; + +signals: + void availableVirtualGeometryChanged(QRect area); + +public: +%If (Qt_6_3_0 -) + static QStringList seatNames(); +%End +}; diff --git a/sip/QtGui/qinputmethod.sip b/sip/QtGui/qinputmethod.sip new file mode 100644 index 0000000..6729696 --- /dev/null +++ b/sip/QtGui/qinputmethod.sip @@ -0,0 +1,77 @@ +// qinputmethod.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QInputMethod : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QTransform inputItemTransform() const; + void setInputItemTransform(const QTransform &transform); + QRectF cursorRectangle() const; + QRectF keyboardRectangle() const; + + enum Action + { + Click, + ContextMenu, + }; + + bool isVisible() const; + void setVisible(bool visible); + bool isAnimating() const; + QLocale locale() const; + Qt::LayoutDirection inputDirection() const; + QRectF inputItemRectangle() const; + void setInputItemRectangle(const QRectF &rect); + static QVariant queryFocusObject(Qt::InputMethodQuery query, const QVariant &argument); + +public slots: + void show(); + void hide(); + void update(Qt::InputMethodQueries queries); + void reset(); + void commit(); + void invokeAction(QInputMethod::Action a, int cursorPosition); + +signals: + void cursorRectangleChanged(); + void keyboardRectangleChanged(); + void visibleChanged(); + void animatingChanged(); + void localeChanged(); + void inputDirectionChanged(Qt::LayoutDirection newDirection); + +public: + QRectF anchorRectangle() const; + QRectF inputItemClipRectangle() const; + +signals: + void anchorRectangleChanged(); + void inputItemClipRectangleChanged(); + +private: + QInputMethod(); + virtual ~QInputMethod(); +}; diff --git a/sip/QtGui/qkeysequence.sip b/sip/QtGui/qkeysequence.sip new file mode 100644 index 0000000..ff584fd --- /dev/null +++ b/sip/QtGui/qkeysequence.sip @@ -0,0 +1,239 @@ +// qkeysequence.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QKeySequence /TypeHintIn="Union[QKeySequence, QKeySequence.StandardKey, QString, int]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +// Allow a StandardKey, QString or an integer whenever a QKeySequence is +// expected. + +if (sipIsErr == NULL) +{ + if (sipCanConvertToType(sipPy, sipType_QKeySequence, SIP_NO_CONVERTORS)) + return 1; + + PyErr_Clear(); + sipConvertToEnum(sipPy, sipType_QKeySequence_StandardKey); + if (!PyErr_Occurred()) + return 1; + + if (sipCanConvertToType(sipPy, sipType_QString, 0)) + return 1; + + PyErr_Clear(); + PyLong_AsLong(sipPy); + + return !PyErr_Occurred(); +} + +if (sipCanConvertToType(sipPy, sipType_QKeySequence, SIP_NO_CONVERTORS)) +{ + *sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, sipType_QKeySequence, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + + return 0; +} + +PyErr_Clear(); +int skey = sipConvertToEnum(sipPy, sipType_QKeySequence_StandardKey); + +if (!PyErr_Occurred()) +{ + *sipCppPtr = new QKeySequence(static_cast(skey)); + + return sipGetState(sipTransferObj); +} + +PyErr_Clear(); + +if (sipCanConvertToType(sipPy, sipType_QString, 0)) +{ + int state; + QString *qs = reinterpret_cast(sipConvertToType(sipPy, sipType_QString, 0, 0, &state, sipIsErr)); + + if (*sipIsErr) + { + sipReleaseType(qs, sipType_QString, state); + return 0; + } + + *sipCppPtr = new QKeySequence(*qs); + + sipReleaseType(qs, sipType_QString, state); + + return sipGetState(sipTransferObj); +} + +int key = PyLong_AsLong(sipPy); + +*sipCppPtr = new QKeySequence(key); + +return sipGetState(sipTransferObj); +%End + +%PickleCode + sipRes = Py_BuildValue("iiii", sipCpp->operator[](0), sipCpp->operator[](1), sipCpp->operator[](2), sipCpp->operator[](3)); +%End + +public: + enum SequenceFormat + { + NativeText, + PortableText, + }; + + enum SequenceMatch + { + NoMatch, + PartialMatch, + ExactMatch, + }; + + enum StandardKey + { + UnknownKey, + HelpContents, + WhatsThis, + Open, + Close, + Save, + New, + Delete, + Cut, + Copy, + Paste, + Undo, + Redo, + Back, + Forward, + Refresh, + ZoomIn, + ZoomOut, + Print, + AddTab, + NextChild, + PreviousChild, + Find, + FindNext, + FindPrevious, + Replace, + SelectAll, + Bold, + Italic, + Underline, + MoveToNextChar, + MoveToPreviousChar, + MoveToNextWord, + MoveToPreviousWord, + MoveToNextLine, + MoveToPreviousLine, + MoveToNextPage, + MoveToPreviousPage, + MoveToStartOfLine, + MoveToEndOfLine, + MoveToStartOfBlock, + MoveToEndOfBlock, + MoveToStartOfDocument, + MoveToEndOfDocument, + SelectNextChar, + SelectPreviousChar, + SelectNextWord, + SelectPreviousWord, + SelectNextLine, + SelectPreviousLine, + SelectNextPage, + SelectPreviousPage, + SelectStartOfLine, + SelectEndOfLine, + SelectStartOfBlock, + SelectEndOfBlock, + SelectStartOfDocument, + SelectEndOfDocument, + DeleteStartOfWord, + DeleteEndOfWord, + DeleteEndOfLine, + InsertParagraphSeparator, + InsertLineSeparator, + SaveAs, + Preferences, + Quit, + FullScreen, + Deselect, + DeleteCompleteLine, + Backspace, + Cancel, + }; + + QKeySequence(); + QKeySequence(const QKeySequence &ks /Constrained/); + QKeySequence(QKeySequence::StandardKey key); + QKeySequence(const QString &key, QKeySequence::SequenceFormat format = QKeySequence::NativeText); + QKeySequence(int k1, int key2 = 0, int key3 = 0, int key4 = 0); + QKeySequence(QKeyCombination k1, QKeyCombination key2 = QKeyCombination::fromCombined(0), QKeyCombination key3 = QKeyCombination::fromCombined(0), QKeyCombination key4 = QKeyCombination::fromCombined(0)); + QKeySequence(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QKeySequence(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + ~QKeySequence(); + int count() const /__len__/; + bool isEmpty() const; + QKeySequence::SequenceMatch matches(const QKeySequence &seq) const; + static QKeySequence mnemonic(const QString &text); + QKeyCombination operator[](int i) const; +%MethodCode + Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); + + if (idx < 0) + sipIsErr = 1; + else + sipRes = new QKeyCombination(sipCpp->operator[]((uint)idx)); +%End + + bool operator==(const QKeySequence &other) const; + bool operator!=(const QKeySequence &other) const; + bool operator<(const QKeySequence &ks) const; + bool operator>(const QKeySequence &other) const; + bool operator<=(const QKeySequence &other) const; + bool operator>=(const QKeySequence &other) const; + bool isDetached() const; + void swap(QKeySequence &other /Constrained/); + QString toString(QKeySequence::SequenceFormat format = QKeySequence::PortableText) const; + static QKeySequence fromString(const QString &str, QKeySequence::SequenceFormat format = QKeySequence::PortableText); + static QList keyBindings(QKeySequence::StandardKey key); + static QList listFromString(const QString &str, QKeySequence::SequenceFormat format = QKeySequence::PortableText); + static QString listToString(const QList &list, QKeySequence::SequenceFormat format = QKeySequence::PortableText); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +QDataStream &operator<<(QDataStream &in, const QKeySequence &ks) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &out, QKeySequence &ks /Constrained/) /ReleaseGIL/; +void qt_set_sequence_auto_mnemonic(bool b); diff --git a/sip/QtGui/qmatrix4x4.sip b/sip/QtGui/qmatrix4x4.sip new file mode 100644 index 0000000..17a4f79 --- /dev/null +++ b/sip/QtGui/qmatrix4x4.sip @@ -0,0 +1,296 @@ +// qmatrix4x4.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QMatrix4x4 +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PYQT_FLOAT data[16]; + + // We want the data in row-major order. + sipCpp->copyDataTo(data); + + sipRes = Py_BuildValue("dddddddddddddddd", + (double)data[0], (double)data[1], (double)data[2], (double)data[3], + (double)data[4], (double)data[5], (double)data[6], (double)data[7], + (double)data[8], (double)data[9], (double)data[10], (double)data[11], + (double)data[12], (double)data[13], (double)data[14], (double)data[15]); +%End + +public: + QMatrix4x4(); + explicit QMatrix4x4(SIP_PYOBJECT values /TypeHint="Sequence[float]"/) [(const float *values)]; +%MethodCode + float values[16]; + + if ((sipError = qtgui_matrixDataFromSequence(a0, 16, values)) == sipErrorNone) + sipCpp = new QMatrix4x4(values); +%End + + QMatrix4x4(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44); + QMatrix4x4(const QTransform &transform); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + bool bad = false; + int i; + PyObject *m[16]; + PYQT_FLOAT data[16]; + + // The raw data is in column-major order but we want row-major order. + sipCpp->copyDataTo(data); + + for (i = 0; i < 16; ++i) + { + m[i] = PyFloat_FromDouble(data[i]); + + if (!m[i]) + bad = true; + } + + if (!bad) + { + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix4x4(" + "%R, %R, %R, %R, " + "%R, %R, %R, %R, " + "%R, %R, %R, %R, " + "%R, %R, %R, %R)", + m[0], m[1], m[2], m[3], + m[4], m[5], m[6], m[7], + m[8], m[9], m[10], m[11], + m[12], m[13], m[14], m[15]); + } + + for (i = 0; i < 16; ++i) + Py_XDECREF(m[i]); +%End + + double determinant() const; + QMatrix4x4 inverted(bool *invertible = 0) const; + QMatrix4x4 transposed() const; + QMatrix3x3 normalMatrix() const; + void scale(const QVector3D &vector); + void scale(float x, float y); + void scale(float x, float y, float z); + void scale(float factor); + void translate(const QVector3D &vector); + void translate(float x, float y); + void translate(float x, float y, float z); + void rotate(float angle, const QVector3D &vector); + void rotate(float angle, float x, float y, float z = 0.F); + void rotate(const QQuaternion &quaternion); + void ortho(const QRect &rect); + void ortho(const QRectF &rect); + void ortho(float left, float right, float bottom, float top, float nearPlane, float farPlane); + void frustum(float left, float right, float bottom, float top, float nearPlane, float farPlane); + void perspective(float angle, float aspect, float nearPlane, float farPlane); + void lookAt(const QVector3D &eye, const QVector3D ¢er, const QVector3D &up); + SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/; +%MethodCode + float values[16]; + + sipCpp->copyDataTo(values); + sipError = qtgui_matrixDataAsList(16, values, &sipRes); +%End + + QTransform toTransform() const; + QTransform toTransform(float distanceToPlane) const; + QRect mapRect(const QRect &rect) const; + QRectF mapRect(const QRectF &rect) const; + SIP_PYLIST data() /TypeHint="List[float]"/; +%MethodCode + sipError = qtgui_matrixDataAsList(16, sipCpp->constData(), &sipRes); +%End + + void optimize(); + SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const; +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 4, 4, &row, &column)) == sipErrorNone) + { + sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column)); + + if (!sipRes) + sipError = sipErrorFail; + } +%End + + void __setitem__(SIP_PYOBJECT, qreal); +%MethodCode + int row, column; + + if ((sipError = qtgui_matrixParseIndex(a0, 4, 4, &row, &column)) == sipErrorNone) + sipCpp->operator()(row, column) = a1; +%End + + QVector4D column(int index) const; + void setColumn(int index, const QVector4D &value); + QVector4D row(int index) const; + void setRow(int index, const QVector4D &value); + bool isIdentity() const; + void setToIdentity(); + void fill(float value); + QMatrix4x4 &operator+=(const QMatrix4x4 &other); + QMatrix4x4 &operator-=(const QMatrix4x4 &other); + QMatrix4x4 &operator*=(const QMatrix4x4 &other) /__imatmul__/; + QMatrix4x4 &operator*=(float factor); + QMatrix4x4 &operator/=(float divisor); + bool operator==(const QMatrix4x4 &other) const; + bool operator!=(const QMatrix4x4 &other) const; + QPoint map(const QPoint &point) const; + QPointF map(const QPointF &point) const; + QVector3D map(const QVector3D &point) const; + QVector3D mapVector(const QVector3D &vector) const; + QVector4D map(const QVector4D &point) const; + void viewport(float left, float bottom, float width, float height, float nearPlane = 0.F, float farPlane = 1.F); + void viewport(const QRectF &rect); + bool isAffine() const; +}; + +QMatrix4x4 operator/(const QMatrix4x4 &matrix, float divisor); +QMatrix4x4 operator+(const QMatrix4x4 &m1, const QMatrix4x4 &m2); +QMatrix4x4 operator-(const QMatrix4x4 &m1, const QMatrix4x4 &m2); +QMatrix4x4 operator*(const QMatrix4x4 &m1, const QMatrix4x4 &m2) /__matmul__/; +QPoint operator*(const QPoint &point, const QMatrix4x4 &matrix); +QPointF operator*(const QPointF &point, const QMatrix4x4 &matrix); +QPoint operator*(const QMatrix4x4 &matrix, const QPoint &point); +QPointF operator*(const QMatrix4x4 &matrix, const QPointF &point); +QMatrix4x4 operator-(const QMatrix4x4 &matrix); +QMatrix4x4 operator*(float factor, const QMatrix4x4 &matrix); +QMatrix4x4 operator*(const QMatrix4x4 &matrix, float factor); +bool qFuzzyCompare(const QMatrix4x4 &m1, const QMatrix4x4 &m2); +QDataStream &operator<<(QDataStream &, const QMatrix4x4 &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QMatrix4x4 & /Constrained/) /ReleaseGIL/; + +%ModuleHeaderCode +// Helpers for the matrix classes. +typedef float PYQT_FLOAT; + +sipErrorState qtgui_matrixParseIndex(PyObject *tup, int nr_rows, + int nr_columns, int *row, int *column); +sipErrorState qtgui_matrixDataFromSequence(PyObject *seq, int nr_values, + PYQT_FLOAT *values); +sipErrorState qtgui_matrixDataAsList(int nr_values, const PYQT_FLOAT *values, + PyObject **list); +%End + +%ModuleCode +// Convert a Python object to a row and column. +sipErrorState qtgui_matrixParseIndex(PyObject *tup, int nr_rows, + int nr_columns, int *row, int *column) +{ + sipErrorState es = sipErrorContinue; + + if (PyTuple_Check(tup) && PyArg_ParseTuple(tup, "ii", row, column)) + if (*row >= 0 && *row < nr_rows && *column >= 0 && *column < nr_columns) + es = sipErrorNone; + + if (es == sipErrorContinue) + PyErr_Format(PyExc_IndexError, "an index must be a row in the range 0 to %d and a column in the range 0 to %d", nr_rows - 1, nr_columns - 1); + + return es; +} + + +// Convert a Python object to an array of qreals. +sipErrorState qtgui_matrixDataFromSequence(PyObject *seq, int nr_values, + PYQT_FLOAT *values) +{ + sipErrorState es; + + if (PySequence_Size(seq) == nr_values) + { + es = sipErrorNone; + + for (int i = 0; i < nr_values; ++i) + { + PyObject *value = PySequence_GetItem(seq, i); + + if (!value) + { + es = sipErrorFail; + break; + } + + PyErr_Clear(); + + double d = PyFloat_AsDouble(value); + + if (PyErr_Occurred()) + { + Py_DECREF(value); + es = sipErrorContinue; + break; + } + + Py_DECREF(value); + + *values++ = d; + } + } + else + { + es = sipErrorContinue; + } + + if (es == sipErrorContinue) + PyErr_Format(PyExc_TypeError, "a sequence of %d floats is expected", + nr_values); + + return es; +} + + +// Convert an array of qreals to a Python list. +sipErrorState qtgui_matrixDataAsList(int nr_values, const PYQT_FLOAT *values, + PyObject **list) +{ + PyObject *l = PyList_New(nr_values); + + if (!l) + return sipErrorFail; + + for (int i = 0; i < nr_values; ++i) + { + PyObject *value = PyFloat_FromDouble(*values++); + + if (!value) + { + Py_DECREF(l); + return sipErrorFail; + } + + PyList_SetItem(l, i, value); + } + + *list = l; + + return sipErrorNone; +} +%End diff --git a/sip/QtGui/qmovie.sip b/sip/QtGui/qmovie.sip new file mode 100644 index 0000000..d62c639 --- /dev/null +++ b/sip/QtGui/qmovie.sip @@ -0,0 +1,91 @@ +// qmovie.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMovie : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum MovieState + { + NotRunning, + Paused, + Running, + }; + + enum CacheMode + { + CacheNone, + CacheAll, + }; + + explicit QMovie(QObject *parent /TransferThis/ = 0); + QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent /TransferThis/ = 0); + QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent /TransferThis/ = 0); + virtual ~QMovie(); + static QList supportedFormats(); + void setDevice(QIODevice *device); + QIODevice *device() const; + void setFileName(const QString &fileName); + QString fileName() const; + void setFormat(const QByteArray &format); + QByteArray format() const; + void setBackgroundColor(const QColor &color); + QColor backgroundColor() const; + QMovie::MovieState state() const; + QRect frameRect() const; + QImage currentImage() const; + QPixmap currentPixmap() const; + bool isValid() const; + bool jumpToFrame(int frameNumber); + int loopCount() const; + int frameCount() const; + int nextFrameDelay() const; + int currentFrameNumber() const; + void setSpeed(int percentSpeed); + int speed() const; + QSize scaledSize(); + void setScaledSize(const QSize &size); + QMovie::CacheMode cacheMode() const; + void setCacheMode(QMovie::CacheMode mode); + +signals: + void started(); + void resized(const QSize &size); + void updated(const QRect &rect); + void stateChanged(QMovie::MovieState state); + void error(QImageReader::ImageReaderError error); + void finished(); + void frameChanged(int frameNumber); + +public slots: + void start(); + bool jumpToNextFrame(); + void setPaused(bool paused); + void stop(); + +public: + QImageReader::ImageReaderError lastError() const; + QString lastErrorString() const; +}; diff --git a/sip/QtGui/qoffscreensurface.sip b/sip/QtGui/qoffscreensurface.sip new file mode 100644 index 0000000..1ca8057 --- /dev/null +++ b/sip/QtGui/qoffscreensurface.sip @@ -0,0 +1,45 @@ +// qoffscreensurface.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOffscreenSurface : QObject, QSurface +{ +%TypeHeaderCode +#include +%End + +public: + QOffscreenSurface(QScreen *screen = 0, QObject *parent /TransferThis/ = 0); + virtual ~QOffscreenSurface(); + virtual QSurface::SurfaceType surfaceType() const; + void create(); + void destroy(); + bool isValid() const; + void setFormat(const QSurfaceFormat &format); + virtual QSurfaceFormat format() const; + QSurfaceFormat requestedFormat() const; + virtual QSize size() const; + QScreen *screen() const; + void setScreen(QScreen *screen); + +signals: + void screenChanged(QScreen *screen); +}; diff --git a/sip/QtGui/qopenglcontext.sip b/sip/QtGui/qopenglcontext.sip new file mode 100644 index 0000000..e16872d --- /dev/null +++ b/sip/QtGui/qopenglcontext.sip @@ -0,0 +1,88 @@ +// qopenglcontext.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_OpenGL) + +class QOpenGLContextGroup : QObject +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QOpenGLContextGroup(); + QList shares() const; + static QOpenGLContextGroup *currentContextGroup(); + +private: + QOpenGLContextGroup(); +}; + +%End +%If (PyQt_OpenGL) + +class QOpenGLContext : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QOpenGLContext(QObject *parent /TransferThis/ = 0); + virtual ~QOpenGLContext(); + void setFormat(const QSurfaceFormat &format); + void setShareContext(QOpenGLContext *shareContext); + void setScreen(QScreen *screen); + bool create(); + bool isValid() const; + QSurfaceFormat format() const; + QOpenGLContext *shareContext() const; + QOpenGLContextGroup *shareGroup() const; + QScreen *screen() const; + GLuint defaultFramebufferObject() const; + bool makeCurrent(QSurface *surface); + void doneCurrent(); + void swapBuffers(QSurface *surface); + QFunctionPointer getProcAddress(const QByteArray &procName) const; + QSurface *surface() const; + static QOpenGLContext *currentContext(); + static bool areSharing(QOpenGLContext *first, QOpenGLContext *second); + QSet extensions() const; + bool hasExtension(const QByteArray &extension) const; + +signals: + void aboutToBeDestroyed(); + +public: + enum OpenGLModuleType + { + LibGL, + LibGLES, + }; + + static QOpenGLContext::OpenGLModuleType openGLModuleType(); + bool isOpenGLES() const; + static bool supportsThreadedOpenGL(); + static QOpenGLContext *globalShareContext(); +}; + +%End diff --git a/sip/QtGui/qpagedpaintdevice.sip b/sip/QtGui/qpagedpaintdevice.sip new file mode 100644 index 0000000..79961b2 --- /dev/null +++ b/sip/QtGui/qpagedpaintdevice.sip @@ -0,0 +1,47 @@ +// qpagedpaintdevice.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPagedPaintDevice : QPaintDevice /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QPagedPaintDevice(); + virtual bool newPage() = 0; + + enum PdfVersion + { + PdfVersion_1_4, + PdfVersion_A1b, + PdfVersion_1_6, + }; + + virtual bool setPageSize(const QPageSize &pageSize); + virtual bool setPageLayout(const QPageLayout &pageLayout); + QPageLayout pageLayout() const; + virtual bool setPageOrientation(QPageLayout::Orientation orientation); + virtual bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units = QPageLayout::Millimeter); + virtual void setPageRanges(const QPageRanges &ranges); + QPageRanges pageRanges() const; +}; diff --git a/sip/QtGui/qpagelayout.sip b/sip/QtGui/qpagelayout.sip new file mode 100644 index 0000000..2eefff3 --- /dev/null +++ b/sip/QtGui/qpagelayout.sip @@ -0,0 +1,90 @@ +// qpagelayout.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPageLayout +{ +%TypeHeaderCode +#include +%End + +public: + enum Unit + { + Millimeter, + Point, + Inch, + Pica, + Didot, + Cicero, + }; + + enum Orientation + { + Portrait, + Landscape, + }; + + enum Mode + { + StandardMode, + FullPageMode, + }; + + QPageLayout(); + QPageLayout(const QPageSize &pageSize, QPageLayout::Orientation orientation, const QMarginsF &margins, QPageLayout::Unit units = QPageLayout::Point, const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0)); + QPageLayout(const QPageLayout &other); + ~QPageLayout(); + void swap(QPageLayout &other /Constrained/); + bool isEquivalentTo(const QPageLayout &other) const; + bool isValid() const; + void setMode(QPageLayout::Mode mode); + QPageLayout::Mode mode() const; + void setPageSize(const QPageSize &pageSize, const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0)); + QPageSize pageSize() const; + void setOrientation(QPageLayout::Orientation orientation); + QPageLayout::Orientation orientation() const; + void setUnits(QPageLayout::Unit units); + QPageLayout::Unit units() const; + bool setMargins(const QMarginsF &margins); + bool setLeftMargin(qreal leftMargin); + bool setRightMargin(qreal rightMargin); + bool setTopMargin(qreal topMargin); + bool setBottomMargin(qreal bottomMargin); + QMarginsF margins() const; + QMarginsF margins(QPageLayout::Unit units) const; + QMargins marginsPoints() const; + QMargins marginsPixels(int resolution) const; + void setMinimumMargins(const QMarginsF &minMargins); + QMarginsF minimumMargins() const; + QMarginsF maximumMargins() const; + QRectF fullRect() const; + QRectF fullRect(QPageLayout::Unit units) const; + QRect fullRectPoints() const; + QRect fullRectPixels(int resolution) const; + QRectF paintRect() const; + QRectF paintRect(QPageLayout::Unit units) const; + QRect paintRectPoints() const; + QRect paintRectPixels(int resolution) const; +}; + +bool operator==(const QPageLayout &lhs, const QPageLayout &rhs); +bool operator!=(const QPageLayout &lhs, const QPageLayout &rhs); diff --git a/sip/QtGui/qpageranges.sip b/sip/QtGui/qpageranges.sip new file mode 100644 index 0000000..4dc93b0 --- /dev/null +++ b/sip/QtGui/qpageranges.sip @@ -0,0 +1,64 @@ +// qpageranges.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPageRanges +{ +%TypeHeaderCode +#include +%End + +public: + QPageRanges(); + QPageRanges(const QPageRanges &other); + ~QPageRanges(); + void swap(QPageRanges &other /Constrained/); + + struct Range + { +%TypeHeaderCode +#include +%End + + int from; + int to; + bool contains(int pageNumber) const; + }; + + void addPage(int pageNumber); + void addRange(int from, int to); + QList toRangeList() const; + void clear(); + QString toString() const; + static QPageRanges fromString(const QString &ranges); + bool contains(int pageNumber) const; + bool isEmpty() const; + int firstPage() const; + int lastPage() const; +}; + +bool operator==(QPageRanges::Range lhs, QPageRanges::Range rhs); +bool operator==(const QPageRanges &lhs, const QPageRanges &rhs); +bool operator!=(QPageRanges::Range lhs, QPageRanges::Range rhs); +bool operator!=(const QPageRanges &lhs, const QPageRanges &rhs); +bool operator<(QPageRanges::Range lhs, QPageRanges::Range rhs); +QDataStream &operator<<(QDataStream &, const QPageRanges &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QPageRanges & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qpagesize.sip b/sip/QtGui/qpagesize.sip new file mode 100644 index 0000000..155085a --- /dev/null +++ b/sip/QtGui/qpagesize.sip @@ -0,0 +1,216 @@ +// qpagesize.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPageSize +{ +%TypeHeaderCode +#include +%End + +public: + enum PageSizeId + { + A4, + B5, + Letter, + Legal, + Executive, + A0, + A1, + A2, + A3, + A5, + A6, + A7, + A8, + A9, + B0, + B1, + B10, + B2, + B3, + B4, + B6, + B7, + B8, + B9, + C5E, + Comm10E, + DLE, + Folio, + Ledger, + Tabloid, + Custom, + A10, + A3Extra, + A4Extra, + A4Plus, + A4Small, + A5Extra, + B5Extra, + JisB0, + JisB1, + JisB2, + JisB3, + JisB4, + JisB5, + JisB6, + JisB7, + JisB8, + JisB9, + JisB10, + AnsiC, + AnsiD, + AnsiE, + LegalExtra, + LetterExtra, + LetterPlus, + LetterSmall, + TabloidExtra, + ArchA, + ArchB, + ArchC, + ArchD, + ArchE, + Imperial7x9, + Imperial8x10, + Imperial9x11, + Imperial9x12, + Imperial10x11, + Imperial10x13, + Imperial10x14, + Imperial12x11, + Imperial15x11, + ExecutiveStandard, + Note, + Quarto, + Statement, + SuperA, + SuperB, + Postcard, + DoublePostcard, + Prc16K, + Prc32K, + Prc32KBig, + FanFoldUS, + FanFoldGerman, + FanFoldGermanLegal, + EnvelopeB4, + EnvelopeB5, + EnvelopeB6, + EnvelopeC0, + EnvelopeC1, + EnvelopeC2, + EnvelopeC3, + EnvelopeC4, + EnvelopeC6, + EnvelopeC65, + EnvelopeC7, + Envelope9, + Envelope11, + Envelope12, + Envelope14, + EnvelopeMonarch, + EnvelopePersonal, + EnvelopeChou3, + EnvelopeChou4, + EnvelopeInvite, + EnvelopeItalian, + EnvelopeKaku2, + EnvelopeKaku3, + EnvelopePrc1, + EnvelopePrc2, + EnvelopePrc3, + EnvelopePrc4, + EnvelopePrc5, + EnvelopePrc6, + EnvelopePrc7, + EnvelopePrc8, + EnvelopePrc9, + EnvelopePrc10, + EnvelopeYou4, + AnsiA, + AnsiB, + EnvelopeC5, + EnvelopeDL, + Envelope10, + LastPageSize, + }; + + enum Unit + { + Millimeter, + Point, + Inch, + Pica, + Didot, + Cicero, + }; + + enum SizeMatchPolicy + { + FuzzyMatch, + FuzzyOrientationMatch, + ExactMatch, + }; + + QPageSize(); +%If (Qt_6_2_0 -) + QPageSize(QPageSize::PageSizeId pageSizeId); +%End +%If (- Qt_6_2_0) + explicit QPageSize(QPageSize::PageSizeId pageSizeId); +%End + QPageSize(const QSize &pointSize, const QString &name = QString(), QPageSize::SizeMatchPolicy matchPolicy = QPageSize::FuzzyMatch); + QPageSize(const QSizeF &size, QPageSize::Unit units, const QString &name = QString(), QPageSize::SizeMatchPolicy matchPolicy = QPageSize::FuzzyMatch); + QPageSize(const QPageSize &other); + ~QPageSize(); + void swap(QPageSize &other /Constrained/); + bool isEquivalentTo(const QPageSize &other) const; + bool isValid() const; + QString key() const; + QString name() const; + QPageSize::PageSizeId id() const; + int windowsId() const; + QSizeF definitionSize() const; + QPageSize::Unit definitionUnits() const; + QSizeF size(QPageSize::Unit units) const; + QSize sizePoints() const; + QSize sizePixels(int resolution) const; + QRectF rect(QPageSize::Unit units) const; + QRect rectPoints() const; + QRect rectPixels(int resolution) const; + static QString key(QPageSize::PageSizeId pageSizeId); + static QString name(QPageSize::PageSizeId pageSizeId); + static QPageSize::PageSizeId id(const QSize &pointSize, QPageSize::SizeMatchPolicy matchPolicy = QPageSize::FuzzyMatch); + static QPageSize::PageSizeId id(const QSizeF &size, QPageSize::Unit units, QPageSize::SizeMatchPolicy matchPolicy = QPageSize::FuzzyMatch); + static QPageSize::PageSizeId id(int windowsId); + static int windowsId(QPageSize::PageSizeId pageSizeId); + static QSizeF definitionSize(QPageSize::PageSizeId pageSizeId); + static QPageSize::Unit definitionUnits(QPageSize::PageSizeId pageSizeId); + static QSizeF size(QPageSize::PageSizeId pageSizeId, QPageSize::Unit units); + static QSize sizePoints(QPageSize::PageSizeId pageSizeId); + static QSize sizePixels(QPageSize::PageSizeId pageSizeId, int resolution); +}; + +bool operator==(const QPageSize &lhs, const QPageSize &rhs); +bool operator!=(const QPageSize &lhs, const QPageSize &rhs); diff --git a/sip/QtGui/qpaintdevice.sip b/sip/QtGui/qpaintdevice.sip new file mode 100644 index 0000000..0dac3cc --- /dev/null +++ b/sip/QtGui/qpaintdevice.sip @@ -0,0 +1,71 @@ +// qpaintdevice.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPaintDevice +{ +%TypeHeaderCode +#include +%End + +public: + enum PaintDeviceMetric + { + PdmWidth, + PdmHeight, + PdmWidthMM, + PdmHeightMM, + PdmNumColors, + PdmDepth, + PdmDpiX, + PdmDpiY, + PdmPhysicalDpiX, + PdmPhysicalDpiY, + PdmDevicePixelRatio, + PdmDevicePixelRatioScaled, + }; + + virtual ~QPaintDevice(); + virtual QPaintEngine *paintEngine() const = 0; + int width() const; + int height() const; + int widthMM() const; + int heightMM() const; + int logicalDpiX() const; + int logicalDpiY() const; + int physicalDpiX() const; + int physicalDpiY() const; + int depth() const; + bool paintingActive() const; + int colorCount() const; + qreal devicePixelRatio() const; + +protected: + QPaintDevice(); + virtual int metric(QPaintDevice::PaintDeviceMetric metric) const; + +public: + qreal devicePixelRatioF() const; + static qreal devicePixelRatioFScale(); + +private: + QPaintDevice(const QPaintDevice &); +}; diff --git a/sip/QtGui/qpaintdevicewindow.sip b/sip/QtGui/qpaintdevicewindow.sip new file mode 100644 index 0000000..77f6ca0 --- /dev/null +++ b/sip/QtGui/qpaintdevicewindow.sip @@ -0,0 +1,41 @@ +// qpaintdevicewindow.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPaintDeviceWindow : QWindow, QPaintDevice /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + void update(const QRect &rect); + void update(const QRegion ®ion); + +public slots: + void update(); + +protected: + virtual void paintEvent(QPaintEvent *event); + virtual int metric(QPaintDevice::PaintDeviceMetric metric) const; + virtual void exposeEvent(QExposeEvent *); + virtual bool event(QEvent *event); +}; diff --git a/sip/QtGui/qpaintengine.sip b/sip/QtGui/qpaintengine.sip new file mode 100644 index 0000000..7540e6e --- /dev/null +++ b/sip/QtGui/qpaintengine.sip @@ -0,0 +1,189 @@ +// qpaintengine.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextItem +{ +%TypeHeaderCode +#include +%End + +public: + enum RenderFlag /BaseType=Flag/ + { + RightToLeft, + Overline, + Underline, + StrikeOut, + }; + + typedef QFlags RenderFlags; + qreal descent() const; + qreal ascent() const; + qreal width() const; + QTextItem::RenderFlags renderFlags() const; + QString text() const; + QFont font() const; +}; + +class QPaintEngine +{ +%TypeHeaderCode +#include +%End + +public: + enum PaintEngineFeature /BaseType=Flag/ + { + PrimitiveTransform, + PatternTransform, + PixmapTransform, + PatternBrush, + LinearGradientFill, + RadialGradientFill, + ConicalGradientFill, + AlphaBlend, + PorterDuff, + PainterPaths, + Antialiasing, + BrushStroke, + ConstantOpacity, + MaskedBrush, + PaintOutsidePaintEvent, + PerspectiveTransform, + BlendModes, + ObjectBoundingModeGradients, + RasterOpModes, + AllFeatures, + }; + + typedef QFlags PaintEngineFeatures; + + enum DirtyFlag /BaseType=Flag/ + { + DirtyPen, + DirtyBrush, + DirtyBrushOrigin, + DirtyFont, + DirtyBackground, + DirtyBackgroundMode, + DirtyTransform, + DirtyClipRegion, + DirtyClipPath, + DirtyHints, + DirtyCompositionMode, + DirtyClipEnabled, + DirtyOpacity, + AllDirty, + }; + + typedef QFlags DirtyFlags; + + enum PolygonDrawMode + { + OddEvenMode, + WindingMode, + ConvexMode, + PolylineMode, + }; + + explicit QPaintEngine(QPaintEngine::PaintEngineFeatures features = QPaintEngine::PaintEngineFeatures()); + virtual ~QPaintEngine(); + bool isActive() const; + void setActive(bool newState); + virtual bool begin(QPaintDevice *pdev) = 0; + virtual bool end() = 0; + virtual void updateState(const QPaintEngineState &state /NoCopy/) = 0; + virtual void drawRects(const QRect *rects /Array/, int rectCount /ArraySize/); + virtual void drawRects(const QRectF *rects /Array/, int rectCount /ArraySize/); + virtual void drawLines(const QLine *lines /Array/, int lineCount /ArraySize/); + virtual void drawLines(const QLineF *lines /Array/, int lineCount /ArraySize/); + virtual void drawEllipse(const QRectF &r); + virtual void drawEllipse(const QRect &r); + virtual void drawPath(const QPainterPath &path); + virtual void drawPoints(const QPointF *points /Array/, int pointCount /ArraySize/); + virtual void drawPoints(const QPoint *points /Array/, int pointCount /ArraySize/); + virtual void drawPolygon(const QPointF *points /Array/, int pointCount /ArraySize/, QPaintEngine::PolygonDrawMode mode); + virtual void drawPolygon(const QPoint *points /Array/, int pointCount /ArraySize/, QPaintEngine::PolygonDrawMode mode); + virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) = 0; + virtual void drawTextItem(const QPointF &p, const QTextItem &textItem /NoCopy/); + virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s); + virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor); + void setPaintDevice(QPaintDevice *device); + QPaintDevice *paintDevice() const; + + enum Type + { + X11, + Windows, + QuickDraw, + CoreGraphics, + MacPrinter, + QWindowSystem, + OpenGL, + Picture, + SVG, + Raster, + Direct3D, + Pdf, + OpenVG, + OpenGL2, + PaintBuffer, + Blitter, + Direct2D, + User, + MaxUser, + }; + + virtual QPaintEngine::Type type() const = 0; + QPainter *painter() const; + bool hasFeature(QPaintEngine::PaintEngineFeatures feature) const; + +private: + QPaintEngine(const QPaintEngine &); +}; + +class QPaintEngineState +{ +%TypeHeaderCode +#include +%End + +public: + QPaintEngine::DirtyFlags state() const; + QPen pen() const; + QBrush brush() const; + QPointF brushOrigin() const; + QBrush backgroundBrush() const; + Qt::BGMode backgroundMode() const; + QFont font() const; + qreal opacity() const; + Qt::ClipOperation clipOperation() const; + QRegion clipRegion() const; + QPainterPath clipPath() const; + bool isClipEnabled() const; + QPainter::RenderHints renderHints() const; + QPainter::CompositionMode compositionMode() const; + QPainter *painter() const; + QTransform transform() const; + bool brushNeedsResolving() const; + bool penNeedsResolving() const; +}; diff --git a/sip/QtGui/qpainter.sip b/sip/QtGui/qpainter.sip new file mode 100644 index 0000000..45c0ba0 --- /dev/null +++ b/sip/QtGui/qpainter.sip @@ -0,0 +1,554 @@ +// qpainter.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPainter +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// Return an array on the heap of class instances extracted from a set of +// Python arguments. +template +static TYPE *qtgui_inst_array(const TYPE *first, PyObject *t, sipTypeDef *td) +{ + TYPE *arr = new TYPE[1 + PyTuple_Size(t)]; + + arr[0] = *first; + + for (Py_ssize_t i = 0; i < PyTuple_Size(t); ++i) + { + int iserr = 0, state; + TYPE *itm; + + itm = reinterpret_cast(sipForceConvertToType(PyTuple_GetItem(t, i), td, 0, SIP_NOT_NONE, &state, &iserr)); + + if (iserr) + { + sipReleaseType(itm, td, state); + + PyErr_Format(PyExc_TypeError, "each argument must be an instance of %s", sipPyTypeName(sipTypeAsPyTypeObject(td))); + + delete[] arr; + return 0; + } + + arr[1 + i] = *itm; + + sipReleaseType(itm, td, state); + } + + return arr; +} +%End + +public: + enum RenderHint /BaseType=Flag/ + { + Antialiasing, + TextAntialiasing, + SmoothPixmapTransform, + LosslessImageRendering, +%If (Qt_6_1_0 -) + VerticalSubpixelPositioning, +%End +%If (Qt_6_4_0 -) + NonCosmeticBrushPatterns, +%End + }; + + typedef QFlags RenderHints; + QPainter(); + explicit QPainter(QPaintDevice *); + ~QPainter(); + SIP_PYOBJECT __enter__(); +%MethodCode + // Check a device was passed. + if (sipCpp->isActive()) + { + // Just return a reference to self. + sipRes = sipSelf; + Py_INCREF(sipRes); + } + else + { + PyErr_SetString(PyExc_ValueError, "QPainter must be created with a device"); + sipRes = 0; + } +%End + + void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback); +%MethodCode + sipCpp->end(); +%End + + QPaintDevice *device() const; + bool begin(QPaintDevice *); + bool end(); + bool isActive() const; + + enum CompositionMode + { + CompositionMode_SourceOver, + CompositionMode_DestinationOver, + CompositionMode_Clear, + CompositionMode_Source, + CompositionMode_Destination, + CompositionMode_SourceIn, + CompositionMode_DestinationIn, + CompositionMode_SourceOut, + CompositionMode_DestinationOut, + CompositionMode_SourceAtop, + CompositionMode_DestinationAtop, + CompositionMode_Xor, + CompositionMode_Plus, + CompositionMode_Multiply, + CompositionMode_Screen, + CompositionMode_Overlay, + CompositionMode_Darken, + CompositionMode_Lighten, + CompositionMode_ColorDodge, + CompositionMode_ColorBurn, + CompositionMode_HardLight, + CompositionMode_SoftLight, + CompositionMode_Difference, + CompositionMode_Exclusion, + RasterOp_SourceOrDestination, + RasterOp_SourceAndDestination, + RasterOp_SourceXorDestination, + RasterOp_NotSourceAndNotDestination, + RasterOp_NotSourceOrNotDestination, + RasterOp_NotSourceXorDestination, + RasterOp_NotSource, + RasterOp_NotSourceAndDestination, + RasterOp_SourceAndNotDestination, + RasterOp_NotSourceOrDestination, + RasterOp_SourceOrNotDestination, + RasterOp_ClearDestination, + RasterOp_SetDestination, + RasterOp_NotDestination, + }; + + void setCompositionMode(QPainter::CompositionMode mode); + QPainter::CompositionMode compositionMode() const; + const QFont &font() const; + void setFont(const QFont &f); + QFontMetrics fontMetrics() const; + QFontInfo fontInfo() const; + void setPen(const QColor &color); + void setPen(const QPen &pen); + void setPen(Qt::PenStyle style); + const QPen &pen() const; + void setBrush(const QBrush &brush); + void setBrush(Qt::BrushStyle style); + const QBrush &brush() const; + void setBackgroundMode(Qt::BGMode mode); + Qt::BGMode backgroundMode() const; + QPoint brushOrigin() const; + void setBrushOrigin(const QPointF &); + void setBackground(const QBrush &bg); + const QBrush &background() const; + QRegion clipRegion() const; + QPainterPath clipPath() const; + void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation = Qt::ReplaceClip); + void setClipRegion(const QRegion ®ion, Qt::ClipOperation operation = Qt::ReplaceClip); + void setClipPath(const QPainterPath &path, Qt::ClipOperation operation = Qt::ReplaceClip); + void setClipping(bool enable); + bool hasClipping() const; + void save(); + void restore(); + void scale(qreal sx, qreal sy); + void shear(qreal sh, qreal sv); + void rotate(qreal a); + void translate(const QPointF &offset); + QRect window() const; + void setWindow(const QRect &window); + QRect viewport() const; + void setViewport(const QRect &viewport); + void setViewTransformEnabled(bool enable); + bool viewTransformEnabled() const; + void strokePath(const QPainterPath &path, const QPen &pen); + void fillPath(const QPainterPath &path, const QBrush &brush); + void drawPath(const QPainterPath &path); + void drawPoints(const QPolygonF &points); + void drawPoints(const QPolygon &points); + void drawPoints(const QPointF *points /Array/, int pointCount /ArraySize/); + void drawPoints(const QPointF *point, ... /TypeHint="QPointF"/); +%MethodCode + QPointF *points = qtgui_inst_array(a0, a1, sipType_QPointF); + + if (points) + { + sipCpp->drawPoints(points, 1 + PyTuple_Size(a1)); + delete[] points; + } + else + sipIsErr = 1; +%End + + void drawPoints(const QPoint *points /Array/, int pointCount /ArraySize/); + void drawPoints(const QPoint *point, ... /TypeHint="QPoint"/); +%MethodCode + QPoint *points = qtgui_inst_array(a0, a1, sipType_QPoint); + + if (points) + { + sipCpp->drawPoints(points, 1 + PyTuple_Size(a1)); + delete[] points; + } + else + sipIsErr = 1; +%End + + void drawLines(const QLineF *lines /Array/, int lineCount /ArraySize/); + void drawLines(const QLineF *line, ... /TypeHint="QLineF"/); +%MethodCode + QLineF *lines = qtgui_inst_array(a0, a1, sipType_QLineF); + + if (lines) + { + sipCpp->drawLines(lines, 1 + PyTuple_Size(a1)); + delete[] lines; + } + else + sipIsErr = 1; +%End + + void drawLines(const QPointF *pointPairs /Array/, int lineCount /ArraySize/); +%MethodCode + sipCpp->drawLines(a0, a1 / 2); +%End + + void drawLines(const QPointF *pointPair, ... /TypeHint="QPointF"/); +%MethodCode + QPointF *pairs = qtgui_inst_array(a0, a1, sipType_QPointF); + + if (pairs) + { + sipCpp->drawLines(pairs, (1 + PyTuple_Size(a1)) / 2); + delete[] pairs; + } + else + sipIsErr = 1; +%End + + void drawLines(const QLine *lines /Array/, int lineCount /ArraySize/); + void drawLines(const QLine *line, ... /TypeHint="QLine"/); +%MethodCode + QLine *lines = qtgui_inst_array(a0, a1, sipType_QLine); + + if (lines) + { + sipCpp->drawLines(lines, 1 + PyTuple_Size(a1)); + delete[] lines; + } + else + sipIsErr = 1; +%End + + void drawLines(const QPoint *pointPairs /Array/, int lineCount /ArraySize/); +%MethodCode + sipCpp->drawLines(a0, a1 / 2); +%End + + void drawLines(const QPoint *pointPair, ... /TypeHint="QPoint"/); +%MethodCode + QPoint *pairs = qtgui_inst_array(a0, a1, sipType_QPoint); + + if (pairs) + { + sipCpp->drawLines(pairs, (1 + PyTuple_Size(a1)) / 2); + delete[] pairs; + } + else + sipIsErr = 1; +%End + + void drawRects(const QRectF *rects /Array/, int rectCount /ArraySize/); + void drawRects(const QRectF *rect, ... /TypeHint="QRectF"/); +%MethodCode + QRectF *rects = qtgui_inst_array(a0, a1, sipType_QRectF); + + if (rects) + { + sipCpp->drawRects(rects, 1 + PyTuple_Size(a1)); + delete[] rects; + } + else + sipIsErr = 1; +%End + + void drawRects(const QRect *rects /Array/, int rectCount /ArraySize/); + void drawRects(const QRect *rect, ... /TypeHint="QRect"/); +%MethodCode + QRect *rects = qtgui_inst_array(a0, a1, sipType_QRect); + + if (rects) + { + sipCpp->drawRects(rects, 1 + PyTuple_Size(a1)); + delete[] rects; + } + else + sipIsErr = 1; +%End + + void drawEllipse(const QRectF &r); + void drawEllipse(const QRect &r); + void drawPolyline(const QPolygonF &polyline); + void drawPolyline(const QPolygon &polyline); + void drawPolyline(const QPointF *points /Array/, int pointCount /ArraySize/); + void drawPolyline(const QPointF *point, ... /TypeHint="QPointF"/); +%MethodCode + QPointF *points = qtgui_inst_array(a0, a1, sipType_QPointF); + + if (points) + { + sipCpp->drawPolyline(points, 1 + PyTuple_Size(a1)); + delete[] points; + } + else + sipIsErr = 1; +%End + + void drawPolyline(const QPoint *points /Array/, int pointCount /ArraySize/); + void drawPolyline(const QPoint *point, ... /TypeHint="QPoint"/); +%MethodCode + QPoint *points = qtgui_inst_array(a0, a1, sipType_QPoint); + + if (points) + { + sipCpp->drawPolyline(points, 1 + PyTuple_Size(a1)); + delete[] points; + } + else + sipIsErr = 1; +%End + + void drawPolygon(const QPolygonF &points, Qt::FillRule fillRule = Qt::OddEvenFill); + void drawPolygon(const QPolygon &points, Qt::FillRule fillRule = Qt::OddEvenFill); + void drawPolygon(const QPointF *points /Array/, int pointCount /ArraySize/, Qt::FillRule fillRule = Qt::OddEvenFill); + void drawPolygon(const QPointF *point, ... /TypeHint="QPointF"/); +%MethodCode + QPointF *points = qtgui_inst_array(a0, a1, sipType_QPointF); + + if (points) + { + sipCpp->drawPolygon(points, 1 + PyTuple_Size(a1)); + delete[] points; + } + else + sipIsErr = 1; +%End + + void drawPolygon(const QPoint *points /Array/, int pointCount /ArraySize/, Qt::FillRule fillRule = Qt::OddEvenFill); + void drawPolygon(const QPoint *point, ... /TypeHint="QPoint"/); +%MethodCode + QPoint *points = qtgui_inst_array(a0, a1, sipType_QPoint); + + if (points) + { + sipCpp->drawPolygon(points, 1 + PyTuple_Size(a1)); + delete[] points; + } + else + sipIsErr = 1; +%End + + void drawConvexPolygon(const QPolygonF &poly); + void drawConvexPolygon(const QPolygon &poly); + void drawConvexPolygon(const QPointF *points /Array/, int pointCount /ArraySize/); + void drawConvexPolygon(const QPointF *point, ... /TypeHint="QPointF"/); +%MethodCode + QPointF *points = qtgui_inst_array(a0, a1, sipType_QPointF); + + if (points) + { + sipCpp->drawConvexPolygon(points, 1 + PyTuple_Size(a1)); + delete[] points; + } + else + sipIsErr = 1; +%End + + void drawConvexPolygon(const QPoint *points /Array/, int pointCount /ArraySize/); + void drawConvexPolygon(const QPoint *point, ... /TypeHint="QPoint"/); +%MethodCode + QPoint *points = qtgui_inst_array(a0, a1, sipType_QPoint); + + if (points) + { + sipCpp->drawConvexPolygon(points, 1 + PyTuple_Size(a1)); + delete[] points; + } + else + sipIsErr = 1; +%End + + void drawArc(const QRectF &rect, int a, int alen); + void drawPie(const QRectF &rect, int a, int alen); + void drawChord(const QRectF &rect, int a, int alen); + void drawTiledPixmap(const QRectF &rectangle, const QPixmap &pixmap, const QPointF &pos = QPointF()); + void drawPicture(const QPointF &p, const QPicture &picture); + void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect); + void setLayoutDirection(Qt::LayoutDirection direction); + Qt::LayoutDirection layoutDirection() const; + void drawText(const QPointF &p, const QString &s); + void drawText(const QRectF &rectangle, int flags, const QString &text, QRectF *boundingRect /Out/ = 0); + void drawText(const QRect &rectangle, int flags, const QString &text, QRect *boundingRect /Out/ = 0); + void drawText(const QRectF &rectangle, const QString &text, const QTextOption &option = QTextOption()); + QRectF boundingRect(const QRectF &rect, int flags, const QString &text); + QRect boundingRect(const QRect &rect, int flags, const QString &text); + QRectF boundingRect(const QRectF &rectangle, const QString &text, const QTextOption &option = QTextOption()); + void fillRect(const QRectF &, const QBrush &); + void fillRect(const QRect &, const QBrush &); + void eraseRect(const QRectF &); + void setRenderHint(QPainter::RenderHint hint, bool on = true); + QPainter::RenderHints renderHints() const; + void setRenderHints(QPainter::RenderHints hints, bool on = true); + QPaintEngine *paintEngine() const; + void drawLine(const QLineF &l); + void drawLine(const QLine &line); + void drawLine(int x1, int y1, int x2, int y2); + void drawLine(const QPoint &p1, const QPoint &p2); + void drawLine(const QPointF &p1, const QPointF &p2); + void drawRect(const QRectF &rect); + void drawRect(int x, int y, int w, int h); + void drawRect(const QRect &r); + void drawPoint(const QPointF &p); + void drawPoint(int x, int y); + void drawPoint(const QPoint &p); + void drawEllipse(int x, int y, int w, int h); + void drawArc(const QRect &r, int a, int alen); + void drawArc(int x, int y, int w, int h, int a, int alen); + void drawPie(const QRect &rect, int a, int alen); + void drawPie(int x, int y, int w, int h, int a, int alen); + void drawChord(const QRect &rect, int a, int alen); + void drawChord(int x, int y, int w, int h, int a, int alen); + void setClipRect(int x, int y, int width, int height, Qt::ClipOperation operation = Qt::ReplaceClip); + void setClipRect(const QRect &rectangle, Qt::ClipOperation operation = Qt::ReplaceClip); + void eraseRect(const QRect &rect); + void eraseRect(int x, int y, int w, int h); + void fillRect(int x, int y, int w, int h, const QBrush &b); + void setBrushOrigin(int x, int y); + void setBrushOrigin(const QPoint &p); + void drawTiledPixmap(const QRect &rectangle, const QPixmap &pixmap, const QPoint &pos = QPoint()); + void drawTiledPixmap(int x, int y, int width, int height, const QPixmap &pixmap, int sx = 0, int sy = 0); + void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect); + void drawPixmap(const QPointF &p, const QPixmap &pm); + void drawPixmap(const QPoint &p, const QPixmap &pm); + void drawPixmap(const QRect &r, const QPixmap &pm); + void drawPixmap(int x, int y, const QPixmap &pm); + void drawPixmap(int x, int y, int w, int h, const QPixmap &pm); + void drawPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy, int sw, int sh); + void drawPixmap(int x, int y, const QPixmap &pm, int sx, int sy, int sw, int sh); + void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr); + void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr); + void drawImage(const QRectF &r, const QImage &image); + void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor); + void drawImage(const QRect &r, const QImage &image); + void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor); + void drawImage(const QPointF &p, const QImage &image); + void drawImage(const QPointF &p, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor); + void drawImage(const QPoint &p, const QImage &image); + void drawImage(const QPoint &p, const QImage &image, const QRect &sr, Qt::ImageConversionFlags flags = Qt::AutoColor); + void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0, int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor); + void drawText(const QPoint &p, const QString &s); + void drawText(int x, int y, int width, int height, int flags, const QString &text, QRect *boundingRect /Out/ = 0); + void drawText(int x, int y, const QString &s); + QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text); + qreal opacity() const; + void setOpacity(qreal opacity); + void translate(qreal dx, qreal dy); + void translate(const QPoint &offset); + void setViewport(int x, int y, int w, int h); + void setWindow(int x, int y, int w, int h); + bool worldMatrixEnabled() const; + void setWorldMatrixEnabled(bool enabled); + void drawPicture(int x, int y, const QPicture &p); + void drawPicture(const QPoint &pt, const QPicture &p); + void setTransform(const QTransform &transform, bool combine = false); + const QTransform &transform() const; + const QTransform &deviceTransform() const; + void resetTransform(); + void setWorldTransform(const QTransform &matrix, bool combine = false); + const QTransform &worldTransform() const; + QTransform combinedTransform() const; + bool testRenderHint(QPainter::RenderHint hint) const; + void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize); + void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize); + void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize); + void drawEllipse(const QPointF ¢er, qreal rx, qreal ry); + void drawEllipse(const QPoint ¢er, int rx, int ry); + void fillRect(const QRectF &, const QColor &color); + void fillRect(const QRect &, const QColor &color); + void fillRect(int x, int y, int w, int h, const QColor &b); + void fillRect(int x, int y, int w, int h, Qt::GlobalColor c); + void fillRect(const QRect &r, Qt::GlobalColor c); + void fillRect(const QRectF &r, Qt::GlobalColor c); + void fillRect(int x, int y, int w, int h, Qt::BrushStyle style); + void fillRect(const QRect &r, Qt::BrushStyle style); + void fillRect(const QRectF &r, Qt::BrushStyle style); + void beginNativePainting(); + void endNativePainting(); + + class PixmapFragment + { +%TypeHeaderCode +#include +%End + + public: + qreal x; + qreal y; + qreal sourceLeft; + qreal sourceTop; + qreal width; + qreal height; + qreal scaleX; + qreal scaleY; + qreal rotation; + qreal opacity; + static QPainter::PixmapFragment create(const QPointF &pos, const QRectF &sourceRect, qreal scaleX = 1, qreal scaleY = 1, qreal rotation = 0, qreal opacity = 1) /Factory/; + }; + + enum PixmapFragmentHint /BaseType=Flag/ + { + OpaqueHint, + }; + + typedef QFlags PixmapFragmentHints; + void drawPixmapFragments(const QPainter::PixmapFragment *fragments /Array/, int fragmentCount /ArraySize/, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints = QPainter::PixmapFragmentHints()); + void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText); + void drawStaticText(const QPoint &p, const QStaticText &staticText); + void drawStaticText(int x, int y, const QStaticText &staticText); + QRectF clipBoundingRect() const; +%If (PyQt_RawFont) + void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun); +%End + void fillRect(int x, int y, int w, int h, QGradient::Preset preset); + void fillRect(const QRect &r, QGradient::Preset preset); + void fillRect(const QRectF &r, QGradient::Preset preset); + +private: + QPainter(const QPainter &); +}; diff --git a/sip/QtGui/qpainterpath.sip b/sip/QtGui/qpainterpath.sip new file mode 100644 index 0000000..2d7378d --- /dev/null +++ b/sip/QtGui/qpainterpath.sip @@ -0,0 +1,165 @@ +// qpainterpath.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPainterPath +{ +%TypeHeaderCode +#include +%End + +public: + enum ElementType + { + MoveToElement, + LineToElement, + CurveToElement, + CurveToDataElement, + }; + + class Element + { +%TypeHeaderCode +#include +%End + + public: + qreal x; + qreal y; + QPainterPath::ElementType type; + bool isMoveTo() const; + bool isLineTo() const; + bool isCurveTo() const; + bool operator==(const QPainterPath::Element &e) const; + bool operator!=(const QPainterPath::Element &e) const; + operator QPointF() const; + }; + + QPainterPath(); + explicit QPainterPath(const QPointF &startPoint); + QPainterPath(const QPainterPath &other); + ~QPainterPath(); + void closeSubpath(); + void moveTo(const QPointF &p); + void lineTo(const QPointF &p); + void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength); + void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt); + void quadTo(const QPointF &ctrlPt, const QPointF &endPt); + QPointF currentPosition() const; + void addRect(const QRectF &rect); + void addEllipse(const QRectF &rect); + void addPolygon(const QPolygonF &polygon); + void addText(const QPointF &point, const QFont &f, const QString &text); + void addPath(const QPainterPath &path); + void addRegion(const QRegion ®ion); + void connectPath(const QPainterPath &path); + bool contains(const QPointF &pt) const; + bool contains(const QRectF &rect) const; + bool intersects(const QRectF &rect) const; + QRectF boundingRect() const; + QRectF controlPointRect() const; + Qt::FillRule fillRule() const; + void setFillRule(Qt::FillRule fillRule); + QPainterPath toReversed() const; + QList toSubpathPolygons(const QTransform &matrix = QTransform()) const; + QList toFillPolygons(const QTransform &matrix = QTransform()) const; + QPolygonF toFillPolygon(const QTransform &matrix = QTransform()) const; + bool operator==(const QPainterPath &other) const; + bool operator!=(const QPainterPath &other) const; + void moveTo(qreal x, qreal y); + void arcMoveTo(const QRectF &rect, qreal angle); + void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle); + void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLenght); + void lineTo(qreal x, qreal y); + void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y, qreal endPtx, qreal endPty); + void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty); + void addEllipse(qreal x, qreal y, qreal w, qreal h); + void addRect(qreal x, qreal y, qreal w, qreal h); + void addText(qreal x, qreal y, const QFont &f, const QString &text); + bool isEmpty() const; + int elementCount() const; + QPainterPath::Element elementAt(int i) const; + void setElementPositionAt(int i, qreal x, qreal y); + qreal length() const; + qreal percentAtLength(qreal t) const; + QPointF pointAtPercent(qreal t) const; + qreal angleAtPercent(qreal t) const; + qreal slopeAtPercent(qreal t) const; + bool intersects(const QPainterPath &p) const; + bool contains(const QPainterPath &p) const; + QPainterPath united(const QPainterPath &r) const; + QPainterPath intersected(const QPainterPath &r) const; + QPainterPath subtracted(const QPainterPath &r) const; + void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize); + void addRoundedRect(qreal x, qreal y, qreal w, qreal h, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize); + void addEllipse(const QPointF ¢er, qreal rx, qreal ry); + QPainterPath simplified() const; + QPainterPath operator&(const QPainterPath &other) const; + QPainterPath operator|(const QPainterPath &other) const; + QPainterPath operator+(const QPainterPath &other) const; + QPainterPath operator-(const QPainterPath &other) const; + QPainterPath &operator&=(const QPainterPath &other); + QPainterPath &operator|=(const QPainterPath &other); + QPainterPath &operator+=(const QPainterPath &other); + QPainterPath &operator-=(const QPainterPath &other); + void translate(qreal dx, qreal dy); + QPainterPath translated(qreal dx, qreal dy) const; + void translate(const QPointF &offset); + QPainterPath translated(const QPointF &offset) const; + void swap(QPainterPath &other /Constrained/); + void clear(); + void reserve(int size); + int capacity() const; +}; + +QDataStream &operator<<(QDataStream &, const QPainterPath &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QPainterPath & /Constrained/) /ReleaseGIL/; + +class QPainterPathStroker +{ +%TypeHeaderCode +#include +%End + +public: + QPainterPathStroker(); + explicit QPainterPathStroker(const QPen &pen); + ~QPainterPathStroker(); + void setWidth(qreal width); + qreal width() const; + void setCapStyle(Qt::PenCapStyle style); + Qt::PenCapStyle capStyle() const; + void setJoinStyle(Qt::PenJoinStyle style); + Qt::PenJoinStyle joinStyle() const; + void setMiterLimit(qreal length); + qreal miterLimit() const; + void setCurveThreshold(qreal threshold); + qreal curveThreshold() const; + void setDashPattern(Qt::PenStyle); + void setDashPattern(const QList &dashPattern); + QList dashPattern() const; + QPainterPath createStroke(const QPainterPath &path) const; + void setDashOffset(qreal offset); + qreal dashOffset() const; + +private: + QPainterPathStroker(const QPainterPathStroker &); +}; diff --git a/sip/QtGui/qpalette.sip b/sip/QtGui/qpalette.sip new file mode 100644 index 0000000..d412b8f --- /dev/null +++ b/sip/QtGui/qpalette.sip @@ -0,0 +1,125 @@ +// qpalette.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPalette +{ +%TypeHeaderCode +#include +%End + +public: + QPalette(); + QPalette(const QColor &button); + QPalette(Qt::GlobalColor button); + QPalette(const QColor &button, const QColor &background); + QPalette(const QBrush &foreground, const QBrush &button, const QBrush &light, const QBrush &dark, const QBrush &mid, const QBrush &text, const QBrush &bright_text, const QBrush &base, const QBrush &background); + QPalette(const QPalette &palette); + QPalette(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QPalette(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + ~QPalette(); + + enum ColorGroup + { + Active, + Disabled, + Inactive, + NColorGroups, + Current, + All, + Normal, + }; + + enum ColorRole + { + WindowText, + Button, + Light, + Midlight, + Dark, + Mid, + Text, + BrightText, + ButtonText, + Base, + Window, + Shadow, + Highlight, + HighlightedText, + Link, + LinkVisited, + AlternateBase, + ToolTipBase, + ToolTipText, + PlaceholderText, + NoRole, + NColorRoles, + }; + + QPalette::ColorGroup currentColorGroup() const; + void setCurrentColorGroup(QPalette::ColorGroup cg); + const QColor &color(QPalette::ColorGroup cg, QPalette::ColorRole cr) const; + const QBrush &brush(QPalette::ColorGroup cg, QPalette::ColorRole cr) const; + void setBrush(QPalette::ColorGroup cg, QPalette::ColorRole cr, const QBrush &brush); + void setColorGroup(QPalette::ColorGroup cr, const QBrush &foreground, const QBrush &button, const QBrush &light, const QBrush &dark, const QBrush &mid, const QBrush &text, const QBrush &bright_text, const QBrush &base, const QBrush &background); + bool isEqual(QPalette::ColorGroup cr1, QPalette::ColorGroup cr2) const; + const QColor &color(QPalette::ColorRole cr) const; + const QBrush &brush(QPalette::ColorRole cr) const; + const QBrush &windowText() const; + const QBrush &button() const; + const QBrush &light() const; + const QBrush &dark() const; + const QBrush &mid() const; + const QBrush &text() const; + const QBrush &base() const; + const QBrush &alternateBase() const; + const QBrush &window() const; + const QBrush &midlight() const; + const QBrush &brightText() const; + const QBrush &buttonText() const; + const QBrush &shadow() const; + const QBrush &highlight() const; + const QBrush &highlightedText() const; + const QBrush &link() const; + const QBrush &linkVisited() const; + const QBrush &toolTipBase() const; + const QBrush &toolTipText() const; + const QBrush &placeholderText() const; + bool operator==(const QPalette &p) const; + bool operator!=(const QPalette &p) const; + bool isCopyOf(const QPalette &p) const; + QPalette resolve(const QPalette &) const; + void setColor(QPalette::ColorGroup acg, QPalette::ColorRole acr, const QColor &acolor); + void setColor(QPalette::ColorRole acr, const QColor &acolor); + void setBrush(QPalette::ColorRole acr, const QBrush &abrush); + bool isBrushSet(QPalette::ColorGroup cg, QPalette::ColorRole cr) const; + qint64 cacheKey() const; + void swap(QPalette &other /Constrained/); +}; + +QDataStream &operator<<(QDataStream &s, const QPalette &p) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &ds, QPalette &p /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qpdfwriter.sip b/sip/QtGui/qpdfwriter.sip new file mode 100644 index 0000000..033c8a0 --- /dev/null +++ b/sip/QtGui/qpdfwriter.sip @@ -0,0 +1,51 @@ +// qpdfwriter.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfWriter : QObject, QPagedPaintDevice +{ +%TypeHeaderCode +#include +%End + +public: + explicit QPdfWriter(const QString &filename); + explicit QPdfWriter(QIODevice *device); + virtual ~QPdfWriter(); + QString title() const; + void setTitle(const QString &title); + QString creator() const; + void setCreator(const QString &creator); + virtual bool newPage(); + +protected: + virtual QPaintEngine *paintEngine() const; + virtual int metric(QPaintDevice::PaintDeviceMetric id) const; + +public: + void setResolution(int resolution); + int resolution() const; + void setPdfVersion(QPagedPaintDevice::PdfVersion version); + QPagedPaintDevice::PdfVersion pdfVersion() const; + void setDocumentXmpMetadata(const QByteArray &xmpMetadata); + QByteArray documentXmpMetadata() const; + void addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType = QString()); +}; diff --git a/sip/QtGui/qpen.sip b/sip/QtGui/qpen.sip new file mode 100644 index 0000000..33504a9 --- /dev/null +++ b/sip/QtGui/qpen.sip @@ -0,0 +1,103 @@ +// qpen.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPen /TypeHintIn="Union[QPen, QColor]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +// SIP doesn't support automatic type convertors so we explicitly allow a +// QColor to be used whenever a QPen is expected. + +if (sipIsErr == NULL) + return (sipCanConvertToType(sipPy, sipType_QPen, SIP_NO_CONVERTORS) || + sipCanConvertToType(sipPy, sipType_QColor, 0)); + +if (sipCanConvertToType(sipPy, sipType_QPen, SIP_NO_CONVERTORS)) +{ + *sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, sipType_QPen, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + + return 0; +} + +int state; +QColor *c = reinterpret_cast(sipConvertToType(sipPy, sipType_QColor, 0, 0, &state, sipIsErr)); + +if (*sipIsErr) +{ + sipReleaseType(c, sipType_QColor, state); + return 0; +} + +*sipCppPtr = new QPen(*c); + +sipReleaseType(c, sipType_QColor, state); + +return sipGetState(sipTransferObj); +%End + +public: + QPen(); + QPen(Qt::PenStyle); + QPen(const QBrush &brush, qreal width, Qt::PenStyle style = Qt::SolidLine, Qt::PenCapStyle cap = Qt::SquareCap, Qt::PenJoinStyle join = Qt::BevelJoin); + QPen(const QPen &pen); + QPen(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QPen(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + ~QPen(); + Qt::PenStyle style() const; + void setStyle(Qt::PenStyle); + qreal widthF() const; + void setWidthF(qreal width); + int width() const; + void setWidth(int width); + QColor color() const; + void setColor(const QColor &color); + QBrush brush() const; + void setBrush(const QBrush &brush); + bool isSolid() const; + Qt::PenCapStyle capStyle() const; + void setCapStyle(Qt::PenCapStyle pcs); + Qt::PenJoinStyle joinStyle() const; + void setJoinStyle(Qt::PenJoinStyle pcs); + QList dashPattern() const; + void setDashPattern(const QList &pattern); + qreal miterLimit() const; + void setMiterLimit(qreal limit); + bool operator==(const QPen &p) const; + bool operator!=(const QPen &p) const; + qreal dashOffset() const; + void setDashOffset(qreal doffset); + bool isCosmetic() const; + void setCosmetic(bool cosmetic); + void swap(QPen &other /Constrained/); +}; + +QDataStream &operator<<(QDataStream &, const QPen &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QPen & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qpicture.sip b/sip/QtGui/qpicture.sip new file mode 100644 index 0000000..fb23e76 --- /dev/null +++ b/sip/QtGui/qpicture.sip @@ -0,0 +1,57 @@ +// qpicture.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPicture : QPaintDevice +{ +%TypeHeaderCode +#include +%End + +public: + explicit QPicture(int formatVersion = -1); + QPicture(const QPicture &); + virtual ~QPicture(); + bool isNull() const; + virtual int devType() const; + uint size() const; + const char *data() const /Encoding="None"/; + virtual void setData(const char *data /Array/, uint size /ArraySize/); + bool play(QPainter *p); + bool load(const QString &fileName) /ReleaseGIL/; + bool load(QIODevice *dev) /ReleaseGIL/; + bool save(const QString &fileName) /ReleaseGIL/; + bool save(QIODevice *dev) /ReleaseGIL/; + QRect boundingRect() const; + void setBoundingRect(const QRect &r); + void detach(); + bool isDetached() const; + virtual QPaintEngine *paintEngine() const; + +protected: + virtual int metric(QPaintDevice::PaintDeviceMetric m) const; + +public: + void swap(QPicture &other /Constrained/); +}; + +QDataStream &operator<<(QDataStream &in, const QPicture &p) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &in, QPicture &p /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qpixelformat.sip b/sip/QtGui/qpixelformat.sip new file mode 100644 index 0000000..d617615 --- /dev/null +++ b/sip/QtGui/qpixelformat.sip @@ -0,0 +1,134 @@ +// qpixelformat.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QPixelFormat +{ +%TypeHeaderCode +#include +%End + +public: + enum ColorModel + { + RGB, + BGR, + Indexed, + Grayscale, + CMYK, + HSL, + HSV, + YUV, + Alpha, + }; + + enum AlphaUsage + { + UsesAlpha, + IgnoresAlpha, + }; + + enum AlphaPosition + { + AtBeginning, + AtEnd, + }; + + enum AlphaPremultiplied + { + NotPremultiplied, + Premultiplied, + }; + + enum TypeInterpretation + { + UnsignedInteger, + UnsignedShort, + UnsignedByte, + FloatingPoint, + }; + + enum YUVLayout + { + YUV444, + YUV422, + YUV411, + YUV420P, + YUV420SP, + YV12, + UYVY, + YUYV, + NV12, + NV21, + IMC1, + IMC2, + IMC3, + IMC4, + Y8, + Y16, + }; + + enum ByteOrder + { + LittleEndian, + BigEndian, + CurrentSystemEndian, + }; + + QPixelFormat(); + QPixelFormat(QPixelFormat::ColorModel mdl, uchar firstSize /PyInt/, uchar secondSize /PyInt/, uchar thirdSize /PyInt/, uchar fourthSize /PyInt/, uchar fifthSize /PyInt/, uchar alfa /PyInt/, QPixelFormat::AlphaUsage usage, QPixelFormat::AlphaPosition position, QPixelFormat::AlphaPremultiplied premult, QPixelFormat::TypeInterpretation typeInterp, QPixelFormat::ByteOrder byteOrder = QPixelFormat::CurrentSystemEndian, uchar subEnum /PyInt/ = 0); + QPixelFormat::ColorModel colorModel() const; + uchar channelCount() const /PyInt/; + uchar redSize() const /PyInt/; + uchar greenSize() const /PyInt/; + uchar blueSize() const /PyInt/; + uchar cyanSize() const /PyInt/; + uchar magentaSize() const /PyInt/; + uchar yellowSize() const /PyInt/; + uchar blackSize() const /PyInt/; + uchar hueSize() const /PyInt/; + uchar saturationSize() const /PyInt/; + uchar lightnessSize() const /PyInt/; + uchar brightnessSize() const /PyInt/; + uchar alphaSize() const /PyInt/; + uchar bitsPerPixel() const /PyInt/; + QPixelFormat::AlphaUsage alphaUsage() const; + QPixelFormat::AlphaPosition alphaPosition() const; + QPixelFormat::AlphaPremultiplied premultiplied() const; + QPixelFormat::TypeInterpretation typeInterpretation() const; + QPixelFormat::ByteOrder byteOrder() const; + QPixelFormat::YUVLayout yuvLayout() const; + uchar subEnum() const /PyInt/; +}; + +bool operator==(QPixelFormat fmt1, QPixelFormat fmt2); +bool operator!=(QPixelFormat fmt1, QPixelFormat fmt2); +QPixelFormat qPixelFormatRgba(uchar red /PyInt/, uchar green /PyInt/, uchar blue /PyInt/, uchar alfa /PyInt/, QPixelFormat::AlphaUsage usage, QPixelFormat::AlphaPosition position, QPixelFormat::AlphaPremultiplied premultiplied = QPixelFormat::NotPremultiplied, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger); +QPixelFormat qPixelFormatGrayscale(uchar channelSize /PyInt/, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger); +QPixelFormat qPixelFormatCmyk(uchar channelSize /PyInt/, uchar alphaSize /PyInt/ = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger); +QPixelFormat qPixelFormatHsl(uchar channelSize /PyInt/, uchar alphaSize /PyInt/ = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::FloatingPoint); +QPixelFormat qPixelFormatHsv(uchar channelSize /PyInt/, uchar alphaSize /PyInt/ = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::FloatingPoint); +QPixelFormat qPixelFormatYuv(QPixelFormat::YUVLayout layout, uchar alphaSize /PyInt/ = 0, QPixelFormat::AlphaUsage alphaUsage = QPixelFormat::IgnoresAlpha, QPixelFormat::AlphaPosition alphaPosition = QPixelFormat::AtBeginning, QPixelFormat::AlphaPremultiplied premultiplied = QPixelFormat::NotPremultiplied, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedByte, QPixelFormat::ByteOrder byteOrder = QPixelFormat::LittleEndian); +QPixelFormat qPixelFormatAlpha(uchar channelSize /PyInt/, QPixelFormat::TypeInterpretation typeInterpretation = QPixelFormat::UnsignedInteger); diff --git a/sip/QtGui/qpixmap.sip b/sip/QtGui/qpixmap.sip new file mode 100644 index 0000000..a328e70 --- /dev/null +++ b/sip/QtGui/qpixmap.sip @@ -0,0 +1,111 @@ +// qpixmap.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPixmap : QPaintDevice +{ +%TypeHeaderCode +#include +%End + +public: + QPixmap(); + QPixmap(int w, int h); + explicit QPixmap(const QSize &); + QPixmap(const QString &fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + explicit QPixmap(SIP_PYLIST xpm /TypeHint="List[str]"/) [(const char * const *xpm)]; +%MethodCode + // The Python interface is a list of ASCII strings that make up the image. + + const char **str = QtGui_ListToArray(a0); + + if (str) + { + sipCpp = new sipQPixmap(str); + QtGui_DeleteArray(str); + } + else + sipIsErr = 1; +%End + + QPixmap(const QPixmap &); + QPixmap(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new sipQPixmap(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + virtual ~QPixmap(); + bool isNull() const; + virtual int devType() const; + int width() const; + int height() const; + QSize size() const; + QRect rect() const; + int depth() const; + static int defaultDepth(); + void fill(const QColor &color = Qt::white); + QBitmap mask() const; + void setMask(const QBitmap &); + bool hasAlpha() const; + bool hasAlphaChannel() const; + QBitmap createHeuristicMask(bool clipTight = true) const; + QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode = Qt::MaskInColor) const; + QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const; + QPixmap scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const; + QPixmap scaledToWidth(int width, Qt::TransformationMode mode = Qt::FastTransformation) const; + QPixmap scaledToHeight(int height, Qt::TransformationMode mode = Qt::FastTransformation) const; + QImage toImage() const; + static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); + static QPixmap fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool convertFromImage(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool load(const QString &fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool loadFromData(const uchar *buf /Array/, uint len /ArraySize/, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool loadFromData(const QByteArray &buf, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); + bool save(const QString &fileName, const char *format = 0, int quality = -1) const; + bool save(QIODevice *device, const char *format = 0, int quality = -1) const; + QPixmap copy(const QRect &rect = QRect()) const; + void detach(); + bool isQBitmap() const; + virtual QPaintEngine *paintEngine() const; + +protected: + virtual int metric(QPaintDevice::PaintDeviceMetric) const; + +public: + QPixmap copy(int ax, int ay, int awidth, int aheight) const; + QPixmap transformed(const QTransform &transform, Qt::TransformationMode mode = Qt::FastTransformation) const; + static QTransform trueMatrix(const QTransform &m, int w, int h); + qint64 cacheKey() const; + void scroll(int dx, int dy, const QRect &rect, QRegion *exposed /Out/ = 0); + void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed /Out/ = 0); + void swap(QPixmap &other /Constrained/); + qreal devicePixelRatio() const; + void setDevicePixelRatio(qreal scaleFactor); +%If (Qt_6_2_0 -) + QSizeF deviceIndependentSize() const; +%End +}; + +QDataStream &operator<<(QDataStream &, const QPixmap &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QPixmap & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qpixmapcache.sip b/sip/QtGui/qpixmapcache.sip new file mode 100644 index 0000000..8ba4ed8 --- /dev/null +++ b/sip/QtGui/qpixmapcache.sip @@ -0,0 +1,76 @@ +// qpixmapcache.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPixmapCache +{ +%TypeHeaderCode +#include +%End + +public: + class Key + { +%TypeHeaderCode +#include +%End + + public: + Key(); + Key(const QPixmapCache::Key &other); + ~Key(); + bool operator==(const QPixmapCache::Key &key) const; + bool operator!=(const QPixmapCache::Key &key) const; + void swap(QPixmapCache::Key &other /Constrained/); + bool isValid() const; + }; + + static int cacheLimit(); + static void clear(); + static QPixmap find(const QString &key); +%MethodCode + sipRes = new QPixmap; + + if (!QPixmapCache::find(*a0, sipRes)) + { + delete sipRes; + sipRes = 0; + } +%End + + static QPixmap find(const QPixmapCache::Key &key); +%MethodCode + sipRes = new QPixmap; + + if (!QPixmapCache::find(*a0, sipRes)) + { + delete sipRes; + sipRes = 0; + } +%End + + static bool insert(const QString &key, const QPixmap &); + static QPixmapCache::Key insert(const QPixmap &pixmap); + static void remove(const QString &key); + static void remove(const QPixmapCache::Key &key); + static bool replace(const QPixmapCache::Key &key, const QPixmap &pixmap); + static void setCacheLimit(int); +}; diff --git a/sip/QtGui/qpointingdevice.sip b/sip/QtGui/qpointingdevice.sip new file mode 100644 index 0000000..d8ac7c4 --- /dev/null +++ b/sip/QtGui/qpointingdevice.sip @@ -0,0 +1,71 @@ +// qpointingdevice.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPointingDeviceUniqueId +{ +%TypeHeaderCode +#include +%End + +public: + QPointingDeviceUniqueId(); + static QPointingDeviceUniqueId fromNumericId(qint64 id); + bool isValid() const; + qint64 numericId() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs); +bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs); + +class QPointingDevice : QInputDevice +{ +%TypeHeaderCode +#include +%End + +public: + enum class PointerType /BaseType=Flag/ + { + Unknown, + Generic, + Finger, + Pen, + Eraser, + Cursor, + AllPointerTypes, + }; + + typedef QFlags PointerTypes; + QPointingDevice(const QString &name, qint64 systemId, QInputDevice::DeviceType devType, QPointingDevice::PointerType pType, QInputDevice::Capabilities caps, int maxPoints, int buttonCount, const QString &seatName = QString(), QPointingDeviceUniqueId uniqueId = QPointingDeviceUniqueId(), QObject *parent /TransferThis/ = 0); + QPointingDevice(QObject *parent /TransferThis/ = 0); + virtual ~QPointingDevice(); + QPointingDevice::PointerType pointerType() const; + int maximumPoints() const; + int buttonCount() const; + QPointingDeviceUniqueId uniqueId() const; + static const QPointingDevice *primaryPointingDevice(const QString &seatName = QString()); + bool operator==(const QPointingDevice &other) const; +}; diff --git a/sip/QtGui/qpolygon.sip b/sip/QtGui/qpolygon.sip new file mode 100644 index 0000000..60c2df6 --- /dev/null +++ b/sip/QtGui/qpolygon.sip @@ -0,0 +1,461 @@ +// qpolygon.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPolygon +{ +%TypeHeaderCode +#include +%End + +%PickleCode + PyObject *pl = PyList_New(sipCpp->count() * 2); + + for (int p = 0, i = 0; i < sipCpp->count(); ++i, p += 2) + { + int x, y; + + sipCpp->point(i, &x, &y); + + PyList_SetItem(pl, p, PyLong_FromLong(x)); + PyList_SetItem(pl, p + 1, PyLong_FromLong(y)); + } + + sipRes = Py_BuildValue("(N)", pl); +%End + +public: + QPolygon(); + QPolygon(const QRect &r, bool closed = false); + QPolygon(const QList &v); + QPolygon(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QPolygon(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + void swap(QPolygon &other /Constrained/); + void translate(int dx, int dy); + void translate(const QPoint &offset); + QPolygon translated(int dx, int dy) const; + QPolygon translated(const QPoint &offset) const; + QRect boundingRect() const; + QPoint point(int i) const; + void setPoint(int index, int x, int y); + void setPoint(int index, const QPoint &p); + void setPoints(int firstx, int firsty, ... /TypeHint="int"/); +%MethodCode + // Accept at least one pair of integer coordinates. + int nPoints = 1 + ((PyTuple_Size(a2) + 1) >> 1); + + int *points = new int[nPoints * 2]; + + points[0] = a0; + points[1] = a1; + + for (Py_ssize_t i = 0; i < PyTuple_Size(a2); ++i) + points[2 + i] = PyLong_AsLong(PyTuple_GetItem(a2, i)); + + sipCpp->setPoints(nPoints, points); + + delete[] points; +%End + + void putPoints(int index, int firstx, int firsty, ... /TypeHint="int"/); +%MethodCode + // Accept at least one pair of integer coordinates. + int nPoints = 1 + ((PyTuple_Size(a3) + 1) >> 1); + + int *points = new int[nPoints * 2]; + + points[0] = a1; + points[1] = a2; + + for (Py_ssize_t i = 0; i < PyTuple_Size(a3); ++i) + points[2 + i] = PyLong_AsLong(PyTuple_GetItem(a3, i)); + + sipCpp->putPoints(a0, nPoints, points); + + delete[] points; +%End + + void putPoints(int index, int nPoints, const QPolygon &fromPolygon, int from = 0); + bool containsPoint(const QPoint &pt, Qt::FillRule fillRule) const; + QPolygon united(const QPolygon &r) const; + QPolygon intersected(const QPolygon &r) const; + QPolygon subtracted(const QPolygon &r) const; + bool intersects(const QPolygon &r) const; +// Methods inherited from QList and Python special methods. +// Keep in sync with QPolygonF and QXmlStreamAttributes. + +void append(const QPoint &value); +const QPoint &at(int i) const; +void clear(); +bool contains(const QPoint &value) const; +int count(const QPoint &value) const; +int count() const /__len__/; +void *data(); + +// Note the Qt return value is discarded as it would require handwritten code +// and seems pretty useless. +void fill(const QPoint &value, int size = -1); + +QPoint &first(); +int indexOf(const QPoint &value, int from = 0) const; +void insert(int i, const QPoint &value); +bool isEmpty() const; +QPoint &last(); +int lastIndexOf(const QPoint &value, int from = -1) const; + +// Note the Qt return type is QList. +QPolygon mid(int pos, int length = -1) const; + +void prepend(const QPoint &value); +void remove(int i); +void remove(int i, int count); +void replace(int i, const QPoint &value); +void resize(qsizetype size); +int size() const; +QPoint value(int i) const; +QPoint value(int i, const QPoint &defaultValue) const; +bool operator!=(const QPolygon &other) const; + +// Note the Qt return type is QList. +QPolygon operator+(const QPolygon &other) const; + +QPolygon &operator+=(const QPolygon &other); +QPolygon &operator+=(const QPoint &value); +bool operator==(const QPolygon &other) const; + +SIP_PYOBJECT operator<<(const QPoint &value); +%MethodCode + *a0 << *a1; + + sipRes = sipArg0; + Py_INCREF(sipRes); +%End + +QPoint &operator[](int i); +%MethodCode +Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); + +if (idx < 0) + sipIsErr = 1; +else + sipRes = &sipCpp->operator[]((int)idx); +%End + +// Some additional Python special methods. + +void __setitem__(int i, const QPoint &value); +%MethodCode +int len; + +len = sipCpp->count(); + +if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0) + sipIsErr = 1; +else + (*sipCpp)[a0] = *a1; +%End + +void __setitem__(SIP_PYSLICE slice, const QPolygon &list); +%MethodCode +Py_ssize_t start, stop, step, slicelength; + +if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) +{ + sipIsErr = 1; +} +else +{ + int vlen = a1->count(); + + if (vlen != slicelength) + { + sipBadLengthForSlice(vlen, slicelength); + sipIsErr = 1; + } + else + { + QList::const_iterator it = a1->begin(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + (*sipCpp)[start] = *it; + start += step; + ++it; + } + } +} +%End + +void __delitem__(int i); +%MethodCode +if ((a0 = (int)sipConvertFromSequenceIndex(a0, sipCpp->count())) < 0) + sipIsErr = 1; +else + sipCpp->remove(a0); +%End + +void __delitem__(SIP_PYSLICE slice); +%MethodCode +Py_ssize_t start, stop, step, slicelength; + +if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) +{ + sipIsErr = 1; +} +else +{ + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + sipCpp->remove(start); + start += step - 1; + } +} +%End + +QPolygon operator[](SIP_PYSLICE slice); +%MethodCode +Py_ssize_t start, stop, step, slicelength; + +if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) +{ + sipIsErr = 1; +} +else +{ + sipRes = new QPolygon(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + (*sipRes) += (*sipCpp)[start]; + start += step; + } +} +%End + +int __contains__(const QPoint &value); +%MethodCode +sipRes = bool(sipCpp->contains(*a0)); +%End +%If (Qt_6_4_0 -) + QPolygonF toPolygonF() const; +%End +}; + +QDataStream &operator<<(QDataStream &stream, const QPolygon &polygon) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &stream, QPolygon &polygon /Constrained/) /ReleaseGIL/; + +class QPolygonF +{ +%TypeHeaderCode +#include +%End + +public: + QPolygonF(); + QPolygonF(const QList &v); + QPolygonF(const QRectF &r); + QPolygonF(const QPolygon &a); + QPolygonF(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QPolygonF(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + void swap(QPolygonF &other /Constrained/); + void translate(qreal dx, qreal dy); + void translate(const QPointF &offset); + QPolygonF translated(qreal dx, qreal dy) const; + QPolygonF translated(const QPointF &offset) const; + QPolygon toPolygon() const; + bool isClosed() const; + QRectF boundingRect() const; + bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const; + QPolygonF united(const QPolygonF &r) const; + QPolygonF intersected(const QPolygonF &r) const; + QPolygonF subtracted(const QPolygonF &r) const; + bool intersects(const QPolygonF &r) const; +// Methods inherited from QList and Python special methods. +// Keep in sync with QPolygon and QXmlStreamAttributes. + +void append(const QPointF &value); +const QPointF &at(int i) const; +void clear(); +bool contains(const QPointF &value) const; +int count(const QPointF &value) const; +int count() const /__len__/; +void *data(); + +// Note the Qt return value is discarded as it would require handwritten code +// and seems pretty useless. +void fill(const QPointF &value, int size = -1); + +QPointF &first(); +int indexOf(const QPointF &value, int from = 0) const; +void insert(int i, const QPointF &value); +bool isEmpty() const; +QPointF &last(); +int lastIndexOf(const QPointF &value, int from = -1) const; + +// Note the Qt return type is QList. +QPolygonF mid(int pos, int length = -1) const; + +void prepend(const QPointF &value); +void remove(int i); +void remove(int i, int count); +void replace(int i, const QPointF &value); +void resize(qsizetype size); +int size() const; +QPointF value(int i) const; +QPointF value(int i, const QPointF &defaultValue) const; +bool operator!=(const QPolygonF &other) const; + +// Note the Qt return type is QList. +QPolygonF operator+(const QPolygonF &other) const; + +QPolygonF &operator+=(const QPolygonF &other); +QPolygonF &operator+=(const QPointF &value); +bool operator==(const QPolygonF &other) const; + +SIP_PYOBJECT operator<<(const QPointF &value); +%MethodCode + *a0 << *a1; + + sipRes = sipArg0; + Py_INCREF(sipRes); +%End + +QPointF &operator[](int i); +%MethodCode +Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); + +if (idx < 0) + sipIsErr = 1; +else + sipRes = &sipCpp->operator[]((int)idx); +%End + +// Some additional Python special methods. + +void __setitem__(int i, const QPointF &value); +%MethodCode +int len; + +len = sipCpp->count(); + +if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0) + sipIsErr = 1; +else + (*sipCpp)[a0] = *a1; +%End + +void __setitem__(SIP_PYSLICE slice, const QPolygonF &list); +%MethodCode +Py_ssize_t start, stop, step, slicelength; + +if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) +{ + sipIsErr = 1; +} +else +{ + int vlen = a1->count(); + + if (vlen != slicelength) + { + sipBadLengthForSlice(vlen, slicelength); + sipIsErr = 1; + } + else + { + QList::const_iterator it = a1->begin(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + (*sipCpp)[start] = *it; + start += step; + ++it; + } + } +} +%End + +void __delitem__(int i); +%MethodCode +if ((a0 = (int)sipConvertFromSequenceIndex(a0, sipCpp->count())) < 0) + sipIsErr = 1; +else + sipCpp->remove(a0); +%End + +void __delitem__(SIP_PYSLICE slice); +%MethodCode +Py_ssize_t start, stop, step, slicelength; + +if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) +{ + sipIsErr = 1; +} +else +{ + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + sipCpp->remove(start); + start += step - 1; + } +} +%End + +QPolygonF operator[](SIP_PYSLICE slice); +%MethodCode +Py_ssize_t start, stop, step, slicelength; + +if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0) +{ + sipIsErr = 1; +} +else +{ + sipRes = new QPolygonF(); + + for (Py_ssize_t i = 0; i < slicelength; ++i) + { + (*sipRes) += (*sipCpp)[start]; + start += step; + } +} +%End + +int __contains__(const QPointF &value); +%MethodCode +sipRes = bool(sipCpp->contains(*a0)); +%End +}; + +QDataStream &operator<<(QDataStream &stream, const QPolygonF &array) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &stream, QPolygonF &array /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qpygui_qlist.sip b/sip/QtGui/qpygui_qlist.sip new file mode 100644 index 0000000..614f690 --- /dev/null +++ b/sip/QtGui/qpygui_qlist.sip @@ -0,0 +1,102 @@ +// This is the SIP interface definition for the QList based mapped types +// specific to the QtGui module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QList + /TypeHintIn="Sequence[QFontDatabase.WritingSystem]", + TypeHintOut="List[QFontDatabase.WritingSystem]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(sipCpp->at(i), + sipType_QFontDatabase_WritingSystem); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return (PySequence_Check(sipPy) && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + + Py_ssize_t len = PySequence_Size(sipPy); + + if (len < 0) + return 0; + + QList *ql = new QList; + + for (Py_ssize_t i = 0; i < len; ++i) + { + PyObject *itm = PySequence_GetItem(sipPy, i); + + if (!itm) + { + delete ql; + *sipIsErr = 1; + + return 0; + } + + int v = sipConvertToEnum(itm, sipType_QFontDatabase_WritingSystem); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "element %zd has type '%s' but 'QFontDatabase.WritingSystem' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtGui/qquaternion.sip b/sip/QtGui/qquaternion.sip new file mode 100644 index 0000000..c83d027 --- /dev/null +++ b/sip/QtGui/qquaternion.sip @@ -0,0 +1,117 @@ +// qquaternion.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QQuaternion +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("dddd", (double)sipCpp->scalar(), + (double)sipCpp->x(), (double)sipCpp->y(), (double)sipCpp->z()); +%End + +public: + QQuaternion(); + QQuaternion(float aScalar, float xpos, float ypos, float zpos); + QQuaternion(float aScalar, const QVector3D &aVector); + explicit QQuaternion(const QVector4D &aVector); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + PyObject *scalar = PyFloat_FromDouble(sipCpp->scalar()); + PyObject *x = PyFloat_FromDouble(sipCpp->x()); + PyObject *y = PyFloat_FromDouble(sipCpp->y()); + PyObject *z = PyFloat_FromDouble(sipCpp->z()); + + if (scalar && x && y && z) + sipRes = PyUnicode_FromFormat( + "PyQt6.QtGui.QQuaternion(%R, %R, %R, %R)", scalar, + x, y, z); + + Py_XDECREF(scalar); + Py_XDECREF(x); + Py_XDECREF(y); + Py_XDECREF(z); +%End + + float length() const; + float lengthSquared() const; + QQuaternion normalized() const; + void normalize(); + QVector3D rotatedVector(const QVector3D &vector) const; + static QQuaternion fromAxisAndAngle(const QVector3D &axis, float angle); + static QQuaternion fromAxisAndAngle(float x, float y, float z, float angle); + static QQuaternion slerp(const QQuaternion &q1, const QQuaternion &q2, float t); + static QQuaternion nlerp(const QQuaternion &q1, const QQuaternion &q2, float t); + bool isNull() const; + bool isIdentity() const; + float x() const; + float y() const; + float z() const; + float scalar() const; + void setX(float aX); + void setY(float aY); + void setZ(float aZ); + void setScalar(float aScalar); + QQuaternion &operator+=(const QQuaternion &quaternion); + QQuaternion &operator-=(const QQuaternion &quaternion); + QQuaternion &operator*=(float factor); + QQuaternion &operator*=(const QQuaternion &quaternion); + QQuaternion &operator/=(float divisor); + void setVector(const QVector3D &aVector); + QVector3D vector() const; + void setVector(float aX, float aY, float aZ); + QVector4D toVector4D() const; + void getAxisAndAngle(QVector3D *axis /Out/, float *angle) const; + void getEulerAngles(float *pitch, float *yaw, float *roll) const; + static QQuaternion fromEulerAngles(float pitch, float yaw, float roll); + QMatrix3x3 toRotationMatrix() const; + static QQuaternion fromRotationMatrix(const QMatrix3x3 &rot3x3); + void getAxes(QVector3D *xAxis /Out/, QVector3D *yAxis /Out/, QVector3D *zAxis /Out/) const; + static QQuaternion fromAxes(const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis); + static QQuaternion fromDirection(const QVector3D &direction, const QVector3D &up); + static QQuaternion rotationTo(const QVector3D &from, const QVector3D &to); + static float dotProduct(const QQuaternion &q1, const QQuaternion &q2); + QQuaternion inverted() const; + QQuaternion conjugated() const; + QVector3D toEulerAngles() const; + static QQuaternion fromEulerAngles(const QVector3D &eulerAngles); +}; + +const QQuaternion operator*(const QQuaternion &q1, const QQuaternion &q2); +bool operator==(const QQuaternion &q1, const QQuaternion &q2); +bool operator!=(const QQuaternion &q1, const QQuaternion &q2); +const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2); +const QQuaternion operator-(const QQuaternion &q1, const QQuaternion &q2); +const QQuaternion operator*(float factor, const QQuaternion &quaternion); +const QQuaternion operator*(const QQuaternion &quaternion, float factor); +const QQuaternion operator-(const QQuaternion &quaternion); +const QQuaternion operator/(const QQuaternion &quaternion, float divisor); +bool qFuzzyCompare(const QQuaternion &q1, const QQuaternion &q2); +QDataStream &operator<<(QDataStream &, const QQuaternion &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QQuaternion & /Constrained/) /ReleaseGIL/; +QVector3D operator*(const QQuaternion &quaternion, const QVector3D &vec); diff --git a/sip/QtGui/qrasterwindow.sip b/sip/QtGui/qrasterwindow.sip new file mode 100644 index 0000000..8689e74 --- /dev/null +++ b/sip/QtGui/qrasterwindow.sip @@ -0,0 +1,35 @@ +// qrasterwindow.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QRasterWindow : QPaintDeviceWindow +{ +%TypeHeaderCode +#include +%End + +public: + explicit QRasterWindow(QWindow *parent /TransferThis/ = 0); + virtual ~QRasterWindow(); + +protected: + virtual int metric(QPaintDevice::PaintDeviceMetric metric) const; +}; diff --git a/sip/QtGui/qrawfont.sip b/sip/QtGui/qrawfont.sip new file mode 100644 index 0000000..7437f40 --- /dev/null +++ b/sip/QtGui/qrawfont.sip @@ -0,0 +1,92 @@ +// qrawfont.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_RawFont) + +class QRawFont +{ +%TypeHeaderCode +#include +%End + +public: + enum AntialiasingType + { + PixelAntialiasing, + SubPixelAntialiasing, + }; + + QRawFont(); + QRawFont(const QString &fileName, qreal pixelSize, QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); + QRawFont(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); + QRawFont(const QRawFont &other); + ~QRawFont(); + bool isValid() const; + bool operator==(const QRawFont &other) const; + bool operator!=(const QRawFont &other) const; + QString familyName() const; + QString styleName() const; + QFont::Style style() const; + int weight() const; + QList glyphIndexesForString(const QString &text) const; + QList advancesForGlyphIndexes(const QList &glyphIndexes, QRawFont::LayoutFlags layoutFlags) const; + QList advancesForGlyphIndexes(const QList &glyphIndexes) const; + QImage alphaMapForGlyph(quint32 glyphIndex, QRawFont::AntialiasingType antialiasingType = QRawFont::SubPixelAntialiasing, const QTransform &transform = QTransform()) const; + QPainterPath pathForGlyph(quint32 glyphIndex) const; + void setPixelSize(qreal pixelSize); + qreal pixelSize() const; + QFont::HintingPreference hintingPreference() const; + qreal ascent() const; + qreal descent() const; + qreal leading() const; + qreal xHeight() const; + qreal averageCharWidth() const; + qreal maxCharWidth() const; + qreal unitsPerEm() const; + void loadFromFile(const QString &fileName, qreal pixelSize, QFont::HintingPreference hintingPreference) /ReleaseGIL/; + void loadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) /ReleaseGIL/; + bool supportsCharacter(uint ucs4) const; + bool supportsCharacter(QChar character) const; + QList supportedWritingSystems() const; + QByteArray fontTable(const char *tagName) const; + static QRawFont fromFont(const QFont &font, QFontDatabase::WritingSystem writingSystem = QFontDatabase::Any); + QRectF boundingRect(quint32 glyphIndex) const; + qreal lineThickness() const; + qreal underlinePosition() const; + void swap(QRawFont &other /Constrained/); + + enum LayoutFlag /BaseType=Flag/ + { + SeparateAdvances, + KernedAdvances, + UseDesignMetrics, + }; + + typedef QFlags LayoutFlags; + qreal capHeight() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End diff --git a/sip/QtGui/qregion.sip b/sip/QtGui/qregion.sip new file mode 100644 index 0000000..80b657e --- /dev/null +++ b/sip/QtGui/qregion.sip @@ -0,0 +1,112 @@ +// qregion.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QRegion +{ +%TypeHeaderCode +#include +%End + +public: + enum RegionType + { + Rectangle, + Ellipse, + }; + + QRegion(); + QRegion(int x, int y, int w, int h, QRegion::RegionType type = QRegion::Rectangle); + QRegion(const QRect &r, QRegion::RegionType type = QRegion::Rectangle); + QRegion(const QPolygon &a, Qt::FillRule fillRule = Qt::OddEvenFill); + QRegion(const QBitmap &bitmap); + QRegion(const QRegion ®ion); + QRegion(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QRegion(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + ~QRegion(); + bool isEmpty() const; + int __bool__() const; +%MethodCode + sipRes = !sipCpp->isEmpty(); +%End + + bool contains(const QPoint &p) const; + int __contains__(const QPoint &p) const; +%MethodCode + sipRes = sipCpp->contains(*a0); +%End + + bool contains(const QRect &r) const; + int __contains__(const QRect &r) const; +%MethodCode + sipRes = sipCpp->contains(*a0); +%End + + void translate(int dx, int dy); + void translate(const QPoint &p); + QRegion translated(int dx, int dy) const; + QRegion translated(const QPoint &p) const; + QRegion united(const QRegion &r) const; + QRegion united(const QRect &r) const; + QRect boundingRect() const; + QRegion operator|(const QRegion &r) const; + void setRects(const QList &); +%MethodCode + if (a0->size()) + sipCpp->setRects(a0->data(), a0->size()); + else + sipCpp->setRects(0, 0); +%End + + QRegion operator+(const QRegion &r) const; + QRegion operator+(const QRect &r) const; + QRegion operator&(const QRegion &r) const; + QRegion operator&(const QRect &r) const; + QRegion operator-(const QRegion &r) const; + QRegion operator^(const QRegion &r) const; + QRegion &operator|=(const QRegion &r); + QRegion &operator+=(const QRegion &r); + QRegion &operator+=(const QRect &r); + QRegion &operator&=(const QRegion &r); + QRegion &operator&=(const QRect &r); + QRegion &operator-=(const QRegion &r); + QRegion &operator^=(const QRegion &r); + bool operator==(const QRegion &r) const; + bool operator!=(const QRegion &r) const; + QRegion intersected(const QRegion &r) const; + QRegion intersected(const QRect &r) const; + QRegion subtracted(const QRegion &r) const; + QRegion xored(const QRegion &r) const; + bool intersects(const QRegion &r) const; + bool intersects(const QRect &r) const; + int rectCount() const; + void swap(QRegion &other /Constrained/); + bool isNull() const; +}; + +QDataStream &operator<<(QDataStream &, const QRegion &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QRegion & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qrgb.sip b/sip/QtGui/qrgb.sip new file mode 100644 index 0000000..a374744 --- /dev/null +++ b/sip/QtGui/qrgb.sip @@ -0,0 +1,37 @@ +// qrgb.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +typedef unsigned int QRgb; +int qRed(QRgb rgb); +int qGreen(QRgb rgb); +int qBlue(QRgb rgb); +int qAlpha(QRgb rgb); +QRgb qRgb(int r, int g, int b); +QRgb qRgba(int r, int g, int b, int a); +int qGray(int r, int g, int b); +int qGray(QRgb rgb); +QRgb qPremultiply(QRgb x); +QRgb qUnpremultiply(QRgb p); diff --git a/sip/QtGui/qrgba64.sip b/sip/QtGui/qrgba64.sip new file mode 100644 index 0000000..84a79e8 --- /dev/null +++ b/sip/QtGui/qrgba64.sip @@ -0,0 +1,67 @@ +// qrgba64.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QRgba64 +{ +%TypeHeaderCode +#include +%End + +public: + QRgba64(); + static QRgba64 fromRgba64(quint64 c); + static QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha); + static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha); + static QRgba64 fromArgb32(uint rgb); + bool isOpaque() const; + bool isTransparent() const; + quint16 red() const; + quint16 green() const; + quint16 blue() const; + quint16 alpha() const; + void setRed(quint16 _red); + void setGreen(quint16 _green); + void setBlue(quint16 _blue); + void setAlpha(quint16 _alpha); + quint8 red8() const; + quint8 green8() const; + quint8 blue8() const; + quint8 alpha8() const; + uint toArgb32() const; + ushort toRgb16() const; + QRgba64 premultiplied() const; + QRgba64 unpremultiplied() const; + operator quint64() const; +}; + +QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a); +QRgba64 qRgba64(quint64 c); +QRgba64 qPremultiply(QRgba64 c); +QRgba64 qUnpremultiply(QRgba64 c); +uint qRed(QRgba64 rgb); +uint qGreen(QRgba64 rgb); +uint qBlue(QRgba64 rgb); +uint qAlpha(QRgba64 rgb); diff --git a/sip/QtGui/qscreen.sip b/sip/QtGui/qscreen.sip new file mode 100644 index 0000000..cb7e7f5 --- /dev/null +++ b/sip/QtGui/qscreen.sip @@ -0,0 +1,77 @@ +// qscreen.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QScreen : QObject /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QScreen(); + QString name() const; + int depth() const; + QSize size() const; + QRect geometry() const; + QSizeF physicalSize() const; + qreal physicalDotsPerInchX() const; + qreal physicalDotsPerInchY() const; + qreal physicalDotsPerInch() const; + qreal logicalDotsPerInchX() const; + qreal logicalDotsPerInchY() const; + qreal logicalDotsPerInch() const; + QSize availableSize() const; + QRect availableGeometry() const; + QList virtualSiblings() const; + QSize virtualSize() const; + QRect virtualGeometry() const; + QSize availableVirtualSize() const; + QRect availableVirtualGeometry() const; + Qt::ScreenOrientation nativeOrientation() const; + Qt::ScreenOrientation primaryOrientation() const; + Qt::ScreenOrientation orientation() const; + int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) const; + QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) const; + QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) const; + bool isPortrait(Qt::ScreenOrientation orientation) const; + bool isLandscape(Qt::ScreenOrientation orientation) const; + QPixmap grabWindow(WId window = 0, int x = 0, int y = 0, int width = -1, int height = -1); + qreal refreshRate() const; + qreal devicePixelRatio() const; + +signals: + void geometryChanged(const QRect &geometry); + void physicalDotsPerInchChanged(qreal dpi); + void logicalDotsPerInchChanged(qreal dpi); + void primaryOrientationChanged(Qt::ScreenOrientation orientation); + void orientationChanged(Qt::ScreenOrientation orientation); + void refreshRateChanged(qreal refreshRate); + void physicalSizeChanged(const QSizeF &size); + void virtualGeometryChanged(const QRect &rect); + void availableGeometryChanged(const QRect &geometry); + +public: + QString manufacturer() const; + QString model() const; + QString serialNumber() const; + QScreen *virtualSiblingAt(QPoint point); +}; diff --git a/sip/QtGui/qsessionmanager.sip b/sip/QtGui/qsessionmanager.sip new file mode 100644 index 0000000..def69a9 --- /dev/null +++ b/sip/QtGui/qsessionmanager.sip @@ -0,0 +1,62 @@ +// qsessionmanager.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SessionManager) + +class QSessionManager : QObject +{ +%TypeHeaderCode +#include +%End + + QSessionManager(QGuiApplication *app /TransferThis/, QString &id, QString &key); + virtual ~QSessionManager(); + +public: + QString sessionId() const; + QString sessionKey() const; + bool allowsInteraction(); + bool allowsErrorInteraction(); + void release(); + void cancel(); + + enum RestartHint + { + RestartIfRunning, + RestartAnyway, + RestartImmediately, + RestartNever, + }; + + void setRestartHint(QSessionManager::RestartHint); + QSessionManager::RestartHint restartHint() const; + void setRestartCommand(const QStringList &); + QStringList restartCommand() const; + void setDiscardCommand(const QStringList &); + QStringList discardCommand() const; + void setManagerProperty(const QString &name, const QString &value); + void setManagerProperty(const QString &name, const QStringList &value); + bool isPhase2() const; + void requestPhase2(); +}; + +%End diff --git a/sip/QtGui/qshortcut.sip b/sip/QtGui/qshortcut.sip new file mode 100644 index 0000000..5935a83 --- /dev/null +++ b/sip/QtGui/qshortcut.sip @@ -0,0 +1,171 @@ +// qshortcut.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QShortcut : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QShortcut(QKeySequence::StandardKey key, QObject *parent /TransferThis/, SIP_PYOBJECT member /TypeHint="PYQT_SLOT"/ = 0, SIP_PYOBJECT ambiguousMember /TypeHint="PYQT_SLOT"/ = 0, Qt::ShortcutContext context = Qt::WindowShortcut) [(QKeySequence::StandardKey key, QObject *parent, const char *member = 0, const char *ambiguousMember = 0, Qt::ShortcutContext context = Qt::WindowShortcut)]; +%MethodCode + // Construct the shortcut without any connections. + Py_BEGIN_ALLOW_THREADS + sipCpp = new sipQShortcut(a0, a1, 0, 0, a4); + Py_END_ALLOW_THREADS + + if (a2) + { + QObject *rx2; + QByteArray member2; + + if ((sipError = pyqt6_qtgui_get_connection_parts(a2, sipCpp, "()", false, &rx2, member2)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + QObject::connect(sipCpp, SIGNAL(activated()), rx2, + member2.constData()); + Py_END_ALLOW_THREADS + } + else + { + delete sipCpp; + + if (sipError == sipErrorContinue) + sipError = sipBadCallableArg(2, a2); + } + } + + if (a3) + { + QObject *rx3; + QByteArray member3; + + if ((sipError = pyqt6_qtgui_get_connection_parts(a3, sipCpp, "()", false, &rx3, member3)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + QObject::connect(sipCpp, SIGNAL(activatedAmbiguously()), rx3, + member3.constData()); + Py_END_ALLOW_THREADS + } + else + { + delete sipCpp; + + if (sipError == sipErrorContinue) + sipError = sipBadCallableArg(3, a3); + } + } +%End + + QShortcut(const QKeySequence &key, QObject *parent /TransferThis/, SIP_PYOBJECT member /TypeHint="PYQT_SLOT"/ = 0, SIP_PYOBJECT ambiguousMember /TypeHint="PYQT_SLOT"/ = 0, Qt::ShortcutContext context = Qt::WindowShortcut) [(const QKeySequence &key, QObject *parent, const char *member = 0, const char *ambiguousMember = 0, Qt::ShortcutContext context = Qt::WindowShortcut)]; +%MethodCode + // Construct the shortcut without any connections. + Py_BEGIN_ALLOW_THREADS + sipCpp = new sipQShortcut(*a0, a1, 0, 0, a4); + Py_END_ALLOW_THREADS + + if (a2) + { + QObject *rx2; + QByteArray member2; + + if ((sipError = pyqt6_qtgui_get_connection_parts(a2, sipCpp, "()", false, &rx2, member2)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + QObject::connect(sipCpp, SIGNAL(activated()), rx2, + member2.constData()); + Py_END_ALLOW_THREADS + } + else + { + delete sipCpp; + + if (sipError == sipErrorContinue) + sipError = sipBadCallableArg(2, a2); + } + } + + if (a3) + { + QObject *rx3; + QByteArray member3; + + if ((sipError = pyqt6_qtgui_get_connection_parts(a3, sipCpp, "()", false, &rx3, member3)) == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + QObject::connect(sipCpp, SIGNAL(activatedAmbiguously()), rx3, + member3.constData()); + Py_END_ALLOW_THREADS + } + else + { + delete sipCpp; + + if (sipError == sipErrorContinue) + sipError = sipBadCallableArg(3, a3); + } + } +%End + + explicit QShortcut(QObject *parent /TransferThis/); + virtual ~QShortcut(); + void setKey(const QKeySequence &key); + QKeySequence key() const; + void setEnabled(bool enable); + bool isEnabled() const; + void setContext(Qt::ShortcutContext context); + Qt::ShortcutContext context() const; + void setWhatsThis(const QString &text); + QString whatsThis() const; + void setAutoRepeat(bool on); + bool autoRepeat() const; + +signals: + void activated(); + void activatedAmbiguously(); + +public: + void setKeys(const QList &keys); + void setKeys(QKeySequence::StandardKey key); + QList keys() const; + +protected: + virtual bool event(QEvent *e); +}; + +%ModuleHeaderCode +// Imports from QtCore. +typedef sipErrorState (*pyqt6_qtgui_get_connection_parts_t)(PyObject *, QObject *, const char *, bool, QObject **, QByteArray &); +extern pyqt6_qtgui_get_connection_parts_t pyqt6_qtgui_get_connection_parts; +%End + +%ModuleCode +// Imports from QtCore. +pyqt6_qtgui_get_connection_parts_t pyqt6_qtgui_get_connection_parts; +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtgui_get_connection_parts = (pyqt6_qtgui_get_connection_parts_t)sipImportSymbol("pyqt6_get_connection_parts"); +Q_ASSERT(pyqt6_qtgui_get_connection_parts); +%End diff --git a/sip/QtGui/qstandarditemmodel.sip b/sip/QtGui/qstandarditemmodel.sip new file mode 100644 index 0000000..916318d --- /dev/null +++ b/sip/QtGui/qstandarditemmodel.sip @@ -0,0 +1,207 @@ +// qstandarditemmodel.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStandardItemModel : QAbstractItemModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QStandardItemModel(QObject *parent /TransferThis/ = 0); + QStandardItemModel(int rows, int columns, QObject *parent /TransferThis/ = 0); + virtual ~QStandardItemModel(); + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex parent(const QModelIndex &child) const; + QObject *parent() const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); + virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + void clear(); + virtual Qt::DropActions supportedDropActions() const; + virtual QMap itemData(const QModelIndex &index) const; + virtual bool setItemData(const QModelIndex &index, const QMap &roles); + virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + QStandardItem *itemFromIndex(const QModelIndex &index) const; + QModelIndex indexFromItem(const QStandardItem *item) const; + QStandardItem *item(int row, int column = 0) const; + void setItem(int row, int column, QStandardItem *item /Transfer/); + void setItem(int arow, QStandardItem *aitem /Transfer/); + QStandardItem *invisibleRootItem() const /Transfer/; + QStandardItem *horizontalHeaderItem(int column) const; + void setHorizontalHeaderItem(int column, QStandardItem *item /Transfer/); + QStandardItem *verticalHeaderItem(int row) const; + void setVerticalHeaderItem(int row, QStandardItem *item /Transfer/); + void setHorizontalHeaderLabels(const QStringList &labels); + void setVerticalHeaderLabels(const QStringList &labels); + void setRowCount(int rows); + void setColumnCount(int columns); + void appendRow(const QList &items /Transfer/); + void appendColumn(const QList &items /Transfer/); + void insertRow(int row, const QList &items /Transfer/); + void insertColumn(int column, const QList &items /Transfer/); + QStandardItem *takeItem(int row, int column = 0) /TransferBack/; + QList takeRow(int row) /TransferBack/; + QList takeColumn(int column) /TransferBack/; + QStandardItem *takeHorizontalHeaderItem(int column) /TransferBack/; + QStandardItem *takeVerticalHeaderItem(int row) /TransferBack/; + const QStandardItem *itemPrototype() const; + void setItemPrototype(const QStandardItem *item /Transfer/); + QList findItems(const QString &text, Qt::MatchFlags flags = Qt::MatchExactly, int column = 0) const; + int sortRole() const; + void setSortRole(int role); + void appendRow(QStandardItem *aitem /Transfer/); + void insertRow(int arow, QStandardItem *aitem /Transfer/); + bool insertRow(int row, const QModelIndex &parent = QModelIndex()); + bool insertColumn(int column, const QModelIndex &parent = QModelIndex()); + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/; + virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); + void setItemRoleNames(const QHash &roleNames); + virtual bool clearItemData(const QModelIndex &index); + virtual QHash roleNames() const; + +signals: + void itemChanged(QStandardItem *item); +}; + +class QStandardItem /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + QStandardItem(); + explicit QStandardItem(const QString &text); + QStandardItem(const QIcon &icon, const QString &text); + QStandardItem(int rows, int columns = 1); + virtual ~QStandardItem(); + virtual QVariant data(int role = Qt::UserRole + 1) const; + virtual void setData(const QVariant &value, int role = Qt::UserRole + 1); + QString text() const; + QIcon icon() const; + QString toolTip() const; + QString statusTip() const; + QString whatsThis() const; + QSize sizeHint() const; + QFont font() const; + Qt::Alignment textAlignment() const; + QBrush background() const; + QBrush foreground() const; + Qt::CheckState checkState() const; + QString accessibleText() const; + QString accessibleDescription() const; + Qt::ItemFlags flags() const; + void setFlags(Qt::ItemFlags flags); + bool isEnabled() const; + void setEnabled(bool enabled); + bool isEditable() const; + void setEditable(bool editable); + bool isSelectable() const; + void setSelectable(bool selectable); + bool isCheckable() const; + void setCheckable(bool checkable); + bool isDragEnabled() const; + void setDragEnabled(bool dragEnabled); + bool isDropEnabled() const; + void setDropEnabled(bool dropEnabled); + QStandardItem *parent() const; + int row() const; + int column() const; + QModelIndex index() const; + QStandardItemModel *model() const; + int rowCount() const; + void setRowCount(int rows); + int columnCount() const; + void setColumnCount(int columns); + bool hasChildren() const; + QStandardItem *child(int row, int column = 0) const; + void setChild(int row, int column, QStandardItem *item /Transfer/); + void setChild(int arow, QStandardItem *aitem /Transfer/); + void insertRow(int row, const QList &items /Transfer/); + void insertRow(int arow, QStandardItem *aitem /Transfer/); + void insertRows(int row, int count); + void insertColumn(int column, const QList &items /Transfer/); + void insertColumns(int column, int count); + void removeRow(int row); + void removeColumn(int column); + void removeRows(int row, int count); + void removeColumns(int column, int count); + QStandardItem *takeChild(int row, int column = 0) /TransferBack/; + QList takeRow(int row) /TransferBack/; + QList takeColumn(int column) /TransferBack/; + void sortChildren(int column, Qt::SortOrder order = Qt::AscendingOrder); + virtual QStandardItem *clone() const /Factory/; + + enum ItemType + { + Type, + UserType, + }; + + virtual int type() const; + virtual void read(QDataStream &in); + virtual void write(QDataStream &out) const; + virtual bool operator<(const QStandardItem &other /NoCopy/) const; + void setText(const QString &atext); + void setIcon(const QIcon &aicon); + void setToolTip(const QString &atoolTip); + void setStatusTip(const QString &astatusTip); + void setWhatsThis(const QString &awhatsThis); + void setSizeHint(const QSize &asizeHint); + void setFont(const QFont &afont); + void setTextAlignment(Qt::Alignment atextAlignment); + void setBackground(const QBrush &abrush); + void setForeground(const QBrush &abrush); + void setCheckState(Qt::CheckState acheckState); + void setAccessibleText(const QString &aaccessibleText); + void setAccessibleDescription(const QString &aaccessibleDescription); + void appendRow(const QList &items /Transfer/); + void appendRow(QStandardItem *aitem /Transfer/); + void appendColumn(const QList &items /Transfer/); + void insertRows(int row, const QList &items /Transfer/); + void appendRows(const QList &items /Transfer/); + +protected: + QStandardItem(const QStandardItem &other); + void emitDataChanged(); + +public: + bool isAutoTristate() const; + void setAutoTristate(bool tristate); + bool isUserTristate() const; + void setUserTristate(bool tristate); + void clearData(); +}; + +QDataStream &operator<<(QDataStream &out, const QStandardItem &item) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &in, QStandardItem &item /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qstatictext.sip b/sip/QtGui/qstatictext.sip new file mode 100644 index 0000000..8e2eacb --- /dev/null +++ b/sip/QtGui/qstatictext.sip @@ -0,0 +1,55 @@ +// qstatictext.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStaticText +{ +%TypeHeaderCode +#include +%End + +public: + enum PerformanceHint + { + ModerateCaching, + AggressiveCaching, + }; + + QStaticText(); + explicit QStaticText(const QString &text); + QStaticText(const QStaticText &other); + ~QStaticText(); + void setText(const QString &text); + QString text() const; + void setTextFormat(Qt::TextFormat textFormat); + Qt::TextFormat textFormat() const; + void setTextWidth(qreal textWidth); + qreal textWidth() const; + void setTextOption(const QTextOption &textOption); + QTextOption textOption() const; + QSizeF size() const; + void prepare(const QTransform &matrix = QTransform(), const QFont &font = QFont()); + void setPerformanceHint(QStaticText::PerformanceHint performanceHint); + QStaticText::PerformanceHint performanceHint() const; + bool operator==(const QStaticText &) const; + bool operator!=(const QStaticText &) const; + void swap(QStaticText &other /Constrained/); +}; diff --git a/sip/QtGui/qstylehints.sip b/sip/QtGui/qstylehints.sip new file mode 100644 index 0000000..8cb9144 --- /dev/null +++ b/sip/QtGui/qstylehints.sip @@ -0,0 +1,100 @@ +// qstylehints.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStyleHints : QObject +{ +%TypeHeaderCode +#include +%End + +public: + int mouseDoubleClickInterval() const; + int startDragDistance() const; + int startDragTime() const; + int startDragVelocity() const; + int keyboardInputInterval() const; + int keyboardAutoRepeatRate() const; + int cursorFlashTime() const; + bool showIsFullScreen() const; + int passwordMaskDelay() const; + qreal fontSmoothingGamma() const; + bool useRtlExtensions() const; + QChar passwordMaskCharacter() const; + bool setFocusOnTouchRelease() const; + int mousePressAndHoldInterval() const; + Qt::TabFocusBehavior tabFocusBehavior() const; + bool singleClickActivation() const; + +signals: + void cursorFlashTimeChanged(int cursorFlashTime); + void keyboardInputIntervalChanged(int keyboardInputInterval); + void mouseDoubleClickIntervalChanged(int mouseDoubleClickInterval); + void startDragDistanceChanged(int startDragDistance); + void startDragTimeChanged(int startDragTime); + void mousePressAndHoldIntervalChanged(int mousePressAndHoldInterval); + void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior); + +public: + bool showIsMaximized() const; + bool useHoverEffects() const; + void setUseHoverEffects(bool useHoverEffects); + +signals: + void useHoverEffectsChanged(bool useHoverEffects); + +public: + int wheelScrollLines() const; + +signals: + void wheelScrollLinesChanged(int scrollLines); + +public: + bool showShortcutsInContextMenus() const; + int mouseQuickSelectionThreshold() const; + +signals: + void mouseQuickSelectionThresholdChanged(int threshold); + +public: + void setShowShortcutsInContextMenus(bool showShortcutsInContextMenus); + +signals: + void showShortcutsInContextMenusChanged(bool); + +public: + int mouseDoubleClickDistance() const; + int touchDoubleTapDistance() const; +%If (Qt_6_5_0 -) + qreal keyboardAutoRepeatRateF() const; +%End +%If (Qt_6_5_0 -) + Qt::ColorScheme colorScheme() const; +%End + +signals: +%If (Qt_6_5_0 -) + void colorSchemeChanged(Qt::ColorScheme colorScheme); +%End + +private: + QStyleHints(); +}; diff --git a/sip/QtGui/qsurface.sip b/sip/QtGui/qsurface.sip new file mode 100644 index 0000000..f4d9e52 --- /dev/null +++ b/sip/QtGui/qsurface.sip @@ -0,0 +1,58 @@ +// qsurface.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSurface /Abstract/ +{ +%TypeHeaderCode +#include +%End + +public: + enum SurfaceClass + { + Window, + Offscreen, + }; + + enum SurfaceType + { + RasterSurface, + OpenGLSurface, + RasterGLSurface, + OpenVGSurface, + VulkanSurface, + MetalSurface, +%If (Qt_6_1_0 -) + Direct3DSurface, +%End + }; + + virtual ~QSurface(); + QSurface::SurfaceClass surfaceClass() const; + virtual QSurfaceFormat format() const = 0; + virtual QSurface::SurfaceType surfaceType() const = 0; + virtual QSize size() const = 0; + bool supportsOpenGL() const; + +protected: + explicit QSurface(QSurface::SurfaceClass type); +}; diff --git a/sip/QtGui/qsurfaceformat.sip b/sip/QtGui/qsurfaceformat.sip new file mode 100644 index 0000000..503d0da --- /dev/null +++ b/sip/QtGui/qsurfaceformat.sip @@ -0,0 +1,112 @@ +// qsurfaceformat.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSurfaceFormat +{ +%TypeHeaderCode +#include +%End + +public: + enum FormatOption /BaseType=Flag/ + { + StereoBuffers, + DebugContext, + DeprecatedFunctions, + ResetNotification, +%If (Qt_6_2_0 -) + ProtectedContent, +%End + }; + + typedef QFlags FormatOptions; + + enum SwapBehavior + { + DefaultSwapBehavior, + SingleBuffer, + DoubleBuffer, + TripleBuffer, + }; + + enum RenderableType + { + DefaultRenderableType, + OpenGL, + OpenGLES, + OpenVG, + }; + + enum OpenGLContextProfile + { + NoProfile, + CoreProfile, + CompatibilityProfile, + }; + + QSurfaceFormat(); + QSurfaceFormat(QSurfaceFormat::FormatOptions options); + QSurfaceFormat(const QSurfaceFormat &other); + ~QSurfaceFormat(); + void setDepthBufferSize(int size); + int depthBufferSize() const; + void setStencilBufferSize(int size); + int stencilBufferSize() const; + void setRedBufferSize(int size); + int redBufferSize() const; + void setGreenBufferSize(int size); + int greenBufferSize() const; + void setBlueBufferSize(int size); + int blueBufferSize() const; + void setAlphaBufferSize(int size); + int alphaBufferSize() const; + void setSamples(int numSamples); + int samples() const; + void setSwapBehavior(QSurfaceFormat::SwapBehavior behavior); + QSurfaceFormat::SwapBehavior swapBehavior() const; + bool hasAlpha() const; + void setProfile(QSurfaceFormat::OpenGLContextProfile profile); + QSurfaceFormat::OpenGLContextProfile profile() const; + void setRenderableType(QSurfaceFormat::RenderableType type); + QSurfaceFormat::RenderableType renderableType() const; + void setMajorVersion(int majorVersion); + int majorVersion() const; + void setMinorVersion(int minorVersion); + int minorVersion() const; + void setStereo(bool enable); + bool stereo() const; + std::pair version() const; + void setVersion(int major, int minor); + void setOptions(QSurfaceFormat::FormatOptions options); + void setOption(QSurfaceFormat::FormatOption option, bool on = true); + bool testOption(QSurfaceFormat::FormatOption option) const; + QSurfaceFormat::FormatOptions options() const; + int swapInterval() const; + void setSwapInterval(int interval); + static void setDefaultFormat(const QSurfaceFormat &format); + static QSurfaceFormat defaultFormat(); + const QColorSpace &colorSpace() const; + void setColorSpace(const QColorSpace &colorSpace); +}; + +bool operator==(const QSurfaceFormat &, const QSurfaceFormat &); +bool operator!=(const QSurfaceFormat &, const QSurfaceFormat &); diff --git a/sip/QtGui/qsyntaxhighlighter.sip b/sip/QtGui/qsyntaxhighlighter.sip new file mode 100644 index 0000000..a4774c2 --- /dev/null +++ b/sip/QtGui/qsyntaxhighlighter.sip @@ -0,0 +1,89 @@ +// qsyntaxhighlighter.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSyntaxHighlighter : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSyntaxHighlighter(QTextDocument *parent /TransferThis/); + explicit QSyntaxHighlighter(QObject *parent /TransferThis/); + virtual ~QSyntaxHighlighter(); + void setDocument(QTextDocument *doc /KeepReference/); + QTextDocument *document() const; + +public slots: + void rehighlight(); + void rehighlightBlock(const QTextBlock &block); + +protected: + virtual void highlightBlock(const QString &text) = 0; + void setFormat(int start, int count, const QTextCharFormat &format); + void setFormat(int start, int count, const QColor &color); + void setFormat(int start, int count, const QFont &font); + QTextCharFormat format(int pos) const; + int previousBlockState() const; + int currentBlockState() const; + void setCurrentBlockState(int newState); + void setCurrentBlockUserData(QTextBlockUserData *data /GetWrapper/); +%MethodCode + // Ownership of the user data is with the document not the syntax highlighter. + + typedef PyObject *(*helper_func)(QObject *, const sipTypeDef *); + + static helper_func helper = 0; + + if (!helper) + { + helper = (helper_func)sipImportSymbol("qtgui_wrap_ancestors"); + Q_ASSERT(helper); + } + + QTextDocument *td = sipCpp->document(); + + if (td) + { + PyObject *py_td = helper(td, sipType_QTextDocument); + + if (!py_td) + { + sipIsErr = 1; + } + else + { + sipTransferTo(a0Wrapper, py_td); + Py_DECREF(py_td); + } + } + + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipCpp->setCurrentBlockUserData(a0); + #else + sipCpp->sipProtect_setCurrentBlockUserData(a0); + #endif +%End + + QTextBlockUserData *currentBlockUserData() const; + QTextBlock currentBlock() const; +}; diff --git a/sip/QtGui/qtextcursor.sip b/sip/QtGui/qtextcursor.sip new file mode 100644 index 0000000..0535ad2 --- /dev/null +++ b/sip/QtGui/qtextcursor.sip @@ -0,0 +1,158 @@ +// qtextcursor.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextCursor +{ +%TypeHeaderCode +#include +%End + +public: + QTextCursor(); + explicit QTextCursor(QTextDocument *document); + explicit QTextCursor(QTextFrame *frame); + explicit QTextCursor(const QTextBlock &block); + QTextCursor(const QTextCursor &cursor); + ~QTextCursor(); + bool isNull() const; + + enum MoveMode + { + MoveAnchor, + KeepAnchor, + }; + + void setPosition(int pos, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); + int position() const; + int anchor() const; + void insertText(const QString &text); + void insertText(const QString &text, const QTextCharFormat &format); + + enum MoveOperation + { + NoMove, + Start, + Up, + StartOfLine, + StartOfBlock, + StartOfWord, + PreviousBlock, + PreviousCharacter, + PreviousWord, + Left, + WordLeft, + End, + Down, + EndOfLine, + EndOfWord, + EndOfBlock, + NextBlock, + NextCharacter, + NextWord, + Right, + WordRight, + NextCell, + PreviousCell, + NextRow, + PreviousRow, + }; + + bool movePosition(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor, int n = 1); + void deleteChar(); + void deletePreviousChar(); + + enum SelectionType + { + WordUnderCursor, + LineUnderCursor, + BlockUnderCursor, + Document, + }; + + void select(QTextCursor::SelectionType selection); + bool hasSelection() const; + bool hasComplexSelection() const; + void removeSelectedText(); + void clearSelection(); + int selectionStart() const; + int selectionEnd() const; + QString selectedText() const; + QTextDocumentFragment selection() const; + void selectedTableCells(int *firstRow, int *numRows, int *firstColumn, int *numColumns) const; + QTextBlock block() const; + QTextCharFormat charFormat() const; + void setCharFormat(const QTextCharFormat &format); + void mergeCharFormat(const QTextCharFormat &modifier); + QTextBlockFormat blockFormat() const; + void setBlockFormat(const QTextBlockFormat &format); + void mergeBlockFormat(const QTextBlockFormat &modifier); + QTextCharFormat blockCharFormat() const; + void setBlockCharFormat(const QTextCharFormat &format); + void mergeBlockCharFormat(const QTextCharFormat &modifier); + bool atBlockStart() const; + bool atBlockEnd() const; + bool atStart() const; + bool atEnd() const; + void insertBlock(); + void insertBlock(const QTextBlockFormat &format); + void insertBlock(const QTextBlockFormat &format, const QTextCharFormat &charFormat); + QTextList *insertList(const QTextListFormat &format); + QTextList *insertList(QTextListFormat::Style style); + QTextList *createList(const QTextListFormat &format); + QTextList *createList(QTextListFormat::Style style); + QTextList *currentList() const; + QTextTable *insertTable(int rows, int cols, const QTextTableFormat &format); + QTextTable *insertTable(int rows, int cols); + QTextTable *currentTable() const; + QTextFrame *insertFrame(const QTextFrameFormat &format); + QTextFrame *currentFrame() const; + void insertFragment(const QTextDocumentFragment &fragment); + void insertHtml(const QString &html); + void insertImage(const QTextImageFormat &format); + void insertImage(const QTextImageFormat &format, QTextFrameFormat::Position alignment); + void insertImage(const QString &name); + void insertImage(const QImage &image, const QString &name = QString()); + void beginEditBlock(); + void joinPreviousEditBlock(); + void endEditBlock(); + int blockNumber() const; + int columnNumber() const; + bool operator!=(const QTextCursor &rhs) const; + bool operator<(const QTextCursor &rhs) const; + bool operator<=(const QTextCursor &rhs) const; + bool operator==(const QTextCursor &rhs) const; + bool operator>=(const QTextCursor &rhs) const; + bool operator>(const QTextCursor &rhs) const; + bool isCopyOf(const QTextCursor &other) const; + bool visualNavigation() const; + void setVisualNavigation(bool b); + QTextDocument *document() const; + int positionInBlock() const; + void setVerticalMovementX(int x); + int verticalMovementX() const; + void setKeepPositionOnInsert(bool b); + bool keepPositionOnInsert() const; + void swap(QTextCursor &other /Constrained/); +%If (Qt_6_4_0 -) + void insertMarkdown(const QString &markdown, QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub); +%End +}; diff --git a/sip/QtGui/qtextdocument.sip b/sip/QtGui/qtextdocument.sip new file mode 100644 index 0000000..1eeb732 --- /dev/null +++ b/sip/QtGui/qtextdocument.sip @@ -0,0 +1,380 @@ +// qtextdocument.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +namespace Qt +{ +%TypeHeaderCode +#include +%End + + bool mightBeRichText(const QString &); + QString convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode = Qt::WhiteSpacePre); +}; + +class QTextDocument : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTextDocument(QObject *parent /TransferThis/ = 0); + QTextDocument(const QString &text, QObject *parent /TransferThis/ = 0); + virtual ~QTextDocument(); + QTextDocument *clone(QObject *parent /TransferThis/ = 0) const /Factory/; + bool isEmpty() const; + virtual void clear(); + void setUndoRedoEnabled(bool enable); + bool isUndoRedoEnabled() const; + bool isUndoAvailable() const; + bool isRedoAvailable() const; + void setDocumentLayout(QAbstractTextDocumentLayout *layout /Transfer/); + QAbstractTextDocumentLayout *documentLayout() const; + + enum MetaInformation + { + DocumentTitle, + DocumentUrl, +%If (Qt_6_3_0 -) + CssMedia, +%End + }; + + void setMetaInformation(QTextDocument::MetaInformation info, const QString &); + QString metaInformation(QTextDocument::MetaInformation info) const; + QString toHtml() const; + void setHtml(const QString &html); + QString toPlainText() const; + void setPlainText(const QString &text); + + enum FindFlag /BaseType=Flag/ + { + FindBackward, + FindCaseSensitively, + FindWholeWords, + }; + + typedef QFlags FindFlags; + QTextCursor find(const QRegularExpression &expr, const QTextCursor &cursor, QTextDocument::FindFlags options = QTextDocument::FindFlags()) const; + QTextCursor find(const QRegularExpression &expr, int position = 0, QTextDocument::FindFlags options = QTextDocument::FindFlags()) const; + QTextCursor find(const QString &subString, const QTextCursor &cursor, QTextDocument::FindFlags options = QTextDocument::FindFlags()) const; + QTextCursor find(const QString &subString, int position = 0, QTextDocument::FindFlags options = QTextDocument::FindFlags()) const; + QTextFrame *rootFrame() const; + QTextObject *object(int objectIndex) const; + QTextObject *objectForFormat(const QTextFormat &) const; + QTextBlock findBlock(int pos) const; + QTextBlock begin() const; + QTextBlock end() const; + void setPageSize(const QSizeF &size); + QSizeF pageSize() const; + void setDefaultFont(const QFont &font); + QFont defaultFont() const; + int pageCount() const; + bool isModified() const; +%If (PyQt_Printer) + void print(QPagedPaintDevice *printer) const; +%End + + enum ResourceType /BaseType=IntEnum/ + { + UnknownResource, + HtmlResource, + ImageResource, + StyleSheetResource, + MarkdownResource, + UserResource, + }; + + QVariant resource(int type, const QUrl &name) const; + void addResource(int type, const QUrl &name, const QVariant &resource); + QList allFormats() const; + void markContentsDirty(int from, int length); + void setUseDesignMetrics(bool b); + bool useDesignMetrics() const; + +signals: + void blockCountChanged(int newBlockCount); + void contentsChange(int from, int charsRemoves, int charsAdded); + void contentsChanged(); + void cursorPositionChanged(const QTextCursor &cursor); + void modificationChanged(bool m); + void redoAvailable(bool); + void undoAvailable(bool); + +public slots: + void undo(); + void redo(); + void setModified(bool on = true); + +protected: + virtual QTextObject *createObject(const QTextFormat &f) /Factory/; + virtual QVariant loadResource(int type, const QUrl &name); + +public: + void drawContents(QPainter *p, const QRectF &rect = QRectF()); + void setTextWidth(qreal width); + qreal textWidth() const; + qreal idealWidth() const; + void adjustSize(); + QSizeF size() const; + int blockCount() const; + void setDefaultStyleSheet(const QString &sheet); + QString defaultStyleSheet() const; + void undo(QTextCursor *cursor); + void redo(QTextCursor *cursor); + int maximumBlockCount() const; + void setMaximumBlockCount(int maximum); + QTextOption defaultTextOption() const; + void setDefaultTextOption(const QTextOption &option); + int revision() const; + QTextBlock findBlockByNumber(int blockNumber) const; + QTextBlock findBlockByLineNumber(int blockNumber) const; + QTextBlock firstBlock() const; + QTextBlock lastBlock() const; + qreal indentWidth() const; + void setIndentWidth(qreal width); + +signals: + void undoCommandAdded(); + void documentLayoutChanged(); + +public: + QChar characterAt(int pos) const; + qreal documentMargin() const; + void setDocumentMargin(qreal margin); + int lineCount() const; + int characterCount() const; + int availableUndoSteps() const; + int availableRedoSteps() const; + + enum Stacks + { + UndoStack, + RedoStack, + UndoAndRedoStacks, + }; + + void clearUndoRedoStacks(QTextDocument::Stacks stacks = QTextDocument::UndoAndRedoStacks); + Qt::CursorMoveStyle defaultCursorMoveStyle() const; + void setDefaultCursorMoveStyle(Qt::CursorMoveStyle style); + QUrl baseUrl() const; + void setBaseUrl(const QUrl &url); + +signals: + void baseUrlChanged(const QUrl &url); + +public: + QString toRawText() const; + + enum MarkdownFeature /BaseType=Flag/ + { + MarkdownNoHTML, + MarkdownDialectCommonMark, + MarkdownDialectGitHub, + }; + + typedef QFlags MarkdownFeatures; + QString toMarkdown(QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub) const; + void setMarkdown(const QString &markdown, QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub); + void setSuperScriptBaseline(qreal baseline); + qreal superScriptBaseline() const; + void setSubScriptBaseline(qreal baseline); + qreal subScriptBaseline() const; + void setBaselineOffset(qreal baseline); + qreal baselineOffset() const; +%If (Qt_6_1_0 -) + SIP_PYCALLABLE resourceProvider() const /TypeHint="Callable[[QUrl], QVariant]"/; +%MethodCode + if (sipCpp->resourceProvider()) + sipRes = sipGetUserObject((sipSimpleWrapper *)sipSelf); + else + sipRes = SIP_NULLPTR; + + if (!sipRes) + sipRes = Py_None; + + Py_INCREF(sipRes); +%End + +%End +%If (Qt_6_1_0 -) + void setResourceProvider(SIP_PYCALLABLE provider /TypeHint="Callable[[QUrl], QVariant]"/); +%MethodCode + // Remove any existing callable. + Py_XDECREF(sipGetUserObject((sipSimpleWrapper *)sipSelf)); + + if (a0 == Py_None) + { + sipSetUserObject((sipSimpleWrapper *)sipSelf, SIP_NULLPTR); + sipCpp->setResourceProvider(SIP_NULLPTR); + } + else + { + // Save the callable so that resourceProvider() can return it. + Py_INCREF(a0); + sipSetUserObject((sipSimpleWrapper *)sipSelf, a0); + + Py_BEGIN_ALLOW_THREADS + + sipCpp->setResourceProvider([a0] (const QUrl &arg) { + QUrl *arg_heap = new QUrl(arg); + QVariant qv; + int is_err = 1; + + SIP_BLOCK_THREADS + + PyObject *arg_obj = sipConvertFromNewType(arg_heap, sipType_QUrl, NULL); + + if (arg_obj) + { + PyObject *res_obj = PyObject_CallFunctionObjArgs(a0, arg_obj, NULL); + + Py_DECREF(arg_obj); + + if (res_obj) + { + is_err = 0; + + QVariant *res = reinterpret_cast( + sipConvertToType(res_obj, sipType_QVariant, NULL, 0, + NULL, &is_err)); + + if (!is_err) + { + qv = *res; + delete res; + } + } + } + else + { + delete arg_heap; + } + + if (is_err) + { + pyqt6_qtgui_err_print(); + } + + SIP_UNBLOCK_THREADS + + return qv; + }); + + Py_END_ALLOW_THREADS + } +%End + +%End +%If (Qt_6_1_0 -) + static SIP_PYCALLABLE defaultResourceProvider() /TypeHint="Callable[[QUrl], QVariant]"/; +%MethodCode + if (QTextDocument::defaultResourceProvider()) + sipRes = (PyObject *)sipGetTypeUserData((sipWrapperType *)sipTypeAsPyTypeObject(sipType_QTextDocument)); + else + sipRes = SIP_NULLPTR; + + if (!sipRes) + sipRes = Py_None; + + Py_INCREF(sipRes); +%End + +%End +%If (Qt_6_1_0 -) + static void setDefaultResourceProvider(SIP_PYCALLABLE provider /TypeHint="Callable[[QUrl], QVariant]"/); +%MethodCode + sipWrapperType *wt = (sipWrapperType *)sipTypeAsPyTypeObject(sipType_QTextDocument); + + // Remove any existing callable. + Py_XDECREF((PyObject *)sipGetTypeUserData(wt)); + + if (a0 == Py_None) + { + sipSetTypeUserData(wt, SIP_NULLPTR); + QTextDocument::setDefaultResourceProvider(SIP_NULLPTR); + } + else + { + // Save the callable so that defaultResourceProvider() can return it. + Py_INCREF(a0); + sipSetTypeUserData(wt, a0); + + Py_BEGIN_ALLOW_THREADS + + QTextDocument::setDefaultResourceProvider([a0] (const QUrl &arg) { + QUrl *arg_heap = new QUrl(arg); + QVariant qv; + int is_err = 1; + + SIP_BLOCK_THREADS + + PyObject *arg_obj = sipConvertFromNewType(arg_heap, sipType_QUrl, NULL); + + if (arg_obj) + { + PyObject *res_obj = PyObject_CallFunctionObjArgs(a0, arg_obj, NULL); + + Py_DECREF(arg_obj); + + if (res_obj) + { + is_err = 0; + + QVariant *res = reinterpret_cast( + sipConvertToType(res_obj, sipType_QVariant, NULL, 0, + NULL, &is_err)); + + if (!is_err) + { + qv = *res; + delete res; + } + } + } + else + { + delete arg_heap; + } + + if (is_err) + { + pyqt6_qtgui_err_print(); + } + + SIP_UNBLOCK_THREADS + + return qv; + }); + + Py_END_ALLOW_THREADS + } +%End + +%End +%If (Qt_6_4_0 -) + void setLayoutEnabled(bool b); +%End +%If (Qt_6_4_0 -) + bool isLayoutEnabled() const; +%End +}; diff --git a/sip/QtGui/qtextdocumentfragment.sip b/sip/QtGui/qtextdocumentfragment.sip new file mode 100644 index 0000000..112cd9d --- /dev/null +++ b/sip/QtGui/qtextdocumentfragment.sip @@ -0,0 +1,49 @@ +// qtextdocumentfragment.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextDocumentFragment +{ +%TypeHeaderCode +#include +%End + +public: + QTextDocumentFragment(); + explicit QTextDocumentFragment(const QTextDocument *document); + explicit QTextDocumentFragment(const QTextCursor &range); + QTextDocumentFragment(const QTextDocumentFragment &rhs); + ~QTextDocumentFragment(); + bool isEmpty() const; + QString toPlainText() const; + QString toHtml() const; + static QTextDocumentFragment fromPlainText(const QString &plainText); + static QTextDocumentFragment fromHtml(const QString &html, const QTextDocument *resourceProvider = 0); +%If (Qt_6_4_0 -) + QString toRawText() const; +%End +%If (Qt_6_4_0 -) + QString toMarkdown(QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub) const; +%End +%If (Qt_6_4_0 -) + static QTextDocumentFragment fromMarkdown(const QString &markdown, QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub); +%End +}; diff --git a/sip/QtGui/qtextdocumentwriter.sip b/sip/QtGui/qtextdocumentwriter.sip new file mode 100644 index 0000000..3a6914c --- /dev/null +++ b/sip/QtGui/qtextdocumentwriter.sip @@ -0,0 +1,46 @@ +// qtextdocumentwriter.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextDocumentWriter +{ +%TypeHeaderCode +#include +%End + +public: + QTextDocumentWriter(); + QTextDocumentWriter(QIODevice *device, const QByteArray &format); + QTextDocumentWriter(const QString &fileName, const QByteArray &format = QByteArray()); + ~QTextDocumentWriter(); + void setFormat(const QByteArray &format); + QByteArray format() const; + void setDevice(QIODevice *device); + QIODevice *device() const; + void setFileName(const QString &fileName); + QString fileName() const; + bool write(const QTextDocument *document); + bool write(const QTextDocumentFragment &fragment); + static QList supportedDocumentFormats(); + +private: + QTextDocumentWriter(const QTextDocumentWriter &); +}; diff --git a/sip/QtGui/qtextformat.sip b/sip/QtGui/qtextformat.sip new file mode 100644 index 0000000..66b91dc --- /dev/null +++ b/sip/QtGui/qtextformat.sip @@ -0,0 +1,654 @@ +// qtextformat.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextLength +{ +%TypeHeaderCode +#include +%End + +public: + enum Type + { + VariableLength, + FixedLength, + PercentageLength, + }; + + QTextLength(); + QTextLength::Type type() const; + QTextLength(QTextLength::Type atype, qreal avalue); + qreal value(qreal maximumLength) const; + qreal rawValue() const; + bool operator==(const QTextLength &other) const; + bool operator!=(const QTextLength &other) const; + QTextLength(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QTextLength(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End +}; + +%If (Qt_6_3_0 -) +QDataStream &operator<<(QDataStream &, const QTextTableCellFormat &) /ReleaseGIL/; +%End +%If (Qt_6_3_0 -) +QDataStream &operator<<(QDataStream &, const QTextFrameFormat &) /ReleaseGIL/; +%End +%If (Qt_6_3_0 -) +QDataStream &operator<<(QDataStream &, const QTextListFormat &) /ReleaseGIL/; +%End +%If (Qt_6_3_0 -) +QDataStream &operator<<(QDataStream &, const QTextBlockFormat &) /ReleaseGIL/; +%End +%If (Qt_6_3_0 -) +QDataStream &operator<<(QDataStream &, const QTextCharFormat &) /ReleaseGIL/; +%End +QDataStream &operator<<(QDataStream &, const QTextLength &) /ReleaseGIL/; +%If (Qt_6_3_0 -) +QDataStream &operator>>(QDataStream &, QTextTableCellFormat & /Constrained/) /ReleaseGIL/; +%End +%If (Qt_6_3_0 -) +QDataStream &operator>>(QDataStream &, QTextFrameFormat & /Constrained/) /ReleaseGIL/; +%End +%If (Qt_6_3_0 -) +QDataStream &operator>>(QDataStream &, QTextListFormat & /Constrained/) /ReleaseGIL/; +%End +%If (Qt_6_3_0 -) +QDataStream &operator>>(QDataStream &, QTextBlockFormat & /Constrained/) /ReleaseGIL/; +%End +%If (Qt_6_3_0 -) +QDataStream &operator>>(QDataStream &, QTextCharFormat & /Constrained/) /ReleaseGIL/; +%End +QDataStream &operator>>(QDataStream &, QTextLength & /Constrained/) /ReleaseGIL/; + +class QTextFormat +{ +%TypeHeaderCode +#include +%End + +public: + enum FormatType /BaseType=IntEnum/ + { + InvalidFormat, + BlockFormat, + CharFormat, + ListFormat, + FrameFormat, + UserFormat, + }; + + enum ObjectTypes /BaseType=IntEnum/ + { + NoObject, + ImageObject, + TableObject, + TableCellObject, + UserObject, + }; + + enum PageBreakFlag /BaseType=Flag/ + { + PageBreak_Auto, + PageBreak_AlwaysBefore, + PageBreak_AlwaysAfter, + }; + + typedef QFlags PageBreakFlags; + + enum Property /BaseType=IntEnum/ + { + ObjectIndex, + CssFloat, + LayoutDirection, + OutlinePen, + BackgroundBrush, + ForegroundBrush, + BlockAlignment, + BlockTopMargin, + BlockBottomMargin, + BlockLeftMargin, + BlockRightMargin, + TextIndent, + BlockIndent, + BlockNonBreakableLines, + BlockTrailingHorizontalRulerWidth, + FontPointSize, + FontSizeAdjustment, + FontSizeIncrement, + FontWeight, + FontItalic, + FontUnderline, + FontOverline, + FontStrikeOut, + FontFixedPitch, + FontPixelSize, + TextUnderlineColor, + TextVerticalAlignment, + TextOutline, + IsAnchor, + AnchorHref, + AnchorName, + ObjectType, + ListStyle, + ListIndent, + FrameBorder, + FrameMargin, + FramePadding, + FrameWidth, + FrameHeight, + TableColumns, + TableColumnWidthConstraints, + TableCellSpacing, + TableCellPadding, + TableCellRowSpan, + TableCellColumnSpan, + ImageName, + ImageWidth, + ImageHeight, + TextUnderlineStyle, + TableHeaderRowCount, + FullWidthSelection, + PageBreakPolicy, + TextToolTip, + FrameTopMargin, + FrameBottomMargin, + FrameLeftMargin, + FrameRightMargin, + FrameBorderBrush, + FrameBorderStyle, + BackgroundImageUrl, + TabPositions, + FirstFontProperty, + FontCapitalization, + FontLetterSpacing, + FontWordSpacing, + LastFontProperty, + TableCellTopPadding, + TableCellBottomPadding, + TableCellLeftPadding, + TableCellRightPadding, + FontStyleHint, + FontStyleStrategy, + FontKerning, + LineHeight, + LineHeightType, + FontHintingPreference, + ListNumberPrefix, + ListNumberSuffix, + FontStretch, + FontLetterSpacingType, + HeadingLevel, + ImageQuality, + FontFamilies, + FontStyleName, + BlockQuoteLevel, + BlockCodeLanguage, + BlockCodeFence, + BlockMarker, + TableBorderCollapse, + TableCellTopBorder, + TableCellBottomBorder, + TableCellLeftBorder, + TableCellRightBorder, + TableCellTopBorderStyle, + TableCellBottomBorderStyle, + TableCellLeftBorderStyle, + TableCellRightBorderStyle, + TableCellTopBorderBrush, + TableCellBottomBorderBrush, + TableCellLeftBorderBrush, + TableCellRightBorderBrush, + ImageTitle, + ImageAltText, + TextSuperScriptBaseline, + TextSubScriptBaseline, + TextBaselineOffset, + OldFontLetterSpacingType, + OldFontStretch, + OldTextUnderlineColor, +%If (Qt_6_4_0 -) + OldFontFamily, +%End + UserProperty, + }; + + QTextFormat(); + explicit QTextFormat(int type); + QTextFormat(const QTextFormat &rhs); + QTextFormat(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QTextFormat(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + ~QTextFormat(); + void merge(const QTextFormat &other); + bool isValid() const; + int type() const; + int objectIndex() const; + void setObjectIndex(int object); + QVariant property(int propertyId) const; + void setProperty(int propertyId, const QList &lengths); + void setProperty(int propertyId, const QVariant &value); + void clearProperty(int propertyId); + bool hasProperty(int propertyId) const; + bool boolProperty(int propertyId) const; + int intProperty(int propertyId) const; + qreal doubleProperty(int propertyId) const; + QString stringProperty(int propertyId) const; + QColor colorProperty(int propertyId) const; + QPen penProperty(int propertyId) const; + QBrush brushProperty(int propertyId) const; + QTextLength lengthProperty(int propertyId) const; + QList lengthVectorProperty(int propertyId) const; + QMap properties() const; + int objectType() const; + bool isCharFormat() const; + bool isBlockFormat() const; + bool isListFormat() const; + bool isFrameFormat() const; + bool isImageFormat() const; + bool isTableFormat() const; + QTextBlockFormat toBlockFormat() const; + QTextCharFormat toCharFormat() const; + QTextListFormat toListFormat() const; + QTextTableFormat toTableFormat() const; + QTextFrameFormat toFrameFormat() const; + QTextImageFormat toImageFormat() const; + bool operator==(const QTextFormat &rhs) const; + bool operator!=(const QTextFormat &rhs) const; + void setLayoutDirection(Qt::LayoutDirection direction); + Qt::LayoutDirection layoutDirection() const; + void setBackground(const QBrush &brush); + QBrush background() const; + void clearBackground(); + void setForeground(const QBrush &brush); + QBrush foreground() const; + void clearForeground(); + void setObjectType(int atype); + int propertyCount() const; + bool isTableCellFormat() const; + QTextTableCellFormat toTableCellFormat() const; + void swap(QTextFormat &other /Constrained/); + bool isEmpty() const; +}; + +QDataStream &operator<<(QDataStream &, const QTextFormat &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QTextFormat & /Constrained/) /ReleaseGIL/; + +class QTextCharFormat : QTextFormat +{ +%TypeHeaderCode +#include +%End + +public: + enum VerticalAlignment + { + AlignNormal, + AlignSuperScript, + AlignSubScript, + AlignMiddle, + AlignTop, + AlignBottom, + AlignBaseline, + }; + + QTextCharFormat(); + bool isValid() const; + void setFont(const QFont &font, QTextCharFormat::FontPropertiesInheritanceBehavior behavior = QTextCharFormat::FontPropertiesAll); + QFont font() const; + void setFontFamily(const QString &family); + QString fontFamily() const; + void setFontPointSize(qreal size); + qreal fontPointSize() const; + void setFontWeight(int weight); + int fontWeight() const; + void setFontItalic(bool italic); + bool fontItalic() const; + void setFontUnderline(bool underline); + bool fontUnderline() const; + void setFontOverline(bool overline); + bool fontOverline() const; + void setFontStrikeOut(bool strikeOut); + bool fontStrikeOut() const; + void setUnderlineColor(const QColor &color); + QColor underlineColor() const; + void setFontFixedPitch(bool fixedPitch); + bool fontFixedPitch() const; + void setVerticalAlignment(QTextCharFormat::VerticalAlignment alignment); + QTextCharFormat::VerticalAlignment verticalAlignment() const; + void setAnchor(bool anchor); + bool isAnchor() const; + void setAnchorHref(const QString &value); + QString anchorHref() const; + int tableCellRowSpan() const; + int tableCellColumnSpan() const; + void setTableCellRowSpan(int atableCellRowSpan); + void setTableCellColumnSpan(int atableCellColumnSpan); + void setTextOutline(const QPen &pen); + QPen textOutline() const; + + enum UnderlineStyle + { + NoUnderline, + SingleUnderline, + DashUnderline, + DotLine, + DashDotLine, + DashDotDotLine, + WaveUnderline, + SpellCheckUnderline, + }; + + void setUnderlineStyle(QTextCharFormat::UnderlineStyle style); + QTextCharFormat::UnderlineStyle underlineStyle() const; + void setToolTip(const QString &tip); + QString toolTip() const; + void setAnchorNames(const QStringList &names); + QStringList anchorNames() const; + void setFontCapitalization(QFont::Capitalization capitalization); + QFont::Capitalization fontCapitalization() const; + void setFontLetterSpacing(qreal spacing); + qreal fontLetterSpacing() const; + void setFontWordSpacing(qreal spacing); + qreal fontWordSpacing() const; + void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault); + void setFontStyleStrategy(QFont::StyleStrategy strategy); + QFont::StyleHint fontStyleHint() const; + QFont::StyleStrategy fontStyleStrategy() const; + void setFontKerning(bool enable); + bool fontKerning() const; + void setFontHintingPreference(QFont::HintingPreference hintingPreference); + QFont::HintingPreference fontHintingPreference() const; + int fontStretch() const; + void setFontStretch(int factor); + void setFontLetterSpacingType(QFont::SpacingType letterSpacingType); + QFont::SpacingType fontLetterSpacingType() const; + + enum FontPropertiesInheritanceBehavior + { + FontPropertiesSpecifiedOnly, + FontPropertiesAll, + }; + + void setFontFamilies(const QStringList &families); + QVariant fontFamilies() const; + void setFontStyleName(const QString &styleName); + QVariant fontStyleName() const; + void setSuperScriptBaseline(qreal baseline); + qreal superScriptBaseline() const; + void setSubScriptBaseline(qreal baseline); + qreal subScriptBaseline() const; + void setBaselineOffset(qreal baseline); + qreal baselineOffset() const; +}; + +class QTextBlockFormat : QTextFormat +{ +%TypeHeaderCode +#include +%End + +public: + QTextBlockFormat(); + bool isValid() const; + Qt::Alignment alignment() const; + void setTopMargin(qreal margin); + qreal topMargin() const; + void setBottomMargin(qreal margin); + qreal bottomMargin() const; + void setLeftMargin(qreal margin); + qreal leftMargin() const; + void setRightMargin(qreal margin); + qreal rightMargin() const; + void setTextIndent(qreal margin); + qreal textIndent() const; + int indent() const; + void setNonBreakableLines(bool b); + bool nonBreakableLines() const; + void setAlignment(Qt::Alignment aalignment); + void setIndent(int aindent); + void setPageBreakPolicy(QTextFormat::PageBreakFlags flags); + QTextFormat::PageBreakFlags pageBreakPolicy() const; + void setTabPositions(const QList &tabs); + QList tabPositions() const; + + enum LineHeightTypes + { + SingleHeight, + ProportionalHeight, + FixedHeight, + MinimumHeight, + LineDistanceHeight, + }; + + void setLineHeight(qreal height, int heightType); + qreal lineHeight() const; + qreal lineHeight(qreal scriptLineHeight, qreal scaling = 1.) const; + int lineHeightType() const; + void setHeadingLevel(int alevel); + int headingLevel() const; + + enum class MarkerType + { + NoMarker, + Unchecked, + Checked, + }; + + void setMarker(QTextBlockFormat::MarkerType marker); + QTextBlockFormat::MarkerType marker() const; +}; + +class QTextListFormat : QTextFormat +{ +%TypeHeaderCode +#include +%End + +public: + QTextListFormat(); + bool isValid() const; + + enum Style + { + ListDisc, + ListCircle, + ListSquare, + ListDecimal, + ListLowerAlpha, + ListUpperAlpha, + ListLowerRoman, + ListUpperRoman, + }; + + QTextListFormat::Style style() const; + int indent() const; + void setStyle(QTextListFormat::Style astyle); + void setIndent(int aindent); + QString numberPrefix() const; + QString numberSuffix() const; + void setNumberPrefix(const QString &np); + void setNumberSuffix(const QString &ns); +}; + +class QTextImageFormat : QTextCharFormat +{ +%TypeHeaderCode +#include +%End + +public: + QTextImageFormat(); + bool isValid() const; + QString name() const; + qreal width() const; + qreal height() const; + int quality() const; + void setName(const QString &aname); + void setWidth(qreal awidth); + void setHeight(qreal aheight); + void setQuality(int quality = 100); +}; + +class QTextFrameFormat : QTextFormat +{ +%TypeHeaderCode +#include +%End + +public: + QTextFrameFormat(); + bool isValid() const; + + enum Position + { + InFlow, + FloatLeft, + FloatRight, + }; + + void setPosition(QTextFrameFormat::Position f); + QTextFrameFormat::Position position() const; + qreal border() const; + qreal margin() const; + qreal padding() const; + void setWidth(const QTextLength &length); + QTextLength width() const; + QTextLength height() const; + void setBorder(qreal aborder); + void setMargin(qreal amargin); + void setPadding(qreal apadding); + void setWidth(qreal awidth); + void setHeight(qreal aheight); + void setHeight(const QTextLength &aheight); + void setPageBreakPolicy(QTextFormat::PageBreakFlags flags); + QTextFormat::PageBreakFlags pageBreakPolicy() const; + + enum BorderStyle + { + BorderStyle_None, + BorderStyle_Dotted, + BorderStyle_Dashed, + BorderStyle_Solid, + BorderStyle_Double, + BorderStyle_DotDash, + BorderStyle_DotDotDash, + BorderStyle_Groove, + BorderStyle_Ridge, + BorderStyle_Inset, + BorderStyle_Outset, + }; + + void setBorderBrush(const QBrush &brush); + QBrush borderBrush() const; + void setBorderStyle(QTextFrameFormat::BorderStyle style); + QTextFrameFormat::BorderStyle borderStyle() const; + qreal topMargin() const; + qreal bottomMargin() const; + qreal leftMargin() const; + qreal rightMargin() const; + void setTopMargin(qreal amargin); + void setBottomMargin(qreal amargin); + void setLeftMargin(qreal amargin); + void setRightMargin(qreal amargin); +}; + +class QTextTableFormat : QTextFrameFormat +{ +%TypeHeaderCode +#include +%End + +public: + QTextTableFormat(); + bool isValid() const; + int columns() const; + void setColumnWidthConstraints(const QList &constraints); + QList columnWidthConstraints() const; + void clearColumnWidthConstraints(); + qreal cellSpacing() const; + void setCellSpacing(qreal spacing); + qreal cellPadding() const; + Qt::Alignment alignment() const; + void setColumns(int acolumns); + void setCellPadding(qreal apadding); + void setAlignment(Qt::Alignment aalignment); + void setHeaderRowCount(int count); + int headerRowCount() const; + void setBorderCollapse(bool borderCollapse); + bool borderCollapse() const; +}; + +class QTextTableCellFormat : QTextCharFormat +{ +%TypeHeaderCode +#include +%End + +public: + QTextTableCellFormat(); + bool isValid() const; + void setTopPadding(qreal padding); + qreal topPadding() const; + void setBottomPadding(qreal padding); + qreal bottomPadding() const; + void setLeftPadding(qreal padding); + qreal leftPadding() const; + void setRightPadding(qreal padding); + qreal rightPadding() const; + void setPadding(qreal padding); + void setTopBorder(qreal width); + qreal topBorder() const; + void setBottomBorder(qreal width); + qreal bottomBorder() const; + void setLeftBorder(qreal width); + qreal leftBorder() const; + void setRightBorder(qreal width); + qreal rightBorder() const; + void setBorder(qreal width); + void setTopBorderStyle(QTextFrameFormat::BorderStyle style); + QTextFrameFormat::BorderStyle topBorderStyle() const; + void setBottomBorderStyle(QTextFrameFormat::BorderStyle style); + QTextFrameFormat::BorderStyle bottomBorderStyle() const; + void setLeftBorderStyle(QTextFrameFormat::BorderStyle style); + QTextFrameFormat::BorderStyle leftBorderStyle() const; + void setRightBorderStyle(QTextFrameFormat::BorderStyle style); + QTextFrameFormat::BorderStyle rightBorderStyle() const; + void setBorderStyle(QTextFrameFormat::BorderStyle style); + void setTopBorderBrush(const QBrush &brush); + QBrush topBorderBrush() const; + void setBottomBorderBrush(const QBrush &brush); + QBrush bottomBorderBrush() const; + void setLeftBorderBrush(const QBrush &brush); + QBrush leftBorderBrush() const; + void setRightBorderBrush(const QBrush &brush); + QBrush rightBorderBrush() const; + void setBorderBrush(const QBrush &brush); +}; diff --git a/sip/QtGui/qtextlayout.sip b/sip/QtGui/qtextlayout.sip new file mode 100644 index 0000000..cd4deba --- /dev/null +++ b/sip/QtGui/qtextlayout.sip @@ -0,0 +1,195 @@ +// qtextlayout.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextInlineObject +{ +%TypeHeaderCode +#include +%End + +public: + bool isValid() const; + QRectF rect() const; + qreal width() const; + qreal ascent() const; + qreal descent() const; + qreal height() const; + Qt::LayoutDirection textDirection() const; + void setWidth(qreal w); + void setAscent(qreal a); + void setDescent(qreal d); + int textPosition() const; + int formatIndex() const; + QTextFormat format() const; +}; + +class QTextLayout +{ +%TypeHeaderCode +#include +%End + +public: + QTextLayout(); + QTextLayout(const QString &text); + QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice = 0); + QTextLayout(const QTextBlock &b); + ~QTextLayout(); + void setFont(const QFont &f); + QFont font() const; + void setText(const QString &string); + QString text() const; + void setTextOption(const QTextOption &option); + const QTextOption &textOption() const; + void setPreeditArea(int position, const QString &text); + int preeditAreaPosition() const; + QString preeditAreaText() const; + + struct FormatRange + { +%TypeHeaderCode +#include +%End + + int start; + int length; + QTextCharFormat format; + }; + + void setCacheEnabled(bool enable); + bool cacheEnabled() const; + void beginLayout(); + void endLayout(); + QTextLine createLine(); + int lineCount() const; + QTextLine lineAt(int i) const; + QTextLine lineForTextPosition(int pos) const; + + enum CursorMode + { + SkipCharacters, + SkipWords, + }; + + bool isValidCursorPosition(int pos) const; + int nextCursorPosition(int oldPos, QTextLayout::CursorMode mode = QTextLayout::SkipCharacters) const; + int previousCursorPosition(int oldPos, QTextLayout::CursorMode mode = QTextLayout::SkipCharacters) const; + void draw(QPainter *p, const QPointF &pos, const QList &selections = QList(), const QRectF &clip = QRectF()) const; + void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition) const; + void drawCursor(QPainter *p, const QPointF &pos, int cursorPosition, int width) const; + QPointF position() const; + void setPosition(const QPointF &p); + QRectF boundingRect() const; + qreal minimumWidth() const; + qreal maximumWidth() const; + void clearLayout(); + void setCursorMoveStyle(Qt::CursorMoveStyle style); + Qt::CursorMoveStyle cursorMoveStyle() const; + int leftCursorPosition(int oldPos) const; + int rightCursorPosition(int oldPos) const; +%If (PyQt_RawFont) + QList glyphRuns(int from = -1, int length = -1) const; +%End +%If (Qt_6_5_0 -) + QList glyphRuns(int from, int length, QTextLayout::GlyphRunRetrievalFlags flags) const; +%End + void setFormats(const QList &overrides); + QList formats() const; + void clearFormats(); + +private: + QTextLayout(const QTextLayout &); + +public: +%If (Qt_6_5_0 -) + + enum GlyphRunRetrievalFlag + { + RetrieveGlyphIndexes, + RetrieveGlyphPositions, + RetrieveStringIndexes, + RetrieveString, + RetrieveAll, + }; + +%End +%If (Qt_6_5_0 -) + typedef QFlags GlyphRunRetrievalFlags; +%End +}; + +class QTextLine +{ +%TypeHeaderCode +#include +%End + +public: + QTextLine(); + bool isValid() const; + QRectF rect() const; + qreal x() const; + qreal y() const; + qreal width() const; + qreal ascent() const; + qreal descent() const; + qreal height() const; + qreal naturalTextWidth() const; + QRectF naturalTextRect() const; + + enum Edge + { + Leading, + Trailing, + }; + + enum CursorPosition + { + CursorBetweenCharacters, + CursorOnCharacter, + }; + + qreal cursorToX(int *cursorPos /In,Out/, QTextLine::Edge edge = QTextLine::Leading) const; + int xToCursor(qreal x, QTextLine::CursorPosition edge = QTextLine::CursorBetweenCharacters) const; + void setLineWidth(qreal width); + void setNumColumns(int columns); + void setNumColumns(int columns, qreal alignmentWidth); + void setPosition(const QPointF &pos); + int textStart() const; + int textLength() const; + int lineNumber() const; + void draw(QPainter *painter, const QPointF &position) const; + QPointF position() const; + qreal leading() const; + void setLeadingIncluded(bool included); + bool leadingIncluded() const; + qreal horizontalAdvance() const; +%If (PyQt_RawFont) + QList glyphRuns(int from = -1, int length = -1) const; +%End +%If (Qt_6_5_0 -) + QList glyphRuns(int from, int length, QTextLayout::GlyphRunRetrievalFlags flags) const; +%End +}; + +bool operator==(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs); +bool operator!=(const QTextLayout::FormatRange &lhs, const QTextLayout::FormatRange &rhs); diff --git a/sip/QtGui/qtextlist.sip b/sip/QtGui/qtextlist.sip new file mode 100644 index 0000000..bdf5558 --- /dev/null +++ b/sip/QtGui/qtextlist.sip @@ -0,0 +1,41 @@ +// qtextlist.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextList : QTextBlockGroup +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTextList(QTextDocument *doc); + virtual ~QTextList(); + int count() const /__len__/; + QTextBlock item(int i) const; + int itemNumber(const QTextBlock &) const; + QString itemText(const QTextBlock &) const; + void removeItem(int i); + void remove(const QTextBlock &); + void add(const QTextBlock &block); + QTextListFormat format() const; + void setFormat(const QTextListFormat &aformat); +}; diff --git a/sip/QtGui/qtextobject.sip b/sip/QtGui/qtextobject.sip new file mode 100644 index 0000000..b644261 --- /dev/null +++ b/sip/QtGui/qtextobject.sip @@ -0,0 +1,292 @@ +// qtextobject.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextObject : QObject +{ +%TypeHeaderCode +#include +%End + +protected: + explicit QTextObject(QTextDocument *doc); + virtual ~QTextObject(); + void setFormat(const QTextFormat &format); + +public: + QTextFormat format() const; + int formatIndex() const; + QTextDocument *document() const; + int objectIndex() const; +}; + +class QTextBlockGroup : QTextObject +{ +%TypeHeaderCode +#include +%End + +protected: + explicit QTextBlockGroup(QTextDocument *doc); + virtual ~QTextBlockGroup(); + virtual void blockInserted(const QTextBlock &block); + virtual void blockRemoved(const QTextBlock &block); + virtual void blockFormatChanged(const QTextBlock &block); + QList blockList() const; +}; + +class QTextFrame : QTextObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTextFrame(QTextDocument *doc); + virtual ~QTextFrame(); + QTextFrameFormat frameFormat() const; + QTextCursor firstCursorPosition() const; + QTextCursor lastCursorPosition() const; + int firstPosition() const; + int lastPosition() const; + QList childFrames() const; + QTextFrame *parentFrame() const; + + class iterator + { +%TypeHeaderCode +#include +%End + + public: + iterator(); + QTextFrame *parentFrame() const; + QTextFrame *currentFrame() const; + QTextBlock currentBlock() const; + bool atEnd() const; + bool operator==(const QTextFrame::iterator &o) const; + bool operator!=(const QTextFrame::iterator &o) const; + QTextFrame::iterator &operator+=(int); +%MethodCode + if (a0 > 0) + while (a0--) + (*sipCpp)++; + else if (a0 < 0) + while (a0++) + (*sipCpp)--; +%End + + QTextFrame::iterator &operator-=(int); +%MethodCode + if (a0 > 0) + while (a0--) + (*sipCpp)--; + else if (a0 < 0) + while (a0++) + (*sipCpp)++; +%End + }; + + typedef QTextFrame::iterator Iterator; + QTextFrame::iterator begin() const; + QTextFrame::iterator end() const; + void setFrameFormat(const QTextFrameFormat &aformat); +}; + +class QTextBlock /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + QTextBlock(); + QTextBlock(const QTextBlock &o); + bool isValid() const; + bool operator==(const QTextBlock &o) const; + bool operator!=(const QTextBlock &o) const; + bool operator<(const QTextBlock &o) const; + int position() const; + int length() const; + bool contains(int position) const; + QTextLayout *layout() const; + QTextBlockFormat blockFormat() const; + int blockFormatIndex() const; + QTextCharFormat charFormat() const; + int charFormatIndex() const; + QString text() const; + const QTextDocument *document() const; + QTextList *textList() const; + + class iterator + { +%TypeHeaderCode +#include +%End + + public: + iterator(); + QTextFragment fragment() const; + bool atEnd() const; + bool operator==(const QTextBlock::iterator &o) const; + bool operator!=(const QTextBlock::iterator &o) const; + QTextBlock::iterator &operator+=(int); +%MethodCode + if (a0 > 0) + while (a0--) + (*sipCpp)++; + else if (a0 < 0) + while (a0++) + (*sipCpp)--; +%End + + QTextBlock::iterator &operator-=(int); +%MethodCode + if (a0 > 0) + while (a0--) + (*sipCpp)--; + else if (a0 < 0) + while (a0++) + (*sipCpp)++; +%End + }; + + typedef QTextBlock::iterator Iterator; + QTextBlock::iterator begin() const; + QTextBlock::iterator end() const; + QTextBlock next() const; + QTextBlock previous() const; + QTextBlockUserData *userData() const; + void setUserData(QTextBlockUserData *data /GetWrapper/); +%MethodCode + // Ownership of the user data is with the document not the text block. + const QTextDocument *td = sipCpp->document(); + + if (td) + { + PyObject *py_td = qtgui_wrap_ancestors(const_cast(td), + sipType_QTextDocument); + + if (!py_td) + { + sipIsErr = 1; + } + else + { + sipTransferTo(a0Wrapper, py_td); + Py_DECREF(py_td); + } + } + + sipCpp->setUserData(a0); +%End + + int userState() const; + void setUserState(int state); + void clearLayout(); + int revision() const; + void setRevision(int rev); + bool isVisible() const; + void setVisible(bool visible); + int blockNumber() const; + int firstLineNumber() const; + void setLineCount(int count); + int lineCount() const; + Qt::LayoutDirection textDirection() const; + QList textFormats() const; +}; + +class QTextFragment +{ +%TypeHeaderCode +#include +%End + +public: + QTextFragment(); + QTextFragment(const QTextFragment &o); + bool isValid() const; + bool operator==(const QTextFragment &o) const; + bool operator!=(const QTextFragment &o) const; + bool operator<(const QTextFragment &o) const; + int position() const; + int length() const; + bool contains(int position) const; + QTextCharFormat charFormat() const; + int charFormatIndex() const; + QString text() const; +%If (PyQt_RawFont) + QList glyphRuns(int from = -1, int length = -1) const; +%End +}; + +class QTextBlockUserData /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QTextBlockUserData(); +}; + +%ModuleHeaderCode +PyObject *qtgui_wrap_ancestors(QObject *obj, const sipTypeDef *td); +%End + +%ModuleCode +// Wrap a QObject and ensure that it's ancestors are all wrapped with the +// correct ownerships. +static PyObject *qtgui_wrap_ancestors_worker(QObject *obj) +{ + if (!obj) + { + Py_INCREF(Py_None); + return Py_None; + } + + PyObject *py_parent = qtgui_wrap_ancestors_worker(obj->parent()); + + if (!py_parent) + return 0; + + PyObject *py_obj = sipConvertFromType(obj, sipType_QObject, + (py_parent != Py_None ? py_parent : 0)); + + Py_DECREF(py_parent); + return py_obj; +} + +PyObject *qtgui_wrap_ancestors(QObject *obj, const sipTypeDef *td) +{ + PyObject *py_parent = qtgui_wrap_ancestors_worker(obj->parent()); + + if (!py_parent) + return 0; + + PyObject *py_obj = sipConvertFromType(obj, td, + (py_parent != Py_None ? py_parent : 0)); + + Py_DECREF(py_parent); + + return py_obj; +} +%End diff --git a/sip/QtGui/qtextoption.sip b/sip/QtGui/qtextoption.sip new file mode 100644 index 0000000..8817a19 --- /dev/null +++ b/sip/QtGui/qtextoption.sip @@ -0,0 +1,96 @@ +// qtextoption.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextOption +{ +%TypeHeaderCode +#include +%End + +public: + QTextOption(); + QTextOption(Qt::Alignment alignment); + ~QTextOption(); + QTextOption(const QTextOption &o); + Qt::Alignment alignment() const; + void setTextDirection(Qt::LayoutDirection aDirection); + Qt::LayoutDirection textDirection() const; + + enum WrapMode + { + NoWrap, + WordWrap, + ManualWrap, + WrapAnywhere, + WrapAtWordBoundaryOrAnywhere, + }; + + void setWrapMode(QTextOption::WrapMode wrap); + QTextOption::WrapMode wrapMode() const; + + enum Flag /BaseType=Flag/ + { + IncludeTrailingSpaces, + ShowTabsAndSpaces, + ShowLineAndParagraphSeparators, + AddSpaceForLineAndParagraphSeparators, + SuppressColors, + ShowDocumentTerminator, + }; + + typedef QFlags Flags; + QTextOption::Flags flags() const; + void setTabArray(const QList &tabStops); + QList tabArray() const; + void setUseDesignMetrics(bool b); + bool useDesignMetrics() const; + void setAlignment(Qt::Alignment aalignment); + void setFlags(QTextOption::Flags flags); + + enum TabType + { + LeftTab, + RightTab, + CenterTab, + DelimiterTab, + }; + + struct Tab + { +%TypeHeaderCode +#include +%End + + Tab(); + Tab(qreal pos, QTextOption::TabType tabType, QChar delim = QChar()); + bool operator==(const QTextOption::Tab &other) const; + bool operator!=(const QTextOption::Tab &other) const; + qreal position; + QTextOption::TabType type; + QChar delimiter; + }; + + void setTabs(const QList &tabStops); + QList tabs() const; + void setTabStopDistance(qreal tabStopDistance); + qreal tabStopDistance() const; +}; diff --git a/sip/QtGui/qtexttable.sip b/sip/QtGui/qtexttable.sip new file mode 100644 index 0000000..d0df8d6 --- /dev/null +++ b/sip/QtGui/qtexttable.sip @@ -0,0 +1,75 @@ +// qtexttable.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextTableCell +{ +%TypeHeaderCode +#include +%End + +public: + QTextTableCell(); + ~QTextTableCell(); + QTextTableCell(const QTextTableCell &o); + QTextCharFormat format() const; + void setFormat(const QTextCharFormat &format); + int row() const; + int column() const; + int rowSpan() const; + int columnSpan() const; + bool isValid() const; + QTextCursor firstCursorPosition() const; + QTextCursor lastCursorPosition() const; + int tableCellFormatIndex() const; + bool operator==(const QTextTableCell &other) const; + bool operator!=(const QTextTableCell &other) const; +}; + +class QTextTable : QTextFrame +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTextTable(QTextDocument *doc); + virtual ~QTextTable(); + void resize(int rows, int cols); + void insertRows(int pos, int num); + void insertColumns(int pos, int num); + void removeRows(int pos, int num); + void removeColumns(int pos, int num); + void mergeCells(int row, int col, int numRows, int numCols); + void mergeCells(const QTextCursor &cursor); + void splitCell(int row, int col, int numRows, int numCols); + int rows() const; + int columns() const; + QTextTableCell cellAt(int row, int col) const; + QTextTableCell cellAt(int position) const; + QTextTableCell cellAt(const QTextCursor &c) const; + QTextCursor rowStart(const QTextCursor &c) const; + QTextCursor rowEnd(const QTextCursor &c) const; + QTextTableFormat format() const; + void setFormat(const QTextTableFormat &aformat); + void appendRows(int count); + void appendColumns(int count); +}; diff --git a/sip/QtGui/qtransform.sip b/sip/QtGui/qtransform.sip new file mode 100644 index 0000000..6a27615 --- /dev/null +++ b/sip/QtGui/qtransform.sip @@ -0,0 +1,132 @@ +// qtransform.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QTransform +{ +%TypeHeaderCode +#include +%End + +%PickleCode + sipRes = Py_BuildValue("ddddddddd", sipCpp->m11(), sipCpp->m12(), sipCpp->m13(), sipCpp->m21(), sipCpp->m22(), sipCpp->m23(), sipCpp->m31(), sipCpp->m32(), sipCpp->m33()); +%End + +public: + enum TransformationType + { + TxNone, + TxTranslate, + TxScale, + TxRotate, + TxShear, + TxProject, + }; + + QTransform(); + QTransform(qreal h11, qreal h12, qreal h13, qreal h21, qreal h22, qreal h23, qreal h31, qreal h32, qreal h33); + QTransform(qreal h11, qreal h12, qreal h13, qreal h21, qreal h22, qreal h23); + QTransform(const QTransform &other); + QTransform::TransformationType type() const; + void setMatrix(qreal m11, qreal m12, qreal m13, qreal m21, qreal m22, qreal m23, qreal m31, qreal m32, qreal m33); + QTransform inverted(bool *invertible = 0) const; + QTransform adjoint() const; + QTransform transposed() const; + QTransform &translate(qreal dx, qreal dy); + QTransform &scale(qreal sx, qreal sy); + QTransform &shear(qreal sh, qreal sv); + QTransform &rotate(qreal angle, Qt::Axis axis = Qt::ZAxis); +%If (Qt_6_5_0 -) + QTransform &rotate(qreal a, Qt::Axis axis, qreal distanceToPlane); +%End + QTransform &rotateRadians(qreal angle, Qt::Axis axis = Qt::ZAxis); +%If (Qt_6_5_0 -) + QTransform &rotateRadians(qreal a, Qt::Axis axis, qreal distanceToPlane); +%End + static bool squareToQuad(const QPolygonF &square, QTransform &result); + static bool quadToSquare(const QPolygonF &quad, QTransform &result); + static bool quadToQuad(const QPolygonF &one, const QPolygonF &two, QTransform &result); + bool operator==(const QTransform &) const; + bool operator!=(const QTransform &) const; + QTransform &operator*=(const QTransform &) /__imatmul__/; + QTransform operator*(const QTransform &o) const /__matmul__/; + void reset(); + void map(int x /Constrained/, int y /Constrained/, int *tx, int *ty) const; + void map(qreal x, qreal y, qreal *tx, qreal *ty) const; + QPoint map(const QPoint &p) const; + QPointF map(const QPointF &p) const; + QLine map(const QLine &l) const; + QLineF map(const QLineF &l) const; + QPolygonF map(const QPolygonF &a) const; + QPolygon map(const QPolygon &a) const; + QRegion map(const QRegion &r) const; + QPainterPath map(const QPainterPath &p) const; + QPolygon mapToPolygon(const QRect &r) const; + QRect mapRect(const QRect &) const; + QRectF mapRect(const QRectF &) const; + bool isAffine() const; + bool isIdentity() const; + bool isInvertible() const; + bool isScaling() const; + bool isRotating() const; + bool isTranslating() const; + qreal determinant() const; + qreal m11() const; + qreal m12() const; + qreal m13() const; + qreal m21() const; + qreal m22() const; + qreal m23() const; + qreal m31() const; + qreal m32() const; + qreal m33() const; + qreal dx() const; + qreal dy() const; + static QTransform fromTranslate(qreal dx, qreal dy); + static QTransform fromScale(qreal dx, qreal dy); + QTransform &operator*=(qreal num); + QTransform &operator/=(qreal div); + QTransform &operator+=(qreal num); + QTransform &operator-=(qreal num); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +QDataStream &operator<<(QDataStream &, const QTransform &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QTransform & /Constrained/) /ReleaseGIL/; +QPoint operator*(const QPoint &p, const QTransform &m); +QPointF operator*(const QPointF &p, const QTransform &m); +QLineF operator*(const QLineF &l, const QTransform &m); +QLine operator*(const QLine &l, const QTransform &m); +QPolygon operator*(const QPolygon &a, const QTransform &m); +QPolygonF operator*(const QPolygonF &a, const QTransform &m); +QRegion operator*(const QRegion &r, const QTransform &m); +QTransform operator*(const QTransform &a, qreal n); +QTransform operator/(const QTransform &a, qreal n); +QTransform operator+(const QTransform &a, qreal n); +QTransform operator-(const QTransform &a, qreal n); +bool qFuzzyCompare(const QTransform &t1, const QTransform &t2); diff --git a/sip/QtGui/qundogroup.sip b/sip/QtGui/qundogroup.sip new file mode 100644 index 0000000..066f359 --- /dev/null +++ b/sip/QtGui/qundogroup.sip @@ -0,0 +1,57 @@ +// qundogroup.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QUndoGroup : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QUndoGroup(QObject *parent /TransferThis/ = 0); + virtual ~QUndoGroup(); + void addStack(QUndoStack *stack); + void removeStack(QUndoStack *stack); + QList stacks() const; + QUndoStack *activeStack() const; + QAction *createRedoAction(QObject *parent /TransferThis/, const QString &prefix = QString()) const /Factory/; + QAction *createUndoAction(QObject *parent /TransferThis/, const QString &prefix = QString()) const /Factory/; + bool canUndo() const; + bool canRedo() const; + QString undoText() const; + QString redoText() const; + bool isClean() const; + +public slots: + void redo(); + void setActiveStack(QUndoStack *stack); + void undo(); + +signals: + void activeStackChanged(QUndoStack *stack); + void canRedoChanged(bool canRedo); + void canUndoChanged(bool canUndo); + void cleanChanged(bool clean); + void indexChanged(int idx); + void redoTextChanged(const QString &redoText); + void undoTextChanged(const QString &undoText); +}; diff --git a/sip/QtGui/qundostack.sip b/sip/QtGui/qundostack.sip new file mode 100644 index 0000000..4d78f3b --- /dev/null +++ b/sip/QtGui/qundostack.sip @@ -0,0 +1,95 @@ +// qundostack.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QUndoCommand /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QUndoCommand(QUndoCommand *parent /TransferThis/ = 0); + QUndoCommand(const QString &text, QUndoCommand *parent /TransferThis/ = 0); + virtual ~QUndoCommand(); + virtual int id() const; + virtual bool mergeWith(const QUndoCommand *other); + virtual void redo(); + void setText(const QString &text); + QString text() const; + virtual void undo(); + int childCount() const; + const QUndoCommand *child(int index) const; + QString actionText() const; + bool isObsolete() const; + void setObsolete(bool obsolete); + +private: + QUndoCommand(const QUndoCommand &); +}; + +class QUndoStack : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QUndoStack(QObject *parent /TransferThis/ = 0); + virtual ~QUndoStack(); + void clear(); + void push(QUndoCommand *cmd /Transfer/); + bool canUndo() const; + bool canRedo() const; + QString undoText() const; + QString redoText() const; + int count() const /__len__/; + int index() const; + QString text(int idx) const; + QAction *createUndoAction(QObject *parent /TransferThis/, const QString &prefix = QString()) const /Factory/; + QAction *createRedoAction(QObject *parent /TransferThis/, const QString &prefix = QString()) const /Factory/; + bool isActive() const; + bool isClean() const; + int cleanIndex() const; + void beginMacro(const QString &text); + void endMacro(); + +public slots: + void redo(); + void setActive(bool active = true); + void setClean(); + void setIndex(int idx); + void undo(); + void resetClean(); + +signals: + void canRedoChanged(bool canRedo); + void canUndoChanged(bool canUndo); + void cleanChanged(bool clean); + void indexChanged(int idx); + void redoTextChanged(const QString &redoText); + void undoTextChanged(const QString &undoText); + +public: + void setUndoLimit(int limit); + int undoLimit() const; + const QUndoCommand *command(int index) const; +}; diff --git a/sip/QtGui/qutimimeconverter.sip b/sip/QtGui/qutimimeconverter.sip new file mode 100644 index 0000000..7b124f2 --- /dev/null +++ b/sip/QtGui/qutimimeconverter.sip @@ -0,0 +1,47 @@ +// qutimimeconverter.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) +%If (macOS) + +class QUtiMimeConverter +{ +%TypeHeaderCode +#include +%End + +public: + QUtiMimeConverter(); + virtual ~QUtiMimeConverter(); + bool canConvert(const QString &mime, const QString &uti) const; + virtual QList convertFromMime(const QString &mime, const QVariant &data, const QString &uti) const = 0; + virtual QString utiForMime(const QString &mime) const = 0; + virtual QString mimeForUti(const QString &uti) const = 0; + virtual QVariant convertToMime(const QString &mime, const QList &data, const QString &uti) const = 0; + virtual int count(const QMimeData *mimeData) const; + +private: + QUtiMimeConverter(const QUtiMimeConverter &); +}; + +%End +%End diff --git a/sip/QtGui/qvalidator.sip b/sip/QtGui/qvalidator.sip new file mode 100644 index 0000000..98e21f6 --- /dev/null +++ b/sip/QtGui/qvalidator.sip @@ -0,0 +1,113 @@ +// qvalidator.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QValidator : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QValidator(QObject *parent /TransferThis/ = 0); + virtual ~QValidator(); + + enum State + { + Invalid, + Intermediate, + Acceptable, + }; + + virtual QValidator::State validate(QString & /In,Out/, int & /In,Out/) const = 0; + virtual void fixup(QString & /In,Out/) const; + void setLocale(const QLocale &locale); + QLocale locale() const; + +signals: + void changed(); +}; + +class QIntValidator : QValidator +{ +%TypeHeaderCode +#include +%End + +public: + explicit QIntValidator(QObject *parent /TransferThis/ = 0); + QIntValidator(int bottom, int top, QObject *parent /TransferThis/ = 0); + virtual ~QIntValidator(); + virtual QValidator::State validate(QString & /In,Out/, int & /In,Out/) const; + virtual void fixup(QString &input /In,Out/) const; + void setBottom(int); + void setTop(int); + void setRange(int bottom, int top); + int bottom() const; + int top() const; +}; + +class QDoubleValidator : QValidator +{ +%TypeHeaderCode +#include +%End + +public: + explicit QDoubleValidator(QObject *parent /TransferThis/ = 0); + QDoubleValidator(double bottom, double top, int decimals, QObject *parent /TransferThis/ = 0); + virtual ~QDoubleValidator(); + virtual QValidator::State validate(QString & /In,Out/, int & /In,Out/) const; + void setRange(double bottom, double top, int decimals = 0); + void setBottom(double); + void setTop(double); + void setDecimals(int); + double bottom() const; + double top() const; + int decimals() const; + + enum Notation + { + StandardNotation, + ScientificNotation, + }; + + void setNotation(QDoubleValidator::Notation); + QDoubleValidator::Notation notation() const; +%If (Qt_6_3_0 -) + virtual void fixup(QString &input) const; +%End +}; + +class QRegularExpressionValidator : QValidator +{ +%TypeHeaderCode +#include +%End + +public: + explicit QRegularExpressionValidator(QObject *parent /TransferThis/ = 0); + QRegularExpressionValidator(const QRegularExpression &re, QObject *parent /TransferThis/ = 0); + virtual ~QRegularExpressionValidator(); + virtual QValidator::State validate(QString &input /In,Out/, int &pos /In,Out/) const; + QRegularExpression regularExpression() const; + void setRegularExpression(const QRegularExpression &re); +}; diff --git a/sip/QtGui/qvectornd.sip b/sip/QtGui/qvectornd.sip new file mode 100644 index 0000000..32bc418 --- /dev/null +++ b/sip/QtGui/qvectornd.sip @@ -0,0 +1,259 @@ +// qvectornd.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QVector2D +{ +%TypeHeaderCode +#include +%End + +public: + QVector2D(); + QVector2D(float xpos, float ypos); + explicit QVector2D(QPoint point); + explicit QVector2D(QPointF point); + explicit QVector2D(QVector3D vector); + explicit QVector2D(QVector4D vector); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + PyObject *x = PyFloat_FromDouble(sipCpp->x()); + PyObject *y = PyFloat_FromDouble(sipCpp->y()); + + if (x && y) + sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QVector2D(%R, %R)", + x, y); + + Py_XDECREF(x); + Py_XDECREF(y); +%End + + bool isNull() const; + float x() const; + float y() const; + void setX(float x); + void setY(float y); + float operator[](int i) const; + float length() const; + float lengthSquared() const; + QVector2D normalized() const; + void normalize(); + float distanceToPoint(QVector2D point) const; + float distanceToLine(QVector2D point, QVector2D direction) const; + QVector2D &operator+=(QVector2D vector); + QVector2D &operator-=(QVector2D vector); + QVector2D &operator*=(float factor); + QVector2D &operator*=(QVector2D vector); + QVector2D &operator/=(float divisor); + QVector2D &operator/=(QVector2D vector); + static float dotProduct(QVector2D v1, QVector2D v2); + QVector3D toVector3D() const; + QVector4D toVector4D() const; + QPoint toPoint() const; + QPointF toPointF() const; +}; + +class QVector3D +{ +%TypeHeaderCode +#include +%End + +public: + QVector3D(); + QVector3D(float xpos, float ypos, float zpos); + explicit QVector3D(QPoint point); + explicit QVector3D(QPointF point); + QVector3D(QVector2D vector, float zpos); +%If (Qt_6_1_0 -) + explicit QVector3D(QVector2D vector); +%End +%If (- Qt_6_1_0) + QVector3D(QVector2D vector); +%End + explicit QVector3D(QVector4D vector); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + PyObject *x = PyFloat_FromDouble(sipCpp->x()); + PyObject *y = PyFloat_FromDouble(sipCpp->y()); + PyObject *z = PyFloat_FromDouble(sipCpp->z()); + + if (x && y && z) + sipRes = PyUnicode_FromFormat( + "PyQt6.QtGui.QVector3D(%R, %R, %R)", x, y, z); + + Py_XDECREF(x); + Py_XDECREF(y); + Py_XDECREF(z); +%End + + bool isNull() const; + float x() const; + float y() const; + float z() const; + void setX(float x); + void setY(float y); + void setZ(float z); + float operator[](int i) const; + float length() const; + float lengthSquared() const; + QVector3D normalized() const; + void normalize(); + QVector3D &operator+=(QVector3D vector); + QVector3D &operator-=(QVector3D vector); + QVector3D &operator*=(float factor); + QVector3D &operator*=(QVector3D vector); + QVector3D &operator/=(float divisor); + QVector3D &operator/=(QVector3D vector); + static float dotProduct(QVector3D v1, QVector3D v2); + static QVector3D crossProduct(QVector3D v1, QVector3D v2); + static QVector3D normal(QVector3D v1, QVector3D v2); + static QVector3D normal(QVector3D v1, QVector3D v2, QVector3D v3); + QVector3D project(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const; + QVector3D unproject(const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const; + float distanceToPoint(QVector3D point) const; + float distanceToPlane(QVector3D plane, QVector3D normal) const; + float distanceToPlane(QVector3D plane1, QVector3D plane2, QVector3D plane3) const; + float distanceToLine(QVector3D point, QVector3D direction) const; + QVector2D toVector2D() const; + QVector4D toVector4D() const; + QPoint toPoint() const; + QPointF toPointF() const; +}; + +class QVector4D +{ +%TypeHeaderCode +#include +%End + +public: + QVector4D(); + QVector4D(float xpos, float ypos, float zpos, float wpos); + explicit QVector4D(QPoint point); + explicit QVector4D(QPointF point); +%If (Qt_6_1_0 -) + explicit QVector4D(QVector2D vector); +%End +%If (- Qt_6_1_0) + QVector4D(QVector2D vector); +%End + QVector4D(QVector2D vector, float zpos, float wpos); +%If (Qt_6_1_0 -) + explicit QVector4D(QVector3D vector); +%End +%If (- Qt_6_1_0) + QVector4D(QVector3D vector); +%End + QVector4D(QVector3D vector, float wpos); + SIP_PYOBJECT __repr__() const /TypeHint="str"/; +%MethodCode + PyObject *x = PyFloat_FromDouble(sipCpp->x()); + PyObject *y = PyFloat_FromDouble(sipCpp->y()); + PyObject *z = PyFloat_FromDouble(sipCpp->z()); + PyObject *w = PyFloat_FromDouble(sipCpp->w()); + + if (x && y && z && w) + sipRes = PyUnicode_FromFormat( + "PyQt6.QtGui.QVector4D(%R, %R, %R, %R)", x, y, z, w); + + Py_XDECREF(x); + Py_XDECREF(y); + Py_XDECREF(z); + Py_XDECREF(w); +%End + + bool isNull() const; + float x() const; + float y() const; + float z() const; + float w() const; + void setX(float x); + void setY(float y); + void setZ(float z); + void setW(float w); + float operator[](int i) const; + float length() const; + float lengthSquared() const; + QVector4D normalized() const; + void normalize(); + QVector4D &operator+=(QVector4D vector); + QVector4D &operator-=(QVector4D vector); + QVector4D &operator*=(float factor); + QVector4D &operator*=(QVector4D vector); + QVector4D &operator/=(float divisor); + QVector4D &operator/=(QVector4D vector); + static float dotProduct(QVector4D v1, QVector4D v2); + QVector2D toVector2D() const; + QVector2D toVector2DAffine() const; + QVector3D toVector3D() const; + QVector3D toVector3DAffine() const; + QPoint toPoint() const; + QPointF toPointF() const; +}; + +bool operator==(QVector4D v1, QVector4D v2); +bool operator==(QVector3D v1, QVector3D v2); +bool operator==(QVector2D v1, QVector2D v2); +bool operator!=(QVector4D v1, QVector4D v2); +bool operator!=(QVector3D v1, QVector3D v2); +bool operator!=(QVector2D v1, QVector2D v2); +QVector4D operator+(QVector4D v1, QVector4D v2); +QVector3D operator+(QVector3D v1, QVector3D v2); +QVector2D operator+(QVector2D v1, QVector2D v2); +QVector4D operator-(QVector4D vector); +QVector4D operator-(QVector4D v1, QVector4D v2); +QVector3D operator-(QVector3D vector); +QVector3D operator-(QVector3D v1, QVector3D v2); +QVector2D operator-(QVector2D vector); +QVector2D operator-(QVector2D v1, QVector2D v2); +QVector4D operator*(const QMatrix4x4 &matrix, const QVector4D &vector); +QVector4D operator*(const QVector4D &vector, const QMatrix4x4 &matrix); +QVector4D operator*(QVector4D v1, QVector4D v2); +QVector4D operator*(QVector4D vector, float factor); +QVector4D operator*(float factor, QVector4D vector); +QVector3D operator*(const QMatrix4x4 &matrix, const QVector3D &vector); +QVector3D operator*(const QVector3D &vector, const QMatrix4x4 &matrix); +QVector3D operator*(QVector3D v1, QVector3D v2); +QVector3D operator*(QVector3D vector, float factor); +QVector3D operator*(float factor, QVector3D vector); +QVector2D operator*(QVector2D v1, QVector2D v2); +QVector2D operator*(QVector2D vector, float factor); +QVector2D operator*(float factor, QVector2D vector); +QVector4D operator/(QVector4D vector, QVector4D divisor); +QVector4D operator/(QVector4D vector, float divisor); +QVector3D operator/(QVector3D vector, QVector3D divisor); +QVector3D operator/(QVector3D vector, float divisor); +QVector2D operator/(QVector2D vector, QVector2D divisor); +QVector2D operator/(QVector2D vector, float divisor); +bool qFuzzyCompare(QVector4D v1, QVector4D v2); +bool qFuzzyCompare(QVector3D v1, QVector3D v2); +bool qFuzzyCompare(QVector2D v1, QVector2D v2); +QDataStream &operator<<(QDataStream &, QVector4D) /ReleaseGIL/; +QDataStream &operator<<(QDataStream &, QVector3D) /ReleaseGIL/; +QDataStream &operator<<(QDataStream &, QVector2D) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QVector4D & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QVector3D & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QVector2D & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtGui/qwindow.sip b/sip/QtGui/qwindow.sip new file mode 100644 index 0000000..cd56f20 --- /dev/null +++ b/sip/QtGui/qwindow.sip @@ -0,0 +1,216 @@ +// qwindow.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QWindow : QObject, QSurface +{ +%TypeHeaderCode +#include +%End + +public: + explicit QWindow(QScreen *screen = 0); + explicit QWindow(QWindow *parent /TransferThis/); + virtual ~QWindow(); + void setSurfaceType(QSurface::SurfaceType surfaceType); + virtual QSurface::SurfaceType surfaceType() const; + bool isVisible() const; + void create(); + WId winId() const; + QWindow *parent(QWindow::AncestorMode mode = QWindow::ExcludeTransients) const; + void setParent(QWindow *parent /Transfer/); + bool isTopLevel() const; + bool isModal() const; + Qt::WindowModality modality() const; + void setModality(Qt::WindowModality modality); + void setFormat(const QSurfaceFormat &format); + virtual QSurfaceFormat format() const; + QSurfaceFormat requestedFormat() const; + void setFlags(Qt::WindowFlags flags); + Qt::WindowFlags flags() const; + Qt::WindowType type() const; + QString title() const; + void setOpacity(qreal level); + +public slots: + void requestActivate(); + +public: + bool isActive() const; + void reportContentOrientationChange(Qt::ScreenOrientation orientation); + Qt::ScreenOrientation contentOrientation() const; + qreal devicePixelRatio() const; + Qt::WindowState windowState() const; + void setWindowState(Qt::WindowState state); + void setTransientParent(QWindow *parent); + QWindow *transientParent() const; + + enum AncestorMode + { + ExcludeTransients, + IncludeTransients, + }; + + bool isAncestorOf(const QWindow *child, QWindow::AncestorMode mode = QWindow::IncludeTransients) const; + bool isExposed() const; + int minimumWidth() const; + int minimumHeight() const; + int maximumWidth() const; + int maximumHeight() const; + QSize minimumSize() const; + QSize maximumSize() const; + QSize baseSize() const; + QSize sizeIncrement() const; + void setMinimumSize(const QSize &size); + void setMaximumSize(const QSize &size); + void setBaseSize(const QSize &size); + void setSizeIncrement(const QSize &size); + void setGeometry(int posx, int posy, int w, int h); + void setGeometry(const QRect &rect); + QRect geometry() const; + QMargins frameMargins() const; + QRect frameGeometry() const; + QPoint framePosition() const; + void setFramePosition(const QPoint &point); + int width() const; + int height() const; + int x() const; + int y() const; + virtual QSize size() const; + QPoint position() const; + void setPosition(const QPoint &pt); + void setPosition(int posx, int posy); + void resize(const QSize &newSize); + void resize(int w, int h); + void setFilePath(const QString &filePath); + QString filePath() const; + void setIcon(const QIcon &icon); + QIcon icon() const; + void destroy(); + bool setKeyboardGrabEnabled(bool grab); + bool setMouseGrabEnabled(bool grab); + QScreen *screen() const; + void setScreen(QScreen *screen); + virtual QObject *focusObject() const; + QPoint mapToGlobal(const QPoint &pos) const; + QPointF mapToGlobal(const QPointF &pos) const; + QPoint mapFromGlobal(const QPoint &pos) const; + QPointF mapFromGlobal(const QPointF &pos) const; + QCursor cursor() const; + void setCursor(const QCursor &); + void unsetCursor(); + +public slots: + void setVisible(bool visible); + void show() /ReleaseGIL/; + void hide(); + void showMinimized() /ReleaseGIL/; + void showMaximized() /ReleaseGIL/; + void showFullScreen() /ReleaseGIL/; + void showNormal() /ReleaseGIL/; + bool close(); + void raise(); + void lower(); + void setTitle(const QString &); + void setX(int arg); + void setY(int arg); + void setWidth(int arg); + void setHeight(int arg); + void setMinimumWidth(int w); + void setMinimumHeight(int h); + void setMaximumWidth(int w); + void setMaximumHeight(int h); + void alert(int msec); + void requestUpdate(); + +signals: + void screenChanged(QScreen *screen); + void modalityChanged(Qt::WindowModality modality); + void windowStateChanged(Qt::WindowState windowState); + void xChanged(int arg); + void yChanged(int arg); + void widthChanged(int arg); + void heightChanged(int arg); + void minimumWidthChanged(int arg); + void minimumHeightChanged(int arg); + void maximumWidthChanged(int arg); + void maximumHeightChanged(int arg); + void visibleChanged(bool arg); + void contentOrientationChanged(Qt::ScreenOrientation orientation); + void focusObjectChanged(QObject *object); + void windowTitleChanged(const QString &title); + +protected: + virtual void exposeEvent(QExposeEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void moveEvent(QMoveEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual void focusOutEvent(QFocusEvent *); + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + virtual bool event(QEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void wheelEvent(QWheelEvent *); + virtual void touchEvent(QTouchEvent *); + virtual void tabletEvent(QTabletEvent *); + +public: + enum Visibility + { + Hidden, + AutomaticVisibility, + Windowed, + Minimized, + Maximized, + FullScreen, + }; + + QWindow::Visibility visibility() const; + void setVisibility(QWindow::Visibility v); + qreal opacity() const; + void setMask(const QRegion ®ion); + QRegion mask() const; + static QWindow *fromWinId(WId id); + +signals: + void visibilityChanged(QWindow::Visibility visibility); + void activeChanged(); + void opacityChanged(qreal opacity); + +public: + void setFlag(Qt::WindowType, bool on = true); + Qt::WindowStates windowStates() const; + void setWindowStates(Qt::WindowStates states); + +public slots: + bool startSystemResize(Qt::Edges edges); + bool startSystemMove(); + +protected: + virtual void paintEvent(QPaintEvent *); + virtual void closeEvent(QCloseEvent *); + virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result /Out/); +}; diff --git a/sip/QtGui/qwindowdefs.sip b/sip/QtGui/qwindowdefs.sip new file mode 100644 index 0000000..6fe45c3 --- /dev/null +++ b/sip/QtGui/qwindowdefs.sip @@ -0,0 +1,24 @@ +// qwindowdefs.sip generated by MetaSIP +// +// This file is part of the QtGui Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +typedef QList QWindowList; +typedef quintptr WId; diff --git a/sip/QtHelp/QtHelpmod.sip b/sip/QtHelp/QtHelpmod.sip new file mode 100644 index 0000000..8d312b0 --- /dev/null +++ b/sip/QtHelp/QtHelpmod.sip @@ -0,0 +1,61 @@ +// QtHelpmod.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtHelp, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qcompressedhelpinfo.sip +%Include qhelpcontentwidget.sip +%Include qhelpengine.sip +%Include qhelpenginecore.sip +%Include qhelpfilterdata.sip +%Include qhelpfilterengine.sip +%Include qhelpfiltersettingswidget.sip +%Include qhelpindexwidget.sip +%Include qhelplink.sip +%Include qhelpsearchengine.sip +%Include qhelpsearchquerywidget.sip +%Include qhelpsearchresultwidget.sip diff --git a/sip/QtHelp/qcompressedhelpinfo.sip b/sip/QtHelp/qcompressedhelpinfo.sip new file mode 100644 index 0000000..8518565 --- /dev/null +++ b/sip/QtHelp/qcompressedhelpinfo.sip @@ -0,0 +1,39 @@ +// qcompressedhelpinfo.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCompressedHelpInfo +{ +%TypeHeaderCode +#include +%End + +public: + QCompressedHelpInfo(); + QCompressedHelpInfo(const QCompressedHelpInfo &other); + ~QCompressedHelpInfo(); + void swap(QCompressedHelpInfo &other); + QString namespaceName() const; + QString component() const; + QVersionNumber version() const; + static QCompressedHelpInfo fromCompressedHelpFile(const QString &documentationFileName); + bool isNull() const; +}; diff --git a/sip/QtHelp/qhelpcontentwidget.sip b/sip/QtHelp/qhelpcontentwidget.sip new file mode 100644 index 0000000..d6272f2 --- /dev/null +++ b/sip/QtHelp/qhelpcontentwidget.sip @@ -0,0 +1,76 @@ +// qhelpcontentwidget.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpContentItem /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + ~QHelpContentItem(); + QHelpContentItem *child(int row) const; + int childCount() const; + QString title() const; + QUrl url() const; + int row() const; + QHelpContentItem *parent() const; + int childPosition(QHelpContentItem *child) const; +}; + +class QHelpContentModel : QAbstractItemModel /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QHelpContentModel(); + void createContents(const QString &customFilterName); + QHelpContentItem *contentItemAt(const QModelIndex &index) const; + virtual QVariant data(const QModelIndex &index, int role) const; + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex parent(const QModelIndex &index) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + bool isCreatingContents() const; + +signals: + void contentsCreationStarted(); + void contentsCreated(); +}; + +class QHelpContentWidget : QTreeView +{ +%TypeHeaderCode +#include +%End + +public: + QModelIndex indexOf(const QUrl &link); + +signals: + void linkActivated(const QUrl &link); + +private: + QHelpContentWidget(); +}; diff --git a/sip/QtHelp/qhelpengine.sip b/sip/QtHelp/qhelpengine.sip new file mode 100644 index 0000000..b113363 --- /dev/null +++ b/sip/QtHelp/qhelpengine.sip @@ -0,0 +1,37 @@ +// qhelpengine.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpEngine : QHelpEngineCore +{ +%TypeHeaderCode +#include +%End + +public: + QHelpEngine(const QString &collectionFile, QObject *parent /TransferThis/ = 0); + virtual ~QHelpEngine(); + QHelpContentModel *contentModel() const; + QHelpIndexModel *indexModel() const; + QHelpContentWidget *contentWidget(); + QHelpIndexWidget *indexWidget(); + QHelpSearchEngine *searchEngine(); +}; diff --git a/sip/QtHelp/qhelpenginecore.sip b/sip/QtHelp/qhelpenginecore.sip new file mode 100644 index 0000000..5e72ba9 --- /dev/null +++ b/sip/QtHelp/qhelpenginecore.sip @@ -0,0 +1,105 @@ +// qhelpenginecore.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpEngineCore : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QHelpContentModel, &sipType_QHelpContentModel, -1, 1}, + {sipName_QHelpContentWidget, &sipType_QHelpContentWidget, -1, 2}, + {sipName_QHelpEngineCore, &sipType_QHelpEngineCore, 10, 3}, + {sipName_QHelpFilterEngine, &sipType_QHelpFilterEngine, -1, 4}, + {sipName_QHelpFilterSettingsWidget, &sipType_QHelpFilterSettingsWidget, -1, 5}, + {sipName_QHelpIndexModel, &sipType_QHelpIndexModel, -1, 6}, + {sipName_QHelpIndexWidget, &sipType_QHelpIndexWidget, -1, 7}, + {sipName_QHelpSearchEngine, &sipType_QHelpSearchEngine, -1, 8}, + {sipName_QHelpSearchQueryWidget, &sipType_QHelpSearchQueryWidget, -1, 9}, + {sipName_QHelpSearchResultWidget, &sipType_QHelpSearchResultWidget, -1, -1}, + {sipName_QHelpEngine, &sipType_QHelpEngine, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + QHelpEngineCore(const QString &collectionFile, QObject *parent /TransferThis/ = 0); + virtual ~QHelpEngineCore(); + bool setupData(); + QString collectionFile() const; + void setCollectionFile(const QString &fileName); + bool copyCollectionFile(const QString &fileName); + static QString namespaceName(const QString &documentationFileName); + bool registerDocumentation(const QString &documentationFileName); + bool unregisterDocumentation(const QString &namespaceName); + QString documentationFileName(const QString &namespaceName); + QStringList registeredDocumentations() const; + QUrl findFile(const QUrl &url) const; + QByteArray fileData(const QUrl &url) const; + bool removeCustomValue(const QString &key); + QVariant customValue(const QString &key, const QVariant &defaultValue = QVariant()) const; + bool setCustomValue(const QString &key, const QVariant &value); + static QVariant metaData(const QString &documentationFileName, const QString &name); + QString error() const; + bool autoSaveFilter() const; + void setAutoSaveFilter(bool save); + +signals: + void setupStarted(); + void setupFinished(); + void warning(const QString &msg); + +public: + QHelpFilterEngine *filterEngine() const; + QList files(const QString namespaceName, const QString &filterName, const QString &extensionFilter = QString()); + void setUsesFilterEngine(bool uses); + bool usesFilterEngine() const; + QList documentsForIdentifier(const QString &id) const; + QList documentsForIdentifier(const QString &id, const QString &filterName) const; + QList documentsForKeyword(const QString &keyword) const; + QList documentsForKeyword(const QString &keyword, const QString &filterName) const; + bool isReadOnly() const; + void setReadOnly(bool enable); +}; diff --git a/sip/QtHelp/qhelpfilterdata.sip b/sip/QtHelp/qhelpfilterdata.sip new file mode 100644 index 0000000..b13f365 --- /dev/null +++ b/sip/QtHelp/qhelpfilterdata.sip @@ -0,0 +1,39 @@ +// qhelpfilterdata.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpFilterData +{ +%TypeHeaderCode +#include +%End + +public: + QHelpFilterData(); + QHelpFilterData(const QHelpFilterData &other); + ~QHelpFilterData(); + bool operator==(const QHelpFilterData &other) const; + void swap(QHelpFilterData &other); + void setComponents(const QStringList &components); + void setVersions(const QList &versions); + QStringList components() const; + QList versions() const; +}; diff --git a/sip/QtHelp/qhelpfilterengine.sip b/sip/QtHelp/qhelpfilterengine.sip new file mode 100644 index 0000000..e0052da --- /dev/null +++ b/sip/QtHelp/qhelpfilterengine.sip @@ -0,0 +1,51 @@ +// qhelpfilterengine.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpFilterEngine : QObject /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QMap namespaceToComponent() const; + QMap namespaceToVersion() const; + QStringList filters() const; + QString activeFilter() const; + bool setActiveFilter(const QString &filterName); + QStringList availableComponents() const; + QHelpFilterData filterData(const QString &filterName) const; + bool setFilterData(const QString &filterName, const QHelpFilterData &filterData); + bool removeFilter(const QString &filterName); + QStringList namespacesForFilter(const QString &filterName) const; + +signals: + void filterActivated(const QString &newFilter); + +protected: + virtual ~QHelpFilterEngine(); + +public: + QList availableVersions() const; + QStringList indices() const; + QStringList indices(const QString &filterName) const; +}; diff --git a/sip/QtHelp/qhelpfiltersettingswidget.sip b/sip/QtHelp/qhelpfiltersettingswidget.sip new file mode 100644 index 0000000..c19cc2e --- /dev/null +++ b/sip/QtHelp/qhelpfiltersettingswidget.sip @@ -0,0 +1,36 @@ +// qhelpfiltersettingswidget.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpFilterSettingsWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QHelpFilterSettingsWidget(QWidget *parent /TransferThis/ = 0); + virtual ~QHelpFilterSettingsWidget(); + void setAvailableComponents(const QStringList &components); + void setAvailableVersions(const QList &versions); + void readSettings(const QHelpFilterEngine *filterEngine); + bool applySettings(QHelpFilterEngine *filterEngine) const; +}; diff --git a/sip/QtHelp/qhelpindexwidget.sip b/sip/QtHelp/qhelpindexwidget.sip new file mode 100644 index 0000000..3d20dd2 --- /dev/null +++ b/sip/QtHelp/qhelpindexwidget.sip @@ -0,0 +1,59 @@ +// qhelpindexwidget.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpIndexModel : QStringListModel /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QHelpEngineCore *helpEngine() const; + void createIndex(const QString &customFilterName); + QModelIndex filter(const QString &filter, const QString &wildcard = QString()); + bool isCreatingIndex() const; + +signals: + void indexCreationStarted(); + void indexCreated(); + +private: + virtual ~QHelpIndexModel(); +}; + +class QHelpIndexWidget : QListView +{ +%TypeHeaderCode +#include +%End + +public slots: + void filterIndices(const QString &filter, const QString &wildcard = QString()); + void activateCurrentItem(); + +signals: + void documentActivated(const QHelpLink &document, const QString &keyword); + void documentsActivated(const QList &documents, const QString &keyword); + +private: + QHelpIndexWidget(); +}; diff --git a/sip/QtHelp/qhelplink.sip b/sip/QtHelp/qhelplink.sip new file mode 100644 index 0000000..58b9b1e --- /dev/null +++ b/sip/QtHelp/qhelplink.sip @@ -0,0 +1,31 @@ +// qhelplink.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +struct QHelpLink +{ +%TypeHeaderCode +#include +%End + + QUrl url; + QString title; +}; diff --git a/sip/QtHelp/qhelpsearchengine.sip b/sip/QtHelp/qhelpsearchengine.sip new file mode 100644 index 0000000..3e30647 --- /dev/null +++ b/sip/QtHelp/qhelpsearchengine.sip @@ -0,0 +1,90 @@ +// qhelpsearchengine.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpSearchQuery +{ +%TypeHeaderCode +#include +%End + +public: + enum FieldName + { + DEFAULT, + FUZZY, + WITHOUT, + PHRASE, + ALL, + ATLEAST, + }; + + QHelpSearchQuery(); + QHelpSearchQuery(QHelpSearchQuery::FieldName field, const QStringList &wordList); +}; + +class QHelpSearchEngine : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QHelpSearchEngine(QHelpEngineCore *helpEngine, QObject *parent /TransferThis/ = 0); + virtual ~QHelpSearchEngine(); + QHelpSearchQueryWidget *queryWidget(); + QHelpSearchResultWidget *resultWidget(); + +public slots: + void reindexDocumentation(); + void cancelIndexing(); + void cancelSearching(); + +signals: + void indexingStarted(); + void indexingFinished(); + void searchingStarted(); + void searchingFinished(int hits); + +public: + int searchResultCount() const; + QList searchResults(int start, int end) const; + QString searchInput() const; + +public slots: + void search(const QString &searchInput); +}; + +class QHelpSearchResult +{ +%TypeHeaderCode +#include +%End + +public: + QHelpSearchResult(); + QHelpSearchResult(const QHelpSearchResult &other); + QHelpSearchResult(const QUrl &url, const QString &title, const QString &snippet); + ~QHelpSearchResult(); + QString title() const; + QUrl url() const; + QString snippet() const; +}; diff --git a/sip/QtHelp/qhelpsearchquerywidget.sip b/sip/QtHelp/qhelpsearchquerywidget.sip new file mode 100644 index 0000000..6d67d99 --- /dev/null +++ b/sip/QtHelp/qhelpsearchquerywidget.sip @@ -0,0 +1,47 @@ +// qhelpsearchquerywidget.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpSearchQueryWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QHelpSearchQueryWidget(QWidget *parent /TransferThis/ = 0); + virtual ~QHelpSearchQueryWidget(); + void expandExtendedSearch(); + void collapseExtendedSearch(); + +signals: + void search(); + +private: + virtual void focusInEvent(QFocusEvent *focusEvent); + virtual void changeEvent(QEvent *event); + +public: + bool isCompactMode() const; + void setCompactMode(bool on); + QString searchInput() const; + void setSearchInput(const QString &searchInput); +}; diff --git a/sip/QtHelp/qhelpsearchresultwidget.sip b/sip/QtHelp/qhelpsearchresultwidget.sip new file mode 100644 index 0000000..53dfd38 --- /dev/null +++ b/sip/QtHelp/qhelpsearchresultwidget.sip @@ -0,0 +1,35 @@ +// qhelpsearchresultwidget.sip generated by MetaSIP +// +// This file is part of the QtHelp Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHelpSearchResultWidget : QWidget /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QHelpSearchResultWidget(); + QUrl linkAt(const QPoint &point); + +signals: + void requestShowLink(const QUrl &url); +}; diff --git a/sip/QtMultimedia/QtMultimediamod.sip b/sip/QtMultimedia/QtMultimediamod.sip new file mode 100644 index 0000000..2ed8cc2 --- /dev/null +++ b/sip/QtMultimedia/QtMultimediamod.sip @@ -0,0 +1,74 @@ +// QtMultimediamod.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtMultimedia, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtNetwork/QtNetworkmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qaudio.sip +%Include qaudiobuffer.sip +%Include qaudiodecoder.sip +%Include qaudiodevice.sip +%Include qaudioformat.sip +%Include qaudioinput.sip +%Include qaudiooutput.sip +%Include qaudiosink.sip +%Include qaudiosource.sip +%Include qcamera.sip +%Include qcameradevice.sip +%Include qimagecapture.sip +%Include qmediacapturesession.sip +%Include qmediadevices.sip +%Include qmediaformat.sip +%Include qmediametadata.sip +%Include qmediaplayer.sip +%Include qmediarecorder.sip +%Include qmediatimerange.sip +%Include qscreencapture.sip +%Include qsoundeffect.sip +%Include qvideoframe.sip +%Include qvideoframeformat.sip +%Include qvideosink.sip +%Include qpymultimedia_qlist.sip diff --git a/sip/QtMultimedia/qaudio.sip b/sip/QtMultimedia/qaudio.sip new file mode 100644 index 0000000..8c98cf5 --- /dev/null +++ b/sip/QtMultimedia/qaudio.sip @@ -0,0 +1,59 @@ +// qaudio.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +namespace QAudio +{ +%TypeHeaderCode +#include +%End + + enum Error + { + NoError, + OpenError, + IOError, + UnderrunError, + FatalError, + }; + + enum State + { + ActiveState, + SuspendedState, + StoppedState, + IdleState, + }; + + enum VolumeScale + { + LinearVolumeScale, + CubicVolumeScale, + LogarithmicVolumeScale, + DecibelVolumeScale, + }; + + float convertVolume(float volume, QAudio::VolumeScale from, QAudio::VolumeScale to); +}; + +%End diff --git a/sip/QtMultimedia/qaudiobuffer.sip b/sip/QtMultimedia/qaudiobuffer.sip new file mode 100644 index 0000000..0a0f15e --- /dev/null +++ b/sip/QtMultimedia/qaudiobuffer.sip @@ -0,0 +1,59 @@ +// qaudiobuffer.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAudioBuffer +{ +%TypeHeaderCode +#include +%End + +public: + QAudioBuffer(); + QAudioBuffer(const QByteArray &data, const QAudioFormat &format, qint64 startTime = -1); + QAudioBuffer(int numFrames, const QAudioFormat &format, qint64 startTime = -1); + QAudioBuffer(const QAudioBuffer &other); + ~QAudioBuffer(); + bool isValid() const; + QAudioFormat format() const; + qsizetype frameCount() const; + qsizetype sampleCount() const; + qsizetype byteCount() const; + qint64 duration() const; + qint64 startTime() const; + void swap(QAudioBuffer &other /Constrained/); + void detach(); + SIP_PYOBJECT constData() const /TypeHint="PyQt6.sip.voidptr"/; +%MethodCode + sipRes = sipConvertFromConstVoidPtrAndSize(sipCpp->constData(), + sipCpp->byteCount()); +%End + + SIP_PYOBJECT data() /TypeHint="PyQt6.sip.voidptr"/; +%MethodCode + sipRes = sipConvertFromVoidPtrAndSize(sipCpp->data(), + sipCpp->byteCount()); +%End +}; + +%End diff --git a/sip/QtMultimedia/qaudiodecoder.sip b/sip/QtMultimedia/qaudiodecoder.sip new file mode 100644 index 0000000..4286908 --- /dev/null +++ b/sip/QtMultimedia/qaudiodecoder.sip @@ -0,0 +1,74 @@ +// qaudiodecoder.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAudioDecoder : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + NoError, + ResourceError, + FormatError, + AccessDeniedError, + NotSupportedError, + }; + + explicit QAudioDecoder(QObject *parent /TransferThis/ = 0); + virtual ~QAudioDecoder(); + bool isSupported() const; + bool isDecoding() const; + QUrl source() const; + void setSource(const QUrl &fileName); + QIODevice *sourceDevice() const; + void setSourceDevice(QIODevice *device); + QAudioDecoder::Error error() const; + QString errorString() const; + QAudioBuffer read() const /ReleaseGIL/; + bool bufferAvailable() const; + qint64 position() const; + qint64 duration() const; + QAudioFormat audioFormat() const; + void setAudioFormat(const QAudioFormat &format); + +public slots: + void start(); + void stop(); + +signals: + void bufferAvailableChanged(bool); + void bufferReady(); + void finished(); + void isDecodingChanged(bool); + void error(QAudioDecoder::Error error); + void sourceChanged(); + void positionChanged(qint64 position); + void durationChanged(qint64 duration); + void formatChanged(const QAudioFormat &format); +}; + +%End diff --git a/sip/QtMultimedia/qaudiodevice.sip b/sip/QtMultimedia/qaudiodevice.sip new file mode 100644 index 0000000..6cb8f30 --- /dev/null +++ b/sip/QtMultimedia/qaudiodevice.sip @@ -0,0 +1,62 @@ +// qaudiodevice.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAudioDevice +{ +%TypeHeaderCode +#include +%End + +public: + enum Mode + { + Null, + Input, + Output, + }; + + QAudioDevice(); + QAudioDevice(const QAudioDevice &other); + ~QAudioDevice(); + void swap(QAudioDevice &other /Constrained/); + bool operator==(const QAudioDevice &other) const; + bool operator!=(const QAudioDevice &other) const; + bool isNull() const; + QByteArray id() const; + QString description() const; + bool isDefault() const; + QAudioDevice::Mode mode() const; + bool isFormatSupported(const QAudioFormat &format) const; + QAudioFormat preferredFormat() const; + int minimumSampleRate() const; + int maximumSampleRate() const; + int minimumChannelCount() const; + int maximumChannelCount() const; + QList supportedSampleFormats() const; +%If (Qt_6_4_0 -) + QAudioFormat::ChannelConfig channelConfiguration() const; +%End +}; + +%End diff --git a/sip/QtMultimedia/qaudioformat.sip b/sip/QtMultimedia/qaudioformat.sip new file mode 100644 index 0000000..96f5f92 --- /dev/null +++ b/sip/QtMultimedia/qaudioformat.sip @@ -0,0 +1,118 @@ +// qaudioformat.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAudioFormat +{ +%TypeHeaderCode +#include +%End + +public: + enum AudioChannelPosition + { + UnknownPosition, + FrontLeft, + FrontRight, + FrontCenter, + LFE, + BackLeft, + BackRight, + FrontLeftOfCenter, + FrontRightOfCenter, + BackCenter, + LFE2, + SideLeft, + SideRight, + TopFrontLeft, + TopFrontRight, + TopFrontCenter, + TopCenter, + TopBackLeft, + TopBackRight, + TopSideLeft, + TopSideRight, + TopBackCenter, + BottomFrontCenter, + BottomFrontLeft, + BottomFrontRight, + }; + + enum ChannelConfig + { + ChannelConfigUnknown, + ChannelConfigMono, + ChannelConfigStereo, + ChannelConfig2Dot1, + ChannelConfigSurround5Dot0, + ChannelConfigSurround5Dot1, + ChannelConfigSurround7Dot0, + ChannelConfigSurround7Dot1, +%If (Qt_6_4_0 -) + ChannelConfig3Dot0, +%End +%If (Qt_6_4_0 -) + ChannelConfig3Dot1, +%End + }; + + enum SampleFormat + { + Unknown, + UInt8, + Int16, + Int32, + Float, + }; + + bool isValid() const; + void setSampleRate(int sampleRate); + int sampleRate() const; + void setChannelCount(int channelCount); + int channelCount() const; + qint32 bytesForDuration(qint64 duration) const; + qint64 durationForBytes(qint32 byteCount) const; + qint32 bytesForFrames(qint32 frameCount) const; + qint32 framesForBytes(qint32 byteCount) const; + qint32 framesForDuration(qint64 duration) const; + qint64 durationForFrames(qint32 frameCount) const; + int bytesPerFrame() const; + void setChannelConfig(QAudioFormat::ChannelConfig config); + QAudioFormat::ChannelConfig channelConfig() const; + int channelOffset(QAudioFormat::AudioChannelPosition channel) const; + void setSampleFormat(QAudioFormat::SampleFormat f); + QAudioFormat::SampleFormat sampleFormat() const; + int bytesPerSample() const; + float normalizedSampleValue(const void *sample) const; +%If (Qt_6_4_0 -) + static QAudioFormat::ChannelConfig defaultChannelConfigForChannelCount(int channelCount); +%End +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QAudioFormat &a, const QAudioFormat &b); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QAudioFormat &a, const QAudioFormat &b); +%End diff --git a/sip/QtMultimedia/qaudioinput.sip b/sip/QtMultimedia/qaudioinput.sip new file mode 100644 index 0000000..1f0ea71 --- /dev/null +++ b/sip/QtMultimedia/qaudioinput.sip @@ -0,0 +1,50 @@ +// qaudioinput.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAudioInput : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QAudioInput(const QAudioDevice &deviceInfo, QObject *parent /TransferThis/ = 0); + explicit QAudioInput(QObject *parent /TransferThis/ = 0); + virtual ~QAudioInput(); + QAudioDevice device() const; + float volume() const; + bool isMuted() const; + +public slots: + void setDevice(const QAudioDevice &device); + void setMuted(bool muted); + void setVolume(float volume); + +signals: + void deviceChanged(); + void volumeChanged(float volume); + void mutedChanged(bool muted); +}; + +%End diff --git a/sip/QtMultimedia/qaudiooutput.sip b/sip/QtMultimedia/qaudiooutput.sip new file mode 100644 index 0000000..d3084c2 --- /dev/null +++ b/sip/QtMultimedia/qaudiooutput.sip @@ -0,0 +1,50 @@ +// qaudiooutput.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAudioOutput : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QAudioOutput(const QAudioDevice &device, QObject *parent /TransferThis/ = 0); + explicit QAudioOutput(QObject *parent /TransferThis/ = 0); + virtual ~QAudioOutput(); + float volume() const; + QAudioDevice device() const; + bool isMuted() const; + +public slots: + void setDevice(const QAudioDevice &device); + void setVolume(float volume); + void setMuted(bool muted); + +signals: + void deviceChanged(); + void volumeChanged(float volume); + void mutedChanged(bool muted); +}; + +%End diff --git a/sip/QtMultimedia/qaudiosink.sip b/sip/QtMultimedia/qaudiosink.sip new file mode 100644 index 0000000..b9c926d --- /dev/null +++ b/sip/QtMultimedia/qaudiosink.sip @@ -0,0 +1,56 @@ +// qaudiosink.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAudioSink : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QAudioSink(const QAudioDevice &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent /TransferThis/ = 0); + QAudioSink(const QAudioFormat &format = QAudioFormat(), QObject *parent /TransferThis/ = 0); + virtual ~QAudioSink(); + QAudioFormat format() const; + void start(QIODevice *device); + QIODevice *start(); + void stop(); + void reset(); + void suspend(); + void resume(); + void setBufferSize(qsizetype bytes); + qsizetype bufferSize() const; + qsizetype bytesFree() const; + qint64 processedUSecs() const; + qint64 elapsedUSecs() const; + QAudio::Error error() const; + QAudio::State state() const; + void setVolume(qreal); + qreal volume() const; + +signals: + void stateChanged(QAudio::State state); +}; + +%End diff --git a/sip/QtMultimedia/qaudiosource.sip b/sip/QtMultimedia/qaudiosource.sip new file mode 100644 index 0000000..d5763ab --- /dev/null +++ b/sip/QtMultimedia/qaudiosource.sip @@ -0,0 +1,56 @@ +// qaudiosource.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAudioSource : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QAudioSource(const QAudioDevice &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent /TransferThis/ = 0); + QAudioSource(const QAudioFormat &format = QAudioFormat(), QObject *parent /TransferThis/ = 0); + virtual ~QAudioSource(); + QAudioFormat format() const; + void start(QIODevice *device); + QIODevice *start(); + void stop(); + void reset(); + void suspend(); + void resume(); + void setBufferSize(qsizetype bytes); + qsizetype bufferSize() const; + qsizetype bytesAvailable() const; + void setVolume(qreal volume); + qreal volume() const; + qint64 processedUSecs() const; + qint64 elapsedUSecs() const; + QAudio::Error error() const; + QAudio::State state() const; + +signals: + void stateChanged(QAudio::State state); +}; + +%End diff --git a/sip/QtMultimedia/qcamera.sip b/sip/QtMultimedia/qcamera.sip new file mode 100644 index 0000000..96b7a81 --- /dev/null +++ b/sip/QtMultimedia/qcamera.sip @@ -0,0 +1,241 @@ +// qcamera.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QCamera : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QAudioDecoder, &sipType_QAudioDecoder, -1, 1}, + {sipName_QAudioInput, &sipType_QAudioInput, -1, 2}, + {sipName_QAudioOutput, &sipType_QAudioOutput, -1, 3}, + {sipName_QAudioSink, &sipType_QAudioSink, -1, 4}, + {sipName_QAudioSource, &sipType_QAudioSource, -1, 5}, + {sipName_QCamera, &sipType_QCamera, -1, 6}, + {sipName_QImageCapture, &sipType_QImageCapture, -1, 7}, + {sipName_QMediaCaptureSession, &sipType_QMediaCaptureSession, -1, 8}, + {sipName_QMediaDevices, &sipType_QMediaDevices, -1, 9}, + {sipName_QMediaPlayer, &sipType_QMediaPlayer, -1, 10}, + {sipName_QMediaRecorder, &sipType_QMediaRecorder, -1, 11}, + #if QT_VERSION >= 0x060500 + {sipName_QScreenCapture, &sipType_QScreenCapture, -1, 12}, + #else + {0, 0, -1, 12}, + #endif + {sipName_QSoundEffect, &sipType_QSoundEffect, -1, 13}, + {sipName_QVideoSink, &sipType_QVideoSink, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum Error + { + NoError, + CameraError, + }; + + enum FocusMode + { + FocusModeAuto, + FocusModeAutoNear, + FocusModeAutoFar, + FocusModeHyperfocal, + FocusModeInfinity, + FocusModeManual, + }; + + enum FlashMode + { + FlashOff, + FlashOn, + FlashAuto, + }; + + enum TorchMode + { + TorchOff, + TorchOn, + TorchAuto, + }; + + enum ExposureMode + { + ExposureAuto, + ExposureManual, + ExposurePortrait, + ExposureNight, + ExposureSports, + ExposureSnow, + ExposureBeach, + ExposureAction, + ExposureLandscape, + ExposureNightPortrait, + ExposureTheatre, + ExposureSunset, + ExposureSteadyPhoto, + ExposureFireworks, + ExposureParty, + ExposureCandlelight, + ExposureBarcode, + }; + + enum WhiteBalanceMode + { + WhiteBalanceAuto, + WhiteBalanceManual, + WhiteBalanceSunlight, + WhiteBalanceCloudy, + WhiteBalanceShade, + WhiteBalanceTungsten, + WhiteBalanceFluorescent, + WhiteBalanceFlash, + WhiteBalanceSunset, + }; + + enum class Feature + { + ColorTemperature, + ExposureCompensation, + IsoSensitivity, + ManualExposureTime, + CustomFocusPoint, + FocusDistance, + }; + + typedef QFlags Features; + QCamera(const QCameraDevice &cameraDevice, QObject *parent /TransferThis/ = 0); + QCamera(QCameraDevice::Position position, QObject *parent /TransferThis/ = 0); + explicit QCamera(QObject *parent /TransferThis/ = 0); + virtual ~QCamera(); + bool isAvailable() const; + bool isActive() const; + QMediaCaptureSession *captureSession() const; + QCameraDevice cameraDevice() const; + void setCameraDevice(const QCameraDevice &cameraDevice); + QCameraFormat cameraFormat() const; + void setCameraFormat(const QCameraFormat &format); + QCamera::Error error() const; + QString errorString() const; + QCamera::Features supportedFeatures() const; + QCamera::FocusMode focusMode() const; + void setFocusMode(QCamera::FocusMode mode); + bool isFocusModeSupported(QCamera::FocusMode mode) const; + QPointF focusPoint() const; + QPointF customFocusPoint() const; + void setCustomFocusPoint(const QPointF &point); + void setFocusDistance(float d); + float focusDistance() const; + float minimumZoomFactor() const; + float maximumZoomFactor() const; + float zoomFactor() const; + void setZoomFactor(float factor); + QCamera::FlashMode flashMode() const; + bool isFlashModeSupported(QCamera::FlashMode mode) const; + bool isFlashReady() const; + QCamera::TorchMode torchMode() const; + bool isTorchModeSupported(QCamera::TorchMode mode) const; + QCamera::ExposureMode exposureMode() const; + bool isExposureModeSupported(QCamera::ExposureMode mode) const; + float exposureCompensation() const; + int isoSensitivity() const; + int manualIsoSensitivity() const; + float exposureTime() const; + float manualExposureTime() const; + int minimumIsoSensitivity() const; + int maximumIsoSensitivity() const; + float minimumExposureTime() const; + float maximumExposureTime() const; + QCamera::WhiteBalanceMode whiteBalanceMode() const; + bool isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const; + int colorTemperature() const; + +public slots: + void setActive(bool active); + void start(); + void stop(); + void zoomTo(float zoom, float rate); + void setFlashMode(QCamera::FlashMode mode); + void setTorchMode(QCamera::TorchMode mode); + void setExposureMode(QCamera::ExposureMode mode); + void setExposureCompensation(float ev); + void setManualIsoSensitivity(int iso); + void setAutoIsoSensitivity(); + void setManualExposureTime(float seconds); + void setAutoExposureTime(); + void setWhiteBalanceMode(QCamera::WhiteBalanceMode mode); + void setColorTemperature(int colorTemperature); + +signals: + void activeChanged(bool); + void errorChanged(); + void errorOccurred(QCamera::Error error, const QString &errorString); + void cameraDeviceChanged(); + void cameraFormatChanged(); + void supportedFeaturesChanged(); + void focusModeChanged(); + void zoomFactorChanged(float); + void minimumZoomFactorChanged(float); + void maximumZoomFactorChanged(float); + void focusDistanceChanged(float); + void customFocusPointChanged(); + void flashReady(bool); + void flashModeChanged(); + void torchModeChanged(); + void exposureTimeChanged(float speed); + void isoSensitivityChanged(int); + void exposureCompensationChanged(float); + void exposureModeChanged(); + void whiteBalanceModeChanged() const; + void colorTemperatureChanged() const; + void focusPointChanged(); + void manualExposureTimeChanged(float speed); + void manualIsoSensitivityChanged(int); +}; + +%End diff --git a/sip/QtMultimedia/qcameradevice.sip b/sip/QtMultimedia/qcameradevice.sip new file mode 100644 index 0000000..c273ce2 --- /dev/null +++ b/sip/QtMultimedia/qcameradevice.sip @@ -0,0 +1,76 @@ +// qcameradevice.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QCameraFormat +{ +%TypeHeaderCode +#include +%End + +public: + QCameraFormat(); + QCameraFormat(const QCameraFormat &other); + ~QCameraFormat(); + QVideoFrameFormat::PixelFormat pixelFormat() const; + QSize resolution() const; + float minFrameRate() const; + float maxFrameRate() const; + bool isNull() const; + bool operator==(const QCameraFormat &other) const; + bool operator!=(const QCameraFormat &other) const; +}; + +%End +%If (Qt_6_2_0 -) + +class QCameraDevice +{ +%TypeHeaderCode +#include +%End + +public: + QCameraDevice(); + QCameraDevice(const QCameraDevice &other); + ~QCameraDevice(); + bool operator==(const QCameraDevice &other) const; + bool operator!=(const QCameraDevice &other) const; + bool isNull() const; + QByteArray id() const; + QString description() const; + bool isDefault() const; + + enum Position + { + UnspecifiedPosition, + BackFace, + FrontFace, + }; + + QCameraDevice::Position position() const; + QList photoResolutions() const; + QList videoFormats() const; +}; + +%End diff --git a/sip/QtMultimedia/qimagecapture.sip b/sip/QtMultimedia/qimagecapture.sip new file mode 100644 index 0000000..aea5fe7 --- /dev/null +++ b/sip/QtMultimedia/qimagecapture.sip @@ -0,0 +1,99 @@ +// qimagecapture.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QImageCapture : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + NoError, + NotReadyError, + ResourceError, + OutOfSpaceError, + NotSupportedFeatureError, + FormatError, + }; + + enum Quality + { + VeryLowQuality, + LowQuality, + NormalQuality, + HighQuality, + VeryHighQuality, + }; + + enum FileFormat + { + UnspecifiedFormat, + JPEG, + PNG, + WebP, + Tiff, + }; + + explicit QImageCapture(QObject *parent /TransferThis/ = 0); + virtual ~QImageCapture(); + bool isAvailable() const; + QMediaCaptureSession *captureSession() const; + QImageCapture::Error error() const; + QString errorString() const; + bool isReadyForCapture() const; + QImageCapture::FileFormat fileFormat() const; + void setFileFormat(QImageCapture::FileFormat format); + static QList supportedFormats(); + static QString fileFormatName(QImageCapture::FileFormat c); + static QString fileFormatDescription(QImageCapture::FileFormat c); + QSize resolution() const; + void setResolution(const QSize &); + void setResolution(int width, int height); + QImageCapture::Quality quality() const; + void setQuality(QImageCapture::Quality quality); + QMediaMetaData metaData() const; + void setMetaData(const QMediaMetaData &metaData); + void addMetaData(const QMediaMetaData &metaData); + +public slots: + int captureToFile(const QString &location = QString()); + int capture(); + +signals: + void errorChanged(); + void errorOccurred(int id, QImageCapture::Error error, const QString &errorString); + void readyForCaptureChanged(bool ready); + void metaDataChanged(); + void fileFormatChanged(); + void qualityChanged(); + void resolutionChanged(); + void imageExposed(int id); + void imageCaptured(int id, const QImage &preview); + void imageAvailable(int id, const QVideoFrame &frame); + void imageSaved(int id, const QString &fileName); +}; + +%End diff --git a/sip/QtMultimedia/qmediacapturesession.sip b/sip/QtMultimedia/qmediacapturesession.sip new file mode 100644 index 0000000..9c0c957 --- /dev/null +++ b/sip/QtMultimedia/qmediacapturesession.sip @@ -0,0 +1,71 @@ +// qmediacapturesession.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QMediaCaptureSession : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QMediaCaptureSession(QObject *parent /TransferThis/ = 0); + virtual ~QMediaCaptureSession(); + QAudioInput *audioInput() const; + void setAudioInput(QAudioInput *device); + QCamera *camera() const; + void setCamera(QCamera *camera); + QImageCapture *imageCapture(); + void setImageCapture(QImageCapture *imageCapture); + QMediaRecorder *recorder(); + void setRecorder(QMediaRecorder *recorder); + void setVideoOutput(QObject *output); + QObject *videoOutput() const; + void setVideoSink(QVideoSink *sink); + QVideoSink *videoSink() const; + void setAudioOutput(QAudioOutput *output); + QAudioOutput *audioOutput() const; + +signals: + void audioInputChanged(); + void cameraChanged(); + void imageCaptureChanged(); + void recorderChanged(); + void videoOutputChanged(); + void audioOutputChanged(); + +public: +%If (Qt_6_5_0 -) + QScreenCapture *screenCapture(); +%End +%If (Qt_6_5_0 -) + void setScreenCapture(QScreenCapture *screenCapture); +%End + +signals: +%If (Qt_6_5_0 -) + void screenCaptureChanged(); +%End +}; + +%End diff --git a/sip/QtMultimedia/qmediadevices.sip b/sip/QtMultimedia/qmediadevices.sip new file mode 100644 index 0000000..e9aa49f --- /dev/null +++ b/sip/QtMultimedia/qmediadevices.sip @@ -0,0 +1,47 @@ +// qmediadevices.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QMediaDevices : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QMediaDevices(QObject *parent /TransferThis/ = 0); + virtual ~QMediaDevices(); + static QList audioInputs(); + static QList audioOutputs(); + static QList videoInputs(); + static QAudioDevice defaultAudioInput(); + static QAudioDevice defaultAudioOutput(); + static QCameraDevice defaultVideoInput(); + +signals: + void audioInputsChanged(); + void audioOutputsChanged(); + void videoInputsChanged(); +}; + +%End diff --git a/sip/QtMultimedia/qmediaformat.sip b/sip/QtMultimedia/qmediaformat.sip new file mode 100644 index 0000000..48d2f00 --- /dev/null +++ b/sip/QtMultimedia/qmediaformat.sip @@ -0,0 +1,120 @@ +// qmediaformat.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QMediaFormat +{ +%TypeHeaderCode +#include +%End + +public: + enum FileFormat + { + UnspecifiedFormat, + WMV, + AVI, + Matroska, + MPEG4, + Ogg, + QuickTime, + WebM, + Mpeg4Audio, + AAC, + WMA, + MP3, + FLAC, + Wave, + }; + + enum class AudioCodec + { + Unspecified, + MP3, + AAC, + AC3, + EAC3, + FLAC, + DolbyTrueHD, + Opus, + Vorbis, + Wave, + WMA, + ALAC, + }; + + enum class VideoCodec + { + Unspecified, + MPEG1, + MPEG2, + MPEG4, + H264, + H265, + VP8, + VP9, + AV1, + Theora, + WMV, + MotionJPEG, + }; + + enum ConversionMode + { + Encode, + Decode, + }; + + enum ResolveFlags + { + NoFlags, + RequiresVideo, + }; + + QMediaFormat(QMediaFormat::FileFormat format = QMediaFormat::UnspecifiedFormat); + QMediaFormat(const QMediaFormat &other); + ~QMediaFormat(); + void swap(QMediaFormat &other /Constrained/); + QMediaFormat::FileFormat fileFormat() const; + void setFileFormat(QMediaFormat::FileFormat f); + void setVideoCodec(QMediaFormat::VideoCodec codec); + QMediaFormat::VideoCodec videoCodec() const; + void setAudioCodec(QMediaFormat::AudioCodec codec); + QMediaFormat::AudioCodec audioCodec() const; + bool isSupported(QMediaFormat::ConversionMode mode) const; + QMimeType mimeType() const; + QList supportedFileFormats(QMediaFormat::ConversionMode m); + QList supportedVideoCodecs(QMediaFormat::ConversionMode m); + QList supportedAudioCodecs(QMediaFormat::ConversionMode m); + static QString fileFormatName(QMediaFormat::FileFormat c); + static QString audioCodecName(QMediaFormat::AudioCodec c); + static QString videoCodecName(QMediaFormat::VideoCodec c); + static QString fileFormatDescription(QMediaFormat::FileFormat c); + static QString audioCodecDescription(QMediaFormat::AudioCodec c); + static QString videoCodecDescription(QMediaFormat::VideoCodec c); + void resolveForEncoding(QMediaFormat::ResolveFlags flags); + bool operator==(const QMediaFormat &other) const; + bool operator!=(const QMediaFormat &other) const; +}; + +%End diff --git a/sip/QtMultimedia/qmediametadata.sip b/sip/QtMultimedia/qmediametadata.sip new file mode 100644 index 0000000..96ba4ec --- /dev/null +++ b/sip/QtMultimedia/qmediametadata.sip @@ -0,0 +1,82 @@ +// qmediametadata.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QMediaMetaData +{ +%TypeHeaderCode +#include +%End + +public: + enum Key + { + Title, + Author, + Comment, + Description, + Genre, + Date, + Language, + Publisher, + Copyright, + Url, + Duration, + MediaType, + FileFormat, + AudioBitRate, + AudioCodec, + VideoBitRate, + VideoCodec, + VideoFrameRate, + AlbumTitle, + AlbumArtist, + ContributingArtist, + TrackNumber, + Composer, + LeadPerformer, + ThumbnailImage, + CoverArtImage, + Orientation, + Resolution, + }; + + QVariant value(QMediaMetaData::Key k) const; + void insert(QMediaMetaData::Key k, const QVariant &value); + QList keys() const; + QString stringValue(QMediaMetaData::Key k) const; + static QString metaDataKeyToString(QMediaMetaData::Key k); + +protected: +%If (Qt_6_4_0 -) + static QMetaType keyType(QMediaMetaData::Key key); +%End +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QMediaMetaData &a, const QMediaMetaData &b); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QMediaMetaData &a, const QMediaMetaData &b); +%End diff --git a/sip/QtMultimedia/qmediaplayer.sip b/sip/QtMultimedia/qmediaplayer.sip new file mode 100644 index 0000000..b94ef49 --- /dev/null +++ b/sip/QtMultimedia/qmediaplayer.sip @@ -0,0 +1,146 @@ +// qmediaplayer.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QMediaPlayer : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum PlaybackState + { + StoppedState, + PlayingState, + PausedState, + }; + + enum MediaStatus + { + NoMedia, + LoadingMedia, + LoadedMedia, + StalledMedia, + BufferingMedia, + BufferedMedia, + EndOfMedia, + InvalidMedia, + }; + + enum Error + { + NoError, + ResourceError, + FormatError, + NetworkError, + AccessDeniedError, + }; + + explicit QMediaPlayer(QObject *parent /TransferThis/ = 0); + virtual ~QMediaPlayer(); + QList audioTracks() const; + QList videoTracks() const; + QList subtitleTracks() const; + int activeAudioTrack() const; + int activeVideoTrack() const; + int activeSubtitleTrack() const; + void setActiveAudioTrack(int index); + void setActiveVideoTrack(int index); + void setActiveSubtitleTrack(int index); + void setAudioOutput(QAudioOutput *output); + QAudioOutput *audioOutput() const; + void setVideoOutput(QObject *); + QObject *videoOutput() const; + void setVideoSink(QVideoSink *sink); + QVideoSink *videoSink() const; + QUrl source() const; + const QIODevice *sourceDevice() const; + QMediaPlayer::PlaybackState playbackState() const; + QMediaPlayer::MediaStatus mediaStatus() const; + qint64 duration() const; + qint64 position() const; + bool hasAudio() const; + bool hasVideo() const; + float bufferProgress() const; + QMediaTimeRange bufferedTimeRange() const; + bool isSeekable() const; + qreal playbackRate() const; + QMediaPlayer::Error error() const; + QString errorString() const; + bool isAvailable() const; + QMediaMetaData metaData() const; + +public slots: + void play(); + void pause(); + void stop(); + void setPosition(qint64 position); + void setPlaybackRate(qreal rate); + void setSource(const QUrl &source); + void setSourceDevice(QIODevice *device, const QUrl &sourceUrl = QUrl()); + +signals: + void sourceChanged(const QUrl &media); + void playbackStateChanged(QMediaPlayer::PlaybackState newState); + void mediaStatusChanged(QMediaPlayer::MediaStatus status); + void durationChanged(qint64 duration); + void positionChanged(qint64 position); + void hasAudioChanged(bool available); + void hasVideoChanged(bool videoAvailable); + void bufferProgressChanged(float progress); + void seekableChanged(bool seekable); + void playbackRateChanged(qreal rate); + void metaDataChanged(); + void videoOutputChanged(); + void audioOutputChanged(); + void tracksChanged(); + void activeTracksChanged(); + void errorChanged(); + void errorOccurred(QMediaPlayer::Error error, const QString &errorString); + +public: + enum Loops /BaseType=IntEnum/ + { + Infinite, + Once, + }; + + int loops() const; + void setLoops(int loops); + +signals: + void loopsChanged(); + +public: +%If (Qt_6_5_0 -) + bool isPlaying() const; +%End + +signals: +%If (Qt_6_5_0 -) + void playingChanged(bool playing); +%End +}; + +%End diff --git a/sip/QtMultimedia/qmediarecorder.sip b/sip/QtMultimedia/qmediarecorder.sip new file mode 100644 index 0000000..4ba8141 --- /dev/null +++ b/sip/QtMultimedia/qmediarecorder.sip @@ -0,0 +1,121 @@ +// qmediarecorder.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QMediaRecorder : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Quality + { + VeryLowQuality, + LowQuality, + NormalQuality, + HighQuality, + VeryHighQuality, + }; + + enum EncodingMode + { + ConstantQualityEncoding, + ConstantBitRateEncoding, + AverageBitRateEncoding, + TwoPassEncoding, + }; + + enum RecorderState + { + StoppedState, + RecordingState, + PausedState, + }; + + enum Error + { + NoError, + ResourceError, + FormatError, + OutOfSpaceError, + LocationNotWritable, + }; + + QMediaRecorder(QObject *parent /TransferThis/ = 0); + virtual ~QMediaRecorder(); + bool isAvailable() const; + QUrl outputLocation() const; + void setOutputLocation(const QUrl &location); + QUrl actualLocation() const; + QMediaRecorder::RecorderState recorderState() const; + QMediaRecorder::Error error() const; + QString errorString() const; + qint64 duration() const; + QMediaFormat mediaFormat() const; + void setMediaFormat(const QMediaFormat &format); + QMediaRecorder::EncodingMode encodingMode() const; + void setEncodingMode(QMediaRecorder::EncodingMode); + QMediaRecorder::Quality quality() const; + void setQuality(QMediaRecorder::Quality quality); + QSize videoResolution() const; + void setVideoResolution(const QSize &); + void setVideoResolution(int width, int height); + qreal videoFrameRate() const; + void setVideoFrameRate(qreal frameRate); + int videoBitRate() const; + void setVideoBitRate(int bitRate); + int audioBitRate() const; + void setAudioBitRate(int bitRate); + int audioChannelCount() const; + void setAudioChannelCount(int channels); + int audioSampleRate() const; + void setAudioSampleRate(int sampleRate); + QMediaMetaData metaData() const; + void setMetaData(const QMediaMetaData &metaData); + QMediaCaptureSession *captureSession() const; + +public slots: + void record(); + void pause(); + void stop(); + +signals: + void recorderStateChanged(QMediaRecorder::RecorderState state /ScopesStripped=1/); + void durationChanged(qint64 duration); + void actualLocationChanged(const QUrl &location); + void errorOccurred(QMediaRecorder::Error error /ScopesStripped=1/, const QString &errorString); + void errorChanged(); + void metaDataChanged(); + void mediaFormatChanged(); + void encodingModeChanged(); + void qualityChanged(); + void videoResolutionChanged(); + void videoFrameRateChanged(); + void videoBitRateChanged(); + void audioBitRateChanged(); + void audioChannelCountChanged(); + void audioSampleRateChanged(); +}; + +%End diff --git a/sip/QtMultimedia/qmediatimerange.sip b/sip/QtMultimedia/qmediatimerange.sip new file mode 100644 index 0000000..4c121a4 --- /dev/null +++ b/sip/QtMultimedia/qmediatimerange.sip @@ -0,0 +1,89 @@ +// qmediatimerange.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QMediaTimeRange +{ +%TypeHeaderCode +#include +%End + +public: + QMediaTimeRange(); + QMediaTimeRange(const QMediaTimeRange::Interval &); + QMediaTimeRange(qint64 start, qint64 end); + QMediaTimeRange(const QMediaTimeRange &range); + ~QMediaTimeRange(); + qint64 earliestTime() const; + qint64 latestTime() const; + QList intervals() const; + bool isEmpty() const; + bool isContinuous() const; + bool contains(qint64 time) const; + void addInterval(const QMediaTimeRange::Interval &interval); + void addInterval(qint64 start, qint64 end); + void addTimeRange(const QMediaTimeRange &); + void removeInterval(const QMediaTimeRange::Interval &interval); + void removeInterval(qint64 start, qint64 end); + void removeTimeRange(const QMediaTimeRange &); + QMediaTimeRange &operator+=(const QMediaTimeRange::Interval &); + QMediaTimeRange &operator+=(const QMediaTimeRange &); + QMediaTimeRange &operator-=(const QMediaTimeRange::Interval &); + QMediaTimeRange &operator-=(const QMediaTimeRange &); + void clear(); + + struct Interval + { +%TypeHeaderCode +#include +%End + + Interval(qint64 start, qint64 end); + qint64 start() const; + qint64 end() const; + bool contains(qint64 time) const; + bool isNormal() const; + QMediaTimeRange::Interval normalized() const; + QMediaTimeRange::Interval translated(qint64 offset) const; + }; +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QMediaTimeRange &, const QMediaTimeRange &); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QMediaTimeRange &, const QMediaTimeRange &); +%End +%If (Qt_6_2_0 -) +QMediaTimeRange operator+(const QMediaTimeRange &, const QMediaTimeRange &); +%End +%If (Qt_6_2_0 -) +QMediaTimeRange operator-(const QMediaTimeRange &, const QMediaTimeRange &); +%End +%If (Qt_6_2_0 -) +bool operator==(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs); +%End +%If (Qt_6_2_0 -) +bool operator!=(QMediaTimeRange::Interval lhs, QMediaTimeRange::Interval rhs); +%End diff --git a/sip/QtMultimedia/qpymultimedia_qlist.sip b/sip/QtMultimedia/qpymultimedia_qlist.sip new file mode 100644 index 0000000..ee36cbe --- /dev/null +++ b/sip/QtMultimedia/qpymultimedia_qlist.sip @@ -0,0 +1,530 @@ +// This is the SIP interface definition for the QList based mapped types +// specific to the QtMultimedia module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + + +%MappedType QList + /TypeHintIn="Iterable[QAudioFormat.SampleFormat]", + TypeHintOut="List[QAudioFormat.SampleFormat]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(sipCpp->at(i), + sipType_QAudioFormat_SampleFormat); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QAudioFormat_SampleFormat); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QAudioFormat.SampleFormat' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType QList + /TypeHintIn="Iterable[QImageCapture.FileFormat]", + TypeHintOut="List[QImageCapture.FileFormat]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(sipCpp->at(i), + sipType_QImageCapture_FileFormat); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QImageCapture_FileFormat); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QImageCapture.FileFormat' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType QList + /TypeHintIn="Iterable[QMediaFormat.FileFormat]", + TypeHintOut="List[QMediaFormat.FileFormat]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(sipCpp->at(i), + sipType_QMediaFormat_FileFormat); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QMediaFormat_FileFormat); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QMediaFormat.FileFormat' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType QList + /TypeHintIn="Iterable[QMediaFormat.AudioCodec]", + TypeHintOut="List[QMediaFormat.AudioCodec]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(static_cast(sipCpp->at(i)), + sipType_QMediaFormat_AudioCodec); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QMediaFormat_AudioCodec); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QMediaFormat.AudioCodec' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +%MappedType QList + /TypeHintIn="Iterable[QMediaFormat.VideoCodec]", + TypeHintOut="List[QMediaFormat.VideoCodec]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(static_cast(sipCpp->at(i)), + sipType_QMediaFormat_VideoCodec); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QMediaFormat_VideoCodec); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QMediaFormat.VideoCodec' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + + +%End diff --git a/sip/QtMultimedia/qscreencapture.sip b/sip/QtMultimedia/qscreencapture.sip new file mode 100644 index 0000000..d8777fe --- /dev/null +++ b/sip/QtMultimedia/qscreencapture.sip @@ -0,0 +1,62 @@ +// qscreencapture.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) + +class QScreenCapture : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + NoError, + InternalError, + CapturingNotSupported, + CaptureFailed, + NotFound, + }; + + explicit QScreenCapture(QObject *parent /TransferThis/ = 0); + virtual ~QScreenCapture(); + QMediaCaptureSession *captureSession() const; + void setScreen(QScreen *screen); + QScreen *screen() const; + bool isActive() const; + QScreenCapture::Error error() const; + QString errorString() const; + +public slots: + void setActive(bool active); + void start(); + void stop(); + +signals: + void activeChanged(bool); + void errorChanged(); + void screenChanged(QScreen *); + void errorOccurred(QScreenCapture::Error error, const QString &errorString); +}; + +%End diff --git a/sip/QtMultimedia/qsoundeffect.sip b/sip/QtMultimedia/qsoundeffect.sip new file mode 100644 index 0000000..0e0fa76 --- /dev/null +++ b/sip/QtMultimedia/qsoundeffect.sip @@ -0,0 +1,80 @@ +// qsoundeffect.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QSoundEffect : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Loop + { + Infinite, + }; + + enum Status + { + Null, + Loading, + Ready, + Error, + }; + + QSoundEffect(const QAudioDevice &audioDevice, QObject *parent /TransferThis/ = 0); + explicit QSoundEffect(QObject *parent /TransferThis/ = 0); + virtual ~QSoundEffect(); + static QStringList supportedMimeTypes(); + QAudioDevice audioDevice(); + void setAudioDevice(const QAudioDevice &device); + QUrl source() const; + void setSource(const QUrl &url); + int loopCount() const; + int loopsRemaining() const; + void setLoopCount(int loopCount); + float volume() const; + void setVolume(float volume); + bool isMuted() const; + void setMuted(bool muted); + bool isLoaded() const; + bool isPlaying() const; + QSoundEffect::Status status() const; + +public slots: + void play(); + void stop(); + +signals: + void audioDeviceChanged(); + void sourceChanged(); + void loopCountChanged(); + void loopsRemainingChanged(); + void volumeChanged(); + void mutedChanged(); + void loadedChanged(); + void playingChanged(); + void statusChanged(); +}; + +%End diff --git a/sip/QtMultimedia/qvideoframe.sip b/sip/QtMultimedia/qvideoframe.sip new file mode 100644 index 0000000..8f11a3a --- /dev/null +++ b/sip/QtMultimedia/qvideoframe.sip @@ -0,0 +1,122 @@ +// qvideoframe.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QVideoFrame +{ +%TypeHeaderCode +#include +%End + +public: + QVideoFrame(); + QVideoFrame(const QVideoFrameFormat &format); + QVideoFrame(const QVideoFrame &other); + ~QVideoFrame(); + + enum HandleType + { + NoHandle, + RhiTextureHandle, + }; + + enum MapMode + { + NotMapped, + ReadOnly, + WriteOnly, + ReadWrite, + }; + + bool isValid() const; + QVideoFrameFormat::PixelFormat pixelFormat() const; + QVideoFrame::HandleType handleType() const; + QSize size() const; + int width() const; + int height() const; + bool isMapped() const; + bool isReadable() const; + bool isWritable() const; + QVideoFrame::MapMode mapMode() const; + bool map(QVideoFrame::MapMode mode); + void unmap(); + int bytesPerLine(int plane) const; + void *bits(int plane) [uchar * (int plane)]; + int mappedBytes(int plane) const; + qint64 startTime() const; + void setStartTime(qint64 time); + qint64 endTime() const; + void setEndTime(qint64 time); + int planeCount() const; + bool operator==(const QVideoFrame &other) const; + bool operator!=(const QVideoFrame &other) const; + QVideoFrameFormat surfaceFormat() const; + QImage toImage() const; + + struct PaintOptions + { +%TypeHeaderCode +#include +%End + + QColor backgroundColor; + Qt::AspectRatioMode aspectRatioMode; + + enum PaintFlag /BaseType=Flag/ + { + DontDrawSubtitles, + }; + + typedef QFlags PaintFlags; + QVideoFrame::PaintOptions::PaintFlags paintFlags; + }; + + QString subtitleText() const; + void setSubtitleText(const QString &text); + void paint(QPainter *painter, const QRectF &rect, const QVideoFrame::PaintOptions &options); +%If (Qt_6_3_0 -) + + enum RotationAngle + { + Rotation0, + Rotation90, + Rotation180, + Rotation270, + }; + +%End +%If (Qt_6_3_0 -) + void setRotationAngle(QVideoFrame::RotationAngle); +%End +%If (Qt_6_3_0 -) + QVideoFrame::RotationAngle rotationAngle() const; +%End +%If (Qt_6_3_0 -) + void setMirrored(bool); +%End +%If (Qt_6_3_0 -) + bool mirrored() const; +%End +}; + +%End diff --git a/sip/QtMultimedia/qvideoframeformat.sip b/sip/QtMultimedia/qvideoframeformat.sip new file mode 100644 index 0000000..b5e6000 --- /dev/null +++ b/sip/QtMultimedia/qvideoframeformat.sip @@ -0,0 +1,175 @@ +// qvideoframeformat.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QVideoFrameFormat +{ +%TypeHeaderCode +#include +%End + +public: + enum PixelFormat + { + Format_Invalid, + Format_YUV420P, + Format_YUV422P, +%If (Qt_6_4_0 -) + Format_YUV420P10, +%End + Format_YV12, + Format_UYVY, + Format_YUYV, + Format_NV12, + Format_NV21, + Format_IMC1, + Format_IMC2, + Format_IMC3, + Format_IMC4, + Format_Y8, + Format_Y16, + Format_P010, + Format_P016, + Format_Jpeg, + Format_SamplerExternalOES, + Format_ARGB8888, + Format_ARGB8888_Premultiplied, + Format_XRGB8888, + Format_BGRA8888, + Format_BGRA8888_Premultiplied, + Format_BGRX8888, + Format_ABGR8888, + Format_XBGR8888, + Format_RGBA8888, + Format_RGBX8888, + Format_AYUV, + Format_AYUV_Premultiplied, + Format_SamplerRect, + }; + + enum Direction + { + TopToBottom, + BottomToTop, + }; + + enum YCbCrColorSpace + { + YCbCr_Undefined, + YCbCr_BT601, + YCbCr_BT709, + YCbCr_xvYCC601, + YCbCr_xvYCC709, + YCbCr_JPEG, +%If (Qt_6_3_0 -) + YCbCr_BT2020, +%End + }; + + QVideoFrameFormat(); + QVideoFrameFormat(const QSize &size, QVideoFrameFormat::PixelFormat pixelFormat); + QVideoFrameFormat(const QVideoFrameFormat &format); + ~QVideoFrameFormat(); + bool operator==(const QVideoFrameFormat &format) const; + bool operator!=(const QVideoFrameFormat &format) const; + bool isValid() const; + QVideoFrameFormat::PixelFormat pixelFormat() const; + QSize frameSize() const; + void setFrameSize(const QSize &size); + void setFrameSize(int width, int height); + int frameWidth() const; + int frameHeight() const; + int planeCount() const; + QRect viewport() const; + void setViewport(const QRect &viewport); + QVideoFrameFormat::Direction scanLineDirection() const; + void setScanLineDirection(QVideoFrameFormat::Direction direction); + qreal frameRate() const; + void setFrameRate(qreal rate); + QVideoFrameFormat::YCbCrColorSpace yCbCrColorSpace() const; + void setYCbCrColorSpace(QVideoFrameFormat::YCbCrColorSpace colorSpace); + bool isMirrored() const; + void setMirrored(bool mirrored); + static QVideoFrameFormat::PixelFormat pixelFormatFromImageFormat(QImage::Format format); + static QImage::Format imageFormatFromPixelFormat(QVideoFrameFormat::PixelFormat format); +%If (Qt_6_2_0 -) + static QString pixelFormatToString(QVideoFrameFormat::PixelFormat pixelFormat); +%End +%If (Qt_6_4_0 -) + + enum ColorSpace + { + ColorSpace_Undefined, + ColorSpace_BT601, + ColorSpace_BT709, + ColorSpace_AdobeRgb, + ColorSpace_BT2020, + }; + +%End +%If (Qt_6_4_0 -) + + enum ColorTransfer + { + ColorTransfer_Unknown, + ColorTransfer_BT709, + ColorTransfer_BT601, + ColorTransfer_Linear, + ColorTransfer_Gamma22, + ColorTransfer_Gamma28, + ColorTransfer_ST2084, + ColorTransfer_STD_B67, + }; + +%End +%If (Qt_6_4_0 -) + + enum ColorRange + { + ColorRange_Unknown, + ColorRange_Video, + ColorRange_Full, + }; + +%End +%If (Qt_6_4_0 -) + QVideoFrameFormat::ColorSpace colorSpace() const; +%End +%If (Qt_6_4_0 -) + void setColorSpace(QVideoFrameFormat::ColorSpace colorSpace); +%End +%If (Qt_6_4_0 -) + QVideoFrameFormat::ColorTransfer colorTransfer() const; +%End +%If (Qt_6_4_0 -) + void setColorTransfer(QVideoFrameFormat::ColorTransfer colorTransfer); +%End +%If (Qt_6_4_0 -) + QVideoFrameFormat::ColorRange colorRange() const; +%End +%If (Qt_6_4_0 -) + void setColorRange(QVideoFrameFormat::ColorRange range); +%End +}; + +%End diff --git a/sip/QtMultimedia/qvideosink.sip b/sip/QtMultimedia/qvideosink.sip new file mode 100644 index 0000000..0db9d31 --- /dev/null +++ b/sip/QtMultimedia/qvideosink.sip @@ -0,0 +1,46 @@ +// qvideosink.sip generated by MetaSIP +// +// This file is part of the QtMultimedia Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QVideoSink : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QVideoSink(QObject *parent /TransferThis/ = 0); + virtual ~QVideoSink(); + QSize videoSize() const; + QString subtitleText() const; + void setSubtitleText(const QString &subtitle); + void setVideoFrame(const QVideoFrame &frame); + QVideoFrame videoFrame() const; + +signals: + void videoFrameChanged(const QVideoFrame &frame) const; + void subtitleTextChanged(const QString &subtitleText) const; + void videoSizeChanged(); +}; + +%End diff --git a/sip/QtMultimediaWidgets/QtMultimediaWidgetsmod.sip b/sip/QtMultimediaWidgets/QtMultimediaWidgetsmod.sip new file mode 100644 index 0000000..38da6ec --- /dev/null +++ b/sip/QtMultimediaWidgets/QtMultimediaWidgetsmod.sip @@ -0,0 +1,51 @@ +// QtMultimediaWidgetsmod.sip generated by MetaSIP +// +// This file is part of the QtMultimediaWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtMultimediaWidgets, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtMultimedia/QtMultimediamod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qgraphicsvideoitem.sip +%Include qvideowidget.sip diff --git a/sip/QtMultimediaWidgets/qgraphicsvideoitem.sip b/sip/QtMultimediaWidgets/qgraphicsvideoitem.sip new file mode 100644 index 0000000..f3f504a --- /dev/null +++ b/sip/QtMultimediaWidgets/qgraphicsvideoitem.sip @@ -0,0 +1,59 @@ +// qgraphicsvideoitem.sip generated by MetaSIP +// +// This file is part of the QtMultimediaWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGraphicsVideoItem : QGraphicsObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsVideoItem(QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsVideoItem(); + QVideoSink *videoSink() const; + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); + QPointF offset() const; + void setOffset(const QPointF &offset); + QSizeF size() const; + void setSize(const QSizeF &size); + QSizeF nativeSize() const; + virtual QRectF boundingRect() const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual int type() const; + +signals: + void nativeSizeChanged(const QSizeF &size); + +protected: + virtual void timerEvent(QTimerEvent *event); + virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value); +}; + +%End + +%ModuleCode +// This is needed by the %ConvertToSubClassCode. +#include +%End diff --git a/sip/QtMultimediaWidgets/qvideowidget.sip b/sip/QtMultimediaWidgets/qvideowidget.sip new file mode 100644 index 0000000..c593adc --- /dev/null +++ b/sip/QtMultimediaWidgets/qvideowidget.sip @@ -0,0 +1,84 @@ +// qvideowidget.sip generated by MetaSIP +// +// This file is part of the QtMultimediaWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QVideoWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QGraphicsVideoItem, &sipType_QGraphicsVideoItem, -1, 1}, + {sipName_QVideoWidget, &sipType_QVideoWidget, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + explicit QVideoWidget(QWidget *parent /TransferThis/ = 0); + virtual ~QVideoWidget(); + QVideoSink *videoSink() const; + Qt::AspectRatioMode aspectRatioMode() const; + bool isFullScreen() const; + virtual QSize sizeHint() const; + +public slots: + void setFullScreen(bool fullScreen); + void setAspectRatioMode(Qt::AspectRatioMode mode); + +signals: + void fullScreenChanged(bool fullScreen); + void aspectRatioModeChanged(Qt::AspectRatioMode mode); + +protected: + virtual bool event(QEvent *event); + virtual void showEvent(QShowEvent *event); + virtual void hideEvent(QHideEvent *event); + virtual void resizeEvent(QResizeEvent *event); + virtual void moveEvent(QMoveEvent *event); +}; + +%End diff --git a/sip/QtNetwork/QtNetworkmod.sip b/sip/QtNetwork/QtNetworkmod.sip new file mode 100644 index 0000000..b2c25e2 --- /dev/null +++ b/sip/QtNetwork/QtNetworkmod.sip @@ -0,0 +1,89 @@ +// QtNetworkmod.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtNetwork, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qabstractnetworkcache.sip +%Include qabstractsocket.sip +%Include qauthenticator.sip +%Include qdnslookup.sip +%Include qhostaddress.sip +%Include qhostinfo.sip +%Include qhstspolicy.sip +%Include qhttp1configuration.sip +%Include qhttp2configuration.sip +%Include qhttpmultipart.sip +%Include qlocalserver.sip +%Include qlocalsocket.sip +%Include qnetworkaccessmanager.sip +%Include qnetworkcookie.sip +%Include qnetworkcookiejar.sip +%Include qnetworkdatagram.sip +%Include qnetworkdiskcache.sip +%Include qnetworkinformation.sip +%Include qnetworkinterface.sip +%Include qnetworkproxy.sip +%Include qnetworkreply.sip +%Include qnetworkrequest.sip +%Include qocspresponse.sip +%Include qpassworddigestor.sip +%Include qssl.sip +%Include qsslcertificate.sip +%Include qsslcertificateextension.sip +%Include qsslcipher.sip +%Include qsslconfiguration.sip +%Include qssldiffiehellmanparameters.sip +%Include qsslellipticcurve.sip +%Include qsslerror.sip +%Include qsslkey.sip +%Include qsslpresharedkeyauthenticator.sip +%Include qsslserver.sip +%Include qsslsocket.sip +%Include qtcpserver.sip +%Include qtcpsocket.sip +%Include qudpsocket.sip +%Include qpynetwork_qmap.sip +%Include qpynetwork_qlist.sip +%Include qpynetwork_qhash.sip diff --git a/sip/QtNetwork/qabstractnetworkcache.sip b/sip/QtNetwork/qabstractnetworkcache.sip new file mode 100644 index 0000000..3e3a52c --- /dev/null +++ b/sip/QtNetwork/qabstractnetworkcache.sip @@ -0,0 +1,78 @@ +// qabstractnetworkcache.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkCacheMetaData +{ +%TypeHeaderCode +#include +%End + + typedef QList> RawHeaderList; + typedef QHash AttributesMap; + +public: + QNetworkCacheMetaData(); + QNetworkCacheMetaData(const QNetworkCacheMetaData &other); + ~QNetworkCacheMetaData(); + bool operator==(const QNetworkCacheMetaData &other) const; + bool operator!=(const QNetworkCacheMetaData &other) const; + bool isValid() const; + QUrl url() const; + void setUrl(const QUrl &url); + QNetworkCacheMetaData::RawHeaderList rawHeaders() const; + void setRawHeaders(const QNetworkCacheMetaData::RawHeaderList &headers); + QDateTime lastModified() const; + void setLastModified(const QDateTime &dateTime); + QDateTime expirationDate() const; + void setExpirationDate(const QDateTime &dateTime); + bool saveToDisk() const; + void setSaveToDisk(bool allow); + QNetworkCacheMetaData::AttributesMap attributes() const; + void setAttributes(const QNetworkCacheMetaData::AttributesMap &attributes); + void swap(QNetworkCacheMetaData &other /Constrained/); +}; + +QDataStream &operator<<(QDataStream &, const QNetworkCacheMetaData & /Constrained/) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QNetworkCacheMetaData & /Constrained/) /ReleaseGIL/; + +class QAbstractNetworkCache : QObject +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QAbstractNetworkCache(); + virtual QNetworkCacheMetaData metaData(const QUrl &url) = 0; + virtual void updateMetaData(const QNetworkCacheMetaData &metaData) = 0; + virtual QIODevice *data(const QUrl &url) = 0 /Factory/; + virtual bool remove(const QUrl &url) = 0; + virtual qint64 cacheSize() const = 0; + virtual QIODevice *prepare(const QNetworkCacheMetaData &metaData) = 0; + virtual void insert(QIODevice *device) = 0; + +public slots: + virtual void clear() = 0; + +protected: + explicit QAbstractNetworkCache(QObject *parent /TransferThis/ = 0); +}; diff --git a/sip/QtNetwork/qabstractsocket.sip b/sip/QtNetwork/qabstractsocket.sip new file mode 100644 index 0000000..48f11ec --- /dev/null +++ b/sip/QtNetwork/qabstractsocket.sip @@ -0,0 +1,330 @@ +// qabstractsocket.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractSocket : QIODevice +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QAbstractNetworkCache, &sipType_QAbstractNetworkCache, 11, 1}, + {sipName_QAbstractSocket, &sipType_QAbstractSocket, 12, 2}, + {sipName_QDnsLookup, &sipType_QDnsLookup, -1, 3}, + {sipName_QHttpMultiPart, &sipType_QHttpMultiPart, -1, 4}, + {sipName_QLocalServer, &sipType_QLocalServer, -1, 5}, + {sipName_QLocalSocket, &sipType_QLocalSocket, -1, 6}, + {sipName_QNetworkAccessManager, &sipType_QNetworkAccessManager, -1, 7}, + {sipName_QNetworkCookieJar, &sipType_QNetworkCookieJar, -1, 8}, + #if QT_VERSION >= 0x060100 + {sipName_QNetworkInformation, &sipType_QNetworkInformation, -1, 9}, + #else + {0, 0, -1, 9}, + #endif + {sipName_QNetworkReply, &sipType_QNetworkReply, -1, 10}, + {sipName_QTcpServer, &sipType_QTcpServer, 15, -1}, + {sipName_QNetworkDiskCache, &sipType_QNetworkDiskCache, -1, -1}, + {sipName_QTcpSocket, &sipType_QTcpSocket, 14, 13}, + {sipName_QUdpSocket, &sipType_QUdpSocket, -1, -1}, + #if defined(SIP_FEATURE_PyQt_SSL) + {sipName_QSslSocket, &sipType_QSslSocket, -1, -1}, + #else + {0, 0, -1, -1}, + #endif + #if QT_VERSION >= 0x060400 && defined(SIP_FEATURE_PyQt_SSL) + {sipName_QSslServer, &sipType_QSslServer, -1, -1}, + #else + {0, 0, -1, -1}, + #endif + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum SocketType + { + TcpSocket, + UdpSocket, + SctpSocket, + UnknownSocketType, + }; + + enum NetworkLayerProtocol + { + IPv4Protocol, + IPv6Protocol, + AnyIPProtocol, + UnknownNetworkLayerProtocol, + }; + + enum SocketError + { + ConnectionRefusedError, + RemoteHostClosedError, + HostNotFoundError, + SocketAccessError, + SocketResourceError, + SocketTimeoutError, + DatagramTooLargeError, + NetworkError, + AddressInUseError, + SocketAddressNotAvailableError, + UnsupportedSocketOperationError, + UnfinishedSocketOperationError, + ProxyAuthenticationRequiredError, + SslHandshakeFailedError, + ProxyConnectionRefusedError, + ProxyConnectionClosedError, + ProxyConnectionTimeoutError, + ProxyNotFoundError, + ProxyProtocolError, + OperationError, + SslInternalError, + SslInvalidUserDataError, + TemporaryError, + UnknownSocketError, + }; + + enum SocketState + { + UnconnectedState, + HostLookupState, + ConnectingState, + ConnectedState, + BoundState, + ListeningState, + ClosingState, + }; + + QAbstractSocket(QAbstractSocket::SocketType socketType, QObject *parent /TransferThis/); + virtual ~QAbstractSocket(); + virtual void connectToHost(const QString &hostName, quint16 port, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::AnyIPProtocol) /ReleaseGIL/; + void connectToHost(const QHostAddress &address, quint16 port, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/; + virtual void disconnectFromHost() /ReleaseGIL/; + bool isValid() const; + virtual qint64 bytesAvailable() const; + virtual qint64 bytesToWrite() const; + quint16 localPort() const; + QHostAddress localAddress() const; + quint16 peerPort() const; + QHostAddress peerAddress() const; + QString peerName() const; + qint64 readBufferSize() const; + virtual void setReadBufferSize(qint64 size); + void abort(); + virtual bool setSocketDescriptor(qintptr socketDescriptor, QAbstractSocket::SocketState state = QAbstractSocket::ConnectedState, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite); + virtual qintptr socketDescriptor() const; + QAbstractSocket::SocketType socketType() const; + QAbstractSocket::SocketState state() const; + QAbstractSocket::SocketError error() const; + virtual void close(); + virtual bool isSequential() const; + bool flush() /ReleaseGIL/; + virtual bool waitForConnected(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForReadyRead(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForBytesWritten(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForDisconnected(int msecs = 30000) /ReleaseGIL/; + void setProxy(const QNetworkProxy &networkProxy); + QNetworkProxy proxy() const; + +signals: + void hostFound(); + void connected(); + void disconnected(); + void stateChanged(QAbstractSocket::SocketState); + void errorOccurred(QAbstractSocket::SocketError); + void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); + +protected: + virtual SIP_PYOBJECT readData(qint64 maxlen) /TypeHint="bytes",ReleaseGIL/ [qint64 (char *data, qint64 maxlen)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QAbstractSocket::readData(s, a0) : sipCpp->readData(s, a0); + #else + len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual SIP_PYOBJECT readLineData(qint64 maxlen) /TypeHint="bytes",ReleaseGIL/ [qint64 (char *data, qint64 maxlen)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QAbstractSocket::readLineData(s, a0) : sipCpp->readLineData(s, a0); + #else + len = sipCpp->sipProtectVirt_readLineData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)]; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipSelfWasArg ? + sipCpp->QAbstractSocket::writeData(reinterpret_cast(bi.bi_buf), bi.bi_len) : + sipCpp->writeData(reinterpret_cast(bi.bi_buf), bi.bi_len); + #else + sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast(bi.bi_buf), + bi.bi_len); + #endif + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + + virtual qint64 skipData(qint64 maxSize) /ReleaseGIL/; + void setSocketState(QAbstractSocket::SocketState state); + void setSocketError(QAbstractSocket::SocketError socketError); + void setLocalPort(quint16 port); + void setLocalAddress(const QHostAddress &address); + void setPeerPort(quint16 port); + void setPeerAddress(const QHostAddress &address); + void setPeerName(const QString &name); + +public: + enum SocketOption + { + LowDelayOption, + KeepAliveOption, + MulticastTtlOption, + MulticastLoopbackOption, + TypeOfServiceOption, + SendBufferSizeSocketOption, + ReceiveBufferSizeSocketOption, + PathMtuSocketOption, + }; + + virtual void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value); + virtual QVariant socketOption(QAbstractSocket::SocketOption option); + + enum BindFlag /BaseType=Flag/ + { + DefaultForPlatform, + ShareAddress, + DontShareAddress, + ReuseAddressHint, + }; + + typedef QFlags BindMode; + + enum PauseMode /BaseType=Flag/ + { + PauseNever, + PauseOnSslErrors, + }; + + typedef QFlags PauseModes; + virtual void resume() /ReleaseGIL/; + QAbstractSocket::PauseModes pauseMode() const; + void setPauseMode(QAbstractSocket::PauseModes pauseMode); + virtual bool bind(const QHostAddress &address, quint16 port = 0, QAbstractSocket::BindMode mode = QAbstractSocket::DefaultForPlatform); + bool bind(quint16 port = 0, QAbstractSocket::BindMode mode = QAbstractSocket::DefaultForPlatform); + QString protocolTag() const; + void setProtocolTag(const QString &tag); +}; diff --git a/sip/QtNetwork/qauthenticator.sip b/sip/QtNetwork/qauthenticator.sip new file mode 100644 index 0000000..99156ba --- /dev/null +++ b/sip/QtNetwork/qauthenticator.sip @@ -0,0 +1,44 @@ +// qauthenticator.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAuthenticator +{ +%TypeHeaderCode +#include +%End + +public: + QAuthenticator(); + QAuthenticator(const QAuthenticator &other); + ~QAuthenticator(); + bool operator==(const QAuthenticator &other) const; + bool operator!=(const QAuthenticator &other) const; + QString user() const; + void setUser(const QString &user); + QString password() const; + void setPassword(const QString &password); + QString realm() const; + bool isNull() const; + QVariant option(const QString &opt) const; + QVariantHash options() const; + void setOption(const QString &opt, const QVariant &value); +}; diff --git a/sip/QtNetwork/qdnslookup.sip b/sip/QtNetwork/qdnslookup.sip new file mode 100644 index 0000000..87315e6 --- /dev/null +++ b/sip/QtNetwork/qdnslookup.sip @@ -0,0 +1,173 @@ +// qdnslookup.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDnsDomainNameRecord +{ +%TypeHeaderCode +#include +%End + +public: + QDnsDomainNameRecord(); + QDnsDomainNameRecord(const QDnsDomainNameRecord &other); + ~QDnsDomainNameRecord(); + void swap(QDnsDomainNameRecord &other /Constrained/); + QString name() const; + quint32 timeToLive() const; + QString value() const; +}; + +class QDnsHostAddressRecord +{ +%TypeHeaderCode +#include +%End + +public: + QDnsHostAddressRecord(); + QDnsHostAddressRecord(const QDnsHostAddressRecord &other); + ~QDnsHostAddressRecord(); + void swap(QDnsHostAddressRecord &other /Constrained/); + QString name() const; + quint32 timeToLive() const; + QHostAddress value() const; +}; + +class QDnsMailExchangeRecord +{ +%TypeHeaderCode +#include +%End + +public: + QDnsMailExchangeRecord(); + QDnsMailExchangeRecord(const QDnsMailExchangeRecord &other); + ~QDnsMailExchangeRecord(); + void swap(QDnsMailExchangeRecord &other /Constrained/); + QString exchange() const; + QString name() const; + quint16 preference() const; + quint32 timeToLive() const; +}; + +class QDnsServiceRecord +{ +%TypeHeaderCode +#include +%End + +public: + QDnsServiceRecord(); + QDnsServiceRecord(const QDnsServiceRecord &other); + ~QDnsServiceRecord(); + void swap(QDnsServiceRecord &other /Constrained/); + QString name() const; + quint16 port() const; + quint16 priority() const; + QString target() const; + quint32 timeToLive() const; + quint16 weight() const; +}; + +class QDnsTextRecord +{ +%TypeHeaderCode +#include +%End + +public: + QDnsTextRecord(); + QDnsTextRecord(const QDnsTextRecord &other); + ~QDnsTextRecord(); + void swap(QDnsTextRecord &other /Constrained/); + QString name() const; + quint32 timeToLive() const; + QList values() const; +}; + +class QDnsLookup : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + NoError, + ResolverError, + OperationCancelledError, + InvalidRequestError, + InvalidReplyError, + ServerFailureError, + ServerRefusedError, + NotFoundError, + }; + + enum Type + { + A, + AAAA, + ANY, + CNAME, + MX, + NS, + PTR, + SRV, + TXT, + }; + + explicit QDnsLookup(QObject *parent /TransferThis/ = 0); + QDnsLookup(QDnsLookup::Type type, const QString &name, QObject *parent /TransferThis/ = 0); + QDnsLookup(QDnsLookup::Type type, const QString &name, const QHostAddress &nameserver, QObject *parent /TransferThis/ = 0); + virtual ~QDnsLookup(); + QDnsLookup::Error error() const; + QString errorString() const; + bool isFinished() const; + QString name() const; + void setName(const QString &name); + QDnsLookup::Type type() const; + void setType(QDnsLookup::Type); + QList canonicalNameRecords() const; + QList hostAddressRecords() const; + QList mailExchangeRecords() const; + QList nameServerRecords() const; + QList pointerRecords() const; + QList serviceRecords() const; + QList textRecords() const; + +public slots: + void abort() /ReleaseGIL/; + void lookup() /ReleaseGIL/; + +signals: + void finished(); + void nameChanged(const QString &name); + void typeChanged(QDnsLookup::Type type /ScopesStripped=1/); + +public: + QHostAddress nameserver() const; + void setNameserver(const QHostAddress &nameserver); + +signals: + void nameserverChanged(const QHostAddress &nameserver); +}; diff --git a/sip/QtNetwork/qhostaddress.sip b/sip/QtNetwork/qhostaddress.sip new file mode 100644 index 0000000..d547397 --- /dev/null +++ b/sip/QtNetwork/qhostaddress.sip @@ -0,0 +1,189 @@ +// qhostaddress.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHostAddress /TypeHintIn="Union[QHostAddress, QHostAddress.SpecialAddress]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +// SIP doesn't support automatic type convertors so we explicitly allow a +// QHostAddress::SpecialAddress to be used whenever a QHostAddress is expected. + +bool is_special_address = true; +int special_address = sipConvertToEnum(sipPy, sipType_QHostAddress_SpecialAddress); + +if (PyErr_Occurred()) +{ + PyErr_Clear(); + is_special_address = false; +} + +if (sipIsErr == NULL) + return (is_special_address || + sipCanConvertToType(sipPy, sipType_QHostAddress, SIP_NO_CONVERTORS)); + +if (is_special_address) +{ + *sipCppPtr = new QHostAddress(static_cast(special_address)); + + return sipGetState(sipTransferObj); +} + + +*sipCppPtr = reinterpret_cast(sipConvertToType(sipPy, sipType_QHostAddress, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr)); + +return 0; +%End + +public: + enum SpecialAddress + { + Null, + Broadcast, + LocalHost, + LocalHostIPv6, + AnyIPv4, + AnyIPv6, + Any, + }; + + QHostAddress(); + QHostAddress(QHostAddress::SpecialAddress address /Constrained/); + explicit QHostAddress(quint32 ip4Addr); + explicit QHostAddress(const QString &address); + explicit QHostAddress(const Q_IPV6ADDR &ip6Addr); + QHostAddress(const QHostAddress ©); + ~QHostAddress(); + void setAddress(QHostAddress::SpecialAddress address /Constrained/); + void setAddress(quint32 ip4Addr); + bool setAddress(const QString &address); + void setAddress(const Q_IPV6ADDR &ip6Addr); + QAbstractSocket::NetworkLayerProtocol protocol() const; + quint32 toIPv4Address(bool *ok = 0) const; + Q_IPV6ADDR toIPv6Address() const; + QString toString() const; + QString scopeId() const; + void setScopeId(const QString &id); + bool operator==(const QHostAddress &address) const; + bool operator==(QHostAddress::SpecialAddress address) const; + bool operator!=(const QHostAddress &address) const; + bool operator!=(QHostAddress::SpecialAddress address) const; + bool isNull() const; + void clear(); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + bool isInSubnet(const QHostAddress &subnet, int netmask) const; + bool isInSubnet(const std::pair &subnet) const; + bool isLoopback() const; + static std::pair parseSubnet(const QString &subnet); + void swap(QHostAddress &other /Constrained/); + bool isMulticast() const; + + enum ConversionModeFlag /BaseType=Flag/ + { + ConvertV4MappedToIPv4, + ConvertV4CompatToIPv4, + ConvertUnspecifiedAddress, + ConvertLocalHost, + TolerantConversion, + StrictConversion, + }; + + typedef QFlags ConversionMode; + bool isEqual(const QHostAddress &address, QHostAddress::ConversionMode mode = QHostAddress::TolerantConversion) const; + bool isGlobal() const; + bool isLinkLocal() const; + bool isSiteLocal() const; + bool isUniqueLocalUnicast() const; + bool isBroadcast() const; +}; + +bool operator==(QHostAddress::SpecialAddress address1, const QHostAddress &address2); +bool operator!=(QHostAddress::SpecialAddress lhs, const QHostAddress &rhs); +QDataStream &operator<<(QDataStream &, const QHostAddress &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QHostAddress &) /ReleaseGIL/; +// Q_IPV6ADDR is implemented as a Python 16-tuple of ints. +%MappedType Q_IPV6ADDR /TypeHint="Tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Create the tuple. + PyObject *t; + + if ((t = PyTuple_New(16)) == NULL) + return NULL; + + // Set the tuple elements. + for (int i = 0; i < 16; ++i) + { + PyObject *pobj; + + if ((pobj = PyLong_FromLong((*sipCpp)[i])) == NULL) + { + Py_DECREF(t); + + return NULL; + } + + PyTuple_SetItem(t, i, pobj); + } + + return t; +%End + +%ConvertToTypeCode + // Check the type if that is all that is required. + if (sipIsErr == NULL) + return (PySequence_Check(sipPy) && PySequence_Size(sipPy) == 16); + + Q_IPV6ADDR *qa = new Q_IPV6ADDR; + + for (Py_ssize_t i = 0; i < 16; ++i) + { + PyObject *itm = PySequence_GetItem(sipPy, i); + + if (!itm) + { + delete qa; + *sipIsErr = 1; + + return 0; + } + + (*qa)[i] = PyLong_AsLong(itm); + + Py_DECREF(itm); + } + + *sipCppPtr = qa; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtNetwork/qhostinfo.sip b/sip/QtNetwork/qhostinfo.sip new file mode 100644 index 0000000..1cb1d14 --- /dev/null +++ b/sip/QtNetwork/qhostinfo.sip @@ -0,0 +1,87 @@ +// qhostinfo.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHostInfo +{ +%TypeHeaderCode +#include +%End + +public: + enum HostInfoError + { + NoError, + HostNotFound, + UnknownError, + }; + + explicit QHostInfo(int id = -1); + QHostInfo(const QHostInfo &d); + ~QHostInfo(); + QString hostName() const; + void setHostName(const QString &name); + QList addresses() const; + void setAddresses(const QList &addresses); + QHostInfo::HostInfoError error() const; + void setError(QHostInfo::HostInfoError error); + QString errorString() const; + void setErrorString(const QString &errorString); + void setLookupId(int id); + int lookupId() const; + static int lookupHost(const QString &name, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtnetwork_get_connection_parts(a1, 0, "(QHostInfo)", true, &receiver, slot_signature)) == sipErrorNone) + { + QHostInfo::lookupHost(*a0, receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(1, a1); + } +%End + + static void abortHostLookup(int lookupId); + static QHostInfo fromName(const QString &name); + static QString localHostName(); + static QString localDomainName(); + void swap(QHostInfo &other /Constrained/); +}; + +%ModuleHeaderCode +// Imports from QtCore. +typedef sipErrorState (*pyqt6_qtnetwork_get_connection_parts_t)(PyObject *, QObject *, const char *, bool, QObject **, QByteArray &); +extern pyqt6_qtnetwork_get_connection_parts_t pyqt6_qtnetwork_get_connection_parts; +%End + +%ModuleCode +// Imports from QtCore. +pyqt6_qtnetwork_get_connection_parts_t pyqt6_qtnetwork_get_connection_parts; +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtnetwork_get_connection_parts = (pyqt6_qtnetwork_get_connection_parts_t)sipImportSymbol("pyqt6_get_connection_parts"); +Q_ASSERT(pyqt6_qtnetwork_get_connection_parts); +%End diff --git a/sip/QtNetwork/qhstspolicy.sip b/sip/QtNetwork/qhstspolicy.sip new file mode 100644 index 0000000..9ee9e67 --- /dev/null +++ b/sip/QtNetwork/qhstspolicy.sip @@ -0,0 +1,51 @@ +// qhstspolicy.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHstsPolicy +{ +%TypeHeaderCode +#include +%End + +public: + enum PolicyFlag /BaseType=Flag/ + { + IncludeSubDomains, + }; + + typedef QFlags PolicyFlags; + QHstsPolicy(); + QHstsPolicy(const QDateTime &expiry, QHstsPolicy::PolicyFlags flags, const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode); + QHstsPolicy(const QHstsPolicy &rhs); + ~QHstsPolicy(); + void swap(QHstsPolicy &other); + void setHost(const QString &host, QUrl::ParsingMode mode = QUrl::DecodedMode); + QString host(QUrl::ComponentFormattingOptions options = QUrl::FullyDecoded) const; + void setExpiry(const QDateTime &expiry); + QDateTime expiry() const; + void setIncludesSubDomains(bool include); + bool includesSubDomains() const; + bool isExpired() const; +}; + +bool operator==(const QHstsPolicy &lhs, const QHstsPolicy &rhs); +bool operator!=(const QHstsPolicy &lhs, const QHstsPolicy &rhs); diff --git a/sip/QtNetwork/qhttp1configuration.sip b/sip/QtNetwork/qhttp1configuration.sip new file mode 100644 index 0000000..7aa8bb7 --- /dev/null +++ b/sip/QtNetwork/qhttp1configuration.sip @@ -0,0 +1,50 @@ +// qhttp1configuration.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) + +class QHttp1Configuration +{ +%TypeHeaderCode +#include +%End + +public: + QHttp1Configuration(); + QHttp1Configuration(const QHttp1Configuration &other); + ~QHttp1Configuration(); + void setNumberOfConnectionsPerHost(qsizetype amount); + qsizetype numberOfConnectionsPerHost() const; + void swap(QHttp1Configuration &other); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (Qt_6_5_0 -) +bool operator==(const QHttp1Configuration &lhs, const QHttp1Configuration &rhs); +%End +%If (Qt_6_5_0 -) +bool operator!=(const QHttp1Configuration &lhs, const QHttp1Configuration &rhs); +%End diff --git a/sip/QtNetwork/qhttp2configuration.sip b/sip/QtNetwork/qhttp2configuration.sip new file mode 100644 index 0000000..16c7907 --- /dev/null +++ b/sip/QtNetwork/qhttp2configuration.sip @@ -0,0 +1,47 @@ +// qhttp2configuration.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHttp2Configuration +{ +%TypeHeaderCode +#include +%End + +public: + QHttp2Configuration(); + QHttp2Configuration(const QHttp2Configuration &other); + ~QHttp2Configuration(); + void setServerPushEnabled(bool enable); + bool serverPushEnabled() const; + void setHuffmanCompressionEnabled(bool enable); + bool huffmanCompressionEnabled() const; + bool setSessionReceiveWindowSize(unsigned int size); + unsigned int sessionReceiveWindowSize() const; + bool setStreamReceiveWindowSize(unsigned int size); + unsigned int streamReceiveWindowSize() const; + bool setMaxFrameSize(unsigned int size); + unsigned int maxFrameSize() const; + void swap(QHttp2Configuration &other /Constrained/); +}; + +bool operator==(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs); +bool operator!=(const QHttp2Configuration &lhs, const QHttp2Configuration &rhs); diff --git a/sip/QtNetwork/qhttpmultipart.sip b/sip/QtNetwork/qhttpmultipart.sip new file mode 100644 index 0000000..7a4db43 --- /dev/null +++ b/sip/QtNetwork/qhttpmultipart.sip @@ -0,0 +1,64 @@ +// qhttpmultipart.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHttpPart +{ +%TypeHeaderCode +#include +%End + +public: + QHttpPart(); + QHttpPart(const QHttpPart &other); + ~QHttpPart(); + bool operator==(const QHttpPart &other) const; + bool operator!=(const QHttpPart &other) const; + void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value); + void setRawHeader(const QByteArray &headerName, const QByteArray &headerValue); + void setBody(const QByteArray &body); + void setBodyDevice(QIODevice *device); + void swap(QHttpPart &other /Constrained/); +}; + +class QHttpMultiPart : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum ContentType + { + MixedType, + RelatedType, + FormDataType, + AlternativeType, + }; + + explicit QHttpMultiPart(QObject *parent /TransferThis/ = 0); + QHttpMultiPart(QHttpMultiPart::ContentType contentType, QObject *parent /TransferThis/ = 0); + virtual ~QHttpMultiPart(); + void append(const QHttpPart &httpPart); + void setContentType(QHttpMultiPart::ContentType contentType); + QByteArray boundary() const; + void setBoundary(const QByteArray &boundary); +}; diff --git a/sip/QtNetwork/qlocalserver.sip b/sip/QtNetwork/qlocalserver.sip new file mode 100644 index 0000000..bacc6cf --- /dev/null +++ b/sip/QtNetwork/qlocalserver.sip @@ -0,0 +1,75 @@ +// qlocalserver.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLocalServer : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QLocalServer(QObject *parent /TransferThis/ = 0); + virtual ~QLocalServer(); + void close(); + QString errorString() const; + virtual bool hasPendingConnections() const; + bool isListening() const; + bool listen(const QString &name); + bool listen(qintptr socketDescriptor); + int maxPendingConnections() const; + virtual QLocalSocket *nextPendingConnection(); + QString serverName() const; + QString fullServerName() const; + QAbstractSocket::SocketError serverError() const; + void setMaxPendingConnections(int numConnections); + bool waitForNewConnection(int msecs = 0, bool *timedOut = 0) /ReleaseGIL/; + static bool removeServer(const QString &name); + +signals: + void newConnection(); + +protected: + virtual void incomingConnection(quintptr socketDescriptor); + +public: + enum SocketOption /BaseType=Flag/ + { + UserAccessOption, + GroupAccessOption, + OtherAccessOption, + WorldAccessOption, +%If (Qt_6_2_0 -) + AbstractNamespaceOption, +%End + }; + + typedef QFlags SocketOptions; + void setSocketOptions(QLocalServer::SocketOptions options); + QLocalServer::SocketOptions socketOptions() const; + qintptr socketDescriptor() const; +%If (Qt_6_3_0 -) + void setListenBacklogSize(int size); +%End +%If (Qt_6_3_0 -) + int listenBacklogSize() const; +%End +}; diff --git a/sip/QtNetwork/qlocalsocket.sip b/sip/QtNetwork/qlocalsocket.sip new file mode 100644 index 0000000..0e22995 --- /dev/null +++ b/sip/QtNetwork/qlocalsocket.sip @@ -0,0 +1,214 @@ +// qlocalsocket.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLocalSocket : QIODevice +{ +%TypeHeaderCode +#include +%End + +public: + enum LocalSocketError + { + ConnectionRefusedError, + PeerClosedError, + ServerNotFoundError, + SocketAccessError, + SocketResourceError, + SocketTimeoutError, + DatagramTooLargeError, + ConnectionError, + UnsupportedSocketOperationError, + OperationError, + UnknownSocketError, + }; + + enum LocalSocketState + { + UnconnectedState, + ConnectingState, + ConnectedState, + ClosingState, + }; + + QLocalSocket(QObject *parent /TransferThis/ = 0); + virtual ~QLocalSocket(); + void connectToServer(const QString &name, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/; + void connectToServer(QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite) /ReleaseGIL/; + void disconnectFromServer() /ReleaseGIL/; + virtual bool open(QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite); + QString serverName() const; + void setServerName(const QString &name); + QString fullServerName() const; + void abort(); + virtual bool isSequential() const; + virtual qint64 bytesAvailable() const; + virtual qint64 bytesToWrite() const; + virtual bool canReadLine() const; + virtual void close(); + QLocalSocket::LocalSocketError error() const; + bool flush(); + bool isValid() const; + qint64 readBufferSize() const; + void setReadBufferSize(qint64 size); + bool setSocketDescriptor(qintptr socketDescriptor, QLocalSocket::LocalSocketState state = QLocalSocket::ConnectedState, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite); + qintptr socketDescriptor() const; + QLocalSocket::LocalSocketState state() const; + virtual bool waitForBytesWritten(int msecs = 30000) /ReleaseGIL/; + bool waitForConnected(int msecs = 30000) /ReleaseGIL/; + bool waitForDisconnected(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForReadyRead(int msecs = 30000) /ReleaseGIL/; + +signals: + void connected(); + void disconnected(); + void errorOccurred(QLocalSocket::LocalSocketError socketError); + void stateChanged(QLocalSocket::LocalSocketState socketState); + +protected: + virtual SIP_PYOBJECT readData(qint64 maxlen) /TypeHint="bytes",ReleaseGIL/ [qint64 (char *, qint64)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QLocalSocket::readData(s, a0) : sipCpp->readData(s, a0); + #else + len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *, qint64)]; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipSelfWasArg ? + sipCpp->QLocalSocket::writeData(reinterpret_cast(bi.bi_buf), bi.bi_len) : + sipCpp->writeData(reinterpret_cast(bi.bi_buf), bi.bi_len); + #else + sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast(bi.bi_buf), + bi.bi_len); + #endif + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + + virtual qint64 skipData(qint64 maxSize) /ReleaseGIL/; + +public: +%If (Qt_6_2_0 -) + + enum SocketOption /BaseType=Flag/ + { + NoOptions, + AbstractNamespaceOption, + }; + +%End +%If (Qt_6_2_0 -) + typedef QFlags SocketOptions; +%End +%If (Qt_6_2_0 -) + void setSocketOptions(QLocalSocket::SocketOptions option); +%End +%If (Qt_6_2_0 -) + QLocalSocket::SocketOptions socketOptions() const; +%End + +protected: +%If (Qt_6_3_0 -) + virtual SIP_PYOBJECT readLineData(qint64 maxlen) /ReleaseGIL,TypeHint="bytes"/ [qint64 (char *data, qint64 maxSize)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QLocalSocket::readLineData(s, a0) : sipCpp->readLineData(s, a0); + #else + len = sipCpp->sipProtectVirt_readLineData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + +%End +}; diff --git a/sip/QtNetwork/qnetworkaccessmanager.sip b/sip/QtNetwork/qnetworkaccessmanager.sip new file mode 100644 index 0000000..b534847 --- /dev/null +++ b/sip/QtNetwork/qnetworkaccessmanager.sip @@ -0,0 +1,108 @@ +// qnetworkaccessmanager.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkAccessManager : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Operation + { + HeadOperation, + GetOperation, + PutOperation, + PostOperation, + DeleteOperation, + CustomOperation, + }; + + explicit QNetworkAccessManager(QObject *parent /TransferThis/ = 0); + virtual ~QNetworkAccessManager(); + QNetworkProxy proxy() const; + void setProxy(const QNetworkProxy &proxy); + QNetworkCookieJar *cookieJar() const; + void setCookieJar(QNetworkCookieJar *cookieJar /Transfer/); + QNetworkReply *head(const QNetworkRequest &request); + QNetworkReply *get(const QNetworkRequest &request); + QNetworkReply *post(const QNetworkRequest &request, QIODevice *data); + QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data); + QNetworkReply *post(const QNetworkRequest &request, QHttpMultiPart *multiPart); + QNetworkReply *put(const QNetworkRequest &request, QIODevice *data); + QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data); + QNetworkReply *put(const QNetworkRequest &request, QHttpMultiPart *multiPart); + +signals: + void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); + void authenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator); + void finished(QNetworkReply *reply); +%If (PyQt_SSL) + void encrypted(QNetworkReply *reply); +%End +%If (PyQt_SSL) + void sslErrors(QNetworkReply *reply, const QList &errors); +%End +%If (PyQt_SSL) + void preSharedKeyAuthenticationRequired(QNetworkReply *reply, QSslPreSharedKeyAuthenticator *authenticator); +%End + +protected: + virtual QNetworkReply *createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *device = 0) /AbortOnException,DisallowNone,ReleaseGIL/; + +public: + QNetworkProxyFactory *proxyFactory() const; + void setProxyFactory(QNetworkProxyFactory *factory /Transfer/); + QAbstractNetworkCache *cache() const; + void setCache(QAbstractNetworkCache *cache /Transfer/); + QNetworkReply *deleteResource(const QNetworkRequest &request); + QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = 0); + QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, const QByteArray &data); + QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart); + void clearAccessCache(); + virtual QStringList supportedSchemes() const; +%If (PyQt_SSL) + void connectToHostEncrypted(const QString &hostName, quint16 port = 443, const QSslConfiguration &sslConfiguration = QSslConfiguration::defaultConfiguration()); +%End +%If (PyQt_SSL) + void connectToHostEncrypted(const QString &hostName, quint16 port, const QSslConfiguration &sslConfiguration, const QString &peerName); +%End + void connectToHost(const QString &hostName, quint16 port = 80); + +protected slots: + QStringList supportedSchemesImplementation() const; + +public: + void clearConnectionCache(); + void setStrictTransportSecurityEnabled(bool enabled); + bool isStrictTransportSecurityEnabled() const; + void addStrictTransportSecurityHosts(const QList &knownHosts); + QList strictTransportSecurityHosts() const; + void setRedirectPolicy(QNetworkRequest::RedirectPolicy policy); + QNetworkRequest::RedirectPolicy redirectPolicy() const; + void enableStrictTransportSecurityStore(bool enabled, const QString &storeDir = QString()); + bool isStrictTransportSecurityStoreEnabled() const; + bool autoDeleteReplies() const; + void setAutoDeleteReplies(bool autoDelete); + int transferTimeout() const; + void setTransferTimeout(int timeout = QNetworkRequest::DefaultTransferTimeoutConstant); +}; diff --git a/sip/QtNetwork/qnetworkcookie.sip b/sip/QtNetwork/qnetworkcookie.sip new file mode 100644 index 0000000..22f8c55 --- /dev/null +++ b/sip/QtNetwork/qnetworkcookie.sip @@ -0,0 +1,78 @@ +// qnetworkcookie.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkCookie +{ +%TypeHeaderCode +#include +%End + +public: + enum RawForm + { + NameAndValueOnly, + Full, + }; + + QNetworkCookie(const QByteArray &name = QByteArray(), const QByteArray &value = QByteArray()); + QNetworkCookie(const QNetworkCookie &other); + ~QNetworkCookie(); + bool isSecure() const; + void setSecure(bool enable); + bool isSessionCookie() const; + QDateTime expirationDate() const; + void setExpirationDate(const QDateTime &date); + QString domain() const; + void setDomain(const QString &domain); + QString path() const; + void setPath(const QString &path); + QByteArray name() const; + void setName(const QByteArray &cookieName); + QByteArray value() const; + void setValue(const QByteArray &value); + QByteArray toRawForm(QNetworkCookie::RawForm form = QNetworkCookie::Full) const; + static QList parseCookies(const QByteArray &cookieString); + bool operator==(const QNetworkCookie &other) const; + bool operator!=(const QNetworkCookie &other) const; + bool isHttpOnly() const; + void setHttpOnly(bool enable); + void swap(QNetworkCookie &other /Constrained/); + bool hasSameIdentifier(const QNetworkCookie &other) const; + void normalize(const QUrl &url); +%If (Qt_6_1_0 -) + + enum class SameSite + { + Default, + None /PyName=None_/, + Lax, + Strict, + }; + +%End +%If (Qt_6_1_0 -) + QNetworkCookie::SameSite sameSitePolicy() const; +%End +%If (Qt_6_1_0 -) + void setSameSitePolicy(QNetworkCookie::SameSite sameSite); +%End +}; diff --git a/sip/QtNetwork/qnetworkcookiejar.sip b/sip/QtNetwork/qnetworkcookiejar.sip new file mode 100644 index 0000000..29f0de1 --- /dev/null +++ b/sip/QtNetwork/qnetworkcookiejar.sip @@ -0,0 +1,42 @@ +// qnetworkcookiejar.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkCookieJar : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QNetworkCookieJar(QObject *parent /TransferThis/ = 0); + virtual ~QNetworkCookieJar(); + virtual QList cookiesForUrl(const QUrl &url) const; + virtual bool setCookiesFromUrl(const QList &cookieList, const QUrl &url); + virtual bool insertCookie(const QNetworkCookie &cookie); + virtual bool updateCookie(const QNetworkCookie &cookie); + virtual bool deleteCookie(const QNetworkCookie &cookie); + +protected: + void setAllCookies(const QList &cookieList); + QList allCookies() const; + virtual bool validateCookie(const QNetworkCookie &cookie, const QUrl &url) const; +}; diff --git a/sip/QtNetwork/qnetworkdatagram.sip b/sip/QtNetwork/qnetworkdatagram.sip new file mode 100644 index 0000000..bf32662 --- /dev/null +++ b/sip/QtNetwork/qnetworkdatagram.sip @@ -0,0 +1,51 @@ +// qnetworkdatagram.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkDatagram +{ +%TypeHeaderCode +#include +%End + +public: + QNetworkDatagram(); + QNetworkDatagram(const QByteArray &data, const QHostAddress &destinationAddress = QHostAddress(), quint16 port = 0); + QNetworkDatagram(const QNetworkDatagram &other); + ~QNetworkDatagram(); + void swap(QNetworkDatagram &other /Constrained/); + void clear(); + bool isValid() const; + bool isNull() const; + uint interfaceIndex() const; + void setInterfaceIndex(uint index); + QHostAddress senderAddress() const; + QHostAddress destinationAddress() const; + int senderPort() const; + int destinationPort() const; + void setSender(const QHostAddress &address, quint16 port = 0); + void setDestination(const QHostAddress &address, quint16 port); + int hopLimit() const; + void setHopLimit(int count); + QByteArray data() const; + void setData(const QByteArray &data); + QNetworkDatagram makeReply(const QByteArray &payload) const; +}; diff --git a/sip/QtNetwork/qnetworkdiskcache.sip b/sip/QtNetwork/qnetworkdiskcache.sip new file mode 100644 index 0000000..c11d264 --- /dev/null +++ b/sip/QtNetwork/qnetworkdiskcache.sip @@ -0,0 +1,50 @@ +// qnetworkdiskcache.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkDiskCache : QAbstractNetworkCache +{ +%TypeHeaderCode +#include +%End + +public: + explicit QNetworkDiskCache(QObject *parent /TransferThis/ = 0); + virtual ~QNetworkDiskCache(); + QString cacheDirectory() const; + void setCacheDirectory(const QString &cacheDir); + qint64 maximumCacheSize() const; + void setMaximumCacheSize(qint64 size); + virtual qint64 cacheSize() const; + virtual QNetworkCacheMetaData metaData(const QUrl &url); + virtual void updateMetaData(const QNetworkCacheMetaData &metaData); + virtual QIODevice *data(const QUrl &url) /Factory/; + virtual bool remove(const QUrl &url); + virtual QIODevice *prepare(const QNetworkCacheMetaData &metaData); + virtual void insert(QIODevice *device); + QNetworkCacheMetaData fileMetaData(const QString &fileName) const; + +public slots: + virtual void clear(); + +protected: + virtual qint64 expire(); +}; diff --git a/sip/QtNetwork/qnetworkinformation.sip b/sip/QtNetwork/qnetworkinformation.sip new file mode 100644 index 0000000..ecb231d --- /dev/null +++ b/sip/QtNetwork/qnetworkinformation.sip @@ -0,0 +1,123 @@ +// qnetworkinformation.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_1_0 -) + +class QNetworkInformation : QObject /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum class Reachability + { + Unknown, + Disconnected, + Local, + Site, + Online, + }; + + enum class Feature + { + Reachability, +%If (Qt_6_2_0 -) + CaptivePortal, +%End +%If (Qt_6_3_0 -) + TransportMedium, +%End +%If (Qt_6_3_0 -) + Metered, +%End + }; + + typedef QFlags Features; + QNetworkInformation::Reachability reachability() const; + QString backendName() const; + bool supports(QNetworkInformation::Features features) const; + static bool load(QStringView backend); + static bool load(QNetworkInformation::Features features); + static QStringList availableBackends(); + static QNetworkInformation *instance(); + +signals: + void reachabilityChanged(QNetworkInformation::Reachability newReachability /ScopesStripped=1/); + +public: +%If (Qt_6_2_0 -) + bool isBehindCaptivePortal() const; +%End + +signals: +%If (Qt_6_2_0 -) + void isBehindCaptivePortalChanged(bool state); +%End + +public: +%If (Qt_6_3_0 -) + + enum class TransportMedium + { + Unknown, + Ethernet, + Cellular, + WiFi, + Bluetooth, + }; + +%End +%If (Qt_6_3_0 -) + QNetworkInformation::TransportMedium transportMedium() const; +%End +%If (Qt_6_3_0 -) + bool isMetered() const; +%End +%If (Qt_6_3_0 -) + QNetworkInformation::Features supportedFeatures() const; +%End +%If (Qt_6_3_0 -) + static bool loadDefaultBackend(); +%End + +signals: +%If (Qt_6_3_0 -) + void transportMediumChanged(QNetworkInformation::TransportMedium current); +%End +%If (Qt_6_3_0 -) + void isMeteredChanged(bool isMetered); +%End + +public: +%If (Qt_6_4_0 -) + static bool loadBackendByName(QStringView backend); +%End +%If (Qt_6_4_0 -) + static bool loadBackendByFeatures(QNetworkInformation::Features features); +%End + +private: + virtual ~QNetworkInformation(); +}; + +%End diff --git a/sip/QtNetwork/qnetworkinterface.sip b/sip/QtNetwork/qnetworkinterface.sip new file mode 100644 index 0000000..df23e83 --- /dev/null +++ b/sip/QtNetwork/qnetworkinterface.sip @@ -0,0 +1,120 @@ +// qnetworkinterface.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkAddressEntry +{ +%TypeHeaderCode +#include +%End + +public: + QNetworkAddressEntry(); + QNetworkAddressEntry(const QNetworkAddressEntry &other); + ~QNetworkAddressEntry(); + QHostAddress ip() const; + void setIp(const QHostAddress &newIp); + QHostAddress netmask() const; + void setNetmask(const QHostAddress &newNetmask); + QHostAddress broadcast() const; + void setBroadcast(const QHostAddress &newBroadcast); + bool operator==(const QNetworkAddressEntry &other) const; + bool operator!=(const QNetworkAddressEntry &other) const; + int prefixLength() const; + void setPrefixLength(int length); + void swap(QNetworkAddressEntry &other /Constrained/); + + enum DnsEligibilityStatus + { + DnsEligibilityUnknown, + DnsIneligible, + DnsEligible, + }; + + QNetworkAddressEntry::DnsEligibilityStatus dnsEligibility() const; + void setDnsEligibility(QNetworkAddressEntry::DnsEligibilityStatus status); + bool isLifetimeKnown() const; + QDeadlineTimer preferredLifetime() const; + QDeadlineTimer validityLifetime() const; + void setAddressLifetime(QDeadlineTimer preferred, QDeadlineTimer validity); + void clearAddressLifetime(); + bool isPermanent() const; + bool isTemporary() const; +}; + +class QNetworkInterface +{ +%TypeHeaderCode +#include +%End + +public: + enum InterfaceFlag /BaseType=Flag/ + { + IsUp, + IsRunning, + CanBroadcast, + IsLoopBack, + IsPointToPoint, + CanMulticast, + }; + + typedef QFlags InterfaceFlags; + QNetworkInterface(); + QNetworkInterface(const QNetworkInterface &other); + ~QNetworkInterface(); + bool isValid() const; + QString name() const; + QNetworkInterface::InterfaceFlags flags() const; + QString hardwareAddress() const; + QList addressEntries() const; + static QNetworkInterface interfaceFromName(const QString &name); + static QNetworkInterface interfaceFromIndex(int index); + static QList allInterfaces(); + static QList allAddresses(); + int index() const; + QString humanReadableName() const; + void swap(QNetworkInterface &other /Constrained/); + static int interfaceIndexFromName(const QString &name); + static QString interfaceNameFromIndex(int index); + + enum InterfaceType + { + Unknown, + Loopback, + Virtual, + Ethernet, + Slip, + CanBus, + Ppp, + Fddi, + Wifi, + Ieee80211, + Phonet, + Ieee802154, + SixLoWPAN, + Ieee80216, + Ieee1394, + }; + + QNetworkInterface::InterfaceType type() const; + int maximumTransmissionUnit() const; +}; diff --git a/sip/QtNetwork/qnetworkproxy.sip b/sip/QtNetwork/qnetworkproxy.sip new file mode 100644 index 0000000..7057f7d --- /dev/null +++ b/sip/QtNetwork/qnetworkproxy.sip @@ -0,0 +1,139 @@ +// qnetworkproxy.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkProxy +{ +%TypeHeaderCode +#include +%End + +public: + enum ProxyType + { + DefaultProxy, + Socks5Proxy, + NoProxy, + HttpProxy, + HttpCachingProxy, + FtpCachingProxy, + }; + + QNetworkProxy(); + QNetworkProxy(QNetworkProxy::ProxyType type, const QString &hostName = QString(), quint16 port = 0, const QString &user = QString(), const QString &password = QString()); + QNetworkProxy(const QNetworkProxy &other); + ~QNetworkProxy(); + void setType(QNetworkProxy::ProxyType type); + QNetworkProxy::ProxyType type() const; + void setUser(const QString &userName); + QString user() const; + void setPassword(const QString &password); + QString password() const; + void setHostName(const QString &hostName); + QString hostName() const; + void setPort(quint16 port); + quint16 port() const; + static void setApplicationProxy(const QNetworkProxy &proxy); + static QNetworkProxy applicationProxy(); + bool isCachingProxy() const; + bool isTransparentProxy() const; + bool operator==(const QNetworkProxy &other) const; + bool operator!=(const QNetworkProxy &other) const; + + enum Capability /BaseType=Flag/ + { + TunnelingCapability, + ListeningCapability, + UdpTunnelingCapability, + CachingCapability, + HostNameLookupCapability, + SctpTunnelingCapability, + SctpListeningCapability, + }; + + typedef QFlags Capabilities; + void setCapabilities(QNetworkProxy::Capabilities capab); + QNetworkProxy::Capabilities capabilities() const; + void swap(QNetworkProxy &other /Constrained/); + QVariant header(QNetworkRequest::KnownHeaders header) const; + void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value); + bool hasRawHeader(const QByteArray &headerName) const; + QList rawHeaderList() const; + QByteArray rawHeader(const QByteArray &headerName) const; + void setRawHeader(const QByteArray &headerName, const QByteArray &value); +}; + +class QNetworkProxyQuery +{ +%TypeHeaderCode +#include +%End + +public: + enum QueryType + { + TcpSocket, + UdpSocket, + TcpServer, + UrlRequest, + SctpSocket, + SctpServer, + }; + + QNetworkProxyQuery(); + QNetworkProxyQuery(const QUrl &requestUrl, QNetworkProxyQuery::QueryType type = QNetworkProxyQuery::UrlRequest); + QNetworkProxyQuery(const QString &hostname, int port, const QString &protocolTag = QString(), QNetworkProxyQuery::QueryType type = QNetworkProxyQuery::TcpSocket); + QNetworkProxyQuery(quint16 bindPort, const QString &protocolTag = QString(), QNetworkProxyQuery::QueryType type = QNetworkProxyQuery::TcpServer); + QNetworkProxyQuery(const QNetworkProxyQuery &other); + ~QNetworkProxyQuery(); + bool operator==(const QNetworkProxyQuery &other) const; + bool operator!=(const QNetworkProxyQuery &other) const; + QNetworkProxyQuery::QueryType queryType() const; + void setQueryType(QNetworkProxyQuery::QueryType type); + int peerPort() const; + void setPeerPort(int port); + QString peerHostName() const; + void setPeerHostName(const QString &hostname); + int localPort() const; + void setLocalPort(int port); + QString protocolTag() const; + void setProtocolTag(const QString &protocolTag); + QUrl url() const; + void setUrl(const QUrl &url); + void swap(QNetworkProxyQuery &other /Constrained/); +}; + +class QNetworkProxyFactory /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + QNetworkProxyFactory(); + virtual ~QNetworkProxyFactory(); + virtual QList queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) = 0; + static void setApplicationProxyFactory(QNetworkProxyFactory *factory /Transfer/); + static QList proxyForQuery(const QNetworkProxyQuery &query); + static QList systemProxyForQuery(const QNetworkProxyQuery &query = QNetworkProxyQuery()); + static void setUseSystemConfiguration(bool enable); + static bool usesSystemConfiguration(); +}; diff --git a/sip/QtNetwork/qnetworkreply.sip b/sip/QtNetwork/qnetworkreply.sip new file mode 100644 index 0000000..25607e4 --- /dev/null +++ b/sip/QtNetwork/qnetworkreply.sip @@ -0,0 +1,175 @@ +// qnetworkreply.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkReply : QIODevice +{ +%TypeHeaderCode +#include +%End + +public: + enum NetworkError + { + NoError, + ConnectionRefusedError, + RemoteHostClosedError, + HostNotFoundError, + TimeoutError, + OperationCanceledError, + SslHandshakeFailedError, + UnknownNetworkError, + ProxyConnectionRefusedError, + ProxyConnectionClosedError, + ProxyNotFoundError, + ProxyTimeoutError, + ProxyAuthenticationRequiredError, + UnknownProxyError, + ContentAccessDenied, + ContentOperationNotPermittedError, + ContentNotFoundError, + AuthenticationRequiredError, + UnknownContentError, + ProtocolUnknownError, + ProtocolInvalidOperationError, + ProtocolFailure, + ContentReSendError, + TemporaryNetworkFailureError, + NetworkSessionFailedError, + BackgroundRequestNotAllowedError, + ContentConflictError, + ContentGoneError, + InternalServerError, + OperationNotImplementedError, + ServiceUnavailableError, + UnknownServerError, + TooManyRedirectsError, + InsecureRedirectError, + }; + + virtual ~QNetworkReply(); + virtual void abort() = 0; + virtual void close(); + virtual bool isSequential() const; + qint64 readBufferSize() const; + virtual void setReadBufferSize(qint64 size); + QNetworkAccessManager *manager() const; + QNetworkAccessManager::Operation operation() const; + QNetworkRequest request() const; + QNetworkReply::NetworkError error() const; + QUrl url() const; + QVariant header(QNetworkRequest::KnownHeaders header) const; + bool hasRawHeader(const QByteArray &headerName) const; + QList rawHeaderList() const; + QByteArray rawHeader(const QByteArray &headerName) const; + QVariant attribute(QNetworkRequest::Attribute code) const; +%If (PyQt_SSL) + QSslConfiguration sslConfiguration() const; +%End +%If (PyQt_SSL) + void setSslConfiguration(const QSslConfiguration &configuration); +%End + +public slots: + virtual void ignoreSslErrors(); + +signals: + void metaDataChanged(); + void finished(); +%If (PyQt_SSL) + void encrypted(); +%End + void errorOccurred(QNetworkReply::NetworkError); +%If (PyQt_SSL) + void sslErrors(const QList &errors); +%End + void uploadProgress(qint64 bytesSent, qint64 bytesTotal); + void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); +%If (PyQt_SSL) + void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator); +%End + void redirected(const QUrl &url); + void redirectAllowed(); + +protected: + explicit QNetworkReply(QObject *parent /TransferThis/ = 0); + virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)]; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipSelfWasArg ? + sipCpp->QNetworkReply::writeData(reinterpret_cast(bi.bi_buf), bi.bi_len) : + sipCpp->writeData(reinterpret_cast(bi.bi_buf), bi.bi_len); + #else + sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast(bi.bi_buf), + bi.bi_len); + #endif + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + + void setOperation(QNetworkAccessManager::Operation operation); + void setRequest(const QNetworkRequest &request); + void setError(QNetworkReply::NetworkError errorCode, const QString &errorString); + void setUrl(const QUrl &url); + void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value); + void setRawHeader(const QByteArray &headerName, const QByteArray &value); + void setAttribute(QNetworkRequest::Attribute code, const QVariant &value); + void setFinished(bool finished); + +public: + bool isFinished() const; + bool isRunning() const; +%If (PyQt_SSL) + void ignoreSslErrors(const QList &errors); +%End + typedef std::pair RawHeaderPair; + const QList> &rawHeaderPairs() const; + +protected: +%If (PyQt_SSL) + virtual void sslConfigurationImplementation(QSslConfiguration &) const; +%End +%If (PyQt_SSL) + virtual void setSslConfigurationImplementation(const QSslConfiguration &); +%End +%If (PyQt_SSL) + virtual void ignoreSslErrorsImplementation(const QList &); +%End + +signals: +%If (Qt_6_3_0 -) + void socketStartedConnecting(); +%End +%If (Qt_6_3_0 -) + void requestSent(); +%End +}; diff --git a/sip/QtNetwork/qnetworkrequest.sip b/sip/QtNetwork/qnetworkrequest.sip new file mode 100644 index 0000000..acfc8ec --- /dev/null +++ b/sip/QtNetwork/qnetworkrequest.sip @@ -0,0 +1,167 @@ +// qnetworkrequest.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QNetworkRequest +{ +%TypeHeaderCode +#include +%End + +public: + enum KnownHeaders + { + ContentTypeHeader, + ContentLengthHeader, + LocationHeader, + LastModifiedHeader, + CookieHeader, + SetCookieHeader, + ContentDispositionHeader, + UserAgentHeader, + ServerHeader, + IfModifiedSinceHeader, + ETagHeader, + IfMatchHeader, + IfNoneMatchHeader, + }; + + enum Attribute + { + HttpStatusCodeAttribute, + HttpReasonPhraseAttribute, + RedirectionTargetAttribute, + ConnectionEncryptedAttribute, + CacheLoadControlAttribute, + CacheSaveControlAttribute, + SourceIsFromCacheAttribute, + DoNotBufferUploadDataAttribute, + HttpPipeliningAllowedAttribute, + HttpPipeliningWasUsedAttribute, + CustomVerbAttribute, + CookieLoadControlAttribute, + AuthenticationReuseAttribute, + CookieSaveControlAttribute, + BackgroundRequestAttribute, + EmitAllUploadProgressSignalsAttribute, + Http2AllowedAttribute, + Http2WasUsedAttribute, + OriginalContentLengthAttribute, + RedirectPolicyAttribute, + Http2DirectAttribute, + AutoDeleteReplyOnFinishAttribute, +%If (Qt_6_3_0 -) + ConnectionCacheExpiryTimeoutSecondsAttribute, +%End +%If (Qt_6_3_0 -) + Http2CleartextAllowedAttribute, +%End +%If (Qt_6_5_0 -) + UseCredentialsAttribute, +%End + User, + UserMax, + }; + + enum CacheLoadControl + { + AlwaysNetwork, + PreferNetwork, + PreferCache, + AlwaysCache, + }; + + enum LoadControl + { + Automatic, + Manual, + }; + + enum Priority + { + HighPriority, + NormalPriority, + LowPriority, + }; + + explicit QNetworkRequest(const QUrl &url); + QNetworkRequest(); + QNetworkRequest(const QNetworkRequest &other); + ~QNetworkRequest(); + QUrl url() const; + void setUrl(const QUrl &url); + QVariant header(QNetworkRequest::KnownHeaders header) const; + void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value); + bool hasRawHeader(const QByteArray &headerName) const; + QList rawHeaderList() const; + QByteArray rawHeader(const QByteArray &headerName) const; + void setRawHeader(const QByteArray &headerName, const QByteArray &value); + QVariant attribute(QNetworkRequest::Attribute code, const QVariant &defaultValue = QVariant()) const; + void setAttribute(QNetworkRequest::Attribute code, const QVariant &value); +%If (PyQt_SSL) + QSslConfiguration sslConfiguration() const; +%End +%If (PyQt_SSL) + void setSslConfiguration(const QSslConfiguration &configuration); +%End + bool operator==(const QNetworkRequest &other) const; + bool operator!=(const QNetworkRequest &other) const; + void setOriginatingObject(QObject *object /KeepReference/); + QObject *originatingObject() const; + QNetworkRequest::Priority priority() const; + void setPriority(QNetworkRequest::Priority priority); + void swap(QNetworkRequest &other /Constrained/); + int maximumRedirectsAllowed() const; + void setMaximumRedirectsAllowed(int maximumRedirectsAllowed); + + enum RedirectPolicy + { + ManualRedirectPolicy, + NoLessSafeRedirectPolicy, + SameOriginRedirectPolicy, + UserVerifiedRedirectPolicy, + }; + + QString peerVerifyName() const; + void setPeerVerifyName(const QString &peerName); +%If (Qt_6_5_0 -) + QHttp1Configuration http1Configuration() const; +%End + QHttp2Configuration http2Configuration() const; +%If (Qt_6_5_0 -) + void setHttp1Configuration(const QHttp1Configuration &configuration); +%End + void setHttp2Configuration(const QHttp2Configuration &configuration); + + enum TransferTimeoutConstant + { + DefaultTransferTimeoutConstant, + }; + + int transferTimeout() const; + void setTransferTimeout(int timeout = QNetworkRequest::DefaultTransferTimeoutConstant); +%If (Qt_6_2_0 -) + qint64 decompressedSafetyCheckThreshold() const; +%End +%If (Qt_6_2_0 -) + void setDecompressedSafetyCheckThreshold(qint64 threshold); +%End +}; diff --git a/sip/QtNetwork/qocspresponse.sip b/sip/QtNetwork/qocspresponse.sip new file mode 100644 index 0000000..380fe92 --- /dev/null +++ b/sip/QtNetwork/qocspresponse.sip @@ -0,0 +1,84 @@ +// qocspresponse.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) +%ModuleCode +#include +%End +%End + +%If (PyQt_SSL) + +enum class QOcspCertificateStatus +{ + Good, + Revoked, + Unknown, +}; + +%End +%If (PyQt_SSL) + +enum class QOcspRevocationReason +{ + None, + Unspecified, + KeyCompromise, + CACompromise, + AffiliationChanged, + Superseded, + CessationOfOperation, + CertificateHold, + RemoveFromCRL, +}; + +%End +%If (PyQt_SSL) + +class QOcspResponse +{ +%TypeHeaderCode +#include +%End + +public: + QOcspResponse(); + QOcspResponse(const QOcspResponse &other); + ~QOcspResponse(); + QOcspCertificateStatus certificateStatus() const; + QOcspRevocationReason revocationReason() const; + QSslCertificate responder() const; + QSslCertificate subject() const; + void swap(QOcspResponse &other); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (PyQt_SSL) +bool operator==(const QOcspResponse &lhs, const QOcspResponse &rhs); +%End +%If (PyQt_SSL) +bool operator!=(const QOcspResponse &lhs, const QOcspResponse &rhs); +%End diff --git a/sip/QtNetwork/qpassworddigestor.sip b/sip/QtNetwork/qpassworddigestor.sip new file mode 100644 index 0000000..f6c2e44 --- /dev/null +++ b/sip/QtNetwork/qpassworddigestor.sip @@ -0,0 +1,35 @@ +// qpassworddigestor.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +namespace QPasswordDigestor +{ +%TypeHeaderCode +#include +%End + + QByteArray deriveKeyPbkdf1(QCryptographicHash::Algorithm algorithm, const QByteArray &password, const QByteArray &salt, int iterations, quint64 dkLen); + QByteArray deriveKeyPbkdf2(QCryptographicHash::Algorithm algorithm, const QByteArray &password, const QByteArray &salt, int iterations, quint64 dkLen); +}; + +%End diff --git a/sip/QtNetwork/qpynetwork_qhash.sip b/sip/QtNetwork/qpynetwork_qhash.sip new file mode 100644 index 0000000..cc98ebd --- /dev/null +++ b/sip/QtNetwork/qpynetwork_qhash.sip @@ -0,0 +1,132 @@ +// This is the SIP interface definition for the QHash based mapped types +// specific to the QtNetwork module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QHash + /TypeHint="Dict[QNetworkRequest.Attribute, QVariant]", + TypeHintValue="{}"/ +{ +%TypeHeaderCode +#include +#include +#include +%End + +%ConvertFromTypeCode + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QHash::const_iterator it = sipCpp->constBegin(); + QHash::const_iterator end = sipCpp->constEnd(); + + while (it != end) + { + PyObject *kobj = sipConvertFromEnum(it.key(), + sipType_QNetworkRequest_Attribute); + + if (!kobj) + { + Py_DECREF(d); + + return 0; + } + + QVariant *v = new QVariant(it.value()); + PyObject *vobj = sipConvertFromNewType(v, sipType_QVariant, + sipTransferObj); + + if (!vobj) + { + delete v; + Py_DECREF(kobj); + Py_DECREF(d); + + return 0; + } + + int rc = PyDict_SetItem(d, kobj, vobj); + + Py_DECREF(vobj); + Py_DECREF(kobj); + + if (rc < 0) + { + Py_DECREF(d); + + return 0; + } + + ++it; + } + + return d; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return PyDict_Check(sipPy); + + QHash *qh = new QHash; + + Py_ssize_t pos = 0; + PyObject *kobj, *vobj; + + while (PyDict_Next(sipPy, &pos, &kobj, &vobj)) + { + int k = sipConvertToEnum(kobj, sipType_QNetworkRequest_Attribute); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "a key has type '%s' but 'QNetworkRequest.Attribute' is expected", + sipPyTypeName(Py_TYPE(kobj))); + + delete qh; + *sipIsErr = 1; + + return 0; + } + + int vstate; + QVariant *v = reinterpret_cast( + sipForceConvertToType(vobj, sipType_QVariant, sipTransferObj, + SIP_NOT_NONE, &vstate, sipIsErr)); + + if (*sipIsErr) + { + // Any error must be internal, so leave the exception as it is. + + delete qh; + + return 0; + } + + qh->insert(static_cast(k), *v); + + sipReleaseType(v, sipType_QVariant, vstate); + } + + *sipCppPtr = qh; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtNetwork/qpynetwork_qlist.sip b/sip/QtNetwork/qpynetwork_qlist.sip new file mode 100644 index 0000000..1c7d142 --- /dev/null +++ b/sip/QtNetwork/qpynetwork_qlist.sip @@ -0,0 +1,349 @@ +// This is the SIP interface definition for the QList based mapped types +// specific to the QtNetwork module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_1_0 -) + +%If (PyQt_SSL) + +%MappedType QList + /TypeHintIn="Iterable[QSsl.SslProtocol]", + TypeHintOut="List[QSsl.SslProtocol]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(sipCpp->at(i), + sipType_QSsl_SslProtocol); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QSsl_SslProtocol); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QSsl.SslProtocol' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + +%End + +%End + + +%If (Qt_6_1_0 -) + +%If (PyQt_SSL) + +%MappedType QList + /TypeHintIn="Iterable[QSsl.ImplementedClass]", + TypeHintOut="List[QSsl.ImplementedClass]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(static_cast(sipCpp->at(i)), + sipType_QSsl_ImplementedClass); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QSsl_ImplementedClass); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QSsl.ImplementedClass' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + +%End + +%End + + +%If (Qt_6_1_0 -) + +%If (PyQt_SSL) + +%MappedType QList + /TypeHintIn="Iterable[QSsl.SupportedFeature]", + TypeHintOut="List[QSsl.SupportedFeature]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(static_cast(sipCpp->at(i)), + sipType_QSsl_SupportedFeature); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QSsl_SupportedFeature); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QSsl.SupportedFeature' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + +%End + +%End diff --git a/sip/QtNetwork/qpynetwork_qmap.sip b/sip/QtNetwork/qpynetwork_qmap.sip new file mode 100644 index 0000000..417c3b1 --- /dev/null +++ b/sip/QtNetwork/qpynetwork_qmap.sip @@ -0,0 +1,208 @@ +// This is the SIP interface definition for the QMap and QMultiMap based mapped +// types specific to the QtNetwork module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +%MappedType QMultiMap + /TypeHintOut="Dict[QSsl.AlternativeNameEntryType, List[QString]]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + // Get the enum member objects that are the dictionary keys. + static PyObject *email_entry = 0; + + if (!email_entry) + { + email_entry = sipConvertFromEnum(static_cast(QSsl::EmailEntry), + sipType_QSsl_AlternativeNameEntryType); + if (!email_entry) + return 0; + } + + static PyObject *dns_entry = 0; + + if (!dns_entry) + { + dns_entry = sipConvertFromEnum(static_cast(QSsl::DnsEntry), + sipType_QSsl_AlternativeNameEntryType); + if (!dns_entry) + return 0; + } + + static PyObject *ip_address_entry = 0; + + if (!ip_address_entry) + { + ip_address_entry = sipConvertFromEnum( + static_cast(QSsl::IpAddressEntry), + sipType_QSsl_AlternativeNameEntryType); + if (!ip_address_entry) + return 0; + } + + // Create the dictionary. + PyObject *d = PyDict_New(); + + if (!d) + return 0; + + QList vl; + + // Handle the Qssl::EmailEntry key. + vl = sipCpp->values(QSsl::EmailEntry); + + if (!vl.isEmpty()) + { + PyObject *vlobj = PyList_New(vl.count()); + + if (!vlobj) + { + Py_DECREF(d); + return 0; + } + + int rc = PyDict_SetItem(d, email_entry, vlobj); + + Py_DECREF(vlobj); + + if (rc < 0) + { + Py_DECREF(d); + return 0; + } + + for (int i = 0; i < vl.count(); ++i) + { + QString *s = new QString(vl.at(i)); + PyObject *vobj = sipConvertFromNewType(s, sipType_QString, + sipTransferObj); + + if (!vobj) + { + delete s; + Py_DECREF(d); + return 0; + } + + PyList_SetItem(vlobj, i, vobj); + } + } + + // Handle the Qssl::DnsEntry key. + vl = sipCpp->values(QSsl::DnsEntry); + + if (!vl.isEmpty()) + { + PyObject *vlobj = PyList_New(vl.count()); + + if (!vlobj) + { + Py_DECREF(d); + return 0; + } + + int rc = PyDict_SetItem(d, dns_entry, vlobj); + + Py_DECREF(vlobj); + + if (rc < 0) + { + Py_DECREF(d); + return 0; + } + + for (int i = 0; i < vl.count(); ++i) + { + QString *s = new QString(vl.at(i)); + PyObject *vobj = sipConvertFromNewType(s, sipType_QString, + sipTransferObj); + + if (!vobj) + { + delete s; + Py_DECREF(d); + return 0; + } + + PyList_SetItem(vlobj, i, vobj); + } + } + + // Handle the Qssl::IpAddressEntry key. + vl = sipCpp->values(QSsl::IpAddressEntry); + + if (!vl.isEmpty()) + { + PyObject *vlobj = PyList_New(vl.count()); + + if (!vlobj) + { + Py_DECREF(d); + return 0; + } + + int rc = PyDict_SetItem(d, ip_address_entry, vlobj); + + Py_DECREF(vlobj); + + if (rc < 0) + { + Py_DECREF(d); + return 0; + } + + for (int i = 0; i < vl.count(); ++i) + { + QString *s = new QString(vl.at(i)); + PyObject *vobj = sipConvertFromNewType(s, sipType_QString, + sipTransferObj); + + if (!vobj) + { + delete s; + Py_DECREF(d); + return 0; + } + + PyList_SetItem(vlobj, i, vobj); + } + } + + return d; +%End + +%ConvertToTypeCode + if (!sipIsErr) + return PyDict_Check(sipPy); + + PyErr_SetString(PyExc_NotImplementedError, + "converting to QMultiMap is unsupported"); + + return 0; +%End +}; + +%End diff --git a/sip/QtNetwork/qssl.sip b/sip/QtNetwork/qssl.sip new file mode 100644 index 0000000..43f56c7 --- /dev/null +++ b/sip/QtNetwork/qssl.sip @@ -0,0 +1,169 @@ +// qssl.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +namespace QSsl +{ +%TypeHeaderCode +#include +%End + + enum KeyType + { + PrivateKey, + PublicKey, + }; + + enum EncodingFormat + { + Pem, + Der, + }; + + enum KeyAlgorithm + { + Opaque, + Rsa, + Dsa, + Ec, + Dh, + }; + + enum AlternativeNameEntryType + { + EmailEntry, + DnsEntry, + IpAddressEntry, + }; + + enum SslProtocol + { + UnknownProtocol, + TlsV1_0, + TlsV1_0OrLater, + TlsV1_1, + TlsV1_1OrLater, + TlsV1_2, + TlsV1_2OrLater, + AnyProtocol, + SecureProtocols, + DtlsV1_0, + DtlsV1_0OrLater, + DtlsV1_2, + DtlsV1_2OrLater, + TlsV1_3, + TlsV1_3OrLater, + }; + + enum SslOption /BaseType=Flag/ + { + SslOptionDisableEmptyFragments, + SslOptionDisableSessionTickets, + SslOptionDisableCompression, + SslOptionDisableServerNameIndication, + SslOptionDisableLegacyRenegotiation, + SslOptionDisableSessionSharing, + SslOptionDisableSessionPersistence, + SslOptionDisableServerCipherPreference, + }; + + typedef QFlags SslOptions; + + enum class AlertLevel + { + Warning, + Fatal, + Unknown, + }; + + enum class AlertType + { + CloseNotify, + UnexpectedMessage, + BadRecordMac, + RecordOverflow, + DecompressionFailure, + HandshakeFailure, + NoCertificate, + BadCertificate, + UnsupportedCertificate, + CertificateRevoked, + CertificateExpired, + CertificateUnknown, + IllegalParameter, + UnknownCa, + AccessDenied, + DecodeError, + DecryptError, + ExportRestriction, + ProtocolVersion, + InsufficientSecurity, + InternalError, + InappropriateFallback, + UserCancelled, + NoRenegotiation, + MissingExtension, + UnsupportedExtension, + CertificateUnobtainable, + UnrecognizedName, + BadCertificateStatusResponse, + BadCertificateHashValue, + UnknownPskIdentity, + CertificateRequired, + NoApplicationProtocol, + UnknownAlertMessage, + }; + +%If (Qt_6_1_0 -) + + enum class ImplementedClass + { + Key, + Certificate, + Socket, + DiffieHellman, + EllipticCurve, + Dtls, +%If (Qt_6_2_0 -) + DtlsCookie, +%End + }; + +%End +%If (Qt_6_1_0 -) + + enum class SupportedFeature + { + CertificateVerification, + ClientSideAlpn, + ServerSideAlpn, + Ocsp, + Psk, + SessionTicket, + Alerts, + }; + +%End +}; + +%End diff --git a/sip/QtNetwork/qsslcertificate.sip b/sip/QtNetwork/qsslcertificate.sip new file mode 100644 index 0000000..ee6103f --- /dev/null +++ b/sip/QtNetwork/qsslcertificate.sip @@ -0,0 +1,95 @@ +// qsslcertificate.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslCertificate +{ +%TypeHeaderCode +#include +%End + +public: + enum SubjectInfo + { + Organization, + CommonName, + LocalityName, + OrganizationalUnitName, + CountryName, + StateOrProvinceName, + DistinguishedNameQualifier, + SerialNumber, + EmailAddress, + }; + + QSslCertificate(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem) /ReleaseGIL/; + QSslCertificate(const QByteArray &data = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem); + QSslCertificate(const QSslCertificate &other); + ~QSslCertificate(); + bool operator==(const QSslCertificate &other) const; + bool operator!=(const QSslCertificate &other) const; + bool isNull() const; + void clear(); + QByteArray version() const; + QByteArray serialNumber() const; + QByteArray digest(QCryptographicHash::Algorithm algorithm = QCryptographicHash::Md5) const; + QStringList issuerInfo(QSslCertificate::SubjectInfo info) const; + QStringList issuerInfo(const QByteArray &attribute) const; + QStringList subjectInfo(QSslCertificate::SubjectInfo info) const; + QStringList subjectInfo(const QByteArray &attribute) const; + QMultiMap subjectAlternativeNames() const; + QDateTime effectiveDate() const; + QDateTime expiryDate() const; + QSslKey publicKey() const; + QByteArray toPem() const; + QByteArray toDer() const; + static QList fromPath(const QString &path, QSsl::EncodingFormat format = QSsl::Pem, QSslCertificate::PatternSyntax syntax = QSslCertificate::PatternSyntax::FixedString); + static QList fromDevice(QIODevice *device, QSsl::EncodingFormat format = QSsl::Pem); + static QList fromData(const QByteArray &data, QSsl::EncodingFormat format = QSsl::Pem); + Qt::HANDLE handle() const; + void swap(QSslCertificate &other /Constrained/); + bool isBlacklisted() const; + QList subjectInfoAttributes() const; + QList issuerInfoAttributes() const; + QList extensions() const; + QString toText() const; + static QList verify(const QList &certificateChain, const QString &hostName = QString()); + bool isSelfSigned() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + static bool importPkcs12(QIODevice *device, QSslKey *key, QSslCertificate *certificate, QList *caCertificates = 0, const QByteArray &passPhrase = QByteArray()) /ReleaseGIL/; + QString issuerDisplayName() const; + QString subjectDisplayName() const; + + enum class PatternSyntax + { + RegularExpression, + Wildcard, + FixedString, + }; +}; + +%End diff --git a/sip/QtNetwork/qsslcertificateextension.sip b/sip/QtNetwork/qsslcertificateextension.sip new file mode 100644 index 0000000..afc5c90 --- /dev/null +++ b/sip/QtNetwork/qsslcertificateextension.sip @@ -0,0 +1,43 @@ +// qsslcertificateextension.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslCertificateExtension +{ +%TypeHeaderCode +#include +%End + +public: + QSslCertificateExtension(); + QSslCertificateExtension(const QSslCertificateExtension &other); + ~QSslCertificateExtension(); + void swap(QSslCertificateExtension &other /Constrained/); + QString oid() const; + QString name() const; + QVariant value() const; + bool isCritical() const; + bool isSupported() const; +}; + +%End diff --git a/sip/QtNetwork/qsslcipher.sip b/sip/QtNetwork/qsslcipher.sip new file mode 100644 index 0000000..803d050 --- /dev/null +++ b/sip/QtNetwork/qsslcipher.sip @@ -0,0 +1,51 @@ +// qsslcipher.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslCipher +{ +%TypeHeaderCode +#include +%End + +public: + QSslCipher(); + explicit QSslCipher(const QString &name); + QSslCipher(const QString &name, QSsl::SslProtocol protocol); + QSslCipher(const QSslCipher &other); + ~QSslCipher(); + bool operator==(const QSslCipher &other) const; + bool operator!=(const QSslCipher &other) const; + bool isNull() const; + QString name() const; + int supportedBits() const; + int usedBits() const; + QString keyExchangeMethod() const; + QString authenticationMethod() const; + QString encryptionMethod() const; + QString protocolString() const; + QSsl::SslProtocol protocol() const; + void swap(QSslCipher &other /Constrained/); +}; + +%End diff --git a/sip/QtNetwork/qsslconfiguration.sip b/sip/QtNetwork/qsslconfiguration.sip new file mode 100644 index 0000000..8efd54c --- /dev/null +++ b/sip/QtNetwork/qsslconfiguration.sip @@ -0,0 +1,124 @@ +// qsslconfiguration.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslConfiguration +{ +%TypeHeaderCode +#include +%End + +public: + QSslConfiguration(); + QSslConfiguration(const QSslConfiguration &other); + ~QSslConfiguration(); + bool isNull() const; + QSsl::SslProtocol protocol() const; + void setProtocol(QSsl::SslProtocol protocol); + QSslSocket::PeerVerifyMode peerVerifyMode() const; + void setPeerVerifyMode(QSslSocket::PeerVerifyMode mode); + int peerVerifyDepth() const; + void setPeerVerifyDepth(int depth); + QSslCertificate localCertificate() const; + void setLocalCertificate(const QSslCertificate &certificate); + QSslCertificate peerCertificate() const; + QList peerCertificateChain() const; + QSslCipher sessionCipher() const; + QSslKey privateKey() const; + void setPrivateKey(const QSslKey &key); + QList ciphers() const; + void setCiphers(const QString &ciphers); + void setCiphers(const QList &ciphers); + QList caCertificates() const; + void setCaCertificates(const QList &certificates); + static QSslConfiguration defaultConfiguration(); + static void setDefaultConfiguration(const QSslConfiguration &configuration); + bool operator==(const QSslConfiguration &other) const; + bool operator!=(const QSslConfiguration &other) const; + void setSslOption(QSsl::SslOption option, bool on); + bool testSslOption(QSsl::SslOption option) const; + void swap(QSslConfiguration &other /Constrained/); + QList localCertificateChain() const; + void setLocalCertificateChain(const QList &localChain); + QByteArray sessionTicket() const; + void setSessionTicket(const QByteArray &sessionTicket); + int sessionTicketLifeTimeHint() const; + + enum NextProtocolNegotiationStatus + { + NextProtocolNegotiationNone, + NextProtocolNegotiationNegotiated, + NextProtocolNegotiationUnsupported, + }; + + void setAllowedNextProtocols(const QList &protocols); + QList allowedNextProtocols() const; + QByteArray nextNegotiatedProtocol() const; + QSslConfiguration::NextProtocolNegotiationStatus nextProtocolNegotiationStatus() const; + QSsl::SslProtocol sessionProtocol() const; + static QList supportedCiphers(); + static QList systemCaCertificates(); + QList ellipticCurves() const; + void setEllipticCurves(const QList &curves); + static QList supportedEllipticCurves(); + QSslKey ephemeralServerKey() const; + QByteArray preSharedKeyIdentityHint() const; + void setPreSharedKeyIdentityHint(const QByteArray &hint); + QSslDiffieHellmanParameters diffieHellmanParameters() const; + void setDiffieHellmanParameters(const QSslDiffieHellmanParameters &dhparams); + QMap backendConfiguration() const; + void setBackendConfigurationOption(const QByteArray &name, const QVariant &value); + void setBackendConfiguration(const QMap &backendConfiguration = QMap()); + void setOcspStaplingEnabled(bool enable); + bool ocspStaplingEnabled() const; + void addCaCertificate(const QSslCertificate &certificate); + bool addCaCertificates(const QString &path, QSsl::EncodingFormat format = QSsl::Pem, QSslCertificate::PatternSyntax syntax = QSslCertificate::PatternSyntax::FixedString); + void addCaCertificates(const QList &certificates); + bool handshakeMustInterruptOnError() const; + void setHandshakeMustInterruptOnError(bool interrupt); + bool missingCertificateIsFatal() const; + void setMissingCertificateIsFatal(bool cannotRecover); + static const char *NextProtocolHttp1_1 /Encoding="None",NoSetter/; +%If (Qt_6_3_0 -) +%If (PyQt_DTLS) + bool dtlsCookieVerificationEnabled() const; +%End +%End +%If (Qt_6_3_0 -) +%If (PyQt_DTLS) + void setDtlsCookieVerificationEnabled(bool enable); +%End +%End +%If (Qt_6_3_0 -) +%If (PyQt_DTLS) + static QSslConfiguration defaultDtlsConfiguration(); +%End +%End +%If (Qt_6_3_0 -) +%If (PyQt_DTLS) + static void setDefaultDtlsConfiguration(const QSslConfiguration &configuration); +%End +%End +}; + +%End diff --git a/sip/QtNetwork/qssldiffiehellmanparameters.sip b/sip/QtNetwork/qssldiffiehellmanparameters.sip new file mode 100644 index 0000000..50c128f --- /dev/null +++ b/sip/QtNetwork/qssldiffiehellmanparameters.sip @@ -0,0 +1,62 @@ +// qssldiffiehellmanparameters.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslDiffieHellmanParameters +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + NoError, + InvalidInputDataError, + UnsafeParametersError, + }; + + QSslDiffieHellmanParameters(); + QSslDiffieHellmanParameters(const QSslDiffieHellmanParameters &other); + ~QSslDiffieHellmanParameters(); + void swap(QSslDiffieHellmanParameters &other /Constrained/); + static QSslDiffieHellmanParameters defaultParameters(); + static QSslDiffieHellmanParameters fromEncoded(const QByteArray &encoded, QSsl::EncodingFormat encoding = QSsl::Pem); + static QSslDiffieHellmanParameters fromEncoded(QIODevice *device, QSsl::EncodingFormat encoding = QSsl::Pem); + bool isEmpty() const; + bool isValid() const; + QSslDiffieHellmanParameters::Error error() const; + QString errorString() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (PyQt_SSL) +bool operator==(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs); +%End +%If (PyQt_SSL) +bool operator!=(const QSslDiffieHellmanParameters &lhs, const QSslDiffieHellmanParameters &rhs); +%End diff --git a/sip/QtNetwork/qsslellipticcurve.sip b/sip/QtNetwork/qsslellipticcurve.sip new file mode 100644 index 0000000..04db4c5 --- /dev/null +++ b/sip/QtNetwork/qsslellipticcurve.sip @@ -0,0 +1,51 @@ +// qsslellipticcurve.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslEllipticCurve +{ +%TypeHeaderCode +#include +%End + +public: + QSslEllipticCurve(); + static QSslEllipticCurve fromShortName(const QString &name); + static QSslEllipticCurve fromLongName(const QString &name); + QString shortName() const; + QString longName() const; + bool isValid() const; + bool isTlsNamedCurve() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (PyQt_SSL) +bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs); +%End +%If (PyQt_SSL) +bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs); +%End diff --git a/sip/QtNetwork/qsslerror.sip b/sip/QtNetwork/qsslerror.sip new file mode 100644 index 0000000..7e92bf5 --- /dev/null +++ b/sip/QtNetwork/qsslerror.sip @@ -0,0 +1,91 @@ +// qsslerror.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslError +{ +%TypeHeaderCode +#include +%End + +public: + enum SslError + { + UnspecifiedError, + NoError, + UnableToGetIssuerCertificate, + UnableToDecryptCertificateSignature, + UnableToDecodeIssuerPublicKey, + CertificateSignatureFailed, + CertificateNotYetValid, + CertificateExpired, + InvalidNotBeforeField, + InvalidNotAfterField, + SelfSignedCertificate, + SelfSignedCertificateInChain, + UnableToGetLocalIssuerCertificate, + UnableToVerifyFirstCertificate, + CertificateRevoked, + InvalidCaCertificate, + PathLengthExceeded, + InvalidPurpose, + CertificateUntrusted, + CertificateRejected, + SubjectIssuerMismatch, + AuthorityIssuerSerialNumberMismatch, + NoPeerCertificate, + HostNameMismatch, + NoSslSupport, + CertificateBlacklisted, + CertificateStatusUnknown, + OcspNoResponseFound, + OcspMalformedRequest, + OcspMalformedResponse, + OcspInternalError, + OcspTryLater, + OcspSigRequred, + OcspUnauthorized, + OcspResponseCannotBeTrusted, + OcspResponseCertIdUnknown, + OcspResponseExpired, + OcspStatusUnknown, + }; + + QSslError(); + explicit QSslError(QSslError::SslError error); + QSslError(QSslError::SslError error, const QSslCertificate &certificate); + QSslError(const QSslError &other); + ~QSslError(); + QSslError::SslError error() const; + QString errorString() const; + QSslCertificate certificate() const; + bool operator==(const QSslError &other) const; + bool operator!=(const QSslError &other) const; + void swap(QSslError &other /Constrained/); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End diff --git a/sip/QtNetwork/qsslkey.sip b/sip/QtNetwork/qsslkey.sip new file mode 100644 index 0000000..3b29ad8 --- /dev/null +++ b/sip/QtNetwork/qsslkey.sip @@ -0,0 +1,51 @@ +// qsslkey.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslKey +{ +%TypeHeaderCode +#include +%End + +public: + QSslKey(); + QSslKey(const QByteArray &encoded, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray &passPhrase = QByteArray()); + QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray &passPhrase = QByteArray()); + QSslKey(Qt::HANDLE handle, QSsl::KeyType type = QSsl::PrivateKey); + QSslKey(const QSslKey &other); + ~QSslKey(); + bool isNull() const; + void clear(); + int length() const; + QSsl::KeyType type() const; + QSsl::KeyAlgorithm algorithm() const; + QByteArray toPem(const QByteArray &passPhrase = QByteArray()) const; + QByteArray toDer(const QByteArray &passPhrase = QByteArray()) const; + Qt::HANDLE handle() const; + bool operator==(const QSslKey &key) const; + bool operator!=(const QSslKey &key) const; + void swap(QSslKey &other /Constrained/); +}; + +%End diff --git a/sip/QtNetwork/qsslpresharedkeyauthenticator.sip b/sip/QtNetwork/qsslpresharedkeyauthenticator.sip new file mode 100644 index 0000000..f1601da --- /dev/null +++ b/sip/QtNetwork/qsslpresharedkeyauthenticator.sip @@ -0,0 +1,51 @@ +// qsslpresharedkeyauthenticator.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslPreSharedKeyAuthenticator +{ +%TypeHeaderCode +#include +%End + +public: + QSslPreSharedKeyAuthenticator(); + QSslPreSharedKeyAuthenticator(const QSslPreSharedKeyAuthenticator &authenticator); + ~QSslPreSharedKeyAuthenticator(); + void swap(QSslPreSharedKeyAuthenticator &authenticator /Constrained/); + QByteArray identityHint() const; + void setIdentity(const QByteArray &identity); + QByteArray identity() const; + int maximumIdentityLength() const; + void setPreSharedKey(const QByteArray &preSharedKey); + QByteArray preSharedKey() const; + int maximumPreSharedKeyLength() const; +}; + +%End +%If (PyQt_SSL) +bool operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs); +%End +%If (PyQt_SSL) +bool operator!=(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs); +%End diff --git a/sip/QtNetwork/qsslserver.sip b/sip/QtNetwork/qsslserver.sip new file mode 100644 index 0000000..578c7b2 --- /dev/null +++ b/sip/QtNetwork/qsslserver.sip @@ -0,0 +1,55 @@ +// qsslserver.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_4_0 -) +%If (PyQt_SSL) + +class QSslServer : QTcpServer +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSslServer(QObject *parent /TransferThis/ = 0); + virtual ~QSslServer(); + void setSslConfiguration(const QSslConfiguration &sslConfiguration); + QSslConfiguration sslConfiguration() const; + void setHandshakeTimeout(int timeout); + int handshakeTimeout() const; + +signals: + void sslErrors(QSslSocket *socket, const QList &errors); + void peerVerifyError(QSslSocket *socket, const QSslError &error); + void errorOccurred(QSslSocket *socket, QAbstractSocket::SocketError error); + void preSharedKeyAuthenticationRequired(QSslSocket *socket, QSslPreSharedKeyAuthenticator *authenticator); + void alertSent(QSslSocket *socket, QSsl::AlertLevel level, QSsl::AlertType type, const QString &description); + void alertReceived(QSslSocket *socket, QSsl::AlertLevel level, QSsl::AlertType type, const QString &description); + void handshakeInterruptedOnError(QSslSocket *socket, const QSslError &error); + void startedEncryptionHandshake(QSslSocket *socket); + +protected: + virtual void incomingConnection(qintptr socket); +}; + +%End +%End diff --git a/sip/QtNetwork/qsslsocket.sip b/sip/QtNetwork/qsslsocket.sip new file mode 100644 index 0000000..ce3f1ef --- /dev/null +++ b/sip/QtNetwork/qsslsocket.sip @@ -0,0 +1,225 @@ +// qsslsocket.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_SSL) + +class QSslSocket : QTcpSocket +{ +%TypeHeaderCode +#include +%End + +public: + enum SslMode + { + UnencryptedMode, + SslClientMode, + SslServerMode, + }; + + explicit QSslSocket(QObject *parent /TransferThis/ = 0); + virtual ~QSslSocket(); + void connectToHostEncrypted(const QString &hostName, quint16 port, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::AnyIPProtocol) /ReleaseGIL/; + void connectToHostEncrypted(const QString &hostName, quint16 port, const QString &sslPeerName, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::AnyIPProtocol) /ReleaseGIL/; + virtual bool setSocketDescriptor(qintptr socketDescriptor, QAbstractSocket::SocketState state = QAbstractSocket::ConnectedState, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite); + QSslSocket::SslMode mode() const; + bool isEncrypted() const; + QSsl::SslProtocol protocol() const; + void setProtocol(QSsl::SslProtocol protocol); + virtual qint64 bytesAvailable() const; + virtual qint64 bytesToWrite() const; + virtual bool canReadLine() const; + virtual void close(); + virtual bool atEnd() const; + void setLocalCertificate(const QSslCertificate &certificate); + void setLocalCertificate(const QString &path, QSsl::EncodingFormat format = QSsl::Pem); + QSslCertificate localCertificate() const; + QSslCertificate peerCertificate() const; + QList peerCertificateChain() const; + QSslCipher sessionCipher() const; + void setPrivateKey(const QSslKey &key); + void setPrivateKey(const QString &fileName, QSsl::KeyAlgorithm algorithm = QSsl::Rsa, QSsl::EncodingFormat format = QSsl::Pem, const QByteArray &passPhrase = QByteArray()); + QSslKey privateKey() const; + virtual bool waitForConnected(int msecs = 30000) /ReleaseGIL/; + bool waitForEncrypted(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForReadyRead(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForBytesWritten(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForDisconnected(int msecs = 30000) /ReleaseGIL/; + static bool supportsSsl(); + +public slots: + void startClientEncryption(); + void startServerEncryption(); + void ignoreSslErrors(); + +signals: + void encrypted(); + void sslErrors(const QList &errors); + void modeChanged(QSslSocket::SslMode newMode); + void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator); + +protected: + virtual SIP_PYOBJECT readData(qint64 maxlen) /TypeHint="bytes",ReleaseGIL/ [qint64 (char *data, qint64 maxlen)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QSslSocket::readData(s, a0) : sipCpp->readData(s, a0); + #else + len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual qint64 writeData(SIP_PYBUFFER) /ReleaseGIL/ [qint64 (const char *data, qint64 len)]; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipRes = sipSelfWasArg ? + sipCpp->QSslSocket::writeData(reinterpret_cast(bi.bi_buf), bi.bi_len) : + sipCpp->writeData(reinterpret_cast(bi.bi_buf), bi.bi_len); + #else + sipRes = sipCpp->sipProtectVirt_writeData(sipSelfWasArg, reinterpret_cast(bi.bi_buf), + bi.bi_len); + #endif + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + + virtual qint64 skipData(qint64 maxSize) /ReleaseGIL/; + +public: + enum PeerVerifyMode + { + VerifyNone, + QueryPeer, + VerifyPeer, + AutoVerifyPeer, + }; + + QSslSocket::PeerVerifyMode peerVerifyMode() const; + void setPeerVerifyMode(QSslSocket::PeerVerifyMode mode); + int peerVerifyDepth() const; + void setPeerVerifyDepth(int depth); + virtual void setReadBufferSize(qint64 size); + qint64 encryptedBytesAvailable() const; + qint64 encryptedBytesToWrite() const; + QSslConfiguration sslConfiguration() const; + void setSslConfiguration(const QSslConfiguration &config); + +signals: + void peerVerifyError(const QSslError &error); + void encryptedBytesWritten(qint64 totalBytes); + void newSessionTicketReceived(); + +public: + virtual void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value); + virtual QVariant socketOption(QAbstractSocket::SocketOption option); + void ignoreSslErrors(const QList &errors); + QString peerVerifyName() const; + void setPeerVerifyName(const QString &hostName); + virtual void resume() /ReleaseGIL/; + virtual void connectToHost(const QString &hostName, quint16 port, QIODeviceBase::OpenMode mode = QIODeviceBase::ReadWrite, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::AnyIPProtocol) /ReleaseGIL/; + virtual void disconnectFromHost() /ReleaseGIL/; + static long sslLibraryVersionNumber(); + static QString sslLibraryVersionString(); + void setLocalCertificateChain(const QList &localChain); + QList localCertificateChain() const; + QSsl::SslProtocol sessionProtocol() const; + static long sslLibraryBuildVersionNumber(); + static QString sslLibraryBuildVersionString(); + QList ocspResponses() const; + QList sslHandshakeErrors() const; + void continueInterruptedHandshake(); + +signals: + void alertSent(QSsl::AlertLevel level, QSsl::AlertType type, const QString &description); + void alertReceived(QSsl::AlertLevel level, QSsl::AlertType type, const QString &description); + void handshakeInterruptedOnError(const QSslError &error); + +public: +%If (Qt_6_1_0 -) + static QList availableBackends(); +%End +%If (Qt_6_1_0 -) + static QString activeBackend(); +%End +%If (Qt_6_1_0 -) + static bool setActiveBackend(const QString &backendName); +%End +%If (Qt_6_1_0 -) + static QList supportedProtocols(const QString &backendName = {}); +%End +%If (Qt_6_1_0 -) + static bool isProtocolSupported(QSsl::SslProtocol protocol, const QString &backendName = {}); +%End +%If (Qt_6_1_0 -) + static QList implementedClasses(const QString &backendName = {}); +%End +%If (Qt_6_1_0 -) + static bool isClassImplemented(QSsl::ImplementedClass cl, const QString &backendName = {}); +%End +%If (Qt_6_1_0 -) + static QList supportedFeatures(const QString &backendName = {}); +%End +%If (Qt_6_1_0 -) + static bool isFeatureSupported(QSsl::SupportedFeature feat, const QString &backendName = {}); +%End +}; + +%End diff --git a/sip/QtNetwork/qtcpserver.sip b/sip/QtNetwork/qtcpserver.sip new file mode 100644 index 0000000..cb61ccf --- /dev/null +++ b/sip/QtNetwork/qtcpserver.sip @@ -0,0 +1,71 @@ +// qtcpserver.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTcpServer : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTcpServer(QObject *parent /TransferThis/ = 0); + virtual ~QTcpServer(); + bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0); + void close(); + bool isListening() const; + void setMaxPendingConnections(int numConnections); + int maxPendingConnections() const; + quint16 serverPort() const; + QHostAddress serverAddress() const; + qintptr socketDescriptor() const; + bool setSocketDescriptor(qintptr socketDescriptor); + bool waitForNewConnection(int msecs = 0, bool *timedOut = 0) /ReleaseGIL/; + virtual bool hasPendingConnections() const; + virtual QTcpSocket *nextPendingConnection(); + QAbstractSocket::SocketError serverError() const; + QString errorString() const; + void setProxy(const QNetworkProxy &networkProxy); + QNetworkProxy proxy() const; + void pauseAccepting(); + void resumeAccepting(); + +protected: + virtual void incomingConnection(qintptr handle); + void addPendingConnection(QTcpSocket *socket); + +signals: + void newConnection(); + void acceptError(QAbstractSocket::SocketError socketError); + +public: +%If (Qt_6_3_0 -) + void setListenBacklogSize(int size); +%End +%If (Qt_6_3_0 -) + int listenBacklogSize() const; +%End + +signals: +%If (Qt_6_4_0 -) + void pendingConnectionAvailable(); +%End +}; diff --git a/sip/QtNetwork/qtcpsocket.sip b/sip/QtNetwork/qtcpsocket.sip new file mode 100644 index 0000000..d41bb14 --- /dev/null +++ b/sip/QtNetwork/qtcpsocket.sip @@ -0,0 +1,32 @@ +// qtcpsocket.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTcpSocket : QAbstractSocket +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTcpSocket(QObject *parent /TransferThis/ = 0); + virtual ~QTcpSocket(); +}; diff --git a/sip/QtNetwork/qudpsocket.sip b/sip/QtNetwork/qudpsocket.sip new file mode 100644 index 0000000..1c916a9 --- /dev/null +++ b/sip/QtNetwork/qudpsocket.sip @@ -0,0 +1,95 @@ +// qudpsocket.sip generated by MetaSIP +// +// This file is part of the QtNetwork Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QUdpSocket : QAbstractSocket +{ +%TypeHeaderCode +#include +%End + +public: + explicit QUdpSocket(QObject *parent /TransferThis/ = 0); + virtual ~QUdpSocket(); + bool hasPendingDatagrams() const; + qint64 pendingDatagramSize() const; + SIP_PYOBJECT readDatagram(qint64 maxlen, QHostAddress *host /Out/ = 0, quint16 *port = 0) /TypeHint="bytes",ReleaseGIL/; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + len = sipCpp->readDatagram(s, a0, a1, &a2); + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + QNetworkDatagram receiveDatagram(qint64 maxSize = -1) /ReleaseGIL/; + qint64 writeDatagram(SIP_PYBUFFER, const QHostAddress &, quint16) /ReleaseGIL/; +%MethodCode + sipBufferInfoDef bi; + + if (sipGetBufferInfo(a0, &bi) > 0) + { + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->writeDatagram(reinterpret_cast(bi.bi_buf), + bi.bi_len, *a1, a2); + Py_END_ALLOW_THREADS + + sipReleaseBufferInfo(&bi); + } + else + { + sipIsErr = 1; + } +%End + + qint64 writeDatagram(const QNetworkDatagram &datagram) /ReleaseGIL/; + bool joinMulticastGroup(const QHostAddress &groupAddress); + bool joinMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface); + bool leaveMulticastGroup(const QHostAddress &groupAddress); + bool leaveMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface); + QNetworkInterface multicastInterface() const; + void setMulticastInterface(const QNetworkInterface &iface); +}; diff --git a/sip/QtNfc/QtNfcmod.sip b/sip/QtNfc/QtNfcmod.sip new file mode 100644 index 0000000..31bc71d --- /dev/null +++ b/sip/QtNfc/QtNfcmod.sip @@ -0,0 +1,55 @@ +// QtNfcmod.sip generated by MetaSIP +// +// This file is part of the QtNfc Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtNfc, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qndeffilter.sip +%Include qndefmessage.sip +%Include qndefnfcsmartposterrecord.sip +%Include qndefnfctextrecord.sip +%Include qndefnfcurirecord.sip +%Include qndefrecord.sip +%Include qnearfieldmanager.sip +%Include qnearfieldtarget.sip diff --git a/sip/QtNfc/qndeffilter.sip b/sip/QtNfc/qndeffilter.sip new file mode 100644 index 0000000..f54f738 --- /dev/null +++ b/sip/QtNfc/qndeffilter.sip @@ -0,0 +1,58 @@ +// qndeffilter.sip generated by MetaSIP +// +// This file is part of the QtNfc Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNdefFilter +{ +%TypeHeaderCode +#include +%End + +public: + QNdefFilter(); + QNdefFilter(const QNdefFilter &other); + ~QNdefFilter(); + void clear(); + void setOrderMatch(bool on); + bool orderMatch() const; + + struct Record + { +%TypeHeaderCode +#include +%End + + QNdefRecord::TypeNameFormat typeNameFormat; + QByteArray type; + unsigned int minimum; + unsigned int maximum; + }; + + bool appendRecord(const QNdefFilter::Record &record); + bool appendRecord(QNdefRecord::TypeNameFormat typeNameFormat, const QByteArray &type, unsigned int min = 1, unsigned int max = 1); + qsizetype recordCount() const /__len__/; + QNdefFilter::Record recordAt(qsizetype i) const; + bool match(const QNdefMessage &message) const; +}; + +%End diff --git a/sip/QtNfc/qndefmessage.sip b/sip/QtNfc/qndefmessage.sip new file mode 100644 index 0000000..f567e6d --- /dev/null +++ b/sip/QtNfc/qndefmessage.sip @@ -0,0 +1,74 @@ +// qndefmessage.sip generated by MetaSIP +// +// This file is part of the QtNfc Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNdefMessage +{ +%TypeHeaderCode +#include +%End + +public: + QNdefMessage(); + explicit QNdefMessage(const QNdefRecord &record); + QNdefMessage(const QNdefMessage &message); + QNdefMessage(const QList &records); + bool operator==(const QNdefMessage &other) const; + QByteArray toByteArray() const; + Py_ssize_t __len__() const; +%MethodCode + sipRes = sipCpp->count(); +%End + + QNdefRecord __getitem__(int i) const; +%MethodCode + Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); + + if (idx < 0) + sipIsErr = 1; + else + sipRes = new QNdefRecord(sipCpp->at((int)idx)); +%End + + void __setitem__(int i, const QNdefRecord &value); +%MethodCode + int len = sipCpp->count(); + + if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0) + sipIsErr = 1; + else + (*sipCpp)[a0] = *a1; +%End + + void __delitem__(int i); +%MethodCode + if ((a0 = (int)sipConvertFromSequenceIndex(a0, sipCpp->count())) < 0) + sipIsErr = 1; + else + sipCpp->removeAt(a0); +%End + + static QNdefMessage fromByteArray(const QByteArray &message); +}; + +%End diff --git a/sip/QtNfc/qndefnfcsmartposterrecord.sip b/sip/QtNfc/qndefnfcsmartposterrecord.sip new file mode 100644 index 0000000..bb5a9d3 --- /dev/null +++ b/sip/QtNfc/qndefnfcsmartposterrecord.sip @@ -0,0 +1,96 @@ +// qndefnfcsmartposterrecord.sip generated by MetaSIP +// +// This file is part of the QtNfc Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNdefNfcIconRecord : QNdefRecord +{ +%TypeHeaderCode +#include +%End + +public: + QNdefNfcIconRecord(); + QNdefNfcIconRecord(const QNdefRecord &other); + void setData(const QByteArray &data); + QByteArray data() const; +}; + +%End +%If (Qt_6_2_0 -) + +class QNdefNfcSmartPosterRecord : QNdefRecord +{ +%TypeHeaderCode +#include +%End + +public: + enum Action + { + UnspecifiedAction, + DoAction, + SaveAction, + EditAction, + }; + + QNdefNfcSmartPosterRecord(); + QNdefNfcSmartPosterRecord(const QNdefNfcSmartPosterRecord &other); + QNdefNfcSmartPosterRecord(const QNdefRecord &other); + ~QNdefNfcSmartPosterRecord(); + void setPayload(const QByteArray &payload); + bool hasTitle(const QString &locale = QString()) const; + bool hasAction() const; + bool hasIcon(const QByteArray &mimetype = QByteArray()) const; + bool hasSize() const; + bool hasTypeInfo() const; + qsizetype titleCount() const; + QString title(const QString &locale = QString()) const; + QNdefNfcTextRecord titleRecord(qsizetype index) const; + QList titleRecords() const; + bool addTitle(const QNdefNfcTextRecord &text); + bool addTitle(const QString &text, const QString &locale, QNdefNfcTextRecord::Encoding encoding); + bool removeTitle(const QNdefNfcTextRecord &text); + bool removeTitle(const QString &locale); + void setTitles(const QList &titles); + QUrl uri() const; + QNdefNfcUriRecord uriRecord() const; + void setUri(const QNdefNfcUriRecord &url); + void setUri(const QUrl &url); + QNdefNfcSmartPosterRecord::Action action() const; + void setAction(QNdefNfcSmartPosterRecord::Action act); + qsizetype iconCount() const; + QByteArray icon(const QByteArray &mimetype = QByteArray()) const; + QNdefNfcIconRecord iconRecord(qsizetype index) const; + QList iconRecords() const; + void addIcon(const QNdefNfcIconRecord &icon); + void addIcon(const QByteArray &type, const QByteArray &data); + bool removeIcon(const QNdefNfcIconRecord &icon); + bool removeIcon(const QByteArray &type); + void setIcons(const QList &icons); + quint32 size() const; + void setSize(quint32 size); + QString typeInfo() const; + void setTypeInfo(const QString &type); +}; + +%End diff --git a/sip/QtNfc/qndefnfctextrecord.sip b/sip/QtNfc/qndefnfctextrecord.sip new file mode 100644 index 0000000..e8ed782 --- /dev/null +++ b/sip/QtNfc/qndefnfctextrecord.sip @@ -0,0 +1,49 @@ +// qndefnfctextrecord.sip generated by MetaSIP +// +// This file is part of the QtNfc Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNdefNfcTextRecord : QNdefRecord +{ +%TypeHeaderCode +#include +%End + +public: + QNdefNfcTextRecord(); + QNdefNfcTextRecord(const QNdefRecord &other); + QString locale() const; + void setLocale(const QString &locale); + QString text() const; + void setText(const QString text); + + enum Encoding + { + Utf8, + Utf16, + }; + + QNdefNfcTextRecord::Encoding encoding() const; + void setEncoding(QNdefNfcTextRecord::Encoding encoding); +}; + +%End diff --git a/sip/QtNfc/qndefnfcurirecord.sip b/sip/QtNfc/qndefnfcurirecord.sip new file mode 100644 index 0000000..624bbdc --- /dev/null +++ b/sip/QtNfc/qndefnfcurirecord.sip @@ -0,0 +1,38 @@ +// qndefnfcurirecord.sip generated by MetaSIP +// +// This file is part of the QtNfc Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNdefNfcUriRecord : QNdefRecord +{ +%TypeHeaderCode +#include +%End + +public: + QNdefNfcUriRecord(); + QNdefNfcUriRecord(const QNdefRecord &other); + QUrl uri() const; + void setUri(const QUrl &uri); +}; + +%End diff --git a/sip/QtNfc/qndefrecord.sip b/sip/QtNfc/qndefrecord.sip new file mode 100644 index 0000000..9fef608 --- /dev/null +++ b/sip/QtNfc/qndefrecord.sip @@ -0,0 +1,93 @@ +// qndefrecord.sip generated by MetaSIP +// +// This file is part of the QtNfc Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNdefRecord +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + QByteArray ndef_type = sipCpp->type(); + + switch (sipCpp->typeNameFormat()) + { + case QNdefRecord::NfcRtd: + if (ndef_type == "Sp") + sipType = sipType_QNdefNfcSmartPosterRecord; + else if (ndef_type == "T") + sipType = sipType_QNdefNfcTextRecord; + else if (ndef_type == "U") + sipType = sipType_QNdefNfcUriRecord; + else + sipType = 0; + + break; + + case QNdefRecord::Mime: + if (ndef_type == "") + sipType = sipType_QNdefNfcIconRecord; + else + sipType = 0; + + break; + + default: + sipType = 0; + } +%End + +public: + enum TypeNameFormat + { + Empty, + NfcRtd, + Mime, + Uri, + ExternalRtd, + Unknown, + }; + + QNdefRecord(); + QNdefRecord(const QNdefRecord &other); + ~QNdefRecord(); + void setTypeNameFormat(QNdefRecord::TypeNameFormat typeNameFormat); + QNdefRecord::TypeNameFormat typeNameFormat() const; + void setType(const QByteArray &type); + QByteArray type() const; + void setId(const QByteArray &id); + QByteArray id() const; + void setPayload(const QByteArray &payload); + QByteArray payload() const; + bool isEmpty() const; + void clear(); + bool operator==(const QNdefRecord &other) const; + bool operator!=(const QNdefRecord &other) const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End diff --git a/sip/QtNfc/qnearfieldmanager.sip b/sip/QtNfc/qnearfieldmanager.sip new file mode 100644 index 0000000..f536bb1 --- /dev/null +++ b/sip/QtNfc/qnearfieldmanager.sip @@ -0,0 +1,107 @@ +// qnearfieldmanager.sip generated by MetaSIP +// +// This file is part of the QtNfc Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNearFieldManager : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QNearFieldManager, &sipType_QNearFieldManager, -1, 1}, + {sipName_QNearFieldTarget, &sipType_QNearFieldTarget, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + explicit QNearFieldManager(QObject *parent /TransferThis/ = 0); + virtual ~QNearFieldManager(); + bool startTargetDetection(QNearFieldTarget::AccessMethod accessMethod); + void stopTargetDetection(const QString &errorMessage = QString()); + +signals: + void targetDetected(QNearFieldTarget *target); + void targetLost(QNearFieldTarget *target); + void targetDetectionStopped(); + +public: + enum class AdapterState + { + Offline, + TurningOn, + Online, + TurningOff, + }; + + bool isSupported(QNearFieldTarget::AccessMethod accessMethod = QNearFieldTarget::AnyAccess) const; + +signals: + void adapterStateChanged(QNearFieldManager::AdapterState state); + +public: + bool isEnabled() const; + void setUserInformation(const QString &message); +}; + +%End + +%ModuleHeaderCode +// Imports from QtCore. +typedef sipErrorState (*pyqt6_qtnfc_get_pyqtslot_parts_t)(PyObject *, QObject **, QByteArray &); +extern pyqt6_qtnfc_get_pyqtslot_parts_t pyqt6_qtnfc_get_pyqtslot_parts; +%End + +%ModuleCode +// Imports from QtCore. +pyqt6_qtnfc_get_pyqtslot_parts_t pyqt6_qtnfc_get_pyqtslot_parts; +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtnfc_get_pyqtslot_parts = (pyqt6_qtnfc_get_pyqtslot_parts_t)sipImportSymbol("pyqt6_get_pyqtslot_parts"); +Q_ASSERT(pyqt6_qtnfc_get_pyqtslot_parts); +%End diff --git a/sip/QtNfc/qnearfieldtarget.sip b/sip/QtNfc/qnearfieldtarget.sip new file mode 100644 index 0000000..40030de --- /dev/null +++ b/sip/QtNfc/qnearfieldtarget.sip @@ -0,0 +1,110 @@ +// qnearfieldtarget.sip generated by MetaSIP +// +// This file is part of the QtNfc Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNearFieldTarget : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Type + { + ProprietaryTag, + NfcTagType1, + NfcTagType2, + NfcTagType3, + NfcTagType4, + NfcTagType4A, + NfcTagType4B, + MifareTag, + }; + + enum AccessMethod /BaseType=Flag/ + { + UnknownAccess, + NdefAccess, + TagTypeSpecificAccess, + AnyAccess, + }; + + typedef QFlags AccessMethods; + + enum Error + { + NoError, + UnknownError, + UnsupportedError, + TargetOutOfRangeError, + NoResponseError, + ChecksumMismatchError, + InvalidParametersError, + NdefReadError, + NdefWriteError, + CommandError, + ConnectionError, + TimeoutError, + }; + + class RequestId + { +%TypeHeaderCode +#include +%End + + public: + RequestId(); + RequestId(const QNearFieldTarget::RequestId &other); + ~RequestId(); + bool isValid() const; + int refCount() const; + bool operator<(const QNearFieldTarget::RequestId &other) const; + bool operator==(const QNearFieldTarget::RequestId &other) const; + bool operator!=(const QNearFieldTarget::RequestId &other) const; + }; + + explicit QNearFieldTarget(QObject *parent /TransferThis/ = 0); + virtual ~QNearFieldTarget(); + QByteArray uid() const; + QNearFieldTarget::Type type() const; + QNearFieldTarget::AccessMethods accessMethods() const; + bool hasNdefMessage(); + QNearFieldTarget::RequestId readNdefMessages(); + QNearFieldTarget::RequestId writeNdefMessages(const QList &messages); + QNearFieldTarget::RequestId sendCommand(const QByteArray &command); + bool waitForRequestCompleted(const QNearFieldTarget::RequestId &id, int msecs = 5000) /ReleaseGIL/; + QVariant requestResponse(const QNearFieldTarget::RequestId &id) const; + +signals: + void disconnected(); + void ndefMessageRead(const QNdefMessage &message); + void requestCompleted(const QNearFieldTarget::RequestId &id); + void error(QNearFieldTarget::Error error, const QNearFieldTarget::RequestId &id); + +public: + bool disconnect(); + int maxCommandLength() const; +}; + +%End diff --git a/sip/QtOpenGL/QtOpenGLmod.sip b/sip/QtOpenGL/QtOpenGLmod.sip new file mode 100644 index 0000000..a41b2e2 --- /dev/null +++ b/sip/QtOpenGL/QtOpenGLmod.sip @@ -0,0 +1,68 @@ +// QtOpenGLmod.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtOpenGL, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qopenglbuffer.sip +%Include qopengldebug.sip +%Include qopenglframebufferobject.sip +%Include qopenglpaintdevice.sip +%Include qopenglpixeltransferoptions.sip +%Include qopenglshaderprogram.sip +%Include qopengltexture.sip +%Include qopengltextureblitter.sip +%Include qopengltimerquery.sip +%Include qopenglversionfunctions.sip +%Include qopenglversionfunctionsfactory.sip +%Include qopenglvertexarrayobject.sip +%Include qopenglwindow.sip +%Include qopenglfunctions_2_0.sip +%Include qopenglfunctions_2_1.sip +%Include qopenglfunctions_4_1_core.sip +%Include qopenglfunctions_es2.sip +%Include qopenglversionprofile.sip +%Include qpyopengl_qlist.sip +%Include qpyopengl_std_pair.sip diff --git a/sip/QtOpenGL/qopenglbuffer.sip b/sip/QtOpenGL/qopenglbuffer.sip new file mode 100644 index 0000000..8dbafd2 --- /dev/null +++ b/sip/QtOpenGL/qopenglbuffer.sip @@ -0,0 +1,96 @@ +// qopenglbuffer.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLBuffer +{ +%TypeHeaderCode +#include +%End + +public: + enum Type + { + VertexBuffer, + IndexBuffer, + PixelPackBuffer, + PixelUnpackBuffer, + }; + + QOpenGLBuffer(); + explicit QOpenGLBuffer(QOpenGLBuffer::Type type); + QOpenGLBuffer(const QOpenGLBuffer &other); + ~QOpenGLBuffer(); + + enum UsagePattern + { + StreamDraw, + StreamRead, + StreamCopy, + StaticDraw, + StaticRead, + StaticCopy, + DynamicDraw, + DynamicRead, + DynamicCopy, + }; + + enum Access + { + ReadOnly, + WriteOnly, + ReadWrite, + }; + + QOpenGLBuffer::Type type() const; + QOpenGLBuffer::UsagePattern usagePattern() const; + void setUsagePattern(QOpenGLBuffer::UsagePattern value); + bool create(); + bool isCreated() const; + void destroy(); + bool bind(); + void release(); + static void release(QOpenGLBuffer::Type type); + GLuint bufferId() const; + int size() const /__len__/; + bool read(int offset, void *data, int count); + void write(int offset, const void *data, int count); + void allocate(const void *data, int count); + void allocate(int count); + void *map(QOpenGLBuffer::Access access); + bool unmap(); + + enum RangeAccessFlag /BaseType=Flag/ + { + RangeRead, + RangeWrite, + RangeInvalidate, + RangeInvalidateBuffer, + RangeFlushExplicit, + RangeUnsynchronized, + }; + + typedef QFlags RangeAccessFlags; + void *mapRange(int offset, int count, QOpenGLBuffer::RangeAccessFlags access); +%If (Qt_6_5_0 -) + void swap(QOpenGLBuffer &other); +%End +}; diff --git a/sip/QtOpenGL/qopengldebug.sip b/sip/QtOpenGL/qopengldebug.sip new file mode 100644 index 0000000..41a95fc --- /dev/null +++ b/sip/QtOpenGL/qopengldebug.sip @@ -0,0 +1,163 @@ +// qopengldebug.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLDebugMessage +{ +%TypeHeaderCode +#include +%End + +public: + enum Source /BaseType=Flag/ + { + InvalidSource, + APISource, + WindowSystemSource, + ShaderCompilerSource, + ThirdPartySource, + ApplicationSource, + OtherSource, + AnySource, + }; + + typedef QFlags Sources; + + enum Type /BaseType=Flag/ + { + InvalidType, + ErrorType, + DeprecatedBehaviorType, + UndefinedBehaviorType, + PortabilityType, + PerformanceType, + OtherType, + MarkerType, + GroupPushType, + GroupPopType, + AnyType, + }; + + typedef QFlags Types; + + enum Severity /BaseType=Flag/ + { + InvalidSeverity, + HighSeverity, + MediumSeverity, + LowSeverity, + NotificationSeverity, + AnySeverity, + }; + + typedef QFlags Severities; + QOpenGLDebugMessage(); + QOpenGLDebugMessage(const QOpenGLDebugMessage &debugMessage); + ~QOpenGLDebugMessage(); + void swap(QOpenGLDebugMessage &debugMessage /Constrained/); + QOpenGLDebugMessage::Source source() const; + QOpenGLDebugMessage::Type type() const; + QOpenGLDebugMessage::Severity severity() const; + GLuint id() const; + QString message() const; + static QOpenGLDebugMessage createApplicationMessage(const QString &text, GLuint id = 0, QOpenGLDebugMessage::Severity severity = QOpenGLDebugMessage::NotificationSeverity, QOpenGLDebugMessage::Type type = QOpenGLDebugMessage::OtherType); + static QOpenGLDebugMessage createThirdPartyMessage(const QString &text, GLuint id = 0, QOpenGLDebugMessage::Severity severity = QOpenGLDebugMessage::NotificationSeverity, QOpenGLDebugMessage::Type type = QOpenGLDebugMessage::OtherType); + bool operator==(const QOpenGLDebugMessage &debugMessage) const; + bool operator!=(const QOpenGLDebugMessage &debugMessage) const; +}; + +class QOpenGLDebugLogger : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QOpenGLDebugLogger, &sipType_QOpenGLDebugLogger, -1, 1}, + {sipName_QOpenGLShader, &sipType_QOpenGLShader, -1, 2}, + {sipName_QOpenGLShaderProgram, &sipType_QOpenGLShaderProgram, -1, 3}, + #if !defined(SIP_FEATURE_PyQt_OpenGL_ES2) + {sipName_QOpenGLTimeMonitor, &sipType_QOpenGLTimeMonitor, -1, 4}, + #else + {0, 0, -1, 4}, + #endif + #if !defined(SIP_FEATURE_PyQt_OpenGL_ES2) + {sipName_QOpenGLTimerQuery, &sipType_QOpenGLTimerQuery, -1, 5}, + #else + {0, 0, -1, 5}, + #endif + {sipName_QOpenGLVertexArrayObject, &sipType_QOpenGLVertexArrayObject, -1, 6}, + {sipName_QOpenGLWindow, &sipType_QOpenGLWindow, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum LoggingMode + { + AsynchronousLogging, + SynchronousLogging, + }; + + explicit QOpenGLDebugLogger(QObject *parent /TransferThis/ = 0); + virtual ~QOpenGLDebugLogger(); + bool initialize(); + bool isLogging() const; + QOpenGLDebugLogger::LoggingMode loggingMode() const; + qint64 maximumMessageLength() const; + void pushGroup(const QString &name, GLuint id = 0, QOpenGLDebugMessage::Source source = QOpenGLDebugMessage::ApplicationSource); + void popGroup(); + void enableMessages(QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::Severities severities = QOpenGLDebugMessage::AnySeverity); + void enableMessages(const QList &ids, QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType); + void disableMessages(QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType, QOpenGLDebugMessage::Severities severities = QOpenGLDebugMessage::AnySeverity); + void disableMessages(const QList &ids, QOpenGLDebugMessage::Sources sources = QOpenGLDebugMessage::AnySource, QOpenGLDebugMessage::Types types = QOpenGLDebugMessage::AnyType); + QList loggedMessages() const; + +public slots: + void logMessage(const QOpenGLDebugMessage &debugMessage); + void startLogging(QOpenGLDebugLogger::LoggingMode loggingMode = QOpenGLDebugLogger::AsynchronousLogging); + void stopLogging(); + +signals: + void messageLogged(const QOpenGLDebugMessage &debugMessage); +}; diff --git a/sip/QtOpenGL/qopenglframebufferobject.sip b/sip/QtOpenGL/qopenglframebufferobject.sip new file mode 100644 index 0000000..305fc99 --- /dev/null +++ b/sip/QtOpenGL/qopenglframebufferobject.sip @@ -0,0 +1,115 @@ +// qopenglframebufferobject.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLFramebufferObject +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// The defaults are different for desktop OpenGL and OpenGL/ES so pretend the +// latter is the former. +#if defined(QT_OPENGL_ES) +#undef GL_RGBA8 +#define GL_RGBA8 GL_RGBA +#endif +%End + +public: + enum Attachment + { + NoAttachment, + CombinedDepthStencil, + Depth, + }; + + QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D); + QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D); + QOpenGLFramebufferObject(const QSize &size, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8); + QOpenGLFramebufferObject(int width, int height, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internal_format = GL_RGBA8); + QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format); + QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format); + virtual ~QOpenGLFramebufferObject(); + QOpenGLFramebufferObjectFormat format() const; + bool isValid() const; + bool isBound() const; + bool bind(); + bool release(); + int width() const; + int height() const; + GLuint texture() const; + QList textures() const; + QSize size() const; + QImage toImage(bool flipped = true) const; + QImage toImage(bool flipped, int colorAttachmentIndex) const; + QOpenGLFramebufferObject::Attachment attachment() const; + void setAttachment(QOpenGLFramebufferObject::Attachment attachment); + GLuint handle() const; + static bool bindDefault(); + static bool hasOpenGLFramebufferObjects(); + static bool hasOpenGLFramebufferBlit(); + + enum FramebufferRestorePolicy + { + DontRestoreFramebufferBinding, + RestoreFramebufferBindingToDefault, + RestoreFrameBufferBinding, + }; + + static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST); + static void blitFramebuffer(QOpenGLFramebufferObject *target, QOpenGLFramebufferObject *source, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST); + static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex); + static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex, QOpenGLFramebufferObject::FramebufferRestorePolicy restorePolicy); + GLuint takeTexture(); + GLuint takeTexture(int colorAttachmentIndex); + void addColorAttachment(const QSize &size, GLenum internal_format = 0); + void addColorAttachment(int width, int height, GLenum internal_format = 0); + QList sizes() const; + +private: + QOpenGLFramebufferObject(const QOpenGLFramebufferObject &); +}; + +class QOpenGLFramebufferObjectFormat +{ +%TypeHeaderCode +#include +%End + +public: + QOpenGLFramebufferObjectFormat(); + QOpenGLFramebufferObjectFormat(const QOpenGLFramebufferObjectFormat &other); + ~QOpenGLFramebufferObjectFormat(); + void setSamples(int samples); + int samples() const; + void setMipmap(bool enabled); + bool mipmap() const; + void setAttachment(QOpenGLFramebufferObject::Attachment attachment); + QOpenGLFramebufferObject::Attachment attachment() const; + void setTextureTarget(GLenum target); + GLenum textureTarget() const; + void setInternalTextureFormat(GLenum internalTextureFormat); + GLenum internalTextureFormat() const; + bool operator==(const QOpenGLFramebufferObjectFormat &other) const; + bool operator!=(const QOpenGLFramebufferObjectFormat &other) const; +}; diff --git a/sip/QtOpenGL/qopenglfunctions_2_0.sip b/sip/QtOpenGL/qopenglfunctions_2_0.sip new file mode 100644 index 0000000..1c06e45 --- /dev/null +++ b/sip/QtOpenGL/qopenglfunctions_2_0.sip @@ -0,0 +1,2919 @@ +// qopenglfunctions_2_0.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (!PyQt_OpenGL_ES2) + +class QOpenGLFunctions_2_0 : QAbstractOpenGLFunctions +{ +%TypeHeaderCode +#include +%End + +public: + QOpenGLFunctions_2_0(); + bool initializeOpenGLFunctions(); + void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); + void glDepthRange(GLdouble nearVal, GLdouble farVal); + GLboolean glIsEnabled(GLenum cap); + void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, SIP_PYOBJECT *params /TypeHint="int"/); +%MethodCode + GLint params[1]; + + sipCpp->glGetTexLevelParameteriv(a0, a1, a2, params); + + a3 = qpyopengl_from_GLint(&sipIsErr, params, 1); +%End + + void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, SIP_PYOBJECT *params /TypeHint="float"/); +%MethodCode + GLfloat params[1]; + + sipCpp->glGetTexLevelParameterfv(a0, a1, a2, params); + + a3 = qpyopengl_from_GLfloat(&sipIsErr, params, 1); +%End + + void glGetTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR) + #if defined(GL_TEXTURE_SWIZZLE_RGBA) + case GL_TEXTURE_SWIZZLE_RGBA: + #endif + #if defined(GL_TEXTURE_BORDER_COLOR) + case GL_TEXTURE_BORDER_COLOR: + #endif + nr_params = 4; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetTexParameteriv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR) + #if defined(GL_TEXTURE_SWIZZLE_RGBA) + case GL_TEXTURE_SWIZZLE_RGBA: + #endif + #if defined(GL_TEXTURE_BORDER_COLOR) + case GL_TEXTURE_BORDER_COLOR: + #endif + nr_params = 4; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetTexParameterfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + const char *glGetString(GLenum name); +%MethodCode + sipRes = reinterpret_cast(sipCpp->glGetString(a0)); +%End + + void glGetIntegerv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLint fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLint[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetIntegerv(a0, params); + a1 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + void glGetFloatv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, ...]]"/); +%MethodCode + GLfloat fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLfloat[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetFloatv(a0, params); + a1 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + GLenum glGetError(); + void glGetDoublev(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, ...]]"/); +%MethodCode + GLdouble fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLdouble[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetDoublev(a0, params); + a1 = qpyopengl_from_GLdouble(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + void glGetBooleanv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[bool, Tuple[bool, ...]]"/); +%MethodCode + GLboolean fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLboolean[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetBooleanv(a0, params); + a1 = qpyopengl_from_GLboolean(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + SIP_PYOBJECT glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type) /TypeHint="Union[Tuple[float, ...], Tuple[int, ...]]"/; +%MethodCode + int components; + + switch (a4) + { + case GL_BGR: + case GL_RGB: + { + components = 3; + break; + } + + case GL_BGRA: + case GL_RGBA: + { + components = 4; + break; + } + + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_DEPTH_COMPONENT: + case GL_STENCIL_INDEX: + case GL_DEPTH_STENCIL: + { + components = 1; + break; + } + + default: + components = 0; + } + + Py_ssize_t length = components * a2 * a3; + + switch (a5) + { + case GL_FLOAT: + { + GLfloat *data = new GLfloat[length]; + + sipCpp->glReadPixels(a0, a1, a2, a3, a4, a5, data); + sipRes = qpyopengl_from_GLfloat(&sipIsErr, data, length); + delete [] data; + + break; + } + + case GL_INT: + { + GLint *data = new GLint[length]; + + sipCpp->glReadPixels(a0, a1, a2, a3, a4, a5, data); + sipRes = qpyopengl_from_GLint(&sipIsErr, data, length); + delete [] data; + + break; + } + + case GL_UNSIGNED_INT: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + case GL_UNSIGNED_INT_24_8: + case GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL_UNSIGNED_INT_5_9_9_9_REV: + { + GLuint *data = new GLuint[length]; + + sipCpp->glReadPixels(a0, a1, a2, a3, a4, a5, data); + sipRes = qpyopengl_from_GLuint(&sipIsErr, data, length); + delete [] data; + + break; + } + + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_HALF_FLOAT: + case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + default: + sipIsErr = 1; + PyErr_SetString(PyExc_ValueError, "pixel data format not supported"); + } +%End + + void glReadBuffer(GLenum mode); + void glPixelStorei(GLenum pname, GLint param); + void glPixelStoref(GLenum pname, GLfloat param); + void glDepthFunc(GLenum func); + void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); + void glStencilFunc(GLenum func, GLint ref, GLuint mask); + void glLogicOp(GLenum opcode); + void glBlendFunc(GLenum sfactor, GLenum dfactor); + void glFlush(); + void glFinish(); + void glEnable(GLenum cap); + void glDisable(GLenum cap); + void glDepthMask(GLboolean flag); + void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void glStencilMask(GLuint mask); + void glClearDepth(GLdouble depth); + void glClearStencil(GLint s); + void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glClear(GLbitfield mask); + void glDrawBuffer(GLenum mode); + void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a7, a6, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage1D(a0, a1, a2, a3, a4, a5, a6, array); +%End + + void glTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexParameteriv(a0, a1, reinterpret_cast(array)); +%End + + void glTexParameteri(GLenum target, GLenum pname, GLint param); + void glTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexParameterfv(a0, a1, reinterpret_cast(array)); +%End + + void glTexParameterf(GLenum target, GLenum pname, GLfloat param); + void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); + void glPolygonMode(GLenum face, GLenum mode); + void glPointSize(GLfloat size); + void glLineWidth(GLfloat width); + void glHint(GLenum target, GLenum mode); + void glFrontFace(GLenum mode); + void glCullFace(GLenum mode); + void glIndexubv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexubv(reinterpret_cast(array)); +%End + + void glIndexub(GLubyte c); + GLboolean glIsTexture(GLuint texture); + void glGenTextures(GLsizei n, SIP_PYOBJECT *textures /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenTextures(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glDeleteTextures(GLsizei n, SIP_PYOBJECT textures /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteTextures(a0, reinterpret_cast(array)); +%End + + void glBindTexture(GLenum target, GLuint texture); + void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, a5, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage1D(a0, a1, a2, a3, a4, a5, array); +%End + + void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); + void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); + void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); + void glPolygonOffset(GLfloat factor, GLfloat units); + void glDrawElements(GLenum mode, GLsizei count, GLenum type, SIP_PYOBJECT indices /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, a2, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawElements(a0, a1, a2, array); +%End + + void glDrawArrays(GLenum mode, GLint first, GLsizei count); + void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a10, a9, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage3D(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, array); +%End + + void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a9, a8, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage3D(a0, a1, a2, a3, a4, a5, a6, a7, a8, array); +%End + + void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, SIP_PYOBJECT indices /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, a4, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawRangeElements(a0, a1, a2, a3, a4, array); +%End + + void glBlendEquation(GLenum mode); + void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage1D(a0, a1, a2, a3, a4, a5, array); +%End + + void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a10, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage3D(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + array); +%End + + void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage1D(a0, a1, a2, a3, a4, a5, array); +%End + + void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a7, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage2D(a0, a1, a2, a3, a4, a5, a6, array); +%End + + void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage3D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glSampleCoverage(GLfloat value, GLboolean invert); + void glActiveTexture(GLenum texture); + void glPointParameteriv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPointParameteriv(a0, reinterpret_cast(array)); +%End + + void glPointParameteri(GLenum pname, GLint param); + void glPointParameterfv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPointParameterfv(a0, reinterpret_cast(array)); +%End + + void glPointParameterf(GLenum pname, GLfloat param); + void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); + void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params); + GLboolean glUnmapBuffer(GLenum target); + void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array; + + if (a3 == Py_None) + array = 0; + else + array = qpyopengl_value_array(&sipError, a3, GL_UNSIGNED_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBufferSubData(a0, a1, a2, array); +%End + + void glBufferData(GLenum target, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/, GLenum usage); +%MethodCode + const GLvoid *array; + + if (a2 == Py_None) + array = 0; + else + array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBufferData(a0, a1, array, a3); +%End + + GLboolean glIsBuffer(GLuint buffer); + void glGenBuffers(GLsizei n, SIP_PYOBJECT *buffers /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenBuffers(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glDeleteBuffers(GLsizei n, SIP_PYOBJECT buffers /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteBuffers(a0, reinterpret_cast(array)); +%End + + void glBindBuffer(GLenum target, GLuint buffer); + void glGetQueryiv(GLenum target, GLenum pname, GLint *params); + void glEndQuery(GLenum target); + void glBeginQuery(GLenum target, GLuint id); + GLboolean glIsQuery(GLuint id); + void glDeleteQueries(GLsizei n, SIP_PYOBJECT ids /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteQueries(a0, reinterpret_cast(array)); +%End + + void glGenQueries(GLsizei n, SIP_PYOBJECT *ids /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenQueries(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a5, a2, sipSelf, + "VertexAttribPointer", a0); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttribPointer(a0, a1, a2, a3, a4, array); +%End + + void glValidateProgram(GLuint program); + void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix4fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix3fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix2fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniform4iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform4iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform3iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform3iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform2iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform2iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform1iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform1iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform4fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform4fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform3fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform3fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform2fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform2fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform1fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform1fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); + void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2); + void glUniform2i(GLint location, GLint v0, GLint v1); + void glUniform1i(GLint location, GLint v0); + void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); + void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); + void glUniform2f(GLint location, GLfloat v0, GLfloat v1); + void glUniform1f(GLint location, GLfloat v0); + void glUseProgram(GLuint program); + void glLinkProgram(GLuint program); + GLboolean glIsShader(GLuint shader); + GLboolean glIsProgram(GLuint program); + void glGetVertexAttribiv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetVertexAttribfv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetVertexAttribdv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLdouble params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribdv(a0, a1, params); + + a2 = qpyopengl_from_GLdouble(&sipIsErr, params, nr_params); +%End + + GLint glGetUniformLocation(GLuint program, const GLchar *name); + SIP_PYOBJECT glGetShaderSource(GLuint shader) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetShaderiv(a0, GL_SHADER_SOURCE_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *source = new GLchar[bufsize]; + + sipCpp->glGetShaderSource(a0, bufsize, 0, source); + sipRes = PyBytes_FromString(source); + + delete[] source; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + SIP_PYOBJECT glGetShaderInfoLog(GLuint shader) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetShaderiv(a0, GL_INFO_LOG_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *log = new GLchar[bufsize]; + + sipCpp->glGetShaderInfoLog(a0, bufsize, 0, log); + sipRes = PyBytes_FromString(log); + + delete[] log; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + void glGetShaderiv(GLuint shader, GLenum pname, GLint *params); + SIP_PYOBJECT glGetProgramInfoLog(GLuint program) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_INFO_LOG_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *log = new GLchar[bufsize]; + + sipCpp->glGetProgramInfoLog(a0, bufsize, 0, log); + sipRes = PyBytes_FromString(log); + + delete[] log; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + void glGetProgramiv(GLuint program, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int]]"/); +%MethodCode + GLint params[3]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_COMPUTE_LOCAL_WORK_SIZE) + case GL_COMPUTE_LOCAL_WORK_SIZE: + nr_params = 3; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetProgramiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + GLint glGetAttribLocation(GLuint program, const GLchar *name); + SIP_PYOBJECT glGetAttachedShaders(GLuint program) /TypeHint="Tuple[int, ...]"/; +%MethodCode + GLint nr_shaders; + + sipCpp->glGetProgramiv(a0, GL_ATTACHED_SHADERS, &nr_shaders); + + if (nr_shaders < 1) + { + sipRes = PyTuple_New(0); + } + else + { + GLuint *shaders = new GLuint[nr_shaders]; + + sipCpp->glGetAttachedShaders(a0, nr_shaders, 0, shaders); + + sipRes = PyTuple_New(nr_shaders); + + if (sipRes) + { + for (GLint i = 0; i < nr_shaders; ++i) + { + PyObject *itm = PyLong_FromLong(shaders[i]); + + if (!itm) + { + Py_DECREF(sipRes); + sipRes = 0; + break; + } + + PyTuple_SetItem(sipRes, i, itm); + } + } + + delete[] shaders; + } + + if (!sipRes) + sipIsErr = 1; +%End + + SIP_PYOBJECT glGetActiveUniform(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufsize); + + GLchar *name = new GLchar[bufsize]; + GLint size; + GLenum type; + + sipCpp->glGetActiveUniform(a0, a1, bufsize, 0, &size, &type, name); + + sipRes = Py_BuildValue("siI", name, size, type); + + if (!sipRes) + sipIsErr = 1; + + delete[] name; +%End + + SIP_PYOBJECT glGetActiveAttrib(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &bufsize); + + GLchar *name = new GLchar[bufsize]; + GLint size; + GLenum type; + + sipCpp->glGetActiveAttrib(a0, a1, bufsize, 0, &size, &type, name); + + sipRes = Py_BuildValue("siI", name, size, type); + + if (!sipRes) + sipIsErr = 1; + + delete[] name; +%End + + void glEnableVertexAttribArray(GLuint index); + void glDisableVertexAttribArray(GLuint index); + void glDetachShader(GLuint program, GLuint shader); + void glDeleteShader(GLuint shader); + void glDeleteProgram(GLuint program); + GLuint glCreateShader(GLenum type); + GLuint glCreateProgram(); + void glCompileShader(GLuint shader); + void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name); + void glAttachShader(GLuint program, GLuint shader); + void glStencilMaskSeparate(GLenum face, GLuint mask); + void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); + void glDrawBuffers(GLsizei n, SIP_PYOBJECT bufs /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawBuffers(a0, reinterpret_cast(array)); +%End + + void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + void glTranslatef(GLfloat x, GLfloat y, GLfloat z); + void glTranslated(GLdouble x, GLdouble y, GLdouble z); + void glScalef(GLfloat x, GLfloat y, GLfloat z); + void glScaled(GLdouble x, GLdouble y, GLdouble z); + void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); + void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); + void glPushMatrix(); + void glPopMatrix(); + void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); + void glMultMatrixd(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultMatrixd(reinterpret_cast(array)); +%End + + void glMultMatrixf(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultMatrixf(reinterpret_cast(array)); +%End + + void glMatrixMode(GLenum mode); + void glLoadMatrixd(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLoadMatrixd(reinterpret_cast(array)); +%End + + void glLoadMatrixf(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLoadMatrixf(reinterpret_cast(array)); +%End + + void glLoadIdentity(); + void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); + GLboolean glIsList(GLuint list); + void glGetTexGeniv(GLenum coord, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_OBJECT_PLANE: + case GL_EYE_PLANE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexGeniv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetTexGenfv(GLenum coord, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_OBJECT_PLANE: + case GL_EYE_PLANE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexGenfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetTexGendv(GLenum coord, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLdouble params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_OBJECT_PLANE: + case GL_EYE_PLANE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexGendv(a0, a1, params); + + a2 = qpyopengl_from_GLdouble(&sipIsErr, params, nr_params); +%End + + void glGetTexEnviv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_TEXTURE_ENV_COLOR: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexEnviv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetTexEnvfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_TEXTURE_ENV_COLOR: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexEnvfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetMaterialiv(GLenum face, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int], Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_SHININESS: + nr_params = 1; + break; + + case GL_COLOR_INDEXES: + nr_params = 3; + break; + + default: + nr_params = 4; + } + + sipCpp->glGetMaterialiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetMaterialfv(GLenum face, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float], Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_SHININESS: + nr_params = 1; + break; + + case GL_COLOR_INDEXES: + nr_params = 3; + break; + + default: + nr_params = 4; + } + + sipCpp->glGetMaterialfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetLightiv(GLenum light, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int], Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_POSITION: + nr_params = 4; + break; + + case GL_SPOT_DIRECTION: + nr_params = 3; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetLightiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetLightfv(GLenum light, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float], Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_POSITION: + nr_params = 4; + break; + + case GL_SPOT_DIRECTION: + nr_params = 3; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetLightfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetClipPlane(GLenum plane, SIP_PYOBJECT *equation /TypeHint="Tuple[float, float, float, float]"/); +%MethodCode + GLdouble params[4]; + + sipCpp->glGetClipPlane(a0, params); + + a1 = qpyopengl_from_GLdouble(&sipIsErr, params, 4); +%End + + void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a4, a3, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawPixels(a0, a1, a2, a3, array); +%End + + void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); + void glPixelMapusv(GLenum map, GLint mapsize, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPixelMapusv(a0, a1, reinterpret_cast(array)); +%End + + void glPixelMapuiv(GLenum map, GLint mapsize, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPixelMapuiv(a0, a1, reinterpret_cast(array)); +%End + + void glPixelMapfv(GLenum map, GLint mapsize, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPixelMapfv(a0, a1, reinterpret_cast(array)); +%End + + void glPixelTransferi(GLenum pname, GLint param); + void glPixelTransferf(GLenum pname, GLfloat param); + void glPixelZoom(GLfloat xfactor, GLfloat yfactor); + void glAlphaFunc(GLenum func, GLfloat ref); + void glEvalPoint2(GLint i, GLint j); + void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); + void glEvalPoint1(GLint i); + void glEvalMesh1(GLenum mode, GLint i1, GLint i2); + void glEvalCoord2fv(SIP_PYOBJECT u /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEvalCoord2fv(reinterpret_cast(array)); +%End + + void glEvalCoord2f(GLfloat u, GLfloat v); + void glEvalCoord2dv(SIP_PYOBJECT u /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEvalCoord2dv(reinterpret_cast(array)); +%End + + void glEvalCoord2d(GLdouble u, GLdouble v); + void glEvalCoord1fv(SIP_PYOBJECT u /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEvalCoord1fv(reinterpret_cast(array)); +%End + + void glEvalCoord1f(GLfloat u); + void glEvalCoord1dv(SIP_PYOBJECT u /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEvalCoord1dv(reinterpret_cast(array)); +%End + + void glEvalCoord1d(GLdouble u); + void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); + void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); + void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2); + void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2); + void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, SIP_PYOBJECT points /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a9, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMap2f(a0, a1, a2, a3, a4, a5, a6, a7, a8, + reinterpret_cast(array)); +%End + + void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, SIP_PYOBJECT points /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a9, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMap2d(a0, a1, a2, a3, a4, a5, a6, a7, a8, + reinterpret_cast(array)); +%End + + void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, SIP_PYOBJECT points /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMap1f(a0, a1, a2, a3, a4, + reinterpret_cast(array)); +%End + + void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, SIP_PYOBJECT points /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMap1d(a0, a1, a2, a3, a4, + reinterpret_cast(array)); +%End + + void glPushAttrib(GLbitfield mask); + void glPopAttrib(); + void glAccum(GLenum op, GLfloat value); + void glIndexMask(GLuint mask); + void glClearIndex(GLfloat c); + void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glPushName(GLuint name); + void glPopName(); + void glPassThrough(GLfloat token); + void glLoadName(GLuint name); + void glInitNames(); + GLint glRenderMode(GLenum mode); + void glTexGeniv(GLenum coord, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexGeniv(a0, a1, reinterpret_cast(array)); +%End + + void glTexGeni(GLenum coord, GLenum pname, GLint param); + void glTexGenfv(GLenum coord, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexGenfv(a0, a1, reinterpret_cast(array)); +%End + + void glTexGenf(GLenum coord, GLenum pname, GLfloat param); + void glTexGendv(GLenum coord, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexGendv(a0, a1, reinterpret_cast(array)); +%End + + void glTexGend(GLenum coord, GLenum pname, GLdouble param); + void glTexEnviv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexEnviv(a0, a1, reinterpret_cast(array)); +%End + + void glTexEnvi(GLenum target, GLenum pname, GLint param); + void glTexEnvfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexEnvfv(a0, a1, reinterpret_cast(array)); +%End + + void glTexEnvf(GLenum target, GLenum pname, GLfloat param); + void glShadeModel(GLenum mode); + void glPolygonStipple(SIP_PYOBJECT mask /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPolygonStipple(reinterpret_cast(array)); +%End + + void glMaterialiv(GLenum face, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMaterialiv(a0, a1, reinterpret_cast(array)); +%End + + void glMateriali(GLenum face, GLenum pname, GLint param); + void glMaterialfv(GLenum face, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMaterialfv(a0, a1, reinterpret_cast(array)); +%End + + void glMaterialf(GLenum face, GLenum pname, GLfloat param); + void glLineStipple(GLint factor, GLushort pattern); + void glLightModeliv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLightModeliv(a0, reinterpret_cast(array)); +%End + + void glLightModeli(GLenum pname, GLint param); + void glLightModelfv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLightModelfv(a0, reinterpret_cast(array)); +%End + + void glLightModelf(GLenum pname, GLfloat param); + void glLightiv(GLenum light, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLightiv(a0, a1, reinterpret_cast(array)); +%End + + void glLighti(GLenum light, GLenum pname, GLint param); + void glLightfv(GLenum light, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLightfv(a0, a1, reinterpret_cast(array)); +%End + + void glLightf(GLenum light, GLenum pname, GLfloat param); + void glFogiv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogiv(a0, reinterpret_cast(array)); +%End + + void glFogi(GLenum pname, GLint param); + void glFogfv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogfv(a0, reinterpret_cast(array)); +%End + + void glFogf(GLenum pname, GLfloat param); + void glColorMaterial(GLenum face, GLenum mode); + void glClipPlane(GLenum plane, SIP_PYOBJECT equation /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glClipPlane(a0, reinterpret_cast(array)); +%End + + void glVertex4sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex4sv(reinterpret_cast(array)); +%End + + void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w); + void glVertex4iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex4iv(reinterpret_cast(array)); +%End + + void glVertex4i(GLint x, GLint y, GLint z, GLint w); + void glVertex4fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex4fv(reinterpret_cast(array)); +%End + + void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glVertex4dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex4dv(reinterpret_cast(array)); +%End + + void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void glVertex3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex3sv(reinterpret_cast(array)); +%End + + void glVertex3s(GLshort x, GLshort y, GLshort z); + void glVertex3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex3iv(reinterpret_cast(array)); +%End + + void glVertex3i(GLint x, GLint y, GLint z); + void glVertex3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex3fv(reinterpret_cast(array)); +%End + + void glVertex3f(GLfloat x, GLfloat y, GLfloat z); + void glVertex3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex3dv(reinterpret_cast(array)); +%End + + void glVertex3d(GLdouble x, GLdouble y, GLdouble z); + void glVertex2sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex2sv(reinterpret_cast(array)); +%End + + void glVertex2s(GLshort x, GLshort y); + void glVertex2iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex2iv(reinterpret_cast(array)); +%End + + void glVertex2i(GLint x, GLint y); + void glVertex2fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex2fv(reinterpret_cast(array)); +%End + + void glVertex2f(GLfloat x, GLfloat y); + void glVertex2dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex2dv(reinterpret_cast(array)); +%End + + void glVertex2d(GLdouble x, GLdouble y); + void glTexCoord4sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord4sv(reinterpret_cast(array)); +%End + + void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q); + void glTexCoord4iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord4iv(reinterpret_cast(array)); +%End + + void glTexCoord4i(GLint s, GLint t, GLint r, GLint q); + void glTexCoord4fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord4fv(reinterpret_cast(array)); +%End + + void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q); + void glTexCoord4dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord4dv(reinterpret_cast(array)); +%End + + void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q); + void glTexCoord3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord3sv(reinterpret_cast(array)); +%End + + void glTexCoord3s(GLshort s, GLshort t, GLshort r); + void glTexCoord3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord3iv(reinterpret_cast(array)); +%End + + void glTexCoord3i(GLint s, GLint t, GLint r); + void glTexCoord3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord3fv(reinterpret_cast(array)); +%End + + void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r); + void glTexCoord3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord3dv(reinterpret_cast(array)); +%End + + void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r); + void glTexCoord2sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord2sv(reinterpret_cast(array)); +%End + + void glTexCoord2s(GLshort s, GLshort t); + void glTexCoord2iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord2iv(reinterpret_cast(array)); +%End + + void glTexCoord2i(GLint s, GLint t); + void glTexCoord2fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord2fv(reinterpret_cast(array)); +%End + + void glTexCoord2f(GLfloat s, GLfloat t); + void glTexCoord2dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord2dv(reinterpret_cast(array)); +%End + + void glTexCoord2d(GLdouble s, GLdouble t); + void glTexCoord1sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord1sv(reinterpret_cast(array)); +%End + + void glTexCoord1s(GLshort s); + void glTexCoord1iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord1iv(reinterpret_cast(array)); +%End + + void glTexCoord1i(GLint s); + void glTexCoord1fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord1fv(reinterpret_cast(array)); +%End + + void glTexCoord1f(GLfloat s); + void glTexCoord1dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord1dv(reinterpret_cast(array)); +%End + + void glTexCoord1d(GLdouble s); + void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2); + void glRecti(GLint x1, GLint y1, GLint x2, GLint y2); + void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); + void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); + void glRasterPos4sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos4sv(reinterpret_cast(array)); +%End + + void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w); + void glRasterPos4iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos4iv(reinterpret_cast(array)); +%End + + void glRasterPos4i(GLint x, GLint y, GLint z, GLint w); + void glRasterPos4fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos4fv(reinterpret_cast(array)); +%End + + void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glRasterPos4dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos4dv(reinterpret_cast(array)); +%End + + void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void glRasterPos3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos3sv(reinterpret_cast(array)); +%End + + void glRasterPos3s(GLshort x, GLshort y, GLshort z); + void glRasterPos3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos3iv(reinterpret_cast(array)); +%End + + void glRasterPos3i(GLint x, GLint y, GLint z); + void glRasterPos3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos3fv(reinterpret_cast(array)); +%End + + void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z); + void glRasterPos3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos3dv(reinterpret_cast(array)); +%End + + void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z); + void glRasterPos2sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos2sv(reinterpret_cast(array)); +%End + + void glRasterPos2s(GLshort x, GLshort y); + void glRasterPos2iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos2iv(reinterpret_cast(array)); +%End + + void glRasterPos2i(GLint x, GLint y); + void glRasterPos2fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos2fv(reinterpret_cast(array)); +%End + + void glRasterPos2f(GLfloat x, GLfloat y); + void glRasterPos2dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos2dv(reinterpret_cast(array)); +%End + + void glRasterPos2d(GLdouble x, GLdouble y); + void glNormal3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3sv(reinterpret_cast(array)); +%End + + void glNormal3s(GLshort nx, GLshort ny, GLshort nz); + void glNormal3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3iv(reinterpret_cast(array)); +%End + + void glNormal3i(GLint nx, GLint ny, GLint nz); + void glNormal3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3fv(reinterpret_cast(array)); +%End + + void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); + void glNormal3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3dv(reinterpret_cast(array)); +%End + + void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz); + void glNormal3bv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3bv(reinterpret_cast(array)); +%End + + void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz); + void glIndexsv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexsv(reinterpret_cast(array)); +%End + + void glIndexs(GLshort c); + void glIndexiv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexiv(reinterpret_cast(array)); +%End + + void glIndexi(GLint c); + void glIndexfv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexfv(reinterpret_cast(array)); +%End + + void glIndexf(GLfloat c); + void glIndexdv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexdv(reinterpret_cast(array)); +%End + + void glIndexd(GLdouble c); + void glEnd(); + void glEdgeFlagv(SIP_PYOBJECT flag /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEdgeFlagv(reinterpret_cast(array)); +%End + + void glEdgeFlag(GLboolean flag); + void glColor4usv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4usv(reinterpret_cast(array)); +%End + + void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha); + void glColor4uiv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4uiv(reinterpret_cast(array)); +%End + + void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha); + void glColor4ubv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4ubv(reinterpret_cast(array)); +%End + + void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); + void glColor4sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4sv(reinterpret_cast(array)); +%End + + void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha); + void glColor4iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4iv(reinterpret_cast(array)); +%End + + void glColor4i(GLint red, GLint green, GLint blue, GLint alpha); + void glColor4fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4fv(reinterpret_cast(array)); +%End + + void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glColor4dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4dv(reinterpret_cast(array)); +%End + + void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); + void glColor4bv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4bv(reinterpret_cast(array)); +%End + + void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); + void glColor3usv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3usv(reinterpret_cast(array)); +%End + + void glColor3us(GLushort red, GLushort green, GLushort blue); + void glColor3uiv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3uiv(reinterpret_cast(array)); +%End + + void glColor3ui(GLuint red, GLuint green, GLuint blue); + void glColor3ubv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3ubv(reinterpret_cast(array)); +%End + + void glColor3ub(GLubyte red, GLubyte green, GLubyte blue); + void glColor3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3sv(reinterpret_cast(array)); +%End + + void glColor3s(GLshort red, GLshort green, GLshort blue); + void glColor3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3iv(reinterpret_cast(array)); +%End + + void glColor3i(GLint red, GLint green, GLint blue); + void glColor3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3fv(reinterpret_cast(array)); +%End + + void glColor3f(GLfloat red, GLfloat green, GLfloat blue); + void glColor3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3dv(reinterpret_cast(array)); +%End + + void glColor3d(GLdouble red, GLdouble green, GLdouble blue); + void glColor3bv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3bv(reinterpret_cast(array)); +%End + + void glColor3b(GLbyte red, GLbyte green, GLbyte blue); + void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, SIP_PYOBJECT bitmap /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBitmap(a0, a1, a2, a3, a4, a5, + reinterpret_cast(array)); +%End + + void glBegin(GLenum mode); + void glListBase(GLuint base); + GLuint glGenLists(GLsizei range); + void glDeleteLists(GLuint list, GLsizei range); + void glCallList(GLuint list); + void glEndList(); + void glNewList(GLuint list, GLenum mode); + void glPushClientAttrib(GLbitfield mask); + void glPopClientAttrib(); + void glVertexPointer(GLint size, GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a3, a1, sipSelf, + "VertexPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glVertexPointer(a0, a1, a2, array); +%End + + void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a3, a1, sipSelf, + "TexCoordPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glTexCoordPointer(a0, a1, a2, array); +%End + + void glNormalPointer(GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a2, a0, sipSelf, + "NormalPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glNormalPointer(a0, a1, array); +%End + + void glIndexPointer(GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a2, a0, sipSelf, + "IndexPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glIndexPointer(a0, a1, array); +%End + + void glEnableClientState(GLenum array); + void glEdgeFlagPointer(GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a1, + GL_UNSIGNED_BYTE, sipSelf, "EdgeFlagPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glEdgeFlagPointer(a0, array); +%End + + void glDisableClientState(GLenum array); + void glColorPointer(GLint size, GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a3, a1, sipSelf, + "ColorPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glColorPointer(a0, a1, a2, array); +%End + + void glArrayElement(GLint i); + void glResetMinmax(GLenum target); + void glResetHistogram(GLenum target); + void glMinmax(GLenum target, GLenum internalformat, GLboolean sink); + void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); + void glGetConvolutionParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetConvolutionParameteriv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetConvolutionParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetConvolutionParameterfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); + void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); + void glConvolutionParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glConvolutionParameteriv(a0, a1, + reinterpret_cast(array)); +%End + + void glConvolutionParameteri(GLenum target, GLenum pname, GLint params); + void glConvolutionParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glConvolutionParameterfv(a0, a1, + reinterpret_cast(array)); +%End + + void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); + void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT image /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, a5, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glConvolutionFilter2D(a0, a1, a2, a3, a4, a5, array); +%End + + void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, SIP_PYOBJECT image /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, a4, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glConvolutionFilter1D(a0, a1, a2, a3, a4, array); +%End + + void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); + void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, a4, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColorSubTable(a0, a1, a2, a3, a4, array); +%End + + void glGetColorTableParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_COLOR_TABLE: + case GL_POST_CONVOLUTION_COLOR_TABLE: + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetColorTableParameteriv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetColorTableParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_COLOR_TABLE: + case GL_POST_CONVOLUTION_COLOR_TABLE: + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetColorTableParameterfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); + void glColorTableParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColorTableParameteriv(a0, a1, + reinterpret_cast(array)); +%End + + void glColorTableParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColorTableParameterfv(a0, a1, + reinterpret_cast(array)); +%End + + void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, SIP_PYOBJECT table /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, a4, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColorTable(a0, a1, a2, a3, a4, array); +%End + + void glMultTransposeMatrixd(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultTransposeMatrixd(reinterpret_cast(array)); +%End + + void glMultTransposeMatrixf(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultTransposeMatrixf(reinterpret_cast(array)); +%End + + void glLoadTransposeMatrixd(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLoadTransposeMatrixd(reinterpret_cast(array)); +%End + + void glLoadTransposeMatrixf(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLoadTransposeMatrixf(reinterpret_cast(array)); +%End + + void glMultiTexCoord4sv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord4sv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); + void glMultiTexCoord4iv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord4iv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q); + void glMultiTexCoord4fv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord4fv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); + void glMultiTexCoord4dv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord4dv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); + void glMultiTexCoord3sv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord3sv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r); + void glMultiTexCoord3iv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord3iv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r); + void glMultiTexCoord3fv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord3fv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r); + void glMultiTexCoord3dv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord3dv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r); + void glMultiTexCoord2sv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord2sv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t); + void glMultiTexCoord2iv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord2iv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord2i(GLenum target, GLint s, GLint t); + void glMultiTexCoord2fv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord2fv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t); + void glMultiTexCoord2dv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord2dv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t); + void glMultiTexCoord1sv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord1sv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord1s(GLenum target, GLshort s); + void glMultiTexCoord1iv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord1iv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord1i(GLenum target, GLint s); + void glMultiTexCoord1fv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord1fv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord1f(GLenum target, GLfloat s); + void glMultiTexCoord1dv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord1dv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord1d(GLenum target, GLdouble s); + void glClientActiveTexture(GLenum texture); + void glWindowPos3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos3sv(reinterpret_cast(array)); +%End + + void glWindowPos3s(GLshort x, GLshort y, GLshort z); + void glWindowPos3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos3iv(reinterpret_cast(array)); +%End + + void glWindowPos3i(GLint x, GLint y, GLint z); + void glWindowPos3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos3fv(reinterpret_cast(array)); +%End + + void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z); + void glWindowPos3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos3dv(reinterpret_cast(array)); +%End + + void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z); + void glWindowPos2sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos2sv(reinterpret_cast(array)); +%End + + void glWindowPos2s(GLshort x, GLshort y); + void glWindowPos2iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos2iv(reinterpret_cast(array)); +%End + + void glWindowPos2i(GLint x, GLint y); + void glWindowPos2fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos2fv(reinterpret_cast(array)); +%End + + void glWindowPos2f(GLfloat x, GLfloat y); + void glWindowPos2dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos2dv(reinterpret_cast(array)); +%End + + void glWindowPos2d(GLdouble x, GLdouble y); + void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, a1, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColorPointer(a0, a1, a2, array); +%End + + void glSecondaryColor3usv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3usv(reinterpret_cast(array)); +%End + + void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue); + void glSecondaryColor3uiv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3uiv(reinterpret_cast(array)); +%End + + void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue); + void glSecondaryColor3ubv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3ubv(reinterpret_cast(array)); +%End + + void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue); + void glSecondaryColor3sv(SIP_PYBUFFER v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3sv(reinterpret_cast(array)); +%End + + void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue); + void glSecondaryColor3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3iv(reinterpret_cast(array)); +%End + + void glSecondaryColor3i(GLint red, GLint green, GLint blue); + void glSecondaryColor3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3fv(reinterpret_cast(array)); +%End + + void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue); + void glSecondaryColor3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3dv(reinterpret_cast(array)); +%End + + void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue); + void glSecondaryColor3bv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3bv(reinterpret_cast(array)); +%End + + void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue); + void glFogCoordPointer(GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, a0, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogCoordPointer(a0, a1, array); +%End + + void glFogCoorddv(SIP_PYOBJECT coord /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogCoorddv(reinterpret_cast(array)); +%End + + void glFogCoordd(GLdouble coord); + void glFogCoordfv(SIP_PYOBJECT coord /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogCoordfv(reinterpret_cast(array)); +%End + + void glFogCoordf(GLfloat coord); + void glVertexAttrib4usv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4usv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4uiv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4uiv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4ubv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4ubv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4sv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4sv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); + void glVertexAttrib4iv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4iv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4fv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glVertexAttrib4dv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4dv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void glVertexAttrib4bv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4bv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nusv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nusv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nuiv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nuiv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nubv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nubv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); + void glVertexAttrib4Nsv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nsv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Niv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Niv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nbv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nbv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib3sv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib3sv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z); + void glVertexAttrib3fv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib3fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); + void glVertexAttrib3dv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib3dv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z); + void glVertexAttrib2sv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib2sv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib2s(GLuint index, GLshort x, GLshort y); + void glVertexAttrib2fv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib2fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y); + void glVertexAttrib2dv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib2dv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y); + void glVertexAttrib1sv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib1sv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib1s(GLuint index, GLshort x); + void glVertexAttrib1fv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib1fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib1f(GLuint index, GLfloat x); + void glVertexAttrib1dv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib1dv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib1d(GLuint index, GLdouble x); +}; + +%End diff --git a/sip/QtOpenGL/qopenglfunctions_2_1.sip b/sip/QtOpenGL/qopenglfunctions_2_1.sip new file mode 100644 index 0000000..706a635 --- /dev/null +++ b/sip/QtOpenGL/qopenglfunctions_2_1.sip @@ -0,0 +1,2920 @@ +// qopenglfunctions_2_1.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (!PyQt_OpenGL_ES2) + +class QOpenGLFunctions_2_1 : QAbstractOpenGLFunctions +{ +%TypeHeaderCode +#include +%End + +public: + QOpenGLFunctions_2_1(); + virtual ~QOpenGLFunctions_2_1(); + virtual bool initializeOpenGLFunctions(); + void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); + void glDepthRange(GLdouble nearVal, GLdouble farVal); + GLboolean glIsEnabled(GLenum cap); + void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, SIP_PYOBJECT *params /TypeHint="int"/); +%MethodCode + GLint params[1]; + + sipCpp->glGetTexLevelParameteriv(a0, a1, a2, params); + + a3 = qpyopengl_from_GLint(&sipIsErr, params, 1); +%End + + void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, SIP_PYOBJECT *params /TypeHint="float"/); +%MethodCode + GLfloat params[1]; + + sipCpp->glGetTexLevelParameterfv(a0, a1, a2, params); + + a3 = qpyopengl_from_GLfloat(&sipIsErr, params, 1); +%End + + void glGetTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR) + #if defined(GL_TEXTURE_SWIZZLE_RGBA) + case GL_TEXTURE_SWIZZLE_RGBA: + #endif + #if defined(GL_TEXTURE_BORDER_COLOR) + case GL_TEXTURE_BORDER_COLOR: + #endif + nr_params = 4; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetTexParameteriv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR) + #if defined(GL_TEXTURE_SWIZZLE_RGBA) + case GL_TEXTURE_SWIZZLE_RGBA: + #endif + #if defined(GL_TEXTURE_BORDER_COLOR) + case GL_TEXTURE_BORDER_COLOR: + #endif + nr_params = 4; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetTexParameterfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + const char *glGetString(GLenum name); +%MethodCode + sipRes = reinterpret_cast(sipCpp->glGetString(a0)); +%End + + void glGetIntegerv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLint fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLint[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetIntegerv(a0, params); + a1 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + void glGetFloatv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, ...]]"/); +%MethodCode + GLfloat fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLfloat[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetFloatv(a0, params); + a1 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + GLenum glGetError(); + void glGetDoublev(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, ...]]"/); +%MethodCode + GLdouble fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLdouble[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetDoublev(a0, params); + a1 = qpyopengl_from_GLdouble(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + void glGetBooleanv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[bool, Tuple[bool, ...]]"/); +%MethodCode + GLboolean fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLboolean[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetBooleanv(a0, params); + a1 = qpyopengl_from_GLboolean(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + SIP_PYOBJECT glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type) /TypeHint="Union[Tuple[float, ...], Tuple[int, ...]]"/; +%MethodCode + int components; + + switch (a4) + { + case GL_BGR: + case GL_RGB: + { + components = 3; + break; + } + + case GL_BGRA: + case GL_RGBA: + { + components = 4; + break; + } + + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_DEPTH_COMPONENT: + case GL_STENCIL_INDEX: + case GL_DEPTH_STENCIL: + { + components = 1; + break; + } + + default: + components = 0; + } + + Py_ssize_t length = components * a2 * a3; + + switch (a5) + { + case GL_FLOAT: + { + GLfloat *data = new GLfloat[length]; + + sipCpp->glReadPixels(a0, a1, a2, a3, a4, a5, data); + sipRes = qpyopengl_from_GLfloat(&sipIsErr, data, length); + delete [] data; + + break; + } + + case GL_INT: + { + GLint *data = new GLint[length]; + + sipCpp->glReadPixels(a0, a1, a2, a3, a4, a5, data); + sipRes = qpyopengl_from_GLint(&sipIsErr, data, length); + delete [] data; + + break; + } + + case GL_UNSIGNED_INT: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + case GL_UNSIGNED_INT_24_8: + case GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL_UNSIGNED_INT_5_9_9_9_REV: + { + GLuint *data = new GLuint[length]; + + sipCpp->glReadPixels(a0, a1, a2, a3, a4, a5, data); + sipRes = qpyopengl_from_GLuint(&sipIsErr, data, length); + delete [] data; + + break; + } + + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_HALF_FLOAT: + case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + default: + sipIsErr = 1; + PyErr_SetString(PyExc_ValueError, "pixel data format not supported"); + } +%End + + void glReadBuffer(GLenum mode); + void glPixelStorei(GLenum pname, GLint param); + void glPixelStoref(GLenum pname, GLfloat param); + void glDepthFunc(GLenum func); + void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); + void glStencilFunc(GLenum func, GLint ref, GLuint mask); + void glLogicOp(GLenum opcode); + void glBlendFunc(GLenum sfactor, GLenum dfactor); + void glFlush(); + void glFinish(); + void glEnable(GLenum cap); + void glDisable(GLenum cap); + void glDepthMask(GLboolean flag); + void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void glStencilMask(GLuint mask); + void glClearDepth(GLdouble depth); + void glClearStencil(GLint s); + void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glClear(GLbitfield mask); + void glDrawBuffer(GLenum mode); + void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a7, a6, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage1D(a0, a1, a2, a3, a4, a5, a6, array); +%End + + void glTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexParameteriv(a0, a1, reinterpret_cast(array)); +%End + + void glTexParameteri(GLenum target, GLenum pname, GLint param); + void glTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexParameterfv(a0, a1, reinterpret_cast(array)); +%End + + void glTexParameterf(GLenum target, GLenum pname, GLfloat param); + void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); + void glPolygonMode(GLenum face, GLenum mode); + void glPointSize(GLfloat size); + void glLineWidth(GLfloat width); + void glHint(GLenum target, GLenum mode); + void glFrontFace(GLenum mode); + void glCullFace(GLenum mode); + void glIndexubv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexubv(reinterpret_cast(array)); +%End + + void glIndexub(GLubyte c); + GLboolean glIsTexture(GLuint texture); + void glGenTextures(GLsizei n, SIP_PYOBJECT *textures /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenTextures(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glDeleteTextures(GLsizei n, SIP_PYOBJECT textures /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteTextures(a0, reinterpret_cast(array)); +%End + + void glBindTexture(GLenum target, GLuint texture); + void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, a5, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage1D(a0, a1, a2, a3, a4, a5, array); +%End + + void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); + void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); + void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); + void glPolygonOffset(GLfloat factor, GLfloat units); + void glDrawElements(GLenum mode, GLsizei count, GLenum type, SIP_PYOBJECT indices /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, a2, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawElements(a0, a1, a2, array); +%End + + void glDrawArrays(GLenum mode, GLint first, GLsizei count); + void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a10, a9, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage3D(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, array); +%End + + void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a9, a8, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage3D(a0, a1, a2, a3, a4, a5, a6, a7, a8, array); +%End + + void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, SIP_PYOBJECT indices /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, a4, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawRangeElements(a0, a1, a2, a3, a4, array); +%End + + void glBlendEquation(GLenum mode); + void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage1D(a0, a1, a2, a3, a4, a5, array); +%End + + void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a10, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage3D(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + array); +%End + + void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage1D(a0, a1, a2, a3, a4, a5, array); +%End + + void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a7, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage2D(a0, a1, a2, a3, a4, a5, a6, array); +%End + + void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage3D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glSampleCoverage(GLfloat value, GLboolean invert); + void glActiveTexture(GLenum texture); + void glPointParameteriv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPointParameteriv(a0, reinterpret_cast(array)); +%End + + void glPointParameteri(GLenum pname, GLint param); + void glPointParameterfv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPointParameterfv(a0, reinterpret_cast(array)); +%End + + void glPointParameterf(GLenum pname, GLfloat param); + void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); + void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params); + GLboolean glUnmapBuffer(GLenum target); + void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array; + + if (a3 == Py_None) + array = 0; + else + array = qpyopengl_value_array(&sipError, a3, GL_UNSIGNED_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBufferSubData(a0, a1, a2, array); +%End + + void glBufferData(GLenum target, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/, GLenum usage); +%MethodCode + const GLvoid *array; + + if (a2 == Py_None) + array = 0; + else + array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBufferData(a0, a1, array, a3); +%End + + GLboolean glIsBuffer(GLuint buffer); + void glGenBuffers(GLsizei n, SIP_PYOBJECT *buffers /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenBuffers(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glDeleteBuffers(GLsizei n, SIP_PYOBJECT buffers /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteBuffers(a0, reinterpret_cast(array)); +%End + + void glBindBuffer(GLenum target, GLuint buffer); + void glGetQueryiv(GLenum target, GLenum pname, GLint *params); + void glEndQuery(GLenum target); + void glBeginQuery(GLenum target, GLuint id); + GLboolean glIsQuery(GLuint id); + void glDeleteQueries(GLsizei n, SIP_PYOBJECT ids /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteQueries(a0, reinterpret_cast(array)); +%End + + void glGenQueries(GLsizei n, SIP_PYOBJECT *ids /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenQueries(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a5, a2, sipSelf, + "VertexAttribPointer", a0); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttribPointer(a0, a1, a2, a3, a4, array); +%End + + void glValidateProgram(GLuint program); + void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix4fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix3fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix2fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniform4iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform4iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform3iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform3iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform2iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform2iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform1iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform1iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform4fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform4fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform3fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform3fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform2fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform2fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform1fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform1fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); + void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2); + void glUniform2i(GLint location, GLint v0, GLint v1); + void glUniform1i(GLint location, GLint v0); + void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); + void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); + void glUniform2f(GLint location, GLfloat v0, GLfloat v1); + void glUniform1f(GLint location, GLfloat v0); + void glUseProgram(GLuint program); + void glLinkProgram(GLuint program); + GLboolean glIsShader(GLuint shader); + GLboolean glIsProgram(GLuint program); + void glGetVertexAttribiv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetVertexAttribfv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetVertexAttribdv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLdouble params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribdv(a0, a1, params); + + a2 = qpyopengl_from_GLdouble(&sipIsErr, params, nr_params); +%End + + GLint glGetUniformLocation(GLuint program, const GLchar *name); + SIP_PYOBJECT glGetShaderSource(GLuint shader) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetShaderiv(a0, GL_SHADER_SOURCE_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *source = new GLchar[bufsize]; + + sipCpp->glGetShaderSource(a0, bufsize, 0, source); + sipRes = PyBytes_FromString(source); + + delete[] source; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + SIP_PYOBJECT glGetShaderInfoLog(GLuint shader) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetShaderiv(a0, GL_INFO_LOG_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *log = new GLchar[bufsize]; + + sipCpp->glGetShaderInfoLog(a0, bufsize, 0, log); + sipRes = PyBytes_FromString(log); + + delete[] log; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + void glGetShaderiv(GLuint shader, GLenum pname, GLint *params); + SIP_PYOBJECT glGetProgramInfoLog(GLuint program) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_INFO_LOG_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *log = new GLchar[bufsize]; + + sipCpp->glGetProgramInfoLog(a0, bufsize, 0, log); + sipRes = PyBytes_FromString(log); + + delete[] log; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + void glGetProgramiv(GLuint program, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int]]"/); +%MethodCode + GLint params[3]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_COMPUTE_LOCAL_WORK_SIZE) + case GL_COMPUTE_LOCAL_WORK_SIZE: + nr_params = 3; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetProgramiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + GLint glGetAttribLocation(GLuint program, const GLchar *name); + SIP_PYOBJECT glGetAttachedShaders(GLuint program) /TypeHint="Tuple[int, ...]"/; +%MethodCode + GLint nr_shaders; + + sipCpp->glGetProgramiv(a0, GL_ATTACHED_SHADERS, &nr_shaders); + + if (nr_shaders < 1) + { + sipRes = PyTuple_New(0); + } + else + { + GLuint *shaders = new GLuint[nr_shaders]; + + sipCpp->glGetAttachedShaders(a0, nr_shaders, 0, shaders); + + sipRes = PyTuple_New(nr_shaders); + + if (sipRes) + { + for (GLint i = 0; i < nr_shaders; ++i) + { + PyObject *itm = PyLong_FromLong(shaders[i]); + + if (!itm) + { + Py_DECREF(sipRes); + sipRes = 0; + break; + } + + PyTuple_SetItem(sipRes, i, itm); + } + } + + delete[] shaders; + } + + if (!sipRes) + sipIsErr = 1; +%End + + SIP_PYOBJECT glGetActiveUniform(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufsize); + + GLchar *name = new GLchar[bufsize]; + GLint size; + GLenum type; + + sipCpp->glGetActiveUniform(a0, a1, bufsize, 0, &size, &type, name); + + sipRes = Py_BuildValue("siI", name, size, type); + + if (!sipRes) + sipIsErr = 1; + + delete[] name; +%End + + SIP_PYOBJECT glGetActiveAttrib(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &bufsize); + + GLchar *name = new GLchar[bufsize]; + GLint size; + GLenum type; + + sipCpp->glGetActiveAttrib(a0, a1, bufsize, 0, &size, &type, name); + + sipRes = Py_BuildValue("siI", name, size, type); + + if (!sipRes) + sipIsErr = 1; + + delete[] name; +%End + + void glEnableVertexAttribArray(GLuint index); + void glDisableVertexAttribArray(GLuint index); + void glDetachShader(GLuint program, GLuint shader); + void glDeleteShader(GLuint shader); + void glDeleteProgram(GLuint program); + GLuint glCreateShader(GLenum type); + GLuint glCreateProgram(); + void glCompileShader(GLuint shader); + void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name); + void glAttachShader(GLuint program, GLuint shader); + void glStencilMaskSeparate(GLenum face, GLuint mask); + void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); + void glDrawBuffers(GLsizei n, SIP_PYOBJECT bufs /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawBuffers(a0, reinterpret_cast(array)); +%End + + void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + void glTranslatef(GLfloat x, GLfloat y, GLfloat z); + void glTranslated(GLdouble x, GLdouble y, GLdouble z); + void glScalef(GLfloat x, GLfloat y, GLfloat z); + void glScaled(GLdouble x, GLdouble y, GLdouble z); + void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); + void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); + void glPushMatrix(); + void glPopMatrix(); + void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); + void glMultMatrixd(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultMatrixd(reinterpret_cast(array)); +%End + + void glMultMatrixf(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultMatrixf(reinterpret_cast(array)); +%End + + void glMatrixMode(GLenum mode); + void glLoadMatrixd(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLoadMatrixd(reinterpret_cast(array)); +%End + + void glLoadMatrixf(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLoadMatrixf(reinterpret_cast(array)); +%End + + void glLoadIdentity(); + void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); + GLboolean glIsList(GLuint list); + void glGetTexGeniv(GLenum coord, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_OBJECT_PLANE: + case GL_EYE_PLANE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexGeniv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetTexGenfv(GLenum coord, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_OBJECT_PLANE: + case GL_EYE_PLANE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexGenfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetTexGendv(GLenum coord, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLdouble params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_OBJECT_PLANE: + case GL_EYE_PLANE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexGendv(a0, a1, params); + + a2 = qpyopengl_from_GLdouble(&sipIsErr, params, nr_params); +%End + + void glGetTexEnviv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_TEXTURE_ENV_COLOR: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexEnviv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetTexEnvfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_TEXTURE_ENV_COLOR: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetTexEnvfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetMaterialiv(GLenum face, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int], Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_SHININESS: + nr_params = 1; + break; + + case GL_COLOR_INDEXES: + nr_params = 3; + break; + + default: + nr_params = 4; + } + + sipCpp->glGetMaterialiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetMaterialfv(GLenum face, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float], Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_SHININESS: + nr_params = 1; + break; + + case GL_COLOR_INDEXES: + nr_params = 3; + break; + + default: + nr_params = 4; + } + + sipCpp->glGetMaterialfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetLightiv(GLenum light, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int], Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_POSITION: + nr_params = 4; + break; + + case GL_SPOT_DIRECTION: + nr_params = 3; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetLightiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetLightfv(GLenum light, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float], Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_POSITION: + nr_params = 4; + break; + + case GL_SPOT_DIRECTION: + nr_params = 3; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetLightfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetClipPlane(GLenum plane, SIP_PYOBJECT *equation /TypeHint="Tuple[float, float, float, float]"/); +%MethodCode + GLdouble params[4]; + + sipCpp->glGetClipPlane(a0, params); + + a1 = qpyopengl_from_GLdouble(&sipIsErr, params, 4); +%End + + void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a4, a3, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawPixels(a0, a1, a2, a3, array); +%End + + void glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); + void glPixelMapusv(GLenum map, GLint mapsize, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPixelMapusv(a0, a1, reinterpret_cast(array)); +%End + + void glPixelMapuiv(GLenum map, GLint mapsize, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPixelMapuiv(a0, a1, reinterpret_cast(array)); +%End + + void glPixelMapfv(GLenum map, GLint mapsize, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPixelMapfv(a0, a1, reinterpret_cast(array)); +%End + + void glPixelTransferi(GLenum pname, GLint param); + void glPixelTransferf(GLenum pname, GLfloat param); + void glPixelZoom(GLfloat xfactor, GLfloat yfactor); + void glAlphaFunc(GLenum func, GLfloat ref); + void glEvalPoint2(GLint i, GLint j); + void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); + void glEvalPoint1(GLint i); + void glEvalMesh1(GLenum mode, GLint i1, GLint i2); + void glEvalCoord2fv(SIP_PYOBJECT u /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEvalCoord2fv(reinterpret_cast(array)); +%End + + void glEvalCoord2f(GLfloat u, GLfloat v); + void glEvalCoord2dv(SIP_PYOBJECT u /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEvalCoord2dv(reinterpret_cast(array)); +%End + + void glEvalCoord2d(GLdouble u, GLdouble v); + void glEvalCoord1fv(SIP_PYOBJECT u /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEvalCoord1fv(reinterpret_cast(array)); +%End + + void glEvalCoord1f(GLfloat u); + void glEvalCoord1dv(SIP_PYOBJECT u /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEvalCoord1dv(reinterpret_cast(array)); +%End + + void glEvalCoord1d(GLdouble u); + void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); + void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); + void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2); + void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2); + void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, SIP_PYOBJECT points /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a9, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMap2f(a0, a1, a2, a3, a4, a5, a6, a7, a8, + reinterpret_cast(array)); +%End + + void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, SIP_PYOBJECT points /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a9, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMap2d(a0, a1, a2, a3, a4, a5, a6, a7, a8, + reinterpret_cast(array)); +%End + + void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, SIP_PYOBJECT points /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMap1f(a0, a1, a2, a3, a4, + reinterpret_cast(array)); +%End + + void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, SIP_PYOBJECT points /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMap1d(a0, a1, a2, a3, a4, + reinterpret_cast(array)); +%End + + void glPushAttrib(GLbitfield mask); + void glPopAttrib(); + void glAccum(GLenum op, GLfloat value); + void glIndexMask(GLuint mask); + void glClearIndex(GLfloat c); + void glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glPushName(GLuint name); + void glPopName(); + void glPassThrough(GLfloat token); + void glLoadName(GLuint name); + void glInitNames(); + GLint glRenderMode(GLenum mode); + void glTexGeniv(GLenum coord, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexGeniv(a0, a1, reinterpret_cast(array)); +%End + + void glTexGeni(GLenum coord, GLenum pname, GLint param); + void glTexGenfv(GLenum coord, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexGenfv(a0, a1, reinterpret_cast(array)); +%End + + void glTexGenf(GLenum coord, GLenum pname, GLfloat param); + void glTexGendv(GLenum coord, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexGendv(a0, a1, reinterpret_cast(array)); +%End + + void glTexGend(GLenum coord, GLenum pname, GLdouble param); + void glTexEnviv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexEnviv(a0, a1, reinterpret_cast(array)); +%End + + void glTexEnvi(GLenum target, GLenum pname, GLint param); + void glTexEnvfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexEnvfv(a0, a1, reinterpret_cast(array)); +%End + + void glTexEnvf(GLenum target, GLenum pname, GLfloat param); + void glShadeModel(GLenum mode); + void glPolygonStipple(SIP_PYOBJECT mask /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPolygonStipple(reinterpret_cast(array)); +%End + + void glMaterialiv(GLenum face, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMaterialiv(a0, a1, reinterpret_cast(array)); +%End + + void glMateriali(GLenum face, GLenum pname, GLint param); + void glMaterialfv(GLenum face, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMaterialfv(a0, a1, reinterpret_cast(array)); +%End + + void glMaterialf(GLenum face, GLenum pname, GLfloat param); + void glLineStipple(GLint factor, GLushort pattern); + void glLightModeliv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLightModeliv(a0, reinterpret_cast(array)); +%End + + void glLightModeli(GLenum pname, GLint param); + void glLightModelfv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLightModelfv(a0, reinterpret_cast(array)); +%End + + void glLightModelf(GLenum pname, GLfloat param); + void glLightiv(GLenum light, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLightiv(a0, a1, reinterpret_cast(array)); +%End + + void glLighti(GLenum light, GLenum pname, GLint param); + void glLightfv(GLenum light, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLightfv(a0, a1, reinterpret_cast(array)); +%End + + void glLightf(GLenum light, GLenum pname, GLfloat param); + void glFogiv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogiv(a0, reinterpret_cast(array)); +%End + + void glFogi(GLenum pname, GLint param); + void glFogfv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogfv(a0, reinterpret_cast(array)); +%End + + void glFogf(GLenum pname, GLfloat param); + void glColorMaterial(GLenum face, GLenum mode); + void glClipPlane(GLenum plane, SIP_PYOBJECT equation /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glClipPlane(a0, reinterpret_cast(array)); +%End + + void glVertex4sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex4sv(reinterpret_cast(array)); +%End + + void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w); + void glVertex4iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex4iv(reinterpret_cast(array)); +%End + + void glVertex4i(GLint x, GLint y, GLint z, GLint w); + void glVertex4fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex4fv(reinterpret_cast(array)); +%End + + void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glVertex4dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex4dv(reinterpret_cast(array)); +%End + + void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void glVertex3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex3sv(reinterpret_cast(array)); +%End + + void glVertex3s(GLshort x, GLshort y, GLshort z); + void glVertex3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex3iv(reinterpret_cast(array)); +%End + + void glVertex3i(GLint x, GLint y, GLint z); + void glVertex3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex3fv(reinterpret_cast(array)); +%End + + void glVertex3f(GLfloat x, GLfloat y, GLfloat z); + void glVertex3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex3dv(reinterpret_cast(array)); +%End + + void glVertex3d(GLdouble x, GLdouble y, GLdouble z); + void glVertex2sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex2sv(reinterpret_cast(array)); +%End + + void glVertex2s(GLshort x, GLshort y); + void glVertex2iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex2iv(reinterpret_cast(array)); +%End + + void glVertex2i(GLint x, GLint y); + void glVertex2fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex2fv(reinterpret_cast(array)); +%End + + void glVertex2f(GLfloat x, GLfloat y); + void glVertex2dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertex2dv(reinterpret_cast(array)); +%End + + void glVertex2d(GLdouble x, GLdouble y); + void glTexCoord4sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord4sv(reinterpret_cast(array)); +%End + + void glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q); + void glTexCoord4iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord4iv(reinterpret_cast(array)); +%End + + void glTexCoord4i(GLint s, GLint t, GLint r, GLint q); + void glTexCoord4fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord4fv(reinterpret_cast(array)); +%End + + void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q); + void glTexCoord4dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord4dv(reinterpret_cast(array)); +%End + + void glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q); + void glTexCoord3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord3sv(reinterpret_cast(array)); +%End + + void glTexCoord3s(GLshort s, GLshort t, GLshort r); + void glTexCoord3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord3iv(reinterpret_cast(array)); +%End + + void glTexCoord3i(GLint s, GLint t, GLint r); + void glTexCoord3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord3fv(reinterpret_cast(array)); +%End + + void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r); + void glTexCoord3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord3dv(reinterpret_cast(array)); +%End + + void glTexCoord3d(GLdouble s, GLdouble t, GLdouble r); + void glTexCoord2sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord2sv(reinterpret_cast(array)); +%End + + void glTexCoord2s(GLshort s, GLshort t); + void glTexCoord2iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord2iv(reinterpret_cast(array)); +%End + + void glTexCoord2i(GLint s, GLint t); + void glTexCoord2fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord2fv(reinterpret_cast(array)); +%End + + void glTexCoord2f(GLfloat s, GLfloat t); + void glTexCoord2dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord2dv(reinterpret_cast(array)); +%End + + void glTexCoord2d(GLdouble s, GLdouble t); + void glTexCoord1sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord1sv(reinterpret_cast(array)); +%End + + void glTexCoord1s(GLshort s); + void glTexCoord1iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord1iv(reinterpret_cast(array)); +%End + + void glTexCoord1i(GLint s); + void glTexCoord1fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord1fv(reinterpret_cast(array)); +%End + + void glTexCoord1f(GLfloat s); + void glTexCoord1dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexCoord1dv(reinterpret_cast(array)); +%End + + void glTexCoord1d(GLdouble s); + void glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2); + void glRecti(GLint x1, GLint y1, GLint x2, GLint y2); + void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); + void glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); + void glRasterPos4sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos4sv(reinterpret_cast(array)); +%End + + void glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w); + void glRasterPos4iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos4iv(reinterpret_cast(array)); +%End + + void glRasterPos4i(GLint x, GLint y, GLint z, GLint w); + void glRasterPos4fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos4fv(reinterpret_cast(array)); +%End + + void glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glRasterPos4dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos4dv(reinterpret_cast(array)); +%End + + void glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void glRasterPos3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos3sv(reinterpret_cast(array)); +%End + + void glRasterPos3s(GLshort x, GLshort y, GLshort z); + void glRasterPos3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos3iv(reinterpret_cast(array)); +%End + + void glRasterPos3i(GLint x, GLint y, GLint z); + void glRasterPos3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos3fv(reinterpret_cast(array)); +%End + + void glRasterPos3f(GLfloat x, GLfloat y, GLfloat z); + void glRasterPos3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos3dv(reinterpret_cast(array)); +%End + + void glRasterPos3d(GLdouble x, GLdouble y, GLdouble z); + void glRasterPos2sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos2sv(reinterpret_cast(array)); +%End + + void glRasterPos2s(GLshort x, GLshort y); + void glRasterPos2iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos2iv(reinterpret_cast(array)); +%End + + void glRasterPos2i(GLint x, GLint y); + void glRasterPos2fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos2fv(reinterpret_cast(array)); +%End + + void glRasterPos2f(GLfloat x, GLfloat y); + void glRasterPos2dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glRasterPos2dv(reinterpret_cast(array)); +%End + + void glRasterPos2d(GLdouble x, GLdouble y); + void glNormal3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3sv(reinterpret_cast(array)); +%End + + void glNormal3s(GLshort nx, GLshort ny, GLshort nz); + void glNormal3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3iv(reinterpret_cast(array)); +%End + + void glNormal3i(GLint nx, GLint ny, GLint nz); + void glNormal3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3fv(reinterpret_cast(array)); +%End + + void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); + void glNormal3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3dv(reinterpret_cast(array)); +%End + + void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz); + void glNormal3bv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glNormal3bv(reinterpret_cast(array)); +%End + + void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz); + void glIndexsv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexsv(reinterpret_cast(array)); +%End + + void glIndexs(GLshort c); + void glIndexiv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexiv(reinterpret_cast(array)); +%End + + void glIndexi(GLint c); + void glIndexfv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexfv(reinterpret_cast(array)); +%End + + void glIndexf(GLfloat c); + void glIndexdv(SIP_PYOBJECT c /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glIndexdv(reinterpret_cast(array)); +%End + + void glIndexd(GLdouble c); + void glEnd(); + void glEdgeFlagv(SIP_PYOBJECT flag /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glEdgeFlagv(reinterpret_cast(array)); +%End + + void glEdgeFlag(GLboolean flag); + void glColor4usv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4usv(reinterpret_cast(array)); +%End + + void glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha); + void glColor4uiv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4uiv(reinterpret_cast(array)); +%End + + void glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha); + void glColor4ubv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4ubv(reinterpret_cast(array)); +%End + + void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); + void glColor4sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4sv(reinterpret_cast(array)); +%End + + void glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha); + void glColor4iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4iv(reinterpret_cast(array)); +%End + + void glColor4i(GLint red, GLint green, GLint blue, GLint alpha); + void glColor4fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4fv(reinterpret_cast(array)); +%End + + void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glColor4dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4dv(reinterpret_cast(array)); +%End + + void glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); + void glColor4bv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor4bv(reinterpret_cast(array)); +%End + + void glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); + void glColor3usv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3usv(reinterpret_cast(array)); +%End + + void glColor3us(GLushort red, GLushort green, GLushort blue); + void glColor3uiv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3uiv(reinterpret_cast(array)); +%End + + void glColor3ui(GLuint red, GLuint green, GLuint blue); + void glColor3ubv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3ubv(reinterpret_cast(array)); +%End + + void glColor3ub(GLubyte red, GLubyte green, GLubyte blue); + void glColor3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3sv(reinterpret_cast(array)); +%End + + void glColor3s(GLshort red, GLshort green, GLshort blue); + void glColor3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3iv(reinterpret_cast(array)); +%End + + void glColor3i(GLint red, GLint green, GLint blue); + void glColor3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3fv(reinterpret_cast(array)); +%End + + void glColor3f(GLfloat red, GLfloat green, GLfloat blue); + void glColor3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3dv(reinterpret_cast(array)); +%End + + void glColor3d(GLdouble red, GLdouble green, GLdouble blue); + void glColor3bv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColor3bv(reinterpret_cast(array)); +%End + + void glColor3b(GLbyte red, GLbyte green, GLbyte blue); + void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, SIP_PYOBJECT bitmap /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBitmap(a0, a1, a2, a3, a4, a5, + reinterpret_cast(array)); +%End + + void glBegin(GLenum mode); + void glListBase(GLuint base); + GLuint glGenLists(GLsizei range); + void glDeleteLists(GLuint list, GLsizei range); + void glCallList(GLuint list); + void glEndList(); + void glNewList(GLuint list, GLenum mode); + void glPushClientAttrib(GLbitfield mask); + void glPopClientAttrib(); + void glVertexPointer(GLint size, GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a3, a1, sipSelf, + "VertexPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glVertexPointer(a0, a1, a2, array); +%End + + void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a3, a1, sipSelf, + "TexCoordPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glTexCoordPointer(a0, a1, a2, array); +%End + + void glNormalPointer(GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a2, a0, sipSelf, + "NormalPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glNormalPointer(a0, a1, array); +%End + + void glIndexPointer(GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a2, a0, sipSelf, + "IndexPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glIndexPointer(a0, a1, array); +%End + + void glEnableClientState(GLenum array); + void glEdgeFlagPointer(GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a1, + GL_UNSIGNED_BYTE, sipSelf, "EdgeFlagPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glEdgeFlagPointer(a0, array); +%End + + void glDisableClientState(GLenum array); + void glColorPointer(GLint size, GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a3, a1, sipSelf, + "ColorPointer", 0); + + if (sipError == sipErrorNone) + sipCpp->glColorPointer(a0, a1, a2, array); +%End + + void glArrayElement(GLint i); + void glResetMinmax(GLenum target); + void glResetHistogram(GLenum target); + void glMinmax(GLenum target, GLenum internalformat, GLboolean sink); + void glHistogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); + void glGetConvolutionParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetConvolutionParameteriv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetConvolutionParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CONVOLUTION_BORDER_COLOR: + case GL_CONVOLUTION_FILTER_SCALE: + case GL_CONVOLUTION_FILTER_BIAS: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetConvolutionParameterfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glCopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); + void glCopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); + void glConvolutionParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glConvolutionParameteriv(a0, a1, + reinterpret_cast(array)); +%End + + void glConvolutionParameteri(GLenum target, GLenum pname, GLint params); + void glConvolutionParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glConvolutionParameterfv(a0, a1, + reinterpret_cast(array)); +%End + + void glConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); + void glConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT image /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, a5, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glConvolutionFilter2D(a0, a1, a2, a3, a4, a5, array); +%End + + void glConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, SIP_PYOBJECT image /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, a4, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glConvolutionFilter1D(a0, a1, a2, a3, a4, array); +%End + + void glCopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); + void glColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, a4, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColorSubTable(a0, a1, a2, a3, a4, array); +%End + + void glGetColorTableParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_COLOR_TABLE: + case GL_POST_CONVOLUTION_COLOR_TABLE: + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetColorTableParameteriv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetColorTableParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_COLOR_TABLE: + case GL_POST_CONVOLUTION_COLOR_TABLE: + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetColorTableParameterfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); + void glColorTableParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColorTableParameteriv(a0, a1, + reinterpret_cast(array)); +%End + + void glColorTableParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColorTableParameterfv(a0, a1, + reinterpret_cast(array)); +%End + + void glColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, SIP_PYOBJECT table /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, a4, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glColorTable(a0, a1, a2, a3, a4, array); +%End + + void glMultTransposeMatrixd(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultTransposeMatrixd(reinterpret_cast(array)); +%End + + void glMultTransposeMatrixf(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultTransposeMatrixf(reinterpret_cast(array)); +%End + + void glLoadTransposeMatrixd(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLoadTransposeMatrixd(reinterpret_cast(array)); +%End + + void glLoadTransposeMatrixf(SIP_PYOBJECT m /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glLoadTransposeMatrixf(reinterpret_cast(array)); +%End + + void glMultiTexCoord4sv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord4sv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord4s(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); + void glMultiTexCoord4iv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord4iv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord4i(GLenum target, GLint s, GLint t, GLint r, GLint q); + void glMultiTexCoord4fv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord4fv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); + void glMultiTexCoord4dv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord4dv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord4d(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); + void glMultiTexCoord3sv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord3sv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord3s(GLenum target, GLshort s, GLshort t, GLshort r); + void glMultiTexCoord3iv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord3iv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord3i(GLenum target, GLint s, GLint t, GLint r); + void glMultiTexCoord3fv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord3fv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r); + void glMultiTexCoord3dv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord3dv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord3d(GLenum target, GLdouble s, GLdouble t, GLdouble r); + void glMultiTexCoord2sv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord2sv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord2s(GLenum target, GLshort s, GLshort t); + void glMultiTexCoord2iv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord2iv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord2i(GLenum target, GLint s, GLint t); + void glMultiTexCoord2fv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord2fv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t); + void glMultiTexCoord2dv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord2dv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord2d(GLenum target, GLdouble s, GLdouble t); + void glMultiTexCoord1sv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord1sv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord1s(GLenum target, GLshort s); + void glMultiTexCoord1iv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord1iv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord1i(GLenum target, GLint s); + void glMultiTexCoord1fv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord1fv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord1f(GLenum target, GLfloat s); + void glMultiTexCoord1dv(GLenum target, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glMultiTexCoord1dv(a0, reinterpret_cast(array)); +%End + + void glMultiTexCoord1d(GLenum target, GLdouble s); + void glClientActiveTexture(GLenum texture); + void glWindowPos3sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos3sv(reinterpret_cast(array)); +%End + + void glWindowPos3s(GLshort x, GLshort y, GLshort z); + void glWindowPos3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos3iv(reinterpret_cast(array)); +%End + + void glWindowPos3i(GLint x, GLint y, GLint z); + void glWindowPos3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos3fv(reinterpret_cast(array)); +%End + + void glWindowPos3f(GLfloat x, GLfloat y, GLfloat z); + void glWindowPos3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos3dv(reinterpret_cast(array)); +%End + + void glWindowPos3d(GLdouble x, GLdouble y, GLdouble z); + void glWindowPos2sv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos2sv(reinterpret_cast(array)); +%End + + void glWindowPos2s(GLshort x, GLshort y); + void glWindowPos2iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos2iv(reinterpret_cast(array)); +%End + + void glWindowPos2i(GLint x, GLint y); + void glWindowPos2fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos2fv(reinterpret_cast(array)); +%End + + void glWindowPos2f(GLfloat x, GLfloat y); + void glWindowPos2dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glWindowPos2dv(reinterpret_cast(array)); +%End + + void glWindowPos2d(GLdouble x, GLdouble y); + void glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, a1, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColorPointer(a0, a1, a2, array); +%End + + void glSecondaryColor3usv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3usv(reinterpret_cast(array)); +%End + + void glSecondaryColor3us(GLushort red, GLushort green, GLushort blue); + void glSecondaryColor3uiv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3uiv(reinterpret_cast(array)); +%End + + void glSecondaryColor3ui(GLuint red, GLuint green, GLuint blue); + void glSecondaryColor3ubv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3ubv(reinterpret_cast(array)); +%End + + void glSecondaryColor3ub(GLubyte red, GLubyte green, GLubyte blue); + void glSecondaryColor3sv(SIP_PYBUFFER v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3sv(reinterpret_cast(array)); +%End + + void glSecondaryColor3s(GLshort red, GLshort green, GLshort blue); + void glSecondaryColor3iv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3iv(reinterpret_cast(array)); +%End + + void glSecondaryColor3i(GLint red, GLint green, GLint blue); + void glSecondaryColor3fv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3fv(reinterpret_cast(array)); +%End + + void glSecondaryColor3f(GLfloat red, GLfloat green, GLfloat blue); + void glSecondaryColor3dv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3dv(reinterpret_cast(array)); +%End + + void glSecondaryColor3d(GLdouble red, GLdouble green, GLdouble blue); + void glSecondaryColor3bv(SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glSecondaryColor3bv(reinterpret_cast(array)); +%End + + void glSecondaryColor3b(GLbyte red, GLbyte green, GLbyte blue); + void glFogCoordPointer(GLenum type, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, a0, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogCoordPointer(a0, a1, array); +%End + + void glFogCoorddv(SIP_PYOBJECT coord /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogCoorddv(reinterpret_cast(array)); +%End + + void glFogCoordd(GLdouble coord); + void glFogCoordfv(SIP_PYOBJECT coord /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a0, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glFogCoordfv(reinterpret_cast(array)); +%End + + void glFogCoordf(GLfloat coord); + void glVertexAttrib4usv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4usv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4uiv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4uiv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4ubv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4ubv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4sv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4sv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4s(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); + void glVertexAttrib4iv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4iv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4fv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glVertexAttrib4dv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4dv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void glVertexAttrib4bv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4bv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nusv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_SHORT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nusv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nuiv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nuiv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nubv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nubv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nub(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); + void glVertexAttrib4Nsv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nsv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Niv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Niv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4Nbv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4Nbv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib3sv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib3sv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib3s(GLuint index, GLshort x, GLshort y, GLshort z); + void glVertexAttrib3fv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib3fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); + void glVertexAttrib3dv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib3dv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib3d(GLuint index, GLdouble x, GLdouble y, GLdouble z); + void glVertexAttrib2sv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib2sv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib2s(GLuint index, GLshort x, GLshort y); + void glVertexAttrib2fv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib2fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y); + void glVertexAttrib2dv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib2dv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib2d(GLuint index, GLdouble x, GLdouble y); + void glVertexAttrib1sv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_SHORT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib1sv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib1s(GLuint index, GLshort x); + void glVertexAttrib1fv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib1fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib1f(GLuint index, GLfloat x); + void glVertexAttrib1dv(GLuint index, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_DOUBLE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib1dv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib1d(GLuint index, GLdouble x); +}; + +%End diff --git a/sip/QtOpenGL/qopenglfunctions_4_1_core.sip b/sip/QtOpenGL/qopenglfunctions_4_1_core.sip new file mode 100644 index 0000000..ebb7baf --- /dev/null +++ b/sip/QtOpenGL/qopenglfunctions_4_1_core.sip @@ -0,0 +1,1074 @@ +// qopenglfunctions_4_1_core.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (!PyQt_OpenGL_ES2) + +class QOpenGLFunctions_4_1_Core : QAbstractOpenGLFunctions +{ +%TypeHeaderCode +#include +%End + +public: + QOpenGLFunctions_4_1_Core(); + virtual ~QOpenGLFunctions_4_1_Core(); + virtual bool initializeOpenGLFunctions(); + void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); + void glDepthRange(GLdouble nearVal, GLdouble farVal); + GLboolean glIsEnabled(GLenum cap); + void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, SIP_PYOBJECT *params /TypeHint="int"/); +%MethodCode + GLint params[1]; + + sipCpp->glGetTexLevelParameteriv(a0, a1, a2, params); + + a3 = qpyopengl_from_GLint(&sipIsErr, params, 1); +%End + + void glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, SIP_PYOBJECT *params /TypeHint="float"/); +%MethodCode + GLfloat params[1]; + + sipCpp->glGetTexLevelParameterfv(a0, a1, a2, params); + + a3 = qpyopengl_from_GLfloat(&sipIsErr, params, 1); +%End + + void glGetTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR) + #if defined(GL_TEXTURE_SWIZZLE_RGBA) + case GL_TEXTURE_SWIZZLE_RGBA: + #endif + #if defined(GL_TEXTURE_BORDER_COLOR) + case GL_TEXTURE_BORDER_COLOR: + #endif + nr_params = 4; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetTexParameteriv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR) + #if defined(GL_TEXTURE_SWIZZLE_RGBA) + case GL_TEXTURE_SWIZZLE_RGBA: + #endif + #if defined(GL_TEXTURE_BORDER_COLOR) + case GL_TEXTURE_BORDER_COLOR: + #endif + nr_params = 4; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetTexParameterfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + const char *glGetString(GLenum name); +%MethodCode + sipRes = reinterpret_cast(sipCpp->glGetString(a0)); +%End + + void glGetIntegerv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLint fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLint[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetIntegerv(a0, params); + a1 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + void glGetFloatv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, ...]]"/); +%MethodCode + GLfloat fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLfloat[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetFloatv(a0, params); + a1 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + GLenum glGetError(); + void glGetDoublev(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, ...]]"/); +%MethodCode + GLdouble fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLdouble[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetDoublev(a0, params); + a1 = qpyopengl_from_GLdouble(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + void glGetBooleanv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[bool, Tuple[bool, ...]]"/); +%MethodCode + GLboolean fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLboolean[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetBooleanv(a0, params); + a1 = qpyopengl_from_GLboolean(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + SIP_PYOBJECT glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type) /TypeHint="Union[Tuple[float, ...], Tuple[int, ...]]"/; +%MethodCode + int components; + + switch (a4) + { + case GL_BGR: + case GL_RGB: + { + components = 3; + break; + } + + case GL_BGRA: + case GL_RGBA: + { + components = 4; + break; + } + + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_DEPTH_COMPONENT: + case GL_STENCIL_INDEX: + case GL_DEPTH_STENCIL: + { + components = 1; + break; + } + + default: + components = 0; + } + + Py_ssize_t length = components * a2 * a3; + + switch (a5) + { + case GL_FLOAT: + { + GLfloat *data = new GLfloat[length]; + + sipCpp->glReadPixels(a0, a1, a2, a3, a4, a5, data); + sipRes = qpyopengl_from_GLfloat(&sipIsErr, data, length); + delete [] data; + + break; + } + + case GL_INT: + { + GLint *data = new GLint[length]; + + sipCpp->glReadPixels(a0, a1, a2, a3, a4, a5, data); + sipRes = qpyopengl_from_GLint(&sipIsErr, data, length); + delete [] data; + + break; + } + + case GL_UNSIGNED_INT: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + case GL_UNSIGNED_INT_24_8: + case GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL_UNSIGNED_INT_5_9_9_9_REV: + { + GLuint *data = new GLuint[length]; + + sipCpp->glReadPixels(a0, a1, a2, a3, a4, a5, data); + sipRes = qpyopengl_from_GLuint(&sipIsErr, data, length); + delete [] data; + + break; + } + + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_HALF_FLOAT: + case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + default: + sipIsErr = 1; + PyErr_SetString(PyExc_ValueError, "pixel data format not supported"); + } +%End + + void glReadBuffer(GLenum mode); + void glPixelStorei(GLenum pname, GLint param); + void glPixelStoref(GLenum pname, GLfloat param); + void glDepthFunc(GLenum func); + void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); + void glStencilFunc(GLenum func, GLint ref, GLuint mask); + void glLogicOp(GLenum opcode); + void glBlendFunc(GLenum sfactor, GLenum dfactor); + void glFlush(); + void glFinish(); + void glEnable(GLenum cap); + void glDisable(GLenum cap); + void glDepthMask(GLboolean flag); + void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void glStencilMask(GLuint mask); + void glClearDepth(GLdouble depth); + void glClearStencil(GLint s); + void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glClear(GLbitfield mask); + void glDrawBuffer(GLenum mode); + void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a7, a6, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage1D(a0, a1, a2, a3, a4, a5, a6, array); +%End + + void glTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexParameteriv(a0, a1, reinterpret_cast(array)); +%End + + void glTexParameteri(GLenum target, GLenum pname, GLint param); + void glTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexParameterfv(a0, a1, reinterpret_cast(array)); +%End + + void glTexParameterf(GLenum target, GLenum pname, GLfloat param); + void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); + void glPolygonMode(GLenum face, GLenum mode); + void glPointSize(GLfloat size); + void glLineWidth(GLfloat width); + void glHint(GLenum target, GLenum mode); + void glFrontFace(GLenum mode); + void glCullFace(GLenum mode); + GLboolean glIsTexture(GLuint texture); + void glGenTextures(GLsizei n, SIP_PYOBJECT *textures /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenTextures(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glDeleteTextures(GLsizei n, SIP_PYOBJECT textures /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteTextures(a0, reinterpret_cast(array)); +%End + + void glBindTexture(GLenum target, GLuint texture); + void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, a5, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage1D(a0, a1, a2, a3, a4, a5, array); +%End + + void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); + void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); + void glCopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); + void glPolygonOffset(GLfloat factor, GLfloat units); + void glDrawElements(GLenum mode, GLsizei count, GLenum type, SIP_PYOBJECT indices /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, a2, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawElements(a0, a1, a2, array); +%End + + void glDrawArrays(GLenum mode, GLint first, GLsizei count); + void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a10, a9, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage3D(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, array); +%End + + void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a9, a8, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage3D(a0, a1, a2, a3, a4, a5, a6, a7, a8, array); +%End + + void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, SIP_PYOBJECT indices /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a5, a4, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawRangeElements(a0, a1, a2, a3, a4, array); +%End + + void glBlendEquation(GLenum mode); + void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); + void glCompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage1D(a0, a1, a2, a3, a4, a5, array); +%End + + void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a10, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage3D(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, + array); +%End + + void glCompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a6, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage1D(a0, a1, a2, a3, a4, a5, array); +%End + + void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a7, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage2D(a0, a1, a2, a3, a4, a5, a6, array); +%End + + void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage3D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glSampleCoverage(GLfloat value, GLboolean invert); + void glActiveTexture(GLenum texture); + void glPointParameteriv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPointParameteriv(a0, reinterpret_cast(array)); +%End + + void glPointParameteri(GLenum pname, GLint param); + void glPointParameterfv(GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glPointParameterfv(a0, reinterpret_cast(array)); +%End + + void glPointParameterf(GLenum pname, GLfloat param); + void glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); + void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params); + GLboolean glUnmapBuffer(GLenum target); + void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array; + + if (a3 == Py_None) + array = 0; + else + array = qpyopengl_value_array(&sipError, a3, GL_UNSIGNED_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBufferSubData(a0, a1, a2, array); +%End + + void glBufferData(GLenum target, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/, GLenum usage); +%MethodCode + const GLvoid *array; + + if (a2 == Py_None) + array = 0; + else + array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBufferData(a0, a1, array, a3); +%End + + GLboolean glIsBuffer(GLuint buffer); + void glGenBuffers(GLsizei n, SIP_PYOBJECT *buffers /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenBuffers(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glDeleteBuffers(GLsizei n, SIP_PYOBJECT buffers /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteBuffers(a0, reinterpret_cast(array)); +%End + + void glBindBuffer(GLenum target, GLuint buffer); + void glGetQueryiv(GLenum target, GLenum pname, GLint *params); + void glEndQuery(GLenum target); + void glBeginQuery(GLenum target, GLuint id); + GLboolean glIsQuery(GLuint id); + void glDeleteQueries(GLsizei n, SIP_PYOBJECT ids /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteQueries(a0, reinterpret_cast(array)); +%End + + void glGenQueries(GLsizei n, SIP_PYOBJECT *ids /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenQueries(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, SIP_PYOBJECT pointer /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a5, a2, sipSelf, + "VertexAttribPointer", a0); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttribPointer(a0, a1, a2, a3, a4, array); +%End + + void glValidateProgram(GLuint program); + void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix4fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix3fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix2fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniform4iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform4iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform3iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform3iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform2iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform2iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform1iv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform1iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform4fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform4fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform3fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform3fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform2fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform2fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform1fv(GLint location, GLsizei count, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform1fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); + void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2); + void glUniform2i(GLint location, GLint v0, GLint v1); + void glUniform1i(GLint location, GLint v0); + void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); + void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); + void glUniform2f(GLint location, GLfloat v0, GLfloat v1); + void glUniform1f(GLint location, GLfloat v0); + void glUseProgram(GLuint program); + void glLinkProgram(GLuint program); + GLboolean glIsShader(GLuint shader); + GLboolean glIsProgram(GLuint program); + void glGetVertexAttribiv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glGetVertexAttribfv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetVertexAttribdv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLdouble params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribdv(a0, a1, params); + + a2 = qpyopengl_from_GLdouble(&sipIsErr, params, nr_params); +%End + + GLint glGetUniformLocation(GLuint program, const GLchar *name); + SIP_PYOBJECT glGetShaderSource(GLuint shader) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetShaderiv(a0, GL_SHADER_SOURCE_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *source = new GLchar[bufsize]; + + sipCpp->glGetShaderSource(a0, bufsize, 0, source); + sipRes = PyBytes_FromString(source); + + delete[] source; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + SIP_PYOBJECT glGetShaderInfoLog(GLuint shader) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetShaderiv(a0, GL_INFO_LOG_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *log = new GLchar[bufsize]; + + sipCpp->glGetShaderInfoLog(a0, bufsize, 0, log); + sipRes = PyBytes_FromString(log); + + delete[] log; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + void glGetShaderiv(GLuint shader, GLenum pname, GLint *params); + SIP_PYOBJECT glGetProgramInfoLog(GLuint program) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_INFO_LOG_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *log = new GLchar[bufsize]; + + sipCpp->glGetProgramInfoLog(a0, bufsize, 0, log); + sipRes = PyBytes_FromString(log); + + delete[] log; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + void glGetProgramiv(GLuint program, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int]]"/); +%MethodCode + GLint params[3]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_COMPUTE_LOCAL_WORK_SIZE) + case GL_COMPUTE_LOCAL_WORK_SIZE: + nr_params = 3; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetProgramiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + GLint glGetAttribLocation(GLuint program, const GLchar *name); + SIP_PYOBJECT glGetAttachedShaders(GLuint program) /TypeHint="Tuple[int, ...]"/; +%MethodCode + GLint nr_shaders; + + sipCpp->glGetProgramiv(a0, GL_ATTACHED_SHADERS, &nr_shaders); + + if (nr_shaders < 1) + { + sipRes = PyTuple_New(0); + } + else + { + GLuint *shaders = new GLuint[nr_shaders]; + + sipCpp->glGetAttachedShaders(a0, nr_shaders, 0, shaders); + + sipRes = PyTuple_New(nr_shaders); + + if (sipRes) + { + for (GLint i = 0; i < nr_shaders; ++i) + { + PyObject *itm = PyLong_FromLong(shaders[i]); + + if (!itm) + { + Py_DECREF(sipRes); + sipRes = 0; + break; + } + + PyTuple_SetItem(sipRes, i, itm); + } + } + + delete[] shaders; + } + + if (!sipRes) + sipIsErr = 1; +%End + + SIP_PYOBJECT glGetActiveUniform(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufsize); + + GLchar *name = new GLchar[bufsize]; + GLint size; + GLenum type; + + sipCpp->glGetActiveUniform(a0, a1, bufsize, 0, &size, &type, name); + + sipRes = Py_BuildValue("siI", name, size, type); + + if (!sipRes) + sipIsErr = 1; + + delete[] name; +%End + + SIP_PYOBJECT glGetActiveAttrib(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &bufsize); + + GLchar *name = new GLchar[bufsize]; + GLint size; + GLenum type; + + sipCpp->glGetActiveAttrib(a0, a1, bufsize, 0, &size, &type, name); + + sipRes = Py_BuildValue("siI", name, size, type); + + if (!sipRes) + sipIsErr = 1; + + delete[] name; +%End + + void glEnableVertexAttribArray(GLuint index); + void glDisableVertexAttribArray(GLuint index); + void glDetachShader(GLuint program, GLuint shader); + void glDeleteShader(GLuint shader); + void glDeleteProgram(GLuint program); + GLuint glCreateShader(GLenum type); + GLuint glCreateProgram(); + void glCompileShader(GLuint shader); + void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name); + void glAttachShader(GLuint program, GLuint shader); + void glStencilMaskSeparate(GLenum face, GLuint mask); + void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); + void glDrawBuffers(GLsizei n, SIP_PYOBJECT bufs /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawBuffers(a0, reinterpret_cast(array)); +%End + + void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + GLboolean glIsVertexArray(GLuint array); + void glBindVertexArray(GLuint array); + void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); + void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + void glGenerateMipmap(GLenum target); + void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); + void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); + void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); + void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); + GLenum glCheckFramebufferStatus(GLenum target); + void glBindFramebuffer(GLenum target, GLuint framebuffer); + GLboolean glIsFramebuffer(GLuint framebuffer); + void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + void glBindRenderbuffer(GLenum target, GLuint renderbuffer); + GLboolean glIsRenderbuffer(GLuint renderbuffer); + void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); + void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); + void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2); + void glUniform2ui(GLint location, GLuint v0, GLuint v1); + void glUniform1ui(GLint location, GLuint v0); + void glEndConditionalRender(); + void glBeginConditionalRender(GLuint id, GLenum mode); + void glClampColor(GLenum target, GLenum clamp); + void glBindBufferBase(GLenum target, GLuint index, GLuint buffer); + void glEndTransformFeedback(); + void glBeginTransformFeedback(GLenum primitiveMode); + GLboolean glIsEnabledi(GLenum target, GLuint index); + void glDisablei(GLenum target, GLuint index); + void glEnablei(GLenum target, GLuint index); + void glColorMaski(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); + void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); + void glPrimitiveRestartIndex(GLuint index); + void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer); + void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); + void glSampleMaski(GLuint index, GLbitfield mask); + void glTexImage3DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); + void glTexImage2DMultisample(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); + void glProvokingVertex(GLenum mode); + void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level); + void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value); + void glVertexAttribP3ui(GLuint index, GLenum type, GLboolean normalized, GLuint value); + void glVertexAttribP2ui(GLuint index, GLenum type, GLboolean normalized, GLuint value); + void glVertexAttribP1ui(GLuint index, GLenum type, GLboolean normalized, GLuint value); + void glQueryCounter(GLuint id, GLenum target); + void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param); + void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param); + void glBindSampler(GLuint unit, GLuint sampler); + GLboolean glIsSampler(GLuint sampler); + void glVertexAttribDivisor(GLuint index, GLuint divisor); + void glEndQueryIndexed(GLenum target, GLuint index); + void glBeginQueryIndexed(GLenum target, GLuint index, GLuint id); + void glDrawTransformFeedbackStream(GLenum mode, GLuint id, GLuint stream); + void glDrawTransformFeedback(GLenum mode, GLuint id); + void glResumeTransformFeedback(); + void glPauseTransformFeedback(); + GLboolean glIsTransformFeedback(GLuint id); + void glBindTransformFeedback(GLenum target, GLuint id); + void glPatchParameteri(GLenum pname, GLint value); + void glUniform4d(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void glUniform3d(GLint location, GLdouble x, GLdouble y, GLdouble z); + void glUniform2d(GLint location, GLdouble x, GLdouble y); + void glUniform1d(GLint location, GLdouble x); + void glBlendFuncSeparatei(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); + void glBlendFunci(GLuint buf, GLenum src, GLenum dst); + void glBlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeAlpha); + void glBlendEquationi(GLuint buf, GLenum mode); + void glMinSampleShading(GLfloat value); + void glDepthRangeIndexed(GLuint index, GLdouble n, GLdouble f); + void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); + void glViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); + void glVertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + void glVertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z); + void glVertexAttribL2d(GLuint index, GLdouble x, GLdouble y); + void glVertexAttribL1d(GLuint index, GLdouble x); + void glValidateProgramPipeline(GLuint pipeline); + void glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); + void glProgramUniform4d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); + void glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); + void glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); + void glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); + void glProgramUniform3d(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); + void glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); + void glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2); + void glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1); + void glProgramUniform2d(GLuint program, GLint location, GLdouble v0, GLdouble v1); + void glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1); + void glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1); + void glProgramUniform1ui(GLuint program, GLint location, GLuint v0); + void glProgramUniform1d(GLuint program, GLint location, GLdouble v0); + void glProgramUniform1f(GLuint program, GLint location, GLfloat v0); + void glProgramUniform1i(GLuint program, GLint location, GLint v0); + GLboolean glIsProgramPipeline(GLuint pipeline); + void glBindProgramPipeline(GLuint pipeline); + void glActiveShaderProgram(GLuint pipeline, GLuint program); + void glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program); + void glProgramParameteri(GLuint program, GLenum pname, GLint value); + void glClearDepthf(GLfloat dd); + void glDepthRangef(GLfloat n, GLfloat f); + void glReleaseShaderCompiler(); +}; + +%End diff --git a/sip/QtOpenGL/qopenglfunctions_es2.sip b/sip/QtOpenGL/qopenglfunctions_es2.sip new file mode 100644 index 0000000..7bdd135 --- /dev/null +++ b/sip/QtOpenGL/qopenglfunctions_es2.sip @@ -0,0 +1,815 @@ +// qopenglfunctions_es2.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_OpenGL_ES2) + +class QOpenGLFunctions_ES2 : QAbstractOpenGLFunctions +{ +%TypeHeaderCode +#include +%End + +public: + QOpenGLFunctions_ES2(); + bool initializeOpenGLFunctions(); + void glActiveTexture(GLenum texture); + void glAttachShader(GLuint program, GLuint shader); + void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name); + void glBindBuffer(GLenum target, GLuint buffer); + void glBindFramebuffer(GLenum target, GLuint framebuffer); + void glBindRenderbuffer(GLenum target, GLuint renderbuffer); + void glBindTexture(GLenum target, GLuint texture); + void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void glBlendEquation(GLenum mode); + void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); + void glBlendFunc(GLenum sfactor, GLenum dfactor); + void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); + void glBufferData(GLenum target, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/, GLenum usage); +%MethodCode + const GLvoid *array; + + if (a2 == Py_None) + array = 0; + else + array = qpyopengl_value_array(&sipError, a2, GL_UNSIGNED_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBufferData(a0, a1, array, a3); +%End + + void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array; + + if (a3 == Py_None) + array = 0; + else + array = qpyopengl_value_array(&sipError, a3, GL_UNSIGNED_BYTE, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glBufferSubData(a0, a1, a2, array); +%End + + GLenum glCheckFramebufferStatus(GLenum target); + void glClear(GLbitfield mask); + void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void glClearDepthf(GLclampf depth); + void glClearStencil(GLint s); + void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void glCompileShader(GLuint shader); + void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a7, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexImage2D(a0, a1, a2, a3, a4, a5, a6, array); +%End + + void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, SIP_PYOBJECT data /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, GL_UNSIGNED_BYTE, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glCompressedTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); + void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); + GLuint glCreateProgram(); + GLuint glCreateShader(GLenum type); + void glCullFace(GLenum mode); + void glDeleteBuffers(GLsizei n, SIP_PYOBJECT buffers /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteBuffers(a0, reinterpret_cast(array)); +%End + + void glDeleteFramebuffers(GLsizei n, SIP_PYOBJECT framebuffers); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteFramebuffers(a0, reinterpret_cast(array)); +%End + + void glDeleteProgram(GLuint program); + void glDeleteRenderbuffers(GLsizei n, SIP_PYOBJECT renderbuffers); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteRenderbuffers(a0, reinterpret_cast(array)); +%End + + void glDeleteShader(GLuint shader); + void glDeleteTextures(GLsizei n, SIP_PYOBJECT textures /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_UNSIGNED_INT, + sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDeleteTextures(a0, reinterpret_cast(array)); +%End + + void glDepthFunc(GLenum func); + void glDepthMask(GLboolean flag); + void glDepthRangef(GLclampf zNear, GLclampf zFar); + void glDetachShader(GLuint program, GLuint shader); + void glDisable(GLenum cap); + void glDisableVertexAttribArray(GLuint index); + void glDrawArrays(GLenum mode, GLint first, GLsizei count); + void glDrawElements(GLenum mode, GLsizei count, GLenum type, SIP_PYOBJECT indices /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, a2, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glDrawElements(a0, a1, a2, array); +%End + + void glEnable(GLenum cap); + void glEnableVertexAttribArray(GLuint index); + void glFinish(); + void glFlush(); + void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); + void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); + void glFrontFace(GLenum mode); + void glGenBuffers(GLsizei n, SIP_PYOBJECT *buffers /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenBuffers(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glGenerateMipmap(GLenum target); + void glGenFramebuffers(GLsizei n, SIP_PYOBJECT framebuffers /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenFramebuffers(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glGenRenderbuffers(GLsizei n, SIP_PYOBJECT *renderbuffers /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenRenderbuffers(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + void glGenTextures(GLsizei n, SIP_PYOBJECT textures /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLuint *params = new GLuint[a0]; + + sipCpp->glGenTextures(a0, params); + + a1 = qpyopengl_from_GLuint(&sipIsErr, params, a0); + + delete[] params; +%End + + SIP_PYOBJECT glGetActiveAttrib(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &bufsize); + + GLchar *name = new GLchar[bufsize]; + GLint size; + GLenum type; + + sipCpp->glGetActiveAttrib(a0, a1, bufsize, 0, &size, &type, name); + + sipRes = Py_BuildValue("siI", name, size, type); + + if (!sipRes) + sipIsErr = 1; + + delete[] name; +%End + + SIP_PYOBJECT glGetActiveUniform(GLuint program, GLuint index) /TypeHint="Tuple[str, int, int]"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_ACTIVE_UNIFORM_MAX_LENGTH, &bufsize); + + GLchar *name = new GLchar[bufsize]; + GLint size; + GLenum type; + + sipCpp->glGetActiveUniform(a0, a1, bufsize, 0, &size, &type, name); + + sipRes = Py_BuildValue("siI", name, size, type); + + if (!sipRes) + sipIsErr = 1; + + delete[] name; +%End + + SIP_PYOBJECT glGetAttachedShaders(GLuint program) /TypeHint="Tuple[int, ...]"/; +%MethodCode + GLint nr_shaders; + + sipCpp->glGetProgramiv(a0, GL_ATTACHED_SHADERS, &nr_shaders); + + if (nr_shaders < 1) + { + sipRes = PyTuple_New(0); + } + else + { + GLuint *shaders = new GLuint[nr_shaders]; + + sipCpp->glGetAttachedShaders(a0, nr_shaders, 0, shaders); + + sipRes = PyTuple_New(nr_shaders); + + if (sipRes) + { + for (GLint i = 0; i < nr_shaders; ++i) + { + PyObject *itm = PyLong_FromLong(shaders[i]); + + if (!itm) + { + Py_DECREF(sipRes); + sipRes = 0; + break; + } + + PyTuple_SetItem(sipRes, i, itm); + } + } + + delete[] shaders; + } + + if (!sipRes) + sipIsErr = 1; +%End + + int glGetAttribLocation(GLuint program, const GLchar *name); + void glGetBooleanv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[bool, Tuple[bool, ...]]"/); +%MethodCode + GLboolean fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLboolean[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetBooleanv(a0, params); + a1 = qpyopengl_from_GLboolean(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params); + GLenum glGetError(); + void glGetFloatv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, ...]]"/); +%MethodCode + GLfloat fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLfloat[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetFloatv(a0, params); + a1 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params); + void glGetIntegerv(GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, ...]]"/); +%MethodCode + GLint fixed_params[16], *params; + GLint nr_params; + GLenum query; + + nr_params = qpyopengl_get(a0, &query); + + if (nr_params == 0) + { + sipCpp->glGetIntegerv(query, &nr_params); + params = new GLint[nr_params]; + } + else + { + params = fixed_params; + } + + sipCpp->glGetIntegerv(a0, params); + a1 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); + + if (params != fixed_params) + delete[] params; +%End + + void glGetProgramiv(GLuint program, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int]]"/); +%MethodCode + GLint params[3]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_COMPUTE_LOCAL_WORK_SIZE) + case GL_COMPUTE_LOCAL_WORK_SIZE: + nr_params = 3; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetProgramiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + SIP_PYOBJECT glGetProgramInfoLog(GLuint program) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetProgramiv(a0, GL_INFO_LOG_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *log = new GLchar[bufsize]; + + sipCpp->glGetProgramInfoLog(a0, bufsize, 0, log); + sipRes = PyBytes_FromString(log); + + delete[] log; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params); + void glGetShaderiv(GLuint shader, GLenum pname, GLint *params); + SIP_PYOBJECT glGetShaderInfoLog(GLuint shader) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetShaderiv(a0, GL_INFO_LOG_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *log = new GLchar[bufsize]; + + sipCpp->glGetShaderInfoLog(a0, bufsize, 0, log); + sipRes = PyBytes_FromString(log); + + delete[] log; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + SIP_PYOBJECT glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype) /TypeHint="Tuple[Tuple[int, int], int]"/; +%MethodCode + GLint range[2], precision; + + sipCpp->glGetShaderPrecisionFormat(a0, a1, range, &precision); + + sipRes = Py_BuildValue("(ii)i", (int)range[0], (int)range[1], (int)precision); + + if (!sipRes) + sipIsErr = 1; +%End + + SIP_PYOBJECT glGetShaderSource(GLuint shader) /TypeHint="bytes"/; +%MethodCode + GLint bufsize; + + sipCpp->glGetShaderiv(a0, GL_SHADER_SOURCE_LENGTH, &bufsize); + + if (bufsize > 0) + { + GLchar *source = new GLchar[bufsize]; + + sipCpp->glGetShaderSource(a0, bufsize, 0, source); + sipRes = PyBytes_FromString(source); + + delete[] source; + } + else + { + sipRes = PyBytes_FromString(""); + } +%End + + const char *glGetString(GLenum name); +%MethodCode + sipRes = reinterpret_cast(sipCpp->glGetString(a0)); +%End + + void glGetTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR) + #if defined(GL_TEXTURE_SWIZZLE_RGBA) + case GL_TEXTURE_SWIZZLE_RGBA: + #endif + #if defined(GL_TEXTURE_BORDER_COLOR) + case GL_TEXTURE_BORDER_COLOR: + #endif + nr_params = 4; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetTexParameterfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + #if defined(GL_TEXTURE_SWIZZLE_RGBA) || defined(GL_TEXTURE_BORDER_COLOR) + #if defined(GL_TEXTURE_SWIZZLE_RGBA) + case GL_TEXTURE_SWIZZLE_RGBA: + #endif + #if defined(GL_TEXTURE_BORDER_COLOR) + case GL_TEXTURE_BORDER_COLOR: + #endif + nr_params = 4; + break; + #endif + + default: + nr_params = 1; + } + + sipCpp->glGetTexParameteriv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + int glGetUniformLocation(GLuint program, const GLchar *name); + void glGetVertexAttribfv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[float, Tuple[float, float, float, float]]"/); +%MethodCode + GLfloat params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribfv(a0, a1, params); + + a2 = qpyopengl_from_GLfloat(&sipIsErr, params, nr_params); +%End + + void glGetVertexAttribiv(GLuint index, GLenum pname, SIP_PYOBJECT *params /TypeHint="Union[int, Tuple[int, int, int, int]]"/); +%MethodCode + GLint params[4]; + Py_ssize_t nr_params; + + switch (a1) + { + case GL_CURRENT_VERTEX_ATTRIB: + nr_params = 4; + break; + + default: + nr_params = 1; + } + + sipCpp->glGetVertexAttribiv(a0, a1, params); + + a2 = qpyopengl_from_GLint(&sipIsErr, params, nr_params); +%End + + void glHint(GLenum target, GLenum mode); + GLboolean glIsBuffer(GLuint buffer); + GLboolean glIsEnabled(GLenum cap); + GLboolean glIsFramebuffer(GLuint framebuffer); + GLboolean glIsProgram(GLuint program); + GLboolean glIsRenderbuffer(GLuint renderbuffer); + GLboolean glIsShader(GLuint shader); + GLboolean glIsTexture(GLuint texture); + void glLineWidth(GLfloat width); + void glLinkProgram(GLuint program); + void glPixelStorei(GLenum pname, GLint param); + void glPolygonOffset(GLfloat factor, GLfloat units); + SIP_PYOBJECT glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type) /TypeHint="Union[Tuple[float, ...], Tuple[int, ...]]"/; +%MethodCode + int components; + + switch (a4) + { + case GL_RGB: + { + components = 3; + break; + } + + case GL_RGBA: + { + components = 4; + break; + } + + case GL_ALPHA: + { + components = 1; + break; + } + + default: + components = 0; + } + + Py_ssize_t length = components * a2 * a3; + + switch (a5) + { + // TODO: Implement array convertors for these formats. + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_BYTE: + default: + sipIsErr = 1; + PyErr_SetString(PyExc_ValueError, "pixel data format not supported"); + } +%End + + void glReleaseShaderCompiler(); + void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + void glSampleCoverage(GLclampf value, GLboolean invert); + void glScissor(GLint x, GLint y, GLsizei width, GLsizei height); + void glStencilFunc(GLenum func, GLint ref, GLuint mask); + void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + void glStencilMask(GLuint mask); + void glStencilMaskSeparate(GLenum face, GLuint mask); + void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); + void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glTexParameterf(GLenum target, GLenum pname, GLfloat param); + void glTexParameterfv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexParameterfv(a0, a1, reinterpret_cast(array)); +%End + + void glTexParameteri(GLenum target, GLenum pname, GLint param); + void glTexParameteriv(GLenum target, GLenum pname, SIP_PYOBJECT params /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexParameteriv(a0, a1, reinterpret_cast(array)); +%End + + void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, SIP_PYOBJECT pixels /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a8, a7, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glTexSubImage2D(a0, a1, a2, a3, a4, a5, a6, a7, array); +%End + + void glUniform1f(GLint location, GLfloat x); + void glUniform1fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform1fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform1i(GLint location, GLint x); + void glUniform1iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform1iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform2f(GLint location, GLfloat x, GLfloat y); + void glUniform2fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform2fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform2i(GLint location, GLint x, GLint y); + void glUniform2iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform2iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z); + void glUniform3fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform3fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform3i(GLint location, GLint x, GLint y, GLint z); + void glUniform3iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform3iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glUniform4fv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform4fv(a0, a1, reinterpret_cast(array)); +%End + + void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w); + void glUniform4iv(GLint location, GLsizei count, SIP_PYOBJECT v /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a2, GL_INT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniform4iv(a0, a1, reinterpret_cast(array)); +%End + + void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix2fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix3fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, SIP_PYOBJECT value /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a3, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glUniformMatrix4fv(a0, a1, a2, + reinterpret_cast(array)); +%End + + void glUseProgram(GLuint program); + void glValidateProgram(GLuint program); + void glVertexAttrib1f(GLuint indx, GLfloat x); + void glVertexAttrib1fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib1fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); + void glVertexAttrib2fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib2fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); + void glVertexAttrib3fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib3fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void glVertexAttrib4fv(GLuint indx, SIP_PYOBJECT values /TypeHint="PYQT_OPENGL_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array(&sipError, a1, GL_FLOAT, sipSelf); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttrib4fv(a0, reinterpret_cast(array)); +%End + + void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, SIP_PYOBJECT ptr /TypeHint="PYQT_OPENGL_BOUND_ARRAY"/); +%MethodCode + const GLvoid *array = qpyopengl_value_array_cached(&sipError, a5, a2, sipSelf, + "VertexAttribPointer", a0); + + if (sipError == sipErrorNone) + sipCpp->glVertexAttribPointer(a0, a1, a2, a3, a4, array); +%End + + void glViewport(GLint x, GLint y, GLsizei width, GLsizei height); +}; + +%End diff --git a/sip/QtOpenGL/qopenglpaintdevice.sip b/sip/QtOpenGL/qopenglpaintdevice.sip new file mode 100644 index 0000000..9d0c98b --- /dev/null +++ b/sip/QtOpenGL/qopenglpaintdevice.sip @@ -0,0 +1,49 @@ +// qopenglpaintdevice.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLPaintDevice : QPaintDevice +{ +%TypeHeaderCode +#include +%End + +public: + QOpenGLPaintDevice(); + explicit QOpenGLPaintDevice(const QSize &size); + QOpenGLPaintDevice(int width, int height); + virtual ~QOpenGLPaintDevice(); + virtual QPaintEngine *paintEngine() const; + QOpenGLContext *context() const; + QSize size() const; + void setSize(const QSize &size); + qreal dotsPerMeterX() const; + qreal dotsPerMeterY() const; + void setDotsPerMeterX(qreal); + void setDotsPerMeterY(qreal); + void setPaintFlipped(bool flipped); + bool paintFlipped() const; + virtual void ensureActiveTarget(); + void setDevicePixelRatio(qreal devicePixelRatio); + +protected: + virtual int metric(QPaintDevice::PaintDeviceMetric metric) const; +}; diff --git a/sip/QtOpenGL/qopenglpixeltransferoptions.sip b/sip/QtOpenGL/qopenglpixeltransferoptions.sip new file mode 100644 index 0000000..9405a7a --- /dev/null +++ b/sip/QtOpenGL/qopenglpixeltransferoptions.sip @@ -0,0 +1,50 @@ +// qopenglpixeltransferoptions.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLPixelTransferOptions +{ +%TypeHeaderCode +#include +%End + +public: + QOpenGLPixelTransferOptions(); + QOpenGLPixelTransferOptions(const QOpenGLPixelTransferOptions &); + ~QOpenGLPixelTransferOptions(); + void swap(QOpenGLPixelTransferOptions &other /Constrained/); + void setAlignment(int alignment); + int alignment() const; + void setSkipImages(int skipImages); + int skipImages() const; + void setSkipRows(int skipRows); + int skipRows() const; + void setSkipPixels(int skipPixels); + int skipPixels() const; + void setImageHeight(int imageHeight); + int imageHeight() const; + void setRowLength(int rowLength); + int rowLength() const; + void setLeastSignificantByteFirst(bool lsbFirst); + bool isLeastSignificantBitFirst() const; + void setSwapBytesEnabled(bool swapBytes); + bool isSwapBytesEnabled() const; +}; diff --git a/sip/QtOpenGL/qopenglshaderprogram.sip b/sip/QtOpenGL/qopenglshaderprogram.sip new file mode 100644 index 0000000..2bc64c6 --- /dev/null +++ b/sip/QtOpenGL/qopenglshaderprogram.sip @@ -0,0 +1,319 @@ +// qopenglshaderprogram.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLShader : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum ShaderTypeBit /BaseType=Flag/ + { + Vertex, + Fragment, + Geometry, + TessellationControl, + TessellationEvaluation, + Compute, + }; + + typedef QFlags ShaderType; + QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent /TransferThis/ = 0); + virtual ~QOpenGLShader(); + QOpenGLShader::ShaderType shaderType() const; + bool compileSourceCode(const QByteArray &source); + bool compileSourceCode(const QString &source); + bool compileSourceFile(const QString &fileName); + QByteArray sourceCode() const; + bool isCompiled() const; + QString log() const; + GLuint shaderId() const; + static bool hasOpenGLShaders(QOpenGLShader::ShaderType type, QOpenGLContext *context = 0); +}; + +class QOpenGLShaderProgram : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QOpenGLShaderProgram(QObject *parent /TransferThis/ = 0); + virtual ~QOpenGLShaderProgram(); + bool addShader(QOpenGLShader *shader); + void removeShader(QOpenGLShader *shader); + QList shaders() const; + bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray &source); + bool addShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString &source); + bool addShaderFromSourceFile(QOpenGLShader::ShaderType type, const QString &fileName); + void removeAllShaders(); + virtual bool link(); + bool isLinked() const; + QString log() const; + bool bind(); + void release(); + GLuint programId() const; + void bindAttributeLocation(const QByteArray &name, int location); + void bindAttributeLocation(const QString &name, int location); + int attributeLocation(const QByteArray &name) const; + int attributeLocation(const QString &name) const; + void setAttributeValue(int location, GLfloat value); + void setAttributeValue(int location, GLfloat x, GLfloat y); + void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z); + void setAttributeValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setAttributeValue(int location, const QVector2D &value); + void setAttributeValue(int location, const QVector3D &value); + void setAttributeValue(int location, const QVector4D &value); + void setAttributeValue(int location, const QColor &value); + void setAttributeValue(const char *name, GLfloat value); + void setAttributeValue(const char *name, GLfloat x, GLfloat y); + void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z); + void setAttributeValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setAttributeValue(const char *name, const QVector2D &value); + void setAttributeValue(const char *name, const QVector3D &value); + void setAttributeValue(const char *name, const QVector4D &value); + void setAttributeValue(const char *name, const QColor &value); + void setAttributeArray(int location, SIP_PYOBJECT values /TypeHint="PYQT_SHADER_ATTRIBUTE_ARRAY"/); +%MethodCode + const GLfloat *values; + int tsize; + + values = qpyopengl_attribute_array(a1, sipSelf, PyLong_FromLong(a0), &tsize, + &sipError); + + if (values) + sipCpp->setAttributeArray(a0, values, tsize); +%End + + void setAttributeArray(const char *name, SIP_PYOBJECT values /TypeHint="PYQT_SHADER_ATTRIBUTE_ARRAY"/); +%MethodCode + const GLfloat *values; + int tsize; + + values = qpyopengl_attribute_array(a1, sipSelf, PyBytes_FromString(a0), + &tsize, &sipError); + + if (values) + sipCpp->setAttributeArray(a0, values, tsize); +%End + + void setAttributeBuffer(int location, GLenum type, int offset, int tupleSize, int stride = 0); + void setAttributeBuffer(const char *name, GLenum type, int offset, int tupleSize, int stride = 0); + void enableAttributeArray(int location); + void enableAttributeArray(const char *name); + void disableAttributeArray(int location); + void disableAttributeArray(const char *name); + int uniformLocation(const QByteArray &name) const; + int uniformLocation(const QString &name) const; + void setUniformValue(int location, GLint value /Constrained/); + void setUniformValue(int location, GLfloat value /Constrained/); + void setUniformValue(int location, GLfloat x, GLfloat y); + void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z); + void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setUniformValue(int location, const QVector2D &value); + void setUniformValue(int location, const QVector3D &value); + void setUniformValue(int location, const QVector4D &value); + void setUniformValue(int location, const QColor &color); + void setUniformValue(int location, const QPoint &point); + void setUniformValue(int location, const QPointF &point); + void setUniformValue(int location, const QSize &size); + void setUniformValue(int location, const QSizeF &size); + void setUniformValue(int location, const QMatrix2x2 &value); + void setUniformValue(int location, const QMatrix2x3 &value); + void setUniformValue(int location, const QMatrix2x4 &value); + void setUniformValue(int location, const QMatrix3x2 &value); + void setUniformValue(int location, const QMatrix3x3 &value); + void setUniformValue(int location, const QMatrix3x4 &value); + void setUniformValue(int location, const QMatrix4x2 &value); + void setUniformValue(int location, const QMatrix4x3 &value); + void setUniformValue(int location, const QMatrix4x4 &value); + void setUniformValue(int location, const QTransform &value); + void setUniformValue(const char *name, GLint value /Constrained/); + void setUniformValue(const char *name, GLfloat value /Constrained/); + void setUniformValue(const char *name, GLfloat x, GLfloat y); + void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z); + void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void setUniformValue(const char *name, const QVector2D &value); + void setUniformValue(const char *name, const QVector3D &value); + void setUniformValue(const char *name, const QVector4D &value); + void setUniformValue(const char *name, const QColor &color); + void setUniformValue(const char *name, const QPoint &point); + void setUniformValue(const char *name, const QPointF &point); + void setUniformValue(const char *name, const QSize &size); + void setUniformValue(const char *name, const QSizeF &size); + void setUniformValue(const char *name, const QMatrix2x2 &value); + void setUniformValue(const char *name, const QMatrix2x3 &value); + void setUniformValue(const char *name, const QMatrix2x4 &value); + void setUniformValue(const char *name, const QMatrix3x2 &value); + void setUniformValue(const char *name, const QMatrix3x3 &value); + void setUniformValue(const char *name, const QMatrix3x4 &value); + void setUniformValue(const char *name, const QMatrix4x2 &value); + void setUniformValue(const char *name, const QMatrix4x3 &value); + void setUniformValue(const char *name, const QMatrix4x4 &value); + void setUniformValue(const char *name, const QTransform &value); + void setUniformValueArray(int location, SIP_PYOBJECT values /TypeHint="PYQT_SHADER_UNIFORM_VALUE_ARRAY"/); +%MethodCode + const void *values; + const sipTypeDef *array_type; + int array_len, tsize; + + values = qpyopengl_uniform_value_array(a1, sipSelf, PyLong_FromLong(a0), + &array_type, &array_len, &tsize, &sipError); + + if (values) + { + if (array_type == sipType_QVector2D) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QVector3D) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QVector4D) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix2x2) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix2x3) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix2x4) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix3x2) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix3x3) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix3x4) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix4x2) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix4x3) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix4x4) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len, tsize); + } +%End + + void setUniformValueArray(const char *name, SIP_PYOBJECT values /TypeHint="PYQT_SHADER_UNIFORM_VALUE_ARRAY"/); +%MethodCode + const void *values; + const sipTypeDef *array_type; + int array_len, tsize; + + values = qpyopengl_uniform_value_array(a1, sipSelf, PyBytes_FromString(a0), + &array_type, &array_len, &tsize, &sipError); + + if (values) + { + if (array_type == sipType_QVector2D) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QVector3D) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QVector4D) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix2x2) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix2x3) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix2x4) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix3x2) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix3x3) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix3x4) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix4x2) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix4x3) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else if (array_type == sipType_QMatrix4x4) + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len); + else + sipCpp->setUniformValueArray(a0, + reinterpret_cast(values), array_len, tsize); + } +%End + + static bool hasOpenGLShaderPrograms(QOpenGLContext *context = 0); + int maxGeometryOutputVertices() const; + void setPatchVertexCount(int count); + int patchVertexCount() const; + void setDefaultOuterTessellationLevels(const QList &levels); + QList defaultOuterTessellationLevels() const; + void setDefaultInnerTessellationLevels(const QList &levels); + QList defaultInnerTessellationLevels() const; + bool create(); + bool addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const QByteArray &source); + bool addCacheableShaderFromSourceCode(QOpenGLShader::ShaderType type, const QString &source); + bool addCacheableShaderFromSourceFile(QOpenGLShader::ShaderType type, const QString &fileName); +}; + +%ModuleHeaderCode +#include "qpyopengl_api.h" +%End + +%InitialisationCode +qpyopengl_init(); +%End + +%TypeHintCode +# Convenient aliases for complicated OpenGL types. +PYQT_OPENGL_ARRAY = typing.Union[typing.Sequence[int], typing.Sequence[float], + PyQt6.sip.Buffer, None] +PYQT_OPENGL_BOUND_ARRAY = typing.Union[typing.Sequence[int], + typing.Sequence[float], PyQt6.sip.Buffer, int, None] +PYQT_SHADER_ATTRIBUTE_ARRAY = typing.Union[typing.Sequence[QtGui.QVector2D], + typing.Sequence[QtGui.QVector3D], typing.Sequence[QtGui.QVector4D], + typing.Sequence[typing.Sequence[float]]] +PYQT_SHADER_UNIFORM_VALUE_ARRAY = typing.Union[ + typing.Sequence[QtGui.QVector2D], typing.Sequence[QtGui.QVector3D], + typing.Sequence[QtGui.QVector4D], typing.Sequence[QtGui.QMatrix2x2], + typing.Sequence[QtGui.QMatrix2x3], typing.Sequence[QtGui.QMatrix2x4], + typing.Sequence[QtGui.QMatrix3x2], typing.Sequence[QtGui.QMatrix3x3], + typing.Sequence[QtGui.QMatrix3x4], typing.Sequence[QtGui.QMatrix4x2], + typing.Sequence[QtGui.QMatrix4x3], typing.Sequence[QtGui.QMatrix4x4], + typing.Sequence[typing.Sequence[float]]] +%End diff --git a/sip/QtOpenGL/qopengltexture.sip b/sip/QtOpenGL/qopengltexture.sip new file mode 100644 index 0000000..369221a --- /dev/null +++ b/sip/QtOpenGL/qopengltexture.sip @@ -0,0 +1,462 @@ +// qopengltexture.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLTexture +{ +%TypeHeaderCode +#include +%End + +public: + enum Target + { + Target1D, + Target1DArray, + Target2D, + Target2DArray, + Target3D, + TargetCubeMap, + TargetCubeMapArray, + Target2DMultisample, + Target2DMultisampleArray, + TargetRectangle, + TargetBuffer, + }; + + enum BindingTarget + { + BindingTarget1D, + BindingTarget1DArray, + BindingTarget2D, + BindingTarget2DArray, + BindingTarget3D, + BindingTargetCubeMap, + BindingTargetCubeMapArray, + BindingTarget2DMultisample, + BindingTarget2DMultisampleArray, + BindingTargetRectangle, + BindingTargetBuffer, + }; + + enum MipMapGeneration + { + GenerateMipMaps, + DontGenerateMipMaps, + }; + + enum TextureUnitReset + { + ResetTextureUnit, + DontResetTextureUnit, + }; + + explicit QOpenGLTexture(QOpenGLTexture::Target target); + QOpenGLTexture(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = QOpenGLTexture::GenerateMipMaps); + ~QOpenGLTexture(); + bool create(); + void destroy(); + bool isCreated() const; + GLuint textureId() const; + void bind(); + void bind(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit); + void release(); + void release(uint unit, QOpenGLTexture::TextureUnitReset reset = QOpenGLTexture::DontResetTextureUnit); + bool isBound() const; + bool isBound(uint unit); + static GLuint boundTextureId(QOpenGLTexture::BindingTarget target); + static GLuint boundTextureId(uint unit, QOpenGLTexture::BindingTarget target); + + enum TextureFormat + { + NoFormat, + R8_UNorm, + RG8_UNorm, + RGB8_UNorm, + RGBA8_UNorm, + R16_UNorm, + RG16_UNorm, + RGB16_UNorm, + RGBA16_UNorm, + R8_SNorm, + RG8_SNorm, + RGB8_SNorm, + RGBA8_SNorm, + R16_SNorm, + RG16_SNorm, + RGB16_SNorm, + RGBA16_SNorm, + R8U, + RG8U, + RGB8U, + RGBA8U, + R16U, + RG16U, + RGB16U, + RGBA16U, + R32U, + RG32U, + RGB32U, + RGBA32U, + R8I, + RG8I, + RGB8I, + RGBA8I, + R16I, + RG16I, + RGB16I, + RGBA16I, + R32I, + RG32I, + RGB32I, + RGBA32I, + R16F, + RG16F, + RGB16F, + RGBA16F, + R32F, + RG32F, + RGB32F, + RGBA32F, + RGB9E5, + RG11B10F, + RG3B2, + R5G6B5, + RGB5A1, + RGBA4, + RGB10A2, + D16, + D24, + D24S8, + D32, + D32F, + D32FS8X24, + RGB_DXT1, + RGBA_DXT1, + RGBA_DXT3, + RGBA_DXT5, + R_ATI1N_UNorm, + R_ATI1N_SNorm, + RG_ATI2N_UNorm, + RG_ATI2N_SNorm, + RGB_BP_UNSIGNED_FLOAT, + RGB_BP_SIGNED_FLOAT, + RGB_BP_UNorm, + SRGB8, + SRGB8_Alpha8, + SRGB_DXT1, + SRGB_Alpha_DXT1, + SRGB_Alpha_DXT3, + SRGB_Alpha_DXT5, + SRGB_BP_UNorm, + DepthFormat, + AlphaFormat, + RGBFormat, + RGBAFormat, + LuminanceFormat, + LuminanceAlphaFormat, + S8, + R11_EAC_UNorm, + R11_EAC_SNorm, + RG11_EAC_UNorm, + RG11_EAC_SNorm, + RGB8_ETC2, + SRGB8_ETC2, + RGB8_PunchThrough_Alpha1_ETC2, + SRGB8_PunchThrough_Alpha1_ETC2, + RGBA8_ETC2_EAC, + SRGB8_Alpha8_ETC2_EAC, + RGB8_ETC1, + RGBA_ASTC_4x4, + RGBA_ASTC_5x4, + RGBA_ASTC_5x5, + RGBA_ASTC_6x5, + RGBA_ASTC_6x6, + RGBA_ASTC_8x5, + RGBA_ASTC_8x6, + RGBA_ASTC_8x8, + RGBA_ASTC_10x5, + RGBA_ASTC_10x6, + RGBA_ASTC_10x8, + RGBA_ASTC_10x10, + RGBA_ASTC_12x10, + RGBA_ASTC_12x12, + SRGB8_Alpha8_ASTC_4x4, + SRGB8_Alpha8_ASTC_5x4, + SRGB8_Alpha8_ASTC_5x5, + SRGB8_Alpha8_ASTC_6x5, + SRGB8_Alpha8_ASTC_6x6, + SRGB8_Alpha8_ASTC_8x5, + SRGB8_Alpha8_ASTC_8x6, + SRGB8_Alpha8_ASTC_8x8, + SRGB8_Alpha8_ASTC_10x5, + SRGB8_Alpha8_ASTC_10x6, + SRGB8_Alpha8_ASTC_10x8, + SRGB8_Alpha8_ASTC_10x10, + SRGB8_Alpha8_ASTC_12x10, + SRGB8_Alpha8_ASTC_12x12, + }; + + void setFormat(QOpenGLTexture::TextureFormat format); + QOpenGLTexture::TextureFormat format() const; + void setSize(int width, int height = 1, int depth = 1); + int width() const; + int height() const; + int depth() const; + void setMipLevels(int levels); + int mipLevels() const; + int maximumMipLevels() const; + void setLayers(int layers); + int layers() const; + int faces() const; + void allocateStorage(); + void allocateStorage(QOpenGLTexture::PixelFormat pixelFormat, QOpenGLTexture::PixelType pixelType); + bool isStorageAllocated() const; + QOpenGLTexture *createTextureView(QOpenGLTexture::Target target, QOpenGLTexture::TextureFormat viewFormat, int minimumMipmapLevel, int maximumMipmapLevel, int minimumLayer, int maximumLayer) const /Factory/; + bool isTextureView() const; + + enum CubeMapFace + { + CubeMapPositiveX, + CubeMapNegativeX, + CubeMapPositiveY, + CubeMapNegativeY, + CubeMapPositiveZ, + CubeMapNegativeZ, + }; + + enum PixelFormat + { + NoSourceFormat, + Red, + RG, + RGB, + BGR, + RGBA, + BGRA, + Red_Integer, + RG_Integer, + RGB_Integer, + BGR_Integer, + RGBA_Integer, + BGRA_Integer, + Depth, + DepthStencil, + Alpha, + Luminance, + LuminanceAlpha, + Stencil, + }; + + enum PixelType + { + NoPixelType, + Int8, + UInt8, + Int16, + UInt16, + Int32, + UInt32, + Float16, + Float16OES, + Float32, + UInt32_RGB9_E5, + UInt32_RG11B10F, + UInt8_RG3B2, + UInt8_RG3B2_Rev, + UInt16_RGB5A1, + UInt16_RGB5A1_Rev, + UInt16_R5G6B5, + UInt16_R5G6B5_Rev, + UInt16_RGBA4, + UInt16_RGBA4_Rev, + UInt32_RGB10A2, + UInt32_RGB10A2_Rev, + UInt32_RGBA8, + UInt32_RGBA8_Rev, + UInt32_D24S8, + Float32_D32_UInt32_S8_X24, + }; + + void setData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setData(int mipLevel, int layer, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setData(int mipLevel, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setData(QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setData(const QImage &image, QOpenGLTexture::MipMapGeneration genMipMaps = QOpenGLTexture::GenerateMipMaps); + void setCompressedData(int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setCompressedData(int mipLevel, int layer, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setCompressedData(int mipLevel, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setCompressedData(int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + + enum Feature /BaseType=Flag/ + { + ImmutableStorage, + ImmutableMultisampleStorage, + TextureRectangle, + TextureArrays, + Texture3D, + TextureMultisample, + TextureBuffer, + TextureCubeMapArrays, + Swizzle, + StencilTexturing, + AnisotropicFiltering, + NPOTTextures, + NPOTTextureRepeat, + Texture1D, + TextureComparisonOperators, + TextureMipMapLevel, + }; + + typedef QFlags Features; + static bool hasFeature(QOpenGLTexture::Feature feature); + void setMipBaseLevel(int baseLevel); + int mipBaseLevel() const; + void setMipMaxLevel(int maxLevel); + int mipMaxLevel() const; + void setMipLevelRange(int baseLevel, int maxLevel); + std::pair mipLevelRange() const; + void setAutoMipMapGenerationEnabled(bool enabled); + bool isAutoMipMapGenerationEnabled() const; + void generateMipMaps(); + void generateMipMaps(int baseLevel, bool resetBaseLevel = true); + + enum SwizzleComponent + { + SwizzleRed, + SwizzleGreen, + SwizzleBlue, + SwizzleAlpha, + }; + + enum SwizzleValue + { + RedValue, + GreenValue, + BlueValue, + AlphaValue, + ZeroValue, + OneValue, + }; + + void setSwizzleMask(QOpenGLTexture::SwizzleComponent component, QOpenGLTexture::SwizzleValue value); + void setSwizzleMask(QOpenGLTexture::SwizzleValue r, QOpenGLTexture::SwizzleValue g, QOpenGLTexture::SwizzleValue b, QOpenGLTexture::SwizzleValue a); + QOpenGLTexture::SwizzleValue swizzleMask(QOpenGLTexture::SwizzleComponent component) const; + + enum DepthStencilMode + { + DepthMode, + StencilMode, + }; + + void setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode); + QOpenGLTexture::DepthStencilMode depthStencilMode() const; + + enum Filter + { + Nearest, + Linear, + NearestMipMapNearest, + NearestMipMapLinear, + LinearMipMapNearest, + LinearMipMapLinear, + }; + + void setMinificationFilter(QOpenGLTexture::Filter filter); + QOpenGLTexture::Filter minificationFilter() const; + void setMagnificationFilter(QOpenGLTexture::Filter filter); + QOpenGLTexture::Filter magnificationFilter() const; + void setMinMagFilters(QOpenGLTexture::Filter minificationFilter, QOpenGLTexture::Filter magnificationFilter); + std::pair minMagFilters() const; + void setMaximumAnisotropy(float anisotropy); + float maximumAnisotropy() const; + + enum WrapMode + { + Repeat, + MirroredRepeat, + ClampToEdge, + ClampToBorder, + }; + + enum CoordinateDirection + { + DirectionS, + DirectionT, + DirectionR, + }; + + void setWrapMode(QOpenGLTexture::WrapMode mode); + void setWrapMode(QOpenGLTexture::CoordinateDirection direction, QOpenGLTexture::WrapMode mode); + QOpenGLTexture::WrapMode wrapMode(QOpenGLTexture::CoordinateDirection direction) const; + void setBorderColor(const QColor &color); + QColor borderColor() const; + void setMinimumLevelOfDetail(float value); + float minimumLevelOfDetail() const; + void setMaximumLevelOfDetail(float value); + float maximumLevelOfDetail() const; + void setLevelOfDetailRange(float min, float max); + std::pair levelOfDetailRange() const; + void setLevelofDetailBias(float bias); + float levelofDetailBias() const; + QOpenGLTexture::Target target() const; + void setSamples(int samples); + int samples() const; + void setFixedSamplePositions(bool fixed); + bool isFixedSamplePositions() const; + + enum ComparisonFunction + { + CompareLessEqual, + CompareGreaterEqual, + CompareLess, + CompareGreater, + CompareEqual, + CommpareNotEqual, + CompareAlways, + CompareNever, +%If (Qt_6_1_0 -) + CompareNotEqual, +%End + }; + + void setComparisonFunction(QOpenGLTexture::ComparisonFunction function); + QOpenGLTexture::ComparisonFunction comparisonFunction() const; + + enum ComparisonMode + { + CompareRefToTexture, + CompareNone, + }; + + void setComparisonMode(QOpenGLTexture::ComparisonMode mode); + QOpenGLTexture::ComparisonMode comparisonMode() const; + void setData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setCompressedData(int mipLevel, int layer, int layerCount, QOpenGLTexture::CubeMapFace cubeFace, int dataSize, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + void setData(int xOffset, int yOffset, int zOffset, int width, int height, int depth, int mipLevel, int layer, QOpenGLTexture::CubeMapFace cubeFace, int layerCount, QOpenGLTexture::PixelFormat sourceFormat, QOpenGLTexture::PixelType sourceType, const void *data, const QOpenGLPixelTransferOptions * const options = 0); + +private: + QOpenGLTexture(const QOpenGLTexture &); +}; diff --git a/sip/QtOpenGL/qopengltextureblitter.sip b/sip/QtOpenGL/qopengltextureblitter.sip new file mode 100644 index 0000000..a38e71a --- /dev/null +++ b/sip/QtOpenGL/qopengltextureblitter.sip @@ -0,0 +1,57 @@ +// qopengltextureblitter.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLTextureBlitter +{ +%TypeHeaderCode +#include +%End + +public: + QOpenGLTextureBlitter(); + ~QOpenGLTextureBlitter(); + + enum Origin + { + OriginBottomLeft, + OriginTopLeft, + }; + + bool create(); + bool isCreated() const; + void destroy(); + bool supportsExternalOESTarget() const; + void bind(GLenum target = GL_TEXTURE_2D); + void release(); + void setRedBlueSwizzle(bool swizzle); + void setOpacity(float opacity); + void blit(GLuint texture, const QMatrix4x4 &targetTransform, QOpenGLTextureBlitter::Origin sourceOrigin); + void blit(GLuint texture, const QMatrix4x4 &targetTransform, const QMatrix3x3 &sourceTransform); + static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport); + static QMatrix3x3 sourceTransform(const QRectF &subTexture, const QSize &textureSize, QOpenGLTextureBlitter::Origin origin); +%If (Qt_6_3_0 -) + bool supportsRectangleTarget() const; +%End + +private: + QOpenGLTextureBlitter(const QOpenGLTextureBlitter &); +}; diff --git a/sip/QtOpenGL/qopengltimerquery.sip b/sip/QtOpenGL/qopengltimerquery.sip new file mode 100644 index 0000000..21f8a08 --- /dev/null +++ b/sip/QtOpenGL/qopengltimerquery.sip @@ -0,0 +1,71 @@ +// qopengltimerquery.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (!PyQt_OpenGL_ES2) + +class QOpenGLTimerQuery : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QOpenGLTimerQuery(QObject *parent /TransferThis/ = 0); + virtual ~QOpenGLTimerQuery(); + bool create(); + void destroy(); + bool isCreated() const; + GLuint objectId() const; + void begin(); + void end(); + GLuint64 waitForTimestamp() const /ReleaseGIL/; + void recordTimestamp(); + bool isResultAvailable() const; + GLuint64 waitForResult() const /ReleaseGIL/; +}; + +%End +%If (!PyQt_OpenGL_ES2) + +class QOpenGLTimeMonitor : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QOpenGLTimeMonitor(QObject *parent /TransferThis/ = 0); + virtual ~QOpenGLTimeMonitor(); + void setSampleCount(int sampleCount); + int sampleCount() const; + bool create(); + void destroy(); + bool isCreated() const; + QList objectIds() const; + int recordSample(); + bool isResultAvailable() const; + QList waitForSamples() const /ReleaseGIL/; + QList waitForIntervals() const /ReleaseGIL/; + void reset(); +}; + +%End diff --git a/sip/QtOpenGL/qopenglversionfunctions.sip b/sip/QtOpenGL/qopenglversionfunctions.sip new file mode 100644 index 0000000..e8d058d --- /dev/null +++ b/sip/QtOpenGL/qopenglversionfunctions.sip @@ -0,0 +1,30 @@ +// qopenglversionfunctions.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractOpenGLFunctions /NoDefaultCtors,Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + + QAbstractOpenGLFunctions(const QAbstractOpenGLFunctions &); +}; diff --git a/sip/QtOpenGL/qopenglversionfunctionsfactory.sip b/sip/QtOpenGL/qopenglversionfunctionsfactory.sip new file mode 100644 index 0000000..3274d1c --- /dev/null +++ b/sip/QtOpenGL/qopenglversionfunctionsfactory.sip @@ -0,0 +1,34 @@ +// qopenglversionfunctionsfactory.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLVersionFunctionsFactory +{ +%TypeHeaderCode +#include +%End + +public: + static SIP_PYOBJECT get(const QOpenGLVersionProfile &versionProfile = QOpenGLVersionProfile(), QOpenGLContext *context /GetWrapper/ = 0) /TypeHint="QAbstractOpenGLFunctions"/; +%MethodCode + sipRes = qpyopengl_version_functions(*a0, a1, a1Wrapper); +%End +}; diff --git a/sip/QtOpenGL/qopenglversionprofile.sip b/sip/QtOpenGL/qopenglversionprofile.sip new file mode 100644 index 0000000..b40347f --- /dev/null +++ b/sip/QtOpenGL/qopenglversionprofile.sip @@ -0,0 +1,48 @@ +// qopenglversionprofile.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLVersionProfile +{ +%TypeHeaderCode +#include +%End + +public: + QOpenGLVersionProfile(); + explicit QOpenGLVersionProfile(const QSurfaceFormat &format); + QOpenGLVersionProfile(const QOpenGLVersionProfile &other); + ~QOpenGLVersionProfile(); + std::pair version() const; + void setVersion(int majorVersion, int minorVersion); + QSurfaceFormat::OpenGLContextProfile profile() const; + void setProfile(QSurfaceFormat::OpenGLContextProfile profile); + bool hasProfiles() const; + bool isLegacyVersion() const; + bool isValid() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +bool operator==(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs); +bool operator!=(const QOpenGLVersionProfile &lhs, const QOpenGLVersionProfile &rhs); diff --git a/sip/QtOpenGL/qopenglvertexarrayobject.sip b/sip/QtOpenGL/qopenglvertexarrayobject.sip new file mode 100644 index 0000000..60d1056 --- /dev/null +++ b/sip/QtOpenGL/qopenglvertexarrayobject.sip @@ -0,0 +1,65 @@ +// qopenglvertexarrayobject.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLVertexArrayObject : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QOpenGLVertexArrayObject(QObject *parent /TransferThis/ = 0); + virtual ~QOpenGLVertexArrayObject(); + bool create(); + void destroy(); + bool isCreated() const; + GLuint objectId() const; + void bind(); + void release(); + + class Binder + { +%TypeHeaderCode +#include +%End + + public: + Binder(QOpenGLVertexArrayObject *v); + ~Binder(); + void release(); + void rebind(); + SIP_PYOBJECT __enter__(); +%MethodCode + // Just return a reference to self. + sipRes = sipSelf; + Py_INCREF(sipRes); +%End + + void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback); +%MethodCode + sipCpp->release(); +%End + + private: + Binder(const QOpenGLVertexArrayObject::Binder &); + }; +}; diff --git a/sip/QtOpenGL/qopenglwindow.sip b/sip/QtOpenGL/qopenglwindow.sip new file mode 100644 index 0000000..7f71f8e --- /dev/null +++ b/sip/QtOpenGL/qopenglwindow.sip @@ -0,0 +1,61 @@ +// qopenglwindow.sip generated by MetaSIP +// +// This file is part of the QtOpenGL Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLWindow : QPaintDeviceWindow +{ +%TypeHeaderCode +#include +%End + +public: + enum UpdateBehavior + { + NoPartialUpdate, + PartialUpdateBlit, + PartialUpdateBlend, + }; + + QOpenGLWindow(QOpenGLWindow::UpdateBehavior updateBehavior = QOpenGLWindow::NoPartialUpdate, QWindow *parent /TransferThis/ = 0); + QOpenGLWindow(QOpenGLContext *shareContext, QOpenGLWindow::UpdateBehavior updateBehavior = QOpenGLWindow::NoPartialUpdate, QWindow *parent /TransferThis/ = 0); + virtual ~QOpenGLWindow(); + QOpenGLWindow::UpdateBehavior updateBehavior() const; + bool isValid() const; + void makeCurrent(); + void doneCurrent(); + QOpenGLContext *context() const; + GLuint defaultFramebufferObject() const; + QImage grabFramebuffer(); + QOpenGLContext *shareContext() const; + +signals: + void frameSwapped(); + +protected: + virtual void initializeGL(); + virtual void resizeGL(int w, int h); + virtual void paintGL(); + virtual void paintUnderGL(); + virtual void paintOverGL(); + virtual void paintEvent(QPaintEvent *event); + virtual void resizeEvent(QResizeEvent *event); + virtual int metric(QPaintDevice::PaintDeviceMetric metric) const; +}; diff --git a/sip/QtOpenGL/qpyopengl_qlist.sip b/sip/QtOpenGL/qpyopengl_qlist.sip new file mode 100644 index 0000000..95acd32 --- /dev/null +++ b/sip/QtOpenGL/qpyopengl_qlist.sip @@ -0,0 +1,129 @@ +// This is the SIP interface definition for the QList based mapped types +// specific to the QtOpenGL module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (!PyQt_OpenGL_ES2) + + +%MappedType QList + /TypeHintIn="Iterable[int]", TypeHintOut="List[int]", + TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + // Convert to a Python long to make sure it doesn't get interpreted as + // a signed value. + PyObject *pobj = PyLong_FromUnsignedLongLong(sipCpp->value(i)); + + if (!pobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, pobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *qv = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + PyErr_Clear(); + unsigned long long val = PyLong_AsUnsignedLongLongMask(itm); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'int' is expected", i, + sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete qv; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + qv->append(val); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = qv; + + return sipGetState(sipTransferObj); +%End +}; + + +%End diff --git a/sip/QtOpenGL/qpyopengl_std_pair.sip b/sip/QtOpenGL/qpyopengl_std_pair.sip new file mode 100644 index 0000000..7bfcf53 --- /dev/null +++ b/sip/QtOpenGL/qpyopengl_std_pair.sip @@ -0,0 +1,111 @@ +// This is the SIP interface definition for the std::pair based mapped types +// specific to the QtGui module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType std::pair + /TypeHint="Tuple[QOpenGLTexture.Filter, QOpenGLTexture.Filter]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + return sipBuildResult(NULL, "(FF)", sipCpp->first, + sipType_QOpenGLTexture_Filter, sipCpp->second, + sipType_QOpenGLTexture_Filter); +%End + +%ConvertToTypeCode + if (!sipIsErr) + return (PySequence_Check(sipPy) && !PyUnicode_Check(sipPy)); + + Py_ssize_t len = PySequence_Size(sipPy); + + if (len != 2) + { + // A negative length should only be an internal error so let the + // original exception stand. + if (len >= 0) + PyErr_Format(PyExc_TypeError, + "sequence has %zd elements but 2 elements are expected", + len); + + *sipIsErr = 1; + + return 0; + } + + PyObject *firstobj = PySequence_GetItem(sipPy, 0); + + if (!firstobj) + { + *sipIsErr = 1; + + return 0; + } + + int firstv = sipConvertToEnum(firstobj, sipType_QOpenGLTexture_Filter); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "the first element has type '%s' but 'QOpenGLTexture.Filter' is expected", + sipPyTypeName(Py_TYPE(firstobj))); + + *sipIsErr = 1; + + return 0; + } + + PyObject *secondobj = PySequence_GetItem(sipPy, 1); + + if (!secondobj) + { + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + int secondv = sipConvertToEnum(secondobj, sipType_QOpenGLTexture_Filter); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "the second element has type '%s' but 'QOpenGLTexture.Filter' is expected", + sipPyTypeName(Py_TYPE(secondobj))); + + Py_DECREF(secondobj); + Py_DECREF(firstobj); + *sipIsErr = 1; + + return 0; + } + + *sipCppPtr = new std::pair( + static_cast(firstv), + static_cast(secondv)); + + Py_DECREF(secondobj); + Py_DECREF(firstobj); + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtOpenGLWidgets/QtOpenGLWidgetsmod.sip b/sip/QtOpenGLWidgets/QtOpenGLWidgetsmod.sip new file mode 100644 index 0000000..1e9f130 --- /dev/null +++ b/sip/QtOpenGLWidgets/QtOpenGLWidgetsmod.sip @@ -0,0 +1,51 @@ +// QtOpenGLWidgetsmod.sip generated by MetaSIP +// +// This file is part of the QtOpenGLWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtOpenGLWidgets, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtOpenGL/QtOpenGLmod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qopenglwidget.sip diff --git a/sip/QtOpenGLWidgets/qopenglwidget.sip b/sip/QtOpenGLWidgets/qopenglwidget.sip new file mode 100644 index 0000000..f3336ba --- /dev/null +++ b/sip/QtOpenGLWidgets/qopenglwidget.sip @@ -0,0 +1,117 @@ +// qopenglwidget.sip generated by MetaSIP +// +// This file is part of the QtOpenGLWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QOpenGLWidget, &sipType_QOpenGLWidget, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + QOpenGLWidget(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QOpenGLWidget(); + void setFormat(const QSurfaceFormat &format); + QSurfaceFormat format() const; + bool isValid() const; + void makeCurrent(); +%If (Qt_6_5_0 -) + void makeCurrent(QOpenGLWidget::TargetBuffer targetBuffer); +%End + void doneCurrent(); + QOpenGLContext *context() const; + GLuint defaultFramebufferObject() const; +%If (Qt_6_5_0 -) + GLuint defaultFramebufferObject(QOpenGLWidget::TargetBuffer targetBuffer) const; +%End + QImage grabFramebuffer(); +%If (Qt_6_5_0 -) + QImage grabFramebuffer(QOpenGLWidget::TargetBuffer targetBuffer); +%End + +signals: + void aboutToCompose(); + void frameSwapped(); + void aboutToResize(); + void resized(); + +protected: + virtual void initializeGL(); + virtual void resizeGL(int w, int h); + virtual void paintGL(); + virtual void paintEvent(QPaintEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual bool event(QEvent *e); + virtual int metric(QPaintDevice::PaintDeviceMetric metric) const; + virtual QPaintEngine *paintEngine() const; + +public: + enum UpdateBehavior + { + NoPartialUpdate, + PartialUpdate, + }; + + void setUpdateBehavior(QOpenGLWidget::UpdateBehavior updateBehavior); + QOpenGLWidget::UpdateBehavior updateBehavior() const; + GLenum textureFormat() const; + void setTextureFormat(GLenum texFormat); +%If (Qt_6_5_0 -) + + enum TargetBuffer + { + LeftBuffer, + RightBuffer, + }; + +%End +%If (Qt_6_5_0 -) + QOpenGLWidget::TargetBuffer currentTargetBuffer() const; +%End +}; diff --git a/sip/QtPdf/QtPdfmod.sip b/sip/QtPdf/QtPdfmod.sip new file mode 100644 index 0000000..4fa2d53 --- /dev/null +++ b/sip/QtPdf/QtPdfmod.sip @@ -0,0 +1,56 @@ +// QtPdfmod.sip generated by MetaSIP +// +// This file is part of the QtPdf Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtPdf, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qpdfbookmarkmodel.sip +%Include qpdfdocument.sip +%Include qpdfdocumentrenderoptions.sip +%Include qpdflink.sip +%Include qpdfpagenavigator.sip +%Include qpdfpagerenderer.sip +%Include qpdfsearchmodel.sip +%Include qpdfselection.sip diff --git a/sip/QtPdf/qpdfbookmarkmodel.sip b/sip/QtPdf/qpdfbookmarkmodel.sip new file mode 100644 index 0000000..79ced8f --- /dev/null +++ b/sip/QtPdf/qpdfbookmarkmodel.sip @@ -0,0 +1,52 @@ +// qpdfbookmarkmodel.sip generated by MetaSIP +// +// This file is part of the QtPdf Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfBookmarkModel : QAbstractItemModel +{ +%TypeHeaderCode +#include +%End + +public: + enum class Role /BaseType=IntEnum/ + { + Title, + Level, + Page, + Location, + Zoom, + }; + + explicit QPdfBookmarkModel(QObject *parent /TransferThis/); + virtual ~QPdfBookmarkModel(); + QPdfDocument *document() const; + void setDocument(QPdfDocument *document); + virtual QVariant data(const QModelIndex &index, int role) const; + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex parent(const QModelIndex &index) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual QHash roleNames() const; + +signals: + void documentChanged(QPdfDocument *document); +}; diff --git a/sip/QtPdf/qpdfdocument.sip b/sip/QtPdf/qpdfdocument.sip new file mode 100644 index 0000000..4864b6f --- /dev/null +++ b/sip/QtPdf/qpdfdocument.sip @@ -0,0 +1,124 @@ +// qpdfdocument.sip generated by MetaSIP +// +// This file is part of the QtPdf Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfDocument : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QPdfBookmarkModel, &sipType_QPdfBookmarkModel, -1, 1}, + {sipName_QPdfDocument, &sipType_QPdfDocument, -1, 2}, + {sipName_QPdfPageNavigator, &sipType_QPdfPageNavigator, -1, 3}, + {sipName_QPdfPageRenderer, &sipType_QPdfPageRenderer, -1, 4}, + {sipName_QPdfSearchModel, &sipType_QPdfSearchModel, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum class Status + { + Null, + Loading, + Ready, + Unloading, + Error, + }; + + enum class Error + { + None, + Unknown, + DataNotYetAvailable, + FileNotFound, + InvalidFileFormat, + IncorrectPassword, + UnsupportedSecurityScheme, + }; + + enum class MetaDataField + { + Title, + Subject, + Author, + Keywords, + Producer, + Creator, + CreationDate, + ModificationDate, + }; + + enum class PageModelRole /BaseType=IntEnum/ + { + Label, + PointSize, + }; + + explicit QPdfDocument(QObject *parent /TransferThis/); + virtual ~QPdfDocument(); + QPdfDocument::Error load(const QString &fileName) /ReleaseGIL/; + void load(QIODevice *device) /ReleaseGIL/; + QPdfDocument::Status status() const; + void setPassword(const QString &password); + QString password() const; + QVariant metaData(QPdfDocument::MetaDataField field) const; + QPdfDocument::Error error() const; + void close(); + int pageCount() const; + QSizeF pagePointSize(int page) const; + QString pageLabel(int page); + QAbstractListModel *pageModel(); + QImage render(int page, QSize imageSize, QPdfDocumentRenderOptions options = QPdfDocumentRenderOptions()); + QPdfSelection getSelection(int page, QPointF start, QPointF end); + QPdfSelection getSelectionAtIndex(int page, int startIndex, int maxLength); + QPdfSelection getAllText(int page); + +signals: + void passwordChanged(); + void statusChanged(QPdfDocument::Status status); + void pageCountChanged(int pageCount); + void pageModelChanged(); +}; diff --git a/sip/QtPdf/qpdfdocumentrenderoptions.sip b/sip/QtPdf/qpdfdocumentrenderoptions.sip new file mode 100644 index 0000000..9a1e766 --- /dev/null +++ b/sip/QtPdf/qpdfdocumentrenderoptions.sip @@ -0,0 +1,63 @@ +// qpdfdocumentrenderoptions.sip generated by MetaSIP +// +// This file is part of the QtPdf Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfDocumentRenderOptions +{ +%TypeHeaderCode +#include +%End + +public: + enum class Rotation + { + None, + Clockwise90, + Clockwise180, + Clockwise270, + }; + + enum class RenderFlag + { + None, + Annotations, + OptimizedForLcd, + Grayscale, + ForceHalftone, + TextAliased, + ImageAliased, + PathAliased, + }; + + typedef QFlags RenderFlags; + QPdfDocumentRenderOptions(); + QPdfDocumentRenderOptions::Rotation rotation() const; + void setRotation(QPdfDocumentRenderOptions::Rotation r); + QPdfDocumentRenderOptions::RenderFlags renderFlags() const; + void setRenderFlags(QPdfDocumentRenderOptions::RenderFlags r); + QRect scaledClipRect() const; + void setScaledClipRect(const QRect &r); + QSize scaledSize() const; + void setScaledSize(const QSize &s); +}; + +bool operator==(const QPdfDocumentRenderOptions &lhs, const QPdfDocumentRenderOptions &rhs); +bool operator!=(const QPdfDocumentRenderOptions &lhs, const QPdfDocumentRenderOptions &rhs); diff --git a/sip/QtPdf/qpdflink.sip b/sip/QtPdf/qpdflink.sip new file mode 100644 index 0000000..6806787 --- /dev/null +++ b/sip/QtPdf/qpdflink.sip @@ -0,0 +1,44 @@ +// qpdflink.sip generated by MetaSIP +// +// This file is part of the QtPdf Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfLink +{ +%TypeHeaderCode +#include +%End + +public: + QPdfLink(); + QPdfLink(const QPdfLink &other); + ~QPdfLink(); + void swap(QPdfLink &other); + bool isValid() const; + int page() const; + QPointF location() const; + qreal zoom() const; + QUrl url() const; + QString contextBefore() const; + QString contextAfter() const; + QList rectangles() const; + QString toString() const; + void copyToClipboard(QClipboard::Mode mode = QClipboard::Clipboard) const; +}; diff --git a/sip/QtPdf/qpdfpagenavigator.sip b/sip/QtPdf/qpdfpagenavigator.sip new file mode 100644 index 0000000..75da4ee --- /dev/null +++ b/sip/QtPdf/qpdfpagenavigator.sip @@ -0,0 +1,53 @@ +// qpdfpagenavigator.sip generated by MetaSIP +// +// This file is part of the QtPdf Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfPageNavigator : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QPdfPageNavigator(QObject *parent /TransferThis/); + virtual ~QPdfPageNavigator(); + int currentPage() const; + QPointF currentLocation() const; + qreal currentZoom() const; + bool backAvailable() const; + bool forwardAvailable() const; + +public slots: + void clear(); + void jump(QPdfLink destination); + void jump(int page, const QPointF &location, qreal zoom = 0); + void update(int page, const QPointF &location, qreal zoom); + void forward(); + void back(); + +signals: + void currentPageChanged(int page); + void currentLocationChanged(QPointF location); + void currentZoomChanged(qreal zoom); + void backAvailableChanged(bool available); + void forwardAvailableChanged(bool available); + void jumped(QPdfLink current); +}; diff --git a/sip/QtPdf/qpdfpagerenderer.sip b/sip/QtPdf/qpdfpagerenderer.sip new file mode 100644 index 0000000..bee8c14 --- /dev/null +++ b/sip/QtPdf/qpdfpagerenderer.sip @@ -0,0 +1,47 @@ +// qpdfpagerenderer.sip generated by MetaSIP +// +// This file is part of the QtPdf Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfPageRenderer : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum class RenderMode + { + MultiThreaded, + SingleThreaded, + }; + + explicit QPdfPageRenderer(QObject *parent /TransferThis/); + virtual ~QPdfPageRenderer(); + QPdfPageRenderer::RenderMode renderMode() const; + void setRenderMode(QPdfPageRenderer::RenderMode mode); + QPdfDocument *document() const; + void setDocument(QPdfDocument *document); + quint64 requestPage(int pageNumber, QSize imageSize, QPdfDocumentRenderOptions options = QPdfDocumentRenderOptions()); + +signals: + void documentChanged(QPdfDocument *document); + void renderModeChanged(QPdfPageRenderer::RenderMode renderMode); +}; diff --git a/sip/QtPdf/qpdfsearchmodel.sip b/sip/QtPdf/qpdfsearchmodel.sip new file mode 100644 index 0000000..46495f9 --- /dev/null +++ b/sip/QtPdf/qpdfsearchmodel.sip @@ -0,0 +1,59 @@ +// qpdfsearchmodel.sip generated by MetaSIP +// +// This file is part of the QtPdf Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfSearchModel : QAbstractListModel +{ +%TypeHeaderCode +#include +%End + +public: + enum class Role /BaseType=IntEnum/ + { + Page, + IndexOnPage, + Location, + ContextBefore, + ContextAfter, + }; + + explicit QPdfSearchModel(QObject *parent /TransferThis/); + virtual ~QPdfSearchModel(); + QList resultsOnPage(int page) const; + QPdfLink resultAtIndex(int index) const; + QPdfDocument *document() const; + QString searchString() const; + virtual QHash roleNames() const; + virtual int rowCount(const QModelIndex &parent) const; + virtual QVariant data(const QModelIndex &index, int role) const; + +public slots: + void setSearchString(const QString &searchString); + void setDocument(QPdfDocument *document); + +signals: + void documentChanged(); + void searchStringChanged(); + +protected: + virtual void timerEvent(QTimerEvent *event); +}; diff --git a/sip/QtPdf/qpdfselection.sip b/sip/QtPdf/qpdfselection.sip new file mode 100644 index 0000000..2626842 --- /dev/null +++ b/sip/QtPdf/qpdfselection.sip @@ -0,0 +1,43 @@ +// qpdfselection.sip generated by MetaSIP +// +// This file is part of the QtPdf Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfSelection +{ +%TypeHeaderCode +#include +%End + +public: + QPdfSelection(const QPdfSelection &other); + ~QPdfSelection(); + void swap(QPdfSelection &other); + bool isValid() const; + QList bounds() const; + QString text() const; + QRectF boundingRectangle() const; + int startIndex() const; + int endIndex() const; + void copyToClipboard(QClipboard::Mode mode = QClipboard::Clipboard) const; + +private: + QPdfSelection(); +}; diff --git a/sip/QtPdfWidgets/QtPdfWidgetsmod.sip b/sip/QtPdfWidgets/QtPdfWidgetsmod.sip new file mode 100644 index 0000000..6ed934a --- /dev/null +++ b/sip/QtPdfWidgets/QtPdfWidgetsmod.sip @@ -0,0 +1,50 @@ +// QtPdfWidgetsmod.sip generated by MetaSIP +// +// This file is part of the QtPdfWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtPdfWidgets, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtPdf/QtPdfmod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qpdfview.sip diff --git a/sip/QtPdfWidgets/qpdfview.sip b/sip/QtPdfWidgets/qpdfview.sip new file mode 100644 index 0000000..911f468 --- /dev/null +++ b/sip/QtPdfWidgets/qpdfview.sip @@ -0,0 +1,101 @@ +// qpdfview.sip generated by MetaSIP +// +// This file is part of the QtPdfWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPdfView : QAbstractScrollArea +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QPdfView, &sipType_QPdfView, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum class PageMode + { + SinglePage, + MultiPage, + }; + + enum class ZoomMode + { + Custom, + FitToWidth, + FitInView, + }; + + explicit QPdfView(QWidget *parent /TransferThis/); + virtual ~QPdfView(); + void setDocument(QPdfDocument *document); + QPdfDocument *document() const; + QPdfPageNavigator *pageNavigator() const; + QPdfView::PageMode pageMode() const; + QPdfView::ZoomMode zoomMode() const; + qreal zoomFactor() const; + int pageSpacing() const; + void setPageSpacing(int spacing); + QMargins documentMargins() const; + void setDocumentMargins(QMargins margins); + +public slots: + void setPageMode(QPdfView::PageMode mode); + void setZoomMode(QPdfView::ZoomMode mode); + void setZoomFactor(qreal factor); + +signals: + void documentChanged(QPdfDocument *document); + void pageModeChanged(QPdfView::PageMode pageMode); + void zoomModeChanged(QPdfView::ZoomMode zoomMode); + void zoomFactorChanged(qreal zoomFactor); + void pageSpacingChanged(int pageSpacing); + void documentMarginsChanged(QMargins documentMargins); + +protected: + virtual void paintEvent(QPaintEvent *event); + virtual void resizeEvent(QResizeEvent *event); + virtual void scrollContentsBy(int dx, int dy); +}; diff --git a/sip/QtPositioning/QtPositioningmod.sip b/sip/QtPositioning/QtPositioningmod.sip new file mode 100644 index 0000000..6cf324a --- /dev/null +++ b/sip/QtPositioning/QtPositioningmod.sip @@ -0,0 +1,61 @@ +// QtPositioningmod.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtPositioning, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%Include qgeoaddress.sip +%Include qgeoareamonitorinfo.sip +%Include qgeoareamonitorsource.sip +%Include qgeocircle.sip +%Include qgeocoordinate.sip +%Include qgeolocation.sip +%Include qgeopath.sip +%Include qgeopolygon.sip +%Include qgeopositioninfo.sip +%Include qgeopositioninfosource.sip +%Include qgeorectangle.sip +%Include qgeosatelliteinfo.sip +%Include qgeosatelliteinfosource.sip +%Include qgeoshape.sip +%Include qnmeapositioninfosource.sip +%Include qnmeasatelliteinfosource.sip diff --git a/sip/QtPositioning/qgeoaddress.sip b/sip/QtPositioning/qgeoaddress.sip new file mode 100644 index 0000000..1c9d280 --- /dev/null +++ b/sip/QtPositioning/qgeoaddress.sip @@ -0,0 +1,71 @@ +// qgeoaddress.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoAddress +{ +%TypeHeaderCode +#include +%End + +public: + QGeoAddress(); + QGeoAddress(const QGeoAddress &other); + ~QGeoAddress(); + QString text() const; + void setText(const QString &text); + QString country() const; + void setCountry(const QString &country); + QString countryCode() const; + void setCountryCode(const QString &countryCode); + QString state() const; + void setState(const QString &state); + QString county() const; + void setCounty(const QString &county); + QString city() const; + void setCity(const QString &city); + QString district() const; + void setDistrict(const QString &district); + QString postalCode() const; + void setPostalCode(const QString &postalCode); + QString street() const; + void setStreet(const QString &street); + bool isEmpty() const; + void clear(); + bool isTextGenerated() const; + void swap(QGeoAddress &other /Constrained/); + QString streetNumber() const; + void setStreetNumber(const QString &streetNumber); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QGeoAddress &lhs, const QGeoAddress &rhs); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QGeoAddress &lhs, const QGeoAddress &rhs); +%End diff --git a/sip/QtPositioning/qgeoareamonitorinfo.sip b/sip/QtPositioning/qgeoareamonitorinfo.sip new file mode 100644 index 0000000..b30f611 --- /dev/null +++ b/sip/QtPositioning/qgeoareamonitorinfo.sip @@ -0,0 +1,66 @@ +// qgeoareamonitorinfo.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoAreaMonitorInfo +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGeoAreaMonitorInfo(const QString &name = QString()); + QGeoAreaMonitorInfo(const QGeoAreaMonitorInfo &other); + ~QGeoAreaMonitorInfo(); + QString name() const; + void setName(const QString &name); + QString identifier() const; + bool isValid() const; + QGeoShape area() const; + void setArea(const QGeoShape &newShape); + QDateTime expiration() const; + void setExpiration(const QDateTime &expiry); + bool isPersistent() const; + void setPersistent(bool isPersistent); + QVariantMap notificationParameters() const; + void setNotificationParameters(const QVariantMap ¶meters); + void swap(QGeoAreaMonitorInfo &other); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (Qt_6_2_0 -) +QDataStream &operator<<(QDataStream &, const QGeoAreaMonitorInfo &); +%End +%If (Qt_6_2_0 -) +QDataStream &operator>>(QDataStream &, QGeoAreaMonitorInfo & /Constrained/); +%End +%If (Qt_6_2_0 -) +bool operator==(const QGeoAreaMonitorInfo &lhs, const QGeoAreaMonitorInfo &rhs); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QGeoAreaMonitorInfo &lhs, const QGeoAreaMonitorInfo &rhs); +%End diff --git a/sip/QtPositioning/qgeoareamonitorsource.sip b/sip/QtPositioning/qgeoareamonitorsource.sip new file mode 100644 index 0000000..61f429c --- /dev/null +++ b/sip/QtPositioning/qgeoareamonitorsource.sip @@ -0,0 +1,74 @@ +// qgeoareamonitorsource.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoAreaMonitorSource : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + AccessError, + InsufficientPositionInfo, + UnknownSourceError, + NoError, + }; + + enum AreaMonitorFeature /BaseType=Flag/ + { + PersistentAreaMonitorFeature, + AnyAreaMonitorFeature, + }; + + typedef QFlags AreaMonitorFeatures; + explicit QGeoAreaMonitorSource(QObject *parent /TransferThis/); + virtual ~QGeoAreaMonitorSource(); + static QGeoAreaMonitorSource *createDefaultSource(QObject *parent /TransferThis/) /Factory/; + static QGeoAreaMonitorSource *createSource(const QString &sourceName, QObject *parent /TransferThis/) /Factory/; + static QStringList availableSources(); + virtual void setPositionInfoSource(QGeoPositionInfoSource *source /Transfer/); + virtual QGeoPositionInfoSource *positionInfoSource() const; + QString sourceName() const; + virtual QGeoAreaMonitorSource::Error error() const = 0; + virtual QGeoAreaMonitorSource::AreaMonitorFeatures supportedAreaMonitorFeatures() const = 0; + virtual bool startMonitoring(const QGeoAreaMonitorInfo &monitor) = 0; + virtual bool stopMonitoring(const QGeoAreaMonitorInfo &monitor) = 0; + virtual bool requestUpdate(const QGeoAreaMonitorInfo &monitor, const char *signal) = 0; + virtual QList activeMonitors() const = 0; + virtual QList activeMonitors(const QGeoShape &lookupArea) const = 0; + +signals: + void areaEntered(const QGeoAreaMonitorInfo &monitor, const QGeoPositionInfo &update); + void areaExited(const QGeoAreaMonitorInfo &monitor, const QGeoPositionInfo &update); + void monitorExpired(const QGeoAreaMonitorInfo &monitor); + void errorOccurred(QGeoAreaMonitorSource::Error error); + +public: + virtual bool setBackendProperty(const QString &name, const QVariant &value); + virtual QVariant backendProperty(const QString &name) const; +}; + +%End diff --git a/sip/QtPositioning/qgeocircle.sip b/sip/QtPositioning/qgeocircle.sip new file mode 100644 index 0000000..758e085 --- /dev/null +++ b/sip/QtPositioning/qgeocircle.sip @@ -0,0 +1,53 @@ +// qgeocircle.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoCircle : QGeoShape +{ +%TypeHeaderCode +#include +%End + +public: + QGeoCircle(); + QGeoCircle(const QGeoCoordinate ¢er, qreal radius = -1.); + QGeoCircle(const QGeoCircle &other); + QGeoCircle(const QGeoShape &other); + ~QGeoCircle(); + void setCenter(const QGeoCoordinate ¢er); + QGeoCoordinate center() const; + void setRadius(qreal radius); + qreal radius() const; + void translate(double degreesLatitude, double degreesLongitude); + QGeoCircle translated(double degreesLatitude, double degreesLongitude) const; + QString toString() const; + void extendCircle(const QGeoCoordinate &coordinate); +}; + +%End +%If (Qt_6_5_0 -) +QDataStream &operator<<(QDataStream &stream, const QGeoCircle &circle) /ReleaseGIL/; +%End +%If (Qt_6_5_0 -) +QDataStream &operator>>(QDataStream &stream, QGeoCircle &circle /Constrained/) /ReleaseGIL/; +%End diff --git a/sip/QtPositioning/qgeocoordinate.sip b/sip/QtPositioning/qgeocoordinate.sip new file mode 100644 index 0000000..10da5ec --- /dev/null +++ b/sip/QtPositioning/qgeocoordinate.sip @@ -0,0 +1,85 @@ +// qgeocoordinate.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoCoordinate +{ +%TypeHeaderCode +#include +%End + +public: + enum CoordinateType + { + InvalidCoordinate, + Coordinate2D, + Coordinate3D, + }; + + enum CoordinateFormat + { + Degrees, + DegreesWithHemisphere, + DegreesMinutes, + DegreesMinutesWithHemisphere, + DegreesMinutesSeconds, + DegreesMinutesSecondsWithHemisphere, + }; + + QGeoCoordinate(); + QGeoCoordinate(double latitude, double longitude); + QGeoCoordinate(double latitude, double longitude, double altitude); + QGeoCoordinate(const QGeoCoordinate &other); + ~QGeoCoordinate(); + bool isValid() const; + QGeoCoordinate::CoordinateType type() const; + void setLatitude(double latitude); + double latitude() const; + void setLongitude(double longitude); + double longitude() const; + void setAltitude(double altitude); + double altitude() const; + qreal distanceTo(const QGeoCoordinate &other) const; + qreal azimuthTo(const QGeoCoordinate &other) const; + QGeoCoordinate atDistanceAndAzimuth(qreal distance, qreal azimuth, qreal distanceUp = 0.) const; + QString toString(QGeoCoordinate::CoordinateFormat format = QGeoCoordinate::DegreesMinutesSecondsWithHemisphere) const; + void swap(QGeoCoordinate &other /Constrained/); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (Qt_6_2_0 -) +QDataStream &operator<<(QDataStream &stream, const QGeoCoordinate &coordinate); +%End +%If (Qt_6_2_0 -) +QDataStream &operator>>(QDataStream &stream, QGeoCoordinate &coordinate /Constrained/); +%End +%If (Qt_6_2_0 -) +bool operator==(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QGeoCoordinate &lhs, const QGeoCoordinate &rhs); +%End diff --git a/sip/QtPositioning/qgeolocation.sip b/sip/QtPositioning/qgeolocation.sip new file mode 100644 index 0000000..c0b2d63 --- /dev/null +++ b/sip/QtPositioning/qgeolocation.sip @@ -0,0 +1,57 @@ +// qgeolocation.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoLocation +{ +%TypeHeaderCode +#include +%End + +public: + QGeoLocation(); + QGeoLocation(const QGeoLocation &other); + ~QGeoLocation(); + QGeoAddress address() const; + void setAddress(const QGeoAddress &address); + QGeoCoordinate coordinate() const; + void setCoordinate(const QGeoCoordinate &position); + bool isEmpty() const; + QVariantMap extendedAttributes() const; + void setExtendedAttributes(const QVariantMap &data); + void swap(QGeoLocation &other /Constrained/); + QGeoShape boundingShape() const; + void setBoundingShape(const QGeoShape &shape); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (Qt_6_2_0 -) +bool operator==(const QGeoLocation &lhs, const QGeoLocation &rhs); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QGeoLocation &lhs, const QGeoLocation &rhs); +%End diff --git a/sip/QtPositioning/qgeopath.sip b/sip/QtPositioning/qgeopath.sip new file mode 100644 index 0000000..3696fe4 --- /dev/null +++ b/sip/QtPositioning/qgeopath.sip @@ -0,0 +1,62 @@ +// qgeopath.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoPath : QGeoShape +{ +%TypeHeaderCode +#include +%End + +public: + QGeoPath(); + QGeoPath(const QList &path, const qreal &width = 0.); + QGeoPath(const QGeoPath &other); + QGeoPath(const QGeoShape &other); + ~QGeoPath(); + void setPath(const QList &path); + const QList &path() const; + void setWidth(const qreal &width); + qreal width() const; + void translate(double degreesLatitude, double degreesLongitude); + QGeoPath translated(double degreesLatitude, double degreesLongitude) const; + double length(qsizetype indexFrom = 0, qsizetype indexTo = -1) const; + void addCoordinate(const QGeoCoordinate &coordinate); + void insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate); + void replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate); + QGeoCoordinate coordinateAt(qsizetype index) const; + bool containsCoordinate(const QGeoCoordinate &coordinate) const; + void removeCoordinate(const QGeoCoordinate &coordinate); + void removeCoordinate(qsizetype index); + QString toString() const; + qsizetype size() const; + void clearPath(); +}; + +%End +%If (Qt_6_5_0 -) +QDataStream &operator<<(QDataStream &stream, const QGeoPath &path) /ReleaseGIL/; +%End +%If (Qt_6_5_0 -) +QDataStream &operator>>(QDataStream &stream, QGeoPath &path /Constrained/) /ReleaseGIL/; +%End diff --git a/sip/QtPositioning/qgeopolygon.sip b/sip/QtPositioning/qgeopolygon.sip new file mode 100644 index 0000000..99578a1 --- /dev/null +++ b/sip/QtPositioning/qgeopolygon.sip @@ -0,0 +1,65 @@ +// qgeopolygon.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoPolygon : QGeoShape +{ +%TypeHeaderCode +#include +%End + +public: + QGeoPolygon(); + QGeoPolygon(const QList &path); + QGeoPolygon(const QGeoPolygon &other); + QGeoPolygon(const QGeoShape &other); + ~QGeoPolygon(); + void translate(double degreesLatitude, double degreesLongitude); + QGeoPolygon translated(double degreesLatitude, double degreesLongitude) const; + double length(qsizetype indexFrom = 0, qsizetype indexTo = -1) const; + qsizetype size() const; + void addCoordinate(const QGeoCoordinate &coordinate); + void insertCoordinate(qsizetype index, const QGeoCoordinate &coordinate); + void replaceCoordinate(qsizetype index, const QGeoCoordinate &coordinate); + QGeoCoordinate coordinateAt(qsizetype index) const; + bool containsCoordinate(const QGeoCoordinate &coordinate) const; + void removeCoordinate(const QGeoCoordinate &coordinate); + void removeCoordinate(qsizetype index); + QString toString() const; + void addHole(const QList &holePath); + void addHole(const QVariant &holePath); + const QVariantList hole(qsizetype index) const; + const QList holePath(qsizetype index) const; + void removeHole(qsizetype index); + qsizetype holesCount() const; + void setPerimeter(const QList &path); + const QList &perimeter() const; +}; + +%End +%If (Qt_6_5_0 -) +QDataStream &operator<<(QDataStream &stream, const QGeoPolygon &polygon) /ReleaseGIL/; +%End +%If (Qt_6_5_0 -) +QDataStream &operator>>(QDataStream &stream, QGeoPolygon &polygon /Constrained/) /ReleaseGIL/; +%End diff --git a/sip/QtPositioning/qgeopositioninfo.sip b/sip/QtPositioning/qgeopositioninfo.sip new file mode 100644 index 0000000..5ce9f76 --- /dev/null +++ b/sip/QtPositioning/qgeopositioninfo.sip @@ -0,0 +1,77 @@ +// qgeopositioninfo.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoPositionInfo +{ +%TypeHeaderCode +#include +%End + +public: + enum Attribute + { + Direction, + GroundSpeed, + VerticalSpeed, + MagneticVariation, + HorizontalAccuracy, + VerticalAccuracy, +%If (Qt_6_3_0 -) + DirectionAccuracy, +%End + }; + + QGeoPositionInfo(); + QGeoPositionInfo(const QGeoCoordinate &coordinate, const QDateTime &updateTime); + QGeoPositionInfo(const QGeoPositionInfo &other); + ~QGeoPositionInfo(); + bool isValid() const; + void setTimestamp(const QDateTime ×tamp); + QDateTime timestamp() const; + void setCoordinate(const QGeoCoordinate &coordinate); + QGeoCoordinate coordinate() const; + void setAttribute(QGeoPositionInfo::Attribute attribute, qreal value); + qreal attribute(QGeoPositionInfo::Attribute attribute) const; + void removeAttribute(QGeoPositionInfo::Attribute attribute); + bool hasAttribute(QGeoPositionInfo::Attribute attribute) const; + void swap(QGeoPositionInfo &other /Constrained/); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (Qt_6_2_0 -) +QDataStream &operator<<(QDataStream &stream, const QGeoPositionInfo &info); +%End +%If (Qt_6_2_0 -) +QDataStream &operator>>(QDataStream &stream, QGeoPositionInfo &info /Constrained/); +%End +%If (Qt_6_2_0 -) +bool operator==(const QGeoPositionInfo &lhs, const QGeoPositionInfo &rhs); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QGeoPositionInfo &lhs, const QGeoPositionInfo &rhs); +%End diff --git a/sip/QtPositioning/qgeopositioninfosource.sip b/sip/QtPositioning/qgeopositioninfosource.sip new file mode 100644 index 0000000..8bc1fb3 --- /dev/null +++ b/sip/QtPositioning/qgeopositioninfosource.sip @@ -0,0 +1,114 @@ +// qgeopositioninfosource.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoPositionInfoSource : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QGeoAreaMonitorSource, &sipType_QGeoAreaMonitorSource, -1, 1}, + {sipName_QGeoPositionInfoSource, &sipType_QGeoPositionInfoSource, 3, 2}, + {sipName_QGeoSatelliteInfoSource, &sipType_QGeoSatelliteInfoSource, 4, -1}, + {sipName_QNmeaPositionInfoSource, &sipType_QNmeaPositionInfoSource, -1, -1}, + {sipName_QNmeaSatelliteInfoSource, &sipType_QNmeaSatelliteInfoSource, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum Error + { + AccessError, + ClosedError, + UnknownSourceError, + UpdateTimeoutError, + NoError, + }; + + enum PositioningMethod /BaseType=Flag/ + { + NoPositioningMethods, + SatellitePositioningMethods, + NonSatellitePositioningMethods, + AllPositioningMethods, + }; + + typedef QFlags PositioningMethods; + explicit QGeoPositionInfoSource(QObject *parent /TransferThis/); + virtual ~QGeoPositionInfoSource(); + virtual void setUpdateInterval(int msec); + int updateInterval() const; + virtual void setPreferredPositioningMethods(QGeoPositionInfoSource::PositioningMethods methods); + QGeoPositionInfoSource::PositioningMethods preferredPositioningMethods() const; + virtual QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const = 0; + virtual QGeoPositionInfoSource::PositioningMethods supportedPositioningMethods() const = 0; + virtual int minimumUpdateInterval() const = 0; + QString sourceName() const; + static QGeoPositionInfoSource *createDefaultSource(QObject *parent /TransferThis/) /Factory/; + static QGeoPositionInfoSource *createDefaultSource(const QVariantMap ¶meters, QObject *parent /TransferThis/) /Factory/; + static QGeoPositionInfoSource *createSource(const QString &sourceName, QObject *parent /TransferThis/) /Factory/; + static QGeoPositionInfoSource *createSource(const QString &sourceName, const QVariantMap ¶meters, QObject *parent /TransferThis/) /Factory/; + static QStringList availableSources(); + virtual QGeoPositionInfoSource::Error error() const = 0; + +public slots: + virtual void startUpdates() = 0; + virtual void stopUpdates() = 0; + virtual void requestUpdate(int timeout = 0) = 0; + +signals: + void positionUpdated(const QGeoPositionInfo &update); + void supportedPositioningMethodsChanged(); + void errorOccurred(QGeoPositionInfoSource::Error); + +public: + virtual bool setBackendProperty(const QString &name, const QVariant &value); + virtual QVariant backendProperty(const QString &name) const; +}; + +%End diff --git a/sip/QtPositioning/qgeorectangle.sip b/sip/QtPositioning/qgeorectangle.sip new file mode 100644 index 0000000..f707ad3 --- /dev/null +++ b/sip/QtPositioning/qgeorectangle.sip @@ -0,0 +1,70 @@ +// qgeorectangle.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoRectangle : QGeoShape +{ +%TypeHeaderCode +#include +%End + +public: + QGeoRectangle(); + QGeoRectangle(const QGeoCoordinate ¢er, double degreesWidth, double degreesHeight); + QGeoRectangle(const QGeoCoordinate &topLeft, const QGeoCoordinate &bottomRight); + QGeoRectangle(const QList &coordinates); + QGeoRectangle(const QGeoRectangle &other); + QGeoRectangle(const QGeoShape &other); + ~QGeoRectangle(); + void setTopLeft(const QGeoCoordinate &topLeft); + QGeoCoordinate topLeft() const; + void setTopRight(const QGeoCoordinate &topRight); + QGeoCoordinate topRight() const; + void setBottomLeft(const QGeoCoordinate &bottomLeft); + QGeoCoordinate bottomLeft() const; + void setBottomRight(const QGeoCoordinate &bottomRight); + QGeoCoordinate bottomRight() const; + void setCenter(const QGeoCoordinate ¢er); + QGeoCoordinate center() const; + void setWidth(double degreesWidth); + double width() const; + void setHeight(double degreesHeight); + double height() const; + bool contains(const QGeoRectangle &rectangle) const; + bool intersects(const QGeoRectangle &rectangle) const; + void translate(double degreesLatitude, double degreesLongitude); + QGeoRectangle translated(double degreesLatitude, double degreesLongitude) const; + QGeoRectangle united(const QGeoRectangle &rectangle) const; + QGeoRectangle &operator|=(const QGeoRectangle &rectangle); + QGeoRectangle operator|(const QGeoRectangle &rectangle) const; + QString toString() const; + void extendRectangle(const QGeoCoordinate &coordinate); +}; + +%End +%If (Qt_6_5_0 -) +QDataStream &operator<<(QDataStream &stream, const QGeoRectangle &rectangle) /ReleaseGIL/; +%End +%If (Qt_6_5_0 -) +QDataStream &operator>>(QDataStream &stream, QGeoRectangle &rectangle /Constrained/) /ReleaseGIL/; +%End diff --git a/sip/QtPositioning/qgeosatelliteinfo.sip b/sip/QtPositioning/qgeosatelliteinfo.sip new file mode 100644 index 0000000..63631ac --- /dev/null +++ b/sip/QtPositioning/qgeosatelliteinfo.sip @@ -0,0 +1,76 @@ +// qgeosatelliteinfo.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoSatelliteInfo +{ +%TypeHeaderCode +#include +%End + +public: + enum Attribute + { + Elevation, + Azimuth, + }; + + enum SatelliteSystem + { + Undefined, + GPS, + GLONASS, + GALILEO, + BEIDOU, + QZSS, + Multiple, + CustomType, + }; + + QGeoSatelliteInfo(); + QGeoSatelliteInfo(const QGeoSatelliteInfo &other); + ~QGeoSatelliteInfo(); + void setSatelliteSystem(QGeoSatelliteInfo::SatelliteSystem system); + QGeoSatelliteInfo::SatelliteSystem satelliteSystem() const; + void setSatelliteIdentifier(int satId); + int satelliteIdentifier() const; + void setSignalStrength(int signalStrength); + int signalStrength() const; + void setAttribute(QGeoSatelliteInfo::Attribute attribute, qreal value); + qreal attribute(QGeoSatelliteInfo::Attribute attribute) const; + void removeAttribute(QGeoSatelliteInfo::Attribute attribute); + bool hasAttribute(QGeoSatelliteInfo::Attribute attribute) const; + void swap(QGeoSatelliteInfo &other /Constrained/); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (Qt_6_2_0 -) +QDataStream &operator<<(QDataStream &stream, const QGeoSatelliteInfo &info); +%End +%If (Qt_6_2_0 -) +QDataStream &operator>>(QDataStream &stream, QGeoSatelliteInfo &info /Constrained/); +%End diff --git a/sip/QtPositioning/qgeosatelliteinfosource.sip b/sip/QtPositioning/qgeosatelliteinfosource.sip new file mode 100644 index 0000000..c4b0c93 --- /dev/null +++ b/sip/QtPositioning/qgeosatelliteinfosource.sip @@ -0,0 +1,69 @@ +// qgeosatelliteinfosource.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoSatelliteInfoSource : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Error + { + AccessError, + ClosedError, + NoError, + UnknownSourceError, + UpdateTimeoutError, + }; + + explicit QGeoSatelliteInfoSource(QObject *parent /TransferThis/); + virtual ~QGeoSatelliteInfoSource(); + static QGeoSatelliteInfoSource *createDefaultSource(QObject *parent /TransferThis/) /Factory/; + static QGeoSatelliteInfoSource *createDefaultSource(const QVariantMap ¶meters, QObject *parent /TransferThis/) /Factory/; + static QGeoSatelliteInfoSource *createSource(const QString &sourceName, QObject *parent /TransferThis/) /Factory/; + static QGeoSatelliteInfoSource *createSource(const QString &sourceName, const QVariantMap ¶meters, QObject *parent /TransferThis/) /Factory/; + static QStringList availableSources(); + QString sourceName() const; + virtual void setUpdateInterval(int msec); + int updateInterval() const; + virtual int minimumUpdateInterval() const = 0; + virtual QGeoSatelliteInfoSource::Error error() const = 0; + +public slots: + virtual void startUpdates() = 0; + virtual void stopUpdates() = 0; + virtual void requestUpdate(int timeout = 0) = 0; + +signals: + void satellitesInViewUpdated(const QList &satellites); + void satellitesInUseUpdated(const QList &satellites); + void errorOccurred(QGeoSatelliteInfoSource::Error); + +public: + virtual bool setBackendProperty(const QString &name, const QVariant &value); + virtual QVariant backendProperty(const QString &name) const; +}; + +%End diff --git a/sip/QtPositioning/qgeoshape.sip b/sip/QtPositioning/qgeoshape.sip new file mode 100644 index 0000000..d049e2e --- /dev/null +++ b/sip/QtPositioning/qgeoshape.sip @@ -0,0 +1,94 @@ +// qgeoshape.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGeoShape +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + switch (sipCpp->type()) + { + case QGeoShape::CircleType: + sipType = sipType_QGeoCircle; + break; + + case QGeoShape::RectangleType: + sipType = sipType_QGeoRectangle; + break; + + case QGeoShape::PathType: + sipType = sipType_QGeoPath; + break; + + case QGeoShape::PolygonType: + sipType = sipType_QGeoPolygon; + break; + + default: + sipType = 0; + } +%End + +public: + QGeoShape(); + QGeoShape(const QGeoShape &other); + ~QGeoShape(); + + enum ShapeType + { + UnknownType, + RectangleType, + CircleType, + PathType, + PolygonType, + }; + + QGeoShape::ShapeType type() const; + bool isValid() const; + bool isEmpty() const; + bool contains(const QGeoCoordinate &coordinate) const; + QGeoCoordinate center() const; + QString toString() const; + QGeoRectangle boundingGeoRectangle() const; + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +%End +%If (Qt_6_2_0 -) +QDataStream &operator<<(QDataStream &stream, const QGeoShape &shape); +%End +%If (Qt_6_2_0 -) +QDataStream &operator>>(QDataStream &stream, QGeoShape &shape /Constrained/); +%End +%If (Qt_6_2_0 -) +bool operator==(const QGeoShape &lhs, const QGeoShape &rhs); +%End +%If (Qt_6_2_0 -) +bool operator!=(const QGeoShape &lhs, const QGeoShape &rhs); +%End diff --git a/sip/QtPositioning/qnmeapositioninfosource.sip b/sip/QtPositioning/qnmeapositioninfosource.sip new file mode 100644 index 0000000..6b5bb8d --- /dev/null +++ b/sip/QtPositioning/qnmeapositioninfosource.sip @@ -0,0 +1,62 @@ +// qnmeapositioninfosource.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNmeaPositionInfoSource : QGeoPositionInfoSource +{ +%TypeHeaderCode +#include +%End + +public: + enum UpdateMode + { + RealTimeMode, + SimulationMode, + }; + + QNmeaPositionInfoSource(QNmeaPositionInfoSource::UpdateMode updateMode, QObject *parent /TransferThis/ = 0); + virtual ~QNmeaPositionInfoSource(); + QNmeaPositionInfoSource::UpdateMode updateMode() const; + void setDevice(QIODevice *source); + QIODevice *device() const; + virtual void setUpdateInterval(int msec); + virtual QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const; + virtual QGeoPositionInfoSource::PositioningMethods supportedPositioningMethods() const; + virtual int minimumUpdateInterval() const; + virtual QGeoPositionInfoSource::Error error() const; + +public slots: + virtual void startUpdates(); + virtual void stopUpdates(); + virtual void requestUpdate(int timeout = 0); + +protected: + virtual bool parsePosInfoFromNmeaData(const char *data /Encoding="None"/, int size, QGeoPositionInfo *posInfo, bool *hasFix); + +public: + void setUserEquivalentRangeError(double uere); + double userEquivalentRangeError() const; +}; + +%End diff --git a/sip/QtPositioning/qnmeasatelliteinfosource.sip b/sip/QtPositioning/qnmeasatelliteinfosource.sip new file mode 100644 index 0000000..21851f2 --- /dev/null +++ b/sip/QtPositioning/qnmeasatelliteinfosource.sip @@ -0,0 +1,68 @@ +// qnmeasatelliteinfosource.sip generated by MetaSIP +// +// This file is part of the QtPositioning Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QNmeaSatelliteInfoSource : QGeoSatelliteInfoSource +{ +%TypeHeaderCode +#include +%End + +public: + enum class UpdateMode + { + RealTimeMode, + SimulationMode, + }; + + static QString SimulationUpdateInterval; + QNmeaSatelliteInfoSource(QNmeaSatelliteInfoSource::UpdateMode mode, QObject *parent /TransferThis/ = 0); + virtual ~QNmeaSatelliteInfoSource(); + QNmeaSatelliteInfoSource::UpdateMode updateMode() const; + void setDevice(QIODevice *source); + QIODevice *device() const; + virtual void setUpdateInterval(int msec); + virtual int minimumUpdateInterval() const; + virtual QGeoSatelliteInfoSource::Error error() const; + virtual bool setBackendProperty(const QString &name, const QVariant &value); + virtual QVariant backendProperty(const QString &name) const; + +public slots: + virtual void startUpdates(); + virtual void stopUpdates(); + virtual void requestUpdate(int timeout = 0); + +protected: + virtual QGeoSatelliteInfo::SatelliteSystem parseSatellitesInUseFromNmea(const char *data /Encoding="None"/, int size, QList &pnrsInUse); + + enum SatelliteInfoParseStatus + { + NotParsed, + PartiallyParsed, + FullyParsed, + }; + + virtual QNmeaSatelliteInfoSource::SatelliteInfoParseStatus parseSatelliteInfoFromNmea(const char *data /Encoding="None"/, int size, QList &infos, QGeoSatelliteInfo::SatelliteSystem &system); +}; + +%End diff --git a/sip/QtPrintSupport/QtPrintSupportmod.sip b/sip/QtPrintSupport/QtPrintSupportmod.sip new file mode 100644 index 0000000..b69917a --- /dev/null +++ b/sip/QtPrintSupport/QtPrintSupportmod.sip @@ -0,0 +1,58 @@ +// QtPrintSupportmod.sip generated by MetaSIP +// +// This file is part of the QtPrintSupport Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtPrintSupport, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qabstractprintdialog.sip +%Include qpagesetupdialog.sip +%Include qprintdialog.sip +%Include qprintengine.sip +%Include qprinter.sip +%Include qprinterinfo.sip +%Include qprintpreviewdialog.sip +%Include qprintpreviewwidget.sip +%Include qpyprintsupport_qlist.sip diff --git a/sip/QtPrintSupport/qabstractprintdialog.sip b/sip/QtPrintSupport/qabstractprintdialog.sip new file mode 100644 index 0000000..3f554bd --- /dev/null +++ b/sip/QtPrintSupport/qabstractprintdialog.sip @@ -0,0 +1,134 @@ +// qabstractprintdialog.sip generated by MetaSIP +// +// This file is part of the QtPrintSupport Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_PrintDialog) + +class QAbstractPrintDialog : QDialog +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + #if defined(SIP_FEATURE_PyQt_PrintDialog) + {sipName_QPageSetupDialog, &sipType_QPageSetupDialog, -1, 1}, + #else + {0, 0, -1, 1}, + #endif + #if defined(SIP_FEATURE_PyQt_PrintPreviewWidget) + {sipName_QPrintPreviewWidget, &sipType_QPrintPreviewWidget, -1, 2}, + #else + {0, 0, -1, 2}, + #endif + #if defined(SIP_FEATURE_PyQt_PrintPreviewDialog) + {sipName_QPrintPreviewDialog, &sipType_QPrintPreviewDialog, -1, 3}, + #else + {0, 0, -1, 3}, + #endif + #if defined(SIP_FEATURE_PyQt_Printer) + {sipName_QAbstractPrintDialog, &sipType_QAbstractPrintDialog, 4, -1}, + #else + {0, 0, 4, -1}, + #endif + #if defined(SIP_FEATURE_PyQt_PrintDialog) + {sipName_QPrintDialog, &sipType_QPrintDialog, -1, -1}, + #else + {0, 0, -1, -1}, + #endif + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum PrintRange + { + AllPages, + Selection, + PageRange, + CurrentPage, + }; + + enum PrintDialogOption /BaseType=Flag/ + { + PrintToFile, + PrintSelection, + PrintPageRange, + PrintCollateCopies, + PrintShowPageSize, + PrintCurrentPage, + }; + + typedef QFlags PrintDialogOptions; + QAbstractPrintDialog(QPrinter *printer, QWidget *parent /TransferThis/ = 0); + virtual ~QAbstractPrintDialog(); + void setPrintRange(QAbstractPrintDialog::PrintRange range); + QAbstractPrintDialog::PrintRange printRange() const; + void setMinMax(int min, int max); + int minPage() const; + int maxPage() const; + void setFromTo(int fromPage, int toPage); + int fromPage() const; + int toPage() const; + QPrinter *printer() const; + void setOptionTabs(const QList &tabs); +}; + +%End + +%ModuleHeaderCode +// Imports from QtCore. +typedef sipErrorState (*pyqt6_qtprintsupport_get_connection_parts_t)(PyObject *, QObject *, const char *, bool, QObject **, QByteArray &); +extern pyqt6_qtprintsupport_get_connection_parts_t pyqt6_qtprintsupport_get_connection_parts; +%End + +%ModuleCode +// Imports from QtCore. +pyqt6_qtprintsupport_get_connection_parts_t pyqt6_qtprintsupport_get_connection_parts; +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtprintsupport_get_connection_parts = (pyqt6_qtprintsupport_get_connection_parts_t)sipImportSymbol("pyqt6_get_connection_parts"); +Q_ASSERT(pyqt6_qtprintsupport_get_connection_parts); +%End diff --git a/sip/QtPrintSupport/qpagesetupdialog.sip b/sip/QtPrintSupport/qpagesetupdialog.sip new file mode 100644 index 0000000..940e106 --- /dev/null +++ b/sip/QtPrintSupport/qpagesetupdialog.sip @@ -0,0 +1,71 @@ +// qpagesetupdialog.sip generated by MetaSIP +// +// This file is part of the QtPrintSupport Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_PrintDialog) + +class QPageSetupDialog : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + QPageSetupDialog(QPrinter *printer, QWidget *parent /TransferThis/ = 0); + explicit QPageSetupDialog(QWidget *parent /TransferThis/ = 0); + virtual ~QPageSetupDialog(); + virtual void setVisible(bool visible); + virtual int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; +%MethodCode + // Transfer ownership back to Python (a modal dialog will probably have the + // main window as it's parent). This means the Qt dialog will be deleted when + // the Python wrapper is garbage collected. Although this is a little + // inconsistent, it saves having to code it explicitly to avoid the memory + // leak. + sipTransferBack(sipSelf); + + Py_BEGIN_ALLOW_THREADS + sipRes = sipSelfWasArg ? sipCpp->QPageSetupDialog::exec() + : sipCpp->exec(); + Py_END_ALLOW_THREADS +%End + + virtual void open(); + void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtprintsupport_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipCpp->open(receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + + virtual void done(int result); + QPrinter *printer(); +}; + +%End diff --git a/sip/QtPrintSupport/qprintdialog.sip b/sip/QtPrintSupport/qprintdialog.sip new file mode 100644 index 0000000..9606687 --- /dev/null +++ b/sip/QtPrintSupport/qprintdialog.sip @@ -0,0 +1,80 @@ +// qprintdialog.sip generated by MetaSIP +// +// This file is part of the QtPrintSupport Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_PrintDialog) + +class QPrintDialog : QAbstractPrintDialog +{ +%TypeHeaderCode +#include +%End + +public: + QPrintDialog(QPrinter *printer, QWidget *parent /TransferThis/ = 0); + explicit QPrintDialog(QWidget *parent /TransferThis/ = 0); + virtual ~QPrintDialog(); + virtual int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; +%MethodCode + // Transfer ownership back to Python (a modal dialog will probably have the + // main window as it's parent). This means the Qt dialog will be deleted when + // the Python wrapper is garbage collected. Although this is a little + // inconsistent, it saves having to code it explicitly to avoid the memory + // leak. + sipTransferBack(sipSelf); + + Py_BEGIN_ALLOW_THREADS + sipRes = sipSelfWasArg ? sipCpp->QPrintDialog::exec() + : sipCpp->exec(); + Py_END_ALLOW_THREADS +%End + +%If (Android || Linux || WebAssembly) + virtual void accept(); +%End + virtual void done(int result); + void setOption(QAbstractPrintDialog::PrintDialogOption option, bool on = true); + bool testOption(QAbstractPrintDialog::PrintDialogOption option) const; + void setOptions(QAbstractPrintDialog::PrintDialogOptions options); + QAbstractPrintDialog::PrintDialogOptions options() const; + virtual void setVisible(bool visible); + virtual void open(); + void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtprintsupport_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipCpp->open(receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + +signals: + void accepted(); + void accepted(QPrinter *printer); +}; + +%End diff --git a/sip/QtPrintSupport/qprintengine.sip b/sip/QtPrintSupport/qprintengine.sip new file mode 100644 index 0000000..f90f4f3 --- /dev/null +++ b/sip/QtPrintSupport/qprintengine.sip @@ -0,0 +1,78 @@ +// qprintengine.sip generated by MetaSIP +// +// This file is part of the QtPrintSupport Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_Printer) + +class QPrintEngine +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QPrintEngine(); + + enum PrintEnginePropertyKey + { + PPK_CollateCopies, + PPK_ColorMode, + PPK_Creator, + PPK_DocumentName, + PPK_FullPage, + PPK_NumberOfCopies, + PPK_Orientation, + PPK_OutputFileName, + PPK_PageOrder, + PPK_PageRect, + PPK_PageSize, + PPK_PaperRect, + PPK_PaperSource, + PPK_PrinterName, + PPK_PrinterProgram, + PPK_Resolution, + PPK_SelectionOption, + PPK_SupportedResolutions, + PPK_WindowsPageSize, + PPK_FontEmbedding, + PPK_Duplex, + PPK_PaperSources, + PPK_CustomPaperSize, + PPK_PageMargins, + PPK_PaperSize, + PPK_CopyCount, + PPK_SupportsMultipleCopies, + PPK_PaperName, + PPK_QPageSize, + PPK_QPageMargins, + PPK_QPageLayout, + PPK_CustomBase, + }; + + virtual void setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value) = 0; + virtual QVariant property(QPrintEngine::PrintEnginePropertyKey key) const = 0; + virtual bool newPage() = 0; + virtual bool abort() = 0; + virtual int metric(QPaintDevice::PaintDeviceMetric) const = 0; + virtual QPrinter::PrinterState printerState() const = 0; +}; + +%End diff --git a/sip/QtPrintSupport/qprinter.sip b/sip/QtPrintSupport/qprinter.sip new file mode 100644 index 0000000..48550e5 --- /dev/null +++ b/sip/QtPrintSupport/qprinter.sip @@ -0,0 +1,178 @@ +// qprinter.sip generated by MetaSIP +// +// This file is part of the QtPrintSupport Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_Printer) + +class QPrinter : QPagedPaintDevice +{ +%TypeHeaderCode +#include +%End + +public: + enum PrinterMode + { + ScreenResolution, + PrinterResolution, + HighResolution, + }; + + explicit QPrinter(QPrinter::PrinterMode mode = QPrinter::ScreenResolution); + QPrinter(const QPrinterInfo &printer, QPrinter::PrinterMode mode = QPrinter::ScreenResolution); + virtual ~QPrinter(); + + enum PageOrder + { + FirstPageFirst, + LastPageFirst, + }; + + enum ColorMode + { + GrayScale, + Color, + }; + + enum PaperSource + { + OnlyOne, + Lower, + Middle, + Manual, + Envelope, + EnvelopeManual, + Auto, + Tractor, + SmallFormat, + LargeFormat, + LargeCapacity, + Cassette, + FormSource, + MaxPageSource, + Upper, + CustomSource, + LastPaperSource, + }; + + enum PrinterState + { + Idle, + Active, + Aborted, + Error, + }; + + enum OutputFormat + { + NativeFormat, + PdfFormat, + }; + + enum PrintRange + { + AllPages, + Selection, + PageRange, + CurrentPage, + }; + + enum Unit + { + Millimeter, + Point, + Inch, + Pica, + Didot, + Cicero, + DevicePixel, + }; + + enum DuplexMode + { + DuplexNone, + DuplexAuto, + DuplexLongSide, + DuplexShortSide, + }; + + void setOutputFormat(QPrinter::OutputFormat format); + QPrinter::OutputFormat outputFormat() const; + void setPrinterName(const QString &); + QString printerName() const; + bool isValid() const; + void setOutputFileName(const QString &); + QString outputFileName() const; + void setPrintProgram(const QString &); + QString printProgram() const; + void setDocName(const QString &); + QString docName() const; + void setCreator(const QString &); + QString creator() const; + void setPageOrder(QPrinter::PageOrder); + QPrinter::PageOrder pageOrder() const; + void setResolution(int); + int resolution() const; + void setColorMode(QPrinter::ColorMode); + QPrinter::ColorMode colorMode() const; + void setCollateCopies(bool collate); + bool collateCopies() const; + void setFullPage(bool); + bool fullPage() const; + void setCopyCount(int); + int copyCount() const; + bool supportsMultipleCopies() const; + void setPaperSource(QPrinter::PaperSource); + QPrinter::PaperSource paperSource() const; + void setDuplex(QPrinter::DuplexMode duplex); + QPrinter::DuplexMode duplex() const; + QList supportedResolutions() const; + void setFontEmbeddingEnabled(bool enable); + bool fontEmbeddingEnabled() const; + QRectF paperRect(QPrinter::Unit) const; + QRectF pageRect(QPrinter::Unit) const; +%If (Android || Linux || iOS || macOS || WebAssembly) + QString printerSelectionOption() const; +%End +%If (Android || Linux || iOS || macOS || WebAssembly) + void setPrinterSelectionOption(const QString &); +%End + virtual bool newPage(); + bool abort(); + QPrinter::PrinterState printerState() const; + virtual QPaintEngine *paintEngine() const; + QPrintEngine *printEngine() const; + void setFromTo(int fromPage, int toPage); + int fromPage() const; + int toPage() const; + void setPrintRange(QPrinter::PrintRange range); + QPrinter::PrintRange printRange() const; + +protected: + virtual int metric(QPaintDevice::PaintDeviceMetric) const; + void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine); + +public: + void setPdfVersion(QPagedPaintDevice::PdfVersion version); + QPagedPaintDevice::PdfVersion pdfVersion() const; +}; + +%End diff --git a/sip/QtPrintSupport/qprinterinfo.sip b/sip/QtPrintSupport/qprinterinfo.sip new file mode 100644 index 0000000..7282237 --- /dev/null +++ b/sip/QtPrintSupport/qprinterinfo.sip @@ -0,0 +1,61 @@ +// qprinterinfo.sip generated by MetaSIP +// +// This file is part of the QtPrintSupport Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_Printer) + +class QPrinterInfo +{ +%TypeHeaderCode +#include +%End + +public: + QPrinterInfo(); + QPrinterInfo(const QPrinterInfo &src); + explicit QPrinterInfo(const QPrinter &printer); + ~QPrinterInfo(); + QString printerName() const; + bool isNull() const; + bool isDefault() const; + static QList availablePrinters(); + static QPrinterInfo defaultPrinter(); + QString description() const; + QString location() const; + QString makeAndModel() const; + static QPrinterInfo printerInfo(const QString &printerName); + bool isRemote() const; + QPrinter::PrinterState state() const; + QList supportedPageSizes() const; + QPageSize defaultPageSize() const; + bool supportsCustomPageSizes() const; + QPageSize minimumPhysicalPageSize() const; + QPageSize maximumPhysicalPageSize() const; + QList supportedResolutions() const; + static QStringList availablePrinterNames(); + static QString defaultPrinterName(); + QPrinter::DuplexMode defaultDuplexMode() const; + QList supportedDuplexModes() const; + QPrinter::ColorMode defaultColorMode() const; + QList supportedColorModes() const; +}; + +%End diff --git a/sip/QtPrintSupport/qprintpreviewdialog.sip b/sip/QtPrintSupport/qprintpreviewdialog.sip new file mode 100644 index 0000000..a567162 --- /dev/null +++ b/sip/QtPrintSupport/qprintpreviewdialog.sip @@ -0,0 +1,59 @@ +// qprintpreviewdialog.sip generated by MetaSIP +// +// This file is part of the QtPrintSupport Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_PrintPreviewDialog) + +class QPrintPreviewDialog : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + QPrintPreviewDialog(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + QPrintPreviewDialog(QPrinter *printer, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QPrintPreviewDialog(); + virtual void setVisible(bool visible); + virtual void open(); + void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtprintsupport_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipCpp->open(receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + + QPrinter *printer(); + virtual void done(int result); + +signals: + void paintRequested(QPrinter *printer); +}; + +%End diff --git a/sip/QtPrintSupport/qprintpreviewwidget.sip b/sip/QtPrintSupport/qprintpreviewwidget.sip new file mode 100644 index 0000000..3d2036e --- /dev/null +++ b/sip/QtPrintSupport/qprintpreviewwidget.sip @@ -0,0 +1,82 @@ +// qprintpreviewwidget.sip generated by MetaSIP +// +// This file is part of the QtPrintSupport Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_PrintPreviewWidget) + +class QPrintPreviewWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + enum ViewMode + { + SinglePageView, + FacingPagesView, + AllPagesView, + }; + + enum ZoomMode + { + CustomZoom, + FitToWidth, + FitInView, + }; + + QPrintPreviewWidget(QPrinter *printer, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + QPrintPreviewWidget(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QPrintPreviewWidget(); + qreal zoomFactor() const; + QPageLayout::Orientation orientation() const; + QPrintPreviewWidget::ViewMode viewMode() const; + QPrintPreviewWidget::ZoomMode zoomMode() const; + int currentPage() const; + +public slots: + virtual void setVisible(bool visible); + void print(); + void zoomIn(qreal factor = 1.1); + void zoomOut(qreal factor = 1.1); + void setZoomFactor(qreal zoomFactor); + void setOrientation(QPageLayout::Orientation orientation); + void setViewMode(QPrintPreviewWidget::ViewMode viewMode); + void setZoomMode(QPrintPreviewWidget::ZoomMode zoomMode); + void setCurrentPage(int pageNumber); + void fitToWidth(); + void fitInView(); + void setLandscapeOrientation(); + void setPortraitOrientation(); + void setSinglePageViewMode(); + void setFacingPagesViewMode(); + void setAllPagesViewMode(); + void updatePreview(); + +signals: + void paintRequested(QPrinter *printer); + void previewChanged(); + +public: + int pageCount() const; +}; + +%End diff --git a/sip/QtPrintSupport/qpyprintsupport_qlist.sip b/sip/QtPrintSupport/qpyprintsupport_qlist.sip new file mode 100644 index 0000000..588a7a2 --- /dev/null +++ b/sip/QtPrintSupport/qpyprintsupport_qlist.sip @@ -0,0 +1,229 @@ +// This is the SIP interface definition for the QList based mapped types +// specific to the QtPrintSupport module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (PyQt_Printer) + +%MappedType QList + /TypeHintIn="Iterable[QPrinter.DuplexMode]", + TypeHintOut="List[QPrinter.DuplexMode]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(sipCpp->at(i), + sipType_QPrinter_DuplexMode); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QPrinter_DuplexMode); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QPrinter.DuplexMode' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + +%End + + +%If (PyQt_Printer) + +%MappedType QList + /TypeHintIn="Iterable[QPrinter.ColorMode]", + TypeHintOut="List[QPrinter.ColorMode]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(sipCpp->at(i), + sipType_QPrinter_ColorMode); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QPrinter_ColorMode); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QPrinter.ColorMode' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; + +%End diff --git a/sip/QtQml/QtQmlmod.sip b/sip/QtQml/QtQmlmod.sip new file mode 100644 index 0000000..56b1595 --- /dev/null +++ b/sip/QtQml/QtQmlmod.sip @@ -0,0 +1,74 @@ +// QtQmlmod.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtQml, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtNetwork/QtNetworkmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qqml.sip +%Include qjsengine.sip +%Include qjsmanagedvalue.sip +%Include qjsprimitivevalue.sip +%Include qjsvalue.sip +%Include qjsvalueiterator.sip +%Include qqmlabstracturlinterceptor.sip +%Include qqmlapplicationengine.sip +%Include qqmlcomponent.sip +%Include qqmlcontext.sip +%Include qqmlengine.sip +%Include qqmlerror.sip +%Include qqmlexpression.sip +%Include qqmlextensionplugin.sip +%Include qqmlfileselector.sip +%Include qqmlincubator.sip +%Include qqmllist.sip +%Include qqmlnetworkaccessmanagerfactory.sip +%Include qqmlparserstatus.sip +%Include qqmlproperty.sip +%Include qqmlpropertymap.sip +%Include qqmlpropertyvaluesource.sip +%Include qqmlscriptstring.sip +%Include qmlattachedpropertiesobject.sip +%Include qpyqmllistproperty.sip +%Include qmlregistertype.sip diff --git a/sip/QtQml/qjsengine.sip b/sip/QtQml/qjsengine.sip new file mode 100644 index 0000000..85aa732 --- /dev/null +++ b/sip/QtQml/qjsengine.sip @@ -0,0 +1,208 @@ +// qjsengine.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +class QJSEngine : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QJSEngine, &sipType_QJSEngine, 9, 1}, + {sipName_QQmlComponent, &sipType_QQmlComponent, -1, 2}, + {sipName_QQmlContext, &sipType_QQmlContext, -1, 3}, + {sipName_QQmlEngineExtensionPlugin, &sipType_QQmlEngineExtensionPlugin, -1, 4}, + {sipName_QQmlExpression, &sipType_QQmlExpression, -1, 5}, + {sipName_QQmlExtensionPlugin, &sipType_QQmlExtensionPlugin, -1, 6}, + {sipName_QQmlFileSelector, &sipType_QQmlFileSelector, -1, 7}, + {sipName_QQmlImageProviderBase, &sipType_QQmlImageProviderBase, -1, 8}, + {sipName_QQmlPropertyMap, &sipType_QQmlPropertyMap, -1, -1}, + {sipName_QQmlEngine, &sipType_QQmlEngine, 10, -1}, + {sipName_QQmlApplicationEngine, &sipType_QQmlApplicationEngine, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + QJSEngine(); + explicit QJSEngine(QObject *parent /TransferThis/); + virtual ~QJSEngine(); + QJSValue globalObject() const; + QJSValue evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1, SIP_PYLIST exceptionStackTrace /AllowNone,TypeHint="List[str]"/ = 0) /ReleaseGIL/; +%MethodCode + QStringList *st; + + st = (a3 ? new QStringList() : SIP_NULLPTR); + + Py_BEGIN_ALLOW_THREADS + sipRes = new QJSValue(sipCpp->evaluate(*a0, *a1, a2, st)); + Py_END_ALLOW_THREADS + + if (st) + { + for (qsizetype i = 0; i < st->size(); ++i) + { + QString *s = new QString(st->at(i)); + PyObject *s_obj = sipConvertFromNewType(s, sipType_QString, SIP_NULLPTR); + + if (s_obj) + { + if (PyList_Append(a3, s_obj) < 0) + { + Py_DECREF(s_obj); + sipIsErr = 1; + break; + } + + Py_DECREF(s_obj); + } + else + { + delete s; + sipIsErr = 1; + break; + } + } + + if (sipIsErr) + { + delete sipRes; + sipRes = SIP_NULLPTR; + } + + delete st; + } +%End + + QJSValue newObject(); + QJSValue newArray(uint length = 0); + QJSValue newQObject(QObject *object /Transfer/); + void collectGarbage(); + + enum Extension /BaseType=Flag/ + { + TranslationExtension, + ConsoleExtension, + GarbageCollectionExtension, + AllExtensions, + }; + + typedef QFlags Extensions; + void installExtensions(QJSEngine::Extensions extensions, const QJSValue &object = QJSValue()); + QJSValue newQMetaObject(const QMetaObject *metaObject); + QJSValue importModule(const QString &fileName); + QJSValue newErrorObject(QJSValue::ErrorType errorType, const QString &message = QString()); + void throwError(const QString &message); +%If (Qt_6_1_0 -) + void throwError(const QJSValue &error); +%End + void throwError(QJSValue::ErrorType errorType, const QString &message = QString()); + void setInterrupted(bool interrupted); + bool isInterrupted() const; + QString uiLanguage() const; + void setUiLanguage(const QString &language); + + enum ObjectOwnership + { + CppOwnership, + JavaScriptOwnership, + }; + + static void setObjectOwnership(QObject * /GetWrapper/, QJSEngine::ObjectOwnership); +%MethodCode + QJSEngine::ObjectOwnership old = QJSEngine::objectOwnership(a0); + + QJSEngine::setObjectOwnership(a0, a1); + + if (old != a1 && !a0->parent()) + { + if (old == QJSEngine::CppOwnership) + sipTransferTo(a0Wrapper, Py_None); + else + sipTransferBack(a0Wrapper); + } +%End + + static QJSEngine::ObjectOwnership objectOwnership(QObject *); +%If (Qt_6_1_0 -) + bool hasError() const; +%End +%If (Qt_6_1_0 -) + QJSValue catchError(); +%End + +signals: + void uiLanguageChanged(); + +public: +%If (Qt_6_2_0 -) + bool registerModule(const QString &moduleName, const QJSValue &value); +%End +%If (Qt_6_2_0 -) + QJSValue newSymbol(const QString &name); +%End +%If (Qt_6_5_0 -) + QJSValue toScriptValue(const QVariant &value); +%End +%If (Qt_6_5_0 -) + QJSManagedValue toManagedValue(const QVariant &value); +%End +%If (Qt_6_5_0 -) + QJSPrimitiveValue toPrimitiveValue(const QVariant &value); +%End +}; + +QJSEngine *qjsEngine(const QObject *); + +%ModuleHeaderCode +#include "qpyqml_api.h" +%End + +%PostInitialisationCode +qpyqml_post_init(sipModuleDict); +%End diff --git a/sip/QtQml/qjsmanagedvalue.sip b/sip/QtQml/qjsmanagedvalue.sip new file mode 100644 index 0000000..fbe931a --- /dev/null +++ b/sip/QtQml/qjsmanagedvalue.sip @@ -0,0 +1,99 @@ +// qjsmanagedvalue.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_1_0 -) + +class QJSManagedValue /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum Type + { + Undefined, + Boolean, + Number, + String, + Object, + Symbol, + Function, + }; + + QJSManagedValue(); + QJSManagedValue(QJSValue value, QJSEngine *engine); + QJSManagedValue(const QJSPrimitiveValue &value, QJSEngine *engine); + QJSManagedValue(const QString &string, QJSEngine *engine); + QJSManagedValue(const QVariant &variant, QJSEngine *engine); + ~QJSManagedValue(); + bool equals(const QJSManagedValue &other) const; + bool strictlyEquals(const QJSManagedValue &other) const; + QJSEngine *engine() const; + QJSManagedValue prototype() const; + void setPrototype(const QJSManagedValue &prototype); + QJSManagedValue::Type type() const; + bool isUndefined() const; + bool isBoolean() const; + bool isNumber() const; + bool isString() const; + bool isObject() const; + bool isSymbol() const; + bool isFunction() const; + bool isInteger() const; + bool isNull() const; + bool isRegularExpression() const; + bool isArray() const; + bool isUrl() const; + bool isVariant() const; + bool isQObject() const; + bool isQMetaObject() const; + bool isDate() const; + bool isError() const; + QString toString() const; + double toNumber() const; + bool toBoolean() const; + QJSPrimitiveValue toPrimitive() const; + QJSValue toJSValue() const; + QVariant toVariant() const; + int toInteger() const; + QRegularExpression toRegularExpression() const; + QUrl toUrl() const; + QObject *toQObject() const; + const QMetaObject *toQMetaObject() const; + QDateTime toDateTime() const; + bool hasProperty(const QString &name) const; + bool hasOwnProperty(const QString &name) const; + QJSValue property(const QString &name) const; + void setProperty(const QString &name, const QJSValue &value); + bool deleteProperty(const QString &name); + bool hasProperty(quint32 arrayIndex) const; + bool hasOwnProperty(quint32 arrayIndex) const; + QJSValue property(quint32 arrayIndex) const; + void setProperty(quint32 arrayIndex, const QJSValue &value); + bool deleteProperty(quint32 arrayIndex); + QJSValue call(const QJSValueList &arguments = {}) const; + QJSValue callWithInstance(const QJSValue &instance, const QJSValueList &arguments = {}) const; + QJSValue callAsConstructor(const QJSValueList &arguments = {}) const; +}; + +%End diff --git a/sip/QtQml/qjsprimitivevalue.sip b/sip/QtQml/qjsprimitivevalue.sip new file mode 100644 index 0000000..7360753 --- /dev/null +++ b/sip/QtQml/qjsprimitivevalue.sip @@ -0,0 +1,117 @@ +// qjsprimitivevalue.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_1_0 -) + +struct QJSPrimitiveUndefined +{ +%TypeHeaderCode +#include +%End +}; + +%End +%If (Qt_6_1_0 -) + +struct QJSPrimitiveNull +{ +%TypeHeaderCode +#include +%End +}; + +%End +%If (Qt_6_1_0 -) + +class QJSPrimitiveValue +{ +%TypeHeaderCode +#include +%End + +public: + enum Type + { + Undefined, + Null, + Boolean, + Integer, + Double, + String, + }; + + QJSPrimitiveValue(); + QJSPrimitiveValue(QJSPrimitiveUndefined undefined); + QJSPrimitiveValue(QJSPrimitiveNull null); + QJSPrimitiveValue(bool value /Constrained/); + QJSPrimitiveValue(int value /Constrained/); + QJSPrimitiveValue(double value /Constrained/); + QJSPrimitiveValue(QString string); + QJSPrimitiveValue::Type type() const; + bool toBoolean() const; + int toInteger() const; + double toDouble() const; + QString toString() const; + bool strictlyEquals(const QJSPrimitiveValue &other) const; + bool equals(const QJSPrimitiveValue &other) const; +%If (Qt_6_2_0 -) + QJSPrimitiveValue operator+(); +%End +%If (Qt_6_2_0 -) + QJSPrimitiveValue operator-(); +%End +}; + +%End +%If (Qt_6_1_0 -) +QJSPrimitiveValue operator+(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +QJSPrimitiveValue operator-(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +QJSPrimitiveValue operator*(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +QJSPrimitiveValue operator/(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +QJSPrimitiveValue operator%(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +bool operator==(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +bool operator!=(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +bool operator<(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +bool operator>(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +bool operator<=(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End +%If (Qt_6_1_0 -) +bool operator>=(const QJSPrimitiveValue &lhs, const QJSPrimitiveValue &rhs); +%End diff --git a/sip/QtQml/qjsvalue.sip b/sip/QtQml/qjsvalue.sip new file mode 100644 index 0000000..dac2718 --- /dev/null +++ b/sip/QtQml/qjsvalue.sip @@ -0,0 +1,117 @@ +// qjsvalue.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +typedef QList QJSValueList; + +class QJSValue /TypeHintIn="Union[QJSValue, QJSValue.SpecialValue, bool, int, float, QString]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToTypeCode +if (!sipIsErr) + return qpyqml_canConvertTo_QJSValue(sipPy); + +return qpyqml_convertTo_QJSValue(sipPy, sipTransferObj, sipCppPtr, sipIsErr); +%End + +public: + enum SpecialValue + { + NullValue, + UndefinedValue, + }; + +%If (Qt_6_1_0 -) + + enum ObjectConversionBehavior + { + ConvertJSObjects, + RetainJSObjects, + }; + +%End + QJSValue(QJSValue::SpecialValue value /Constrained/ = QJSValue::UndefinedValue); + QJSValue(const QJSValue &other); + ~QJSValue(); + bool isBool() const; + bool isNumber() const; + bool isNull() const; + bool isString() const; + bool isUndefined() const; + bool isVariant() const; + bool isQObject() const; + bool isObject() const; + bool isDate() const; + bool isRegExp() const; + bool isArray() const; + bool isError() const; +%If (Qt_6_2_0 -) + bool isUrl() const; +%End + QString toString() const; + double toNumber() const; + qint32 toInt() const; + quint32 toUInt() const; + bool toBool() const; + QVariant toVariant() const; +%If (Qt_6_1_0 -) + QVariant toVariant(QJSValue::ObjectConversionBehavior behavior) const; +%End +%If (Qt_6_1_0 -) + QJSPrimitiveValue toPrimitive() const; +%End + QObject *toQObject() const; + QDateTime toDateTime() const; + bool equals(const QJSValue &other) const; + bool strictlyEquals(const QJSValue &other) const; + QJSValue prototype() const; + void setPrototype(const QJSValue &prototype); + QJSValue property(const QString &name) const; + void setProperty(const QString &name, const QJSValue &value); + bool hasProperty(const QString &name) const; + bool hasOwnProperty(const QString &name) const; + QJSValue property(quint32 arrayIndex) const; + void setProperty(quint32 arrayIndex, const QJSValue &value); + bool deleteProperty(const QString &name); + bool isCallable() const; + QJSValue call(const QJSValueList &args = QJSValueList()) const; + QJSValue callWithInstance(const QJSValue &instance, const QJSValueList &args = QJSValueList()) const; + QJSValue callAsConstructor(const QJSValueList &args = QJSValueList()) const; + + enum ErrorType + { + GenericError, + EvalError, + RangeError, + ReferenceError, + SyntaxError, + TypeError, + URIError, + }; + + QJSValue::ErrorType errorType() const; +}; + +QDataStream &operator<<(QDataStream &, const QJSValue &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QJSValue & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtQml/qjsvalueiterator.sip b/sip/QtQml/qjsvalueiterator.sip new file mode 100644 index 0000000..a1becf9 --- /dev/null +++ b/sip/QtQml/qjsvalueiterator.sip @@ -0,0 +1,39 @@ +// qjsvalueiterator.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QJSValueIterator +{ +%TypeHeaderCode +#include +%End + +public: + QJSValueIterator(const QJSValue &value); + ~QJSValueIterator(); + bool hasNext() const; + bool next(); + QString name() const; + QJSValue value() const; + +private: + QJSValueIterator(const QJSValueIterator &); +}; diff --git a/sip/QtQml/qmlattachedpropertiesobject.sip b/sip/QtQml/qmlattachedpropertiesobject.sip new file mode 100644 index 0000000..8457133 --- /dev/null +++ b/sip/QtQml/qmlattachedpropertiesobject.sip @@ -0,0 +1,42 @@ +// This is the SIP specification of the qmlAttachedPropertiesObject() function. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleHeaderCode +#include +%End + + +QObject *qmlAttachedPropertiesObject(SIP_PYTYPE, QObject *object, + bool create = true); +%MethodCode + QObject *proxy = qpyqml_find_proxy_for(a1); + + if (!proxy) + { + sipError = sipErrorFail; + } + else + { + const QMetaObject *mo = pyqt6_qtqml_get_qmetaobject((PyTypeObject *)a0); + + sipRes = qmlAttachedPropertiesObject(proxy, + qmlAttachedPropertiesFunction(nullptr, mo), a2); + } +%End diff --git a/sip/QtQml/qmlregistertype.sip b/sip/QtQml/qmlregistertype.sip new file mode 100644 index 0000000..64ca7ef --- /dev/null +++ b/sip/QtQml/qmlregistertype.sip @@ -0,0 +1,82 @@ +// This is the SIP specification of the template versions of qmlRegisterType() +// and related functions. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleHeaderCode +#include +%End + + +%ModuleCode +// Imports from QtCore. +pyqt6_qtqml_get_qmetaobject_t pyqt6_qtqml_get_qmetaobject; +%End + + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtqml_get_qmetaobject = (pyqt6_qtqml_get_qmetaobject_t)sipImportSymbol( + "pyqt6_get_qmetaobject"); +Q_ASSERT(pyqt6_qtqml_get_qmetaobject); +%End + + +int qmlRegisterRevision(SIP_PYTYPE, const char *uri, int major, int minor, + SIP_PYTYPE attachedProperties = 0); +%MethodCode + if ((sipRes = qpyqml_register_library_type((PyTypeObject *)a0, a1, a2, a3, nullptr, (PyTypeObject *)a4)) < 0) + sipError = sipErrorFail; +%End + + +int qmlRegisterSingletonInstance(const char *uri, int major, int minor, + const char *typeName, QObject *cppObject); + + +int qmlRegisterSingletonType(SIP_PYTYPE, const char *uri, int major, int minor, + SIP_PYCALLABLE factory /TypeHint="Callable[[QQmlEngine, QJSEngine], Any]"/, + const char *name = 0); +%MethodCode + if ((sipRes = qpyqml_register_singleton_type((PyTypeObject *)a0, a1, a2, a3, a5, a4)) < 0) + sipError = sipErrorFail; +%End + + +int qmlRegisterType(SIP_PYTYPE, const char *uri, int major, int minor, + const char *name = 0, SIP_PYTYPE attachedProperties = 0); +%MethodCode + if ((sipRes = qpyqml_register_library_type((PyTypeObject *)a0, a1, a2, a3, a4, (PyTypeObject *)a5)) < 0) + sipError = sipErrorFail; +%End + + +int qmlRegisterAnonymousType(SIP_PYTYPE, const char *uri, int major); +%MethodCode + if ((sipRes = qpyqml_register_anonymous_type((PyTypeObject *)a0, a1, a2)) < 0) + sipError = sipErrorFail; +%End + + +int qmlRegisterUncreatableType(SIP_PYTYPE, const char *uri, int major, + int minor, const QString &reason, const char *qmlName = 0); +%MethodCode + if ((sipRes = qpyqml_register_uncreatable_type((PyTypeObject *)a0, a1, a2, a3, a5, *a4)) < 0) + sipError = sipErrorFail; +%End diff --git a/sip/QtQml/qpyqmllistproperty.sip b/sip/QtQml/qpyqmllistproperty.sip new file mode 100644 index 0000000..64c1396 --- /dev/null +++ b/sip/QtQml/qpyqmllistproperty.sip @@ -0,0 +1,40 @@ +// This is the SIP specification of the QQmlListProperty mapped type. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QQmlListProperty /TypeHint="QQmlListProperty"/ +{ +%TypeHeaderCode +#include "qpyqmllistpropertywrapper.h" +%End + +%ConvertFromTypeCode + return qpyqml_QQmlListPropertyWrapper_New(sipCpp, 0); +%End + +%ConvertToTypeCode + if (sipIsErr == NULL) + return PyObject_IsInstance(sipPy, (PyObject *)qpyqml_QQmlListPropertyWrapper_TypeObject); + + *sipCppPtr = ((qpyqml_QQmlListPropertyWrapper *)sipPy)->qml_list_property; + + // It isn't a temporary copy. + return 0; +%End +}; diff --git a/sip/QtQml/qqml.sip b/sip/QtQml/qqml.sip new file mode 100644 index 0000000..1b739ec --- /dev/null +++ b/sip/QtQml/qqml.sip @@ -0,0 +1,36 @@ +// qqml.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +void qmlClearTypeRegistrations(); +int qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &message); +int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString &reason); +bool qmlProtectModule(const char *uri, int majVersion); +void qmlRegisterModule(const char *uri, int versionMajor, int versionMinor); +int qmlRegisterSingletonType(const QUrl &url, const char *uri, int versionMajor, int versionMinor, const char *qmlName); +int qmlRegisterType(const QUrl &url, const char *uri, int versionMajor, int versionMinor, const char *qmlName); +int qmlTypeId(const char *uri, int versionMajor, int versionMinor, const char *qmlName); +QQmlContext *qmlContext(const QObject *); +QQmlEngine *qmlEngine(const QObject *); diff --git a/sip/QtQml/qqmlabstracturlinterceptor.sip b/sip/QtQml/qqmlabstracturlinterceptor.sip new file mode 100644 index 0000000..71a7589 --- /dev/null +++ b/sip/QtQml/qqmlabstracturlinterceptor.sip @@ -0,0 +1,41 @@ +// qqmlabstracturlinterceptor.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlAbstractUrlInterceptor +{ +%TypeHeaderCode +#include +%End + +public: + enum DataType + { + QmlFile, + JavaScriptFile, + QmldirFile, + UrlString, + }; + + QQmlAbstractUrlInterceptor(); + virtual ~QQmlAbstractUrlInterceptor(); + virtual QUrl intercept(const QUrl &path, QQmlAbstractUrlInterceptor::DataType type) = 0; +}; diff --git a/sip/QtQml/qqmlapplicationengine.sip b/sip/QtQml/qqmlapplicationengine.sip new file mode 100644 index 0000000..e821121 --- /dev/null +++ b/sip/QtQml/qqmlapplicationengine.sip @@ -0,0 +1,54 @@ +// qqmlapplicationengine.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlApplicationEngine : QQmlEngine +{ +%TypeHeaderCode +#include +%End + +public: + QQmlApplicationEngine(QObject *parent /TransferThis/ = 0); + QQmlApplicationEngine(const QUrl &url, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QQmlApplicationEngine(const QString &filePath, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; +%If (Qt_6_5_0 -) + QQmlApplicationEngine(QAnyStringView uri, QAnyStringView typeName, QObject *parent /TransferThis/ = 0); +%End + virtual ~QQmlApplicationEngine(); + QList rootObjects() const; + +public slots: + void load(const QUrl &url) /ReleaseGIL/; + void load(const QString &filePath) /ReleaseGIL/; + void loadData(const QByteArray &data, const QUrl &url = QUrl()) /ReleaseGIL/; + void setExtraFileSelectors(const QStringList &extraFileSelectors); + void setInitialProperties(const QVariantMap &initialProperties); +%If (Qt_6_5_0 -) + void loadFromModule(QAnyStringView uri, QAnyStringView typeName); +%End + +signals: + void objectCreated(QObject *object, const QUrl &url); +%If (Qt_6_4_0 -) + void objectCreationFailed(const QUrl &url); +%End +}; diff --git a/sip/QtQml/qqmlcomponent.sip b/sip/QtQml/qqmlcomponent.sip new file mode 100644 index 0000000..62293c0 --- /dev/null +++ b/sip/QtQml/qqmlcomponent.sip @@ -0,0 +1,91 @@ +// qqmlcomponent.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlComponent : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum CompilationMode + { + PreferSynchronous, + Asynchronous, + }; + + QQmlComponent(QQmlEngine *, QObject *parent /TransferThis/ = 0); + QQmlComponent(QQmlEngine *, const QString &fileName, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QQmlComponent(QQmlEngine *, const QString &fileName, QQmlComponent::CompilationMode mode, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QQmlComponent(QQmlEngine *, const QUrl &url, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QQmlComponent(QQmlEngine *, const QUrl &url, QQmlComponent::CompilationMode mode, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; +%If (Qt_6_5_0 -) + QQmlComponent(QQmlEngine *engine, QAnyStringView uri, QAnyStringView typeName, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; +%End +%If (Qt_6_5_0 -) + QQmlComponent(QQmlEngine *engine, QAnyStringView uri, QAnyStringView typeName, QQmlComponent::CompilationMode mode, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; +%End + QQmlComponent(QObject *parent /TransferThis/ = 0); + virtual ~QQmlComponent(); + + enum Status + { + Null, + Ready, + Loading, + Error, + }; + + QQmlComponent::Status status() const; +%If (Qt_6_5_0 -) + bool isBound() const; +%End + bool isNull() const; + bool isReady() const; + bool isError() const; + bool isLoading() const; + QList errors() const; + qreal progress() const; + QUrl url() const; + virtual QObject *create(QQmlContext *context = 0) /TransferBack/; + QObject *createWithInitialProperties(const QVariantMap &initialProperties, QQmlContext *context = 0) /TransferBack/; + virtual QObject *beginCreate(QQmlContext *) /TransferBack/; + virtual void completeCreate(); + void create(QQmlIncubator &, QQmlContext *context = 0, QQmlContext *forContext = 0); + QQmlContext *creationContext() const; + +public slots: + void loadUrl(const QUrl &url) /ReleaseGIL/; + void loadUrl(const QUrl &url, QQmlComponent::CompilationMode mode) /ReleaseGIL/; + void setData(const QByteArray &, const QUrl &baseUrl); +%If (Qt_6_5_0 -) + void loadFromModule(QAnyStringView uri, QAnyStringView typeName, QQmlComponent::CompilationMode mode = QQmlComponent::PreferSynchronous); +%End + +signals: + void statusChanged(QQmlComponent::Status); + void progressChanged(qreal); + +public: + QQmlEngine *engine() const; + void setInitialProperties(QObject *component, const QVariantMap &properties); +}; diff --git a/sip/QtQml/qqmlcontext.sip b/sip/QtQml/qqmlcontext.sip new file mode 100644 index 0000000..59a1d2e --- /dev/null +++ b/sip/QtQml/qqmlcontext.sip @@ -0,0 +1,60 @@ +// qqmlcontext.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlContext : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QQmlContext(QQmlEngine *engine, QObject *parent /TransferThis/ = 0); + QQmlContext(QQmlContext *parentContext, QObject *parent /TransferThis/ = 0); + virtual ~QQmlContext(); + bool isValid() const; + QQmlEngine *engine() const; + QQmlContext *parentContext() const; + QObject *contextObject() const; + void setContextObject(QObject *); + QVariant contextProperty(const QString &) const; + void setContextProperty(const QString &, QObject *); + void setContextProperty(const QString &, const QVariant &); + QString nameForObject(const QObject *) const; + QUrl resolvedUrl(const QUrl &) const; + void setBaseUrl(const QUrl &); + QUrl baseUrl() const; + + struct PropertyPair + { +%TypeHeaderCode +#include +%End + + QString name; + QVariant value; + }; + + void setContextProperties(const QList &properties); +%If (Qt_6_2_0 -) + QObject *objectForName(const QString &) const; +%End +}; diff --git a/sip/QtQml/qqmlengine.sip b/sip/QtQml/qqmlengine.sip new file mode 100644 index 0000000..b291756 --- /dev/null +++ b/sip/QtQml/qqmlengine.sip @@ -0,0 +1,184 @@ +// qqmlengine.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlEngine : QJSEngine +{ +%TypeHeaderCode +#include +%End + +public: + explicit QQmlEngine(QObject *parent /TransferThis/ = 0); + virtual ~QQmlEngine(); + QQmlContext *rootContext() const; + void clearComponentCache(); + void trimComponentCache(); + QStringList importPathList() const; + void setImportPathList(const QStringList &paths); + void addImportPath(const QString &dir); + QStringList pluginPathList() const; + void setPluginPathList(const QStringList &paths); + void addPluginPath(const QString &dir); + bool importPlugin(const QString &filePath, const QString &uri, QList *errors /GetWrapper/); +%MethodCode + int orig_size = (a2 ? a2->size() : 0); + + sipRes = sipCpp->importPlugin(*a0, *a1, a2); + + if (a2) + { + for (int i = a2->size(); i > orig_size; --i) + { + QQmlError *new_error = new QQmlError(a2->at(i - orig_size - 1)); + PyObject *new_error_obj = sipConvertFromNewType(new_error, sipType_QQmlError, 0); + + if (!new_error_obj) + { + delete new_error; + sipError = sipErrorFail; + break; + } + + if (PyList_Insert(a2Wrapper, 0, new_error_obj) < 0) + { + Py_DECREF(new_error_obj); + sipError = sipErrorFail; + break; + } + + Py_DECREF(new_error_obj); + } + } +%End + + void setNetworkAccessManagerFactory(QQmlNetworkAccessManagerFactory * /KeepReference/); + QQmlNetworkAccessManagerFactory *networkAccessManagerFactory() const; + QNetworkAccessManager *networkAccessManager() const; + void addImageProvider(const QString &id, QQmlImageProviderBase * /Transfer/); + QQmlImageProviderBase *imageProvider(const QString &id) const; + void removeImageProvider(const QString &id); + void setIncubationController(QQmlIncubationController * /KeepReference/); + QQmlIncubationController *incubationController() const; + void setOfflineStoragePath(const QString &dir); + QString offlineStoragePath() const; + QUrl baseUrl() const; + void setBaseUrl(const QUrl &); + bool outputWarningsToStandardError() const; + void setOutputWarningsToStandardError(bool); + static QQmlContext *contextForObject(const QObject *); + static void setContextForObject(QObject *, QQmlContext *); + +public slots: + void retranslate(); + +protected: + virtual bool event(QEvent *); + +signals: + void quit(); + void warnings(const QList &warnings); + void exit(int retCode); + +public: + QString offlineStorageDatabaseFilePath(const QString &databaseName) const; + SIP_PYOBJECT singletonInstance(int qmlTypeId) /TypeHint="QObject"/; +%MethodCode + QJSValue instance = sipCpp->singletonInstance(a0); + + if (instance.isQObject()) + { + sipRes = sipConvertFromType(instance.toQObject(), sipType_QObject, NULL); + + if (!sipRes) + sipError = sipErrorFail; + } + else + { + sipRes = Py_None; + Py_INCREF(sipRes); + } +%End + +%If (Qt_6_5_0 -) + SIP_PYOBJECT singletonInstance(QAnyStringView moduleName, QAnyStringView typeName) /TypeHint="QObject"/; +%MethodCode + QJSValue instance = sipCpp->singletonInstance(*a0, *a1); + + if (instance.isQObject()) + { + sipRes = sipConvertFromType(instance.toQObject(), sipType_QObject, NULL); + + if (!sipRes) + sipError = sipErrorFail; + } + else + { + sipRes = Py_None; + Py_INCREF(sipRes); + } +%End + +%End + void addUrlInterceptor(QQmlAbstractUrlInterceptor *urlInterceptor); + void removeUrlInterceptor(QQmlAbstractUrlInterceptor *urlInterceptor); + QUrl interceptUrl(const QUrl &url, QQmlAbstractUrlInterceptor::DataType type) const; +%If (Qt_6_2_0 -) + QList urlInterceptors() const; +%End +%If (Qt_6_3_0 -) + void clearSingletons(); +%End + +signals: +%If (Qt_6_5_0 -) + void offlineStoragePathChanged(); +%End +}; + +class QQmlImageProviderBase : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum ImageType + { + Image, + Pixmap, + Texture, + ImageResponse, + }; + + enum Flag /BaseType=Flag/ + { + ForceAsynchronousImageLoading, + }; + + typedef QFlags Flags; + virtual ~QQmlImageProviderBase(); + virtual QQmlImageProviderBase::ImageType imageType() const = 0; + virtual QQmlImageProviderBase::Flags flags() const = 0; + +private: + QQmlImageProviderBase(); +}; diff --git a/sip/QtQml/qqmlerror.sip b/sip/QtQml/qqmlerror.sip new file mode 100644 index 0000000..2093032 --- /dev/null +++ b/sip/QtQml/qqmlerror.sip @@ -0,0 +1,52 @@ +// qqmlerror.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlError +{ +%TypeHeaderCode +#include +%End + +public: + QQmlError(); + QQmlError(const QQmlError &); + ~QQmlError(); + bool isValid() const; + QUrl url() const; + void setUrl(const QUrl &); + QString description() const; + void setDescription(const QString &); + int line() const; + void setLine(int); + int column() const; + void setColumn(int); + QString toString() const; + QObject *object() const; + void setObject(QObject *); + QtMsgType messageType() const; + void setMessageType(QtMsgType messageType); +%If (Qt_6_4_0 -) + void swap(QQmlError &other); +%End +}; + +bool operator==(const QQmlError &a, const QQmlError &b); diff --git a/sip/QtQml/qqmlexpression.sip b/sip/QtQml/qqmlexpression.sip new file mode 100644 index 0000000..596eae9 --- /dev/null +++ b/sip/QtQml/qqmlexpression.sip @@ -0,0 +1,52 @@ +// qqmlexpression.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlExpression : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QQmlExpression(); + QQmlExpression(QQmlContext *, QObject *, const QString &, QObject *parent /TransferThis/ = 0); + QQmlExpression(const QQmlScriptString &, QQmlContext *context = 0, QObject *scope = 0, QObject *parent /TransferThis/ = 0); + virtual ~QQmlExpression(); + QQmlEngine *engine() const; + QQmlContext *context() const; + QString expression() const; + void setExpression(const QString &); + bool notifyOnValueChanged() const; + void setNotifyOnValueChanged(bool); + QString sourceFile() const; + int lineNumber() const; + int columnNumber() const; + void setSourceLocation(const QString &fileName, int line, int column = 0); + QObject *scopeObject() const; + bool hasError() const; + void clearError(); + QQmlError error() const; + QVariant evaluate(bool *valueIsUndefined = 0) /ReleaseGIL/; + +signals: + void valueChanged(); +}; diff --git a/sip/QtQml/qqmlextensionplugin.sip b/sip/QtQml/qqmlextensionplugin.sip new file mode 100644 index 0000000..8033276 --- /dev/null +++ b/sip/QtQml/qqmlextensionplugin.sip @@ -0,0 +1,47 @@ +// qqmlextensionplugin.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlExtensionPlugin : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QQmlExtensionPlugin(QObject *parent /TransferThis/ = 0); + virtual ~QQmlExtensionPlugin(); + virtual void registerTypes(const char *uri) = 0; + QUrl baseUrl() const; + virtual void unregisterTypes(); +}; + +class QQmlEngineExtensionPlugin : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QQmlEngineExtensionPlugin(QObject *parent /TransferThis/ = 0); + virtual ~QQmlEngineExtensionPlugin(); + virtual void initializeEngine(QQmlEngine *engine, const char *uri); +}; diff --git a/sip/QtQml/qqmlfileselector.sip b/sip/QtQml/qqmlfileselector.sip new file mode 100644 index 0000000..7741f0c --- /dev/null +++ b/sip/QtQml/qqmlfileselector.sip @@ -0,0 +1,35 @@ +// qqmlfileselector.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlFileSelector : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QQmlFileSelector(QQmlEngine *engine, QObject *parent /TransferThis/ = 0); + virtual ~QQmlFileSelector(); + void setSelector(QFileSelector *selector); + void setExtraSelectors(const QStringList &strings); + QFileSelector *selector() const; +}; diff --git a/sip/QtQml/qqmlincubator.sip b/sip/QtQml/qqmlincubator.sip new file mode 100644 index 0000000..8c1c8b5 --- /dev/null +++ b/sip/QtQml/qqmlincubator.sip @@ -0,0 +1,85 @@ +// qqmlincubator.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlIncubator +{ +%TypeHeaderCode +#include +%End + +public: + enum IncubationMode + { + Asynchronous, + AsynchronousIfNested, + Synchronous, + }; + + enum Status + { + Null, + Ready, + Loading, + Error, + }; + + QQmlIncubator(QQmlIncubator::IncubationMode mode = QQmlIncubator::Asynchronous); + virtual ~QQmlIncubator(); + void clear(); + void forceCompletion(); + bool isNull() const; + bool isReady() const; + bool isError() const; + bool isLoading() const; + QList errors() const; + QQmlIncubator::IncubationMode incubationMode() const; + QQmlIncubator::Status status() const; + QObject *object() const /Factory/; + void setInitialProperties(const QVariantMap &initialProperties); + +protected: + virtual void statusChanged(QQmlIncubator::Status); + virtual void setInitialState(QObject *); + +private: + QQmlIncubator(const QQmlIncubator &); +}; + +class QQmlIncubationController +{ +%TypeHeaderCode +#include +%End + +public: + QQmlIncubationController(); + virtual ~QQmlIncubationController(); + QQmlEngine *engine() const; + int incubatingObjectCount() const; + void incubateFor(int msecs) /ReleaseGIL/; + +protected: + virtual void incubatingObjectCountChanged(int); + +private: + QQmlIncubationController(const QQmlIncubationController &); +}; diff --git a/sip/QtQml/qqmllist.sip b/sip/QtQml/qqmllist.sip new file mode 100644 index 0000000..994b92e --- /dev/null +++ b/sip/QtQml/qqmllist.sip @@ -0,0 +1,55 @@ +// qqmllist.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlListReference +{ +%TypeHeaderCode +#include +%End + +public: + QQmlListReference(); + QQmlListReference(QObject *, const char *property, QQmlEngine *engine = 0); + QQmlListReference(const QQmlListReference &); +%If (Qt_6_1_0 -) + QQmlListReference(const QVariant &variant, QQmlEngine *engine = 0); +%End + ~QQmlListReference(); + bool isValid() const; + QObject *object() const; + const QMetaObject *listElementType() const; + bool canAppend() const; + bool canAt() const; + bool canClear() const; + bool canCount() const; + bool isManipulable() const; + bool isReadable() const; + bool append(QObject *) const; + QObject *at(qsizetype) const; + bool clear() const; + qsizetype count() const /__len__/; + bool canReplace() const; + bool canRemoveLast() const; + bool replace(qsizetype, QObject *) const; + bool removeLast() const; + bool operator==(const QQmlListReference &other) const; +}; diff --git a/sip/QtQml/qqmlnetworkaccessmanagerfactory.sip b/sip/QtQml/qqmlnetworkaccessmanagerfactory.sip new file mode 100644 index 0000000..847a4b7 --- /dev/null +++ b/sip/QtQml/qqmlnetworkaccessmanagerfactory.sip @@ -0,0 +1,32 @@ +// qqmlnetworkaccessmanagerfactory.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlNetworkAccessManagerFactory +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QQmlNetworkAccessManagerFactory(); + virtual QNetworkAccessManager *create(QObject *parent) = 0; +}; diff --git a/sip/QtQml/qqmlparserstatus.sip b/sip/QtQml/qqmlparserstatus.sip new file mode 100644 index 0000000..2f288e0 --- /dev/null +++ b/sip/QtQml/qqmlparserstatus.sip @@ -0,0 +1,34 @@ +// qqmlparserstatus.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlParserStatus /Mixin,PyQtInterface="org.qt-project.Qt.QQmlParserStatus"/ +{ +%TypeHeaderCode +#include +%End + +public: + QQmlParserStatus(); + virtual ~QQmlParserStatus(); + virtual void classBegin() = 0; + virtual void componentComplete() = 0; +}; diff --git a/sip/QtQml/qqmlproperty.sip b/sip/QtQml/qqmlproperty.sip new file mode 100644 index 0000000..74bb639 --- /dev/null +++ b/sip/QtQml/qqmlproperty.sip @@ -0,0 +1,130 @@ +// qqmlproperty.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlProperty +{ +%TypeHeaderCode +#include +%End + +public: + enum PropertyTypeCategory + { + InvalidCategory, + List, + Object, + Normal, + }; + + enum Type + { + Invalid, + Property, + SignalProperty, + }; + + QQmlProperty(); + QQmlProperty(QObject *); + QQmlProperty(QObject *, QQmlContext *); + QQmlProperty(QObject *, QQmlEngine *); + QQmlProperty(QObject *, const QString &); + QQmlProperty(QObject *, const QString &, QQmlContext *); + QQmlProperty(QObject *, const QString &, QQmlEngine *); + QQmlProperty(const QQmlProperty &); + ~QQmlProperty(); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End + + bool operator==(const QQmlProperty &) const; + QQmlProperty::Type type() const; + bool isValid() const; + bool isProperty() const; + bool isSignalProperty() const; +%If (Qt_6_2_0 -) + bool isBindable() const; +%End + int propertyType() const; + QQmlProperty::PropertyTypeCategory propertyTypeCategory() const; + const char *propertyTypeName() const; +%If (Qt_6_1_0 -) + QMetaType propertyMetaType() const; +%End + QString name() const; + QVariant read() const; + static QVariant read(const QObject *, const QString &); + static QVariant read(const QObject *, const QString &, QQmlContext *); + static QVariant read(const QObject *, const QString &, QQmlEngine *); + bool write(const QVariant &) const; + static bool write(QObject *, const QString &, const QVariant &); + static bool write(QObject *, const QString &, const QVariant &, QQmlContext *); + static bool write(QObject *, const QString &, const QVariant &, QQmlEngine *); + bool reset() const; + bool hasNotifySignal() const; + bool needsNotifySignal() const; + bool connectNotifySignal(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) const; +%MethodCode + QObject *receiver; + QByteArray slot; + + if ((sipError = pyqt6_qtqml_get_connection_parts(a0, 0, "()", false, &receiver, slot)) == sipErrorNone) + { + sipRes = sipCpp->connectNotifySignal(receiver, slot.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + + bool connectNotifySignal(QObject *dest, int method) const; + bool isWritable() const; + bool isDesignable() const; + bool isResettable() const; + QObject *object() const; + int index() const; + QMetaProperty property() const; + QMetaMethod method() const; +%If (Qt_6_3_0 -) + void swap(QQmlProperty &other); +%End +}; + +typedef QList QQmlProperties; + +%ModuleHeaderCode +// Imports from QtCore. +typedef sipErrorState (*pyqt6_qtqml_get_connection_parts_t)(PyObject *, QObject *, const char *, bool, QObject **, QByteArray &); +extern pyqt6_qtqml_get_connection_parts_t pyqt6_qtqml_get_connection_parts; +%End + +%ModuleCode +// Imports from QtCore. +pyqt6_qtqml_get_connection_parts_t pyqt6_qtqml_get_connection_parts; +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtqml_get_connection_parts = (pyqt6_qtqml_get_connection_parts_t)sipImportSymbol("pyqt6_get_connection_parts"); +Q_ASSERT(pyqt6_qtqml_get_connection_parts); +%End diff --git a/sip/QtQml/qqmlpropertymap.sip b/sip/QtQml/qqmlpropertymap.sip new file mode 100644 index 0000000..ed9ee43 --- /dev/null +++ b/sip/QtQml/qqmlpropertymap.sip @@ -0,0 +1,53 @@ +// qqmlpropertymap.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlPropertyMap : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QQmlPropertyMap(QObject *parent /TransferThis/ = 0); + virtual ~QQmlPropertyMap(); + QVariant value(const QString &key) const; +%If (Qt_6_1_0 -) + void insert(const QVariantHash &values); +%End + void insert(const QString &key, const QVariant &value); +%If (Qt_6_1_0 -) + void freeze(); +%End + void clear(const QString &key); + QStringList keys() const; + int count() const; + int size() const /__len__/; + bool isEmpty() const; + bool contains(const QString &key) const; + QVariant operator[](const QString &key) const; + +signals: + void valueChanged(const QString &key, const QVariant &value); + +protected: + virtual QVariant updateValue(const QString &key, const QVariant &input); +}; diff --git a/sip/QtQml/qqmlpropertyvaluesource.sip b/sip/QtQml/qqmlpropertyvaluesource.sip new file mode 100644 index 0000000..c72af45 --- /dev/null +++ b/sip/QtQml/qqmlpropertyvaluesource.sip @@ -0,0 +1,33 @@ +// qqmlpropertyvaluesource.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlPropertyValueSource /Mixin,PyQtInterface="org.qt-project.Qt.QQmlPropertyValueSource"/ +{ +%TypeHeaderCode +#include +%End + +public: + QQmlPropertyValueSource(); + virtual ~QQmlPropertyValueSource(); + virtual void setTarget(const QQmlProperty &) = 0; +}; diff --git a/sip/QtQml/qqmlscriptstring.sip b/sip/QtQml/qqmlscriptstring.sip new file mode 100644 index 0000000..b2f43e1 --- /dev/null +++ b/sip/QtQml/qqmlscriptstring.sip @@ -0,0 +1,41 @@ +// qqmlscriptstring.sip generated by MetaSIP +// +// This file is part of the QtQml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQmlScriptString +{ +%TypeHeaderCode +#include +%End + +public: + QQmlScriptString(); + QQmlScriptString(const QQmlScriptString &); + ~QQmlScriptString(); + bool isEmpty() const; + bool isUndefinedLiteral() const; + bool isNullLiteral() const; + QString stringLiteral() const; + qreal numberLiteral(bool *ok) const; + bool booleanLiteral(bool *ok) const; + bool operator==(const QQmlScriptString &) const; + bool operator!=(const QQmlScriptString &) const; +}; diff --git a/sip/QtQuick/QtQuickmod.sip b/sip/QtQuick/QtQuickmod.sip new file mode 100644 index 0000000..032d807 --- /dev/null +++ b/sip/QtQuick/QtQuickmod.sip @@ -0,0 +1,78 @@ +// QtQuickmod.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtQuick, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtQml/QtQmlmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qquickframebufferobject.sip +%Include qquickgraphicsconfiguration.sip +%Include qquickgraphicsdevice.sip +%Include qquickimageprovider.sip +%Include qquickitem.sip +%Include qquickitemgrabresult.sip +%Include qquickpainteditem.sip +%Include qquickrendercontrol.sip +%Include qquickrendertarget.sip +%Include qquicktextdocument.sip +%Include qquickview.sip +%Include qquickwindow.sip +%Include qsgflatcolormaterial.sip +%Include qsggeometry.sip +%Include qsgimagenode.sip +%Include qsgmaterial.sip +%Include qsgmaterialshader.sip +%Include qsgmaterialtype.sip +%Include qsgnode.sip +%Include qsgrectanglenode.sip +%Include qsgrendererinterface.sip +%Include qsgrendernode.sip +%Include qsgsimplerectnode.sip +%Include qsgsimpletexturenode.sip +%Include qsgtexture.sip +%Include qsgtexture_platform.sip +%Include qsgtexturematerial.sip +%Include qsgtextureprovider.sip +%Include qsgvertexcolormaterial.sip diff --git a/sip/QtQuick/qquickframebufferobject.sip b/sip/QtQuick/qquickframebufferobject.sip new file mode 100644 index 0000000..0c50431 --- /dev/null +++ b/sip/QtQuick/qquickframebufferobject.sip @@ -0,0 +1,81 @@ +// qquickframebufferobject.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QOpenGLFramebufferObject /External/; + +class QQuickFramebufferObject : QQuickItem /ExportDerived/ +{ +%TypeHeaderCode +#include +%End + +public: + class Renderer /Supertype=PyQt6.sip.wrapper/ + { +%TypeHintCode +try: + from PyQt6.QtOpenGL import QOpenGLFramebufferObject +except ImportError: + pass +%End + +%TypeHeaderCode +#include +%End + + protected: + Renderer(); + virtual ~Renderer(); + virtual void render() = 0; +%If (PyQt_OpenGL) + virtual QOpenGLFramebufferObject *createFramebufferObject(const QSize &size); +%End + virtual void synchronize(QQuickFramebufferObject *); +%If (PyQt_OpenGL) + QOpenGLFramebufferObject *framebufferObject() const; +%End + void update(); + void invalidateFramebufferObject(); + }; + + QQuickFramebufferObject(QQuickItem *parent /TransferThis/ = 0); + bool textureFollowsItemSize() const; + void setTextureFollowsItemSize(bool follows); + virtual QQuickFramebufferObject::Renderer *createRenderer() const = 0 /Factory/; + +protected: + virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry); + virtual QSGNode *updatePaintNode(QSGNode *, QQuickItem::UpdatePaintNodeData *); + +signals: + void textureFollowsItemSizeChanged(bool); + +public: + virtual bool isTextureProvider() const; + virtual QSGTextureProvider *textureProvider() const; + virtual void releaseResources(); + bool mirrorVertically() const; + void setMirrorVertically(bool enable); + +signals: + void mirrorVerticallyChanged(bool); +}; diff --git a/sip/QtQuick/qquickgraphicsconfiguration.sip b/sip/QtQuick/qquickgraphicsconfiguration.sip new file mode 100644 index 0000000..676461b --- /dev/null +++ b/sip/QtQuick/qquickgraphicsconfiguration.sip @@ -0,0 +1,76 @@ +// qquickgraphicsconfiguration.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickGraphicsConfiguration +{ +%TypeHeaderCode +#include +%End + +public: + QQuickGraphicsConfiguration(); + QQuickGraphicsConfiguration(const QQuickGraphicsConfiguration &other); + ~QQuickGraphicsConfiguration(); + void setDeviceExtensions(const QByteArrayList &extensions); + QByteArrayList deviceExtensions() const; + void setDepthBufferFor2D(bool enable); + bool isDepthBufferEnabledFor2D() const; +%If (Qt_6_1_0 -) + static QByteArrayList preferredInstanceExtensions(); +%End +%If (Qt_6_5_0 -) + void setDebugLayer(bool enable); +%End +%If (Qt_6_5_0 -) + bool isDebugLayerEnabled() const; +%End +%If (Qt_6_5_0 -) + void setDebugMarkers(bool enable); +%End +%If (Qt_6_5_0 -) + bool isDebugMarkersEnabled() const; +%End +%If (Qt_6_5_0 -) + void setPreferSoftwareDevice(bool enable); +%End +%If (Qt_6_5_0 -) + bool prefersSoftwareDevice() const; +%End +%If (Qt_6_5_0 -) + void setAutomaticPipelineCache(bool enable); +%End +%If (Qt_6_5_0 -) + bool isAutomaticPipelineCacheEnabled() const; +%End +%If (Qt_6_5_0 -) + void setPipelineCacheSaveFile(const QString &filename); +%End +%If (Qt_6_5_0 -) + QString pipelineCacheSaveFile() const; +%End +%If (Qt_6_5_0 -) + void setPipelineCacheLoadFile(const QString &filename); +%End +%If (Qt_6_5_0 -) + QString pipelineCacheLoadFile() const; +%End +}; diff --git a/sip/QtQuick/qquickgraphicsdevice.sip b/sip/QtQuick/qquickgraphicsdevice.sip new file mode 100644 index 0000000..f7ce885 --- /dev/null +++ b/sip/QtQuick/qquickgraphicsdevice.sip @@ -0,0 +1,37 @@ +// qquickgraphicsdevice.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickGraphicsDevice +{ +%TypeHeaderCode +#include +%End + +public: + QQuickGraphicsDevice(); + ~QQuickGraphicsDevice(); + QQuickGraphicsDevice(const QQuickGraphicsDevice &other); + bool isNull() const; +%If (PyQt_OpenGL) + static QQuickGraphicsDevice fromOpenGLContext(QOpenGLContext *context); +%End +}; diff --git a/sip/QtQuick/qquickimageprovider.sip b/sip/QtQuick/qquickimageprovider.sip new file mode 100644 index 0000000..f1a173e --- /dev/null +++ b/sip/QtQuick/qquickimageprovider.sip @@ -0,0 +1,84 @@ +// qquickimageprovider.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickTextureFactory : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QQuickTextureFactory(); + virtual ~QQuickTextureFactory(); + virtual QSGTexture *createTexture(QQuickWindow *window) const = 0 /Factory/; + virtual QSize textureSize() const = 0; + virtual int textureByteCount() const = 0; + virtual QImage image() const; + static QQuickTextureFactory *textureFactoryForImage(const QImage &image) /Factory/; +}; + +class QQuickImageProvider : QQmlImageProviderBase +{ +%TypeHeaderCode +#include +%End + +public: + QQuickImageProvider(QQmlImageProviderBase::ImageType type, QQmlImageProviderBase::Flags flags = QQmlImageProviderBase::Flags()); + virtual ~QQuickImageProvider(); + virtual QQmlImageProviderBase::ImageType imageType() const; + virtual QQmlImageProviderBase::Flags flags() const; + virtual QImage requestImage(const QString &id, QSize *size /Out/, const QSize &requestedSize); + virtual QPixmap requestPixmap(const QString &id, QSize *size /Out/, const QSize &requestedSize); + virtual QQuickTextureFactory *requestTexture(const QString &id, QSize *size /Out/, const QSize &requestedSize) /Factory/; +}; + +class QQuickImageResponse : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QQuickImageResponse(); + virtual ~QQuickImageResponse(); + virtual QQuickTextureFactory *textureFactory() const = 0 /Factory/; + virtual QString errorString() const; + +public slots: + virtual void cancel(); + +signals: + void finished(); +}; + +class QQuickAsyncImageProvider : QQuickImageProvider +{ +%TypeHeaderCode +#include +%End + +public: + QQuickAsyncImageProvider(); + virtual ~QQuickAsyncImageProvider(); + virtual QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) = 0 /Factory/; +}; diff --git a/sip/QtQuick/qquickitem.sip b/sip/QtQuick/qquickitem.sip new file mode 100644 index 0000000..d9ff83e --- /dev/null +++ b/sip/QtQuick/qquickitem.sip @@ -0,0 +1,320 @@ +// qquickitem.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickItem : QObject, QQmlParserStatus /ExportDerived/ +{ +%TypeHeaderCode +#include +%End + +public: + enum Flag /BaseType=Flag/ + { + ItemClipsChildrenToShape, + ItemAcceptsInputMethod, + ItemIsFocusScope, + ItemHasContents, + ItemAcceptsDrops, +%If (Qt_6_3_0 -) + ItemIsViewport, +%End +%If (Qt_6_3_0 -) + ItemObservesViewport, +%End + }; + + typedef QFlags Flags; + + enum ItemChange + { + ItemChildAddedChange, + ItemChildRemovedChange, + ItemSceneChange, + ItemVisibleHasChanged, + ItemParentHasChanged, + ItemOpacityHasChanged, + ItemActiveFocusHasChanged, + ItemRotationHasChanged, + ItemAntialiasingHasChanged, + ItemDevicePixelRatioHasChanged, + ItemEnabledHasChanged, + }; + + struct ItemChangeData + { +%TypeHeaderCode +#include +%End + + ItemChangeData(QQuickItem *v); + ItemChangeData(QQuickWindow *v); + ItemChangeData(qreal v /Constrained/); + ItemChangeData(bool v /Constrained/); + QQuickItem *item; + QQuickWindow *window; + qreal realValue; + bool boolValue; + }; + + enum TransformOrigin + { + TopLeft, + Top, + TopRight, + Left, + Center, + Right, + BottomLeft, + Bottom, + BottomRight, + }; + + explicit QQuickItem(QQuickItem *parent /TransferThis/ = 0); + virtual ~QQuickItem(); + QQuickWindow *window() const; + QQuickItem *parentItem() const; + void setParentItem(QQuickItem *parent); + void stackBefore(const QQuickItem *); + void stackAfter(const QQuickItem *); + QRectF childrenRect(); + QList childItems() const; + bool clip() const; + void setClip(bool); + QString state() const; + void setState(const QString &); + qreal baselineOffset() const; + void setBaselineOffset(qreal); + qreal x() const; + qreal y() const; + void setX(qreal); + void setY(qreal); + qreal width() const; + void setWidth(qreal); + void resetWidth(); + void setImplicitWidth(qreal); + qreal implicitWidth() const; + qreal height() const; + void setHeight(qreal); + void resetHeight(); + void setImplicitHeight(qreal); + qreal implicitHeight() const; + void setSize(const QSizeF &size); + QQuickItem::TransformOrigin transformOrigin() const; + void setTransformOrigin(QQuickItem::TransformOrigin); + qreal z() const; + void setZ(qreal); + qreal rotation() const; + void setRotation(qreal); + qreal scale() const; + void setScale(qreal); + qreal opacity() const; + void setOpacity(qreal); + bool isVisible() const; + void setVisible(bool); + bool isEnabled() const; + void setEnabled(bool); + bool smooth() const; + void setSmooth(bool); + bool antialiasing() const; + void setAntialiasing(bool); + QQuickItem::Flags flags() const; + void setFlag(QQuickItem::Flag flag, bool enabled = true); + void setFlags(QQuickItem::Flags flags); + bool hasActiveFocus() const; + bool hasFocus() const; + void setFocus(bool); + bool isFocusScope() const; + QQuickItem *scopedFocusItem() const; + Qt::MouseButtons acceptedMouseButtons() const; + void setAcceptedMouseButtons(Qt::MouseButtons buttons); + bool acceptHoverEvents() const; + void setAcceptHoverEvents(bool enabled); + QCursor cursor() const; + void setCursor(const QCursor &cursor); + void unsetCursor(); + void grabMouse(); + void ungrabMouse(); + bool keepMouseGrab() const; + void setKeepMouseGrab(bool); + bool filtersChildMouseEvents() const; + void setFiltersChildMouseEvents(bool filter); + void grabTouchPoints(const QList &ids); + void ungrabTouchPoints(); + bool keepTouchGrab() const; + void setKeepTouchGrab(bool); + virtual bool contains(const QPointF &point) const; + QPointF mapToItem(const QQuickItem *item, const QPointF &point) const; + QPointF mapToScene(const QPointF &point) const; + QRectF mapRectToItem(const QQuickItem *item, const QRectF &rect) const; + QRectF mapRectToScene(const QRectF &rect) const; + QPointF mapFromItem(const QQuickItem *item, const QPointF &point) const; + QPointF mapFromScene(const QPointF &point) const; + QRectF mapRectFromItem(const QQuickItem *item, const QRectF &rect) const; + QRectF mapRectFromScene(const QRectF &rect) const; + void polish(); + void forceActiveFocus(); + QQuickItem *childAt(qreal x, qreal y) const; + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + + struct UpdatePaintNodeData + { +%TypeHeaderCode +#include +%End + + QSGTransformNode *transformNode; + + private: + UpdatePaintNodeData(); + }; + + virtual bool isTextureProvider() const; + virtual QSGTextureProvider *textureProvider() const; + +public slots: + void update() /ReleaseGIL/; + +signals: + void childrenRectChanged(const QRectF &); + void baselineOffsetChanged(qreal); + void stateChanged(const QString &); + void focusChanged(bool); + void activeFocusChanged(bool); + void parentChanged(QQuickItem *); + void transformOriginChanged(QQuickItem::TransformOrigin); + void smoothChanged(bool); + void antialiasingChanged(bool); + void clipChanged(bool); + void opacityChanged(); + void enabledChanged(); + void visibleChanged(); + void rotationChanged(); + void scaleChanged(); + void xChanged(); + void yChanged(); + void widthChanged(); + void heightChanged(); + void zChanged(); + void implicitWidthChanged(); + void implicitHeightChanged(); + +protected: + virtual bool event(QEvent *); + bool isComponentComplete() const; + virtual void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &); + void updateInputMethod(Qt::InputMethodQueries queries = Qt::ImQueryInput); + bool widthValid() const; + bool heightValid() const; + virtual void classBegin(); + virtual void componentComplete(); + virtual void keyPressEvent(QKeyEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual void focusOutEvent(QFocusEvent *); + virtual void mousePressEvent(QMouseEvent *event); + virtual void mouseMoveEvent(QMouseEvent *event); + virtual void mouseReleaseEvent(QMouseEvent *event); + virtual void mouseDoubleClickEvent(QMouseEvent *event); + virtual void mouseUngrabEvent(); + virtual void touchUngrabEvent(); + virtual void wheelEvent(QWheelEvent *event); + virtual void touchEvent(QTouchEvent *event); + virtual void hoverEnterEvent(QHoverEvent *event); + virtual void hoverMoveEvent(QHoverEvent *event); + virtual void hoverLeaveEvent(QHoverEvent *event); + virtual void dragEnterEvent(QDragEnterEvent *); + virtual void dragMoveEvent(QDragMoveEvent *); + virtual void dragLeaveEvent(QDragLeaveEvent *); + virtual void dropEvent(QDropEvent *); + virtual bool childMouseEventFilter(QQuickItem *, QEvent *); + virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry); + virtual QSGNode *updatePaintNode(QSGNode *, QQuickItem::UpdatePaintNodeData *); +%VirtualCatcherCode + PyObject *res; + + res = sipCallMethod(&sipIsErr, sipMethod, "DD", + a0, sipType_QSGNode, NULL, + a1, sipType_QQuickItem_UpdatePaintNodeData, NULL); + + if (res) + { + sipParseResult(&sipIsErr, sipMethod, res, "H0", sipType_QSGNode, &sipRes); + + if (!sipIsErr && sipRes && (sipRes->flags() & QSGNode::OwnedByParent)) + sipTransferTo(res, (PyObject *)sipPySelf); + + Py_DECREF(res); + } +%End + + virtual void releaseResources(); + virtual void updatePolish(); + +public: + bool activeFocusOnTab() const; + void setActiveFocusOnTab(bool); + void setFocus(bool focus, Qt::FocusReason reason); + void forceActiveFocus(Qt::FocusReason reason); + QQuickItem *nextItemInFocusChain(bool forward = true); + +signals: + void activeFocusOnTabChanged(bool); + void windowChanged(QQuickWindow *window); + +public: + void resetAntialiasing(); + QQuickItemGrabResult *grabToImage(const QSize &targetSize = QSize()) /Factory/; +%MethodCode + QSharedPointer *grab; + + Py_BEGIN_ALLOW_THREADS + // This will leak but there seems to be no way to detach the object. + grab = new QSharedPointer(sipCpp->grabToImage(*a0)); + Py_END_ALLOW_THREADS + + sipRes = grab->data(); +%End + + bool isAncestorOf(const QQuickItem *child) const; + QPointF mapToGlobal(const QPointF &point) const; + QPointF mapFromGlobal(const QPointF &point) const; + QSizeF size() const; + bool acceptTouchEvents() const; + void setAcceptTouchEvents(bool accept); + QObject *containmentMask() const; + void setContainmentMask(QObject *mask /KeepReference/); + +signals: + void containmentMaskChanged(); + +public: +%If (Qt_6_3_0 -) + QQuickItem *viewportItem() const; +%End +%If (Qt_6_3_0 -) + void ensurePolished(); +%End +%If (Qt_6_3_0 -) + void dumpItemTree() const; +%End +}; diff --git a/sip/QtQuick/qquickitemgrabresult.sip b/sip/QtQuick/qquickitemgrabresult.sip new file mode 100644 index 0000000..d4fd631 --- /dev/null +++ b/sip/QtQuick/qquickitemgrabresult.sip @@ -0,0 +1,45 @@ +// qquickitemgrabresult.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickItemGrabResult : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QImage image() const; + QUrl url() const; + bool saveToFile(const QString &fileName) const; +%If (Qt_6_2_0 -) + bool saveToFile(const QUrl &fileName) const; +%End + +protected: + virtual bool event(QEvent *); + +signals: + void ready(); + +private: + QQuickItemGrabResult(QObject *parent = 0); +}; diff --git a/sip/QtQuick/qquickpainteditem.sip b/sip/QtQuick/qquickpainteditem.sip new file mode 100644 index 0000000..a04c25a --- /dev/null +++ b/sip/QtQuick/qquickpainteditem.sip @@ -0,0 +1,91 @@ +// qquickpainteditem.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickPaintedItem : QQuickItem /ExportDerived/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QQuickPaintedItem(QQuickItem *parent /TransferThis/ = 0); + virtual ~QQuickPaintedItem(); + + enum RenderTarget + { + Image, + FramebufferObject, + InvertedYFramebufferObject, + }; + + enum PerformanceHint /BaseType=Flag/ + { + FastFBOResizing, + }; + + typedef QFlags PerformanceHints; + void update(const QRect &rect = QRect()); + bool opaquePainting() const; + void setOpaquePainting(bool opaque); + bool antialiasing() const; + void setAntialiasing(bool enable); + bool mipmap() const; + void setMipmap(bool enable); + QQuickPaintedItem::PerformanceHints performanceHints() const; + void setPerformanceHint(QQuickPaintedItem::PerformanceHint hint, bool enabled = true); + void setPerformanceHints(QQuickPaintedItem::PerformanceHints hints); + QRectF contentsBoundingRect() const; + QSize contentsSize() const; + void setContentsSize(const QSize &); + void resetContentsSize(); + qreal contentsScale() const; + void setContentsScale(qreal); + QColor fillColor() const; + void setFillColor(const QColor &); + QQuickPaintedItem::RenderTarget renderTarget() const; + void setRenderTarget(QQuickPaintedItem::RenderTarget target); + virtual void paint(QPainter *painter) = 0; + +signals: + void fillColorChanged(); + void contentsSizeChanged(); + void contentsScaleChanged(); + void renderTargetChanged(); + +protected: + virtual QSGNode *updatePaintNode(QSGNode *, QQuickItem::UpdatePaintNodeData *); + +public: + virtual bool isTextureProvider() const; + virtual QSGTextureProvider *textureProvider() const; + +protected: + virtual void releaseResources(); + virtual void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &); + +public: + QSize textureSize() const; + void setTextureSize(const QSize &size); + +signals: + void textureSizeChanged(); +}; diff --git a/sip/QtQuick/qquickrendercontrol.sip b/sip/QtQuick/qquickrendercontrol.sip new file mode 100644 index 0000000..850e3e8 --- /dev/null +++ b/sip/QtQuick/qquickrendercontrol.sip @@ -0,0 +1,51 @@ +// qquickrendercontrol.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickRenderControl : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QQuickRenderControl(QObject *parent /TransferThis/ = 0); + virtual ~QQuickRenderControl(); + bool initialize(); + void invalidate(); + void polishItems(); + void render(); + bool sync(); + static QWindow *renderWindowFor(QQuickWindow *win, QPoint *offset = 0); + virtual QWindow *renderWindow(QPoint *offset); + void prepareThread(QThread *targetThread); + +signals: + void renderRequested(); + void sceneChanged(); + +public: + void setSamples(int sampleCount); + int samples() const; + void beginFrame(); + void endFrame(); + QQuickWindow *window() const; +}; diff --git a/sip/QtQuick/qquickrendertarget.sip b/sip/QtQuick/qquickrendertarget.sip new file mode 100644 index 0000000..15e74f5 --- /dev/null +++ b/sip/QtQuick/qquickrendertarget.sip @@ -0,0 +1,61 @@ +// qquickrendertarget.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickRenderTarget +{ +%TypeHeaderCode +#include +%End + +public: + QQuickRenderTarget(); + ~QQuickRenderTarget(); + QQuickRenderTarget(const QQuickRenderTarget &other); + bool isNull() const; +%If (PyQt_OpenGL) + static QQuickRenderTarget fromOpenGLTexture(uint textureId, const QSize &pixelSize, int sampleCount = 1); +%End +%If (Qt_6_4_0 -) + static QQuickRenderTarget fromOpenGLTexture(uint textureId, uint format, const QSize &pixelSize, int sampleCount = 1); +%End +%If (Qt_6_2_0 -) + static QQuickRenderTarget fromOpenGLRenderBuffer(uint renderbufferId, const QSize &pixelSize, int sampleCount = 1); +%End +%If (Qt_6_4_0 -) + static QQuickRenderTarget fromPaintDevice(QPaintDevice *device); +%End +%If (Qt_6_3_0 -) + qreal devicePixelRatio() const; +%End +%If (Qt_6_3_0 -) + void setDevicePixelRatio(qreal ratio); +%End +%If (Qt_6_4_0 -) + bool mirrorVertically() const; +%End +%If (Qt_6_4_0 -) + void setMirrorVertically(bool enable); +%End +}; + +bool operator==(const QQuickRenderTarget &lhs, const QQuickRenderTarget &rhs); +bool operator!=(const QQuickRenderTarget &lhs, const QQuickRenderTarget &rhs); diff --git a/sip/QtQuick/qquicktextdocument.sip b/sip/QtQuick/qquicktextdocument.sip new file mode 100644 index 0000000..268c2a3 --- /dev/null +++ b/sip/QtQuick/qquicktextdocument.sip @@ -0,0 +1,32 @@ +// qquicktextdocument.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickTextDocument : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QQuickTextDocument(QQuickItem *parent /TransferThis/); + QTextDocument *textDocument() const; +}; diff --git a/sip/QtQuick/qquickview.sip b/sip/QtQuick/qquickview.sip new file mode 100644 index 0000000..156e067 --- /dev/null +++ b/sip/QtQuick/qquickview.sip @@ -0,0 +1,75 @@ +// qquickview.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickView : QQuickWindow /ExportDerived/ +{ +%TypeHeaderCode +#include +%End + +public: + explicit QQuickView(QWindow *parent /TransferThis/ = 0); + QQuickView(QQmlEngine *engine, QWindow *parent /TransferThis/); + QQuickView(const QUrl &source, QWindow *parent /TransferThis/ = 0); + virtual ~QQuickView() /ReleaseGIL/; + QUrl source() const; + QQmlEngine *engine() const; + QQmlContext *rootContext() const; + QQuickItem *rootObject() const; + + enum ResizeMode + { + SizeViewToRootObject, + SizeRootObjectToView, + }; + + QQuickView::ResizeMode resizeMode() const; + void setResizeMode(QQuickView::ResizeMode); + + enum Status + { + Null, + Ready, + Loading, + Error, + }; + + QQuickView::Status status() const; + QList errors() const; + QSize initialSize() const; + +public slots: + void setSource(const QUrl &) /ReleaseGIL/; + void setInitialProperties(const QVariantMap &initialProperties); + +signals: + void statusChanged(QQuickView::Status); + +protected: + virtual void resizeEvent(QResizeEvent *); + virtual void timerEvent(QTimerEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); +}; diff --git a/sip/QtQuick/qquickwindow.sip b/sip/QtQuick/qquickwindow.sip new file mode 100644 index 0000000..43763ba --- /dev/null +++ b/sip/QtQuick/qquickwindow.sip @@ -0,0 +1,206 @@ +// qquickwindow.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickWindow : QWindow /ExportDerived/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QQuickImageProvider, &sipType_QQuickImageProvider, 10, 1}, + {sipName_QQuickItem, &sipType_QQuickItem, 11, 2}, + {sipName_QQuickImageResponse, &sipType_QQuickImageResponse, -1, 3}, + {sipName_QQuickItemGrabResult, &sipType_QQuickItemGrabResult, -1, 4}, + {sipName_QQuickRenderControl, &sipType_QQuickRenderControl, -1, 5}, + {sipName_QQuickTextDocument, &sipType_QQuickTextDocument, -1, 6}, + {sipName_QQuickTextureFactory, &sipType_QQuickTextureFactory, -1, 7}, + {sipName_QQuickWindow, &sipType_QQuickWindow, 13, 8}, + {sipName_QSGTexture, &sipType_QSGTexture, 14, 9}, + {sipName_QSGTextureProvider, &sipType_QSGTextureProvider, -1, -1}, + {sipName_QQuickAsyncImageProvider, &sipType_QQuickAsyncImageProvider, -1, -1}, + {sipName_QQuickFramebufferObject, &sipType_QQuickFramebufferObject, -1, 12}, + {sipName_QQuickPaintedItem, &sipType_QQuickPaintedItem, -1, -1}, + {sipName_QQuickView, &sipType_QQuickView, -1, -1}, + {sipName_QSGDynamicTexture, &sipType_QSGDynamicTexture, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum CreateTextureOption /BaseType=Flag/ + { + TextureHasAlphaChannel, + TextureHasMipmaps, + TextureOwnsGLTexture, + TextureCanUseAtlas, + TextureIsOpaque, + }; + + typedef QFlags CreateTextureOptions; + explicit QQuickWindow(QWindow *parent /TransferThis/ = 0); + virtual ~QQuickWindow() /ReleaseGIL/; + QQuickItem *contentItem() const; + QQuickItem *activeFocusItem() const; + virtual QObject *focusObject() const; + QQuickItem *mouseGrabberItem() const; + QImage grabWindow() /ReleaseGIL/; + void setRenderTarget(const QQuickRenderTarget &target); + QQuickRenderTarget renderTarget() const; + QQmlIncubationController *incubationController() const; + QSGTexture *createTextureFromImage(const QImage &image) const /Factory/; + QSGTexture *createTextureFromImage(const QImage &image, QQuickWindow::CreateTextureOptions options) const /Factory/; + void setColor(const QColor &color); + QColor color() const; + void setPersistentSceneGraph(bool persistent); + bool isPersistentSceneGraph() const; + +signals: + void frameSwapped(); + void sceneGraphInitialized(); + void sceneGraphInvalidated(); + void beforeSynchronizing(); + void beforeRendering(); + void afterRendering(); + void colorChanged(const QColor &); + +public slots: + void update(); + void releaseResources(); + +protected: + virtual void exposeEvent(QExposeEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual void focusOutEvent(QFocusEvent *); + virtual bool event(QEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void wheelEvent(QWheelEvent *); + virtual void tabletEvent(QTabletEvent *); + virtual void closeEvent(QCloseEvent *); + +public: + static bool hasDefaultAlphaBuffer(); + static void setDefaultAlphaBuffer(bool useAlpha); + +signals: + void closing(QQuickCloseEvent *close); + void activeFocusItemChanged(); + +public: + enum SceneGraphError + { + ContextNotAvailable, + }; + +signals: + void afterSynchronizing(); + void afterAnimating(); + void sceneGraphAboutToStop(); + void sceneGraphError(QQuickWindow::SceneGraphError error, const QString &message); + +public: + enum RenderStage + { + BeforeSynchronizingStage, + AfterSynchronizingStage, + BeforeRenderingStage, + AfterRenderingStage, + AfterSwapStage, + NoStage, + }; + + void scheduleRenderJob(QRunnable *job /Transfer/, QQuickWindow::RenderStage schedule) /ReleaseGIL/; + qreal effectiveDevicePixelRatio() const; + bool isSceneGraphInitialized() const; + QSGRendererInterface *rendererInterface() const; + static void setSceneGraphBackend(const QString &backend); + QSGRectangleNode *createRectangleNode() const /Factory/; + QSGImageNode *createImageNode() const /Factory/; + static QString sceneGraphBackend(); + + enum TextRenderType + { + QtTextRendering, + NativeTextRendering, + }; + + static QQuickWindow::TextRenderType textRenderType(); + static void setTextRenderType(QQuickWindow::TextRenderType renderType); + void beginExternalCommands(); + void endExternalCommands(); + +signals: + void beforeRenderPassRecording(); + void afterRenderPassRecording(); + void beforeFrameBegin(); + void afterFrameEnd(); + +public: + void setPersistentGraphics(bool persistent); + bool isPersistentGraphics() const; + static void setGraphicsApi(QSGRendererInterface::GraphicsApi api); + static QSGRendererInterface::GraphicsApi graphicsApi(); + void setGraphicsDevice(const QQuickGraphicsDevice &device); + QQuickGraphicsDevice graphicsDevice() const; + void setGraphicsConfiguration(const QQuickGraphicsConfiguration &config); + QQuickGraphicsConfiguration graphicsConfiguration() const; +}; + +class QQuickCloseEvent; + +%ModuleHeaderCode +#include "qpyquick_api.h" +%End + +%PostInitialisationCode +qpyquick_post_init(); +%End diff --git a/sip/QtQuick/qsgflatcolormaterial.sip b/sip/QtQuick/qsgflatcolormaterial.sip new file mode 100644 index 0000000..d20c7e1 --- /dev/null +++ b/sip/QtQuick/qsgflatcolormaterial.sip @@ -0,0 +1,36 @@ +// qsgflatcolormaterial.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGFlatColorMaterial : QSGMaterial +{ +%TypeHeaderCode +#include +%End + +public: + QSGFlatColorMaterial(); + virtual QSGMaterialType *type() const; + virtual QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const /Factory/; + void setColor(const QColor &color); + const QColor &color() const; + virtual int compare(const QSGMaterial *other) const; +}; diff --git a/sip/QtQuick/qsggeometry.sip b/sip/QtQuick/qsggeometry.sip new file mode 100644 index 0000000..152eb23 --- /dev/null +++ b/sip/QtQuick/qsggeometry.sip @@ -0,0 +1,355 @@ +// qsggeometry.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGGeometry /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + struct Attribute + { +%TypeHeaderCode +#include +%End + + int position; + int tupleSize; + int type; + uint isVertexCoordinate; + QSGGeometry::AttributeType attributeType; + static QSGGeometry::Attribute create(int pos, int tupleSize, int primitiveType, bool isPosition = false) /Factory/; + static QSGGeometry::Attribute createWithAttributeType(int pos, int tupleSize, int primitiveType, QSGGeometry::AttributeType attributeType) /Factory/; + }; + + struct AttributeSet /NoDefaultCtors/ + { +%TypeHeaderCode +#include +#include +%End + + AttributeSet(SIP_PYOBJECT attributes /TypeHint="Iterable[QSGGeometry.Attribute]"/, int stride = 0); +%MethodCode + PyObject *iter = PyObject_GetIter(a0); + + if (!iter || PyUnicode_Check(a0)) + { + Py_XDECREF(iter); + PyErr_SetString(PyExc_TypeError, "iterable object expected"); + sipError = sipErrorContinue; + } + else + { + QList attrs; + int stride = 0; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + sipError = sipErrorFail; + + break; + } + + int state, is_err = 0; + QSGGeometry::Attribute *attr; + + attr = reinterpret_cast( + sipForceConvertToType(itm, sipType_QSGGeometry_Attribute, 0, + SIP_NOT_NONE, &state, &is_err)); + + if (is_err) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QSGGeometry.Attribute' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + sipError = sipErrorFail; + + break; + } + + // Calculate the stride if there no explicit one. + if (a1 <= 0) + { + int size; + + switch (attr->type) + { + case QSGGeometry::ByteType: + size = sizeof (qint8); + break; + + case QSGGeometry::DoubleType: + size = sizeof (double); + break; + + case QSGGeometry::FloatType: + size = sizeof (float); + break; + + case QSGGeometry::IntType: + size = sizeof (qint32); + break; + + default: + size = 0; + } + + if (!size) + { + PyErr_Format(PyExc_TypeError, + "index %zd has an unsupported primitive type", + i); + + sipReleaseType(attr, sipType_QSGGeometry_Attribute, state); + Py_DECREF(itm); + sipError = sipErrorFail; + + break; + } + + stride += attr->tupleSize * size; + } + + attrs.append(*attr); + + sipReleaseType(attr, sipType_QSGGeometry_Attribute, state); + Py_DECREF(itm); + } + + Py_DECREF(iter); + + if (sipError == sipErrorNone) + { + if (attrs.isEmpty()) + { + PyErr_SetString(PyExc_TypeError, "no attributes defined"); + sipError = sipErrorFail; + } + else + { + PyObject *bytes = PyBytes_FromStringAndSize( + reinterpret_cast(attrs.data()), + sizeof (QSGGeometry::Attribute) * attrs.size()); + + if (!bytes) + { + sipError = sipErrorFail; + } + else + { + sipCpp = new QSGGeometry::AttributeSet; + + sipCpp->count = attrs.size(); + sipCpp->stride = (a1 > 0 ? a1 : stride); + sipCpp->attributes = reinterpret_cast( + PyBytes_AsString(bytes)); + + sipSetUserObject(sipSelf, bytes); + } + } + } + } +%End + + int count; + int stride; + const QSGGeometry::Attribute *attributes /TypeHint="PyQt6.sip.array[QSGGeometry.Attribute]"/ { +%GetCode + sipPy = sipConvertToTypedArray((void *)sipCpp->attributes, + sipType_QSGGeometry_Attribute, "iiiI", sizeof (QSGGeometry::Attribute), + sipCpp->count, SIP_READ_ONLY); +%End + +%SetCode + sipErr = 1; + PyErr_SetString(PyExc_ValueError, "array is read-only"); +%End + + }; + }; + + struct Point2D + { +%TypeHeaderCode +#include +%End + + float x; + float y; + void set(float nx, float ny); + }; + + struct TexturedPoint2D + { +%TypeHeaderCode +#include +%End + + float x; + float y; + float tx; + float ty; + void set(float nx, float ny, float ntx, float nty); + }; + + struct ColoredPoint2D + { +%TypeHeaderCode +#include +%End + + float x; + float y; + unsigned char r /PyInt/; + unsigned char g /PyInt/; + unsigned char b /PyInt/; + unsigned char a /PyInt/; + void set(float nx, float ny, uchar nr /PyInt/, uchar ng /PyInt/, uchar nb /PyInt/, uchar na /PyInt/); + }; + + static const QSGGeometry::AttributeSet &defaultAttributes_Point2D() /NoCopy/; + static const QSGGeometry::AttributeSet &defaultAttributes_TexturedPoint2D() /NoCopy/; + static const QSGGeometry::AttributeSet &defaultAttributes_ColoredPoint2D() /NoCopy/; + + enum DataPattern + { + AlwaysUploadPattern, + StreamPattern, + DynamicPattern, + StaticPattern, + }; + + QSGGeometry(const QSGGeometry::AttributeSet &attribs /KeepReference/, int vertexCount, int indexCount = 0, int indexType = QSGGeometry::UnsignedShortType); + virtual ~QSGGeometry(); + void setDrawingMode(unsigned int mode); + unsigned int drawingMode() const; + void allocate(int vertexCount, int indexCount = 0); + int vertexCount() const; + void *vertexData(); + int indexType() const; + int indexCount() const; + void *indexData(); + int attributeCount() const; + SIP_PYOBJECT attributes() const /TypeHint="PyQt6.sip.array[QSGGeometry.Attribute]"/; +%MethodCode + sipRes = sipConvertToTypedArray((void *)sipCpp->attributes(), + sipType_QSGGeometry_Attribute, "iiiI", sizeof (QSGGeometry::Attribute), + sipCpp->attributeCount(), SIP_READ_ONLY); +%End + + int sizeOfVertex() const; + static void updateRectGeometry(QSGGeometry *g, const QRectF &rect); + static void updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect, const QRectF &sourceRect); + void setIndexDataPattern(QSGGeometry::DataPattern p); + QSGGeometry::DataPattern indexDataPattern() const; + void setVertexDataPattern(QSGGeometry::DataPattern p); + QSGGeometry::DataPattern vertexDataPattern() const; + void markIndexDataDirty(); + void markVertexDataDirty(); + float lineWidth() const; + void setLineWidth(float w); + SIP_PYOBJECT indexDataAsUInt() /TypeHint="PyQt6.sip.array[int]"/; +%MethodCode + sipRes = sipConvertToArray(sipCpp->indexDataAsUInt(), "I", + sipCpp->indexCount(), 0); +%End + + SIP_PYOBJECT indexDataAsUShort() /TypeHint="PyQt6.sip.array[int]"/; +%MethodCode + sipRes = sipConvertToArray(sipCpp->indexDataAsUShort(), "H", + sipCpp->indexCount(), 0); +%End + + SIP_PYOBJECT vertexDataAsPoint2D() /TypeHint="PyQt6.sip.array[QSGGeometry.Point2D]"/; +%MethodCode + sipRes = sipConvertToTypedArray(sipCpp->vertexDataAsPoint2D(), + sipType_QSGGeometry_Point2D, "ff", sizeof (QSGGeometry::Point2D), + sipCpp->vertexCount(), 0); +%End + + SIP_PYOBJECT vertexDataAsTexturedPoint2D() /TypeHint="PyQt6.sip.array[QSGGeometry.TexturedPoint2D]"/; +%MethodCode + sipRes = sipConvertToTypedArray(sipCpp->vertexDataAsTexturedPoint2D(), + sipType_QSGGeometry_TexturedPoint2D, "ffff", + sizeof (QSGGeometry::TexturedPoint2D), sipCpp->vertexCount(), 0); +%End + + SIP_PYOBJECT vertexDataAsColoredPoint2D() /TypeHint="PyQt6.sip.array[QSGGeometry.ColoredPoint2D]"/; +%MethodCode + sipRes = sipConvertToTypedArray(sipCpp->vertexDataAsColoredPoint2D(), + sipType_QSGGeometry_ColoredPoint2D, "ffbbbb", + sizeof (QSGGeometry::ColoredPoint2D), sipCpp->vertexCount(), 0); +%End + + int sizeOfIndex() const; + + enum AttributeType + { + UnknownAttribute, + PositionAttribute, + ColorAttribute, + TexCoordAttribute, + TexCoord1Attribute, + TexCoord2Attribute, + }; + + enum DrawingMode /BaseType=IntEnum/ + { + DrawPoints, + DrawLines, + DrawLineLoop, + DrawLineStrip, + DrawTriangles, + DrawTriangleStrip, + DrawTriangleFan, + }; + + enum Type + { + ByteType, + UnsignedByteType, + ShortType, + UnsignedShortType, + IntType, + UnsignedIntType, + FloatType, + Bytes2Type, + Bytes3Type, + Bytes4Type, + DoubleType, + }; + + static void updateColoredRectGeometry(QSGGeometry *g, const QRectF &rect); + +private: + QSGGeometry(const QSGGeometry &); +}; diff --git a/sip/QtQuick/qsgimagenode.sip b/sip/QtQuick/qsgimagenode.sip new file mode 100644 index 0000000..e061366 --- /dev/null +++ b/sip/QtQuick/qsgimagenode.sip @@ -0,0 +1,66 @@ +// qsgimagenode.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGImageNode : QSGGeometryNode /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QSGImageNode(); + virtual void setRect(const QRectF &rect) = 0; + void setRect(qreal x, qreal y, qreal w, qreal h); + virtual QRectF rect() const = 0; + virtual void setSourceRect(const QRectF &r) = 0; + void setSourceRect(qreal x, qreal y, qreal w, qreal h); + virtual QRectF sourceRect() const = 0; + virtual void setTexture(QSGTexture *texture /GetWrapper/) = 0; +%MethodCode + sipCpp->setTexture(a0); + + if (sipCpp->ownsTexture()) + sipTransferTo(a0Wrapper, sipSelf); +%End + + virtual QSGTexture *texture() const = 0; + virtual void setFiltering(QSGTexture::Filtering filtering) = 0; + virtual QSGTexture::Filtering filtering() const = 0; + virtual void setMipmapFiltering(QSGTexture::Filtering filtering) = 0; + virtual QSGTexture::Filtering mipmapFiltering() const = 0; + + enum TextureCoordinatesTransformFlag /BaseType=Flag/ + { + NoTransform, + MirrorHorizontally, + MirrorVertically, + }; + + typedef QFlags TextureCoordinatesTransformMode; + virtual void setTextureCoordinatesTransform(QSGImageNode::TextureCoordinatesTransformMode mode) = 0; + virtual QSGImageNode::TextureCoordinatesTransformMode textureCoordinatesTransform() const = 0; + virtual void setOwnsTexture(bool owns) = 0; + virtual bool ownsTexture() const = 0; + static void rebuildGeometry(QSGGeometry *g, QSGTexture *texture, const QRectF &rect, QRectF sourceRect, QSGImageNode::TextureCoordinatesTransformMode texCoordMode); + virtual void setAnisotropyLevel(QSGTexture::AnisotropyLevel level) = 0; + virtual QSGTexture::AnisotropyLevel anisotropyLevel() const = 0; +}; diff --git a/sip/QtQuick/qsgmaterial.sip b/sip/QtQuick/qsgmaterial.sip new file mode 100644 index 0000000..ed0aabe --- /dev/null +++ b/sip/QtQuick/qsgmaterial.sip @@ -0,0 +1,53 @@ +// qsgmaterial.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGMaterial /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + enum Flag /BaseType=Flag/ + { + Blending, + RequiresDeterminant, + RequiresFullMatrixExceptTranslate, + RequiresFullMatrix, +%If (Qt_6_3_0 -) + NoBatching, +%End + CustomCompileStep, + }; + + typedef QFlags Flags; + QSGMaterial(); + virtual ~QSGMaterial(); + virtual QSGMaterialType *type() const = 0; + virtual QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const = 0 /Factory/; + virtual int compare(const QSGMaterial *other) const; + QSGMaterial::Flags flags() const; + void setFlag(QSGMaterial::Flags flags, bool enabled = true); + +private: + QSGMaterial(const QSGMaterial &); +}; diff --git a/sip/QtQuick/qsgmaterialshader.sip b/sip/QtQuick/qsgmaterialshader.sip new file mode 100644 index 0000000..8343779 --- /dev/null +++ b/sip/QtQuick/qsgmaterialshader.sip @@ -0,0 +1,165 @@ +// qsgmaterialshader.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGMaterialShader +{ +%TypeHeaderCode +#include +%End + +public: + class RenderState + { +%TypeHeaderCode +#include +%End + + public: + enum DirtyState /BaseType=Flag/ + { + DirtyMatrix, + DirtyOpacity, + DirtyCachedMaterialData, + DirtyAll, + }; + + typedef QFlags DirtyStates; + QSGMaterialShader::RenderState::DirtyStates dirtyStates() const; + bool isMatrixDirty() const; + bool isOpacityDirty() const; + float opacity() const; + QMatrix4x4 combinedMatrix() const; + QMatrix4x4 modelViewMatrix() const; + QMatrix4x4 projectionMatrix() const; + QRect viewportRect() const; + QRect deviceRect() const; + float determinant() const; + float devicePixelRatio() const; + QByteArray *uniformData(); + }; + + struct GraphicsPipelineState + { +%TypeHeaderCode +#include +%End + + enum BlendFactor + { + Zero, + One, + SrcColor, + OneMinusSrcColor, + DstColor, + OneMinusDstColor, + SrcAlpha, + OneMinusSrcAlpha, + DstAlpha, + OneMinusDstAlpha, + ConstantColor, + OneMinusConstantColor, + ConstantAlpha, + OneMinusConstantAlpha, + SrcAlphaSaturate, + Src1Color, + OneMinusSrc1Color, + Src1Alpha, + OneMinusSrc1Alpha, + }; + + enum ColorMaskComponent /BaseType=Flag/ + { + R, + G, + B, + A, + }; + + typedef QFlags ColorMask; + + enum CullMode + { + CullNone, + CullFront, + CullBack, + }; + +%If (Qt_6_4_0 -) + + enum PolygonMode + { + Fill, + Line, + }; + +%End + QColor blendConstant; + bool blendEnable; + QSGMaterialShader::GraphicsPipelineState::ColorMask colorWrite; + QSGMaterialShader::GraphicsPipelineState::CullMode cullMode; +%If (Qt_6_5_0 -) + QSGMaterialShader::GraphicsPipelineState::BlendFactor dstAlpha; +%End + QSGMaterialShader::GraphicsPipelineState::BlendFactor dstColor; +%If (Qt_6_4_0 -) + QSGMaterialShader::GraphicsPipelineState::PolygonMode polygonMode; +%End +%If (Qt_6_5_0 -) + bool separateBlendFactors; +%End +%If (Qt_6_5_0 -) + QSGMaterialShader::GraphicsPipelineState::BlendFactor srcAlpha; +%End + QSGMaterialShader::GraphicsPipelineState::BlendFactor srcColor; + }; + + enum Flag /BaseType=Flag/ + { + UpdatesGraphicsPipelineState, + }; + + typedef QFlags Flags; + + enum Stage + { + VertexStage, + FragmentStage, + }; + + QSGMaterialShader(); + virtual ~QSGMaterialShader(); + virtual bool updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); + virtual void updateSampledImage(QSGMaterialShader::RenderState &state, int binding, QSGTexture **texture /Out/, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); + virtual bool updateGraphicsPipelineState(QSGMaterialShader::RenderState &state, QSGMaterialShader::GraphicsPipelineState *ps, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); + QSGMaterialShader::Flags flags() const; + void setFlag(QSGMaterialShader::Flags flags, bool on = true); + void setFlags(QSGMaterialShader::Flags flags); +%If (Qt_6_4_0 -) + int combinedImageSamplerCount(int binding) const; +%End + +protected: + void setShaderFileName(QSGMaterialShader::Stage stage, const QString &filename); + +private: + QSGMaterialShader(const QSGMaterialShader &); +}; diff --git a/sip/QtQuick/qsgmaterialtype.sip b/sip/QtQuick/qsgmaterialtype.sip new file mode 100644 index 0000000..3ca6a8d --- /dev/null +++ b/sip/QtQuick/qsgmaterialtype.sip @@ -0,0 +1,28 @@ +// qsgmaterialtype.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +struct QSGMaterialType +{ +%TypeHeaderCode +#include +%End +}; diff --git a/sip/QtQuick/qsgnode.sip b/sip/QtQuick/qsgnode.sip new file mode 100644 index 0000000..0b895d1 --- /dev/null +++ b/sip/QtQuick/qsgnode.sip @@ -0,0 +1,335 @@ +// qsgnode.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGNode /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +%TypeCode +static sipErrorState qsgnode_handle_flags(QSGNode *node, PyObject *self, QSGNode::Flags old_flags) +{ + QSGNode::Flags new_flags = node->flags(); + + if (node->parent()) + { + if ((old_flags & QSGNode::OwnedByParent) != (new_flags & QSGNode::OwnedByParent)) + { + if (old_flags & QSGNode::OwnedByParent) + { + sipTransferBack(self); + } + else + { + PyObject *parent = sipConvertFromType(node->parent(), sipType_QSGNode, 0); + + if (!parent) + return sipErrorFail; + + sipTransferTo(self, parent); + Py_DECREF(parent); + } + } + } + + QSGNode::NodeType ntype = node->type(); + + if (ntype == QSGNode::BasicNodeType || ntype == QSGNode::GeometryNodeType || ntype == QSGNode::ClipNodeType) + { + QSGBasicGeometryNode *bg_node = (QSGBasicGeometryNode *)node; + + if (bg_node->geometry()) + { + if ((old_flags & QSGNode::OwnsGeometry) != (new_flags & QSGNode::OwnsGeometry)) + { + PyObject *geom = sipConvertFromType(bg_node->geometry(), sipType_QSGGeometry, 0); + + if (!geom) + return sipErrorFail; + + if (old_flags & QSGNode::OwnsGeometry) + sipTransferBack(geom); + else + sipTransferTo(geom, self); + + Py_DECREF(geom); + } + } + } + + if (ntype == QSGNode::GeometryNodeType) + { + QSGGeometryNode *g_node = (QSGGeometryNode *)node; + + if (g_node->material()) + { + if ((old_flags & QSGNode::OwnsMaterial) != (new_flags & QSGNode::OwnsMaterial)) + { + PyObject *mat = sipConvertFromType(g_node->material(), sipType_QSGMaterial, 0); + + if (!mat) + return sipErrorFail; + + if (old_flags & QSGNode::OwnsMaterial) + sipTransferBack(mat); + else + sipTransferTo(mat, self); + + Py_DECREF(mat); + } + } + + if (g_node->opaqueMaterial()) + { + if ((old_flags & QSGNode::OwnsOpaqueMaterial) != (new_flags & QSGNode::OwnsOpaqueMaterial)) + { + PyObject *omat = sipConvertFromType(g_node->opaqueMaterial(), sipType_QSGMaterial, 0); + + if (!omat) + return sipErrorFail; + + if (old_flags & QSGNode::OwnsOpaqueMaterial) + sipTransferBack(omat); + else + sipTransferTo(omat, self); + + Py_DECREF(omat); + } + } + } + + return sipErrorNone; +} +%End + +%ConvertToSubClassCode + switch (sipCpp->type()) + { + case QSGNode::BasicNodeType: + sipType = sipType_QSGBasicGeometryNode; + break; + + case QSGNode::GeometryNodeType: + sipType = sipType_QSGGeometryNode; + break; + + case QSGNode::TransformNodeType: + sipType = sipType_QSGClipNode; + break; + + case QSGNode::ClipNodeType: + sipType = sipType_QSGTransformNode; + break; + + case QSGNode::OpacityNodeType: + sipType = sipType_QSGOpacityNode; + break; + + default: + sipType = 0; + } +%End + +public: + enum NodeType + { + BasicNodeType, + GeometryNodeType, + TransformNodeType, + ClipNodeType, + OpacityNodeType, + }; + + enum Flag /BaseType=Flag/ + { + OwnedByParent, + UsePreprocess, + OwnsGeometry, + OwnsMaterial, + OwnsOpaqueMaterial, + }; + + typedef QFlags Flags; + + enum DirtyStateBit /BaseType=Flag/ + { + DirtyMatrix, + DirtyNodeAdded, + DirtyNodeRemoved, + DirtyGeometry, + DirtyMaterial, + DirtyOpacity, + }; + + typedef QFlags DirtyState; + QSGNode(); + virtual ~QSGNode(); + QSGNode *parent() const; + void removeChildNode(QSGNode *node); + void removeAllChildNodes(); + void prependChildNode(QSGNode *node /GetWrapper/); +%MethodCode + sipCpp->prependChildNode(a0); + + if (a0->flags() & QSGNode::OwnedByParent) + sipTransferTo(a0Wrapper, sipSelf); +%End + + void appendChildNode(QSGNode *node /GetWrapper/); +%MethodCode + sipCpp->appendChildNode(a0); + + if (a0->flags() & QSGNode::OwnedByParent) + sipTransferTo(a0Wrapper, sipSelf); +%End + + void insertChildNodeBefore(QSGNode *node /GetWrapper/, QSGNode *before); +%MethodCode + sipCpp->insertChildNodeBefore(a0, a1); + + if (a0->flags() & QSGNode::OwnedByParent) + sipTransferTo(a0Wrapper, sipSelf); +%End + + void insertChildNodeAfter(QSGNode *node /GetWrapper/, QSGNode *after); +%MethodCode + sipCpp->insertChildNodeAfter(a0, a1); + + if (a0->flags() & QSGNode::OwnedByParent) + sipTransferTo(a0Wrapper, sipSelf); +%End + + int childCount() const /__len__/; + QSGNode *childAtIndex(int i) const; + QSGNode *firstChild() const; + QSGNode *lastChild() const; + QSGNode *nextSibling() const; + QSGNode *previousSibling() const; + QSGNode::NodeType type() const; + void markDirty(QSGNode::DirtyState bits); + virtual bool isSubtreeBlocked() const; + QSGNode::Flags flags() const; + void setFlag(QSGNode::Flag, bool enabled = true); +%MethodCode + QSGNode::Flags old_flags = sipCpp->flags(); + + sipCpp->setFlag(a0, a1); + + sipError = qsgnode_handle_flags(sipCpp, sipSelf, old_flags); +%End + + void setFlags(QSGNode::Flags, bool enabled = true); + virtual void preprocess(); + +private: + QSGNode(const QSGNode &); +}; + +class QSGBasicGeometryNode : QSGNode /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QSGBasicGeometryNode(); + void setGeometry(QSGGeometry *geometry /GetWrapper/); +%MethodCode + sipCpp->setGeometry(a0); + + if (sipCpp->flags() & QSGNode::OwnsGeometry) + sipTransferTo(a0Wrapper, sipSelf); +%End + + QSGGeometry *geometry(); +}; + +class QSGGeometryNode : QSGBasicGeometryNode +{ +%TypeHeaderCode +#include +%End + +public: + QSGGeometryNode(); + virtual ~QSGGeometryNode(); + void setMaterial(QSGMaterial *material /GetWrapper/); +%MethodCode + sipCpp->setMaterial(a0); + + if (sipCpp->flags() & QSGNode::OwnsMaterial) + sipTransferTo(a0Wrapper, sipSelf); +%End + + QSGMaterial *material() const; + void setOpaqueMaterial(QSGMaterial *material /GetWrapper/); +%MethodCode + sipCpp->setOpaqueMaterial(a0); + + if (sipCpp->flags() & QSGNode::OwnsOpaqueMaterial) + sipTransferTo(a0Wrapper, sipSelf); +%End + + QSGMaterial *opaqueMaterial() const; +}; + +class QSGClipNode : QSGBasicGeometryNode +{ +%TypeHeaderCode +#include +%End + +public: + QSGClipNode(); + virtual ~QSGClipNode(); + void setIsRectangular(bool rectHint); + bool isRectangular() const; + void setClipRect(const QRectF &); + QRectF clipRect() const; +}; + +class QSGTransformNode : QSGNode +{ +%TypeHeaderCode +#include +%End + +public: + QSGTransformNode(); + virtual ~QSGTransformNode(); + void setMatrix(const QMatrix4x4 &matrix); + const QMatrix4x4 &matrix() const; +}; + +class QSGOpacityNode : QSGNode +{ +%TypeHeaderCode +#include +%End + +public: + QSGOpacityNode(); + virtual ~QSGOpacityNode(); + void setOpacity(qreal opacity); + qreal opacity() const; +}; diff --git a/sip/QtQuick/qsgrectanglenode.sip b/sip/QtQuick/qsgrectanglenode.sip new file mode 100644 index 0000000..0ded6ed --- /dev/null +++ b/sip/QtQuick/qsgrectanglenode.sip @@ -0,0 +1,36 @@ +// qsgrectanglenode.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGRectangleNode : QSGGeometryNode /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QSGRectangleNode(); + virtual void setRect(const QRectF &rect) = 0; + void setRect(qreal x, qreal y, qreal w, qreal h); + virtual QRectF rect() const = 0; + virtual void setColor(const QColor &color) = 0; + virtual QColor color() const = 0; +}; diff --git a/sip/QtQuick/qsgrendererinterface.sip b/sip/QtQuick/qsgrendererinterface.sip new file mode 100644 index 0000000..cd84dd5 --- /dev/null +++ b/sip/QtQuick/qsgrendererinterface.sip @@ -0,0 +1,107 @@ +// qsgrendererinterface.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGRendererInterface /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum GraphicsApi + { + Unknown, + Software, + OpenGL, + OpenVG, + OpenGLRhi, + Direct3D11Rhi, + VulkanRhi, + MetalRhi, + NullRhi, + Direct3D11, + Vulkan, + Metal, + Null, + }; + + enum Resource + { + DeviceResource, + CommandQueueResource, + CommandListResource, + PainterResource, + RhiResource, + PhysicalDeviceResource, + OpenGLContextResource, + DeviceContextResource, + CommandEncoderResource, + VulkanInstanceResource, + RenderPassResource, + RhiSwapchainResource, + RhiRedirectCommandBuffer, + RhiRedirectRenderTarget, +%If (Qt_6_4_0 -) + RedirectPaintDevice, +%End + }; + + enum ShaderType + { + UnknownShadingLanguage, + GLSL, + HLSL, + RhiShader, + }; + + enum ShaderCompilationType /BaseType=Flag/ + { + RuntimeCompilation, + OfflineCompilation, + }; + + typedef QFlags ShaderCompilationTypes; + + enum ShaderSourceType /BaseType=Flag/ + { + ShaderSourceString, + ShaderSourceFile, + ShaderByteCode, + }; + + typedef QFlags ShaderSourceTypes; + virtual ~QSGRendererInterface(); + virtual QSGRendererInterface::GraphicsApi graphicsApi() const = 0; + virtual void *getResource(QQuickWindow *window, QSGRendererInterface::Resource resource) const; + virtual void *getResource(QQuickWindow *window, const char *resource) const; + virtual QSGRendererInterface::ShaderType shaderType() const = 0; + virtual QSGRendererInterface::ShaderCompilationTypes shaderCompilationType() const = 0; + virtual QSGRendererInterface::ShaderSourceTypes shaderSourceType() const = 0; + static bool isApiRhiBased(QSGRendererInterface::GraphicsApi api); + + enum RenderMode + { + RenderMode2D, + RenderMode2DNoDepthBuffer, + RenderMode3D, + }; +}; diff --git a/sip/QtQuick/qsgrendernode.sip b/sip/QtQuick/qsgrendernode.sip new file mode 100644 index 0000000..1d936e4 --- /dev/null +++ b/sip/QtQuick/qsgrendernode.sip @@ -0,0 +1,82 @@ +// qsgrendernode.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGRenderNode : QSGNode +{ +%TypeHeaderCode +#include +%End + +public: + enum StateFlag /BaseType=Flag/ + { + DepthState, + StencilState, + ScissorState, + ColorState, + BlendState, + CullState, + ViewportState, + RenderTargetState, + }; + + typedef QFlags StateFlags; + + enum RenderingFlag /BaseType=Flag/ + { + BoundedRectRendering, + DepthAwareRendering, + OpaqueRendering, + }; + + typedef QFlags RenderingFlags; + + struct RenderState /NoDefaultCtors/ + { +%TypeHeaderCode +#include +%End + + virtual ~RenderState(); + virtual const QMatrix4x4 *projectionMatrix() const = 0; + virtual QRect scissorRect() const = 0; + virtual bool scissorEnabled() const = 0; + virtual int stencilValue() const = 0; + virtual bool stencilEnabled() const = 0; + virtual const QRegion *clipRegion() const = 0; + virtual void *get(const char *state) const; + }; + + virtual ~QSGRenderNode(); + virtual QSGRenderNode::StateFlags changedStates() const; + virtual void render(const QSGRenderNode::RenderState *state) = 0; + virtual void releaseResources(); + virtual QSGRenderNode::RenderingFlags flags() const; + virtual QRectF rect() const; + const QMatrix4x4 *matrix() const; + const QSGClipNode *clipList() const; + qreal inheritedOpacity() const; + virtual void prepare(); +%If (Qt_6_5_0 -) + const QMatrix4x4 *projectionMatrix() const; +%End +}; diff --git a/sip/QtQuick/qsgsimplerectnode.sip b/sip/QtQuick/qsgsimplerectnode.sip new file mode 100644 index 0000000..b45a4f5 --- /dev/null +++ b/sip/QtQuick/qsgsimplerectnode.sip @@ -0,0 +1,37 @@ +// qsgsimplerectnode.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGSimpleRectNode : QSGGeometryNode /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QSGSimpleRectNode(const QRectF &rect, const QColor &color); + QSGSimpleRectNode(); + void setRect(const QRectF &rect); + void setRect(qreal x, qreal y, qreal w, qreal h); + QRectF rect() const; + void setColor(const QColor &color); + QColor color() const; +}; diff --git a/sip/QtQuick/qsgsimpletexturenode.sip b/sip/QtQuick/qsgsimpletexturenode.sip new file mode 100644 index 0000000..7f9dfc5 --- /dev/null +++ b/sip/QtQuick/qsgsimpletexturenode.sip @@ -0,0 +1,55 @@ +// qsgsimpletexturenode.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGSimpleTextureNode : QSGGeometryNode /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + QSGSimpleTextureNode(); + virtual ~QSGSimpleTextureNode(); + void setRect(const QRectF &rect); + void setRect(qreal x, qreal y, qreal w, qreal h); + QRectF rect() const; + void setTexture(QSGTexture *texture); + QSGTexture *texture() const; + void setFiltering(QSGTexture::Filtering filtering); + QSGTexture::Filtering filtering() const; + + enum TextureCoordinatesTransformFlag /BaseType=Flag/ + { + NoTransform, + MirrorHorizontally, + MirrorVertically, + }; + + typedef QFlags TextureCoordinatesTransformMode; + void setTextureCoordinatesTransform(QSGSimpleTextureNode::TextureCoordinatesTransformMode mode); + QSGSimpleTextureNode::TextureCoordinatesTransformMode textureCoordinatesTransform() const; + void setOwnsTexture(bool owns); + bool ownsTexture() const; + void setSourceRect(const QRectF &r); + void setSourceRect(qreal x, qreal y, qreal w, qreal h); + QRectF sourceRect() const; +}; diff --git a/sip/QtQuick/qsgtexture.sip b/sip/QtQuick/qsgtexture.sip new file mode 100644 index 0000000..4b1c307 --- /dev/null +++ b/sip/QtQuick/qsgtexture.sip @@ -0,0 +1,88 @@ +// qsgtexture.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGTexture : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QSGTexture(); + virtual ~QSGTexture(); + + enum WrapMode + { + Repeat, + ClampToEdge, + MirroredRepeat, + }; + + enum Filtering + { + None, + Nearest, + Linear, + }; + + virtual QSize textureSize() const = 0; + virtual bool hasAlphaChannel() const = 0; + virtual bool hasMipmaps() const = 0; + virtual QRectF normalizedTextureSubRect() const; + virtual bool isAtlasTexture() const; + void setMipmapFiltering(QSGTexture::Filtering filter); + QSGTexture::Filtering mipmapFiltering() const; + void setFiltering(QSGTexture::Filtering filter); + QSGTexture::Filtering filtering() const; + void setHorizontalWrapMode(QSGTexture::WrapMode hwrap); + QSGTexture::WrapMode horizontalWrapMode() const; + void setVerticalWrapMode(QSGTexture::WrapMode vwrap); + QSGTexture::WrapMode verticalWrapMode() const; + QRectF convertToNormalizedSourceRect(const QRectF &rect) const; + + enum AnisotropyLevel + { + AnisotropyNone, + Anisotropy2x, + Anisotropy4x, + Anisotropy8x, + Anisotropy16x, + }; + + void setAnisotropyLevel(QSGTexture::AnisotropyLevel level); + QSGTexture::AnisotropyLevel anisotropyLevel() const; + virtual qint64 comparisonKey() const = 0; +}; + +class QSGDynamicTexture : QSGTexture +{ +%TypeHeaderCode +#include +%End + +public: + QSGDynamicTexture(); + virtual bool updateTexture() = 0; +%If (Qt_6_4_0 -) + virtual ~QSGDynamicTexture(); +%End +}; diff --git a/sip/QtQuick/qsgtexture_platform.sip b/sip/QtQuick/qsgtexture_platform.sip new file mode 100644 index 0000000..36037eb --- /dev/null +++ b/sip/QtQuick/qsgtexture_platform.sip @@ -0,0 +1,46 @@ +// qsgtexture_platform.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +namespace QNativeInterface +{ +%TypeHeaderCode +#include +%End + +%If (PyQt_OpenGL) + + struct QSGOpenGLTexture /NoDefaultCtors/ + { +%TypeHeaderCode +#include +%End + + protected: + virtual ~QSGOpenGLTexture(); + + public: + virtual GLuint nativeTexture() const = 0; + static QSGTexture *fromNative(GLuint textureId, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {}); + }; + +%End +}; diff --git a/sip/QtQuick/qsgtexturematerial.sip b/sip/QtQuick/qsgtexturematerial.sip new file mode 100644 index 0000000..66adc36 --- /dev/null +++ b/sip/QtQuick/qsgtexturematerial.sip @@ -0,0 +1,57 @@ +// qsgtexturematerial.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGOpaqueTextureMaterial : QSGMaterial +{ +%TypeHeaderCode +#include +%End + +public: + QSGOpaqueTextureMaterial(); + virtual QSGMaterialType *type() const; + virtual QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const /Factory/; + virtual int compare(const QSGMaterial *other) const; + void setTexture(QSGTexture *texture); + QSGTexture *texture() const; + void setMipmapFiltering(QSGTexture::Filtering filtering); + QSGTexture::Filtering mipmapFiltering() const; + void setFiltering(QSGTexture::Filtering filtering); + QSGTexture::Filtering filtering() const; + void setHorizontalWrapMode(QSGTexture::WrapMode mode); + QSGTexture::WrapMode horizontalWrapMode() const; + void setVerticalWrapMode(QSGTexture::WrapMode mode); + QSGTexture::WrapMode verticalWrapMode() const; + void setAnisotropyLevel(QSGTexture::AnisotropyLevel level); + QSGTexture::AnisotropyLevel anisotropyLevel() const; +}; + +class QSGTextureMaterial : QSGOpaqueTextureMaterial +{ +%TypeHeaderCode +#include +%End + +public: + virtual QSGMaterialType *type() const; + virtual QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const /Factory/; +}; diff --git a/sip/QtQuick/qsgtextureprovider.sip b/sip/QtQuick/qsgtextureprovider.sip new file mode 100644 index 0000000..5ffb2a7 --- /dev/null +++ b/sip/QtQuick/qsgtextureprovider.sip @@ -0,0 +1,34 @@ +// qsgtextureprovider.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGTextureProvider : QObject +{ +%TypeHeaderCode +#include +%End + +public: + virtual QSGTexture *texture() const = 0 /Factory/; + +signals: + void textureChanged(); +}; diff --git a/sip/QtQuick/qsgvertexcolormaterial.sip b/sip/QtQuick/qsgvertexcolormaterial.sip new file mode 100644 index 0000000..5437d5b --- /dev/null +++ b/sip/QtQuick/qsgvertexcolormaterial.sip @@ -0,0 +1,36 @@ +// qsgvertexcolormaterial.sip generated by MetaSIP +// +// This file is part of the QtQuick Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSGVertexColorMaterial : QSGMaterial +{ +%TypeHeaderCode +#include +%End + +public: + QSGVertexColorMaterial(); + virtual int compare(const QSGMaterial *other) const; + +protected: + virtual QSGMaterialType *type() const; + virtual QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const /Factory/; +}; diff --git a/sip/QtQuick3D/QtQuick3Dmod.sip b/sip/QtQuick3D/QtQuick3Dmod.sip new file mode 100644 index 0000000..585bd84 --- /dev/null +++ b/sip/QtQuick3D/QtQuick3Dmod.sip @@ -0,0 +1,53 @@ +// QtQuick3Dmod.sip generated by MetaSIP +// +// This file is part of the QtQuick3D Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtQuick3D, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtQml/QtQmlmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qquick3d.sip +%Include qquick3dgeometry.sip +%Include qquick3dobject.sip +%Include qquick3dtexturedata.sip diff --git a/sip/QtQuick3D/qquick3d.sip b/sip/QtQuick3D/qquick3d.sip new file mode 100644 index 0000000..57dff50 --- /dev/null +++ b/sip/QtQuick3D/qquick3d.sip @@ -0,0 +1,31 @@ +// qquick3d.sip generated by MetaSIP +// +// This file is part of the QtQuick3D Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuick3D +{ +%TypeHeaderCode +#include +%End + +public: + static QSurfaceFormat idealSurfaceFormat(int samples = -1); +}; diff --git a/sip/QtQuick3D/qquick3dgeometry.sip b/sip/QtQuick3D/qquick3dgeometry.sip new file mode 100644 index 0000000..7670f64 --- /dev/null +++ b/sip/QtQuick3D/qquick3dgeometry.sip @@ -0,0 +1,132 @@ +// qquick3dgeometry.sip generated by MetaSIP +// +// This file is part of the QtQuick3D Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuick3DGeometry : QQuick3DObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QQuick3DGeometry(QQuick3DObject *parent /TransferThis/ = 0); + virtual ~QQuick3DGeometry(); + + enum class PrimitiveType + { + Points, + LineStrip, + Lines, + TriangleStrip, + TriangleFan, + Triangles, + }; + + struct Attribute + { +%TypeHeaderCode +#include +%End + + enum Semantic + { + IndexSemantic, + PositionSemantic, + NormalSemantic, + TexCoordSemantic, + TangentSemantic, + BinormalSemantic, + JointSemantic, + WeightSemantic, + ColorSemantic, +%If (Qt_6_1_0 -) + TargetPositionSemantic, +%End +%If (Qt_6_1_0 -) + TargetNormalSemantic, +%End +%If (Qt_6_1_0 -) + TargetTangentSemantic, +%End +%If (Qt_6_1_0 -) + TargetBinormalSemantic, +%End +%If (Qt_6_1_0 -) + TexCoord1Semantic, +%End +%If (Qt_6_1_0 -) + TexCoord0Semantic, +%End + }; + + enum ComponentType + { + U16Type, + U32Type, + F32Type, + I32Type, + }; + + QQuick3DGeometry::Attribute::Semantic semantic; + int offset; + QQuick3DGeometry::Attribute::ComponentType componentType; + }; + + int attributeCount() const; + QQuick3DGeometry::Attribute attribute(int index) const; + QQuick3DGeometry::PrimitiveType primitiveType() const; + QVector3D boundsMin() const; + QVector3D boundsMax() const; + int stride() const; + void setVertexData(const QByteArray &data); + void setVertexData(int offset, const QByteArray &data); + void setIndexData(const QByteArray &data); + void setIndexData(int offset, const QByteArray &data); + void setStride(int stride); + void setBounds(const QVector3D &min, const QVector3D &max); + void setPrimitiveType(QQuick3DGeometry::PrimitiveType type); + void addAttribute(QQuick3DGeometry::Attribute::Semantic semantic, int offset, QQuick3DGeometry::Attribute::ComponentType componentType); + void addAttribute(const QQuick3DGeometry::Attribute &att); + void clear(); + QByteArray vertexData() const; + QByteArray indexData() const; +%If (Qt_6_3_0 -) + int subsetCount(int subset) const; +%End +%If (Qt_6_3_0 -) + int subsetCount() const; +%End +%If (Qt_6_3_0 -) + QVector3D subsetBoundsMin(int subset) const; +%End +%If (Qt_6_3_0 -) + QVector3D subsetBoundsMax(int subset) const; +%End +%If (Qt_6_3_0 -) + int subsetOffset(int subset) const; +%End +%If (Qt_6_3_0 -) + QString subsetName(int subset) const; +%End +%If (Qt_6_3_0 -) + void addSubset(int offset, int count, const QVector3D &boundsMin, const QVector3D &boundsMax, const QString &name = {}); +%End +}; diff --git a/sip/QtQuick3D/qquick3dobject.sip b/sip/QtQuick3D/qquick3dobject.sip new file mode 100644 index 0000000..88b5f0f --- /dev/null +++ b/sip/QtQuick3D/qquick3dobject.sip @@ -0,0 +1,75 @@ +// qquick3dobject.sip generated by MetaSIP +// +// This file is part of the QtQuick3D Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuick3DObject : QObject, QQmlParserStatus /Abstract/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QQuick3DObject, &sipType_QQuick3DObject, 1, -1}, + {sipName_QQuick3DGeometry, &sipType_QQuick3DGeometry, -1, 2}, + {sipName_QQuick3DTextureData, &sipType_QQuick3DTextureData, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + explicit QQuick3DObject(QQuick3DObject *parent /TransferThis/ = 0); + virtual ~QQuick3DObject(); + QString state() const; + void setState(const QString &state); + QQuick3DObject *parentItem() const; + +public slots: + void setParentItem(QQuick3DObject *parentItem); + +signals: + void stateChanged(); + +protected: + virtual void classBegin(); + virtual void componentComplete(); +}; diff --git a/sip/QtQuick3D/qquick3dtexturedata.sip b/sip/QtQuick3D/qquick3dtexturedata.sip new file mode 100644 index 0000000..51c35f2 --- /dev/null +++ b/sip/QtQuick3D/qquick3dtexturedata.sip @@ -0,0 +1,81 @@ +// qquick3dtexturedata.sip generated by MetaSIP +// +// This file is part of the QtQuick3D Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuick3DTextureData : QQuick3DObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Format + { + None /PyName=None_/, + RGBA8, + RGBA16F, + RGBA32F, + RGBE8, + R8, + R16, + R16F, + R32F, + BC1, + BC2, + BC3, + BC4, + BC5, + BC6H, + BC7, + DXT1_RGBA, + DXT1_RGB, + DXT3_RGBA, + DXT5_RGBA, + ETC2_RGB8, + ETC2_RGB8A1, + ETC2_RGBA8, + ASTC_4x4, + ASTC_5x4, + ASTC_5x5, + ASTC_6x5, + ASTC_6x6, + ASTC_8x5, + ASTC_8x6, + ASTC_8x8, + ASTC_10x5, + ASTC_10x6, + ASTC_10x8, + ASTC_10x10, + ASTC_12x10, + ASTC_12x12, + }; + + QQuick3DTextureData(QQuick3DObject *parent /TransferThis/ = 0); + virtual ~QQuick3DTextureData(); + const QByteArray textureData() const; + void setTextureData(const QByteArray &data); + QSize size() const; + void setSize(const QSize &size); + QQuick3DTextureData::Format format() const; + void setFormat(QQuick3DTextureData::Format format); + bool hasTransparency() const; + void setHasTransparency(bool hasTransparency); +}; diff --git a/sip/QtQuickWidgets/QtQuickWidgetsmod.sip b/sip/QtQuickWidgets/QtQuickWidgetsmod.sip new file mode 100644 index 0000000..97fb497 --- /dev/null +++ b/sip/QtQuickWidgets/QtQuickWidgetsmod.sip @@ -0,0 +1,52 @@ +// QtQuickWidgetsmod.sip generated by MetaSIP +// +// This file is part of the QtQuickWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtQuickWidgets, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtQml/QtQmlmod.sip +%Import QtQuick/QtQuickmod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qquickwidget.sip diff --git a/sip/QtQuickWidgets/qquickwidget.sip b/sip/QtQuickWidgets/qquickwidget.sip new file mode 100644 index 0000000..b8ada71 --- /dev/null +++ b/sip/QtQuickWidgets/qquickwidget.sip @@ -0,0 +1,102 @@ +// qquickwidget.sip generated by MetaSIP +// +// This file is part of the QtQuickWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QQuickWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + sipType = (sipCpp->inherits(sipName_QQuickWidget) ? sipType_QQuickWidget : 0); +%End + +public: + explicit QQuickWidget(QWidget *parent /TransferThis/ = 0); + QQuickWidget(QQmlEngine *engine, QWidget *parent /TransferThis/); + QQuickWidget(const QUrl &source, QWidget *parent /TransferThis/ = 0); + virtual ~QQuickWidget(); + QUrl source() const; + QQmlEngine *engine() const; + QQmlContext *rootContext() const; + QQuickItem *rootObject() const; + + enum ResizeMode + { + SizeViewToRootObject, + SizeRootObjectToView, + }; + + QQuickWidget::ResizeMode resizeMode() const; + void setResizeMode(QQuickWidget::ResizeMode); + + enum Status + { + Null, + Ready, + Loading, + Error, + }; + + QQuickWidget::Status status() const; + QList errors() const; + virtual QSize sizeHint() const; + QSize initialSize() const; + void setFormat(const QSurfaceFormat &format); + QSurfaceFormat format() const; + +public slots: + void setSource(const QUrl &) /ReleaseGIL/; + +signals: + void statusChanged(QQuickWidget::Status); + void sceneGraphError(QQuickWindow::SceneGraphError error, const QString &message); + +protected: + virtual void resizeEvent(QResizeEvent *); + virtual void timerEvent(QTimerEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + virtual void wheelEvent(QWheelEvent *); + virtual bool event(QEvent *); + virtual void focusInEvent(QFocusEvent *event); + virtual void focusOutEvent(QFocusEvent *event); + virtual void dragEnterEvent(QDragEnterEvent *); + virtual void dragMoveEvent(QDragMoveEvent *); + virtual void dragLeaveEvent(QDragLeaveEvent *); + virtual void dropEvent(QDropEvent *); + virtual void paintEvent(QPaintEvent *event); + +public: + QImage grabFramebuffer() const; + void setClearColor(const QColor &color); + QQuickWindow *quickWindow() const; + +protected: + virtual bool focusNextPrevChild(bool next); +}; diff --git a/sip/QtRemoteObjects/QtRemoteObjectsmod.sip b/sip/QtRemoteObjects/QtRemoteObjectsmod.sip new file mode 100644 index 0000000..89e30e6 --- /dev/null +++ b/sip/QtRemoteObjects/QtRemoteObjectsmod.sip @@ -0,0 +1,53 @@ +// QtRemoteObjectsmod.sip generated by MetaSIP +// +// This file is part of the QtRemoteObjects Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtRemoteObjects, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qtremoteobjectglobal.sip +%Include qremoteobjectabstractitemmodelreplica.sip +%Include qremoteobjectdynamicreplica.sip +%Include qremoteobjectnode.sip +%Include qremoteobjectregistry.sip +%Include qremoteobjectreplica.sip diff --git a/sip/QtRemoteObjects/qremoteobjectabstractitemmodelreplica.sip b/sip/QtRemoteObjects/qremoteobjectabstractitemmodelreplica.sip new file mode 100644 index 0000000..e0b68a3 --- /dev/null +++ b/sip/QtRemoteObjects/qremoteobjectabstractitemmodelreplica.sip @@ -0,0 +1,54 @@ +// qremoteobjectabstractitemmodelreplica.sip generated by MetaSIP +// +// This file is part of the QtRemoteObjects Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAbstractItemModelReplica : QAbstractItemModel /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QAbstractItemModelReplica(); + QItemSelectionModel *selectionModel() const; + virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + virtual QModelIndex parent(const QModelIndex &index) const; + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + QList availableRoles() const; + virtual QHash roleNames() const; + bool isInitialized() const; + bool hasData(const QModelIndex &index, int role) const; + size_t rootCacheSize() const; + void setRootCacheSize(size_t rootCacheSize); + +signals: + void initialized(); +}; + +%End diff --git a/sip/QtRemoteObjects/qremoteobjectdynamicreplica.sip b/sip/QtRemoteObjects/qremoteobjectdynamicreplica.sip new file mode 100644 index 0000000..6c0f329 --- /dev/null +++ b/sip/QtRemoteObjects/qremoteobjectdynamicreplica.sip @@ -0,0 +1,38 @@ +// qremoteobjectdynamicreplica.sip generated by MetaSIP +// +// This file is part of the QtRemoteObjects Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QRemoteObjectDynamicReplica : QRemoteObjectReplica +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QRemoteObjectDynamicReplica(); + +private: + QRemoteObjectDynamicReplica(); +}; + +%End diff --git a/sip/QtRemoteObjects/qremoteobjectnode.sip b/sip/QtRemoteObjects/qremoteobjectnode.sip new file mode 100644 index 0000000..8397dd5 --- /dev/null +++ b/sip/QtRemoteObjects/qremoteobjectnode.sip @@ -0,0 +1,191 @@ +// qremoteobjectnode.sip generated by MetaSIP +// +// This file is part of the QtRemoteObjects Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QRemoteObjectAbstractPersistedStore : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QRemoteObjectAbstractPersistedStore(QObject *parent /TransferThis/ = 0); + virtual ~QRemoteObjectAbstractPersistedStore(); + virtual void saveProperties(const QString &repName, const QByteArray &repSig, const QVariantList &values) = 0; + virtual QVariantList restoreProperties(const QString &repName, const QByteArray &repSig) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QRemoteObjectNode : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QAbstractItemModelReplica, &sipType_QAbstractItemModelReplica, -1, 1}, + {sipName_QRemoteObjectAbstractPersistedStore, &sipType_QRemoteObjectAbstractPersistedStore, -1, 2}, + {sipName_QRemoteObjectReplica, &sipType_QRemoteObjectReplica, 4, 3}, + {sipName_QRemoteObjectNode, &sipType_QRemoteObjectNode, 6, -1}, + {sipName_QRemoteObjectDynamicReplica, &sipType_QRemoteObjectDynamicReplica, -1, 5}, + {sipName_QRemoteObjectRegistry, &sipType_QRemoteObjectRegistry, -1, -1}, + {sipName_QRemoteObjectHostBase, &sipType_QRemoteObjectHostBase, 7, -1}, + {sipName_QRemoteObjectHost, &sipType_QRemoteObjectHost, -1, 8}, + {sipName_QRemoteObjectRegistryHost, &sipType_QRemoteObjectRegistryHost, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum ErrorCode + { + NoError, + RegistryNotAcquired, + RegistryAlreadyHosted, + NodeIsNoServer, + ServerAlreadyCreated, + UnintendedRegistryHosting, + OperationNotValidOnClientNode, + SourceNotRegistered, + MissingObjectName, + HostUrlInvalid, + ProtocolMismatch, + ListenFailed, + }; + + QRemoteObjectNode(QObject *parent /TransferThis/ = 0); + QRemoteObjectNode(const QUrl ®istryAddress, QObject *parent /TransferThis/ = 0); + virtual ~QRemoteObjectNode(); + bool connectToNode(const QUrl &address); + void addClientSideConnection(QIODevice *ioDevice); + virtual void setName(const QString &name); + QStringList instances(QStringView typeName) const; + QRemoteObjectDynamicReplica *acquireDynamic(const QString &name) /Factory/; + QAbstractItemModelReplica *acquireModel(const QString &name, QtRemoteObjects::InitialAction action = QtRemoteObjects::FetchRootSize, const QList &rolesHint = {}); + QUrl registryUrl() const; + virtual bool setRegistryUrl(const QUrl ®istryAddress); + bool waitForRegistry(int timeout = 30000) /ReleaseGIL/; + const QRemoteObjectRegistry *registry() const; + QRemoteObjectAbstractPersistedStore *persistedStore() const; + void setPersistedStore(QRemoteObjectAbstractPersistedStore *persistedStore); + QRemoteObjectNode::ErrorCode lastError() const; + int heartbeatInterval() const; + void setHeartbeatInterval(int interval); + +signals: + void remoteObjectAdded(const QRemoteObjectSourceLocation &); + void remoteObjectRemoved(const QRemoteObjectSourceLocation &); + void error(QRemoteObjectNode::ErrorCode errorCode); + void heartbeatIntervalChanged(int heartbeatInterval); + +protected: + virtual void timerEvent(QTimerEvent *); +}; + +%End +%If (Qt_6_2_0 -) + +class QRemoteObjectHostBase : QRemoteObjectNode /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum AllowedSchemas + { + BuiltInSchemasOnly, + AllowExternalRegistration, + }; + + virtual ~QRemoteObjectHostBase(); + virtual void setName(const QString &name); + bool enableRemoting(QObject *object, const QString &name = QString()); + bool enableRemoting(QAbstractItemModel *model, const QString &name, const QList roles, QItemSelectionModel *selectionModel = 0); + bool disableRemoting(QObject *remoteObject); + void addHostSideConnection(QIODevice *ioDevice); + bool proxy(const QUrl ®istryUrl, const QUrl &hostUrl /TypeHintValue="QUrl()"/ = {}); + bool reverseProxy(); +}; + +%End +%If (Qt_6_2_0 -) + +class QRemoteObjectHost : QRemoteObjectHostBase +{ +%TypeHeaderCode +#include +%End + +public: + QRemoteObjectHost(QObject *parent /TransferThis/ = 0); + QRemoteObjectHost(const QUrl &address, const QUrl ®istryAddress = QUrl(), QRemoteObjectHostBase::AllowedSchemas allowedSchemas = QRemoteObjectHostBase::BuiltInSchemasOnly, QObject *parent /TransferThis/ = 0); + QRemoteObjectHost(const QUrl &address, QObject *parent /TransferThis/); + virtual ~QRemoteObjectHost(); + virtual QUrl hostUrl() const; + virtual bool setHostUrl(const QUrl &hostAddress, QRemoteObjectHostBase::AllowedSchemas allowedSchemas = QRemoteObjectHostBase::BuiltInSchemasOnly); + +signals: + void hostUrlChanged(); +}; + +%End +%If (Qt_6_2_0 -) + +class QRemoteObjectRegistryHost : QRemoteObjectHostBase +{ +%TypeHeaderCode +#include +%End + +public: + QRemoteObjectRegistryHost(const QUrl ®istryAddress = QUrl(), QObject *parent /TransferThis/ = 0); + virtual ~QRemoteObjectRegistryHost(); + virtual bool setRegistryUrl(const QUrl ®istryUrl); +}; + +%End diff --git a/sip/QtRemoteObjects/qremoteobjectregistry.sip b/sip/QtRemoteObjects/qremoteobjectregistry.sip new file mode 100644 index 0000000..b3a1239 --- /dev/null +++ b/sip/QtRemoteObjects/qremoteobjectregistry.sip @@ -0,0 +1,43 @@ +// qremoteobjectregistry.sip generated by MetaSIP +// +// This file is part of the QtRemoteObjects Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QRemoteObjectRegistry : QRemoteObjectReplica +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QRemoteObjectRegistry(); + QRemoteObjectSourceLocations sourceLocations() const; + +signals: + void remoteObjectAdded(const QRemoteObjectSourceLocation &entry); + void remoteObjectRemoved(const QRemoteObjectSourceLocation &entry); + +private: + explicit QRemoteObjectRegistry(QObject *parent = 0); +}; + +%End diff --git a/sip/QtRemoteObjects/qremoteobjectreplica.sip b/sip/QtRemoteObjects/qremoteobjectreplica.sip new file mode 100644 index 0000000..c5a2f07 --- /dev/null +++ b/sip/QtRemoteObjects/qremoteobjectreplica.sip @@ -0,0 +1,55 @@ +// qremoteobjectreplica.sip generated by MetaSIP +// +// This file is part of the QtRemoteObjects Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QRemoteObjectReplica : QObject /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum State + { + Uninitialized, + Default, + Valid, + Suspect, + SignatureMismatch, + }; + + virtual ~QRemoteObjectReplica(); + bool isReplicaValid() const; + bool waitForSource(int timeout = 30000) /ReleaseGIL/; + bool isInitialized() const; + QRemoteObjectReplica::State state() const; + QRemoteObjectNode *node() const; + virtual void setNode(QRemoteObjectNode *node); + +signals: + void initialized(); + void stateChanged(QRemoteObjectReplica::State state, QRemoteObjectReplica::State oldState); + void notified(); +}; + +%End diff --git a/sip/QtRemoteObjects/qtremoteobjectglobal.sip b/sip/QtRemoteObjects/qtremoteobjectglobal.sip new file mode 100644 index 0000000..baed08b --- /dev/null +++ b/sip/QtRemoteObjects/qtremoteobjectglobal.sip @@ -0,0 +1,67 @@ +// qtremoteobjectglobal.sip generated by MetaSIP +// +// This file is part of the QtRemoteObjects Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +struct QRemoteObjectSourceLocationInfo +{ +%TypeHeaderCode +#include +%End + + QRemoteObjectSourceLocationInfo(); + QRemoteObjectSourceLocationInfo(const QString &typeName_, const QUrl &hostUrl_); + bool operator==(const QRemoteObjectSourceLocationInfo &other) const; + bool operator!=(const QRemoteObjectSourceLocationInfo &other) const; + QString typeName; + QUrl hostUrl; +}; + +%End +%If (Qt_6_2_0 -) +QDataStream &operator<<(QDataStream &stream, const QRemoteObjectSourceLocationInfo &info) /ReleaseGIL/; +%End +%If (Qt_6_2_0 -) +QDataStream &operator>>(QDataStream &stream, QRemoteObjectSourceLocationInfo &info /Constrained/) /ReleaseGIL/; +%End +%If (Qt_6_2_0 -) +typedef std::pair QRemoteObjectSourceLocation; +%End +%If (Qt_6_2_0 -) +typedef QHash QRemoteObjectSourceLocations; +%End +%If (Qt_6_2_0 -) + +namespace QtRemoteObjects /PyQtNoQMetaObject/ +{ +%TypeHeaderCode +#include +%End + + enum InitialAction + { + FetchRootSize, + PrefetchData, + }; +}; + +%End diff --git a/sip/QtSensors/QtSensorsmod.sip b/sip/QtSensors/QtSensorsmod.sip new file mode 100644 index 0000000..21fd4f2 --- /dev/null +++ b/sip/QtSensors/QtSensorsmod.sip @@ -0,0 +1,64 @@ +// QtSensorsmod.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtSensors, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qaccelerometer.sip +%Include qambientlightsensor.sip +%Include qambienttemperaturesensor.sip +%Include qcompass.sip +%Include qgyroscope.sip +%Include qhumiditysensor.sip +%Include qirproximitysensor.sip +%Include qlidsensor.sip +%Include qlightsensor.sip +%Include qmagnetometer.sip +%Include qorientationsensor.sip +%Include qpressuresensor.sip +%Include qproximitysensor.sip +%Include qrotationsensor.sip +%Include qsensor.sip +%Include qtapsensor.sip +%Include qtiltsensor.sip diff --git a/sip/QtSensors/qaccelerometer.sip b/sip/QtSensors/qaccelerometer.sip new file mode 100644 index 0000000..aa48a6a --- /dev/null +++ b/sip/QtSensors/qaccelerometer.sip @@ -0,0 +1,81 @@ +// qaccelerometer.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAccelerometerReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal x() const; + void setX(qreal x); + qreal y() const; + void setY(qreal y); + qreal z() const; + void setZ(qreal z); +}; + +%End +%If (Qt_6_2_0 -) + +class QAccelerometerFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QAccelerometerReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QAccelerometer : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAccelerometer(QObject *parent /TransferThis/ = 0); + virtual ~QAccelerometer(); + + enum AccelerationMode + { + Combined, + Gravity, + User, + }; + + QAccelerometer::AccelerationMode accelerationMode() const; + void setAccelerationMode(QAccelerometer::AccelerationMode accelerationMode); + QAccelerometerReading *reading() const; + +signals: + void accelerationModeChanged(QAccelerometer::AccelerationMode accelerationMode /ScopesStripped=1/); +}; + +%End diff --git a/sip/QtSensors/qambientlightsensor.sip b/sip/QtSensors/qambientlightsensor.sip new file mode 100644 index 0000000..9e0779b --- /dev/null +++ b/sip/QtSensors/qambientlightsensor.sip @@ -0,0 +1,74 @@ +// qambientlightsensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAmbientLightReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum LightLevel + { + Undefined, + Dark, + Twilight, + Light, + Bright, + Sunny, + }; + + QAmbientLightReading::LightLevel lightLevel() const; + void setLightLevel(QAmbientLightReading::LightLevel lightLevel); +}; + +%End +%If (Qt_6_2_0 -) + +class QAmbientLightFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QAmbientLightReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QAmbientLightSensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAmbientLightSensor(QObject *parent /TransferThis/ = 0); + virtual ~QAmbientLightSensor(); + QAmbientLightReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qambienttemperaturesensor.sip b/sip/QtSensors/qambienttemperaturesensor.sip new file mode 100644 index 0000000..93c6667 --- /dev/null +++ b/sip/QtSensors/qambienttemperaturesensor.sip @@ -0,0 +1,64 @@ +// qambienttemperaturesensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QAmbientTemperatureReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal temperature() const; + void setTemperature(qreal temperature); +}; + +%End +%If (Qt_6_2_0 -) + +class QAmbientTemperatureFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QAmbientTemperatureReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QAmbientTemperatureSensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAmbientTemperatureSensor(QObject *parent /TransferThis/ = 0); + virtual ~QAmbientTemperatureSensor(); + QAmbientTemperatureReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qcompass.sip b/sip/QtSensors/qcompass.sip new file mode 100644 index 0000000..853cf86 --- /dev/null +++ b/sip/QtSensors/qcompass.sip @@ -0,0 +1,66 @@ +// qcompass.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QCompassReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal azimuth() const; + void setAzimuth(qreal azimuth); + qreal calibrationLevel() const; + void setCalibrationLevel(qreal calibrationLevel); +}; + +%End +%If (Qt_6_2_0 -) + +class QCompassFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QCompassReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QCompass : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QCompass(QObject *parent /TransferThis/ = 0); + virtual ~QCompass(); + QCompassReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qgyroscope.sip b/sip/QtSensors/qgyroscope.sip new file mode 100644 index 0000000..eafacaa --- /dev/null +++ b/sip/QtSensors/qgyroscope.sip @@ -0,0 +1,68 @@ +// qgyroscope.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QGyroscopeReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal x() const; + void setX(qreal x); + qreal y() const; + void setY(qreal y); + qreal z() const; + void setZ(qreal z); +}; + +%End +%If (Qt_6_2_0 -) + +class QGyroscopeFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QGyroscopeReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QGyroscope : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGyroscope(QObject *parent /TransferThis/ = 0); + virtual ~QGyroscope(); + QGyroscopeReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qhumiditysensor.sip b/sip/QtSensors/qhumiditysensor.sip new file mode 100644 index 0000000..25387f5 --- /dev/null +++ b/sip/QtSensors/qhumiditysensor.sip @@ -0,0 +1,66 @@ +// qhumiditysensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QHumidityReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal relativeHumidity() const; + void setRelativeHumidity(qreal percent); + qreal absoluteHumidity() const; + void setAbsoluteHumidity(qreal value); +}; + +%End +%If (Qt_6_2_0 -) + +class QHumidityFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QHumidityReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QHumiditySensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QHumiditySensor(QObject *parent /TransferThis/ = 0); + virtual ~QHumiditySensor(); + QHumidityReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qirproximitysensor.sip b/sip/QtSensors/qirproximitysensor.sip new file mode 100644 index 0000000..8ea1274 --- /dev/null +++ b/sip/QtSensors/qirproximitysensor.sip @@ -0,0 +1,64 @@ +// qirproximitysensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QIRProximityReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal reflectance() const; + void setReflectance(qreal reflectance); +}; + +%End +%If (Qt_6_2_0 -) + +class QIRProximityFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QIRProximityReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QIRProximitySensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QIRProximitySensor(QObject *parent /TransferThis/ = 0); + virtual ~QIRProximitySensor(); + QIRProximityReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qlidsensor.sip b/sip/QtSensors/qlidsensor.sip new file mode 100644 index 0000000..727019b --- /dev/null +++ b/sip/QtSensors/qlidsensor.sip @@ -0,0 +1,70 @@ +// qlidsensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLidReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + bool backLidClosed() const; + void setBackLidClosed(bool closed); + bool frontLidClosed() const; + void setFrontLidClosed(bool closed); + +signals: + void backLidChanged(bool closed); + void frontLidChanged(bool closed); +}; + +%End +%If (Qt_6_2_0 -) + +class QLidFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QLidReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QLidSensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QLidSensor(QObject *parent /TransferThis/ = 0); + virtual ~QLidSensor(); + QLidReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qlightsensor.sip b/sip/QtSensors/qlightsensor.sip new file mode 100644 index 0000000..43db2d2 --- /dev/null +++ b/sip/QtSensors/qlightsensor.sip @@ -0,0 +1,69 @@ +// qlightsensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QLightReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal lux() const; + void setLux(qreal lux); +}; + +%End +%If (Qt_6_2_0 -) + +class QLightFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QLightReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QLightSensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QLightSensor(QObject *parent /TransferThis/ = 0); + virtual ~QLightSensor(); + QLightReading *reading() const; + qreal fieldOfView() const; + void setFieldOfView(qreal fieldOfView); + +signals: + void fieldOfViewChanged(qreal fieldOfView); +}; + +%End diff --git a/sip/QtSensors/qmagnetometer.sip b/sip/QtSensors/qmagnetometer.sip new file mode 100644 index 0000000..4223d8d --- /dev/null +++ b/sip/QtSensors/qmagnetometer.sip @@ -0,0 +1,75 @@ +// qmagnetometer.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QMagnetometerReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal x() const; + void setX(qreal x); + qreal y() const; + void setY(qreal y); + qreal z() const; + void setZ(qreal z); + qreal calibrationLevel() const; + void setCalibrationLevel(qreal calibrationLevel); +}; + +%End +%If (Qt_6_2_0 -) + +class QMagnetometerFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QMagnetometerReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QMagnetometer : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QMagnetometer(QObject *parent /TransferThis/ = 0); + virtual ~QMagnetometer(); + QMagnetometerReading *reading() const; + bool returnGeoValues() const; + void setReturnGeoValues(bool returnGeoValues); + +signals: + void returnGeoValuesChanged(bool returnGeoValues); +}; + +%End diff --git a/sip/QtSensors/qorientationsensor.sip b/sip/QtSensors/qorientationsensor.sip new file mode 100644 index 0000000..2469305 --- /dev/null +++ b/sip/QtSensors/qorientationsensor.sip @@ -0,0 +1,75 @@ +// qorientationsensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QOrientationReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum Orientation + { + Undefined, + TopUp, + TopDown, + LeftUp, + RightUp, + FaceUp, + FaceDown, + }; + + QOrientationReading::Orientation orientation() const; + void setOrientation(QOrientationReading::Orientation orientation); +}; + +%End +%If (Qt_6_2_0 -) + +class QOrientationFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QOrientationReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QOrientationSensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QOrientationSensor(QObject *parent /TransferThis/ = 0); + virtual ~QOrientationSensor(); + QOrientationReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qpressuresensor.sip b/sip/QtSensors/qpressuresensor.sip new file mode 100644 index 0000000..4e14d2b --- /dev/null +++ b/sip/QtSensors/qpressuresensor.sip @@ -0,0 +1,66 @@ +// qpressuresensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QPressureReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal pressure() const; + void setPressure(qreal pressure); + qreal temperature() const; + void setTemperature(qreal temperature); +}; + +%End +%If (Qt_6_2_0 -) + +class QPressureFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QPressureReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QPressureSensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QPressureSensor(QObject *parent /TransferThis/ = 0); + virtual ~QPressureSensor(); + QPressureReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qproximitysensor.sip b/sip/QtSensors/qproximitysensor.sip new file mode 100644 index 0000000..db83b9c --- /dev/null +++ b/sip/QtSensors/qproximitysensor.sip @@ -0,0 +1,64 @@ +// qproximitysensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QProximityReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + bool close() const; + void setClose(bool close); +}; + +%End +%If (Qt_6_2_0 -) + +class QProximityFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QProximityReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QProximitySensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QProximitySensor(QObject *parent /TransferThis/ = 0); + virtual ~QProximitySensor(); + QProximityReading *reading() const; +}; + +%End diff --git a/sip/QtSensors/qrotationsensor.sip b/sip/QtSensors/qrotationsensor.sip new file mode 100644 index 0000000..c5af6e4 --- /dev/null +++ b/sip/QtSensors/qrotationsensor.sip @@ -0,0 +1,71 @@ +// qrotationsensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QRotationReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal x() const; + qreal y() const; + qreal z() const; + void setFromEuler(qreal x, qreal y, qreal z); +}; + +%End +%If (Qt_6_2_0 -) + +class QRotationFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QRotationReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QRotationSensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QRotationSensor(QObject *parent /TransferThis/ = 0); + virtual ~QRotationSensor(); + QRotationReading *reading() const; + bool hasZ() const; + void setHasZ(bool hasZ); + +signals: + void hasZChanged(bool hasZ); +}; + +%End diff --git a/sip/QtSensors/qsensor.sip b/sip/QtSensors/qsensor.sip new file mode 100644 index 0000000..32cb629 --- /dev/null +++ b/sip/QtSensors/qsensor.sip @@ -0,0 +1,234 @@ +// qsensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +struct qoutputrange +{ +%TypeHeaderCode +#include +%End + + qreal minimum; + qreal maximum; + qreal accuracy; +}; + +%End +%If (Qt_6_2_0 -) +typedef QList qoutputrangelist; +%End +%If (Qt_6_2_0 -) + +class QSensorReading : QObject /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QSensorReading(); + quint64 timestamp() const; + void setTimestamp(quint64 timestamp); + int valueCount() const; + QVariant value(int index) const; +}; + +%End +%If (Qt_6_2_0 -) + +class QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QSensorReading *reading) = 0; + +protected: + QSensorFilter(); + virtual ~QSensorFilter(); +}; + +%End +%If (Qt_6_2_0 -) + +class QSensor : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QSensor, &sipType_QSensor, 2, 1}, + {sipName_QSensorReading, &sipType_QSensorReading, 18, -1}, + {sipName_QAccelerometer, &sipType_QAccelerometer, -1, 3}, + {sipName_QAmbientLightSensor, &sipType_QAmbientLightSensor, -1, 4}, + {sipName_QAmbientTemperatureSensor, &sipType_QAmbientTemperatureSensor, -1, 5}, + {sipName_QCompass, &sipType_QCompass, -1, 6}, + {sipName_QGyroscope, &sipType_QGyroscope, -1, 7}, + {sipName_QHumiditySensor, &sipType_QHumiditySensor, -1, 8}, + {sipName_QIRProximitySensor, &sipType_QIRProximitySensor, -1, 9}, + {sipName_QLidSensor, &sipType_QLidSensor, -1, 10}, + {sipName_QLightSensor, &sipType_QLightSensor, -1, 11}, + {sipName_QMagnetometer, &sipType_QMagnetometer, -1, 12}, + {sipName_QOrientationSensor, &sipType_QOrientationSensor, -1, 13}, + {sipName_QPressureSensor, &sipType_QPressureSensor, -1, 14}, + {sipName_QProximitySensor, &sipType_QProximitySensor, -1, 15}, + {sipName_QRotationSensor, &sipType_QRotationSensor, -1, 16}, + {sipName_QTapSensor, &sipType_QTapSensor, -1, 17}, + {sipName_QTiltSensor, &sipType_QTiltSensor, -1, -1}, + {sipName_QAccelerometerReading, &sipType_QAccelerometerReading, -1, 19}, + {sipName_QAmbientLightReading, &sipType_QAmbientLightReading, -1, 20}, + {sipName_QAmbientTemperatureReading, &sipType_QAmbientTemperatureReading, -1, 21}, + {sipName_QCompassReading, &sipType_QCompassReading, -1, 22}, + {sipName_QGyroscopeReading, &sipType_QGyroscopeReading, -1, 23}, + {sipName_QHumidityReading, &sipType_QHumidityReading, -1, 24}, + {sipName_QIRProximityReading, &sipType_QIRProximityReading, -1, 25}, + {sipName_QLidReading, &sipType_QLidReading, -1, 26}, + {sipName_QLightReading, &sipType_QLightReading, -1, 27}, + {sipName_QMagnetometerReading, &sipType_QMagnetometerReading, -1, 28}, + {sipName_QOrientationReading, &sipType_QOrientationReading, -1, 29}, + {sipName_QPressureReading, &sipType_QPressureReading, -1, 30}, + {sipName_QProximityReading, &sipType_QProximityReading, -1, 31}, + {sipName_QRotationReading, &sipType_QRotationReading, -1, 32}, + {sipName_QTapReading, &sipType_QTapReading, -1, 33}, + {sipName_QTiltReading, &sipType_QTiltReading, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum Feature + { + Buffering, + AlwaysOn, + GeoValues, + FieldOfView, + AccelerationMode, + SkipDuplicates, + AxesOrientation, + PressureSensorTemperature, + }; + + enum AxesOrientationMode + { + FixedOrientation, + AutomaticOrientation, + UserOrientation, + }; + + QSensor(const QByteArray &type, QObject *parent /TransferThis/ = 0); + virtual ~QSensor(); + QByteArray identifier() const; + void setIdentifier(const QByteArray &identifier); + QByteArray type() const; + bool connectToBackend(); + bool isConnectedToBackend() const; + bool isBusy() const; + void setActive(bool active); + bool isActive() const; + bool isAlwaysOn() const; + void setAlwaysOn(bool alwaysOn); + bool skipDuplicates() const; + void setSkipDuplicates(bool skipDuplicates); + qrangelist availableDataRates() const; + int dataRate() const; + void setDataRate(int rate); + qoutputrangelist outputRanges() const; + int outputRange() const; + void setOutputRange(int index); + QString description() const; + int error() const; + void addFilter(QSensorFilter *filter); + void removeFilter(QSensorFilter *filter); + QList filters() const; + QSensorReading *reading() const; + static QList sensorTypes(); + static QList sensorsForType(const QByteArray &type); + static QByteArray defaultSensorForType(const QByteArray &type); + bool isFeatureSupported(QSensor::Feature feature) const; + QSensor::AxesOrientationMode axesOrientationMode() const; + void setAxesOrientationMode(QSensor::AxesOrientationMode axesOrientationMode); + int currentOrientation() const; + void setCurrentOrientation(int currentOrientation); + int userOrientation() const; + void setUserOrientation(int userOrientation); + int maxBufferSize() const; + void setMaxBufferSize(int maxBufferSize); + int efficientBufferSize() const; + void setEfficientBufferSize(int efficientBufferSize); + int bufferSize() const; + void setBufferSize(int bufferSize); + +public slots: + bool start(); + void stop(); + +signals: + void busyChanged(); + void activeChanged(); + void readingChanged(); + void sensorError(int error); + void availableSensorsChanged(); + void alwaysOnChanged(); + void dataRateChanged(); + void skipDuplicatesChanged(bool skipDuplicates); + void axesOrientationModeChanged(QSensor::AxesOrientationMode axesOrientationMode /ScopesStripped=1/); + void currentOrientationChanged(int currentOrientation); + void userOrientationChanged(int userOrientation); + void maxBufferSizeChanged(int maxBufferSize); + void efficientBufferSizeChanged(int efficientBufferSize); + void bufferSizeChanged(int bufferSize); + void identifierChanged(); +}; + +%End +%If (Qt_6_2_0 -) +typedef std::pair qrange; +%End +%If (Qt_6_2_0 -) +typedef QList> qrangelist; +%End diff --git a/sip/QtSensors/qtapsensor.sip b/sip/QtSensors/qtapsensor.sip new file mode 100644 index 0000000..55795bd --- /dev/null +++ b/sip/QtSensors/qtapsensor.sip @@ -0,0 +1,88 @@ +// qtapsensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QTapReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum TapDirection + { + Undefined, + X, + Y, + Z, + X_Pos, + Y_Pos, + Z_Pos, + X_Neg, + Y_Neg, + Z_Neg, + X_Both, + Y_Both, + Z_Both, + }; + + QTapReading::TapDirection tapDirection() const; + void setTapDirection(QTapReading::TapDirection tapDirection); + bool isDoubleTap() const; + void setDoubleTap(bool doubleTap); +}; + +%End +%If (Qt_6_2_0 -) + +class QTapFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QTapReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QTapSensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTapSensor(QObject *parent /TransferThis/ = 0); + virtual ~QTapSensor(); + QTapReading *reading() const; + bool returnDoubleTapEvents() const; + void setReturnDoubleTapEvents(bool returnDoubleTapEvents); + +signals: + void returnDoubleTapEventsChanged(bool returnDoubleTapEvents); +}; + +%End diff --git a/sip/QtSensors/qtiltsensor.sip b/sip/QtSensors/qtiltsensor.sip new file mode 100644 index 0000000..717c04f --- /dev/null +++ b/sip/QtSensors/qtiltsensor.sip @@ -0,0 +1,67 @@ +// qtiltsensor.sip generated by MetaSIP +// +// This file is part of the QtSensors Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QTiltReading : QSensorReading /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + qreal yRotation() const; + void setYRotation(qreal y); + qreal xRotation() const; + void setXRotation(qreal x); +}; + +%End +%If (Qt_6_2_0 -) + +class QTiltFilter : QSensorFilter +{ +%TypeHeaderCode +#include +%End + +public: + virtual bool filter(QTiltReading *reading) = 0; +}; + +%End +%If (Qt_6_2_0 -) + +class QTiltSensor : QSensor +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTiltSensor(QObject *parent /TransferThis/ = 0); + virtual ~QTiltSensor(); + QTiltReading *reading() const; + void calibrate(); +}; + +%End diff --git a/sip/QtSerialPort/QtSerialPortmod.sip b/sip/QtSerialPort/QtSerialPortmod.sip new file mode 100644 index 0000000..b03214f --- /dev/null +++ b/sip/QtSerialPort/QtSerialPortmod.sip @@ -0,0 +1,49 @@ +// QtSerialPortmod.sip generated by MetaSIP +// +// This file is part of the QtSerialPort Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtSerialPort, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qserialport.sip +%Include qserialportinfo.sip diff --git a/sip/QtSerialPort/qserialport.sip b/sip/QtSerialPort/qserialport.sip new file mode 100644 index 0000000..5c3db7d --- /dev/null +++ b/sip/QtSerialPort/qserialport.sip @@ -0,0 +1,282 @@ +// qserialport.sip generated by MetaSIP +// +// This file is part of the QtSerialPort Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QSerialPort : QIODevice +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QSerialPort, &sipType_QSerialPort, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum Direction /BaseType=Flag/ + { + Input, + Output, + AllDirections, + }; + + typedef QFlags Directions; + + enum BaudRate + { + Baud1200, + Baud2400, + Baud4800, + Baud9600, + Baud19200, + Baud38400, + Baud57600, + Baud115200, + }; + + enum DataBits + { + Data5, + Data6, + Data7, + Data8, + }; + + enum Parity + { + NoParity, + EvenParity, + OddParity, + SpaceParity, + MarkParity, + }; + + enum StopBits + { + OneStop, + OneAndHalfStop, + TwoStop, + }; + + enum FlowControl + { + NoFlowControl, + HardwareControl, + SoftwareControl, + }; + + enum PinoutSignal /BaseType=Flag/ + { + NoSignal, + DataTerminalReadySignal, + DataCarrierDetectSignal, + DataSetReadySignal, + RingIndicatorSignal, + RequestToSendSignal, + ClearToSendSignal, + SecondaryTransmittedDataSignal, + SecondaryReceivedDataSignal, + }; + + typedef QFlags PinoutSignals; + + enum SerialPortError + { + NoError, + DeviceNotFoundError, + PermissionError, + OpenError, + WriteError, + ReadError, + ResourceError, + UnsupportedOperationError, + TimeoutError, + NotOpenError, + UnknownError, + }; + + explicit QSerialPort(QObject *parent /TransferThis/ = 0); + QSerialPort(const QString &name, QObject *parent /TransferThis/ = 0); + QSerialPort(const QSerialPortInfo &info, QObject *parent /TransferThis/ = 0); + virtual ~QSerialPort(); + void setPortName(const QString &name); + QString portName() const; + void setPort(const QSerialPortInfo &info); + virtual bool open(QIODeviceBase::OpenMode mode) /ReleaseGIL/; + virtual void close() /ReleaseGIL/; + bool setBaudRate(qint32 baudRate, QSerialPort::Directions dir = QSerialPort::AllDirections); + qint32 baudRate(QSerialPort::Directions dir = QSerialPort::AllDirections) const; + bool setDataBits(QSerialPort::DataBits dataBits); + QSerialPort::DataBits dataBits() const; + bool setParity(QSerialPort::Parity parity); + QSerialPort::Parity parity() const; + bool setStopBits(QSerialPort::StopBits stopBits); + QSerialPort::StopBits stopBits() const; + bool setFlowControl(QSerialPort::FlowControl flow); + QSerialPort::FlowControl flowControl() const; + bool setDataTerminalReady(bool set); + bool isDataTerminalReady(); + bool setRequestToSend(bool set); + bool isRequestToSend(); + QSerialPort::PinoutSignals pinoutSignals(); + bool flush() /ReleaseGIL/; + bool clear(QSerialPort::Directions dir = QSerialPort::AllDirections); + QSerialPort::SerialPortError error() const; + void clearError(); + qint64 readBufferSize() const; + void setReadBufferSize(qint64 size); + virtual bool isSequential() const; + virtual qint64 bytesAvailable() const; + virtual qint64 bytesToWrite() const; + virtual bool canReadLine() const; + virtual bool waitForReadyRead(int msecs = 30000) /ReleaseGIL/; + virtual bool waitForBytesWritten(int msecs = 30000) /ReleaseGIL/; + bool setBreakEnabled(bool enabled = true); + +signals: + void baudRateChanged(qint32 baudRate, QSerialPort::Directions directions); + void dataBitsChanged(QSerialPort::DataBits dataBits); + void parityChanged(QSerialPort::Parity parity); + void stopBitsChanged(QSerialPort::StopBits stopBits); + void flowControlChanged(QSerialPort::FlowControl flow); + void dataTerminalReadyChanged(bool set); + void requestToSendChanged(bool set); + +protected: + virtual SIP_PYOBJECT readData(qint64 maxlen) /TypeHint="bytes",ReleaseGIL/ [qint64 (char *data, qint64 maxSize)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QSerialPort::readData(s, a0) : sipCpp->readData(s, a0); + #else + len = sipCpp->sipProtectVirt_readData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual SIP_PYOBJECT readLineData(qint64 maxlen) /TypeHint="bytes",ReleaseGIL/ [qint64 (char *data, qint64 maxSize)]; +%MethodCode + // Return the data read or None if there was an error. + if (a0 < 0) + { + PyErr_SetString(PyExc_ValueError, "maximum length of data to be read cannot be negative"); + sipIsErr = 1; + } + else + { + char *s = new char[a0]; + qint64 len; + + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + len = sipSelfWasArg ? sipCpp->QSerialPort::readLineData(s, a0) : sipCpp->readLineData(s, a0); + #else + len = sipCpp->sipProtectVirt_readLineData(sipSelfWasArg, s, a0); + #endif + Py_END_ALLOW_THREADS + + if (len < 0) + { + Py_INCREF(Py_None); + sipRes = Py_None; + } + else + { + sipRes = PyBytes_FromStringAndSize(s, len); + + if (!sipRes) + sipIsErr = 1; + } + + delete[] s; + } +%End + + virtual qint64 writeData(const char *data /Array/, qint64 maxSize /ArraySize/) /ReleaseGIL/; + +public: +%If (Windows) + void *handle() const; +%End +%If (Android || Linux || iOS || macOS || WebAssembly) + int handle() const; +%End + bool isBreakEnabled() const; + +signals: + void breakEnabledChanged(bool set); + void errorOccurred(QSerialPort::SerialPortError error); +}; + +%End diff --git a/sip/QtSerialPort/qserialportinfo.sip b/sip/QtSerialPort/qserialportinfo.sip new file mode 100644 index 0000000..45bf011 --- /dev/null +++ b/sip/QtSerialPort/qserialportinfo.sip @@ -0,0 +1,52 @@ +// qserialportinfo.sip generated by MetaSIP +// +// This file is part of the QtSerialPort Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QSerialPortInfo +{ +%TypeHeaderCode +#include +%End + +public: + QSerialPortInfo(); + explicit QSerialPortInfo(const QSerialPort &port); + explicit QSerialPortInfo(const QString &name); + QSerialPortInfo(const QSerialPortInfo &other); + ~QSerialPortInfo(); + void swap(QSerialPortInfo &other /Constrained/); + QString portName() const; + QString systemLocation() const; + QString description() const; + QString manufacturer() const; + quint16 vendorIdentifier() const; + quint16 productIdentifier() const; + bool hasVendorIdentifier() const; + bool hasProductIdentifier() const; + static QList standardBaudRates(); + static QList availablePorts(); + bool isNull() const; + QString serialNumber() const; +}; + +%End diff --git a/sip/QtSpatialAudio/QtSpatialAudiomod.sip b/sip/QtSpatialAudio/QtSpatialAudiomod.sip new file mode 100644 index 0000000..71d6581 --- /dev/null +++ b/sip/QtSpatialAudio/QtSpatialAudiomod.sip @@ -0,0 +1,53 @@ +// QtSpatialAudiomod.sip generated by MetaSIP +// +// This file is part of the QtSpatialAudio Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtSpatialAudio, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtMultimedia/QtMultimediamod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qambientsound.sip +%Include qaudioengine.sip +%Include qaudiolistener.sip +%Include qaudioroom.sip +%Include qspatialsound.sip diff --git a/sip/QtSpatialAudio/qambientsound.sip b/sip/QtSpatialAudio/qambientsound.sip new file mode 100644 index 0000000..6a132f2 --- /dev/null +++ b/sip/QtSpatialAudio/qambientsound.sip @@ -0,0 +1,62 @@ +// qambientsound.sip generated by MetaSIP +// +// This file is part of the QtSpatialAudio Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) + +class QAmbientSound : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Loops + { + Infinite, + Once, + }; + + explicit QAmbientSound(QAudioEngine *engine); + virtual ~QAmbientSound(); + void setSource(const QUrl &url); + QUrl source() const; + int loops() const; + void setLoops(int loops); + bool autoPlay() const; + void setAutoPlay(bool autoPlay); + void setVolume(float volume); + float volume() const; + QAudioEngine *engine() const; + +signals: + void sourceChanged(); + void loopsChanged(); + void autoPlayChanged(); + void volumeChanged(); + +public slots: + void play(); + void pause(); + void stop(); +}; + +%End diff --git a/sip/QtSpatialAudio/qaudioengine.sip b/sip/QtSpatialAudio/qaudioengine.sip new file mode 100644 index 0000000..bd4d12d --- /dev/null +++ b/sip/QtSpatialAudio/qaudioengine.sip @@ -0,0 +1,105 @@ +// qaudioengine.sip generated by MetaSIP +// +// This file is part of the QtSpatialAudio Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) + +class QAudioEngine : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QAmbientSound, &sipType_QAmbientSound, -1, 1}, + {sipName_QAudioEngine, &sipType_QAudioEngine, -1, 2}, + {sipName_QAudioListener, &sipType_QAudioListener, -1, 3}, + {sipName_QAudioRoom, &sipType_QAudioRoom, -1, 4}, + {sipName_QSpatialSound, &sipType_QSpatialSound, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum OutputMode + { + Surround, + Stereo, + Headphone, + }; + + QAudioEngine(); + explicit QAudioEngine(QObject *parent /TransferThis/); + QAudioEngine(int sampleRate, QObject *parent /TransferThis/ = 0); + virtual ~QAudioEngine(); + void setOutputMode(QAudioEngine::OutputMode mode); + QAudioEngine::OutputMode outputMode() const; + int sampleRate() const; + void setOutputDevice(const QAudioDevice &device); + QAudioDevice outputDevice() const; + void setMasterVolume(float volume); + float masterVolume() const; + void setPaused(bool paused); + bool paused() const; + void setRoomEffectsEnabled(bool enabled); + bool roomEffectsEnabled() const; + static const float DistanceScaleCentimeter; + static const float DistanceScaleMeter; + void setDistanceScale(float scale); + float distanceScale() const; + +signals: + void outputModeChanged(); + void outputDeviceChanged(); + void masterVolumeChanged(); + void pausedChanged(); + void distanceScaleChanged(); + +public slots: + void start(); + void stop(); + void pause(); + void resume(); +}; + +%End diff --git a/sip/QtSpatialAudio/qaudiolistener.sip b/sip/QtSpatialAudio/qaudiolistener.sip new file mode 100644 index 0000000..0d288e8 --- /dev/null +++ b/sip/QtSpatialAudio/qaudiolistener.sip @@ -0,0 +1,41 @@ +// qaudiolistener.sip generated by MetaSIP +// +// This file is part of the QtSpatialAudio Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) + +class QAudioListener : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAudioListener(QAudioEngine *engine); + virtual ~QAudioListener(); + void setPosition(QVector3D pos); + QVector3D position() const; + void setRotation(const QQuaternion &q); + QQuaternion rotation() const; + QAudioEngine *engine() const; +}; + +%End diff --git a/sip/QtSpatialAudio/qaudioroom.sip b/sip/QtSpatialAudio/qaudioroom.sip new file mode 100644 index 0000000..3a19903 --- /dev/null +++ b/sip/QtSpatialAudio/qaudioroom.sip @@ -0,0 +1,100 @@ +// qaudioroom.sip generated by MetaSIP +// +// This file is part of the QtSpatialAudio Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) + +class QAudioRoom : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum Material + { + Transparent, + AcousticCeilingTiles, + BrickBare, + BrickPainted, + ConcreteBlockCoarse, + ConcreteBlockPainted, + CurtainHeavy, + FiberGlassInsulation, + GlassThin, + GlassThick, + Grass, + LinoleumOnConcrete, + Marble, + Metal, + ParquetOnConcrete, + PlasterRough, + PlasterSmooth, + PlywoodPanel, + PolishedConcreteOrTile, + Sheetrock, + WaterOrIceSurface, + WoodCeiling, + WoodPanel, + UniformMaterial, + }; + + enum Wall + { + LeftWall, + RightWall, + Floor, + Ceiling, + FrontWall, + BackWall, + }; + + explicit QAudioRoom(QAudioEngine *engine); + virtual ~QAudioRoom(); + void setPosition(QVector3D pos); + QVector3D position() const; + void setDimensions(QVector3D dim); + QVector3D dimensions() const; + void setRotation(const QQuaternion &q); + QQuaternion rotation() const; + void setWallMaterial(QAudioRoom::Wall wall, QAudioRoom::Material material); + QAudioRoom::Material wallMaterial(QAudioRoom::Wall wall) const; + void setReflectionGain(float factor); + float reflectionGain() const; + void setReverbGain(float factor); + float reverbGain() const; + void setReverbTime(float factor); + float reverbTime() const; + void setReverbBrightness(float factor); + float reverbBrightness() const; + +signals: + void positionChanged(); + void dimensionsChanged(); + void rotationChanged(); + void wallsChanged(); + void reflectionGainChanged(); + void reverbGainChanged(); + void reverbTimeChanged(); + void reverbBrightnessChanged(); +}; + +%End diff --git a/sip/QtSpatialAudio/qspatialsound.sip b/sip/QtSpatialAudio/qspatialsound.sip new file mode 100644 index 0000000..35c9254 --- /dev/null +++ b/sip/QtSpatialAudio/qspatialsound.sip @@ -0,0 +1,99 @@ +// qspatialsound.sip generated by MetaSIP +// +// This file is part of the QtSpatialAudio Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_5_0 -) + +class QSpatialSound : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum class DistanceModel + { + Logarithmic, + Linear, + ManualAttenuation, + }; + + enum Loops + { + Infinite, + Once, + }; + + explicit QSpatialSound(QAudioEngine *engine); + virtual ~QSpatialSound(); + void setSource(const QUrl &url); + QUrl source() const; + int loops() const; + void setLoops(int loops); + bool autoPlay() const; + void setAutoPlay(bool autoPlay); + void setPosition(QVector3D pos); + QVector3D position() const; + void setRotation(const QQuaternion &q); + QQuaternion rotation() const; + void setVolume(float volume); + float volume() const; + void setDistanceModel(QSpatialSound::DistanceModel model); + QSpatialSound::DistanceModel distanceModel() const; + void setSize(float size); + float size() const; + void setDistanceCutoff(float cutoff); + float distanceCutoff() const; + void setManualAttenuation(float attenuation); + float manualAttenuation() const; + void setOcclusionIntensity(float occlusion); + float occlusionIntensity() const; + void setDirectivity(float alpha); + float directivity() const; + void setDirectivityOrder(float alpha); + float directivityOrder() const; + void setNearFieldGain(float gain); + float nearFieldGain() const; + QAudioEngine *engine() const; + +signals: + void sourceChanged(); + void loopsChanged(); + void autoPlayChanged(); + void positionChanged(); + void rotationChanged(); + void volumeChanged(); + void distanceModelChanged(); + void sizeChanged(); + void distanceCutoffChanged(); + void manualAttenuationChanged(); + void occlusionIntensityChanged(); + void directivityChanged(); + void directivityOrderChanged(); + void nearFieldGainChanged(); + +public slots: + void play(); + void pause(); + void stop(); +}; + +%End diff --git a/sip/QtSql/QtSqlmod.sip b/sip/QtSql/QtSqlmod.sip new file mode 100644 index 0000000..12ea64f --- /dev/null +++ b/sip/QtSql/QtSqlmod.sip @@ -0,0 +1,61 @@ +// QtSqlmod.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtSql, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qsqldatabase.sip +%Include qsqldriver.sip +%Include qsqlerror.sip +%Include qsqlfield.sip +%Include qsqlindex.sip +%Include qsqlquery.sip +%Include qsqlquerymodel.sip +%Include qsqlrecord.sip +%Include qsqlrelationaldelegate.sip +%Include qsqlrelationaltablemodel.sip +%Include qsqlresult.sip +%Include qsqltablemodel.sip +%Include qtsqlglobal.sip diff --git a/sip/QtSql/qsqldatabase.sip b/sip/QtSql/qsqldatabase.sip new file mode 100644 index 0000000..19adbf7 --- /dev/null +++ b/sip/QtSql/qsqldatabase.sip @@ -0,0 +1,92 @@ +// qsqldatabase.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlDriverCreatorBase /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QSqlDriverCreatorBase(); + virtual QSqlDriver *createObject() const = 0 /Factory/; +}; + +class QSqlDatabase +{ +%TypeHeaderCode +#include +%End + +public: + QSqlDatabase(); + QSqlDatabase(const QSqlDatabase &other); + ~QSqlDatabase(); + bool open() /ReleaseGIL/; + bool open(const QString &user, const QString &password) /ReleaseGIL/; + void close(); + bool isOpen() const; + bool isOpenError() const; + QStringList tables(QSql::TableType type = QSql::Tables) const; + QSqlIndex primaryIndex(const QString &tablename) const; + QSqlRecord record(const QString &tablename) const; + QSqlQuery exec(const QString &query = QString()) const /ReleaseGIL/; + QSqlError lastError() const; + bool isValid() const; + bool transaction() /ReleaseGIL/; + bool commit() /ReleaseGIL/; + bool rollback() /ReleaseGIL/; + void setDatabaseName(const QString &name); + void setUserName(const QString &name); + void setPassword(const QString &password); + void setHostName(const QString &host); + void setPort(int p); + void setConnectOptions(const QString &options = QString()); + QString databaseName() const; + QString userName() const; + QString password() const; + QString hostName() const; + QString driverName() const; + int port() const; + QString connectOptions() const; + QString connectionName() const; + QSqlDriver *driver() const; + static QSqlDatabase addDatabase(const QString &type, const QString &connectionName = QLatin1String(QSqlDatabase::defaultConnection)); + static QSqlDatabase addDatabase(QSqlDriver *driver, const QString &connectionName = QLatin1String(QSqlDatabase::defaultConnection)); + static QSqlDatabase cloneDatabase(const QSqlDatabase &other, const QString &connectionName); + static QSqlDatabase cloneDatabase(const QString &other, const QString &connectionName); + static QSqlDatabase database(const QString &connectionName = QLatin1String(QSqlDatabase::defaultConnection), bool open = true); + static void removeDatabase(const QString &connectionName); + static bool contains(const QString &connectionName = QLatin1String(QSqlDatabase::defaultConnection)); + static QStringList drivers(); + static QStringList connectionNames(); + static void registerSqlDriver(const QString &name, QSqlDriverCreatorBase *creator /Transfer/); + static bool isDriverAvailable(const QString &name); + +protected: + explicit QSqlDatabase(const QString &type); + explicit QSqlDatabase(QSqlDriver *driver); + +public: + void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy); + QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; +}; diff --git a/sip/QtSql/qsqldriver.sip b/sip/QtSql/qsqldriver.sip new file mode 100644 index 0000000..c146612 --- /dev/null +++ b/sip/QtSql/qsqldriver.sip @@ -0,0 +1,156 @@ +// qsqldriver.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlDriver : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QSqlQueryModel, &sipType_QSqlQueryModel, 3, 1}, + {sipName_QSqlRelationalDelegate, &sipType_QSqlRelationalDelegate, -1, 2}, + {sipName_QSqlDriver, &sipType_QSqlDriver, -1, -1}, + {sipName_QSqlTableModel, &sipType_QSqlTableModel, 4, -1}, + {sipName_QSqlRelationalTableModel, &sipType_QSqlRelationalTableModel, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum DriverFeature + { + Transactions, + QuerySize, + BLOB, + Unicode, + PreparedQueries, + NamedPlaceholders, + PositionalPlaceholders, + LastInsertId, + BatchOperations, + SimpleLocking, + LowPrecisionNumbers, + EventNotifications, + FinishQuery, + MultipleResultSets, + }; + + enum StatementType + { + WhereStatement, + SelectStatement, + UpdateStatement, + InsertStatement, + DeleteStatement, + }; + + enum IdentifierType + { + FieldName, + TableName, + }; + + explicit QSqlDriver(QObject *parent /TransferThis/ = 0); + virtual ~QSqlDriver(); + virtual bool isOpen() const; + bool isOpenError() const; + virtual bool beginTransaction() /ReleaseGIL/; + virtual bool commitTransaction() /ReleaseGIL/; + virtual bool rollbackTransaction() /ReleaseGIL/; + virtual QStringList tables(QSql::TableType tableType) const; + virtual QSqlIndex primaryIndex(const QString &tableName) const; + virtual QSqlRecord record(const QString &tableName) const; + virtual QString formatValue(const QSqlField &field, bool trimStrings = false) const; + virtual QString escapeIdentifier(const QString &identifier, QSqlDriver::IdentifierType type) const; + virtual QString sqlStatement(QSqlDriver::StatementType type, const QString &tableName, const QSqlRecord &rec, bool preparedStatement) const; + QSqlError lastError() const; + virtual QVariant handle() const; + virtual bool hasFeature(QSqlDriver::DriverFeature f) const = 0; + virtual void close() = 0; + virtual QSqlResult *createResult() const = 0 /Factory/; + virtual bool open(const QString &db, const QString &user = QString(), const QString &password = QString(), const QString &host = QString(), int port = -1, const QString &options = QString()) = 0 /ReleaseGIL/; + +protected: + virtual void setOpen(bool o); + virtual void setOpenError(bool e); + virtual void setLastError(const QSqlError &e); + +public: + virtual bool subscribeToNotification(const QString &name); + virtual bool unsubscribeFromNotification(const QString &name); + virtual QStringList subscribedToNotifications() const; + + enum NotificationSource + { + UnknownSource, + SelfSource, + OtherSource, + }; + +signals: + void notification(const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload); + +public: + virtual bool isIdentifierEscaped(const QString &identifier, QSqlDriver::IdentifierType type) const; + virtual QString stripDelimiters(const QString &identifier, QSqlDriver::IdentifierType type) const; + void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy); + QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; + + enum DbmsType + { + UnknownDbms, + MSSqlServer, + MySqlServer, + PostgreSQL, + Oracle, + Sybase, + SQLite, + Interbase, + DB2, + }; + + QSqlDriver::DbmsType dbmsType() const; + virtual int maximumIdentifierLength(QSqlDriver::IdentifierType type) const; +}; diff --git a/sip/QtSql/qsqlerror.sip b/sip/QtSql/qsqlerror.sip new file mode 100644 index 0000000..c7b525d --- /dev/null +++ b/sip/QtSql/qsqlerror.sip @@ -0,0 +1,51 @@ +// qsqlerror.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlError +{ +%TypeHeaderCode +#include +%End + +public: + enum ErrorType + { + NoError, + ConnectionError, + StatementError, + TransactionError, + UnknownError, + }; + + QSqlError(const QString &driverText = QString(), const QString &databaseText = QString(), QSqlError::ErrorType type = QSqlError::NoError, const QString &errorCode = QString()); + QSqlError(const QSqlError &other); + ~QSqlError(); + QString driverText() const; + QString databaseText() const; + QSqlError::ErrorType type() const; + QString text() const; + bool isValid() const; + bool operator==(const QSqlError &other) const; + bool operator!=(const QSqlError &other) const; + QString nativeErrorCode() const; + void swap(QSqlError &other /Constrained/); +}; diff --git a/sip/QtSql/qsqlfield.sip b/sip/QtSql/qsqlfield.sip new file mode 100644 index 0000000..3fe2247 --- /dev/null +++ b/sip/QtSql/qsqlfield.sip @@ -0,0 +1,70 @@ +// qsqlfield.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlField +{ +%TypeHeaderCode +#include +%End + +public: + enum RequiredStatus + { + Unknown, + Optional, + Required, + }; + + QSqlField(const QString &fieldName = QString(), QMetaType type = QMetaType(), const QString &tableName = QString()); + QSqlField(const QSqlField &other); + bool operator==(const QSqlField &other) const; + bool operator!=(const QSqlField &other) const; + ~QSqlField(); + void setValue(const QVariant &value); + QVariant value() const; + void setName(const QString &name); + QString name() const; + bool isNull() const; + void setReadOnly(bool readOnly); + bool isReadOnly() const; + void clear(); + bool isAutoValue() const; + void setRequiredStatus(QSqlField::RequiredStatus status); + void setRequired(bool required); + void setLength(int fieldLength); + void setPrecision(int precision); + void setDefaultValue(const QVariant &value); + void setSqlType(int type); + void setGenerated(bool gen); + void setAutoValue(bool autoVal); + QSqlField::RequiredStatus requiredStatus() const; + int length() const; + int precision() const; + QVariant defaultValue() const; + int typeID() const; + bool isGenerated() const; + bool isValid() const; + void setTableName(const QString &tableName); + QString tableName() const; + QMetaType metaType() const; + void setMetaType(QMetaType type); +}; diff --git a/sip/QtSql/qsqlindex.sip b/sip/QtSql/qsqlindex.sip new file mode 100644 index 0000000..02db79f --- /dev/null +++ b/sip/QtSql/qsqlindex.sip @@ -0,0 +1,41 @@ +// qsqlindex.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlIndex : QSqlRecord +{ +%TypeHeaderCode +#include +%End + +public: + QSqlIndex(const QString &cursorName = QString(), const QString &name = QString()); + QSqlIndex(const QSqlIndex &other); + ~QSqlIndex(); + void setCursorName(const QString &cursorName); + QString cursorName() const; + void setName(const QString &name); + QString name() const; + void append(const QSqlField &field); + void append(const QSqlField &field, bool desc); + bool isDescending(int i) const; + void setDescending(int i, bool desc); +}; diff --git a/sip/QtSql/qsqlquery.sip b/sip/QtSql/qsqlquery.sip new file mode 100644 index 0000000..a0b9d6e --- /dev/null +++ b/sip/QtSql/qsqlquery.sip @@ -0,0 +1,83 @@ +// qsqlquery.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlQuery +{ +%TypeHeaderCode +#include +%End + +public: + enum BatchExecutionMode + { + ValuesAsRows, + ValuesAsColumns, + }; + + explicit QSqlQuery(const QSqlDatabase &db); + QSqlQuery(const QString &query = QString(), const QSqlDatabase &db = QSqlDatabase()) /ReleaseGIL/; + explicit QSqlQuery(QSqlResult *r); + QSqlQuery(const QSqlQuery &other); + ~QSqlQuery(); + bool isValid() const; + bool isActive() const; + bool isNull(int field) const; + bool isNull(const QString &name) const; + int at() const; + QString lastQuery() const; + int numRowsAffected() const; + QSqlError lastError() const; + bool isSelect() const; + int size() const; + const QSqlDriver *driver() const; + const QSqlResult *result() const; + bool isForwardOnly() const; + QSqlRecord record() const; + void setForwardOnly(bool forward); + bool exec(const QString &query) /ReleaseGIL/; + QVariant value(int i) const; + QVariant value(const QString &name) const; + bool seek(int index, bool relative = false) /ReleaseGIL/; + bool next() /ReleaseGIL/; + bool previous() /ReleaseGIL/; + bool first() /ReleaseGIL/; + bool last() /ReleaseGIL/; + void clear() /ReleaseGIL/; + bool exec() /ReleaseGIL/; + bool execBatch(QSqlQuery::BatchExecutionMode mode = QSqlQuery::ValuesAsRows); + bool prepare(const QString &query) /ReleaseGIL/; + void bindValue(const QString &placeholder, const QVariant &val, QSql::ParamType type = QSql::In); + void bindValue(int pos, const QVariant &val, QSql::ParamType type = QSql::In); + void addBindValue(const QVariant &val, QSql::ParamType type = QSql::In); + QVariant boundValue(const QString &placeholder) const; + QVariant boundValue(int pos) const; + QVariantList boundValues() const; + QString executedQuery() const; + QVariant lastInsertId() const; + void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy); + QSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; + void finish(); + bool nextResult(); +%If (Qt_6_2_0 -) + void swap(QSqlQuery &other /Constrained/); +%End +}; diff --git a/sip/QtSql/qsqlquerymodel.sip b/sip/QtSql/qsqlquerymodel.sip new file mode 100644 index 0000000..3691bd2 --- /dev/null +++ b/sip/QtSql/qsqlquerymodel.sip @@ -0,0 +1,75 @@ +// qsqlquerymodel.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlQueryModel : QAbstractTableModel +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSqlQueryModel(QObject *parent /TransferThis/ = 0); + virtual ~QSqlQueryModel(); + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + QSqlRecord record() const; + QSqlRecord record(int row) const; + virtual QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); + virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + void setQuery(const QSqlQuery &query); + void setQuery(const QString &query, const QSqlDatabase &db = QSqlDatabase()); +%If (Qt_6_5_0 -) + const QSqlQuery &query() const; +%MethodCode + sipRes = const_cast(&sipCpp->query(Qt::Disambiguated)); +%End + +%End +%If (- Qt_6_5_0) + QSqlQuery query() const; +%End + virtual void clear(); + QSqlError lastError() const; + virtual void fetchMore(const QModelIndex &parent = QModelIndex()); + virtual bool canFetchMore(const QModelIndex &parent = QModelIndex()) const; + +protected: + virtual void queryChange(); + virtual QModelIndex indexInQuery(const QModelIndex &item) const; + void setLastError(const QSqlError &error); + void beginResetModel(); + void endResetModel(); + void beginInsertRows(const QModelIndex &parent, int first, int last); + void endInsertRows(); + void beginRemoveRows(const QModelIndex &parent, int first, int last); + void endRemoveRows(); + void beginInsertColumns(const QModelIndex &parent, int first, int last); + void endInsertColumns(); + void beginRemoveColumns(const QModelIndex &parent, int first, int last); + void endRemoveColumns(); + +public: + virtual QHash roleNames() const; +}; diff --git a/sip/QtSql/qsqlrecord.sip b/sip/QtSql/qsqlrecord.sip new file mode 100644 index 0000000..2934829 --- /dev/null +++ b/sip/QtSql/qsqlrecord.sip @@ -0,0 +1,61 @@ +// qsqlrecord.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlRecord +{ +%TypeHeaderCode +#include +%End + +public: + QSqlRecord(); + QSqlRecord(const QSqlRecord &other); + ~QSqlRecord(); + bool operator==(const QSqlRecord &other) const; + bool operator!=(const QSqlRecord &other) const; + QVariant value(int i) const; + QVariant value(const QString &name) const; + void setValue(int i, const QVariant &val); + void setValue(const QString &name, const QVariant &val); + void setNull(int i); + void setNull(const QString &name); + bool isNull(int i) const; + bool isNull(const QString &name) const; + int indexOf(const QString &name) const; + QString fieldName(int i) const; + QSqlField field(int i) const; + QSqlField field(const QString &name) const; + bool isGenerated(int i) const; + bool isGenerated(const QString &name) const; + void setGenerated(const QString &name, bool generated); + void setGenerated(int i, bool generated); + void append(const QSqlField &field); + void replace(int pos, const QSqlField &field); + void insert(int pos, const QSqlField &field); + void remove(int pos); + bool isEmpty() const; + bool contains(const QString &name) const; + void clear(); + void clearValues(); + int count() const /__len__/; + QSqlRecord keyValues(const QSqlRecord &keyFields) const; +}; diff --git a/sip/QtSql/qsqlrelationaldelegate.sip b/sip/QtSql/qsqlrelationaldelegate.sip new file mode 100644 index 0000000..5ee1385 --- /dev/null +++ b/sip/QtSql/qsqlrelationaldelegate.sip @@ -0,0 +1,35 @@ +// qsqlrelationaldelegate.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlRelationalDelegate : QStyledItemDelegate +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSqlRelationalDelegate(QObject *parent /TransferThis/ = 0); + virtual ~QSqlRelationalDelegate(); + virtual QWidget *createEditor(QWidget *parent /TransferThis/, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const; + virtual void setEditorData(QWidget *editor, const QModelIndex &index) const; + virtual void setModelData(QWidget *editor, QAbstractItemModel *model /KeepReference/, const QModelIndex &index) const; +}; diff --git a/sip/QtSql/qsqlrelationaltablemodel.sip b/sip/QtSql/qsqlrelationaltablemodel.sip new file mode 100644 index 0000000..79de4a2 --- /dev/null +++ b/sip/QtSql/qsqlrelationaltablemodel.sip @@ -0,0 +1,73 @@ +// qsqlrelationaltablemodel.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlRelation +{ +%TypeHeaderCode +#include +%End + +public: + QSqlRelation(); + QSqlRelation(const QString &aTableName, const QString &indexCol, const QString &displayCol); + QString tableName() const; + QString indexColumn() const; + QString displayColumn() const; + bool isValid() const; + void swap(QSqlRelation &other /Constrained/); +}; + +class QSqlRelationalTableModel : QSqlTableModel +{ +%TypeHeaderCode +#include +%End + +public: + QSqlRelationalTableModel(QObject *parent /TransferThis/ = 0, const QSqlDatabase &db = QSqlDatabase()); + virtual ~QSqlRelationalTableModel(); + virtual QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex &item, const QVariant &value, int role = Qt::EditRole); + virtual void clear(); + virtual bool select(); + virtual void setTable(const QString &tableName); + virtual void setRelation(int column, const QSqlRelation &relation); + QSqlRelation relation(int column) const; + virtual QSqlTableModel *relationModel(int column) const; + virtual void revertRow(int row); + virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + +protected: + virtual QString selectStatement() const; + virtual bool updateRowInTable(int row, const QSqlRecord &values); + virtual QString orderByClause() const; + virtual bool insertRowIntoTable(const QSqlRecord &values); + +public: + enum JoinMode + { + InnerJoin, + LeftJoin, + }; + + void setJoinMode(QSqlRelationalTableModel::JoinMode joinMode); +}; diff --git a/sip/QtSql/qsqlresult.sip b/sip/QtSql/qsqlresult.sip new file mode 100644 index 0000000..13bf061 --- /dev/null +++ b/sip/QtSql/qsqlresult.sip @@ -0,0 +1,87 @@ +// qsqlresult.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlResult /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QSqlResult(); + virtual QVariant handle() const; + +protected: + enum BindingSyntax + { + PositionalBinding, + NamedBinding, + }; + + explicit QSqlResult(const QSqlDriver *db); + int at() const; + QString lastQuery() const; + QSqlError lastError() const; + bool isValid() const; + bool isActive() const; + bool isSelect() const; + bool isForwardOnly() const; + const QSqlDriver *driver() const; + virtual void setAt(int at); + virtual void setActive(bool a); + virtual void setLastError(const QSqlError &e); + virtual void setQuery(const QString &query); + virtual void setSelect(bool s); + virtual void setForwardOnly(bool forward); + virtual bool exec() /ReleaseGIL/; + virtual bool prepare(const QString &query) /ReleaseGIL/; + virtual bool savePrepare(const QString &sqlquery); + virtual void bindValue(int pos, const QVariant &val, QSql::ParamType type); + virtual void bindValue(const QString &placeholder, const QVariant &val, QSql::ParamType type); + void addBindValue(const QVariant &val, QSql::ParamType type); + QVariant boundValue(const QString &placeholder) const; + QVariant boundValue(int pos) const; + QSql::ParamType bindValueType(const QString &placeholder) const; + QSql::ParamType bindValueType(int pos) const; + int boundValueCount() const; + QList &boundValues() const; + QString executedQuery() const; + QString boundValueName(int pos) const; + void clear(); + bool hasOutValues() const; + QSqlResult::BindingSyntax bindingSyntax() const; + virtual QVariant data(int i) = 0; + virtual bool isNull(int i) = 0; + virtual bool reset(const QString &sqlquery) = 0; + virtual bool fetch(int i) = 0 /ReleaseGIL/; + virtual bool fetchNext() /ReleaseGIL/; + virtual bool fetchPrevious() /ReleaseGIL/; + virtual bool fetchFirst() = 0 /ReleaseGIL/; + virtual bool fetchLast() = 0 /ReleaseGIL/; + virtual int size() = 0; + virtual int numRowsAffected() = 0; + virtual QSqlRecord record() const; + virtual QVariant lastInsertId() const; + +private: + QSqlResult(const QSqlResult &); +}; diff --git a/sip/QtSql/qsqltablemodel.sip b/sip/QtSql/qsqltablemodel.sip new file mode 100644 index 0000000..6df1b57 --- /dev/null +++ b/sip/QtSql/qsqltablemodel.sip @@ -0,0 +1,96 @@ +// qsqltablemodel.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSqlTableModel : QSqlQueryModel +{ +%TypeHeaderCode +#include +%End + +public: + enum EditStrategy + { + OnFieldChange, + OnRowChange, + OnManualSubmit, + }; + + QSqlTableModel(QObject *parent /TransferThis/ = 0, const QSqlDatabase &db = QSqlDatabase()); + virtual ~QSqlTableModel(); + virtual bool select(); + virtual void setTable(const QString &tableName); + QString tableName() const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const; + virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + bool isDirty(const QModelIndex &index) const; + bool isDirty() const; + virtual void clear(); + virtual void setEditStrategy(QSqlTableModel::EditStrategy strategy); + QSqlTableModel::EditStrategy editStrategy() const; + QSqlIndex primaryKey() const; + QSqlDatabase database() const; + int fieldIndex(const QString &fieldName) const; + virtual void sort(int column, Qt::SortOrder order); + virtual void setSort(int column, Qt::SortOrder order); + QString filter() const; + virtual void setFilter(const QString &filter); + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); + bool insertRecord(int row, const QSqlRecord &record); + bool setRecord(int row, const QSqlRecord &record); + virtual void revertRow(int row); + +public slots: + virtual bool submit(); + virtual void revert(); + bool submitAll(); + void revertAll(); + +signals: + void primeInsert(int row, QSqlRecord &record); + void beforeInsert(QSqlRecord &record); + void beforeUpdate(int row, QSqlRecord &record); + void beforeDelete(int row); + +protected: + virtual bool updateRowInTable(int row, const QSqlRecord &values); + virtual bool insertRowIntoTable(const QSqlRecord &values); + virtual bool deleteRowFromTable(int row); + virtual QString orderByClause() const; + virtual QString selectStatement() const; + void setPrimaryKey(const QSqlIndex &key); +%If (- Qt_6_5_0) + void setQuery(const QSqlQuery &query); +%End + virtual QModelIndex indexInQuery(const QModelIndex &item) const; + QSqlRecord primaryValues(int row) const; + +public: + virtual bool selectRow(int row); + QSqlRecord record() const; + QSqlRecord record(int row) const; + virtual bool clearItemData(const QModelIndex &index); +}; diff --git a/sip/QtSql/qtsqlglobal.sip b/sip/QtSql/qtsqlglobal.sip new file mode 100644 index 0000000..bf9f80c --- /dev/null +++ b/sip/QtSql/qtsqlglobal.sip @@ -0,0 +1,60 @@ +// qtsqlglobal.sip generated by MetaSIP +// +// This file is part of the QtSql Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +namespace QSql +{ +%TypeHeaderCode +#include +%End + + enum Location + { + BeforeFirstRow, + AfterLastRow, + }; + + enum ParamTypeFlag /BaseType=Flag/ + { + In, + Out, + InOut, + Binary, + }; + + typedef QFlags ParamType; + + enum TableType + { + Tables, + SystemTables, + Views, + AllTables, + }; + + enum NumericalPrecisionPolicy + { + LowPrecisionInt32, + LowPrecisionInt64, + LowPrecisionDouble, + HighPrecision, + }; +}; diff --git a/sip/QtSvg/QtSvgmod.sip b/sip/QtSvg/QtSvgmod.sip new file mode 100644 index 0000000..d2dddfa --- /dev/null +++ b/sip/QtSvg/QtSvgmod.sip @@ -0,0 +1,50 @@ +// QtSvgmod.sip generated by MetaSIP +// +// This file is part of the QtSvg Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtSvg, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qsvggenerator.sip +%Include qsvgrenderer.sip diff --git a/sip/QtSvg/qsvggenerator.sip b/sip/QtSvg/qsvggenerator.sip new file mode 100644 index 0000000..d2a6759 --- /dev/null +++ b/sip/QtSvg/qsvggenerator.sip @@ -0,0 +1,69 @@ +// qsvggenerator.sip generated by MetaSIP +// +// This file is part of the QtSvg Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSvgGenerator : QPaintDevice +{ +%TypeHeaderCode +#include +%End + +public: + QSvgGenerator(); +%If (Qt_6_5_0 -) + explicit QSvgGenerator(QSvgGenerator::SvgVersion version); +%End + virtual ~QSvgGenerator(); + QSize size() const; + void setSize(const QSize &size); + QString fileName() const; + void setFileName(const QString &fileName); + QIODevice *outputDevice() const; + void setOutputDevice(QIODevice *outputDevice); + int resolution() const; + void setResolution(int resolution); + QString title() const; + void setTitle(const QString &title); + QString description() const; + void setDescription(const QString &description); + QRect viewBox() const; + QRectF viewBoxF() const; + void setViewBox(const QRect &viewBox); + void setViewBox(const QRectF &viewBox); + +protected: + virtual QPaintEngine *paintEngine() const; + virtual int metric(QPaintDevice::PaintDeviceMetric metric) const; + +public: +%If (Qt_6_5_0 -) + + enum class SvgVersion + { + SvgTiny12, + Svg11, + }; + +%End +%If (Qt_6_5_0 -) + QSvgGenerator::SvgVersion svgVersion() const; +%End +}; diff --git a/sip/QtSvg/qsvgrenderer.sip b/sip/QtSvg/qsvgrenderer.sip new file mode 100644 index 0000000..cdae926 --- /dev/null +++ b/sip/QtSvg/qsvgrenderer.sip @@ -0,0 +1,93 @@ +// qsvgrenderer.sip generated by MetaSIP +// +// This file is part of the QtSvg Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSvgRenderer : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QSvgRenderer, &sipType_QSvgRenderer, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + QSvgRenderer(QObject *parent /TransferThis/ = 0); + QSvgRenderer(const QString &filename, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QSvgRenderer(const QByteArray &contents, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + QSvgRenderer(QXmlStreamReader *contents, QObject *parent /TransferThis/ = 0) /ReleaseGIL/; + virtual ~QSvgRenderer(); + bool isValid() const; + QSize defaultSize() const; + bool elementExists(const QString &id) const; + QRect viewBox() const; + QRectF viewBoxF() const; + void setViewBox(const QRect &viewbox); + void setViewBox(const QRectF &viewbox); + bool animated() const; + QRectF boundsOnElement(const QString &id) const; + int framesPerSecond() const; + void setFramesPerSecond(int num); + int currentFrame() const; + void setCurrentFrame(int); + int animationDuration() const; + +public slots: + bool load(const QString &filename) /ReleaseGIL/; + bool load(const QByteArray &contents) /ReleaseGIL/; + bool load(QXmlStreamReader *contents) /ReleaseGIL/; + void render(QPainter *p) /ReleaseGIL/; + void render(QPainter *p, const QRectF &bounds) /ReleaseGIL/; + void render(QPainter *painter, const QString &elementId, const QRectF &bounds = QRectF()) /ReleaseGIL/; + +signals: + void repaintNeeded(); + +public: + Qt::AspectRatioMode aspectRatioMode() const; + void setAspectRatioMode(Qt::AspectRatioMode mode); + QTransform transformForElement(const QString &id) const; +}; diff --git a/sip/QtSvgWidgets/QtSvgWidgetsmod.sip b/sip/QtSvgWidgets/QtSvgWidgetsmod.sip new file mode 100644 index 0000000..08dfce2 --- /dev/null +++ b/sip/QtSvgWidgets/QtSvgWidgetsmod.sip @@ -0,0 +1,52 @@ +// QtSvgWidgetsmod.sip generated by MetaSIP +// +// This file is part of the QtSvgWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtSvgWidgets, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtSvg/QtSvgmod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qgraphicssvgitem.sip +%Include qsvgwidget.sip diff --git a/sip/QtSvgWidgets/qgraphicssvgitem.sip b/sip/QtSvgWidgets/qgraphicssvgitem.sip new file mode 100644 index 0000000..88b3897 --- /dev/null +++ b/sip/QtSvgWidgets/qgraphicssvgitem.sip @@ -0,0 +1,54 @@ +// qgraphicssvgitem.sip generated by MetaSIP +// +// This file is part of the QtSvgWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsSvgItem : QGraphicsObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + if (sipCpp->type() == 13) + { + // Switch to the QObject convertor. + *sipCppRet = static_cast(sipCpp); + sipType = sipType_QObject; + } + else + { + sipType = 0; + } +%End + +public: + QGraphicsSvgItem(QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsSvgItem(const QString &fileName, QGraphicsItem *parent /TransferThis/ = 0); + void setSharedRenderer(QSvgRenderer *renderer /KeepReference/); + QSvgRenderer *renderer() const; + void setElementId(const QString &id); + QString elementId() const; + void setMaximumCacheSize(const QSize &size); + QSize maximumCacheSize() const; + virtual QRectF boundingRect() const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual int type() const; +}; diff --git a/sip/QtSvgWidgets/qsvgwidget.sip b/sip/QtSvgWidgets/qsvgwidget.sip new file mode 100644 index 0000000..4bb939f --- /dev/null +++ b/sip/QtSvgWidgets/qsvgwidget.sip @@ -0,0 +1,71 @@ +// qsvgwidget.sip generated by MetaSIP +// +// This file is part of the QtSvgWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSvgWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QGraphicsSvgItem, &sipType_QGraphicsSvgItem, -1, 1}, + {sipName_QSvgWidget, &sipType_QSvgWidget, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + QSvgWidget(QWidget *parent /TransferThis/ = 0); + QSvgWidget(const QString &file, QWidget *parent /TransferThis/ = 0); + virtual ~QSvgWidget(); + QSvgRenderer *renderer() const; + virtual QSize sizeHint() const; + +public slots: + void load(const QString &file) /ReleaseGIL/; + void load(const QByteArray &contents); + +protected: + virtual void paintEvent(QPaintEvent *event); +}; diff --git a/sip/QtTest/QtTestmod.sip b/sip/QtTest/QtTestmod.sip new file mode 100644 index 0000000..be24fc0 --- /dev/null +++ b/sip/QtTest/QtTestmod.sip @@ -0,0 +1,54 @@ +// QtTestmod.sip generated by MetaSIP +// +// This file is part of the QtTest Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtTest, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip +%Import QtWidgets/QtWidgetsmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qabstractitemmodeltester.sip +%Include qsignalspy.sip +%Include qtestkeyboard.sip +%Include qtestmouse.sip +%Include qtestsystem.sip diff --git a/sip/QtTest/qabstractitemmodeltester.sip b/sip/QtTest/qabstractitemmodeltester.sip new file mode 100644 index 0000000..c4dccd1 --- /dev/null +++ b/sip/QtTest/qabstractitemmodeltester.sip @@ -0,0 +1,47 @@ +// qabstractitemmodeltester.sip generated by MetaSIP +// +// This file is part of the QtTest Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractItemModelTester : QObject +{ +%TypeHeaderCode +// Qt v5.11.0 needs this. +#include + +#include +%End + +public: + enum class FailureReportingMode + { + QtTest, + Warning, + Fatal, + }; + + QAbstractItemModelTester(QAbstractItemModel *model /KeepReference=1/, QObject *parent /TransferThis/ = 0); + QAbstractItemModelTester(QAbstractItemModel *model /KeepReference=1/, QAbstractItemModelTester::FailureReportingMode mode, QObject *parent /TransferThis/ = 0); + QAbstractItemModel *model() const; + QAbstractItemModelTester::FailureReportingMode failureReportingMode() const; +%If (Qt_6_4_0 -) + void setUseFetchMore(bool value); +%End +}; diff --git a/sip/QtTest/qsignalspy.sip b/sip/QtTest/qsignalspy.sip new file mode 100644 index 0000000..67c9ae5 --- /dev/null +++ b/sip/QtTest/qsignalspy.sip @@ -0,0 +1,101 @@ +// qsignalspy.sip generated by MetaSIP +// +// This file is part of the QtTest Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSignalSpy : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + sipType = (sipCpp->inherits("QSignalSpy") ? sipType_QSignalSpy : 0); + + if (!sipType && sipCpp->inherits("QAbstractItemModelTester")) + sipType = sipType_QAbstractItemModelTester; +%End + +public: + QSignalSpy(SIP_PYOBJECT signal /TypeHint="QtCore.pyqtBoundSignal"/) [(const QObject *obj, const char *aSignal)]; +%MethodCode + QObject *sender; + QByteArray signal_signature; + + if ((sipError = pyqt6_qttest_get_pyqtsignal_parts(a0, &sender, signal_signature)) == sipErrorNone) + sipCpp = new sipQSignalSpy(sender, signal_signature.constData()); + else if (sipError == sipErrorContinue) + sipError = sipBadCallableArg(0, a0); +%End + + QSignalSpy(const QObject *obj, const QMetaMethod &signal); + bool isValid() const; + QByteArray signal() const; + bool wait(int timeout = 5000) /ReleaseGIL/; + Py_ssize_t __len__() const; +%MethodCode + sipRes = sipCpp->count(); +%End + + QList __getitem__(int i) const; +%MethodCode + Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count()); + + if (idx < 0) + sipIsErr = 1; + else + sipRes = new QList(sipCpp->at((int)idx)); +%End + + void __setitem__(int i, const QList &value); +%MethodCode + int len = sipCpp->count(); + + if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0) + sipIsErr = 1; + else + (*sipCpp)[a0] = *a1; +%End + + void __delitem__(int i); +%MethodCode + if ((a0 = (int)sipConvertFromSequenceIndex(a0, sipCpp->count())) < 0) + sipIsErr = 1; + else + sipCpp->removeAt(a0); +%End +}; + +%ModuleHeaderCode +// Imports from QtCore. +typedef sipErrorState (*pyqt6_qttest_get_pyqtsignal_parts_t)(PyObject *, QObject **, QByteArray &); +extern pyqt6_qttest_get_pyqtsignal_parts_t pyqt6_qttest_get_pyqtsignal_parts; +%End + +%ModuleCode +// Imports from QtCore. +pyqt6_qttest_get_pyqtsignal_parts_t pyqt6_qttest_get_pyqtsignal_parts; +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qttest_get_pyqtsignal_parts = (pyqt6_qttest_get_pyqtsignal_parts_t)sipImportSymbol("pyqt6_get_pyqtsignal_parts"); +Q_ASSERT(pyqt6_qttest_get_pyqtsignal_parts); +%End diff --git a/sip/QtTest/qtestkeyboard.sip b/sip/QtTest/qtestkeyboard.sip new file mode 100644 index 0000000..0615560 --- /dev/null +++ b/sip/QtTest/qtestkeyboard.sip @@ -0,0 +1,59 @@ +// qtestkeyboard.sip generated by MetaSIP +// +// This file is part of the QtTest Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +namespace QTest +{ +%TypeHeaderCode +#include +%End + + enum KeyAction + { + Press, + Release, + Click, + Shortcut, + }; + + void keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyClicks(QWidget *widget, const QString &sequence, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyEvent(QTest::KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keySequence(QWidget *widget, const QKeySequence &keySequence); + void simulateEvent(QWidget *widget, bool press, int code, Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay = -1); + void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, char ascii /Encoding="ASCII"/, Qt::KeyboardModifiers modifier, int delay = -1); + void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, QString text, Qt::KeyboardModifiers modifier, int delay = -1); + void keyEvent(QTest::KeyAction action, QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyEvent(QTest::KeyAction action, QWindow *window, char ascii, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyClick(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyClick(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyPress(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyPress(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyRelease(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keyRelease(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1); + void keySequence(QWindow *window, const QKeySequence &keySequence); +}; diff --git a/sip/QtTest/qtestmouse.sip b/sip/QtTest/qtestmouse.sip new file mode 100644 index 0000000..a635238 --- /dev/null +++ b/sip/QtTest/qtestmouse.sip @@ -0,0 +1,39 @@ +// qtestmouse.sip generated by MetaSIP +// +// This file is part of the QtTest Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +namespace QTest +{ +%TypeHeaderCode +#include +%End + + void mouseClick(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = Qt::KeyboardModifiers(), QPoint pos = QPoint(), int delay = -1); + void mouseDClick(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = Qt::KeyboardModifiers(), QPoint pos = QPoint(), int delay = -1); + void mouseMove(QWidget *widget, QPoint pos = QPoint(), int delay = -1); + void mousePress(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = Qt::KeyboardModifiers(), QPoint pos = QPoint(), int delay = -1); + void mouseRelease(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = Qt::KeyboardModifiers(), QPoint pos = QPoint(), int delay = -1); + void mousePress(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers modifier = Qt::KeyboardModifiers(), QPoint pos = QPoint(), int delay = -1); + void mouseRelease(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers modifier = Qt::KeyboardModifiers(), QPoint pos = QPoint(), int delay = -1); + void mouseClick(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers modifier = Qt::KeyboardModifiers(), QPoint pos = QPoint(), int delay = -1); + void mouseDClick(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers modifier = Qt::KeyboardModifiers(), QPoint pos = QPoint(), int delay = -1); + void mouseMove(QWindow *window, QPoint pos = QPoint(), int delay = -1); +}; diff --git a/sip/QtTest/qtestsystem.sip b/sip/QtTest/qtestsystem.sip new file mode 100644 index 0000000..1ffcd18 --- /dev/null +++ b/sip/QtTest/qtestsystem.sip @@ -0,0 +1,34 @@ +// qtestsystem.sip generated by MetaSIP +// +// This file is part of the QtTest Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +namespace QTest +{ +%TypeHeaderCode +#include +%End + + void qWait(int ms) /ReleaseGIL/; + bool qWaitForWindowActive(QWindow *window, int timeout = 5000) /ReleaseGIL/; + bool qWaitForWindowExposed(QWindow *window, int timeout = 5000) /ReleaseGIL/; + bool qWaitForWindowActive(QWidget *widget, int timeout = 5000) /ReleaseGIL/; + bool qWaitForWindowExposed(QWidget *widget, int timeout = 5000) /ReleaseGIL/; +}; diff --git a/sip/QtTextToSpeech/QtTextToSpeechmod.sip b/sip/QtTextToSpeech/QtTextToSpeechmod.sip new file mode 100644 index 0000000..373a2fc --- /dev/null +++ b/sip/QtTextToSpeech/QtTextToSpeechmod.sip @@ -0,0 +1,49 @@ +// QtTextToSpeechmod.sip generated by MetaSIP +// +// This file is part of the QtTextToSpeech Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtTextToSpeech, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qtexttospeech.sip +%Include qvoice.sip diff --git a/sip/QtTextToSpeech/qtexttospeech.sip b/sip/QtTextToSpeech/qtexttospeech.sip new file mode 100644 index 0000000..8aed94d --- /dev/null +++ b/sip/QtTextToSpeech/qtexttospeech.sip @@ -0,0 +1,121 @@ +// qtexttospeech.sip generated by MetaSIP +// +// This file is part of the QtTextToSpeech Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextToSpeech : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QTextToSpeech, &sipType_QTextToSpeech, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + enum class BoundaryHint + { + Default, + Immediate, + Word, + Sentence, + }; + + enum class ErrorReason + { + NoError, + Initialization, + Configuration, + Input, + Playback, + }; + + enum State + { + Ready, + Speaking, + Paused, + Error, + }; + + QTextToSpeech(const QString &engine, const QVariantMap ¶ms, QObject *parent /TransferThis/ = 0); + explicit QTextToSpeech(QObject *parent /TransferThis/ = 0); + QTextToSpeech(const QString &engine, QObject *parent /TransferThis/ = 0); + virtual ~QTextToSpeech(); + bool setEngine(const QString &engine, const QVariantMap ¶ms = QVariantMap()); + QString engine() const; + QTextToSpeech::ErrorReason errorReason() const; + QString errorString() const; + QTextToSpeech::State state() const; + QList availableLocales() const; + QLocale locale() const; + QVoice voice() const; + QList availableVoices() const; + double rate() const; + double pitch() const; + double volume() const; + static QStringList availableEngines(); + +public slots: + void say(const QString &text); + void stop(QTextToSpeech::BoundaryHint boundaryHint = QTextToSpeech::BoundaryHint::Default); + void pause(QTextToSpeech::BoundaryHint boundaryHint = QTextToSpeech::BoundaryHint::Default); + void resume(); + void setLocale(const QLocale &locale); + void setRate(double rate); + void setPitch(double pitch); + void setVolume(double volume); + void setVoice(const QVoice &voice); + +signals: + void stateChanged(QTextToSpeech::State state); + void localeChanged(const QLocale &locale); + void rateChanged(double rate); + void pitchChanged(double pitch); + void volumeChanged(double volume); + void voiceChanged(const QVoice &voice); + void engineChanged(const QString &engine); + void errorOccurred(QTextToSpeech::ErrorReason error, const QString &errorString); +}; diff --git a/sip/QtTextToSpeech/qvoice.sip b/sip/QtTextToSpeech/qvoice.sip new file mode 100644 index 0000000..d9213f1 --- /dev/null +++ b/sip/QtTextToSpeech/qvoice.sip @@ -0,0 +1,61 @@ +// qvoice.sip generated by MetaSIP +// +// This file is part of the QtTextToSpeech Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QVoice +{ +%TypeHeaderCode +#include +%End + +public: + enum Gender + { + Male, + Female, + Unknown, + }; + + enum Age + { + Child, + Teenager, + Adult, + Senior, + Other, + }; + + QVoice(); + QVoice(const QVoice &other); + ~QVoice(); + QString name() const; + QVoice::Gender gender() const; + QVoice::Age age() const; + static QString genderName(QVoice::Gender gender); + static QString ageName(QVoice::Age age); + void swap(QVoice &other); + QLocale locale() const; +}; + +bool operator==(const QVoice &lhs, const QVoice &rhs); +bool operator!=(const QVoice &lhs, const QVoice &rhs); +QDataStream &operator<<(QDataStream &str, const QVoice &voice); +QDataStream &operator>>(QDataStream &str, QVoice &voice /Constrained/); diff --git a/sip/QtWebChannel/QtWebChannelmod.sip b/sip/QtWebChannel/QtWebChannelmod.sip new file mode 100644 index 0000000..8b59e1b --- /dev/null +++ b/sip/QtWebChannel/QtWebChannelmod.sip @@ -0,0 +1,49 @@ +// QtWebChannelmod.sip generated by MetaSIP +// +// This file is part of the QtWebChannel Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtWebChannel, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qwebchannel.sip +%Include qwebchannelabstracttransport.sip diff --git a/sip/QtWebChannel/qwebchannel.sip b/sip/QtWebChannel/qwebchannel.sip new file mode 100644 index 0000000..1da368a --- /dev/null +++ b/sip/QtWebChannel/qwebchannel.sip @@ -0,0 +1,80 @@ +// qwebchannel.sip generated by MetaSIP +// +// This file is part of the QtWebChannel Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QWebChannel : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QWebChannelAbstractTransport, &sipType_QWebChannelAbstractTransport, -1, 1}, + {sipName_QWebChannel, &sipType_QWebChannel, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + explicit QWebChannel(QObject *parent /TransferThis/ = 0); + virtual ~QWebChannel(); + void registerObjects(const QHash &objects); + QHash registeredObjects() const; + void registerObject(const QString &id, QObject *object); + void deregisterObject(QObject *object); + bool blockUpdates() const; + void setBlockUpdates(bool block); + int propertyUpdateInterval() const; + void setPropertyUpdateInterval(int ms); + +public slots: + void connectTo(QWebChannelAbstractTransport *transport); + void disconnectFrom(QWebChannelAbstractTransport *transport); + +signals: + void blockUpdatesChanged(bool block); +}; + +%End diff --git a/sip/QtWebChannel/qwebchannelabstracttransport.sip b/sip/QtWebChannel/qwebchannelabstracttransport.sip new file mode 100644 index 0000000..c0e4a42 --- /dev/null +++ b/sip/QtWebChannel/qwebchannelabstracttransport.sip @@ -0,0 +1,42 @@ +// qwebchannelabstracttransport.sip generated by MetaSIP +// +// This file is part of the QtWebChannel Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QWebChannelAbstractTransport : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QWebChannelAbstractTransport(QObject *parent /TransferThis/ = 0); + virtual ~QWebChannelAbstractTransport(); + +public slots: + virtual void sendMessage(const QJsonObject &message) = 0; + +signals: + void messageReceived(const QJsonObject &message, QWebChannelAbstractTransport *transport); +}; + +%End diff --git a/sip/QtWebSockets/QtWebSocketsmod.sip b/sip/QtWebSockets/QtWebSocketsmod.sip new file mode 100644 index 0000000..7361ea4 --- /dev/null +++ b/sip/QtWebSockets/QtWebSocketsmod.sip @@ -0,0 +1,54 @@ +// QtWebSocketsmod.sip generated by MetaSIP +// +// This file is part of the QtWebSockets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtWebSockets, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtNetwork/QtNetworkmod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qmaskgenerator.sip +%Include qwebsocket.sip +%Include qwebsocketcorsauthenticator.sip +%Include qwebsockethandshakeoptions.sip +%Include qwebsocketprotocol.sip +%Include qwebsocketserver.sip diff --git a/sip/QtWebSockets/qmaskgenerator.sip b/sip/QtWebSockets/qmaskgenerator.sip new file mode 100644 index 0000000..1a9c8d5 --- /dev/null +++ b/sip/QtWebSockets/qmaskgenerator.sip @@ -0,0 +1,38 @@ +// qmaskgenerator.sip generated by MetaSIP +// +// This file is part of the QtWebSockets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QMaskGenerator : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QMaskGenerator(QObject *parent /TransferThis/ = 0); + virtual ~QMaskGenerator(); + virtual bool seed() = 0; + virtual quint32 nextMask() = 0; +}; + +%End diff --git a/sip/QtWebSockets/qwebsocket.sip b/sip/QtWebSockets/qwebsocket.sip new file mode 100644 index 0000000..9cb673c --- /dev/null +++ b/sip/QtWebSockets/qwebsocket.sip @@ -0,0 +1,180 @@ +// qwebsocket.sip generated by MetaSIP +// +// This file is part of the QtWebSockets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QWebSocket : QObject +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QWebSocket, &sipType_QWebSocket, -1, 1}, + {sipName_QWebSocketServer, &sipType_QWebSocketServer, -1, 2}, + {sipName_QMaskGenerator, &sipType_QMaskGenerator, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + QWebSocket(const QString &origin = QString(), QWebSocketProtocol::Version version = QWebSocketProtocol::VersionLatest, QObject *parent /TransferThis/ = 0); + virtual ~QWebSocket(); + void abort(); + QAbstractSocket::SocketError error() const; + QString errorString() const; + bool flush() /ReleaseGIL/; + bool isValid() const; + QHostAddress localAddress() const; + quint16 localPort() const; + QAbstractSocket::PauseModes pauseMode() const; + QHostAddress peerAddress() const; + QString peerName() const; + quint16 peerPort() const; + QNetworkProxy proxy() const; + void setProxy(const QNetworkProxy &networkProxy); + void setMaskGenerator(const QMaskGenerator *maskGenerator /KeepReference/); + const QMaskGenerator *maskGenerator() const; + qint64 readBufferSize() const; + void setReadBufferSize(qint64 size); + void resume() /ReleaseGIL/; + void setPauseMode(QAbstractSocket::PauseModes pauseMode); + QAbstractSocket::SocketState state() const; + QWebSocketProtocol::Version version() const; + QString resourceName() const; + QUrl requestUrl() const; + QString origin() const; + QWebSocketProtocol::CloseCode closeCode() const; + QString closeReason() const; + qint64 sendTextMessage(const QString &message) /ReleaseGIL/; + qint64 sendBinaryMessage(const QByteArray &data) /ReleaseGIL/; +%If (PyQt_SSL) + void ignoreSslErrors(const QList &errors); +%End +%If (PyQt_SSL) + void setSslConfiguration(const QSslConfiguration &sslConfiguration); +%End +%If (PyQt_SSL) + QSslConfiguration sslConfiguration() const; +%End + QNetworkRequest request() const; + +public slots: + void close(QWebSocketProtocol::CloseCode closeCode = QWebSocketProtocol::CloseCodeNormal, const QString &reason = QString()) /ReleaseGIL/; +%If (Qt_6_4_0 -) + void open(const QNetworkRequest &request, const QWebSocketHandshakeOptions &options) /ReleaseGIL/; +%End +%If (Qt_6_4_0 -) + void open(const QUrl &url, const QWebSocketHandshakeOptions &options) /ReleaseGIL/; +%End + void open(const QUrl &url) /ReleaseGIL/; + void open(const QNetworkRequest &request) /ReleaseGIL/; + void ping(const QByteArray &payload = QByteArray()) /ReleaseGIL/; +%If (PyQt_SSL) + void ignoreSslErrors(); +%End + +signals: + void aboutToClose(); + void connected(); + void disconnected(); + void stateChanged(QAbstractSocket::SocketState state); + void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *pAuthenticator); + void readChannelFinished(); + void textFrameReceived(const QString &frame, bool isLastFrame); + void binaryFrameReceived(const QByteArray &frame, bool isLastFrame); + void textMessageReceived(const QString &message); + void binaryMessageReceived(const QByteArray &message); + void error(QAbstractSocket::SocketError error); + void pong(quint64 elapsedTime, const QByteArray &payload); + void bytesWritten(qint64 bytes); +%If (PyQt_SSL) + void sslErrors(const QList &errors); +%End +%If (PyQt_SSL) + void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator); +%End + +public: + qint64 bytesToWrite() const; + void setMaxAllowedIncomingFrameSize(quint64 maxAllowedIncomingFrameSize); + quint64 maxAllowedIncomingFrameSize() const; + void setMaxAllowedIncomingMessageSize(quint64 maxAllowedIncomingMessageSize); + quint64 maxAllowedIncomingMessageSize() const; + static quint64 maxIncomingMessageSize(); + static quint64 maxIncomingFrameSize(); + void setOutgoingFrameSize(quint64 outgoingFrameSize); + quint64 outgoingFrameSize() const; + static quint64 maxOutgoingFrameSize(); + void continueInterruptedHandshake(); + +signals: +%If (PyQt_SSL) + void peerVerifyError(const QSslError &error); +%End +%If (PyQt_SSL) + void alertSent(QSsl::AlertLevel level, QSsl::AlertType type, const QString &description); +%End +%If (PyQt_SSL) + void alertReceived(QSsl::AlertLevel level, QSsl::AlertType type, const QString &description); +%End +%If (PyQt_SSL) + void handshakeInterruptedOnError(const QSslError &error); +%End + +public: +%If (Qt_6_4_0 -) + QWebSocketHandshakeOptions handshakeOptions() const; +%End +%If (Qt_6_4_0 -) + QString subprotocol() const; +%End + +signals: +%If (Qt_6_5_0 -) + void errorOccurred(QAbstractSocket::SocketError error); +%End +}; + +%End diff --git a/sip/QtWebSockets/qwebsocketcorsauthenticator.sip b/sip/QtWebSockets/qwebsocketcorsauthenticator.sip new file mode 100644 index 0000000..6e9309a --- /dev/null +++ b/sip/QtWebSockets/qwebsocketcorsauthenticator.sip @@ -0,0 +1,41 @@ +// qwebsocketcorsauthenticator.sip generated by MetaSIP +// +// This file is part of the QtWebSockets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QWebSocketCorsAuthenticator +{ +%TypeHeaderCode +#include +%End + +public: + explicit QWebSocketCorsAuthenticator(const QString &origin); + explicit QWebSocketCorsAuthenticator(const QWebSocketCorsAuthenticator &other); + ~QWebSocketCorsAuthenticator(); + void swap(QWebSocketCorsAuthenticator &other /Constrained/); + QString origin() const; + void setAllowed(bool allowed); + bool allowed() const; +}; + +%End diff --git a/sip/QtWebSockets/qwebsockethandshakeoptions.sip b/sip/QtWebSockets/qwebsockethandshakeoptions.sip new file mode 100644 index 0000000..35a774a --- /dev/null +++ b/sip/QtWebSockets/qwebsockethandshakeoptions.sip @@ -0,0 +1,46 @@ +// qwebsockethandshakeoptions.sip generated by MetaSIP +// +// This file is part of the QtWebSockets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_4_0 -) + +class QWebSocketHandshakeOptions +{ +%TypeHeaderCode +#include +%End + +public: + QWebSocketHandshakeOptions(); + QWebSocketHandshakeOptions(const QWebSocketHandshakeOptions &other); + ~QWebSocketHandshakeOptions(); + void swap(QWebSocketHandshakeOptions &other); + QStringList subprotocols() const; + void setSubprotocols(const QStringList &protocols); +}; + +%End +%If (Qt_6_4_0 -) +bool operator==(const QWebSocketHandshakeOptions &lhs, const QWebSocketHandshakeOptions &rhs); +%End +%If (Qt_6_4_0 -) +bool operator!=(const QWebSocketHandshakeOptions &lhs, const QWebSocketHandshakeOptions &rhs); +%End diff --git a/sip/QtWebSockets/qwebsocketprotocol.sip b/sip/QtWebSockets/qwebsocketprotocol.sip new file mode 100644 index 0000000..bf5bc10 --- /dev/null +++ b/sip/QtWebSockets/qwebsocketprotocol.sip @@ -0,0 +1,62 @@ +// qwebsocketprotocol.sip generated by MetaSIP +// +// This file is part of the QtWebSockets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +namespace QWebSocketProtocol +{ +%TypeHeaderCode +#include +%End + + enum Version + { + VersionUnknown, + Version0, + Version4, + Version5, + Version6, + Version7, + Version8, + Version13, + VersionLatest, + }; + + enum CloseCode + { + CloseCodeNormal, + CloseCodeGoingAway, + CloseCodeProtocolError, + CloseCodeDatatypeNotSupported, + CloseCodeReserved1004, + CloseCodeMissingStatusCode, + CloseCodeAbnormalDisconnection, + CloseCodeWrongDatatype, + CloseCodePolicyViolated, + CloseCodeTooMuchData, + CloseCodeMissingExtension, + CloseCodeBadOperation, + CloseCodeTlsHandshakeFailed, + }; +}; + +%End diff --git a/sip/QtWebSockets/qwebsocketserver.sip b/sip/QtWebSockets/qwebsocketserver.sip new file mode 100644 index 0000000..3f1a07e --- /dev/null +++ b/sip/QtWebSockets/qwebsocketserver.sip @@ -0,0 +1,99 @@ +// qwebsocketserver.sip generated by MetaSIP +// +// This file is part of the QtWebSockets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%If (Qt_6_2_0 -) + +class QWebSocketServer : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum SslMode + { +%If (PyQt_SSL) + SecureMode, +%End + NonSecureMode, + }; + + QWebSocketServer(const QString &serverName, QWebSocketServer::SslMode secureMode, QObject *parent /TransferThis/ = 0); + virtual ~QWebSocketServer(); + bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0); + void close(); + bool isListening() const; + void setMaxPendingConnections(int numConnections); + int maxPendingConnections() const; + quint16 serverPort() const; + QHostAddress serverAddress() const; + QWebSocketServer::SslMode secureMode() const; + bool setSocketDescriptor(qintptr socketDescriptor); + qintptr socketDescriptor() const; + bool hasPendingConnections() const; + virtual QWebSocket *nextPendingConnection() /Factory/; + QWebSocketProtocol::CloseCode error() const; + QString errorString() const; + void pauseAccepting(); + void resumeAccepting(); + void setServerName(const QString &serverName); + QString serverName() const; + void setProxy(const QNetworkProxy &networkProxy); + QNetworkProxy proxy() const; +%If (PyQt_SSL) + void setSslConfiguration(const QSslConfiguration &sslConfiguration); +%End +%If (PyQt_SSL) + QSslConfiguration sslConfiguration() const; +%End + QList supportedVersions() const; + QUrl serverUrl() const; + void handleConnection(QTcpSocket *socket) const; + +signals: + void acceptError(QAbstractSocket::SocketError socketError); + void serverError(QWebSocketProtocol::CloseCode closeCode); + void originAuthenticationRequired(QWebSocketCorsAuthenticator *pAuthenticator); + void newConnection(); +%If (PyQt_SSL) + void peerVerifyError(const QSslError &error); +%End +%If (PyQt_SSL) + void sslErrors(const QList &errors); +%End + void closed(); +%If (PyQt_SSL) + void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator); +%End + +public: + void setHandshakeTimeout(int msec); + int handshakeTimeoutMS() const; +%If (Qt_6_4_0 -) + void setSupportedSubprotocols(const QStringList &protocols); +%End +%If (Qt_6_4_0 -) + QStringList supportedSubprotocols() const; +%End +}; + +%End diff --git a/sip/QtWidgets/QtWidgetsmod.sip b/sip/QtWidgets/QtWidgetsmod.sip new file mode 100644 index 0000000..aba4d73 --- /dev/null +++ b/sip/QtWidgets/QtWidgetsmod.sip @@ -0,0 +1,161 @@ +// QtWidgetsmod.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtWidgets, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip +%Import QtGui/QtGuimod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qabstractbutton.sip +%Include qabstractitemdelegate.sip +%Include qabstractitemview.sip +%Include qabstractscrollarea.sip +%Include qabstractslider.sip +%Include qabstractspinbox.sip +%Include qapplication.sip +%Include qboxlayout.sip +%Include qbuttongroup.sip +%Include qcalendarwidget.sip +%Include qcheckbox.sip +%Include qcolordialog.sip +%Include qcolumnview.sip +%Include qcombobox.sip +%Include qcommandlinkbutton.sip +%Include qcommonstyle.sip +%Include qcompleter.sip +%Include qdatawidgetmapper.sip +%Include qdatetimeedit.sip +%Include qdial.sip +%Include qdialog.sip +%Include qdialogbuttonbox.sip +%Include qdockwidget.sip +%Include qdrawutil.sip +%Include qerrormessage.sip +%Include qfiledialog.sip +%Include qfileiconprovider.sip +%Include qfocusframe.sip +%Include qfontcombobox.sip +%Include qfontdialog.sip +%Include qformlayout.sip +%Include qframe.sip +%Include qgesture.sip +%Include qgesturerecognizer.sip +%Include qgraphicsanchorlayout.sip +%Include qgraphicseffect.sip +%Include qgraphicsgridlayout.sip +%Include qgraphicsitem.sip +%Include qgraphicslayout.sip +%Include qgraphicslayoutitem.sip +%Include qgraphicslinearlayout.sip +%Include qgraphicsproxywidget.sip +%Include qgraphicsscene.sip +%Include qgraphicssceneevent.sip +%Include qgraphicstransform.sip +%Include qgraphicsview.sip +%Include qgraphicswidget.sip +%Include qgridlayout.sip +%Include qgroupbox.sip +%Include qheaderview.sip +%Include qinputdialog.sip +%Include qitemdelegate.sip +%Include qitemeditorfactory.sip +%Include qkeysequenceedit.sip +%Include qlabel.sip +%Include qlayout.sip +%Include qlayoutitem.sip +%Include qlcdnumber.sip +%Include qlineedit.sip +%Include qlistview.sip +%Include qlistwidget.sip +%Include qmainwindow.sip +%Include qmdiarea.sip +%Include qmdisubwindow.sip +%Include qmenu.sip +%Include qmenubar.sip +%Include qmessagebox.sip +%Include qplaintextedit.sip +%Include qprogressbar.sip +%Include qprogressdialog.sip +%Include qproxystyle.sip +%Include qpushbutton.sip +%Include qradiobutton.sip +%Include qrubberband.sip +%Include qscrollarea.sip +%Include qscrollbar.sip +%Include qscroller.sip +%Include qscrollerproperties.sip +%Include qsizegrip.sip +%Include qsizepolicy.sip +%Include qslider.sip +%Include qspinbox.sip +%Include qsplashscreen.sip +%Include qsplitter.sip +%Include qstackedlayout.sip +%Include qstackedwidget.sip +%Include qstatusbar.sip +%Include qstyle.sip +%Include qstyleditemdelegate.sip +%Include qstylefactory.sip +%Include qstyleoption.sip +%Include qstylepainter.sip +%Include qsystemtrayicon.sip +%Include qtabbar.sip +%Include qtableview.sip +%Include qtablewidget.sip +%Include qtabwidget.sip +%Include qtextbrowser.sip +%Include qtextedit.sip +%Include qtoolbar.sip +%Include qtoolbox.sip +%Include qtoolbutton.sip +%Include qtooltip.sip +%Include qtreeview.sip +%Include qtreewidget.sip +%Include qtreewidgetitemiterator.sip +%Include qundoview.sip +%Include qwhatsthis.sip +%Include qwidget.sip +%Include qwidgetaction.sip +%Include qwizard.sip +%Include qfilesystemmodel.sip +%Include qpywidgets_qlist.sip diff --git a/sip/QtWidgets/qabstractbutton.sip b/sip/QtWidgets/qabstractbutton.sip new file mode 100644 index 0000000..9e25a91 --- /dev/null +++ b/sip/QtWidgets/qabstractbutton.sip @@ -0,0 +1,82 @@ +// qabstractbutton.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractButton : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAbstractButton(QWidget *parent /TransferThis/ = 0); + virtual ~QAbstractButton(); + void setAutoRepeatDelay(int); + int autoRepeatDelay() const; + void setAutoRepeatInterval(int); + int autoRepeatInterval() const; + void setText(const QString &text); + QString text() const; + void setIcon(const QIcon &icon); + QIcon icon() const; + QSize iconSize() const; + void setShortcut(const QKeySequence &key); + QKeySequence shortcut() const; + void setCheckable(bool); + bool isCheckable() const; + bool isChecked() const; + void setDown(bool); + bool isDown() const; + void setAutoRepeat(bool); + bool autoRepeat() const; + void setAutoExclusive(bool); + bool autoExclusive() const; + QButtonGroup *group() const; + +public slots: + void setIconSize(const QSize &size); + void animateClick(); + void click(); + void toggle(); + void setChecked(bool); + +signals: + void pressed(); + void released(); + void clicked(bool checked = false); + void toggled(bool checked); + +protected: + virtual void paintEvent(QPaintEvent *e) = 0; + virtual bool hitButton(const QPoint &pos) const; + virtual void checkStateSet(); + virtual void nextCheckState(); + virtual bool event(QEvent *e); + virtual void keyPressEvent(QKeyEvent *e); + virtual void keyReleaseEvent(QKeyEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void focusInEvent(QFocusEvent *e); + virtual void focusOutEvent(QFocusEvent *e); + virtual void changeEvent(QEvent *e); + virtual void timerEvent(QTimerEvent *e); +}; diff --git a/sip/QtWidgets/qabstractitemdelegate.sip b/sip/QtWidgets/qabstractitemdelegate.sip new file mode 100644 index 0000000..6ad4585 --- /dev/null +++ b/sip/QtWidgets/qabstractitemdelegate.sip @@ -0,0 +1,55 @@ +// qabstractitemdelegate.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractItemDelegate : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum EndEditHint + { + NoHint, + EditNextItem, + EditPreviousItem, + SubmitModelCache, + RevertModelCache, + }; + + explicit QAbstractItemDelegate(QObject *parent /TransferThis/ = 0); + virtual ~QAbstractItemDelegate(); + virtual void paint(QPainter *painter, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const = 0; + virtual QSize sizeHint(const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const = 0; + virtual QWidget *createEditor(QWidget *parent /TransferThis/, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const /Factory/; + virtual void setEditorData(QWidget *editor, const QModelIndex &index) const; + virtual void setModelData(QWidget *editor, QAbstractItemModel *model /KeepReference/, const QModelIndex &index) const; + virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const; + virtual void destroyEditor(QWidget *editor, const QModelIndex &index) const; + virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index); + virtual bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index); + +signals: + void commitData(QWidget *editor); + void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint = QAbstractItemDelegate::NoHint); + void sizeHintChanged(const QModelIndex &); +}; diff --git a/sip/QtWidgets/qabstractitemview.sip b/sip/QtWidgets/qabstractitemview.sip new file mode 100644 index 0000000..c6931a0 --- /dev/null +++ b/sip/QtWidgets/qabstractitemview.sip @@ -0,0 +1,282 @@ +// qabstractitemview.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractItemView : QAbstractScrollArea +{ +%TypeHeaderCode +#include +%End + +public: + enum DragDropMode + { + NoDragDrop, + DragOnly, + DropOnly, + DragDrop, + InternalMove, + }; + + enum EditTrigger /BaseType=Flag/ + { + NoEditTriggers, + CurrentChanged, + DoubleClicked, + SelectedClicked, + EditKeyPressed, + AnyKeyPressed, + AllEditTriggers, + }; + + typedef QFlags EditTriggers; + + enum ScrollHint + { + EnsureVisible, + PositionAtTop, + PositionAtBottom, + PositionAtCenter, + }; + + enum ScrollMode + { + ScrollPerItem, + ScrollPerPixel, + }; + + enum SelectionBehavior + { + SelectItems, + SelectRows, + SelectColumns, + }; + + enum SelectionMode + { + NoSelection, + SingleSelection, + MultiSelection, + ExtendedSelection, + ContiguousSelection, + }; + + explicit QAbstractItemView(QWidget *parent /TransferThis/ = 0); + virtual ~QAbstractItemView(); + virtual void setModel(QAbstractItemModel *model /KeepReference/); + QAbstractItemModel *model() const; + virtual void setSelectionModel(QItemSelectionModel *selectionModel /KeepReference/); + QItemSelectionModel *selectionModel() const; + void setItemDelegate(QAbstractItemDelegate *delegate /KeepReference/); + QAbstractItemDelegate *itemDelegate() const; + void setSelectionMode(QAbstractItemView::SelectionMode mode); + QAbstractItemView::SelectionMode selectionMode() const; + void setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior); + QAbstractItemView::SelectionBehavior selectionBehavior() const; + QModelIndex currentIndex() const; + QModelIndex rootIndex() const; + void setEditTriggers(QAbstractItemView::EditTriggers triggers); + QAbstractItemView::EditTriggers editTriggers() const; + void setAutoScroll(bool enable); + bool hasAutoScroll() const; + void setTabKeyNavigation(bool enable); + bool tabKeyNavigation() const; + void setDropIndicatorShown(bool enable); + bool showDropIndicator() const; + void setDragEnabled(bool enable); + bool dragEnabled() const; + void setAlternatingRowColors(bool enable); + bool alternatingRowColors() const; + void setIconSize(const QSize &size); + QSize iconSize() const; + void setTextElideMode(Qt::TextElideMode mode); + Qt::TextElideMode textElideMode() const; + virtual void keyboardSearch(const QString &search); + virtual QRect visualRect(const QModelIndex &index) const = 0; + virtual void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible) = 0; + virtual QModelIndex indexAt(const QPoint &p) const = 0; + QSize sizeHintForIndex(const QModelIndex &index) const; + virtual int sizeHintForRow(int row) const; + virtual int sizeHintForColumn(int column) const; + void openPersistentEditor(const QModelIndex &index); + void closePersistentEditor(const QModelIndex &index); + void setIndexWidget(const QModelIndex &index, QWidget *widget /Transfer/); +%MethodCode + // We have to break the association with any existing widget. + QWidget *w = sipCpp->indexWidget(*a0); + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QWidget); + + if (wo) + sipTransferTo(wo, 0); + } + + Py_BEGIN_ALLOW_THREADS + sipCpp->setIndexWidget(*a0, a1); + Py_END_ALLOW_THREADS +%End + + QWidget *indexWidget(const QModelIndex &index) const; + +public slots: + virtual void reset(); + virtual void setRootIndex(const QModelIndex &index); + virtual void selectAll(); + void edit(const QModelIndex &index); + void clearSelection(); + void setCurrentIndex(const QModelIndex &index); + void scrollToTop(); + void scrollToBottom(); + void update(); + void update(const QModelIndex &index); + +protected slots: + virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList &roles = QList()); + virtual void rowsInserted(const QModelIndex &parent, int start, int end); + virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + virtual void updateEditorData(); + virtual void updateEditorGeometries(); + virtual void updateGeometries(); + virtual void verticalScrollbarAction(int action); + virtual void horizontalScrollbarAction(int action); + virtual void verticalScrollbarValueChanged(int value); + virtual void horizontalScrollbarValueChanged(int value); + virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint); + virtual void commitData(QWidget *editor); + virtual void editorDestroyed(QObject *editor); + +signals: + void pressed(const QModelIndex &index); + void clicked(const QModelIndex &index); + void doubleClicked(const QModelIndex &index); + void activated(const QModelIndex &index); + void entered(const QModelIndex &index); + void viewportEntered(); + void iconSizeChanged(const QSize &size); + +protected: + enum CursorAction + { + MoveUp, + MoveDown, + MoveLeft, + MoveRight, + MoveHome, + MoveEnd, + MovePageUp, + MovePageDown, + MoveNext, + MovePrevious, + }; + + virtual QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers) = 0; + virtual int horizontalOffset() const = 0; + virtual int verticalOffset() const = 0; + virtual bool isIndexHidden(const QModelIndex &index) const = 0; + virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) = 0; + virtual QRegion visualRegionForSelection(const QItemSelection &selection) const = 0; + virtual QModelIndexList selectedIndexes() const; + virtual bool edit(const QModelIndex &index, QAbstractItemView::EditTrigger trigger, QEvent *event); + virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, const QEvent *event = 0) const; + virtual void startDrag(Qt::DropActions supportedActions); + + enum State + { + NoState, + DraggingState, + DragSelectingState, + EditingState, + ExpandingState, + CollapsingState, + AnimatingState, + }; + + QAbstractItemView::State state() const; + void setState(QAbstractItemView::State state); + void scheduleDelayedItemsLayout(); + void executeDelayedItemsLayout(); + void scrollDirtyRegion(int dx, int dy); + void setDirtyRegion(const QRegion ®ion); + QPoint dirtyRegionOffset() const; + virtual bool event(QEvent *event); + virtual bool viewportEvent(QEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void mouseDoubleClickEvent(QMouseEvent *e); + virtual void dragEnterEvent(QDragEnterEvent *e); + virtual void dragMoveEvent(QDragMoveEvent *e); + virtual void dragLeaveEvent(QDragLeaveEvent *e); + virtual void dropEvent(QDropEvent *e); + virtual void focusInEvent(QFocusEvent *e); + virtual void focusOutEvent(QFocusEvent *e); + virtual void keyPressEvent(QKeyEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual void timerEvent(QTimerEvent *e); + + enum DropIndicatorPosition + { + OnItem, + AboveItem, + BelowItem, + OnViewport, + }; + + QAbstractItemView::DropIndicatorPosition dropIndicatorPosition() const; + +public: + void setVerticalScrollMode(QAbstractItemView::ScrollMode mode); + QAbstractItemView::ScrollMode verticalScrollMode() const; + void setHorizontalScrollMode(QAbstractItemView::ScrollMode mode); + QAbstractItemView::ScrollMode horizontalScrollMode() const; + void setDragDropOverwriteMode(bool overwrite); + bool dragDropOverwriteMode() const; + void setDragDropMode(QAbstractItemView::DragDropMode behavior); + QAbstractItemView::DragDropMode dragDropMode() const; + void setItemDelegateForRow(int row, QAbstractItemDelegate *delegate /KeepReference/); + QAbstractItemDelegate *itemDelegateForRow(int row) const; + void setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate /KeepReference/); + QAbstractItemDelegate *itemDelegateForColumn(int column) const; + virtual QAbstractItemDelegate *itemDelegateForIndex(const QModelIndex &index) const; + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + void setAutoScrollMargin(int margin); + int autoScrollMargin() const; + +protected: + virtual bool focusNextPrevChild(bool next); + virtual void inputMethodEvent(QInputMethodEvent *event); + virtual QSize viewportSizeHint() const; + virtual bool eventFilter(QObject *object, QEvent *event); + +public: + void setDefaultDropAction(Qt::DropAction dropAction); + Qt::DropAction defaultDropAction() const; + void resetVerticalScrollMode(); + void resetHorizontalScrollMode(); + bool isPersistentEditorOpen(const QModelIndex &index) const; + +protected: + virtual void initViewItemOption(QStyleOptionViewItem *option) const; +}; diff --git a/sip/QtWidgets/qabstractscrollarea.sip b/sip/QtWidgets/qabstractscrollarea.sip new file mode 100644 index 0000000..99c02c2 --- /dev/null +++ b/sip/QtWidgets/qabstractscrollarea.sip @@ -0,0 +1,85 @@ +// qabstractscrollarea.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractScrollArea : QFrame +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAbstractScrollArea(QWidget *parent /TransferThis/ = 0); + virtual ~QAbstractScrollArea(); + Qt::ScrollBarPolicy verticalScrollBarPolicy() const; + void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy); + QScrollBar *verticalScrollBar() const /Transfer/; + Qt::ScrollBarPolicy horizontalScrollBarPolicy() const; + void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy); + QScrollBar *horizontalScrollBar() const /Transfer/; + QWidget *viewport() const /Transfer/; + QSize maximumViewportSize() const; + virtual QSize minimumSizeHint() const; + virtual QSize sizeHint() const; + +protected: + void setViewportMargins(int left, int top, int right, int bottom); + void setViewportMargins(const QMargins &margins); + QMargins viewportMargins() const; + virtual QSize viewportSizeHint() const; + virtual bool event(QEvent *); + virtual bool viewportEvent(QEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void wheelEvent(QWheelEvent *); + virtual void contextMenuEvent(QContextMenuEvent *); + virtual void dragEnterEvent(QDragEnterEvent *); + virtual void dragMoveEvent(QDragMoveEvent *); + virtual void dragLeaveEvent(QDragLeaveEvent *); + virtual void dropEvent(QDropEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual bool eventFilter(QObject *, QEvent *); + virtual void scrollContentsBy(int dx, int dy); + +public: + void setVerticalScrollBar(QScrollBar *scrollbar /Transfer/); + void setHorizontalScrollBar(QScrollBar *scrollbar /Transfer/); + QWidget *cornerWidget() const; + void setCornerWidget(QWidget *widget /Transfer/); + void addScrollBarWidget(QWidget *widget /Transfer/, Qt::Alignment alignment); + QWidgetList scrollBarWidgets(Qt::Alignment alignment) /Transfer/; + void setViewport(QWidget *widget /Transfer/); + virtual void setupViewport(QWidget *viewport); + + enum SizeAdjustPolicy + { + AdjustIgnored, + AdjustToContentsOnFirstShow, + AdjustToContents, + }; + + QAbstractScrollArea::SizeAdjustPolicy sizeAdjustPolicy() const; + void setSizeAdjustPolicy(QAbstractScrollArea::SizeAdjustPolicy policy); +}; diff --git a/sip/QtWidgets/qabstractslider.sip b/sip/QtWidgets/qabstractslider.sip new file mode 100644 index 0000000..22aa623 --- /dev/null +++ b/sip/QtWidgets/qabstractslider.sip @@ -0,0 +1,98 @@ +// qabstractslider.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractSlider : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAbstractSlider(QWidget *parent /TransferThis/ = 0); + virtual ~QAbstractSlider(); + Qt::Orientation orientation() const; + void setMinimum(int); + int minimum() const; + void setMaximum(int); + int maximum() const; + void setRange(int min, int max); + void setSingleStep(int); + int singleStep() const; + void setPageStep(int); + int pageStep() const; + void setTracking(bool enable); + bool hasTracking() const; + void setSliderDown(bool); + bool isSliderDown() const; + void setSliderPosition(int); + int sliderPosition() const; + void setInvertedAppearance(bool); + bool invertedAppearance() const; + void setInvertedControls(bool); + bool invertedControls() const; + + enum SliderAction + { + SliderNoAction, + SliderSingleStepAdd, + SliderSingleStepSub, + SliderPageStepAdd, + SliderPageStepSub, + SliderToMinimum, + SliderToMaximum, + SliderMove, + }; + + int value() const; + void triggerAction(QAbstractSlider::SliderAction action); + +public slots: + void setValue(int); + void setOrientation(Qt::Orientation); + +signals: + void valueChanged(int value); + void sliderPressed(); + void sliderMoved(int position); + void sliderReleased(); + void rangeChanged(int min, int max); + void actionTriggered(int action); + +protected: + void setRepeatAction(QAbstractSlider::SliderAction action, int thresholdTime = 500, int repeatTime = 50); + QAbstractSlider::SliderAction repeatAction() const; + + enum SliderChange + { + SliderRangeChange, + SliderOrientationChange, + SliderStepsChange, + SliderValueChange, + }; + + virtual void sliderChange(QAbstractSlider::SliderChange change); + virtual bool event(QEvent *e); + virtual void keyPressEvent(QKeyEvent *ev); + virtual void timerEvent(QTimerEvent *); + virtual void wheelEvent(QWheelEvent *e); + virtual void changeEvent(QEvent *e); +}; diff --git a/sip/QtWidgets/qabstractspinbox.sip b/sip/QtWidgets/qabstractspinbox.sip new file mode 100644 index 0000000..4fa0f43 --- /dev/null +++ b/sip/QtWidgets/qabstractspinbox.sip @@ -0,0 +1,124 @@ +// qabstractspinbox.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QAbstractSpinBox : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAbstractSpinBox(QWidget *parent /TransferThis/ = 0); + virtual ~QAbstractSpinBox(); + + enum StepEnabledFlag /BaseType=Flag/ + { + StepNone, + StepUpEnabled, + StepDownEnabled, + }; + + typedef QFlags StepEnabled; + + enum ButtonSymbols + { + UpDownArrows, + PlusMinus, + NoButtons, + }; + + QAbstractSpinBox::ButtonSymbols buttonSymbols() const; + void setButtonSymbols(QAbstractSpinBox::ButtonSymbols bs); + QString text() const; + QString specialValueText() const; + void setSpecialValueText(const QString &s); + bool wrapping() const; + void setWrapping(bool w); + void setReadOnly(bool r); + bool isReadOnly() const; + void setAlignment(Qt::Alignment flag); + Qt::Alignment alignment() const; + void setFrame(bool); + bool hasFrame() const; + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + void interpretText(); + virtual bool event(QEvent *event); + virtual QValidator::State validate(QString &input /In,Out/, int &pos /In,Out/) const; + virtual void fixup(QString &input /In,Out/) const; + virtual void stepBy(int steps); + +public slots: + void stepUp(); + void stepDown(); + void selectAll(); + virtual void clear(); + +signals: + void editingFinished(); + +protected: + virtual void resizeEvent(QResizeEvent *e); + virtual void keyPressEvent(QKeyEvent *e); + virtual void keyReleaseEvent(QKeyEvent *e); + virtual void wheelEvent(QWheelEvent *e); + virtual void focusInEvent(QFocusEvent *e); + virtual void focusOutEvent(QFocusEvent *e); + virtual void contextMenuEvent(QContextMenuEvent *e); + virtual void changeEvent(QEvent *e); + virtual void closeEvent(QCloseEvent *e); + virtual void hideEvent(QHideEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void timerEvent(QTimerEvent *e); + virtual void paintEvent(QPaintEvent *e); + virtual void showEvent(QShowEvent *e); + QLineEdit *lineEdit() const; + void setLineEdit(QLineEdit *e /Transfer/); + virtual QAbstractSpinBox::StepEnabled stepEnabled() const; + virtual void initStyleOption(QStyleOptionSpinBox *option) const; + +public: + enum CorrectionMode + { + CorrectToPreviousValue, + CorrectToNearestValue, + }; + + void setCorrectionMode(QAbstractSpinBox::CorrectionMode cm); + QAbstractSpinBox::CorrectionMode correctionMode() const; + bool hasAcceptableInput() const; + void setAccelerated(bool on); + bool isAccelerated() const; + void setKeyboardTracking(bool kt); + bool keyboardTracking() const; + virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; + void setGroupSeparatorShown(bool shown); + bool isGroupSeparatorShown() const; + + enum StepType + { + DefaultStepType, + AdaptiveDecimalStepType, + }; +}; diff --git a/sip/QtWidgets/qapplication.sip b/sip/QtWidgets/qapplication.sip new file mode 100644 index 0000000..81d9263 --- /dev/null +++ b/sip/QtWidgets/qapplication.sip @@ -0,0 +1,310 @@ +// qapplication.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +typedef QList QWidgetList; + +class QApplication : QGuiApplication +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + static struct class_graph { + const char *name; + sipTypeDef **type; + int yes, no; + } graph[] = { + {sipName_QWidget, &sipType_QWidget, 18, 1}, + {sipName_QAbstractItemDelegate, &sipType_QAbstractItemDelegate, 89, 2}, + {sipName_QApplication, &sipType_QApplication, -1, 3}, + {sipName_QLayout, &sipType_QLayout, 91, 4}, + {sipName_QButtonGroup, &sipType_QButtonGroup, -1, 5}, + {sipName_QStyle, &sipType_QStyle, 97, 6}, + {sipName_QCompleter, &sipType_QCompleter, -1, 7}, + {sipName_QDataWidgetMapper, &sipType_QDataWidgetMapper, -1, 8}, + {sipName_QGesture, &sipType_QGesture, 99, 9}, + {sipName_QGraphicsAnchor, &sipType_QGraphicsAnchor, -1, 10}, + {sipName_QGraphicsEffect, &sipType_QGraphicsEffect, 104, 11}, + {sipName_QGraphicsObject, &sipType_QGraphicsObject, 108, 12}, + {sipName_QGraphicsTransform, &sipType_QGraphicsTransform, 111, 13}, + {sipName_QGraphicsScene, &sipType_QGraphicsScene, -1, 14}, + {sipName_QPlainTextDocumentLayout, &sipType_QPlainTextDocumentLayout, -1, 15}, + {sipName_QScroller, &sipType_QScroller, -1, 16}, + {sipName_QSystemTrayIcon, &sipType_QSystemTrayIcon, -1, 17}, + {sipName_QWidgetAction, &sipType_QWidgetAction, -1, -1}, + {sipName_QAbstractButton, &sipType_QAbstractButton, 45, 19}, + {sipName_QFrame, &sipType_QFrame, 50, 20}, + {sipName_QAbstractSlider, &sipType_QAbstractSlider, 72, 21}, + {sipName_QAbstractSpinBox, &sipType_QAbstractSpinBox, 75, 22}, + {sipName_QCalendarWidget, &sipType_QCalendarWidget, -1, 23}, + {sipName_QDialog, &sipType_QDialog, 80, 24}, + {sipName_QComboBox, &sipType_QComboBox, 88, 25}, + {sipName_QDialogButtonBox, &sipType_QDialogButtonBox, -1, 26}, + {sipName_QDockWidget, &sipType_QDockWidget, -1, 27}, + {sipName_QFocusFrame, &sipType_QFocusFrame, -1, 28}, + {sipName_QGroupBox, &sipType_QGroupBox, -1, 29}, + {sipName_QKeySequenceEdit, &sipType_QKeySequenceEdit, -1, 30}, + {sipName_QLineEdit, &sipType_QLineEdit, -1, 31}, + {sipName_QMainWindow, &sipType_QMainWindow, -1, 32}, + {sipName_QMdiSubWindow, &sipType_QMdiSubWindow, -1, 33}, + {sipName_QMenu, &sipType_QMenu, -1, 34}, + {sipName_QMenuBar, &sipType_QMenuBar, -1, 35}, + {sipName_QProgressBar, &sipType_QProgressBar, -1, 36}, + {sipName_QRubberBand, &sipType_QRubberBand, -1, 37}, + {sipName_QSizeGrip, &sipType_QSizeGrip, -1, 38}, + {sipName_QSplashScreen, &sipType_QSplashScreen, -1, 39}, + {sipName_QSplitterHandle, &sipType_QSplitterHandle, -1, 40}, + {sipName_QStatusBar, &sipType_QStatusBar, -1, 41}, + {sipName_QTabBar, &sipType_QTabBar, -1, 42}, + {sipName_QTabWidget, &sipType_QTabWidget, -1, 43}, + {sipName_QToolBar, &sipType_QToolBar, -1, 44}, + {sipName_QWizardPage, &sipType_QWizardPage, -1, -1}, + {sipName_QCheckBox, &sipType_QCheckBox, -1, 46}, + {sipName_QPushButton, &sipType_QPushButton, 49, 47}, + {sipName_QRadioButton, &sipType_QRadioButton, -1, 48}, + {sipName_QToolButton, &sipType_QToolButton, -1, -1}, + {sipName_QCommandLinkButton, &sipType_QCommandLinkButton, -1, -1}, + {sipName_QAbstractScrollArea, &sipType_QAbstractScrollArea, 56, 51}, + {sipName_QLCDNumber, &sipType_QLCDNumber, -1, 52}, + {sipName_QLabel, &sipType_QLabel, -1, 53}, + {sipName_QSplitter, &sipType_QSplitter, -1, 54}, + {sipName_QStackedWidget, &sipType_QStackedWidget, -1, 55}, + {sipName_QToolBox, &sipType_QToolBox, -1, -1}, + {sipName_QAbstractItemView, &sipType_QAbstractItemView, 62, 57}, + {sipName_QGraphicsView, &sipType_QGraphicsView, -1, 58}, + {sipName_QMdiArea, &sipType_QMdiArea, -1, 59}, + {sipName_QPlainTextEdit, &sipType_QPlainTextEdit, -1, 60}, + {sipName_QScrollArea, &sipType_QScrollArea, -1, 61}, + {sipName_QTextEdit, &sipType_QTextEdit, 71, -1}, + {sipName_QColumnView, &sipType_QColumnView, -1, 63}, + {sipName_QHeaderView, &sipType_QHeaderView, -1, 64}, + {sipName_QListView, &sipType_QListView, 67, 65}, + {sipName_QTableView, &sipType_QTableView, 69, 66}, + {sipName_QTreeView, &sipType_QTreeView, 70, -1}, + {sipName_QListWidget, &sipType_QListWidget, -1, 68}, + {sipName_QUndoView, &sipType_QUndoView, -1, -1}, + {sipName_QTableWidget, &sipType_QTableWidget, -1, -1}, + {sipName_QTreeWidget, &sipType_QTreeWidget, -1, -1}, + {sipName_QTextBrowser, &sipType_QTextBrowser, -1, -1}, + {sipName_QDial, &sipType_QDial, -1, 73}, + {sipName_QScrollBar, &sipType_QScrollBar, -1, 74}, + {sipName_QSlider, &sipType_QSlider, -1, -1}, + {sipName_QDateTimeEdit, &sipType_QDateTimeEdit, 78, 76}, + {sipName_QDoubleSpinBox, &sipType_QDoubleSpinBox, -1, 77}, + {sipName_QSpinBox, &sipType_QSpinBox, -1, -1}, + {sipName_QDateEdit, &sipType_QDateEdit, -1, 79}, + {sipName_QTimeEdit, &sipType_QTimeEdit, -1, -1}, + {sipName_QColorDialog, &sipType_QColorDialog, -1, 81}, + {sipName_QErrorMessage, &sipType_QErrorMessage, -1, 82}, + {sipName_QFileDialog, &sipType_QFileDialog, -1, 83}, + {sipName_QFontDialog, &sipType_QFontDialog, -1, 84}, + {sipName_QInputDialog, &sipType_QInputDialog, -1, 85}, + {sipName_QMessageBox, &sipType_QMessageBox, -1, 86}, + {sipName_QProgressDialog, &sipType_QProgressDialog, -1, 87}, + {sipName_QWizard, &sipType_QWizard, -1, -1}, + {sipName_QFontComboBox, &sipType_QFontComboBox, -1, -1}, + {sipName_QItemDelegate, &sipType_QItemDelegate, -1, 90}, + {sipName_QStyledItemDelegate, &sipType_QStyledItemDelegate, -1, -1}, + {sipName_QBoxLayout, &sipType_QBoxLayout, 95, 92}, + {sipName_QFormLayout, &sipType_QFormLayout, -1, 93}, + {sipName_QGridLayout, &sipType_QGridLayout, -1, 94}, + {sipName_QStackedLayout, &sipType_QStackedLayout, -1, -1}, + {sipName_QHBoxLayout, &sipType_QHBoxLayout, -1, 96}, + {sipName_QVBoxLayout, &sipType_QVBoxLayout, -1, -1}, + {sipName_QCommonStyle, &sipType_QCommonStyle, 98, -1}, + {sipName_QProxyStyle, &sipType_QProxyStyle, -1, -1}, + {sipName_QPanGesture, &sipType_QPanGesture, -1, 100}, + {sipName_QPinchGesture, &sipType_QPinchGesture, -1, 101}, + {sipName_QSwipeGesture, &sipType_QSwipeGesture, -1, 102}, + {sipName_QTapAndHoldGesture, &sipType_QTapAndHoldGesture, -1, 103}, + {sipName_QTapGesture, &sipType_QTapGesture, -1, -1}, + {sipName_QGraphicsBlurEffect, &sipType_QGraphicsBlurEffect, -1, 105}, + {sipName_QGraphicsColorizeEffect, &sipType_QGraphicsColorizeEffect, -1, 106}, + {sipName_QGraphicsDropShadowEffect, &sipType_QGraphicsDropShadowEffect, -1, 107}, + {sipName_QGraphicsOpacityEffect, &sipType_QGraphicsOpacityEffect, -1, -1}, + {sipName_QGraphicsWidget, &sipType_QGraphicsWidget, 110, 109}, + {sipName_QGraphicsTextItem, &sipType_QGraphicsTextItem, -1, -1}, + {sipName_QGraphicsProxyWidget, &sipType_QGraphicsProxyWidget, -1, -1}, + {sipName_QGraphicsRotation, &sipType_QGraphicsRotation, -1, 112}, + {sipName_QGraphicsScale, &sipType_QGraphicsScale, -1, -1}, + }; + + int i = 0; + + sipType = NULL; + + do + { + struct class_graph *cg = &graph[i]; + + if (cg->name != NULL && sipCpp->inherits(cg->name)) + { + sipType = *cg->type; + i = cg->yes; + } + else + i = cg->no; + } + while (i >= 0); +%End + +public: + QApplication(SIP_PYLIST argv /TypeHint="List[str]"/) /PostHook=__pyQtQAppHook__/ [(int &argc, char **argv, int = QCoreApplication::ApplicationFlags)]; +%MethodCode + // The Python interface is a list of argument strings that is modified. + + int argc; + char **argv; + + // Convert the list. + if ((argv = pyqt6_qtwidgets_from_argv_list(a0, argc)) == NULL) + sipIsErr = 1; + else + { + // Create it now the arguments are right. + static int nargc; + nargc = argc; + + Py_BEGIN_ALLOW_THREADS + sipCpp = new sipQApplication(nargc, argv, QCoreApplication::ApplicationFlags); + Py_END_ALLOW_THREADS + + // Now modify the original list. + pyqt6_qtwidgets_update_argv_list(a0, argc, argv); + } +%End + + virtual ~QApplication() /ReleaseGIL/; +%MethodCode + pyqt6_qtwidgets_cleanup_qobjects(); +%End + + static QStyle *style(); + static void setStyle(QStyle * /Transfer/); + static QStyle *setStyle(const QString &); + static QPalette palette(); + static QPalette palette(const QWidget *); + static QPalette palette(const char *className); + static void setPalette(const QPalette &, const char *className = 0); + static QFont font(); + static QFont font(const QWidget *); + static QFont font(const char *className); + static void setFont(const QFont &, const char *className = 0); + static QWidgetList allWidgets(); + static QWidgetList topLevelWidgets(); + static QWidget *activePopupWidget(); + static QWidget *activeModalWidget(); + static QWidget *focusWidget(); + static QWidget *activeWindow(); + static void setActiveWindow(QWidget *act); + static QWidget *widgetAt(const QPoint &p); + static QWidget *widgetAt(int x, int y); + static QWidget *topLevelAt(const QPoint &p); + static QWidget *topLevelAt(int x, int y); + static void beep(); + static void alert(QWidget *widget, int msecs = 0) /ReleaseGIL/; + static void setCursorFlashTime(int); + static int cursorFlashTime(); + static void setDoubleClickInterval(int); + static int doubleClickInterval(); + static void setKeyboardInputInterval(int); + static int keyboardInputInterval(); + static void setWheelScrollLines(int); + static int wheelScrollLines(); + static void setStartDragTime(int ms); + static int startDragTime(); + static void setStartDragDistance(int l); + static int startDragDistance(); + static bool isEffectEnabled(Qt::UIEffect); + static void setEffectEnabled(Qt::UIEffect, bool enabled = true); + static int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; + virtual bool notify(QObject *, QEvent *) /ReleaseGIL/; + bool autoSipEnabled() const; + QString styleSheet() const; + +signals: + void focusChanged(QWidget *old, QWidget *now); + +public slots: + static void aboutQt(); + static void closeAllWindows(); + void setAutoSipEnabled(const bool enabled); + void setStyleSheet(const QString &sheet); + +protected: + virtual bool event(QEvent *); +}; + +%ModuleHeaderCode +// Imports from QtCore. +typedef void (*pyqt6_qtwidgets_cleanup_qobjects_t)(); +extern pyqt6_qtwidgets_cleanup_qobjects_t pyqt6_qtwidgets_cleanup_qobjects; + +typedef char **(*pyqt6_qtwidgets_from_argv_list_t)(PyObject *, int &); +extern pyqt6_qtwidgets_from_argv_list_t pyqt6_qtwidgets_from_argv_list; + +typedef sipErrorState (*pyqt6_qtwidgets_get_connection_parts_t)(PyObject *, QObject *, const char *, bool, QObject **, QByteArray &); +extern pyqt6_qtwidgets_get_connection_parts_t pyqt6_qtwidgets_get_connection_parts; + +typedef sipErrorState (*pyqt6_qtwidgets_get_signal_signature_t)(PyObject *, QObject *, QByteArray &); +extern pyqt6_qtwidgets_get_signal_signature_t pyqt6_qtwidgets_get_signal_signature; + +typedef void (*pyqt6_qtwidgets_update_argv_list_t)(PyObject *, int, char **); +extern pyqt6_qtwidgets_update_argv_list_t pyqt6_qtwidgets_update_argv_list; + +// This is needed for Qt v5.0.0. +#if defined(B0) +#undef B0 +#endif +%End + +%ModuleCode +#include "qpywidgets_api.h" + +// Imports from QtCore. +pyqt6_qtwidgets_cleanup_qobjects_t pyqt6_qtwidgets_cleanup_qobjects; +pyqt6_qtwidgets_from_argv_list_t pyqt6_qtwidgets_from_argv_list; +pyqt6_qtwidgets_get_connection_parts_t pyqt6_qtwidgets_get_connection_parts; +pyqt6_qtwidgets_get_signal_signature_t pyqt6_qtwidgets_get_signal_signature; +pyqt6_qtwidgets_update_argv_list_t pyqt6_qtwidgets_update_argv_list; +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtwidgets_cleanup_qobjects = (pyqt6_qtwidgets_cleanup_qobjects_t)sipImportSymbol("pyqt6_cleanup_qobjects"); +Q_ASSERT(pyqt6_qtwidgets_cleanup_qobjects); + +pyqt6_qtwidgets_from_argv_list = (pyqt6_qtwidgets_from_argv_list_t)sipImportSymbol("pyqt6_from_argv_list"); +Q_ASSERT(pyqt6_qtwidgets_from_argv_list); + +pyqt6_qtwidgets_get_connection_parts = (pyqt6_qtwidgets_get_connection_parts_t)sipImportSymbol("pyqt6_get_connection_parts"); +Q_ASSERT(pyqt6_qtwidgets_get_connection_parts); + +pyqt6_qtwidgets_get_signal_signature = (pyqt6_qtwidgets_get_signal_signature_t)sipImportSymbol("pyqt6_get_signal_signature"); +Q_ASSERT(pyqt6_qtwidgets_get_signal_signature); + +pyqt6_qtwidgets_update_argv_list = (pyqt6_qtwidgets_update_argv_list_t)sipImportSymbol("pyqt6_update_argv_list"); +Q_ASSERT(pyqt6_qtwidgets_update_argv_list); + +qpywidgets_post_init(); +%End diff --git a/sip/QtWidgets/qboxlayout.sip b/sip/QtWidgets/qboxlayout.sip new file mode 100644 index 0000000..aa55045 --- /dev/null +++ b/sip/QtWidgets/qboxlayout.sip @@ -0,0 +1,145 @@ +// qboxlayout.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QBoxLayout : QLayout +{ +%TypeHeaderCode +#include +%End + +public: + enum Direction + { + LeftToRight, + RightToLeft, + TopToBottom, + BottomToTop, + Down, + Up, + }; + + QBoxLayout(QBoxLayout::Direction direction, QWidget *parent /TransferThis/ = 0); + virtual ~QBoxLayout(); + QBoxLayout::Direction direction() const; + void setDirection(QBoxLayout::Direction); + void addSpacing(int size); + void addStretch(int stretch = 0); + void addWidget(QWidget * /GetWrapper/, int stretch = 0, Qt::Alignment alignment = Qt::Alignment()); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->addWidget(a0, a1, *a2); + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a0Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows addWidget(QWidget()). + sipTransferTo(a0Wrapper, sipSelf); + } +%End + + void addLayout(QLayout *layout /Transfer/, int stretch = 0); + void addStrut(int); + virtual void addItem(QLayoutItem * /Transfer/); + void insertSpacing(int index, int size); + void insertStretch(int index, int stretch = 0); + void insertWidget(int index, QWidget *widget /GetWrapper/, int stretch = 0, Qt::Alignment alignment = Qt::Alignment()); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->insertWidget(a0, a1, a2, *a3); + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a1Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows insertWidget(QWidget()). + sipTransferTo(a1Wrapper, sipSelf); + } +%End + + void insertLayout(int index, QLayout *layout /Transfer/, int stretch = 0); + bool setStretchFactor(QWidget *w, int stretch); + bool setStretchFactor(QLayout *l, int stretch); + virtual QSize sizeHint() const; + virtual QSize minimumSize() const; + virtual QSize maximumSize() const; + virtual bool hasHeightForWidth() const; + virtual int heightForWidth(int) const; + virtual int minimumHeightForWidth(int) const; + virtual Qt::Orientations expandingDirections() const; + virtual void invalidate(); + virtual QLayoutItem *itemAt(int) const; + virtual QLayoutItem *takeAt(int) /TransferBack/; + virtual int count() const; + virtual void setGeometry(const QRect &); + virtual int spacing() const; + virtual void setSpacing(int spacing); + void addSpacerItem(QSpacerItem *spacerItem /Transfer/); + void insertSpacerItem(int index, QSpacerItem *spacerItem /Transfer/); + void setStretch(int index, int stretch); + int stretch(int index) const; + void insertItem(int index, QLayoutItem * /Transfer/); +}; + +class QHBoxLayout : QBoxLayout +{ +%TypeHeaderCode +#include +%End + +public: + QHBoxLayout(); + explicit QHBoxLayout(QWidget *parent /TransferThis/); + virtual ~QHBoxLayout(); +}; + +class QVBoxLayout : QBoxLayout +{ +%TypeHeaderCode +#include +%End + +public: + QVBoxLayout(); + explicit QVBoxLayout(QWidget *parent /TransferThis/); + virtual ~QVBoxLayout(); +}; diff --git a/sip/QtWidgets/qbuttongroup.sip b/sip/QtWidgets/qbuttongroup.sip new file mode 100644 index 0000000..2bb3637 --- /dev/null +++ b/sip/QtWidgets/qbuttongroup.sip @@ -0,0 +1,52 @@ +// qbuttongroup.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QButtonGroup : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QButtonGroup(QObject *parent /TransferThis/ = 0); + virtual ~QButtonGroup(); + void setExclusive(bool); + bool exclusive() const; + void addButton(QAbstractButton *, int id = -1); + void removeButton(QAbstractButton *); + QList buttons() const; + QAbstractButton *button(int id) const; + QAbstractButton *checkedButton() const; + void setId(QAbstractButton *button, int id); + int id(QAbstractButton *button) const; + int checkedId() const; + +signals: + void buttonClicked(QAbstractButton *); + void buttonPressed(QAbstractButton *); + void buttonReleased(QAbstractButton *); + void buttonToggled(QAbstractButton *, bool); + void idClicked(int); + void idPressed(int); + void idReleased(int); + void idToggled(int, bool); +}; diff --git a/sip/QtWidgets/qcalendarwidget.sip b/sip/QtWidgets/qcalendarwidget.sip new file mode 100644 index 0000000..9110dc6 --- /dev/null +++ b/sip/QtWidgets/qcalendarwidget.sip @@ -0,0 +1,119 @@ +// qcalendarwidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCalendarWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + enum HorizontalHeaderFormat + { + NoHorizontalHeader, + SingleLetterDayNames, + ShortDayNames, + LongDayNames, + }; + + enum VerticalHeaderFormat + { + NoVerticalHeader, + ISOWeekNumbers, + }; + + enum SelectionMode + { + NoSelection, + SingleSelection, + }; + + explicit QCalendarWidget(QWidget *parent /TransferThis/ = 0); + virtual ~QCalendarWidget(); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + QDate selectedDate() const; + int yearShown() const; + int monthShown() const; + QDate minimumDate() const; + void setMinimumDate(QDate date); + QDate maximumDate() const; + void setMaximumDate(QDate date); + Qt::DayOfWeek firstDayOfWeek() const; + void setFirstDayOfWeek(Qt::DayOfWeek dayOfWeek); + bool isGridVisible() const; + void setGridVisible(bool show); + QCalendarWidget::SelectionMode selectionMode() const; + void setSelectionMode(QCalendarWidget::SelectionMode mode); + QCalendarWidget::HorizontalHeaderFormat horizontalHeaderFormat() const; + void setHorizontalHeaderFormat(QCalendarWidget::HorizontalHeaderFormat format); + QCalendarWidget::VerticalHeaderFormat verticalHeaderFormat() const; + void setVerticalHeaderFormat(QCalendarWidget::VerticalHeaderFormat format); + QTextCharFormat headerTextFormat() const; + void setHeaderTextFormat(const QTextCharFormat &format); + QTextCharFormat weekdayTextFormat(Qt::DayOfWeek dayOfWeek) const; + void setWeekdayTextFormat(Qt::DayOfWeek dayOfWeek, const QTextCharFormat &format); + QMap dateTextFormat() const; + QTextCharFormat dateTextFormat(QDate date) const; + void setDateTextFormat(QDate date, const QTextCharFormat &format); + +protected: + void updateCell(QDate date); + void updateCells(); + virtual bool event(QEvent *event); + virtual bool eventFilter(QObject *watched, QEvent *event); + virtual void mousePressEvent(QMouseEvent *event); + virtual void resizeEvent(QResizeEvent *event); + virtual void keyPressEvent(QKeyEvent *event); + virtual void paintCell(QPainter *painter, const QRect &rect, QDate date) const; + +public slots: + void setCurrentPage(int year, int month); + void setDateRange(QDate min, QDate max); + void setSelectedDate(QDate date); + void showNextMonth(); + void showNextYear(); + void showPreviousMonth(); + void showPreviousYear(); + void showSelectedDate(); + void showToday(); + +signals: + void activated(QDate date); + void clicked(QDate date); + void currentPageChanged(int year, int month); + void selectionChanged(); + +public: + bool isNavigationBarVisible() const; + bool isDateEditEnabled() const; + void setDateEditEnabled(bool enable); + int dateEditAcceptDelay() const; + void setDateEditAcceptDelay(int delay); + +public slots: + void setNavigationBarVisible(bool visible); + +public: + QCalendar calendar() const; + void setCalendar(QCalendar calendar); +}; diff --git a/sip/QtWidgets/qcheckbox.sip b/sip/QtWidgets/qcheckbox.sip new file mode 100644 index 0000000..686bfdf --- /dev/null +++ b/sip/QtWidgets/qcheckbox.sip @@ -0,0 +1,51 @@ +// qcheckbox.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCheckBox : QAbstractButton +{ +%TypeHeaderCode +#include +%End + +public: + explicit QCheckBox(QWidget *parent /TransferThis/ = 0); + QCheckBox(const QString &text, QWidget *parent /TransferThis/ = 0); + virtual ~QCheckBox(); + virtual QSize sizeHint() const; + void setTristate(bool on = true); + bool isTristate() const; + Qt::CheckState checkState() const; + void setCheckState(Qt::CheckState state); + virtual QSize minimumSizeHint() const; + +signals: + void stateChanged(int); + +protected: + virtual bool hitButton(const QPoint &pos) const; + virtual void checkStateSet(); + virtual void nextCheckState(); + virtual bool event(QEvent *e); + virtual void paintEvent(QPaintEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void initStyleOption(QStyleOptionButton *option) const; +}; diff --git a/sip/QtWidgets/qcolordialog.sip b/sip/QtWidgets/qcolordialog.sip new file mode 100644 index 0000000..e67b94f --- /dev/null +++ b/sip/QtWidgets/qcolordialog.sip @@ -0,0 +1,83 @@ +// qcolordialog.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QColorDialog : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + enum ColorDialogOption /BaseType=Flag/ + { + ShowAlphaChannel, + NoButtons, + DontUseNativeDialog, + }; + + typedef QFlags ColorDialogOptions; + explicit QColorDialog(QWidget *parent /TransferThis/ = 0); + QColorDialog(const QColor &initial, QWidget *parent /TransferThis/ = 0); + virtual ~QColorDialog(); + static QColor getColor(const QColor &initial = Qt::white, QWidget *parent = 0, const QString &title = QString(), QColorDialog::ColorDialogOptions options = QColorDialog::ColorDialogOptions()) /ReleaseGIL/; + static int customCount(); + static QColor customColor(int index); + static void setCustomColor(int index, QColor color); + static QColor standardColor(int index); + static void setStandardColor(int index, QColor color); + +public slots: + virtual void open(); + +signals: + void colorSelected(const QColor &color); + void currentColorChanged(const QColor &color); + +protected: + virtual void changeEvent(QEvent *e); + virtual void done(int result); + +public: + void setCurrentColor(const QColor &color); + QColor currentColor() const; + QColor selectedColor() const; + void setOption(QColorDialog::ColorDialogOption option, bool on = true); + bool testOption(QColorDialog::ColorDialogOption option) const; + void setOptions(QColorDialog::ColorDialogOptions options); + QColorDialog::ColorDialogOptions options() const; + void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipCpp->open(receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + + virtual void setVisible(bool visible); +}; diff --git a/sip/QtWidgets/qcolumnview.sip b/sip/QtWidgets/qcolumnview.sip new file mode 100644 index 0000000..8384db6 --- /dev/null +++ b/sip/QtWidgets/qcolumnview.sip @@ -0,0 +1,65 @@ +// qcolumnview.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QColumnView : QAbstractItemView +{ +%TypeHeaderCode +#include +%End + +public: + explicit QColumnView(QWidget *parent /TransferThis/ = 0); + virtual ~QColumnView(); + QList columnWidths() const; + QWidget *previewWidget() const; + bool resizeGripsVisible() const; + void setColumnWidths(const QList &list); + void setPreviewWidget(QWidget *widget /Transfer/); + void setResizeGripsVisible(bool visible); + virtual QModelIndex indexAt(const QPoint &point) const; + virtual void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible); + virtual QSize sizeHint() const; + virtual QRect visualRect(const QModelIndex &index) const; + virtual void setModel(QAbstractItemModel *model /KeepReference/); + virtual void setSelectionModel(QItemSelectionModel *selectionModel /KeepReference/); + virtual void setRootIndex(const QModelIndex &index); + virtual void selectAll(); + +signals: + void updatePreviewWidget(const QModelIndex &index); + +protected: + virtual QAbstractItemView *createColumn(const QModelIndex &rootIndex); + void initializeColumn(QAbstractItemView *column) const; + virtual bool isIndexHidden(const QModelIndex &index) const; + virtual QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + virtual void resizeEvent(QResizeEvent *event); + virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command); + virtual QRegion visualRegionForSelection(const QItemSelection &selection) const; + virtual int horizontalOffset() const; + virtual int verticalOffset() const; + virtual void scrollContentsBy(int dx, int dy); + virtual void rowsInserted(const QModelIndex &parent, int start, int end); + +protected slots: + virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); +}; diff --git a/sip/QtWidgets/qcombobox.sip b/sip/QtWidgets/qcombobox.sip new file mode 100644 index 0000000..c5c2429 --- /dev/null +++ b/sip/QtWidgets/qcombobox.sip @@ -0,0 +1,164 @@ +// qcombobox.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QComboBox : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QComboBox(QWidget *parent /TransferThis/ = 0); + virtual ~QComboBox(); + int maxVisibleItems() const; + void setMaxVisibleItems(int maxItems); + int count() const /__len__/; + void setMaxCount(int max); + int maxCount() const; + bool duplicatesEnabled() const; + void setDuplicatesEnabled(bool enable); + void setFrame(bool); + bool hasFrame() const; +%If (Qt_6_2_0 -) + int findText(const QString &text, Qt::MatchFlags flags = static_cast>(Qt::MatchExactly | Qt::MatchCaseSensitive)) const; +%End +%If (- Qt_6_2_0) + int findText(const QString &text, Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const; +%End +%If (Qt_6_2_0 -) + int findData(const QVariant &data, int role = Qt::UserRole, Qt::MatchFlags flags = static_cast>(Qt::MatchExactly | Qt::MatchCaseSensitive)) const; +%End +%If (- Qt_6_2_0) + int findData(const QVariant &data, int role = Qt::UserRole, Qt::MatchFlags flags = Qt::MatchExactly|Qt::MatchCaseSensitive) const; +%End + + enum InsertPolicy + { + NoInsert, + InsertAtTop, + InsertAtCurrent, + InsertAtBottom, + InsertAfterCurrent, + InsertBeforeCurrent, + InsertAlphabetically, + }; + + QComboBox::InsertPolicy insertPolicy() const; + void setInsertPolicy(QComboBox::InsertPolicy policy); + + enum SizeAdjustPolicy + { + AdjustToContents, + AdjustToContentsOnFirstShow, + AdjustToMinimumContentsLengthWithIcon, + }; + + QComboBox::SizeAdjustPolicy sizeAdjustPolicy() const; + void setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy policy); + int minimumContentsLength() const; + void setMinimumContentsLength(int characters); + QSize iconSize() const; + void setIconSize(const QSize &size); + bool isEditable() const; + void setEditable(bool editable); + void setLineEdit(QLineEdit *edit /Transfer/); + QLineEdit *lineEdit() const; + void setValidator(const QValidator *v /KeepReference/); + const QValidator *validator() const; + QAbstractItemDelegate *itemDelegate() const; + void setItemDelegate(QAbstractItemDelegate *delegate /KeepReference/); + QAbstractItemModel *model() const; + virtual void setModel(QAbstractItemModel *model /KeepReference/); + QModelIndex rootModelIndex() const; + void setRootModelIndex(const QModelIndex &index); + int modelColumn() const; + void setModelColumn(int visibleColumn); + int currentIndex() const; + void setCurrentIndex(int index); + QString currentText() const; + QString itemText(int index) const; + QIcon itemIcon(int index) const; + QVariant itemData(int index, int role = Qt::UserRole) const; + void addItems(const QStringList &texts); + void addItem(const QString &text, const QVariant &userData = QVariant()); + void addItem(const QIcon &icon, const QString &text, const QVariant &userData = QVariant()); + void insertItem(int index, const QString &text, const QVariant &userData = QVariant()); + void insertItem(int index, const QIcon &icon, const QString &text, const QVariant &userData = QVariant()); + void insertItems(int index, const QStringList &texts); + void removeItem(int index); + void setItemText(int index, const QString &text); + void setItemIcon(int index, const QIcon &icon); + void setItemData(int index, const QVariant &value, int role = Qt::UserRole); + QAbstractItemView *view() const; + void setView(QAbstractItemView *itemView /Transfer/); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + virtual void showPopup(); + virtual void hidePopup(); + virtual bool event(QEvent *event); + void setCompleter(QCompleter *c /KeepReference/); + QCompleter *completer() const; + void insertSeparator(int index); + +public slots: + void clear(); + void clearEditText(); + void setEditText(const QString &text); + void setCurrentText(const QString &text); + +signals: + void editTextChanged(const QString &); + void activated(int index); + void currentIndexChanged(int index); + void currentTextChanged(const QString &); + void highlighted(int index); + +protected: + virtual void initStyleOption(QStyleOptionComboBox *option) const; + virtual void focusInEvent(QFocusEvent *e); + virtual void focusOutEvent(QFocusEvent *e); + virtual void changeEvent(QEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual void paintEvent(QPaintEvent *e); + virtual void showEvent(QShowEvent *e); + virtual void hideEvent(QHideEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void keyPressEvent(QKeyEvent *e); + virtual void keyReleaseEvent(QKeyEvent *e); + virtual void wheelEvent(QWheelEvent *e); + virtual void contextMenuEvent(QContextMenuEvent *e); + virtual void inputMethodEvent(QInputMethodEvent *); + +public: + virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; + QVariant currentData(int role = Qt::UserRole) const; + QVariant inputMethodQuery(Qt::InputMethodQuery query, const QVariant &argument) const; + +signals: + void textActivated(const QString &); + void textHighlighted(const QString &); + +public: + void setPlaceholderText(const QString &placeholderText); + QString placeholderText() const; +}; diff --git a/sip/QtWidgets/qcommandlinkbutton.sip b/sip/QtWidgets/qcommandlinkbutton.sip new file mode 100644 index 0000000..f098ec3 --- /dev/null +++ b/sip/QtWidgets/qcommandlinkbutton.sip @@ -0,0 +1,46 @@ +// qcommandlinkbutton.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCommandLinkButton : QPushButton +{ +%TypeHeaderCode +#include +%End + +public: + explicit QCommandLinkButton(QWidget *parent /TransferThis/ = 0); + QCommandLinkButton(const QString &text, QWidget *parent /TransferThis/ = 0); + QCommandLinkButton(const QString &text, const QString &description, QWidget *parent /TransferThis/ = 0); + virtual ~QCommandLinkButton(); + QString description() const; + void setDescription(const QString &description); + virtual QSize sizeHint() const; + virtual int heightForWidth(int) const; + virtual QSize minimumSizeHint() const; +%If (Qt_6_1_0 -) + virtual void initStyleOption(QStyleOptionButton *option) const; +%End + +protected: + virtual bool event(QEvent *e); + virtual void paintEvent(QPaintEvent *); +}; diff --git a/sip/QtWidgets/qcommonstyle.sip b/sip/QtWidgets/qcommonstyle.sip new file mode 100644 index 0000000..85b247b --- /dev/null +++ b/sip/QtWidgets/qcommonstyle.sip @@ -0,0 +1,50 @@ +// qcommonstyle.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCommonStyle : QStyle +{ +%TypeHeaderCode +#include +%End + +public: + QCommonStyle(); + virtual ~QCommonStyle(); + virtual void polish(QWidget *widget); + virtual void unpolish(QWidget *widget); + virtual void polish(QApplication *app); + virtual void unpolish(QApplication *application); + virtual void polish(QPalette & /In,Out/); + virtual void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *widget = 0) const; + virtual void drawControl(QStyle::ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *widget = 0) const; + virtual QRect subElementRect(QStyle::SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const; + virtual void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget = 0) const; + virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget = 0) const; + virtual QRect subControlRect(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QStyle::SubControl sc, const QWidget *widget = 0) const; + virtual QSize sizeFromContents(QStyle::ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget = 0) const; + virtual int pixelMetric(QStyle::PixelMetric m, const QStyleOption *option = 0, const QWidget *widget = 0) const; + virtual int styleHint(QStyle::StyleHint sh, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const; + virtual QPixmap standardPixmap(QStyle::StandardPixmap sp, const QStyleOption *option = 0, const QWidget *widget = 0) const; + virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const; + virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option = 0, const QWidget *widget = 0) const; + virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const; +}; diff --git a/sip/QtWidgets/qcompleter.sip b/sip/QtWidgets/qcompleter.sip new file mode 100644 index 0000000..1fe545a --- /dev/null +++ b/sip/QtWidgets/qcompleter.sip @@ -0,0 +1,95 @@ +// qcompleter.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QCompleter : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum CompletionMode + { + PopupCompletion, + UnfilteredPopupCompletion, + InlineCompletion, + }; + + enum ModelSorting + { + UnsortedModel, + CaseSensitivelySortedModel, + CaseInsensitivelySortedModel, + }; + + QCompleter(QAbstractItemModel *model, QObject *parent /TransferThis/ = 0); + QCompleter(const QStringList &list, QObject *parent /TransferThis/ = 0); + QCompleter(QObject *parent /TransferThis/ = 0); + virtual ~QCompleter(); + void setWidget(QWidget *widget /Transfer/); + QWidget *widget() const; + void setModel(QAbstractItemModel *c /KeepReference/); + QAbstractItemModel *model() const; + void setCompletionMode(QCompleter::CompletionMode mode); + QCompleter::CompletionMode completionMode() const; + QAbstractItemView *popup() const; + void setPopup(QAbstractItemView *popup /Transfer/); + void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity); + Qt::CaseSensitivity caseSensitivity() const; + void setModelSorting(QCompleter::ModelSorting sorting); + QCompleter::ModelSorting modelSorting() const; + void setCompletionColumn(int column); + int completionColumn() const; + void setCompletionRole(int role); + int completionRole() const; + int completionCount() const; + bool setCurrentRow(int row); + int currentRow() const; + QModelIndex currentIndex() const; + QString currentCompletion() const; + QAbstractItemModel *completionModel() const; + QString completionPrefix() const; + virtual QString pathFromIndex(const QModelIndex &index) const; + virtual QStringList splitPath(const QString &path) const; + bool wrapAround() const; + +public slots: + void complete(const QRect &rect = QRect()); + void setCompletionPrefix(const QString &prefix); + void setWrapAround(bool wrap); + +protected: + virtual bool eventFilter(QObject *o, QEvent *e); + virtual bool event(QEvent *); + +signals: + void activated(const QString &text); + void activated(const QModelIndex &index); + void highlighted(const QString &text); + void highlighted(const QModelIndex &index); + +public: + int maxVisibleItems() const; + void setMaxVisibleItems(int maxItems); + void setFilterMode(Qt::MatchFlags filterMode); + Qt::MatchFlags filterMode() const; +}; diff --git a/sip/QtWidgets/qdatawidgetmapper.sip b/sip/QtWidgets/qdatawidgetmapper.sip new file mode 100644 index 0000000..96f85ee --- /dev/null +++ b/sip/QtWidgets/qdatawidgetmapper.sip @@ -0,0 +1,69 @@ +// qdatawidgetmapper.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDataWidgetMapper : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum SubmitPolicy + { + AutoSubmit, + ManualSubmit, + }; + + explicit QDataWidgetMapper(QObject *parent /TransferThis/ = 0); + virtual ~QDataWidgetMapper(); + void setModel(QAbstractItemModel *model /KeepReference/); + QAbstractItemModel *model() const; + void setItemDelegate(QAbstractItemDelegate *delegate /KeepReference/); + QAbstractItemDelegate *itemDelegate() const; + void setRootIndex(const QModelIndex &index); + QModelIndex rootIndex() const; + void setOrientation(Qt::Orientation aOrientation); + Qt::Orientation orientation() const; + void setSubmitPolicy(QDataWidgetMapper::SubmitPolicy policy); + QDataWidgetMapper::SubmitPolicy submitPolicy() const; + void addMapping(QWidget *widget, int section); + void addMapping(QWidget *widget, int section, const QByteArray &propertyName); + void removeMapping(QWidget *widget); + QByteArray mappedPropertyName(QWidget *widget) const; + int mappedSection(QWidget *widget) const; + QWidget *mappedWidgetAt(int section) const; + void clearMapping(); + int currentIndex() const; + +public slots: + void revert(); + virtual void setCurrentIndex(int index); + void setCurrentModelIndex(const QModelIndex &index); + bool submit(); + void toFirst(); + void toLast(); + void toNext(); + void toPrevious(); + +signals: + void currentIndexChanged(int index); +}; diff --git a/sip/QtWidgets/qdatetimeedit.sip b/sip/QtWidgets/qdatetimeedit.sip new file mode 100644 index 0000000..029d822 --- /dev/null +++ b/sip/QtWidgets/qdatetimeedit.sip @@ -0,0 +1,148 @@ +// qdatetimeedit.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDateTimeEdit : QAbstractSpinBox +{ +%TypeHeaderCode +#include +%End + +public: + enum Section /BaseType=Flag/ + { + NoSection, + AmPmSection, + MSecSection, + SecondSection, + MinuteSection, + HourSection, + DaySection, + MonthSection, + YearSection, + TimeSections_Mask, + DateSections_Mask, + }; + + typedef QFlags Sections; + explicit QDateTimeEdit(QWidget *parent /TransferThis/ = 0); + QDateTimeEdit(const QDateTime &datetime, QWidget *parent /TransferThis/ = 0); + QDateTimeEdit(QDate d, QWidget *parent /TransferThis/ = 0); + QDateTimeEdit(QTime t, QWidget *parent /TransferThis/ = 0); + virtual ~QDateTimeEdit(); + QDateTime dateTime() const; + QDate date() const; + QTime time() const; + QDate minimumDate() const; + void setMinimumDate(QDate min); + void clearMinimumDate(); + QDate maximumDate() const; + void setMaximumDate(QDate max); + void clearMaximumDate(); + void setDateRange(QDate min, QDate max); + QTime minimumTime() const; + void setMinimumTime(QTime min); + void clearMinimumTime(); + QTime maximumTime() const; + void setMaximumTime(QTime max); + void clearMaximumTime(); + void setTimeRange(QTime min, QTime max); + QDateTimeEdit::Sections displayedSections() const; + QDateTimeEdit::Section currentSection() const; + void setCurrentSection(QDateTimeEdit::Section section); + QString sectionText(QDateTimeEdit::Section s) const; + QString displayFormat() const; + void setDisplayFormat(const QString &format); + bool calendarPopup() const; + void setCalendarPopup(bool enable); + void setSelectedSection(QDateTimeEdit::Section section); + virtual QSize sizeHint() const; + virtual void clear(); + virtual void stepBy(int steps); + virtual bool event(QEvent *e); + QDateTimeEdit::Section sectionAt(int index) const; + int currentSectionIndex() const; + void setCurrentSectionIndex(int index); + int sectionCount() const; + +signals: + void dateTimeChanged(const QDateTime &date); + void timeChanged(QTime time); + void dateChanged(QDate date); + +public slots: + void setDateTime(const QDateTime &dateTime); + void setDate(QDate date); + void setTime(QTime time); + +protected: + virtual void initStyleOption(QStyleOptionSpinBox *option) const; + virtual void keyPressEvent(QKeyEvent *e); + virtual void wheelEvent(QWheelEvent *e); + virtual void focusInEvent(QFocusEvent *e); + virtual bool focusNextPrevChild(bool next); + virtual void mousePressEvent(QMouseEvent *event); + virtual void paintEvent(QPaintEvent *event); + virtual QValidator::State validate(QString &input /In,Out/, int &pos /In,Out/) const; + virtual void fixup(QString &input /In,Out/) const; + virtual QDateTime dateTimeFromText(const QString &text) const; + virtual QString textFromDateTime(const QDateTime &dt) const; + virtual QAbstractSpinBox::StepEnabled stepEnabled() const; + +public: + QDateTime minimumDateTime() const; + void clearMinimumDateTime(); + void setMinimumDateTime(const QDateTime &dt); + QDateTime maximumDateTime() const; + void clearMaximumDateTime(); + void setMaximumDateTime(const QDateTime &dt); + void setDateTimeRange(const QDateTime &min, const QDateTime &max); + QCalendarWidget *calendarWidget() const; + void setCalendarWidget(QCalendarWidget *calendarWidget /Transfer/); + Qt::TimeSpec timeSpec() const; + void setTimeSpec(Qt::TimeSpec spec); + QCalendar calendar() const; + void setCalendar(QCalendar calendar); +}; + +class QTimeEdit : QDateTimeEdit +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTimeEdit(QWidget *parent /TransferThis/ = 0); + QTimeEdit(QTime time, QWidget *parent /TransferThis/ = 0); + virtual ~QTimeEdit(); +}; + +class QDateEdit : QDateTimeEdit +{ +%TypeHeaderCode +#include +%End + +public: + explicit QDateEdit(QWidget *parent /TransferThis/ = 0); + QDateEdit(QDate date, QWidget *parent /TransferThis/ = 0); + virtual ~QDateEdit(); +}; diff --git a/sip/QtWidgets/qdial.sip b/sip/QtWidgets/qdial.sip new file mode 100644 index 0000000..04c781b --- /dev/null +++ b/sip/QtWidgets/qdial.sip @@ -0,0 +1,53 @@ +// qdial.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDial : QAbstractSlider +{ +%TypeHeaderCode +#include +%End + +public: + explicit QDial(QWidget *parent /TransferThis/ = 0); + virtual ~QDial(); + bool wrapping() const; + int notchSize() const; + void setNotchTarget(double target); + qreal notchTarget() const; + bool notchesVisible() const; + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + +public slots: + void setNotchesVisible(bool visible); + void setWrapping(bool on); + +protected: + virtual void initStyleOption(QStyleOptionSlider *option) const; + virtual bool event(QEvent *e); + virtual void resizeEvent(QResizeEvent *re); + virtual void paintEvent(QPaintEvent *pe); + virtual void mousePressEvent(QMouseEvent *me); + virtual void mouseReleaseEvent(QMouseEvent *me); + virtual void mouseMoveEvent(QMouseEvent *me); + virtual void sliderChange(QAbstractSlider::SliderChange change); +}; diff --git a/sip/QtWidgets/qdialog.sip b/sip/QtWidgets/qdialog.sip new file mode 100644 index 0000000..23fc049 --- /dev/null +++ b/sip/QtWidgets/qdialog.sip @@ -0,0 +1,80 @@ +// qdialog.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDialog : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QDialog(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QDialog(); + + enum DialogCode /BaseType=IntEnum/ + { + Rejected, + Accepted, + }; + + int result() const; + virtual void setVisible(bool visible); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + void setSizeGripEnabled(bool); + bool isSizeGripEnabled() const; + void setModal(bool modal); + void setResult(int r); + virtual int exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; +%MethodCode + // Transfer ownership back to Python (a modal dialog will probably have the + // main window as it's parent). This means the Qt dialog will be deleted when + // the Python wrapper is garbage collected. Although this is a little + // inconsistent, it saves having to code it explicitly to avoid the memory + // leak. + sipTransferBack(sipSelf); + + Py_BEGIN_ALLOW_THREADS + sipRes = sipSelfWasArg ? sipCpp->QDialog::exec() + : sipCpp->exec(); + Py_END_ALLOW_THREADS +%End + +public slots: + virtual void done(int); + virtual void accept(); + virtual void reject(); + virtual void open(); + +signals: + void accepted(); + void finished(int result); + void rejected(); + +protected: + virtual void keyPressEvent(QKeyEvent *); + virtual void closeEvent(QCloseEvent *); + virtual void showEvent(QShowEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void contextMenuEvent(QContextMenuEvent *); + virtual bool eventFilter(QObject *, QEvent *); +}; diff --git a/sip/QtWidgets/qdialogbuttonbox.sip b/sip/QtWidgets/qdialogbuttonbox.sip new file mode 100644 index 0000000..380ddd8 --- /dev/null +++ b/sip/QtWidgets/qdialogbuttonbox.sip @@ -0,0 +1,107 @@ +// qdialogbuttonbox.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDialogButtonBox : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + enum ButtonLayout + { + WinLayout, + MacLayout, + KdeLayout, + GnomeLayout, + AndroidLayout, + }; + + enum ButtonRole + { + InvalidRole, + AcceptRole, + RejectRole, + DestructiveRole, + ActionRole, + HelpRole, + YesRole, + NoRole, + ResetRole, + ApplyRole, + }; + + enum StandardButton /BaseType=Flag/ + { + NoButton, + Ok, + Save, + SaveAll, + Open, + Yes, + YesToAll, + No, + NoToAll, + Abort, + Retry, + Ignore, + Close, + Cancel, + Discard, + Help, + Apply, + Reset, + RestoreDefaults, + }; + + typedef QFlags StandardButtons; + QDialogButtonBox(QWidget *parent /TransferThis/ = 0); + QDialogButtonBox(Qt::Orientation orientation, QWidget *parent /TransferThis/ = 0); + QDialogButtonBox(QDialogButtonBox::StandardButtons buttons, QWidget *parent /TransferThis/ = 0); + QDialogButtonBox(QDialogButtonBox::StandardButtons buttons, Qt::Orientation orientation, QWidget *parent /TransferThis/ = 0); + virtual ~QDialogButtonBox(); + void setOrientation(Qt::Orientation orientation); + Qt::Orientation orientation() const; + void addButton(QAbstractButton *button /Transfer/, QDialogButtonBox::ButtonRole role); + QPushButton *addButton(const QString &text, QDialogButtonBox::ButtonRole role) /Transfer/; + QPushButton *addButton(QDialogButtonBox::StandardButton button) /Transfer/; + void removeButton(QAbstractButton *button /TransferBack/); + void clear(); + QList buttons() const; + QDialogButtonBox::ButtonRole buttonRole(QAbstractButton *button) const; + void setStandardButtons(QDialogButtonBox::StandardButtons buttons); + QDialogButtonBox::StandardButtons standardButtons() const; + QDialogButtonBox::StandardButton standardButton(QAbstractButton *button) const; + QPushButton *button(QDialogButtonBox::StandardButton which) const; + void setCenterButtons(bool center); + bool centerButtons() const; + +signals: + void accepted(); + void clicked(QAbstractButton *button); + void helpRequested(); + void rejected(); + +protected: + virtual void changeEvent(QEvent *event); + virtual bool event(QEvent *event); +}; diff --git a/sip/QtWidgets/qdockwidget.sip b/sip/QtWidgets/qdockwidget.sip new file mode 100644 index 0000000..328fcf6 --- /dev/null +++ b/sip/QtWidgets/qdockwidget.sip @@ -0,0 +1,70 @@ +// qdockwidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDockWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QDockWidget(const QString &title, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + QDockWidget(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QDockWidget(); + QWidget *widget() const; + void setWidget(QWidget *widget /Transfer/); + + enum DockWidgetFeature /BaseType=Flag/ + { + DockWidgetClosable, + DockWidgetMovable, + DockWidgetFloatable, + DockWidgetVerticalTitleBar, + NoDockWidgetFeatures, + }; + + typedef QFlags DockWidgetFeatures; + void setFeatures(QDockWidget::DockWidgetFeatures features); + QDockWidget::DockWidgetFeatures features() const; + void setFloating(bool floating); + bool isFloating() const; + void setAllowedAreas(Qt::DockWidgetAreas areas); + Qt::DockWidgetAreas allowedAreas() const; + bool isAreaAllowed(Qt::DockWidgetArea area) const; + QAction *toggleViewAction() const /Transfer/; + void setTitleBarWidget(QWidget *widget /Transfer/); + QWidget *titleBarWidget() const; + +signals: + void featuresChanged(QDockWidget::DockWidgetFeatures features); + void topLevelChanged(bool topLevel); + void allowedAreasChanged(Qt::DockWidgetAreas allowedAreas); + void dockLocationChanged(Qt::DockWidgetArea area); + void visibilityChanged(bool visible); + +protected: + virtual void initStyleOption(QStyleOptionDockWidget *option) const; + virtual void changeEvent(QEvent *event); + virtual void closeEvent(QCloseEvent *event); + virtual void paintEvent(QPaintEvent *event); + virtual bool event(QEvent *event); +}; diff --git a/sip/QtWidgets/qdrawutil.sip b/sip/QtWidgets/qdrawutil.sip new file mode 100644 index 0000000..37690c3 --- /dev/null +++ b/sip/QtWidgets/qdrawutil.sip @@ -0,0 +1,39 @@ +// qdrawutil.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%ModuleCode +#include +%End + +void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, const QPalette &pal, bool sunken = true, int lineWidth = 1, int midLineWidth = 0); +void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, const QPalette &pal, bool sunken = true, int lineWidth = 1, int midLineWidth = 0); +void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken = false, int lineWidth = 1, int midLineWidth = 0, const QBrush *fill = 0); +void qDrawShadeRect(QPainter *p, const QRect &r, const QPalette &pal, bool sunken = false, int lineWidth = 1, int midLineWidth = 0, const QBrush *fill = 0); +void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken = false, int lineWidth = 1, const QBrush *fill = 0); +void qDrawShadePanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken = false, int lineWidth = 1, const QBrush *fill = 0); +void qDrawWinButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken = false, const QBrush *fill = 0); +void qDrawWinButton(QPainter *p, const QRect &r, const QPalette &pal, bool sunken = false, const QBrush *fill = 0); +void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken = false, const QBrush *fill = 0); +void qDrawWinPanel(QPainter *p, const QRect &r, const QPalette &pal, bool sunken = false, const QBrush *fill = 0); +void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &, int lineWidth = 1, const QBrush *fill = 0); +void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &, int lineWidth = 1, const QBrush *fill = 0); +void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap); diff --git a/sip/QtWidgets/qerrormessage.sip b/sip/QtWidgets/qerrormessage.sip new file mode 100644 index 0000000..d8b929c --- /dev/null +++ b/sip/QtWidgets/qerrormessage.sip @@ -0,0 +1,41 @@ +// qerrormessage.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QErrorMessage : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + explicit QErrorMessage(QWidget *parent /TransferThis/ = 0); + virtual ~QErrorMessage(); + static QErrorMessage *qtHandler(); + +public slots: + void showMessage(const QString &message); + void showMessage(const QString &message, const QString &type); + +protected: + virtual void changeEvent(QEvent *e); + virtual void done(int); +}; diff --git a/sip/QtWidgets/qfiledialog.sip b/sip/QtWidgets/qfiledialog.sip new file mode 100644 index 0000000..ddc8ba6 --- /dev/null +++ b/sip/QtWidgets/qfiledialog.sip @@ -0,0 +1,311 @@ +// qfiledialog.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFileDialog : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + enum ViewMode + { + Detail, + List, + }; + + enum FileMode + { + AnyFile, + ExistingFile, + Directory, + ExistingFiles, + }; + + enum AcceptMode + { + AcceptOpen, + AcceptSave, + }; + + enum DialogLabel + { + LookIn, + FileName, + FileType, + Accept, + Reject, + }; + + enum Option /BaseType=Flag/ + { + ShowDirsOnly, + DontResolveSymlinks, + DontConfirmOverwrite, + DontUseNativeDialog, + ReadOnly, + HideNameFilterDetails, + DontUseCustomDirectoryIcons, + }; + + typedef QFlags Options; + QFileDialog(QWidget *parent /TransferThis/, Qt::WindowFlags f); + QFileDialog(QWidget *parent /TransferThis/ = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString()); + virtual ~QFileDialog(); + void setDirectory(const QString &directory); + void setDirectory(const QDir &adirectory); + QDir directory() const; + void selectFile(const QString &filename); + QStringList selectedFiles() const; + void setViewMode(QFileDialog::ViewMode mode); + QFileDialog::ViewMode viewMode() const; + void setFileMode(QFileDialog::FileMode mode); + QFileDialog::FileMode fileMode() const; + void setAcceptMode(QFileDialog::AcceptMode mode); + QFileDialog::AcceptMode acceptMode() const; + void setDefaultSuffix(const QString &suffix); + QString defaultSuffix() const; + void setHistory(const QStringList &paths); + QStringList history() const; + void setItemDelegate(QAbstractItemDelegate *delegate /KeepReference/); + QAbstractItemDelegate *itemDelegate() const; + void setIconProvider(QAbstractFileIconProvider *provider /KeepReference/); + QAbstractFileIconProvider *iconProvider() const; + void setLabelText(QFileDialog::DialogLabel label, const QString &text); + QString labelText(QFileDialog::DialogLabel label) const; + +signals: + void currentChanged(const QString &path); + void directoryEntered(const QString &directory); + void filesSelected(const QStringList &files); + void filterSelected(const QString &filter); + void fileSelected(const QString &file); + +public: + static QString getExistingDirectory(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly) /ReleaseGIL/; + static QUrl getExistingDirectoryUrl(QWidget *parent = 0, const QString &caption = QString(), const QUrl &directory = QUrl(), QFileDialog::Options options = QFileDialog::ShowDirsOnly, const QStringList &supportedSchemes = QStringList()) /ReleaseGIL/; + static SIP_PYTUPLE getOpenFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = QFileDialog::Options()) /TypeHint="Tuple[QString, QString]", ReleaseGIL/; +%MethodCode + QString *name; + QString *filter = new QString(*a4); + + Py_BEGIN_ALLOW_THREADS + + name = new QString(QFileDialog::getOpenFileName(a0, *a1, *a2, *a3, filter, *a5)); + + Py_END_ALLOW_THREADS + + PyObject *name_obj = sipConvertFromNewType(name, sipType_QString, NULL); + PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL); + + if (name_obj && filter_obj) + sipRes = PyTuple_Pack(2, name_obj, filter_obj); + + Py_XDECREF(name_obj); + Py_XDECREF(filter_obj); +%End + + static SIP_PYTUPLE getOpenFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = QFileDialog::Options()) /TypeHint="Tuple[QStringList, QString]", ReleaseGIL/; +%MethodCode + QStringList *names; + QString *filter = new QString(*a4); + + Py_BEGIN_ALLOW_THREADS + + names = new QStringList(QFileDialog::getOpenFileNames(a0, *a1, *a2, *a3, filter, *a5)); + + Py_END_ALLOW_THREADS + + PyObject *names_obj = sipConvertFromNewType(names, sipType_QStringList, NULL); + PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL); + + if (names_obj && filter_obj) + sipRes = PyTuple_Pack(2, names_obj, filter_obj); + + Py_XDECREF(names_obj); + Py_XDECREF(filter_obj); +%End + + static SIP_PYTUPLE getSaveFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = QFileDialog::Options()) /TypeHint="Tuple[QString, QString]", ReleaseGIL/; +%MethodCode + QString *name; + QString *filter = new QString(*a4); + + Py_BEGIN_ALLOW_THREADS + + name = new QString(QFileDialog::getSaveFileName(a0, *a1, *a2, *a3, filter, *a5)); + + Py_END_ALLOW_THREADS + + PyObject *name_obj = sipConvertFromNewType(name, sipType_QString, NULL); + PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL); + + if (name_obj && filter_obj) + sipRes = PyTuple_Pack(2, name_obj, filter_obj); + + Py_XDECREF(name_obj); + Py_XDECREF(filter_obj); +%End + +protected: + virtual void done(int result); + virtual void accept(); + virtual void changeEvent(QEvent *e); + +public: + void setSidebarUrls(const QList &urls); + QList sidebarUrls() const; + QByteArray saveState() const; + bool restoreState(const QByteArray &state); + void setProxyModel(QAbstractProxyModel *model /Transfer/); + QAbstractProxyModel *proxyModel() const; + void setNameFilter(const QString &filter); + void setNameFilters(const QStringList &filters); + QStringList nameFilters() const; + void selectNameFilter(const QString &filter); + QString selectedNameFilter() const; + QDir::Filters filter() const; + void setFilter(QDir::Filters filters); + void setOption(QFileDialog::Option option, bool on = true); + bool testOption(QFileDialog::Option option) const; + void setOptions(QFileDialog::Options options); + QFileDialog::Options options() const; + virtual void open(); + void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipCpp->open(receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + + virtual void setVisible(bool visible); + void setDirectoryUrl(const QUrl &directory); + QUrl directoryUrl() const; + void selectUrl(const QUrl &url); + QList selectedUrls() const; + void setMimeTypeFilters(const QStringList &filters); + QStringList mimeTypeFilters() const; + void selectMimeTypeFilter(const QString &filter); + +signals: + void urlSelected(const QUrl &url); + void urlsSelected(const QList &urls); + void currentUrlChanged(const QUrl &url); + void directoryUrlEntered(const QUrl &directory); + +public: + static SIP_PYTUPLE getOpenFileUrl(QWidget *parent = 0, const QString &caption = QString(), const QUrl &directory = QUrl(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = QFileDialog::Options(), const QStringList &supportedSchemes = QStringList()) /TypeHint="Tuple[QUrl, QString]", ReleaseGIL/; +%MethodCode + QUrl *url; + QString *filter = new QString(*a4); + + Py_BEGIN_ALLOW_THREADS + + url = new QUrl(QFileDialog::getOpenFileUrl(a0, *a1, *a2, *a3, filter, *a5, *a6)); + + Py_END_ALLOW_THREADS + + PyObject *url_obj = sipConvertFromNewType(url, sipType_QUrl, NULL); + PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL); + + if (url_obj && filter_obj) + sipRes = PyTuple_Pack(2, url_obj, filter_obj); + + Py_XDECREF(url_obj); + Py_XDECREF(filter_obj); +%End + + static SIP_PYTUPLE getOpenFileUrls(QWidget *parent = 0, const QString &caption = QString(), const QUrl &directory = QUrl(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = QFileDialog::Options(), const QStringList &supportedSchemes = QStringList()) /TypeHint="Tuple[List[QUrl], QString]", ReleaseGIL/; +%MethodCode + QList url_list; + QString *filter = new QString(*a4); + + Py_BEGIN_ALLOW_THREADS + + url_list = QFileDialog::getOpenFileUrls(a0, *a1, *a2, *a3, filter, *a5, *a6); + + Py_END_ALLOW_THREADS + + PyObject *url_list_obj = PyList_New(url_list.size()); + + if (url_list_obj) + { + for (int i = 0; i < url_list.size(); ++i) + { + QUrl *url = new QUrl(url_list.at(i)); + PyObject *url_obj = sipConvertFromNewType(url, sipType_QUrl, NULL); + + if (!url_obj) + { + delete url; + Py_DECREF(url_list_obj); + url_list_obj = 0; + break; + } + + PyList_SetItem(url_list_obj, i, url_obj); + } + } + + PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL); + + if (url_list_obj && filter_obj) + sipRes = PyTuple_Pack(2, url_list_obj, filter_obj); + + Py_XDECREF(url_list_obj); + Py_XDECREF(filter_obj); +%End + + static SIP_PYTUPLE getSaveFileUrl(QWidget *parent = 0, const QString &caption = QString(), const QUrl &directory = QUrl(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = QFileDialog::Options(), const QStringList &supportedSchemes = QStringList()) /TypeHint="Tuple[QUrl, QString]", ReleaseGIL/; +%MethodCode + QUrl *url; + QString *filter = new QString(*a4); + + Py_BEGIN_ALLOW_THREADS + + url = new QUrl(QFileDialog::getSaveFileUrl(a0, *a1, *a2, *a3, filter, *a5, *a6)); + + Py_END_ALLOW_THREADS + + PyObject *url_obj = sipConvertFromNewType(url, sipType_QUrl, NULL); + PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL); + + if (url_obj && filter_obj) + sipRes = PyTuple_Pack(2, url_obj, filter_obj); + + Py_XDECREF(url_obj); + Py_XDECREF(filter_obj); +%End + + void setSupportedSchemes(const QStringList &schemes); + QStringList supportedSchemes() const; + QString selectedMimeTypeFilter() const; + static void saveFileContent(const QByteArray &fileContent, const QString &fileNameHint = QString()) /ReleaseGIL/; +}; diff --git a/sip/QtWidgets/qfileiconprovider.sip b/sip/QtWidgets/qfileiconprovider.sip new file mode 100644 index 0000000..00925a7 --- /dev/null +++ b/sip/QtWidgets/qfileiconprovider.sip @@ -0,0 +1,34 @@ +// qfileiconprovider.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFileIconProvider : QAbstractFileIconProvider +{ +%TypeHeaderCode +#include +%End + +public: + QFileIconProvider(); + virtual ~QFileIconProvider(); + virtual QIcon icon(QAbstractFileIconProvider::IconType type) const; + virtual QIcon icon(const QFileInfo &info) const; +}; diff --git a/sip/QtWidgets/qfilesystemmodel.sip b/sip/QtWidgets/qfilesystemmodel.sip new file mode 100644 index 0000000..e9dd714 --- /dev/null +++ b/sip/QtWidgets/qfilesystemmodel.sip @@ -0,0 +1,21 @@ +// qfilesystemmodel.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + diff --git a/sip/QtWidgets/qfocusframe.sip b/sip/QtWidgets/qfocusframe.sip new file mode 100644 index 0000000..bc710f7 --- /dev/null +++ b/sip/QtWidgets/qfocusframe.sip @@ -0,0 +1,40 @@ +// qfocusframe.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFocusFrame : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QFocusFrame(QWidget *parent /TransferThis/ = 0); + virtual ~QFocusFrame(); + void setWidget(QWidget *widget); + QWidget *widget() const; + +protected: + virtual void initStyleOption(QStyleOption *option) const; + virtual bool eventFilter(QObject *, QEvent *); + virtual bool event(QEvent *e); + virtual void paintEvent(QPaintEvent *); +}; diff --git a/sip/QtWidgets/qfontcombobox.sip b/sip/QtWidgets/qfontcombobox.sip new file mode 100644 index 0000000..24719ed --- /dev/null +++ b/sip/QtWidgets/qfontcombobox.sip @@ -0,0 +1,91 @@ +// qfontcombobox.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFontComboBox : QComboBox +{ +%TypeHeaderCode +#include +%End + +public: + enum FontFilter /BaseType=Flag/ + { + AllFonts, + ScalableFonts, + NonScalableFonts, + MonospacedFonts, + ProportionalFonts, + }; + + typedef QFlags FontFilters; + QFontComboBox::FontFilters fontFilters() const; + explicit QFontComboBox(QWidget *parent /TransferThis/ = 0); + virtual ~QFontComboBox(); + void setWritingSystem(QFontDatabase::WritingSystem); + QFontDatabase::WritingSystem writingSystem() const; + void setFontFilters(QFontComboBox::FontFilters filters); + QFont currentFont() const; + virtual QSize sizeHint() const; + +public slots: + void setCurrentFont(const QFont &f); + +signals: + void currentFontChanged(const QFont &f); + +protected: + virtual bool event(QEvent *e); + +public: +%If (Qt_6_3_0 -) + void setSampleTextForSystem(QFontDatabase::WritingSystem writingSystem, const QString &sampleText); +%End +%If (Qt_6_3_0 -) + QString sampleTextForSystem(QFontDatabase::WritingSystem writingSystem) const; +%End +%If (Qt_6_3_0 -) + void setSampleTextForFont(const QString &fontFamily, const QString &sampleText); +%End +%If (Qt_6_3_0 -) + QString sampleTextForFont(const QString &fontFamily) const; +%End +%If (Qt_6_3_0 -) + void setDisplayFont(const QString &fontFamily, const QFont &font); +%End +%If (Qt_6_3_0 -) + SIP_PYOBJECT displayFont(const QString &fontFamily) const /TypeHint="Optional[QFont]"/; +%MethodCode + std::optional f = sipCpp->displayFont(*a0); + + if (f) + { + sipRes = sipConvertFromNewType(new QFont(f.value()), sipType_QFont, NULL); + } + else + { + sipRes = Py_None; + Py_INCREF(sipRes); + } +%End + +%End +}; diff --git a/sip/QtWidgets/qfontdialog.sip b/sip/QtWidgets/qfontdialog.sip new file mode 100644 index 0000000..e64c582 --- /dev/null +++ b/sip/QtWidgets/qfontdialog.sip @@ -0,0 +1,81 @@ +// qfontdialog.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFontDialog : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + enum FontDialogOption /BaseType=Flag/ + { + NoButtons, + DontUseNativeDialog, + ScalableFonts, + NonScalableFonts, + MonospacedFonts, + ProportionalFonts, + }; + + typedef QFlags FontDialogOptions; + explicit QFontDialog(QWidget *parent /TransferThis/ = 0); + QFontDialog(const QFont &initial, QWidget *parent /TransferThis/ = 0); + virtual ~QFontDialog(); + static QFont getFont(bool *ok, const QFont &initial, QWidget *parent = 0, const QString &caption = QString(), QFontDialog::FontDialogOptions options = QFontDialog::FontDialogOptions()) /ReleaseGIL/; + static QFont getFont(bool *ok, QWidget *parent = 0) /ReleaseGIL/; + +protected: + virtual void changeEvent(QEvent *e); + virtual void done(int result); + virtual bool eventFilter(QObject *object, QEvent *event); + +public: + void setCurrentFont(const QFont &font); + QFont currentFont() const; + QFont selectedFont() const; + void setOption(QFontDialog::FontDialogOption option, bool on = true); + bool testOption(QFontDialog::FontDialogOption option) const; + void setOptions(QFontDialog::FontDialogOptions options); + QFontDialog::FontDialogOptions options() const; + virtual void open(); + void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipCpp->open(receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + + virtual void setVisible(bool visible); + +signals: + void currentFontChanged(const QFont &font); + void fontSelected(const QFont &font); +}; diff --git a/sip/QtWidgets/qformlayout.sip b/sip/QtWidgets/qformlayout.sip new file mode 100644 index 0000000..f554de7 --- /dev/null +++ b/sip/QtWidgets/qformlayout.sip @@ -0,0 +1,135 @@ +// qformlayout.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFormLayout : QLayout +{ +%TypeHeaderCode +#include +%End + +public: + enum FieldGrowthPolicy + { + FieldsStayAtSizeHint, + ExpandingFieldsGrow, + AllNonFixedFieldsGrow, + }; + + enum RowWrapPolicy + { + DontWrapRows, + WrapLongRows, + WrapAllRows, + }; + + enum ItemRole + { + LabelRole, + FieldRole, + SpanningRole, + }; + + explicit QFormLayout(QWidget *parent /TransferThis/ = 0); + virtual ~QFormLayout(); + void setFieldGrowthPolicy(QFormLayout::FieldGrowthPolicy policy); + QFormLayout::FieldGrowthPolicy fieldGrowthPolicy() const; + void setRowWrapPolicy(QFormLayout::RowWrapPolicy policy); + QFormLayout::RowWrapPolicy rowWrapPolicy() const; + void setLabelAlignment(Qt::Alignment alignment); + Qt::Alignment labelAlignment() const; + void setFormAlignment(Qt::Alignment alignment); + Qt::Alignment formAlignment() const; + void setHorizontalSpacing(int spacing); + int horizontalSpacing() const; + void setVerticalSpacing(int spacing); + int verticalSpacing() const; + virtual int spacing() const; + virtual void setSpacing(int); + void addRow(QWidget *label /Transfer/, QWidget *field /Transfer/); + void addRow(QWidget *label /Transfer/, QLayout *field /Transfer/); + void addRow(const QString &labelText, QWidget *field /Transfer/); + void addRow(const QString &labelText, QLayout *field /Transfer/); + void addRow(QWidget *widget /Transfer/); + void addRow(QLayout *layout /Transfer/); + void insertRow(int row, QWidget *label /Transfer/, QWidget *field /Transfer/); + void insertRow(int row, QWidget *label /Transfer/, QLayout *field /Transfer/); + void insertRow(int row, const QString &labelText, QWidget *field /Transfer/); + void insertRow(int row, const QString &labelText, QLayout *field /Transfer/); + void insertRow(int row, QWidget *widget /Transfer/); + void insertRow(int row, QLayout *layout /Transfer/); + void setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item /Transfer/); + void setWidget(int row, QFormLayout::ItemRole role, QWidget *widget /Transfer/); + void setLayout(int row, QFormLayout::ItemRole role, QLayout *layout /Transfer/); + QLayoutItem *itemAt(int row, QFormLayout::ItemRole role) const; + void getItemPosition(int index, int *rowPtr, QFormLayout::ItemRole *rolePtr) const; + void getWidgetPosition(QWidget *widget, int *rowPtr, QFormLayout::ItemRole *rolePtr) const; + void getLayoutPosition(QLayout *layout, int *rowPtr, QFormLayout::ItemRole *rolePtr) const; + QWidget *labelForField(QWidget *field) const; + QWidget *labelForField(QLayout *field) const; + virtual void addItem(QLayoutItem *item /Transfer/); + virtual QLayoutItem *itemAt(int index) const; + virtual QLayoutItem *takeAt(int index) /TransferBack/; + virtual void setGeometry(const QRect &rect); + virtual QSize minimumSize() const; + virtual QSize sizeHint() const; + virtual void invalidate(); + virtual bool hasHeightForWidth() const; + virtual int heightForWidth(int width) const; + virtual Qt::Orientations expandingDirections() const; + virtual int count() const; + int rowCount() const; + + struct TakeRowResult + { +%TypeHeaderCode +#include +%End + + QLayoutItem *labelItem; + QLayoutItem *fieldItem; + }; + + void removeRow(int row); + void removeRow(QWidget *widget); + void removeRow(QLayout *layout); + QFormLayout::TakeRowResult takeRow(int row); + QFormLayout::TakeRowResult takeRow(QWidget *widget); + QFormLayout::TakeRowResult takeRow(QLayout *layout); +%If (Qt_6_4_0 -) + void setRowVisible(QLayout *layout, bool on); +%End +%If (Qt_6_4_0 -) + void setRowVisible(QWidget *widget, bool on); +%End +%If (Qt_6_4_0 -) + void setRowVisible(int row, bool on); +%End +%If (Qt_6_4_0 -) + bool isRowVisible(QLayout *layout) const; +%End +%If (Qt_6_4_0 -) + bool isRowVisible(QWidget *widget) const; +%End +%If (Qt_6_4_0 -) + bool isRowVisible(int row) const; +%End +}; diff --git a/sip/QtWidgets/qframe.sip b/sip/QtWidgets/qframe.sip new file mode 100644 index 0000000..ddc20c5 --- /dev/null +++ b/sip/QtWidgets/qframe.sip @@ -0,0 +1,77 @@ +// qframe.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QFrame : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + enum Shadow /BaseType=IntEnum/ + { + Plain, + Raised, + Sunken, + }; + + enum Shape /BaseType=IntEnum/ + { + NoFrame, + Box, + Panel, + WinPanel, + HLine, + VLine, + StyledPanel, + }; + + enum StyleMask + { + Shadow_Mask, + Shape_Mask, + }; + + QFrame(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QFrame(); + int frameStyle() const; + void setFrameStyle(int); + int frameWidth() const; + virtual QSize sizeHint() const; + QFrame::Shape frameShape() const; + void setFrameShape(QFrame::Shape); + QFrame::Shadow frameShadow() const; + void setFrameShadow(QFrame::Shadow); + int lineWidth() const; + void setLineWidth(int); + int midLineWidth() const; + void setMidLineWidth(int); + QRect frameRect() const; + void setFrameRect(const QRect &); + +protected: + virtual bool event(QEvent *e); + virtual void paintEvent(QPaintEvent *); + virtual void changeEvent(QEvent *); + void drawFrame(QPainter *); + virtual void initStyleOption(QStyleOptionFrame *option) const; +}; diff --git a/sip/QtWidgets/qgesture.sip b/sip/QtWidgets/qgesture.sip new file mode 100644 index 0000000..fb820de --- /dev/null +++ b/sip/QtWidgets/qgesture.sip @@ -0,0 +1,191 @@ +// qgesture.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGesture : QObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGesture(QObject *parent /TransferThis/ = 0); + virtual ~QGesture(); + Qt::GestureType gestureType() const; + Qt::GestureState state() const; + QPointF hotSpot() const; + void setHotSpot(const QPointF &value); + bool hasHotSpot() const; + void unsetHotSpot(); + + enum GestureCancelPolicy + { + CancelNone, + CancelAllInContext, + }; + + void setGestureCancelPolicy(QGesture::GestureCancelPolicy policy); + QGesture::GestureCancelPolicy gestureCancelPolicy() const; +}; + +class QPanGesture : QGesture +{ +%TypeHeaderCode +#include +%End + +public: + explicit QPanGesture(QObject *parent /TransferThis/ = 0); + virtual ~QPanGesture(); + QPointF lastOffset() const; + QPointF offset() const; + QPointF delta() const; + qreal acceleration() const; + void setLastOffset(const QPointF &value); + void setOffset(const QPointF &value); + void setAcceleration(qreal value); +}; + +class QPinchGesture : QGesture +{ +%TypeHeaderCode +#include +%End + +public: + enum ChangeFlag /BaseType=Flag/ + { + ScaleFactorChanged, + RotationAngleChanged, + CenterPointChanged, + }; + + typedef QFlags ChangeFlags; + explicit QPinchGesture(QObject *parent /TransferThis/ = 0); + virtual ~QPinchGesture(); + QPinchGesture::ChangeFlags totalChangeFlags() const; + void setTotalChangeFlags(QPinchGesture::ChangeFlags value); + QPinchGesture::ChangeFlags changeFlags() const; + void setChangeFlags(QPinchGesture::ChangeFlags value); + QPointF startCenterPoint() const; + QPointF lastCenterPoint() const; + QPointF centerPoint() const; + void setStartCenterPoint(const QPointF &value); + void setLastCenterPoint(const QPointF &value); + void setCenterPoint(const QPointF &value); + qreal totalScaleFactor() const; + qreal lastScaleFactor() const; + qreal scaleFactor() const; + void setTotalScaleFactor(qreal value); + void setLastScaleFactor(qreal value); + void setScaleFactor(qreal value); + qreal totalRotationAngle() const; + qreal lastRotationAngle() const; + qreal rotationAngle() const; + void setTotalRotationAngle(qreal value); + void setLastRotationAngle(qreal value); + void setRotationAngle(qreal value); +}; + +class QSwipeGesture : QGesture +{ +%TypeHeaderCode +#include +%End + +public: + enum SwipeDirection + { + NoDirection, + Left, + Right, + Up, + Down, + }; + + explicit QSwipeGesture(QObject *parent /TransferThis/ = 0); + virtual ~QSwipeGesture(); + QSwipeGesture::SwipeDirection horizontalDirection() const; + QSwipeGesture::SwipeDirection verticalDirection() const; + qreal swipeAngle() const; + void setSwipeAngle(qreal value); +}; + +class QTapGesture : QGesture +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTapGesture(QObject *parent /TransferThis/ = 0); + virtual ~QTapGesture(); + QPointF position() const; + void setPosition(const QPointF &pos); +}; + +class QTapAndHoldGesture : QGesture +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTapAndHoldGesture(QObject *parent /TransferThis/ = 0); + virtual ~QTapAndHoldGesture(); + QPointF position() const; + void setPosition(const QPointF &pos); + static void setTimeout(int msecs); + static int timeout(); +}; + +class QGestureEvent : QEvent +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + sipType = ((sipCpp->type() == QEvent::Gesture) ? sipType_QGestureEvent : 0); +%End + +public: + explicit QGestureEvent(const QList &gestures); + virtual ~QGestureEvent(); + QList gestures() const; + QGesture *gesture(Qt::GestureType type) const; + QList activeGestures() const; + QList canceledGestures() const; + void setAccepted(bool accepted); + bool isAccepted() const; + void accept(); + void ignore(); + void setAccepted(QGesture *, bool); + void accept(QGesture *); + void ignore(QGesture *); + bool isAccepted(QGesture *) const; + void setAccepted(Qt::GestureType, bool); + void accept(Qt::GestureType); + void ignore(Qt::GestureType); + bool isAccepted(Qt::GestureType) const; + QWidget *widget() const; + QPointF mapToGraphicsScene(const QPointF &gesturePoint) const; +}; diff --git a/sip/QtWidgets/qgesturerecognizer.sip b/sip/QtWidgets/qgesturerecognizer.sip new file mode 100644 index 0000000..60ed478 --- /dev/null +++ b/sip/QtWidgets/qgesturerecognizer.sip @@ -0,0 +1,48 @@ +// qgesturerecognizer.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGestureRecognizer /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + enum ResultFlag /BaseType=Flag/ + { + Ignore, + MayBeGesture, + TriggerGesture, + FinishGesture, + CancelGesture, + ConsumeEventHint, + }; + + typedef QFlags Result; + QGestureRecognizer(); + virtual ~QGestureRecognizer(); + virtual QGesture *create(QObject *target) /Factory/; + virtual QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) = 0; + virtual void reset(QGesture *state); + static Qt::GestureType registerRecognizer(QGestureRecognizer *recognizer /Transfer/); + static void unregisterRecognizer(Qt::GestureType type); +}; diff --git a/sip/QtWidgets/qgraphicsanchorlayout.sip b/sip/QtWidgets/qgraphicsanchorlayout.sip new file mode 100644 index 0000000..b72846b --- /dev/null +++ b/sip/QtWidgets/qgraphicsanchorlayout.sip @@ -0,0 +1,67 @@ +// qgraphicsanchorlayout.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsAnchor : QObject +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QGraphicsAnchor(); + void setSpacing(qreal spacing); + void unsetSpacing(); + qreal spacing() const; + void setSizePolicy(QSizePolicy::Policy policy); + QSizePolicy::Policy sizePolicy() const; + +private: + QGraphicsAnchor(QGraphicsAnchorLayout *parent); +}; + +class QGraphicsAnchorLayout : QGraphicsLayout +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsAnchorLayout(QGraphicsLayoutItem *parent /TransferThis/ = 0); + virtual ~QGraphicsAnchorLayout(); + QGraphicsAnchor *addAnchor(QGraphicsLayoutItem *firstItem /Transfer/, Qt::AnchorPoint firstEdge, QGraphicsLayoutItem *secondItem /Transfer/, Qt::AnchorPoint secondEdge); + QGraphicsAnchor *anchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge, QGraphicsLayoutItem *secondItem, Qt::AnchorPoint secondEdge); + void addCornerAnchors(QGraphicsLayoutItem *firstItem /Transfer/, Qt::Corner firstCorner, QGraphicsLayoutItem *secondItem /Transfer/, Qt::Corner secondCorner); + void addAnchors(QGraphicsLayoutItem *firstItem /Transfer/, QGraphicsLayoutItem *secondItem /Transfer/, Qt::Orientations orientations = Qt::Horizontal | Qt::Vertical); + void setHorizontalSpacing(qreal spacing); + void setVerticalSpacing(qreal spacing); + void setSpacing(qreal spacing); + qreal horizontalSpacing() const; + qreal verticalSpacing() const; + virtual void removeAt(int index); + virtual void setGeometry(const QRectF &rect); + virtual int count() const; + virtual QGraphicsLayoutItem *itemAt(int index) const; + virtual void invalidate(); + +protected: + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; +}; diff --git a/sip/QtWidgets/qgraphicseffect.sip b/sip/QtWidgets/qgraphicseffect.sip new file mode 100644 index 0000000..0aa67b6 --- /dev/null +++ b/sip/QtWidgets/qgraphicseffect.sip @@ -0,0 +1,183 @@ +// qgraphicseffect.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsEffect : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum ChangeFlag /BaseType=Flag/ + { + SourceAttached, + SourceDetached, + SourceBoundingRectChanged, + SourceInvalidated, + }; + + typedef QFlags ChangeFlags; + + enum PixmapPadMode + { + NoPad, + PadToTransparentBorder, + PadToEffectiveBoundingRect, + }; + + QGraphicsEffect(QObject *parent /TransferThis/ = 0); + virtual ~QGraphicsEffect(); + virtual QRectF boundingRectFor(const QRectF &sourceRect) const; + QRectF boundingRect() const; + bool isEnabled() const; + +public slots: + void setEnabled(bool enable); + void update(); + +signals: + void enabledChanged(bool enabled); + +protected: + virtual void draw(QPainter *painter) = 0; + virtual void sourceChanged(QGraphicsEffect::ChangeFlags flags); + void updateBoundingRect(); + bool sourceIsPixmap() const; + QRectF sourceBoundingRect(Qt::CoordinateSystem system = Qt::LogicalCoordinates) const; + void drawSource(QPainter *painter); + QPixmap sourcePixmap(Qt::CoordinateSystem system = Qt::LogicalCoordinates, QPoint *offset /Out/ = 0, QGraphicsEffect::PixmapPadMode mode = QGraphicsEffect::PadToEffectiveBoundingRect) const; +}; + +class QGraphicsColorizeEffect : QGraphicsEffect +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsColorizeEffect(QObject *parent /TransferThis/ = 0); + virtual ~QGraphicsColorizeEffect(); + QColor color() const; + qreal strength() const; + +public slots: + void setColor(const QColor &c); + void setStrength(qreal strength); + +signals: + void colorChanged(const QColor &color); + void strengthChanged(qreal strength); + +protected: + virtual void draw(QPainter *painter); +}; + +class QGraphicsBlurEffect : QGraphicsEffect +{ +%TypeHeaderCode +#include +%End + +public: + enum BlurHint /BaseType=Flag/ + { + PerformanceHint, + QualityHint, + AnimationHint, + }; + + typedef QFlags BlurHints; + QGraphicsBlurEffect(QObject *parent /TransferThis/ = 0); + virtual ~QGraphicsBlurEffect(); + virtual QRectF boundingRectFor(const QRectF &rect) const; + qreal blurRadius() const; + QGraphicsBlurEffect::BlurHints blurHints() const; + +public slots: + void setBlurRadius(qreal blurRadius); + void setBlurHints(QGraphicsBlurEffect::BlurHints hints); + +signals: + void blurRadiusChanged(qreal blurRadius); + void blurHintsChanged(QGraphicsBlurEffect::BlurHints hints /ScopesStripped=1/); + +protected: + virtual void draw(QPainter *painter); +}; + +class QGraphicsDropShadowEffect : QGraphicsEffect +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsDropShadowEffect(QObject *parent /TransferThis/ = 0); + virtual ~QGraphicsDropShadowEffect(); + virtual QRectF boundingRectFor(const QRectF &rect) const; + QPointF offset() const; + qreal xOffset() const; + qreal yOffset() const; + qreal blurRadius() const; + QColor color() const; + +public slots: + void setOffset(const QPointF &ofs); + void setOffset(qreal dx, qreal dy); + void setOffset(qreal d); + void setXOffset(qreal dx); + void setYOffset(qreal dy); + void setBlurRadius(qreal blurRadius); + void setColor(const QColor &color); + +signals: + void offsetChanged(const QPointF &offset); + void blurRadiusChanged(qreal blurRadius); + void colorChanged(const QColor &color); + +protected: + virtual void draw(QPainter *painter); +}; + +class QGraphicsOpacityEffect : QGraphicsEffect +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsOpacityEffect(QObject *parent /TransferThis/ = 0); + virtual ~QGraphicsOpacityEffect(); + qreal opacity() const; + QBrush opacityMask() const; + +public slots: + void setOpacity(qreal opacity); + void setOpacityMask(const QBrush &mask); + +signals: + void opacityChanged(qreal opacity); + void opacityMaskChanged(const QBrush &mask); + +protected: + virtual void draw(QPainter *painter); +}; diff --git a/sip/QtWidgets/qgraphicsgridlayout.sip b/sip/QtWidgets/qgraphicsgridlayout.sip new file mode 100644 index 0000000..e8b0532 --- /dev/null +++ b/sip/QtWidgets/qgraphicsgridlayout.sip @@ -0,0 +1,100 @@ +// qgraphicsgridlayout.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsGridLayout : QGraphicsLayout +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsGridLayout(QGraphicsLayoutItem *parent /TransferThis/ = 0); + virtual ~QGraphicsGridLayout(); + void addItem(QGraphicsLayoutItem *item /Transfer/, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment = Qt::Alignment()); + void addItem(QGraphicsLayoutItem *item /Transfer/, int row, int column, Qt::Alignment alignment = Qt::Alignment()); + void setHorizontalSpacing(qreal spacing); + qreal horizontalSpacing() const; + void setVerticalSpacing(qreal spacing); + qreal verticalSpacing() const; + void setSpacing(qreal spacing); + void setRowSpacing(int row, qreal spacing); + qreal rowSpacing(int row) const; + void setColumnSpacing(int column, qreal spacing); + qreal columnSpacing(int column) const; + void setRowStretchFactor(int row, int stretch); + int rowStretchFactor(int row) const; + void setColumnStretchFactor(int column, int stretch); + int columnStretchFactor(int column) const; + void setRowMinimumHeight(int row, qreal height); + qreal rowMinimumHeight(int row) const; + void setRowPreferredHeight(int row, qreal height); + qreal rowPreferredHeight(int row) const; + void setRowMaximumHeight(int row, qreal height); + qreal rowMaximumHeight(int row) const; + void setRowFixedHeight(int row, qreal height); + void setColumnMinimumWidth(int column, qreal width); + qreal columnMinimumWidth(int column) const; + void setColumnPreferredWidth(int column, qreal width); + qreal columnPreferredWidth(int column) const; + void setColumnMaximumWidth(int column, qreal width); + qreal columnMaximumWidth(int column) const; + void setColumnFixedWidth(int column, qreal width); + void setRowAlignment(int row, Qt::Alignment alignment); + Qt::Alignment rowAlignment(int row) const; + void setColumnAlignment(int column, Qt::Alignment alignment); + Qt::Alignment columnAlignment(int column) const; + void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment); + Qt::Alignment alignment(QGraphicsLayoutItem *item) const; + int rowCount() const; + int columnCount() const; + QGraphicsLayoutItem *itemAt(int row, int column) const; + virtual int count() const; + virtual QGraphicsLayoutItem *itemAt(int index) const; + virtual void removeAt(int index); +%MethodCode + // The ownership of any existing item must be passed back to Python. + QGraphicsLayoutItem *itm; + + if (a0 < sipCpp->count()) + itm = sipCpp->itemAt(a0); + else + itm = 0; + + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->QGraphicsGridLayout::removeAt(a0) + : sipCpp->removeAt(a0); + Py_END_ALLOW_THREADS + + if (itm) + { + PyObject *itmo = sipGetPyObject(itm, sipType_QGraphicsLayoutItem); + + if (itmo) + sipTransferBack(itmo); + } +%End + + virtual void invalidate(); + virtual void setGeometry(const QRectF &rect); + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + void removeItem(QGraphicsLayoutItem *item /TransferBack/); +}; diff --git a/sip/QtWidgets/qgraphicsitem.sip b/sip/QtWidgets/qgraphicsitem.sip new file mode 100644 index 0000000..27f93f5 --- /dev/null +++ b/sip/QtWidgets/qgraphicsitem.sip @@ -0,0 +1,698 @@ +// qgraphicsitem.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsItem /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + switch (sipCpp->type()) + { + case 2: + sipType = sipType_QGraphicsPathItem; + break; + + case 3: + sipType = sipType_QGraphicsRectItem; + break; + + case 4: + sipType = sipType_QGraphicsEllipseItem; + break; + + case 5: + sipType = sipType_QGraphicsPolygonItem; + break; + + case 6: + sipType = sipType_QGraphicsLineItem; + break; + + case 7: + sipType = sipType_QGraphicsPixmapItem; + break; + + case 8: + // Switch to the QObject convertor. + *sipCppRet = static_cast(sipCpp); + sipType = sipType_QObject; + break; + + case 9: + sipType = sipType_QGraphicsSimpleTextItem; + break; + + case 10: + sipType = sipType_QGraphicsItemGroup; + break; + + case 11: + // Switch to the QObject convertor. + *sipCppRet = static_cast(sipCpp); + sipType = sipType_QObject; + break; + + case 12: + // Switch to the QObject convertor. + *sipCppRet = static_cast(sipCpp); + sipType = sipType_QObject; + break; + + default: + sipType = 0; + } +%End + +public: + enum CacheMode + { + NoCache, + ItemCoordinateCache, + DeviceCoordinateCache, + }; + + enum GraphicsItemChange + { + ItemPositionChange, + ItemVisibleChange, + ItemEnabledChange, + ItemSelectedChange, + ItemParentChange, + ItemChildAddedChange, + ItemChildRemovedChange, + ItemTransformChange, + ItemPositionHasChanged, + ItemTransformHasChanged, + ItemSceneChange, + ItemVisibleHasChanged, + ItemEnabledHasChanged, + ItemSelectedHasChanged, + ItemParentHasChanged, + ItemSceneHasChanged, + ItemCursorChange, + ItemCursorHasChanged, + ItemToolTipChange, + ItemToolTipHasChanged, + ItemFlagsChange, + ItemFlagsHaveChanged, + ItemZValueChange, + ItemZValueHasChanged, + ItemOpacityChange, + ItemOpacityHasChanged, + ItemScenePositionHasChanged, + ItemRotationChange, + ItemRotationHasChanged, + ItemScaleChange, + ItemScaleHasChanged, + ItemTransformOriginPointChange, + ItemTransformOriginPointHasChanged, + }; + + enum GraphicsItemFlag /BaseType=Flag/ + { + ItemIsMovable, + ItemIsSelectable, + ItemIsFocusable, + ItemClipsToShape, + ItemClipsChildrenToShape, + ItemIgnoresTransformations, + ItemIgnoresParentOpacity, + ItemDoesntPropagateOpacityToChildren, + ItemStacksBehindParent, + ItemUsesExtendedStyleOption, + ItemHasNoContents, + ItemSendsGeometryChanges, + ItemAcceptsInputMethod, + ItemNegativeZStacksBehindParent, + ItemIsPanel, + ItemSendsScenePositionChanges, + ItemContainsChildrenInShape, + }; + + typedef QFlags GraphicsItemFlags; + static const int Type; + static const int UserType; + explicit QGraphicsItem(QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsItem(); + QGraphicsScene *scene() const; + QGraphicsItem *parentItem() const; + QGraphicsItem *topLevelItem() const; + void setParentItem(QGraphicsItem *parent /TransferThis/); + QGraphicsItemGroup *group() const; + void setGroup(QGraphicsItemGroup *group /KeepReference/); + QGraphicsItem::GraphicsItemFlags flags() const; + void setFlag(QGraphicsItem::GraphicsItemFlag flag, bool enabled = true); + void setFlags(QGraphicsItem::GraphicsItemFlags flags); + QString toolTip() const; + void setToolTip(const QString &toolTip); + QCursor cursor() const; + void setCursor(const QCursor &cursor); + bool hasCursor() const; + void unsetCursor(); + bool isVisible() const; + void setVisible(bool visible); + void hide(); + void show(); + bool isEnabled() const; + void setEnabled(bool enabled); + bool isSelected() const; + void setSelected(bool selected); + bool acceptDrops() const; + void setAcceptDrops(bool on); + Qt::MouseButtons acceptedMouseButtons() const; + void setAcceptedMouseButtons(Qt::MouseButtons buttons); + bool hasFocus() const; + void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason); + void clearFocus(); + QPointF pos() const; + qreal x() const; + qreal y() const; + QPointF scenePos() const; + void setPos(const QPointF &pos); + void moveBy(qreal dx, qreal dy); + void ensureVisible(const QRectF &rect = QRectF(), int xMargin = 50, int yMargin = 50); + virtual void advance(int phase); + qreal zValue() const; + void setZValue(qreal z); + virtual QRectF boundingRect() const = 0; + QRectF childrenBoundingRect() const; + QRectF sceneBoundingRect() const; + virtual QPainterPath shape() const; + virtual bool contains(const QPointF &point) const; + virtual bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + virtual bool collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList collidingItems(Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0; + void update(const QRectF &rect = QRectF()); + QPointF mapToItem(const QGraphicsItem *item, const QPointF &point) const; + QPointF mapToParent(const QPointF &point) const; + QPointF mapToScene(const QPointF &point) const; + QPolygonF mapToItem(const QGraphicsItem *item, const QRectF &rect) const; + QPolygonF mapToParent(const QRectF &rect) const; + QPolygonF mapToScene(const QRectF &rect) const; + QPolygonF mapToItem(const QGraphicsItem *item, const QPolygonF &polygon) const; + QPolygonF mapToParent(const QPolygonF &polygon) const; + QPolygonF mapToScene(const QPolygonF &polygon) const; + QPainterPath mapToItem(const QGraphicsItem *item, const QPainterPath &path) const; + QPainterPath mapToParent(const QPainterPath &path) const; + QPainterPath mapToScene(const QPainterPath &path) const; + QPointF mapFromItem(const QGraphicsItem *item, const QPointF &point) const; + QPointF mapFromParent(const QPointF &point) const; + QPointF mapFromScene(const QPointF &point) const; + QPolygonF mapFromItem(const QGraphicsItem *item, const QRectF &rect) const; + QPolygonF mapFromParent(const QRectF &rect) const; + QPolygonF mapFromScene(const QRectF &rect) const; + QPolygonF mapFromItem(const QGraphicsItem *item, const QPolygonF &polygon) const; + QPolygonF mapFromParent(const QPolygonF &polygon) const; + QPolygonF mapFromScene(const QPolygonF &polygon) const; + QPainterPath mapFromItem(const QGraphicsItem *item, const QPainterPath &path) const; + QPainterPath mapFromParent(const QPainterPath &path) const; + QPainterPath mapFromScene(const QPainterPath &path) const; + bool isAncestorOf(const QGraphicsItem *child) const; + QVariant data(int key) const; + void setData(int key, const QVariant &value); + virtual int type() const; + void installSceneEventFilter(QGraphicsItem *filterItem); + void removeSceneEventFilter(QGraphicsItem *filterItem); + +protected: + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); + virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dropEvent(QGraphicsSceneDragDropEvent *event); + virtual void focusInEvent(QFocusEvent *event); + virtual void focusOutEvent(QFocusEvent *event); + virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *event); + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value); + virtual void keyPressEvent(QKeyEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void prepareGeometryChange(); + virtual bool sceneEvent(QEvent *event); + virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); + virtual void wheelEvent(QGraphicsSceneWheelEvent *event); + +public: + void setPos(qreal ax, qreal ay); + void ensureVisible(qreal x, qreal y, qreal w, qreal h, int xMargin = 50, int yMargin = 50); + void update(qreal ax, qreal ay, qreal width, qreal height); + QPointF mapToItem(const QGraphicsItem *item, qreal ax, qreal ay) const; + QPointF mapToParent(qreal ax, qreal ay) const; + QPointF mapToScene(qreal ax, qreal ay) const; + QPointF mapFromItem(const QGraphicsItem *item, qreal ax, qreal ay) const; + QPointF mapFromParent(qreal ax, qreal ay) const; + QPointF mapFromScene(qreal ax, qreal ay) const; + QTransform transform() const; + QTransform sceneTransform() const; + QTransform deviceTransform(const QTransform &viewportTransform) const; + void setTransform(const QTransform &matrix, bool combine = false); + void resetTransform(); + bool isObscured(const QRectF &rect = QRectF()) const; + bool isObscured(qreal ax, qreal ay, qreal w, qreal h) const; + QPolygonF mapToItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const; + QPolygonF mapToParent(qreal ax, qreal ay, qreal w, qreal h) const; + QPolygonF mapToScene(qreal ax, qreal ay, qreal w, qreal h) const; + QPolygonF mapFromItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const; + QPolygonF mapFromParent(qreal ax, qreal ay, qreal w, qreal h) const; + QPolygonF mapFromScene(qreal ax, qreal ay, qreal w, qreal h) const; + QGraphicsWidget *parentWidget() const; + QGraphicsWidget *topLevelWidget() const; + QGraphicsWidget *window() const; + QList childItems() const; + bool isWidget() const; + bool isWindow() const; + QGraphicsItem::CacheMode cacheMode() const; + void setCacheMode(QGraphicsItem::CacheMode mode, const QSize &logicalCacheSize = QSize()); + bool isVisibleTo(const QGraphicsItem *parent) const; + bool acceptHoverEvents() const; + void setAcceptHoverEvents(bool enabled); + void grabMouse(); + void ungrabMouse(); + void grabKeyboard(); + void ungrabKeyboard(); + QRegion boundingRegion(const QTransform &itemToDeviceTransform) const; + qreal boundingRegionGranularity() const; + void setBoundingRegionGranularity(qreal granularity); + void scroll(qreal dx, qreal dy, const QRectF &rect = QRectF()); + QGraphicsItem *commonAncestorItem(const QGraphicsItem *other) const; + bool isUnderMouse() const; + qreal opacity() const; + qreal effectiveOpacity() const; + void setOpacity(qreal opacity); + QTransform itemTransform(const QGraphicsItem *other, bool *ok = 0) const; + bool isClipped() const; + QPainterPath clipPath() const; + QRectF mapRectToItem(const QGraphicsItem *item, const QRectF &rect) const; + QRectF mapRectToParent(const QRectF &rect) const; + QRectF mapRectToScene(const QRectF &rect) const; + QRectF mapRectFromItem(const QGraphicsItem *item, const QRectF &rect) const; + QRectF mapRectFromParent(const QRectF &rect) const; + QRectF mapRectFromScene(const QRectF &rect) const; + QRectF mapRectToItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const; + QRectF mapRectToParent(qreal ax, qreal ay, qreal w, qreal h) const; + QRectF mapRectToScene(qreal ax, qreal ay, qreal w, qreal h) const; + QRectF mapRectFromItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const; + QRectF mapRectFromParent(qreal ax, qreal ay, qreal w, qreal h) const; + QRectF mapRectFromScene(qreal ax, qreal ay, qreal w, qreal h) const; + + enum PanelModality + { + NonModal, + PanelModal, + SceneModal, + }; + + QGraphicsObject *parentObject() const; + QGraphicsItem *panel() const; + bool isPanel() const; + QGraphicsObject *toGraphicsObject(); + QGraphicsItem::PanelModality panelModality() const; + void setPanelModality(QGraphicsItem::PanelModality panelModality); + bool isBlockedByModalPanel(QGraphicsItem **blockingPanel /Out/ = 0) const; + QGraphicsEffect *graphicsEffect() const; + void setGraphicsEffect(QGraphicsEffect *effect /Transfer/); + bool acceptTouchEvents() const; + void setAcceptTouchEvents(bool enabled); + bool filtersChildEvents() const; + void setFiltersChildEvents(bool enabled); + bool isActive() const; + void setActive(bool active); + QGraphicsItem *focusProxy() const; + void setFocusProxy(QGraphicsItem *item /KeepReference/); + QGraphicsItem *focusItem() const; + void setX(qreal x); + void setY(qreal y); + void setRotation(qreal angle); + qreal rotation() const; + void setScale(qreal scale); + qreal scale() const; + QList transformations() const; + void setTransformations(const QList &transformations /KeepReference/); + QPointF transformOriginPoint() const; + void setTransformOriginPoint(const QPointF &origin); + void setTransformOriginPoint(qreal ax, qreal ay); + void stackBefore(const QGraphicsItem *sibling); + Qt::InputMethodHints inputMethodHints() const; + void setInputMethodHints(Qt::InputMethodHints hints); + +protected: + void updateMicroFocus(); + +private: + QGraphicsItem(const QGraphicsItem &); +}; + +class QAbstractGraphicsShapeItem : QGraphicsItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QAbstractGraphicsShapeItem(QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QAbstractGraphicsShapeItem(); + QPen pen() const; + void setPen(const QPen &pen); + QBrush brush() const; + void setBrush(const QBrush &brush); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; +}; + +class QGraphicsPathItem : QAbstractGraphicsShapeItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsPathItem(QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsPathItem(); + QPainterPath path() const; + void setPath(const QPainterPath &path); + virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; + virtual bool contains(const QPointF &point) const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual int type() const; +}; + +class QGraphicsRectItem : QAbstractGraphicsShapeItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsRectItem(QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsRectItem(); + QRectF rect() const; + void setRect(const QRectF &rect); + void setRect(qreal ax, qreal ay, qreal w, qreal h); + virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; + virtual bool contains(const QPointF &point) const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual int type() const; +}; + +class QGraphicsEllipseItem : QAbstractGraphicsShapeItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsEllipseItem(QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsEllipseItem(); + QRectF rect() const; + void setRect(const QRectF &rect); + void setRect(qreal ax, qreal ay, qreal w, qreal h); + int startAngle() const; + void setStartAngle(int angle); + int spanAngle() const; + void setSpanAngle(int angle); + virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; + virtual bool contains(const QPointF &point) const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual int type() const; +}; + +class QGraphicsPolygonItem : QAbstractGraphicsShapeItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsPolygonItem(QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsPolygonItem(); + QPolygonF polygon() const; + void setPolygon(const QPolygonF &polygon); + Qt::FillRule fillRule() const; + void setFillRule(Qt::FillRule rule); + virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; + virtual bool contains(const QPointF &point) const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual int type() const; +}; + +class QGraphicsLineItem : QGraphicsItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsLineItem(QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsLineItem(); + QPen pen() const; + void setPen(const QPen &pen); + QLineF line() const; + void setLine(const QLineF &line); + void setLine(qreal x1, qreal y1, qreal x2, qreal y2); + virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; + virtual bool contains(const QPointF &point) const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual int type() const; +}; + +class QGraphicsPixmapItem : QGraphicsItem +{ +%TypeHeaderCode +#include +%End + +public: + enum ShapeMode + { + MaskShape, + BoundingRectShape, + HeuristicMaskShape, + }; + + explicit QGraphicsPixmapItem(QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsPixmapItem(); + QPixmap pixmap() const; + void setPixmap(const QPixmap &pixmap); + Qt::TransformationMode transformationMode() const; + void setTransformationMode(Qt::TransformationMode mode); + QPointF offset() const; + void setOffset(const QPointF &offset); + void setOffset(qreal ax, qreal ay); + virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; + virtual bool contains(const QPointF &point) const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual int type() const; + QGraphicsPixmapItem::ShapeMode shapeMode() const; + void setShapeMode(QGraphicsPixmapItem::ShapeMode mode); +}; + +class QGraphicsSimpleTextItem : QAbstractGraphicsShapeItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsSimpleTextItem(QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsSimpleTextItem(); + void setText(const QString &text); + QString text() const; + void setFont(const QFont &font); + QFont font() const; + virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; + virtual bool contains(const QPointF &point) const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual int type() const; +}; + +class QGraphicsItemGroup : QGraphicsItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsItemGroup(QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsItemGroup(); + void addToGroup(QGraphicsItem *item /Transfer/); + void removeFromGroup(QGraphicsItem *item /GetWrapper/); +%MethodCode + sipCpp->removeFromGroup(a0); + + // The item will be passed to the group's parent if there is one. If not, + // transfer ownership back to Python. + if (sipCpp->parentItem()) + sipTransferTo(a0Wrapper, sipGetPyObject(sipCpp->parentItem(), sipType_QGraphicsItem)); + else + sipTransferBack(a0Wrapper); +%End + + virtual QRectF boundingRect() const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual int type() const; +}; + +class QGraphicsObject : QObject, QGraphicsItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsObject(QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsObject(); + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); + void ungrabGesture(Qt::GestureType type); + +signals: + void parentChanged(); + void opacityChanged(); + void visibleChanged(); + void enabledChanged(); + void xChanged(); + void yChanged(); + void zChanged(); + void rotationChanged(); + void scaleChanged(); + +protected slots: + void updateMicroFocus(); + +protected: + virtual bool event(QEvent *ev); +}; + +class QGraphicsTextItem : QGraphicsObject +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGraphicsTextItem(QGraphicsItem *parent /TransferThis/ = 0); + QGraphicsTextItem(const QString &text, QGraphicsItem *parent /TransferThis/ = 0); + virtual ~QGraphicsTextItem(); + QString toHtml() const; + void setHtml(const QString &html); + QString toPlainText() const; + void setPlainText(const QString &text); + QFont font() const; + void setFont(const QFont &font); + void setDefaultTextColor(const QColor &c); + QColor defaultTextColor() const; + virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; + virtual bool contains(const QPointF &point) const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + virtual bool isObscuredBy(const QGraphicsItem *item) const; + virtual QPainterPath opaqueArea() const; + virtual int type() const; + void setTextWidth(qreal width); + qreal textWidth() const; + void adjustSize(); + void setDocument(QTextDocument *document /KeepReference/); + QTextDocument *document() const; + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + void setTabChangesFocus(bool b); + bool tabChangesFocus() const; + void setOpenExternalLinks(bool open); + bool openExternalLinks() const; + void setTextCursor(const QTextCursor &cursor); + QTextCursor textCursor() const; + +signals: + void linkActivated(const QString &); + void linkHovered(const QString &); + +protected: + virtual bool sceneEvent(QEvent *event); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); + virtual void keyPressEvent(QKeyEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); + virtual void focusInEvent(QFocusEvent *event); + virtual void focusOutEvent(QFocusEvent *event); + virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dropEvent(QGraphicsSceneDragDropEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *event); + virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; +}; + +%ModuleCode +// These are needed by the %ConvertToSubClassCode. +#include +#include +%End diff --git a/sip/QtWidgets/qgraphicslayout.sip b/sip/QtWidgets/qgraphicslayout.sip new file mode 100644 index 0000000..0648937 --- /dev/null +++ b/sip/QtWidgets/qgraphicslayout.sip @@ -0,0 +1,45 @@ +// qgraphicslayout.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsLayout : QGraphicsLayoutItem +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsLayout(QGraphicsLayoutItem *parent /TransferThis/ = 0); + virtual ~QGraphicsLayout(); + void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom); + virtual void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; + void activate(); + bool isActivated() const; + virtual void invalidate(); + virtual void widgetEvent(QEvent *e); + virtual int count() const = 0 /__len__/; + virtual QGraphicsLayoutItem *itemAt(int i) const = 0; + virtual void removeAt(int index) = 0; + virtual void updateGeometry(); + +protected: + void addChildLayoutItem(QGraphicsLayoutItem *layoutItem /Transfer/); +}; diff --git a/sip/QtWidgets/qgraphicslayoutitem.sip b/sip/QtWidgets/qgraphicslayoutitem.sip new file mode 100644 index 0000000..556036a --- /dev/null +++ b/sip/QtWidgets/qgraphicslayoutitem.sip @@ -0,0 +1,76 @@ +// qgraphicslayoutitem.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsLayoutItem /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsLayoutItem(QGraphicsLayoutItem *parent /TransferThis/ = 0, bool isLayout = false); + virtual ~QGraphicsLayoutItem(); + void setSizePolicy(const QSizePolicy &policy); + void setSizePolicy(QSizePolicy::Policy hPolicy, QSizePolicy::Policy vPolicy, QSizePolicy::ControlType controlType = QSizePolicy::DefaultType); + QSizePolicy sizePolicy() const; + void setMinimumSize(const QSizeF &size); + QSizeF minimumSize() const; + void setMinimumWidth(qreal width); + void setMinimumHeight(qreal height); + void setPreferredSize(const QSizeF &size); + QSizeF preferredSize() const; + void setPreferredWidth(qreal width); + void setPreferredHeight(qreal height); + void setMaximumSize(const QSizeF &size); + QSizeF maximumSize() const; + void setMaximumWidth(qreal width); + void setMaximumHeight(qreal height); + virtual void setGeometry(const QRectF &rect); + QRectF geometry() const; + virtual void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; + QRectF contentsRect() const; + QSizeF effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + virtual void updateGeometry(); + QGraphicsLayoutItem *parentLayoutItem() const; + void setParentLayoutItem(QGraphicsLayoutItem *parent /TransferThis/); + bool isLayout() const; + void setMinimumSize(qreal aw, qreal ah); + void setPreferredSize(qreal aw, qreal ah); + void setMaximumSize(qreal aw, qreal ah); + qreal minimumWidth() const; + qreal minimumHeight() const; + qreal preferredWidth() const; + qreal preferredHeight() const; + qreal maximumWidth() const; + qreal maximumHeight() const; + QGraphicsItem *graphicsItem() const; + bool ownedByLayout() const; + virtual bool isEmpty() const; + +protected: + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const = 0; + void setGraphicsItem(QGraphicsItem *item); + void setOwnedByLayout(bool ownedByLayout); + +private: + QGraphicsLayoutItem(const QGraphicsLayoutItem &); +}; diff --git a/sip/QtWidgets/qgraphicslinearlayout.sip b/sip/QtWidgets/qgraphicslinearlayout.sip new file mode 100644 index 0000000..4f74eb6 --- /dev/null +++ b/sip/QtWidgets/qgraphicslinearlayout.sip @@ -0,0 +1,79 @@ +// qgraphicslinearlayout.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsLinearLayout : QGraphicsLayout +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsLinearLayout(QGraphicsLayoutItem *parent /TransferThis/ = 0); + QGraphicsLinearLayout(Qt::Orientation orientation, QGraphicsLayoutItem *parent /TransferThis/ = 0); + virtual ~QGraphicsLinearLayout(); + void setOrientation(Qt::Orientation orientation); + Qt::Orientation orientation() const; + void addItem(QGraphicsLayoutItem *item /Transfer/); + void addStretch(int stretch = 1); + void insertItem(int index, QGraphicsLayoutItem *item /Transfer/); + void insertStretch(int index, int stretch = 1); + void removeItem(QGraphicsLayoutItem *item /TransferBack/); + virtual void removeAt(int index); +%MethodCode + // The ownership of any existing item must be passed back to Python. + QGraphicsLayoutItem *itm; + + if (a0 < sipCpp->count()) + itm = sipCpp->itemAt(a0); + else + itm = 0; + + Py_BEGIN_ALLOW_THREADS + sipSelfWasArg ? sipCpp->QGraphicsLinearLayout::removeAt(a0) + : sipCpp->removeAt(a0); + Py_END_ALLOW_THREADS + + // The Qt documentation isn't quite correct as ownership isn't always passed + // back to the caller. + if (itm && !itm->parentLayoutItem()) + { + PyObject *itmo = sipGetPyObject(itm, sipType_QGraphicsLayoutItem); + + if (itmo) + sipTransferBack(itmo); + } +%End + + void setSpacing(qreal spacing); + qreal spacing() const; + void setItemSpacing(int index, qreal spacing); + qreal itemSpacing(int index) const; + void setStretchFactor(QGraphicsLayoutItem *item, int stretch); + int stretchFactor(QGraphicsLayoutItem *item) const; + void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment); + Qt::Alignment alignment(QGraphicsLayoutItem *item) const; + virtual void setGeometry(const QRectF &rect); + virtual int count() const; + virtual QGraphicsLayoutItem *itemAt(int index) const; + virtual void invalidate(); + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; +}; diff --git a/sip/QtWidgets/qgraphicsproxywidget.sip b/sip/QtWidgets/qgraphicsproxywidget.sip new file mode 100644 index 0000000..bbef339 --- /dev/null +++ b/sip/QtWidgets/qgraphicsproxywidget.sip @@ -0,0 +1,88 @@ +// qgraphicsproxywidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsProxyWidget : QGraphicsWidget +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsProxyWidget(QGraphicsItem *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QGraphicsProxyWidget(); + void setWidget(QWidget *widget /Transfer/); +%MethodCode + // The ownership of any existing widget must be passed back to Python. + QWidget *w = sipCpp->widget(); + + Py_BEGIN_ALLOW_THREADS + sipCpp->setWidget(a0); + Py_END_ALLOW_THREADS + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QWidget); + + if (wo) + sipTransferBack(wo); + } +%End + + QWidget *widget() const; + QRectF subWidgetRect(const QWidget *widget) const; + virtual void setGeometry(const QRectF &rect); + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + virtual int type() const; + QGraphicsProxyWidget *createProxyForChildWidget(QWidget *child) /Factory/; + +protected: + virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value); + virtual bool event(QEvent *event); + virtual bool eventFilter(QObject *object, QEvent *event); + virtual void showEvent(QShowEvent *event); + virtual void hideEvent(QHideEvent *event); + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); + virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual void grabMouseEvent(QEvent *event); + virtual void ungrabMouseEvent(QEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + virtual void wheelEvent(QGraphicsSceneWheelEvent *event); + virtual void keyPressEvent(QKeyEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); + virtual void focusInEvent(QFocusEvent *event); + virtual void focusOutEvent(QFocusEvent *event); + virtual bool focusNextPrevChild(bool next); + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + virtual void resizeEvent(QGraphicsSceneResizeEvent *event); + virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dropEvent(QGraphicsSceneDragDropEvent *event); + QGraphicsProxyWidget *newProxyWidget(const QWidget *) /Factory/; + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + virtual void inputMethodEvent(QInputMethodEvent *event); +}; diff --git a/sip/QtWidgets/qgraphicsscene.sip b/sip/QtWidgets/qgraphicsscene.sip new file mode 100644 index 0000000..133f5b4 --- /dev/null +++ b/sip/QtWidgets/qgraphicsscene.sip @@ -0,0 +1,167 @@ +// qgraphicsscene.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsScene : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum ItemIndexMethod + { + BspTreeIndex, + NoIndex, + }; + + QGraphicsScene(QObject *parent /TransferThis/ = 0); + QGraphicsScene(const QRectF &sceneRect, QObject *parent /TransferThis/ = 0); + QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent /TransferThis/ = 0); + virtual ~QGraphicsScene(); + QRectF sceneRect() const; + qreal width() const; + qreal height() const; + void setSceneRect(const QRectF &rect); + void setSceneRect(qreal x, qreal y, qreal w, qreal h); + void render(QPainter *painter, const QRectF &target = QRectF(), const QRectF &source = QRectF(), Qt::AspectRatioMode mode = Qt::KeepAspectRatio); + QGraphicsScene::ItemIndexMethod itemIndexMethod() const; + void setItemIndexMethod(QGraphicsScene::ItemIndexMethod method); + QRectF itemsBoundingRect() const; + QList items(Qt::SortOrder order = Qt::DescendingOrder) const; + QList items(const QPointF &pos, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; + QList items(const QRectF &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; + QList items(const QPolygonF &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; + QList items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, Qt::SortOrder order = Qt::DescendingOrder, const QTransform &deviceTransform = QTransform()) const; + QList items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform = QTransform()) const; + QList collidingItems(const QGraphicsItem *item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList selectedItems() const; + void setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform); + void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionOperation selectionOperation = Qt::ReplaceSelection, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape, const QTransform &deviceTransform = QTransform()); + void clearSelection(); + QGraphicsItemGroup *createItemGroup(const QList &items /Transfer/); + void destroyItemGroup(QGraphicsItemGroup *group /Transfer/); + void addItem(QGraphicsItem *item /Transfer/); + QGraphicsEllipseItem *addEllipse(const QRectF &rect, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsEllipseItem *addEllipse(qreal x, qreal y, qreal w, qreal h, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsLineItem *addLine(const QLineF &line, const QPen &pen = QPen()); + QGraphicsLineItem *addLine(qreal x1, qreal y1, qreal x2, qreal y2, const QPen &pen = QPen()); + QGraphicsPathItem *addPath(const QPainterPath &path, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsPixmapItem *addPixmap(const QPixmap &pixmap); + QGraphicsPolygonItem *addPolygon(const QPolygonF &polygon, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsRectItem *addRect(const QRectF &rect, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsRectItem *addRect(qreal x, qreal y, qreal w, qreal h, const QPen &pen = QPen(), const QBrush &brush = QBrush()); + QGraphicsSimpleTextItem *addSimpleText(const QString &text, const QFont &font = QFont()); + QGraphicsTextItem *addText(const QString &text, const QFont &font = QFont()); + void removeItem(QGraphicsItem *item /TransferBack/); + QGraphicsItem *focusItem() const; + void setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason = Qt::OtherFocusReason); + bool hasFocus() const; + void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason); + void clearFocus(); + QGraphicsItem *mouseGrabberItem() const; + QBrush backgroundBrush() const; + void setBackgroundBrush(const QBrush &brush); + QBrush foregroundBrush() const; + void setForegroundBrush(const QBrush &brush); + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + QList views() const; + +public slots: + void advance(); + void update(const QRectF &rect = QRectF()); + void invalidate(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers); + void clear(); + +signals: + void changed(const QList ®ion); + void sceneRectChanged(const QRectF &rect); + void selectionChanged(); + +protected: + virtual bool event(QEvent *event); + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); + virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); + virtual void dropEvent(QGraphicsSceneDragDropEvent *event); + virtual void focusInEvent(QFocusEvent *event); + virtual void focusOutEvent(QFocusEvent *event); + virtual void helpEvent(QGraphicsSceneHelpEvent *event); + virtual void keyPressEvent(QKeyEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); + virtual void wheelEvent(QGraphicsSceneWheelEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *event); + virtual void drawBackground(QPainter *painter, const QRectF &rect); + virtual void drawForeground(QPainter *painter, const QRectF &rect); + +public: + enum SceneLayer /BaseType=Flag/ + { + ItemLayer, + BackgroundLayer, + ForegroundLayer, + AllLayers, + }; + + typedef QFlags SceneLayers; + int bspTreeDepth() const; + void setBspTreeDepth(int depth); + QPainterPath selectionArea() const; + void update(qreal x, qreal y, qreal w, qreal h); + QGraphicsProxyWidget *addWidget(QWidget *widget /Transfer/, Qt::WindowFlags flags = Qt::WindowFlags()); + QStyle *style() const; + void setStyle(QStyle *style /Transfer/); + QFont font() const; + void setFont(const QFont &font); + QPalette palette() const; + void setPalette(const QPalette &palette); + QGraphicsWidget *activeWindow() const; + void setActiveWindow(QGraphicsWidget *widget); + +protected: + virtual bool eventFilter(QObject *watched, QEvent *event); + virtual bool focusNextPrevChild(bool next); + +public: + void setStickyFocus(bool enabled); + bool stickyFocus() const; + QGraphicsItem *itemAt(const QPointF &pos, const QTransform &deviceTransform) const; + QGraphicsItem *itemAt(qreal x, qreal y, const QTransform &deviceTransform) const; + bool isActive() const; + QGraphicsItem *activePanel() const; + void setActivePanel(QGraphicsItem *item); + bool sendEvent(QGraphicsItem *item, QEvent *event); + void invalidate(qreal x, qreal y, qreal w, qreal h, QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers); + qreal minimumRenderSize() const; + void setMinimumRenderSize(qreal minSize); + +signals: + void focusItemChanged(QGraphicsItem *newFocus, QGraphicsItem *oldFocus, Qt::FocusReason reason); + +public: + bool focusOnTouch() const; + void setFocusOnTouch(bool enabled); +}; diff --git a/sip/QtWidgets/qgraphicssceneevent.sip b/sip/QtWidgets/qgraphicssceneevent.sip new file mode 100644 index 0000000..1bcfb24 --- /dev/null +++ b/sip/QtWidgets/qgraphicssceneevent.sip @@ -0,0 +1,235 @@ +// qgraphicssceneevent.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsSceneEvent : QEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + switch (sipCpp->type()) + { + case QEvent::GraphicsSceneContextMenu: + sipType = sipType_QGraphicsSceneContextMenuEvent; + break; + + case QEvent::GraphicsSceneDragEnter: + case QEvent::GraphicsSceneDragLeave: + case QEvent::GraphicsSceneDragMove: + case QEvent::GraphicsSceneDrop: + sipType = sipType_QGraphicsSceneDragDropEvent; + break; + + case QEvent::GraphicsSceneHelp: + sipType = sipType_QGraphicsSceneHelpEvent; + break; + + case QEvent::GraphicsSceneHoverEnter: + case QEvent::GraphicsSceneHoverLeave: + case QEvent::GraphicsSceneHoverMove: + sipType = sipType_QGraphicsSceneHoverEvent; + break; + + case QEvent::GraphicsSceneMouseDoubleClick: + case QEvent::GraphicsSceneMouseMove: + case QEvent::GraphicsSceneMousePress: + case QEvent::GraphicsSceneMouseRelease: + sipType = sipType_QGraphicsSceneMouseEvent; + break; + + case QEvent::GraphicsSceneWheel: + sipType = sipType_QGraphicsSceneWheelEvent; + break; + + case QEvent::GraphicsSceneMove: + sipType = sipType_QGraphicsSceneMoveEvent; + break; + + case QEvent::GraphicsSceneResize: + sipType = sipType_QGraphicsSceneResizeEvent; + break; + + default: + sipType = 0; + } +%End + +public: + virtual ~QGraphicsSceneEvent(); + QWidget *widget() const; +%If (Qt_6_2_0 -) + quint64 timestamp() const; +%End + +private: + QGraphicsSceneEvent(const QGraphicsSceneEvent &); +}; + +class QGraphicsSceneMouseEvent : QGraphicsSceneEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QGraphicsSceneMouseEvent(); + QPointF pos() const; + QPointF scenePos() const; + QPoint screenPos() const; + QPointF buttonDownPos(Qt::MouseButton button) const; + QPointF buttonDownScenePos(Qt::MouseButton button) const; + QPoint buttonDownScreenPos(Qt::MouseButton button) const; + QPointF lastPos() const; + QPointF lastScenePos() const; + QPoint lastScreenPos() const; + Qt::MouseButtons buttons() const; + Qt::MouseButton button() const; + Qt::KeyboardModifiers modifiers() const; + Qt::MouseEventSource source() const; + Qt::MouseEventFlags flags() const; +}; + +class QGraphicsSceneWheelEvent : QGraphicsSceneEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QGraphicsSceneWheelEvent(); + QPointF pos() const; + QPointF scenePos() const; + QPoint screenPos() const; + Qt::MouseButtons buttons() const; + Qt::KeyboardModifiers modifiers() const; + int delta() const; + Qt::Orientation orientation() const; +%If (Qt_6_2_0 -) + Qt::ScrollPhase phase() const; +%End +%If (Qt_6_2_0 -) + QPoint pixelDelta() const; +%End +%If (Qt_6_2_0 -) + bool isInverted() const; +%End +}; + +class QGraphicsSceneContextMenuEvent : QGraphicsSceneEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + enum Reason + { + Mouse, + Keyboard, + Other, + }; + + virtual ~QGraphicsSceneContextMenuEvent(); + QPointF pos() const; + QPointF scenePos() const; + QPoint screenPos() const; + Qt::KeyboardModifiers modifiers() const; + QGraphicsSceneContextMenuEvent::Reason reason() const; +}; + +class QGraphicsSceneHoverEvent : QGraphicsSceneEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QGraphicsSceneHoverEvent(); + QPointF pos() const; + QPointF scenePos() const; + QPoint screenPos() const; + QPointF lastPos() const; + QPointF lastScenePos() const; + QPoint lastScreenPos() const; + Qt::KeyboardModifiers modifiers() const; +}; + +class QGraphicsSceneHelpEvent : QGraphicsSceneEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QGraphicsSceneHelpEvent(); + QPointF scenePos() const; + QPoint screenPos() const; +}; + +class QGraphicsSceneDragDropEvent : QGraphicsSceneEvent /NoDefaultCtors/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QGraphicsSceneDragDropEvent(); + QPointF pos() const; + QPointF scenePos() const; + QPoint screenPos() const; + Qt::MouseButtons buttons() const; + Qt::KeyboardModifiers modifiers() const; + Qt::DropActions possibleActions() const; + Qt::DropAction proposedAction() const; + void acceptProposedAction(); + Qt::DropAction dropAction() const; + void setDropAction(Qt::DropAction action); + QWidget *source() const; + const QMimeData *mimeData() const; +}; + +class QGraphicsSceneResizeEvent : QGraphicsSceneEvent +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsSceneResizeEvent(); + virtual ~QGraphicsSceneResizeEvent(); + QSizeF oldSize() const; + QSizeF newSize() const; +}; + +class QGraphicsSceneMoveEvent : QGraphicsSceneEvent +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsSceneMoveEvent(); + virtual ~QGraphicsSceneMoveEvent(); + QPointF oldPos() const; + QPointF newPos() const; +}; diff --git a/sip/QtWidgets/qgraphicstransform.sip b/sip/QtWidgets/qgraphicstransform.sip new file mode 100644 index 0000000..0b24fe0 --- /dev/null +++ b/sip/QtWidgets/qgraphicstransform.sip @@ -0,0 +1,87 @@ +// qgraphicstransform.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsTransform : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsTransform(QObject *parent /TransferThis/ = 0); + virtual ~QGraphicsTransform(); + virtual void applyTo(QMatrix4x4 *matrix) const = 0; + +protected slots: + void update(); +}; + +class QGraphicsScale : QGraphicsTransform +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsScale(QObject *parent /TransferThis/ = 0); + virtual ~QGraphicsScale(); + QVector3D origin() const; + void setOrigin(const QVector3D &point); + qreal xScale() const; + void setXScale(qreal); + qreal yScale() const; + void setYScale(qreal); + qreal zScale() const; + void setZScale(qreal); + virtual void applyTo(QMatrix4x4 *matrix) const; + +signals: + void originChanged(); + void scaleChanged(); + void xScaleChanged(); + void yScaleChanged(); + void zScaleChanged(); +}; + +class QGraphicsRotation : QGraphicsTransform +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsRotation(QObject *parent /TransferThis/ = 0); + virtual ~QGraphicsRotation(); + QVector3D origin() const; + void setOrigin(const QVector3D &point); + qreal angle() const; + void setAngle(qreal); + QVector3D axis() const; + void setAxis(const QVector3D &axis); + void setAxis(Qt::Axis axis); + virtual void applyTo(QMatrix4x4 *matrix) const; + +signals: + void originChanged(); + void angleChanged(); + void axisChanged(); +}; diff --git a/sip/QtWidgets/qgraphicsview.sip b/sip/QtWidgets/qgraphicsview.sip new file mode 100644 index 0000000..296f9a9 --- /dev/null +++ b/sip/QtWidgets/qgraphicsview.sip @@ -0,0 +1,186 @@ +// qgraphicsview.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsView : QAbstractScrollArea +{ +%TypeHeaderCode +#include +%End + +public: + enum CacheModeFlag /BaseType=Flag/ + { + CacheNone, + CacheBackground, + }; + + typedef QFlags CacheMode; + + enum DragMode + { + NoDrag, + ScrollHandDrag, + RubberBandDrag, + }; + + enum ViewportAnchor + { + NoAnchor, + AnchorViewCenter, + AnchorUnderMouse, + }; + + QGraphicsView(QWidget *parent /TransferThis/ = 0); + QGraphicsView(QGraphicsScene *scene /KeepReference/, QWidget *parent /TransferThis/ = 0); + virtual ~QGraphicsView(); + virtual QSize sizeHint() const; + QPainter::RenderHints renderHints() const; + void setRenderHint(QPainter::RenderHint hint, bool on = true); + void setRenderHints(QPainter::RenderHints hints); + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment alignment); + QGraphicsView::ViewportAnchor transformationAnchor() const; + void setTransformationAnchor(QGraphicsView::ViewportAnchor anchor); + QGraphicsView::ViewportAnchor resizeAnchor() const; + void setResizeAnchor(QGraphicsView::ViewportAnchor anchor); + QGraphicsView::DragMode dragMode() const; + void setDragMode(QGraphicsView::DragMode mode); + QGraphicsView::CacheMode cacheMode() const; + void setCacheMode(QGraphicsView::CacheMode mode); + void resetCachedContent(); + bool isInteractive() const; + void setInteractive(bool allowed); + QGraphicsScene *scene() const; + void setScene(QGraphicsScene *scene /KeepReference/); + QRectF sceneRect() const; + void setSceneRect(const QRectF &rect); + void rotate(qreal angle); + void scale(qreal sx, qreal sy); + void shear(qreal sh, qreal sv); + void translate(qreal dx, qreal dy); + void centerOn(const QPointF &pos); + void centerOn(const QGraphicsItem *item); + void ensureVisible(const QRectF &rect, int xMargin = 50, int yMargin = 50); + void ensureVisible(const QGraphicsItem *item, int xMargin = 50, int yMargin = 50); + void fitInView(const QRectF &rect, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio); + void fitInView(const QGraphicsItem *item, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio); + void render(QPainter *painter, const QRectF &target = QRectF(), const QRect &source = QRect(), Qt::AspectRatioMode mode = Qt::KeepAspectRatio); + QList items() const; + QList items(const QPoint &pos) const; + QList items(int x, int y) const; + QList items(int x, int y, int w, int h, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList items(const QRect &rect, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList items(const QPolygon &polygon, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QList items(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; + QGraphicsItem *itemAt(const QPoint &pos) const; + QPointF mapToScene(const QPoint &point) const; + QPolygonF mapToScene(const QRect &rect) const; + QPolygonF mapToScene(const QPolygon &polygon) const; + QPainterPath mapToScene(const QPainterPath &path) const; + QPoint mapFromScene(const QPointF &point) const; + QPolygon mapFromScene(const QRectF &rect) const; + QPolygon mapFromScene(const QPolygonF &polygon) const; + QPainterPath mapFromScene(const QPainterPath &path) const; + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + QBrush backgroundBrush() const; + void setBackgroundBrush(const QBrush &brush); + QBrush foregroundBrush() const; + void setForegroundBrush(const QBrush &brush); + +public slots: + void invalidateScene(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers); + void updateScene(const QList &rects); + void updateSceneRect(const QRectF &rect); + +protected slots: + virtual void setupViewport(QWidget *widget); + +protected: + virtual bool event(QEvent *event); + virtual bool viewportEvent(QEvent *event); + virtual void contextMenuEvent(QContextMenuEvent *event); + virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void dragLeaveEvent(QDragLeaveEvent *event); + virtual void dragMoveEvent(QDragMoveEvent *event); + virtual void dropEvent(QDropEvent *event); + virtual void focusInEvent(QFocusEvent *event); + virtual void focusOutEvent(QFocusEvent *event); + virtual bool focusNextPrevChild(bool next); + virtual void keyPressEvent(QKeyEvent *event); + virtual void keyReleaseEvent(QKeyEvent *event); + virtual void mouseDoubleClickEvent(QMouseEvent *event); + virtual void mousePressEvent(QMouseEvent *event); + virtual void mouseMoveEvent(QMouseEvent *event); + virtual void mouseReleaseEvent(QMouseEvent *event); + virtual void wheelEvent(QWheelEvent *event); + virtual void paintEvent(QPaintEvent *event); + virtual void resizeEvent(QResizeEvent *event); + virtual void scrollContentsBy(int dx, int dy); + virtual void showEvent(QShowEvent *event); + virtual void inputMethodEvent(QInputMethodEvent *event); + virtual void drawBackground(QPainter *painter, const QRectF &rect); + virtual void drawForeground(QPainter *painter, const QRectF &rect); + +public: + void setSceneRect(qreal ax, qreal ay, qreal aw, qreal ah); + void centerOn(qreal ax, qreal ay); + void ensureVisible(qreal x, qreal y, qreal w, qreal h, int xMargin = 50, int yMargin = 50); + void fitInView(qreal x, qreal y, qreal w, qreal h, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio); + QGraphicsItem *itemAt(int ax, int ay) const; + QPointF mapToScene(int ax, int ay) const; + QPolygonF mapToScene(int ax, int ay, int w, int h) const; + QPoint mapFromScene(qreal ax, qreal ay) const; + QPolygon mapFromScene(qreal ax, qreal ay, qreal w, qreal h) const; + + enum ViewportUpdateMode + { + FullViewportUpdate, + MinimalViewportUpdate, + SmartViewportUpdate, + BoundingRectViewportUpdate, + NoViewportUpdate, + }; + + enum OptimizationFlag /BaseType=Flag/ + { + DontSavePainterState, + DontAdjustForAntialiasing, + }; + + typedef QFlags OptimizationFlags; + QGraphicsView::ViewportUpdateMode viewportUpdateMode() const; + void setViewportUpdateMode(QGraphicsView::ViewportUpdateMode mode); + QGraphicsView::OptimizationFlags optimizationFlags() const; + void setOptimizationFlag(QGraphicsView::OptimizationFlag flag, bool enabled = true); + void setOptimizationFlags(QGraphicsView::OptimizationFlags flags); + Qt::ItemSelectionMode rubberBandSelectionMode() const; + void setRubberBandSelectionMode(Qt::ItemSelectionMode mode); + QTransform transform() const; + QTransform viewportTransform() const; + void setTransform(const QTransform &matrix, bool combine = false); + void resetTransform(); + bool isTransformed() const; + QRect rubberBandRect() const; + +signals: + void rubberBandChanged(QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint); +}; diff --git a/sip/QtWidgets/qgraphicswidget.sip b/sip/QtWidgets/qgraphicswidget.sip new file mode 100644 index 0000000..4a688c0 --- /dev/null +++ b/sip/QtWidgets/qgraphicswidget.sip @@ -0,0 +1,122 @@ +// qgraphicswidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGraphicsWidget : QGraphicsObject, QGraphicsLayoutItem +{ +%TypeHeaderCode +#include +%End + +public: + QGraphicsWidget(QGraphicsItem *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QGraphicsWidget(); + QGraphicsLayout *layout() const; + void setLayout(QGraphicsLayout *layout /Transfer/); + void adjustSize(); + Qt::LayoutDirection layoutDirection() const; + void setLayoutDirection(Qt::LayoutDirection direction); + void unsetLayoutDirection(); + QStyle *style() const; + void setStyle(QStyle *style /KeepReference/); + QFont font() const; + void setFont(const QFont &font); + QPalette palette() const; + void setPalette(const QPalette &palette); + void resize(const QSizeF &size); + void resize(qreal w, qreal h); + QSizeF size() const; + virtual void setGeometry(const QRectF &rect); + QRectF rect() const; + void setContentsMargins(QMarginsF margins); + void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom); + virtual void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; + void setWindowFrameMargins(QMarginsF margins); + void setWindowFrameMargins(qreal left, qreal top, qreal right, qreal bottom); + void getWindowFrameMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; + void unsetWindowFrameMargins(); + QRectF windowFrameGeometry() const; + QRectF windowFrameRect() const; + Qt::WindowFlags windowFlags() const; + Qt::WindowType windowType() const; + void setWindowFlags(Qt::WindowFlags wFlags); + bool isActiveWindow() const; + void setWindowTitle(const QString &title); + QString windowTitle() const; + Qt::FocusPolicy focusPolicy() const; + void setFocusPolicy(Qt::FocusPolicy policy); + static void setTabOrder(QGraphicsWidget *first, QGraphicsWidget *second); + QGraphicsWidget *focusWidget() const; + int grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context = Qt::WindowShortcut); + void releaseShortcut(int id); + void setShortcutEnabled(int id, bool enabled = true); + void setShortcutAutoRepeat(int id, bool enabled = true); + void addAction(QAction *action); + void addActions(const QList &actions); + void insertAction(QAction *before, QAction *action); + void insertActions(QAction *before, const QList &actions); + void removeAction(QAction *action); + QList actions() const; + void setAttribute(Qt::WidgetAttribute attribute, bool on = true); + bool testAttribute(Qt::WidgetAttribute attribute) const; + virtual int type() const; + virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; + void setGeometry(qreal ax, qreal ay, qreal aw, qreal ah); + +public slots: + bool close(); + +protected: + virtual void initStyleOption(QStyleOption *option) const; + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + virtual void updateGeometry(); + virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value); + virtual bool sceneEvent(QEvent *event); + virtual bool windowFrameEvent(QEvent *e); + virtual Qt::WindowFrameSection windowFrameSectionAt(const QPointF &pos) const; + virtual bool event(QEvent *event); + virtual void changeEvent(QEvent *event); + virtual void closeEvent(QCloseEvent *event); + virtual void focusInEvent(QFocusEvent *event); + virtual bool focusNextPrevChild(bool next); + virtual void focusOutEvent(QFocusEvent *event); + virtual void hideEvent(QHideEvent *event); + virtual void moveEvent(QGraphicsSceneMoveEvent *event); + virtual void polishEvent(); + virtual void resizeEvent(QGraphicsSceneResizeEvent *event); + virtual void showEvent(QShowEvent *event); + virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + virtual void grabMouseEvent(QEvent *event); + virtual void ungrabMouseEvent(QEvent *event); + virtual void grabKeyboardEvent(QEvent *event); + virtual void ungrabKeyboardEvent(QEvent *event); + +public: + bool autoFillBackground() const; + void setAutoFillBackground(bool enabled); + +signals: + void geometryChanged(); +}; diff --git a/sip/QtWidgets/qgridlayout.sip b/sip/QtWidgets/qgridlayout.sip new file mode 100644 index 0000000..2147a64 --- /dev/null +++ b/sip/QtWidgets/qgridlayout.sip @@ -0,0 +1,144 @@ +// qgridlayout.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGridLayout : QLayout +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGridLayout(QWidget *parent /TransferThis/ = 0); + virtual ~QGridLayout(); + virtual QSize sizeHint() const; + virtual QSize minimumSize() const; + virtual QSize maximumSize() const; + void setRowStretch(int row, int stretch); + void setColumnStretch(int column, int stretch); + int rowStretch(int row) const; + int columnStretch(int column) const; + void setRowMinimumHeight(int row, int minSize); + void setColumnMinimumWidth(int column, int minSize); + int rowMinimumHeight(int row) const; + int columnMinimumWidth(int column) const; + int columnCount() const; + int rowCount() const; + QRect cellRect(int row, int column) const; + virtual bool hasHeightForWidth() const; + virtual int heightForWidth(int) const; + virtual int minimumHeightForWidth(int) const; + virtual Qt::Orientations expandingDirections() const; + virtual void invalidate(); + void addWidget(QWidget *w /GetWrapper/); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->addWidget(a0); + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a0Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows addWidget(QWidget()). + sipTransferTo(a0Wrapper, sipSelf); + } +%End + + void addWidget(QWidget * /GetWrapper/, int row, int column, Qt::Alignment alignment = Qt::Alignment()); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->addWidget(a0, a1, a2, *a3); + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a0Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows addWidget(QWidget()). + sipTransferTo(a0Wrapper, sipSelf); + } +%End + + void addWidget(QWidget * /GetWrapper/, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment = Qt::Alignment()); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->addWidget(a0, a1, a2, a3, a4, *a5); + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a0Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows addWidget(QWidget()). + sipTransferTo(a0Wrapper, sipSelf); + } +%End + + void addLayout(QLayout * /Transfer/, int row, int column, Qt::Alignment alignment = Qt::Alignment()); + void addLayout(QLayout * /Transfer/, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment = Qt::Alignment()); + void setOriginCorner(Qt::Corner); + Qt::Corner originCorner() const; + virtual QLayoutItem *itemAt(int) const; + virtual QLayoutItem *takeAt(int) /TransferBack/; + virtual int count() const; + virtual void setGeometry(const QRect &); + void addItem(QLayoutItem *item /Transfer/, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = Qt::Alignment()); + void setDefaultPositioning(int n, Qt::Orientation orient); + void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan) const; + void setHorizontalSpacing(int spacing); + int horizontalSpacing() const; + void setVerticalSpacing(int spacing); + int verticalSpacing() const; + virtual void setSpacing(int spacing); + virtual int spacing() const; + QLayoutItem *itemAtPosition(int row, int column) const; + +protected: + virtual void addItem(QLayoutItem * /Transfer/); +}; diff --git a/sip/QtWidgets/qgroupbox.sip b/sip/QtWidgets/qgroupbox.sip new file mode 100644 index 0000000..1967e89 --- /dev/null +++ b/sip/QtWidgets/qgroupbox.sip @@ -0,0 +1,62 @@ +// qgroupbox.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QGroupBox : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QGroupBox(QWidget *parent /TransferThis/ = 0); + QGroupBox(const QString &title, QWidget *parent /TransferThis/ = 0); + virtual ~QGroupBox(); + QString title() const; + void setTitle(const QString &); + Qt::Alignment alignment() const; + void setAlignment(int); + virtual QSize minimumSizeHint() const; + bool isFlat() const; + void setFlat(bool b); + bool isCheckable() const; + void setCheckable(bool b); + bool isChecked() const; + +public slots: + void setChecked(bool b); + +signals: + void clicked(bool checked = false); + void toggled(bool); + +protected: + virtual void initStyleOption(QStyleOptionGroupBox *option) const; + virtual bool event(QEvent *); + virtual void childEvent(QChildEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual void changeEvent(QEvent *); + virtual void mousePressEvent(QMouseEvent *event); + virtual void mouseMoveEvent(QMouseEvent *event); + virtual void mouseReleaseEvent(QMouseEvent *event); +}; diff --git a/sip/QtWidgets/qheaderview.sip b/sip/QtWidgets/qheaderview.sip new file mode 100644 index 0000000..476449b --- /dev/null +++ b/sip/QtWidgets/qheaderview.sip @@ -0,0 +1,179 @@ +// qheaderview.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QHeaderView : QAbstractItemView +{ +%TypeHeaderCode +#include +%End + +public: + enum ResizeMode + { + Interactive, + Fixed, + Stretch, + ResizeToContents, + Custom, + }; + + QHeaderView(Qt::Orientation orientation, QWidget *parent /TransferThis/ = 0); + virtual ~QHeaderView(); + virtual void setModel(QAbstractItemModel *model /KeepReference/); + Qt::Orientation orientation() const; + int offset() const; + int length() const; + virtual QSize sizeHint() const; + int sectionSizeHint(int logicalIndex) const; + int visualIndexAt(int position) const; + int logicalIndexAt(int position) const; + int sectionSize(int logicalIndex) const; + int sectionPosition(int logicalIndex) const; + int sectionViewportPosition(int logicalIndex) const; + void moveSection(int from, int to); + void resizeSection(int logicalIndex, int size); + bool isSectionHidden(int logicalIndex) const; + void setSectionHidden(int logicalIndex, bool hide); + int count() const /__len__/; + int visualIndex(int logicalIndex) const; + int logicalIndex(int visualIndex) const; + void setHighlightSections(bool highlight); + bool highlightSections() const; + int stretchSectionCount() const; + void setSortIndicatorShown(bool show); + bool isSortIndicatorShown() const; + void setSortIndicator(int logicalIndex, Qt::SortOrder order); + int sortIndicatorSection() const; + Qt::SortOrder sortIndicatorOrder() const; + bool stretchLastSection() const; + void setStretchLastSection(bool stretch); + bool sectionsMoved() const; + +public slots: + void setOffset(int offset); + void headerDataChanged(Qt::Orientation orientation, int logicalFirst, int logicalLast); + void setOffsetToSectionPosition(int visualIndex); + +signals: + void geometriesChanged(); + void sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex); + void sectionResized(int logicalIndex, int oldSize, int newSize); + void sectionPressed(int logicalIndex); + void sectionClicked(int logicalIndex); + void sectionDoubleClicked(int logicalIndex); + void sectionCountChanged(int oldCount, int newCount); + void sectionHandleDoubleClicked(int logicalIndex); + +protected slots: + void updateSection(int logicalIndex); + void resizeSections(); + void sectionsInserted(const QModelIndex &parent, int logicalFirst, int logicalLast); + void sectionsAboutToBeRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast); + +protected: + void initialize(); + void initializeSections(); + void initializeSections(int start, int end); + virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &old); + virtual bool event(QEvent *e); + virtual bool viewportEvent(QEvent *e); + virtual void paintEvent(QPaintEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void mouseDoubleClickEvent(QMouseEvent *e); + virtual void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const; + virtual QSize sectionSizeFromContents(int logicalIndex) const; + virtual int horizontalOffset() const; + virtual int verticalOffset() const; + virtual void updateGeometries(); + virtual void scrollContentsBy(int dx, int dy); + virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList &roles = QList()); + virtual void rowsInserted(const QModelIndex &parent, int start, int end); + virtual QRect visualRect(const QModelIndex &index) const; + virtual void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint); + virtual QModelIndex indexAt(const QPoint &p) const; + virtual bool isIndexHidden(const QModelIndex &index) const; + virtual QModelIndex moveCursor(QAbstractItemView::CursorAction, Qt::KeyboardModifiers); + virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags); + virtual QRegion visualRegionForSelection(const QItemSelection &selection) const; + +public: + int logicalIndexAt(int ax, int ay) const; + int logicalIndexAt(const QPoint &apos) const; + void hideSection(int alogicalIndex); + void showSection(int alogicalIndex); + void resizeSections(QHeaderView::ResizeMode mode); + int hiddenSectionCount() const; + int defaultSectionSize() const; + void setDefaultSectionSize(int size); + Qt::Alignment defaultAlignment() const; + void setDefaultAlignment(Qt::Alignment alignment); + bool sectionsHidden() const; + void swapSections(int first, int second); + bool cascadingSectionResizes() const; + void setCascadingSectionResizes(bool enable); + int minimumSectionSize() const; + void setMinimumSectionSize(int size); + QByteArray saveState() const; + bool restoreState(const QByteArray &state); + virtual void reset(); + +public slots: + void setOffsetToLastSection(); + +signals: + void sectionEntered(int logicalIndex); + void sortIndicatorChanged(int logicalIndex, Qt::SortOrder order); + +protected: + virtual void initStyleOption(QStyleOptionHeader *option) const; + virtual void initStyleOptionForIndex(QStyleOptionHeader *option, int logicalIndex) const; + +public: + void setSectionsMovable(bool movable); + bool sectionsMovable() const; + void setSectionsClickable(bool clickable); + bool sectionsClickable() const; + QHeaderView::ResizeMode sectionResizeMode(int logicalIndex) const; + void setSectionResizeMode(int logicalIndex, QHeaderView::ResizeMode mode); + void setSectionResizeMode(QHeaderView::ResizeMode mode); + virtual void setVisible(bool v); + void setResizeContentsPrecision(int precision); + int resizeContentsPrecision() const; + int maximumSectionSize() const; + void setMaximumSectionSize(int size); + void resetDefaultSectionSize(); + void setFirstSectionMovable(bool movable); + bool isFirstSectionMovable() const; +%If (Qt_6_1_0 -) + void setSortIndicatorClearable(bool clearable); +%End +%If (Qt_6_1_0 -) + bool isSortIndicatorClearable() const; +%End + +signals: +%If (Qt_6_1_0 -) + void sortIndicatorClearableChanged(bool clearable); +%End +}; diff --git a/sip/QtWidgets/qinputdialog.sip b/sip/QtWidgets/qinputdialog.sip new file mode 100644 index 0000000..59aa448 --- /dev/null +++ b/sip/QtWidgets/qinputdialog.sip @@ -0,0 +1,123 @@ +// qinputdialog.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QInputDialog : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + enum InputDialogOption /BaseType=Flag/ + { + NoButtons, + UseListViewForComboBoxItems, + UsePlainTextEditForTextInput, + }; + + typedef QFlags InputDialogOptions; + + enum InputMode + { + TextInput, + IntInput, + DoubleInput, + }; + + static QString getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode echo = QLineEdit::Normal, const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = Qt::WindowFlags(), Qt::InputMethodHints inputMethodHints = Qt::ImhNone) /ReleaseGIL/; + static int getInt(QWidget *parent, const QString &title, const QString &label, int value = 0, int min = -2147483647, int max = 2147483647, int step = 1, bool *ok = 0, Qt::WindowFlags flags = Qt::WindowFlags()) /ReleaseGIL/; + static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0, double min = -2147483647, double max = 2147483647, int decimals = 1, bool *ok = 0, Qt::WindowFlags flags = Qt::WindowFlags(), double step = 1); + static QString getItem(QWidget *parent, const QString &title, const QString &label, const QStringList &items, int current = 0, bool editable = true, bool *ok = 0, Qt::WindowFlags flags = Qt::WindowFlags(), Qt::InputMethodHints inputMethodHints = Qt::ImhNone) /ReleaseGIL/; + static QString getMultiLineText(QWidget *parent, const QString &title, const QString &label, const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = Qt::WindowFlags(), Qt::InputMethodHints inputMethodHints = Qt::ImhNone) /ReleaseGIL/; + QInputDialog(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QInputDialog(); + void setInputMode(QInputDialog::InputMode mode); + QInputDialog::InputMode inputMode() const; + void setLabelText(const QString &text); + QString labelText() const; + void setOption(QInputDialog::InputDialogOption option, bool on = true); + bool testOption(QInputDialog::InputDialogOption option) const; + void setOptions(QInputDialog::InputDialogOptions options); + QInputDialog::InputDialogOptions options() const; + void setTextValue(const QString &text); + QString textValue() const; + void setTextEchoMode(QLineEdit::EchoMode mode); + QLineEdit::EchoMode textEchoMode() const; + void setComboBoxEditable(bool editable); + bool isComboBoxEditable() const; + void setComboBoxItems(const QStringList &items); + QStringList comboBoxItems() const; + void setIntValue(int value); + int intValue() const; + void setIntMinimum(int min); + int intMinimum() const; + void setIntMaximum(int max); + int intMaximum() const; + void setIntRange(int min, int max); + void setIntStep(int step); + int intStep() const; + void setDoubleValue(double value); + double doubleValue() const; + void setDoubleMinimum(double min); + double doubleMinimum() const; + void setDoubleMaximum(double max); + double doubleMaximum() const; + void setDoubleRange(double min, double max); + void setDoubleDecimals(int decimals); + int doubleDecimals() const; + void setOkButtonText(const QString &text); + QString okButtonText() const; + void setCancelButtonText(const QString &text); + QString cancelButtonText() const; + virtual void open(); + void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipCpp->open(receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + + virtual QSize minimumSizeHint() const; + virtual QSize sizeHint() const; + virtual void setVisible(bool visible); + virtual void done(int result); + +signals: + void textValueChanged(const QString &text); + void textValueSelected(const QString &text); + void intValueChanged(int value); + void intValueSelected(int value); + void doubleValueChanged(double value); + void doubleValueSelected(double value); + +public: + void setDoubleStep(double step); + double doubleStep() const; +}; diff --git a/sip/QtWidgets/qitemdelegate.sip b/sip/QtWidgets/qitemdelegate.sip new file mode 100644 index 0000000..fb5def2 --- /dev/null +++ b/sip/QtWidgets/qitemdelegate.sip @@ -0,0 +1,51 @@ +// qitemdelegate.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QItemDelegate : QAbstractItemDelegate +{ +%TypeHeaderCode +#include +%End + +public: + explicit QItemDelegate(QObject *parent /TransferThis/ = 0); + virtual ~QItemDelegate(); + virtual void paint(QPainter *painter, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const; + virtual QSize sizeHint(const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const; + virtual QWidget *createEditor(QWidget *parent /TransferThis/, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const /Factory/; + virtual void setEditorData(QWidget *editor, const QModelIndex &index) const; + virtual void setModelData(QWidget *editor, QAbstractItemModel *model /KeepReference/, const QModelIndex &index) const; + virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const; + QItemEditorFactory *itemEditorFactory() const; + void setItemEditorFactory(QItemEditorFactory *factory /KeepReference/); + bool hasClipping() const; + void setClipping(bool clip); + +protected: + void drawBackground(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; + virtual void drawCheck(QPainter *painter, const QStyleOptionViewItem &option /NoCopy/, const QRect &rect, Qt::CheckState state) const; + virtual void drawDecoration(QPainter *painter, const QStyleOptionViewItem &option /NoCopy/, const QRect &rect, const QPixmap &pixmap) const; + virtual void drawDisplay(QPainter *painter, const QStyleOptionViewItem &option /NoCopy/, const QRect &rect, const QString &text) const; + virtual void drawFocus(QPainter *painter, const QStyleOptionViewItem &option /NoCopy/, const QRect &rect) const; + virtual bool eventFilter(QObject *object, QEvent *event); + virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index); +}; diff --git a/sip/QtWidgets/qitemeditorfactory.sip b/sip/QtWidgets/qitemeditorfactory.sip new file mode 100644 index 0000000..9253fdb --- /dev/null +++ b/sip/QtWidgets/qitemeditorfactory.sip @@ -0,0 +1,49 @@ +// qitemeditorfactory.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QItemEditorCreatorBase /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + virtual ~QItemEditorCreatorBase(); + virtual QWidget *createWidget(QWidget *parent /TransferThis/) const = 0 /Factory/; + virtual QByteArray valuePropertyName() const = 0; +}; + +class QItemEditorFactory /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + QItemEditorFactory(); + virtual ~QItemEditorFactory(); + virtual QWidget *createEditor(int userType, QWidget *parent /TransferThis/) const; + virtual QByteArray valuePropertyName(int userType) const; + void registerEditor(int userType, QItemEditorCreatorBase *creator /Transfer/); + static const QItemEditorFactory *defaultFactory(); + static void setDefaultFactory(QItemEditorFactory *factory /Transfer/); +}; diff --git a/sip/QtWidgets/qkeysequenceedit.sip b/sip/QtWidgets/qkeysequenceedit.sip new file mode 100644 index 0000000..afc1d31 --- /dev/null +++ b/sip/QtWidgets/qkeysequenceedit.sip @@ -0,0 +1,73 @@ +// qkeysequenceedit.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QKeySequenceEdit : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QKeySequenceEdit(QWidget *parent /TransferThis/ = 0); + QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent /TransferThis/ = 0); + virtual ~QKeySequenceEdit(); + QKeySequence keySequence() const; + +public slots: + void setKeySequence(const QKeySequence &keySequence); + void clear(); + +signals: + void editingFinished(); + void keySequenceChanged(const QKeySequence &keySequence); + +protected: + virtual bool event(QEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void timerEvent(QTimerEvent *); +%If (Qt_6_4_0 -) + virtual void focusOutEvent(QFocusEvent *); +%End + +public: +%If (Qt_6_4_0 -) + void setClearButtonEnabled(bool enable); +%End +%If (Qt_6_4_0 -) + bool isClearButtonEnabled() const; +%End +%If (Qt_6_5_0 -) + qsizetype maximumSequenceLength() const; +%End +%If (Qt_6_5_0 -) + void setFinishingKeyCombinations(const QList &finishingKeyCombinations); +%End +%If (Qt_6_5_0 -) + QList finishingKeyCombinations() const; +%End + +public slots: +%If (Qt_6_5_0 -) + void setMaximumSequenceLength(qsizetype count); +%End +}; diff --git a/sip/QtWidgets/qlabel.sip b/sip/QtWidgets/qlabel.sip new file mode 100644 index 0000000..97c0ae9 --- /dev/null +++ b/sip/QtWidgets/qlabel.sip @@ -0,0 +1,191 @@ +// qlabel.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLabel : QFrame +{ +%TypeHeaderCode +#include +%End + +public: + QLabel(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + QLabel(const QString &text, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QLabel(); + QString text() const; + QPixmap pixmap() const; + QPicture picture() const; + QMovie *movie() const; + Qt::TextFormat textFormat() const; + void setTextFormat(Qt::TextFormat); + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment); + void setWordWrap(bool on); + bool wordWrap() const; + int indent() const; + void setIndent(int); + int margin() const; + void setMargin(int); + bool hasScaledContents() const; + void setScaledContents(bool); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + void setBuddy(QWidget * /KeepReference/); + QWidget *buddy() const; + virtual int heightForWidth(int) const; + bool openExternalLinks() const; + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + void setOpenExternalLinks(bool open); + +public slots: + void clear(); + void setMovie(QMovie *movie /KeepReference/); + void setNum(double /Constrained/); + void setNum(int); + void setPicture(const QPicture &); + void setPixmap(const QPixmap &); + void setText(const QString &); + +signals: + void linkActivated(const QString &link); + void linkHovered(const QString &link); + +protected: + virtual bool event(QEvent *e); + virtual void paintEvent(QPaintEvent *); + virtual void changeEvent(QEvent *); + virtual void keyPressEvent(QKeyEvent *ev); + virtual void mousePressEvent(QMouseEvent *ev); + virtual void mouseMoveEvent(QMouseEvent *ev); + virtual void mouseReleaseEvent(QMouseEvent *ev); + virtual void contextMenuEvent(QContextMenuEvent *ev); + virtual void focusInEvent(QFocusEvent *ev); + virtual void focusOutEvent(QFocusEvent *ev); + virtual bool focusNextPrevChild(bool next); + +public: + void setSelection(int, int); + bool hasSelectedText() const; + QString selectedText() const; + int selectionStart() const; +%If (Qt_6_1_0 -) + SIP_PYCALLABLE resourceProvider() const /TypeHint="Callable[[QUrl], QVariant]"/; +%MethodCode + if (sipCpp->resourceProvider()) + sipRes = sipGetUserObject((sipSimpleWrapper *)sipSelf); + else + sipRes = SIP_NULLPTR; + + if (!sipRes) + sipRes = Py_None; + + Py_INCREF(sipRes); +%End + +%End +%If (Qt_6_1_0 -) + void setResourceProvider(SIP_PYCALLABLE provider /TypeHint="Callable[[QUrl], QVariant]"/); +%MethodCode + // Remove any existing callable. + Py_XDECREF(sipGetUserObject((sipSimpleWrapper *)sipSelf)); + + if (a0 == Py_None) + { + sipSetUserObject((sipSimpleWrapper *)sipSelf, SIP_NULLPTR); + sipCpp->setResourceProvider(SIP_NULLPTR); + } + else + { + // Save the callable so that resourceProvider() can return it. + Py_INCREF(a0); + sipSetUserObject((sipSimpleWrapper *)sipSelf, a0); + + Py_BEGIN_ALLOW_THREADS + + sipCpp->setResourceProvider([a0] (const QUrl &arg) { + QUrl *arg_heap = new QUrl(arg); + QVariant qv; + int is_err = 1; + + SIP_BLOCK_THREADS + + PyObject *arg_obj = sipConvertFromNewType(arg_heap, sipType_QUrl, NULL); + + if (arg_obj) + { + PyObject *res_obj = PyObject_CallFunctionObjArgs(a0, arg_obj, NULL); + + Py_DECREF(arg_obj); + + if (res_obj) + { + is_err = 0; + + QVariant *res = reinterpret_cast( + sipConvertToType(res_obj, sipType_QVariant, NULL, 0, + NULL, &is_err)); + + if (!is_err) + { + qv = *res; + delete res; + } + } + } + else + { + delete arg_heap; + } + + if (is_err) + { + pyqt6_qtwidgets_err_print(); + } + + SIP_UNBLOCK_THREADS + + return qv; + }); + + Py_END_ALLOW_THREADS + } +%End + +%End +}; + +%ModuleHeaderCode +// Imports from QtCore. +typedef void (*pyqt6_qtwidgets_err_print_t)(); +extern pyqt6_qtwidgets_err_print_t pyqt6_qtwidgets_err_print; +%End + +%ModuleCode +// Imports from QtCore. +pyqt6_qtwidgets_err_print_t pyqt6_qtwidgets_err_print; +%End + +%PostInitialisationCode +// Imports from QtCore. +pyqt6_qtwidgets_err_print = (pyqt6_qtwidgets_err_print_t)sipImportSymbol("pyqt6_err_print"); +Q_ASSERT(pyqt6_qtwidgets_err_print); +%End diff --git a/sip/QtWidgets/qlayout.sip b/sip/QtWidgets/qlayout.sip new file mode 100644 index 0000000..ca4df82 --- /dev/null +++ b/sip/QtWidgets/qlayout.sip @@ -0,0 +1,171 @@ +// qlayout.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLayout : QObject, QLayoutItem +{ +%TypeHeaderCode +#include +%End + +public: + enum SizeConstraint + { + SetDefaultConstraint, + SetNoConstraint, + SetMinimumSize, + SetFixedSize, + SetMaximumSize, + SetMinAndMaxSize, + }; + + explicit QLayout(QWidget *parent /TransferThis/ = 0); + virtual ~QLayout(); + virtual int spacing() const; + virtual void setSpacing(int); + bool setAlignment(QWidget *w, Qt::Alignment alignment); + bool setAlignment(QLayout *l, Qt::Alignment alignment); + void setAlignment(Qt::Alignment); + void setSizeConstraint(QLayout::SizeConstraint); + QLayout::SizeConstraint sizeConstraint() const; + void setMenuBar(QWidget *w /GetWrapper/); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->setMenuBar(a0); + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (a0 && parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a0Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows setMenuBar(QWidget()). + sipTransferTo(a0Wrapper, sipSelf); + } +%End + + QWidget *menuBar() const; + QWidget *parentWidget() const; + virtual void invalidate(); + virtual QRect geometry() const; + bool activate(); + void update(); + void addWidget(QWidget *w /GetWrapper/); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->addWidget(a0); + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a0Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows addWidget(QWidget()). + sipTransferTo(a0Wrapper, sipSelf); + } +%End + + virtual void addItem(QLayoutItem * /Transfer/) = 0; + void removeWidget(QWidget *w /TransferBack/); + void removeItem(QLayoutItem * /TransferBack/); + virtual Qt::Orientations expandingDirections() const; + virtual QSize minimumSize() const; + virtual QSize maximumSize() const; + virtual void setGeometry(const QRect &); + virtual QLayoutItem *itemAt(int index) const = 0; + virtual QLayoutItem *takeAt(int index) = 0 /TransferBack/; + virtual int indexOf(const QWidget *) const; + virtual int indexOf(const QLayoutItem *) const; + virtual int count() const = 0 /__len__/; + virtual bool isEmpty() const; + int totalHeightForWidth(int w) const; + QSize totalMinimumSize() const; + QSize totalMaximumSize() const; + QSize totalSizeHint() const; + virtual QLayout *layout(); + void setEnabled(bool); + bool isEnabled() const; + static QSize closestAcceptableSize(const QWidget *w, const QSize &s); + +protected: + void widgetEvent(QEvent *); + virtual void childEvent(QChildEvent *e); + void addChildLayout(QLayout *l /Transfer/); + void addChildWidget(QWidget *w /GetWrapper/); +%MethodCode + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipCpp->addChildWidget(a0); + #else + sipCpp->sipProtect_addChildWidget(a0); + #endif + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a0Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows + // addChildWidget(QWidget()). + sipTransferTo(a0Wrapper, sipSelf); + } +%End + + QRect alignmentRect(const QRect &) const; + +public: + void setContentsMargins(int left, int top, int right, int bottom); + void getContentsMargins(int *left, int *top, int *right, int *bottom) const; + QRect contentsRect() const; + void setContentsMargins(const QMargins &margins); + QMargins contentsMargins() const; + virtual QSizePolicy::ControlTypes controlTypes() const; + virtual QLayoutItem *replaceWidget(QWidget *from, QWidget *to /Transfer/, Qt::FindChildOptions options = Qt::FindChildrenRecursively); +%If (Qt_6_1_0 -) + void unsetContentsMargins(); +%End +}; diff --git a/sip/QtWidgets/qlayoutitem.sip b/sip/QtWidgets/qlayoutitem.sip new file mode 100644 index 0000000..df41eed --- /dev/null +++ b/sip/QtWidgets/qlayoutitem.sip @@ -0,0 +1,117 @@ +// qlayoutitem.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLayoutItem /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + if (sipCpp->widget()) + { + sipType = sipType_QWidgetItem; + } + else if (sipCpp->spacerItem()) + { + sipType = sipType_QSpacerItem; + } + else + { + // Switch to the QObject convertor. + *sipCppRet = sipCpp->layout(); + sipType = sipType_QObject; + } +%End + +public: + explicit QLayoutItem(Qt::Alignment alignment = Qt::Alignment()); + virtual ~QLayoutItem(); + virtual QSize sizeHint() const = 0; + virtual QSize minimumSize() const = 0; + virtual QSize maximumSize() const = 0; + virtual Qt::Orientations expandingDirections() const = 0; + virtual void setGeometry(const QRect &) = 0; + virtual QRect geometry() const = 0; + virtual bool isEmpty() const = 0; + virtual bool hasHeightForWidth() const; + virtual int heightForWidth(int) const; + virtual int minimumHeightForWidth(int) const; + virtual void invalidate(); + virtual QWidget *widget() const; + virtual QLayout *layout(); + virtual QSpacerItem *spacerItem(); + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment a); + virtual QSizePolicy::ControlTypes controlTypes() const; +}; + +class QSpacerItem : QLayoutItem +{ +%TypeHeaderCode +#include +%End + +public: + QSpacerItem(int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum); + virtual ~QSpacerItem(); + void changeSize(int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum); + virtual QSize sizeHint() const; + virtual QSize minimumSize() const; + virtual QSize maximumSize() const; + virtual Qt::Orientations expandingDirections() const; + virtual bool isEmpty() const; + virtual void setGeometry(const QRect &); + virtual QRect geometry() const; + virtual QSpacerItem *spacerItem(); + QSizePolicy sizePolicy() const; +}; + +class QWidgetItem : QLayoutItem +{ +%TypeHeaderCode +#include +%End + +public: + explicit QWidgetItem(QWidget *w); + virtual ~QWidgetItem(); + virtual QSize sizeHint() const; + virtual QSize minimumSize() const; + virtual QSize maximumSize() const; + virtual Qt::Orientations expandingDirections() const; + virtual bool isEmpty() const; + virtual void setGeometry(const QRect &); + virtual QRect geometry() const; + virtual QWidget *widget() const; + virtual bool hasHeightForWidth() const; + virtual int heightForWidth(int) const; + virtual QSizePolicy::ControlTypes controlTypes() const; + +private: + QWidgetItem(const QWidgetItem &); + +public: +%If (Qt_6_2_0 -) + virtual int minimumHeightForWidth(int) const; +%End +}; diff --git a/sip/QtWidgets/qlcdnumber.sip b/sip/QtWidgets/qlcdnumber.sip new file mode 100644 index 0000000..b5ef04e --- /dev/null +++ b/sip/QtWidgets/qlcdnumber.sip @@ -0,0 +1,82 @@ +// qlcdnumber.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLCDNumber : QFrame +{ +%TypeHeaderCode +#include +%End + +public: + explicit QLCDNumber(QWidget *parent /TransferThis/ = 0); + QLCDNumber(uint numDigits, QWidget *parent /TransferThis/ = 0); + virtual ~QLCDNumber(); + + enum Mode + { + Hex, + Dec, + Oct, + Bin, + }; + + enum SegmentStyle + { + Outline, + Filled, + Flat, + }; + + bool smallDecimalPoint() const; + int digitCount() const; + void setDigitCount(int nDigits); + void setNumDigits(int nDigits); +%MethodCode + // This is implemented for Qt v5 so that .ui files created with Designer for Qt v4 will continue to work. + sipCpp->setDigitCount(a0); +%End + + bool checkOverflow(double num /Constrained/) const; + bool checkOverflow(int num) const; + QLCDNumber::Mode mode() const; + void setMode(QLCDNumber::Mode); + QLCDNumber::SegmentStyle segmentStyle() const; + void setSegmentStyle(QLCDNumber::SegmentStyle); + double value() const; + int intValue() const; + virtual QSize sizeHint() const; + void display(const QString &str); + void display(double num /Constrained/); + void display(int num); + void setHexMode(); + void setDecMode(); + void setOctMode(); + void setBinMode(); + void setSmallDecimalPoint(bool); + +signals: + void overflow(); + +protected: + virtual bool event(QEvent *e); + virtual void paintEvent(QPaintEvent *); +}; diff --git a/sip/QtWidgets/qlineedit.sip b/sip/QtWidgets/qlineedit.sip new file mode 100644 index 0000000..ccdc12d --- /dev/null +++ b/sip/QtWidgets/qlineedit.sip @@ -0,0 +1,153 @@ +// qlineedit.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QLineEdit : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QLineEdit(QWidget *parent /TransferThis/ = 0); + QLineEdit(const QString &contents, QWidget *parent /TransferThis/ = 0); + virtual ~QLineEdit(); + QString text() const; + QString displayText() const; + int maxLength() const; + void setMaxLength(int); + void setFrame(bool); + bool hasFrame() const; + + enum EchoMode + { + Normal, + NoEcho, + Password, + PasswordEchoOnEdit, + }; + + QLineEdit::EchoMode echoMode() const; + void setEchoMode(QLineEdit::EchoMode); + bool isReadOnly() const; + void setReadOnly(bool); + void setValidator(const QValidator * /KeepReference/); + const QValidator *validator() const; + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + int cursorPosition() const; + void setCursorPosition(int); + int cursorPositionAt(const QPoint &pos); + void setAlignment(Qt::Alignment flag); + Qt::Alignment alignment() const; + void cursorForward(bool mark, int steps = 1); + void cursorBackward(bool mark, int steps = 1); + void cursorWordForward(bool mark); + void cursorWordBackward(bool mark); + void backspace(); + void del(); + void home(bool mark); + void end(bool mark); + bool isModified() const; + void setModified(bool); + void setSelection(int, int); + bool hasSelectedText() const; + QString selectedText() const; + int selectionStart() const; + bool isUndoAvailable() const; + bool isRedoAvailable() const; + void setDragEnabled(bool b); + bool dragEnabled() const; + QString inputMask() const; + void setInputMask(const QString &inputMask); + bool hasAcceptableInput() const; + void setText(const QString &); + void clear(); + void selectAll(); + void undo(); + void redo(); + void cut(); + void copy() const; + void paste(); + void deselect(); + void insert(const QString &); + QMenu *createStandardContextMenu() /Factory/; + +signals: + void textChanged(const QString &); + void textEdited(const QString &); + void cursorPositionChanged(int, int); + void returnPressed(); + void editingFinished(); + void selectionChanged(); + +protected: + virtual void initStyleOption(QStyleOptionFrame *option) const; + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual void focusOutEvent(QFocusEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void dragEnterEvent(QDragEnterEvent *); + virtual void dragMoveEvent(QDragMoveEvent *e); + virtual void dragLeaveEvent(QDragLeaveEvent *e); + virtual void dropEvent(QDropEvent *); + virtual void changeEvent(QEvent *); + virtual void contextMenuEvent(QContextMenuEvent *); + virtual void inputMethodEvent(QInputMethodEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + QRect cursorRect() const; + +public: + virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; + virtual bool event(QEvent *); + virtual void timerEvent(QTimerEvent *); + void setCompleter(QCompleter *completer /KeepReference/); + QCompleter *completer() const; + void setTextMargins(int left, int top, int right, int bottom); + void setTextMargins(const QMargins &margins); + QMargins textMargins() const; + QString placeholderText() const; + void setPlaceholderText(const QString &); + void setCursorMoveStyle(Qt::CursorMoveStyle style); + Qt::CursorMoveStyle cursorMoveStyle() const; + + enum ActionPosition + { + LeadingPosition, + TrailingPosition, + }; + + void setClearButtonEnabled(bool enable); + bool isClearButtonEnabled() const; + void addAction(QAction *); + void addAction(QAction *action, QLineEdit::ActionPosition position); + QAction *addAction(const QIcon &icon, QLineEdit::ActionPosition position) /Transfer/; + QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const; + int selectionEnd() const; + int selectionLength() const; + +signals: + void inputRejected(); +}; diff --git a/sip/QtWidgets/qlistview.sip b/sip/QtWidgets/qlistview.sip new file mode 100644 index 0000000..3c778f3 --- /dev/null +++ b/sip/QtWidgets/qlistview.sip @@ -0,0 +1,139 @@ +// qlistview.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QListView : QAbstractItemView +{ +%TypeHeaderCode +#include +%End + +public: + enum Movement + { + Static, + Free, + Snap, + }; + + enum Flow + { + LeftToRight, + TopToBottom, + }; + + enum ResizeMode + { + Fixed, + Adjust, + }; + + enum LayoutMode + { + SinglePass, + Batched, + }; + + enum ViewMode + { + ListMode, + IconMode, + }; + + explicit QListView(QWidget *parent /TransferThis/ = 0); + virtual ~QListView(); + void setMovement(QListView::Movement movement); + QListView::Movement movement() const; + void setFlow(QListView::Flow flow); + QListView::Flow flow() const; + void setWrapping(bool enable); + bool isWrapping() const; + void setResizeMode(QListView::ResizeMode mode); + QListView::ResizeMode resizeMode() const; + void setLayoutMode(QListView::LayoutMode mode); + QListView::LayoutMode layoutMode() const; + void setSpacing(int space); + int spacing() const; + void setGridSize(const QSize &size); + QSize gridSize() const; + void setViewMode(QListView::ViewMode mode); + QListView::ViewMode viewMode() const; + void clearPropertyFlags(); + bool isRowHidden(int row) const; + void setRowHidden(int row, bool hide); + void setModelColumn(int column); + int modelColumn() const; + void setUniformItemSizes(bool enable); + bool uniformItemSizes() const; + virtual QRect visualRect(const QModelIndex &index) const; + virtual void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible); + virtual QModelIndex indexAt(const QPoint &p) const; + virtual void reset(); + virtual void setRootIndex(const QModelIndex &index); + +signals: + void indexesMoved(const QModelIndexList &indexes); + +protected: + virtual void scrollContentsBy(int dx, int dy); + virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList &roles = QList()); + virtual void rowsInserted(const QModelIndex &parent, int start, int end); + virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + virtual bool event(QEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void timerEvent(QTimerEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual void dragMoveEvent(QDragMoveEvent *e); + virtual void dragLeaveEvent(QDragLeaveEvent *e); + virtual void dropEvent(QDropEvent *e); + virtual void wheelEvent(QWheelEvent *e); + virtual void startDrag(Qt::DropActions supportedActions); + virtual void paintEvent(QPaintEvent *e); + virtual int horizontalOffset() const; + virtual int verticalOffset() const; + virtual QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + QRect rectForIndex(const QModelIndex &index) const; + void setPositionForIndex(const QPoint &position, const QModelIndex &index); + virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command); + virtual QRegion visualRegionForSelection(const QItemSelection &selection) const; + virtual QModelIndexList selectedIndexes() const; + virtual void updateGeometries(); + virtual bool isIndexHidden(const QModelIndex &index) const; + virtual QSize viewportSizeHint() const; + +public: + void setBatchSize(int batchSize); + int batchSize() const; + void setWordWrap(bool on); + bool wordWrap() const; + void setSelectionRectVisible(bool show); + bool isSelectionRectVisible() const; + +protected: + virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + virtual void initViewItemOption(QStyleOptionViewItem *option) const; + +public: + void setItemAlignment(Qt::Alignment alignment); + Qt::Alignment itemAlignment() const; +}; diff --git a/sip/QtWidgets/qlistwidget.sip b/sip/QtWidgets/qlistwidget.sip new file mode 100644 index 0000000..0867efa --- /dev/null +++ b/sip/QtWidgets/qlistwidget.sip @@ -0,0 +1,195 @@ +// qlistwidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QListWidgetItem /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + enum ItemType /BaseType=IntEnum/ + { + Type, + UserType, + }; + + QListWidgetItem(QListWidget *parent /TransferThis/ = 0, int type = QListWidgetItem::Type); + QListWidgetItem(const QString &text, QListWidget *parent /TransferThis/ = 0, int type = QListWidgetItem::Type); + QListWidgetItem(const QIcon &icon, const QString &text, QListWidget *parent /TransferThis/ = 0, int type = QListWidgetItem::Type); + QListWidgetItem(const QListWidgetItem &other); + virtual ~QListWidgetItem(); + virtual QListWidgetItem *clone() const /Factory/; + QListWidget *listWidget() const; + Qt::ItemFlags flags() const; + QString text() const; + QIcon icon() const; + QString statusTip() const; + QString toolTip() const; + QString whatsThis() const; + QFont font() const; + int textAlignment() const; +%If (Qt_6_4_0 -) + void setTextAlignment(Qt::Alignment alignment); +%End + void setTextAlignment(int alignment); + Qt::CheckState checkState() const; + void setCheckState(Qt::CheckState state); + QSize sizeHint() const; + void setSizeHint(const QSize &size); + virtual QVariant data(int role) const; + virtual void setData(int role, const QVariant &value); + virtual bool operator<(const QListWidgetItem &other /NoCopy/) const; + virtual void read(QDataStream &in) /ReleaseGIL/; + virtual void write(QDataStream &out) const /ReleaseGIL/; + int type() const; + void setFlags(Qt::ItemFlags aflags); + void setText(const QString &atext); + void setIcon(const QIcon &aicon); + void setStatusTip(const QString &astatusTip); + void setToolTip(const QString &atoolTip); + void setWhatsThis(const QString &awhatsThis); + void setFont(const QFont &afont); + QBrush background() const; + void setBackground(const QBrush &brush); + QBrush foreground() const; + void setForeground(const QBrush &brush); + void setSelected(bool aselect); + bool isSelected() const; + void setHidden(bool ahide); + bool isHidden() const; + +private: + QListWidgetItem &operator=(const QListWidgetItem &); +}; + +QDataStream &operator<<(QDataStream &out, const QListWidgetItem &item) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &in, QListWidgetItem &item /Constrained/) /ReleaseGIL/; + +class QListWidget : QListView +{ +%TypeHeaderCode +#include +%End + +public: + explicit QListWidget(QWidget *parent /TransferThis/ = 0); + virtual ~QListWidget(); + QListWidgetItem *item(int row) const; + int row(const QListWidgetItem *item) const; + void insertItem(int row, QListWidgetItem *item /Transfer/); + void insertItem(int row, const QString &label); + void insertItems(int row, const QStringList &labels); + void addItem(QListWidgetItem *aitem /Transfer/); + void addItem(const QString &label); + void addItems(const QStringList &labels); + QListWidgetItem *takeItem(int row) /TransferBack/; + int count() const /__len__/; + QListWidgetItem *currentItem() const; + void setCurrentItem(QListWidgetItem *item); + void setCurrentItem(QListWidgetItem *item, QItemSelectionModel::SelectionFlags command); + int currentRow() const; + void setCurrentRow(int row); + void setCurrentRow(int row, QItemSelectionModel::SelectionFlags command); + QListWidgetItem *itemAt(const QPoint &p) const; + QListWidgetItem *itemAt(int ax, int ay) const; + QWidget *itemWidget(QListWidgetItem *item) const; + void setItemWidget(QListWidgetItem *item, QWidget *widget /Transfer/); +%MethodCode + // We have to break the association with any existing widget. + QWidget *w = sipCpp->itemWidget(a0); + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QWidget); + + if (wo) + sipTransferTo(wo, 0); + } + + Py_BEGIN_ALLOW_THREADS + sipCpp->setItemWidget(a0, a1); + Py_END_ALLOW_THREADS +%End + + QRect visualItemRect(const QListWidgetItem *item) const; + void sortItems(Qt::SortOrder order = Qt::AscendingOrder); + void editItem(QListWidgetItem *item); + void openPersistentEditor(QListWidgetItem *item); + void closePersistentEditor(QListWidgetItem *item); + QList selectedItems() const; + QList findItems(const QString &text, Qt::MatchFlags flags) const; + +public slots: + void clear(); + void scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible); + +signals: + void itemPressed(QListWidgetItem *item); + void itemClicked(QListWidgetItem *item); + void itemDoubleClicked(QListWidgetItem *item); + void itemActivated(QListWidgetItem *item); + void itemEntered(QListWidgetItem *item); + void itemChanged(QListWidgetItem *item); + void currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous); + void currentTextChanged(const QString ¤tText); + void currentRowChanged(int currentRow); + void itemSelectionChanged(); + +protected: + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QList &items) const /TransferBack/; + virtual bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action); + virtual Qt::DropActions supportedDropActions() const; + virtual bool event(QEvent *e); + virtual void dropEvent(QDropEvent *event); + +public: + QList items(const QMimeData *data) const; + QModelIndex indexFromItem(const QListWidgetItem *item) const; + QListWidgetItem *itemFromIndex(const QModelIndex &index) const; + void setSortingEnabled(bool enable); + bool isSortingEnabled() const; + void removeItemWidget(QListWidgetItem *aItem); +%MethodCode + // We have to break the association with any existing widget. + QWidget *w = sipCpp->itemWidget(a0); + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QWidget); + + if (wo) + sipTransferTo(wo, 0); + } + + Py_BEGIN_ALLOW_THREADS + sipCpp->removeItemWidget(a0); + Py_END_ALLOW_THREADS +%End + + virtual void setSelectionModel(QItemSelectionModel *selectionModel); + bool isPersistentEditorOpen(QListWidgetItem *item) const; + +private: + virtual void setModel(QAbstractItemModel *model /KeepReference/); +}; diff --git a/sip/QtWidgets/qmainwindow.sip b/sip/QtWidgets/qmainwindow.sip new file mode 100644 index 0000000..905c822 --- /dev/null +++ b/sip/QtWidgets/qmainwindow.sip @@ -0,0 +1,109 @@ +// qmainwindow.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMainWindow : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QMainWindow(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QMainWindow(); + QSize iconSize() const; + void setIconSize(const QSize &iconSize); + Qt::ToolButtonStyle toolButtonStyle() const; + void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle); + QMenuBar *menuBar() const /Transfer/; + void setMenuBar(QMenuBar *menubar /Transfer/); + QStatusBar *statusBar() const /Transfer/; + void setStatusBar(QStatusBar *statusbar /Transfer/); + QWidget *centralWidget() const; + void setCentralWidget(QWidget *widget /Transfer/); + void setCorner(Qt::Corner corner, Qt::DockWidgetArea area); + Qt::DockWidgetArea corner(Qt::Corner corner) const; + void addToolBarBreak(Qt::ToolBarArea area = Qt::TopToolBarArea); + void insertToolBarBreak(QToolBar *before); + void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar /Transfer/); + void addToolBar(QToolBar *toolbar /Transfer/); + QToolBar *addToolBar(const QString &title) /Transfer/; + void insertToolBar(QToolBar *before, QToolBar *toolbar /Transfer/); + void removeToolBar(QToolBar *toolbar); + Qt::ToolBarArea toolBarArea(const QToolBar *toolbar) const; + void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget /Transfer/); + void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget /Transfer/, Qt::Orientation orientation); + void splitDockWidget(QDockWidget *after, QDockWidget *dockwidget /Transfer/, Qt::Orientation orientation); + void removeDockWidget(QDockWidget *dockwidget /TransferBack/); + Qt::DockWidgetArea dockWidgetArea(QDockWidget *dockwidget) const; + QByteArray saveState(int version = 0) const; + bool restoreState(const QByteArray &state, int version = 0); + virtual QMenu *createPopupMenu(); + +public slots: + void setAnimated(bool enabled); + void setDockNestingEnabled(bool enabled); + +signals: + void iconSizeChanged(const QSize &iconSize); + void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle); + void tabifiedDockWidgetActivated(QDockWidget *dockWidget); + +protected: + virtual void contextMenuEvent(QContextMenuEvent *event); + virtual bool event(QEvent *event); + +public: + bool isAnimated() const; + bool isDockNestingEnabled() const; + bool isSeparator(const QPoint &pos) const; + QWidget *menuWidget() const; + void setMenuWidget(QWidget *menubar /Transfer/); + void tabifyDockWidget(QDockWidget *first, QDockWidget *second); + + enum DockOption /BaseType=Flag/ + { + AnimatedDocks, + AllowNestedDocks, + AllowTabbedDocks, + ForceTabbedDocks, + VerticalTabs, + GroupedDragging, + }; + + typedef QFlags DockOptions; + void setDockOptions(QMainWindow::DockOptions options); + QMainWindow::DockOptions dockOptions() const; + void removeToolBarBreak(QToolBar *before); + bool toolBarBreak(QToolBar *toolbar) const; + void setUnifiedTitleAndToolBarOnMac(bool set); + bool unifiedTitleAndToolBarOnMac() const; + bool restoreDockWidget(QDockWidget *dockwidget); + bool documentMode() const; + void setDocumentMode(bool enabled); + QTabWidget::TabShape tabShape() const; + void setTabShape(QTabWidget::TabShape tabShape); + QTabWidget::TabPosition tabPosition(Qt::DockWidgetArea area) const; + void setTabPosition(Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition); + QList tabifiedDockWidgets(QDockWidget *dockwidget) const; + QWidget *takeCentralWidget() /TransferBack/; + void resizeDocks(const QList &docks, const QList &sizes, Qt::Orientation orientation); +}; diff --git a/sip/QtWidgets/qmdiarea.sip b/sip/QtWidgets/qmdiarea.sip new file mode 100644 index 0000000..a84960e --- /dev/null +++ b/sip/QtWidgets/qmdiarea.sip @@ -0,0 +1,125 @@ +// qmdiarea.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMdiArea : QAbstractScrollArea +{ +%TypeHeaderCode +#include +%End + +public: + enum AreaOption /BaseType=Flag/ + { + DontMaximizeSubWindowOnActivation, + }; + + typedef QFlags AreaOptions; + + enum ViewMode + { + SubWindowView, + TabbedView, + }; + + enum WindowOrder + { + CreationOrder, + StackingOrder, + ActivationHistoryOrder, + }; + + QMdiArea(QWidget *parent /TransferThis/ = 0); + virtual ~QMdiArea(); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + QMdiSubWindow *activeSubWindow() const; + QMdiSubWindow *addSubWindow(QWidget *widget /Transfer/, Qt::WindowFlags flags = Qt::WindowFlags()); + QList subWindowList(QMdiArea::WindowOrder order = QMdiArea::CreationOrder) const; + QMdiSubWindow *currentSubWindow() const; + void removeSubWindow(QWidget *widget /GetWrapper/); +%MethodCode + // We need to implement /TransferBack/ on the argument, but it might be the + // QMdiSubWindow that wraps the widget we are really after. + QMdiSubWindow *swin = qobject_cast(a0); + + if (swin) + { + QWidget *w = swin->widget(); + + a0Wrapper = (w ? sipGetPyObject(w, sipType_QWidget) : 0); + } + else + a0Wrapper = 0; + + Py_BEGIN_ALLOW_THREADS + sipCpp->removeSubWindow(a0); + Py_END_ALLOW_THREADS + + if (a0Wrapper) + sipTransferBack(a0Wrapper); +%End + + QBrush background() const; + void setBackground(const QBrush &background); + void setOption(QMdiArea::AreaOption option, bool on = true); + bool testOption(QMdiArea::AreaOption opton) const; + +signals: + void subWindowActivated(QMdiSubWindow *); + +public slots: + void setActiveSubWindow(QMdiSubWindow *window); + void tileSubWindows(); + void cascadeSubWindows(); + void closeActiveSubWindow(); + void closeAllSubWindows(); + void activateNextSubWindow(); + void activatePreviousSubWindow(); + +protected: + virtual void setupViewport(QWidget *viewport); + virtual bool event(QEvent *event); + virtual bool eventFilter(QObject *object, QEvent *event); + virtual void paintEvent(QPaintEvent *paintEvent); + virtual void childEvent(QChildEvent *childEvent); + virtual void resizeEvent(QResizeEvent *resizeEvent); + virtual void timerEvent(QTimerEvent *timerEvent); + virtual void showEvent(QShowEvent *showEvent); + virtual bool viewportEvent(QEvent *event); + virtual void scrollContentsBy(int dx, int dy); + +public: + QMdiArea::WindowOrder activationOrder() const; + void setActivationOrder(QMdiArea::WindowOrder order); + void setViewMode(QMdiArea::ViewMode mode); + QMdiArea::ViewMode viewMode() const; + void setTabShape(QTabWidget::TabShape shape); + QTabWidget::TabShape tabShape() const; + void setTabPosition(QTabWidget::TabPosition position); + QTabWidget::TabPosition tabPosition() const; + bool documentMode() const; + void setDocumentMode(bool enabled); + void setTabsClosable(bool closable); + bool tabsClosable() const; + void setTabsMovable(bool movable); + bool tabsMovable() const; +}; diff --git a/sip/QtWidgets/qmdisubwindow.sip b/sip/QtWidgets/qmdisubwindow.sip new file mode 100644 index 0000000..88dfc25 --- /dev/null +++ b/sip/QtWidgets/qmdisubwindow.sip @@ -0,0 +1,117 @@ +// qmdisubwindow.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMdiSubWindow : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + enum SubWindowOption /BaseType=Flag/ + { + RubberBandResize, + RubberBandMove, + }; + + typedef QFlags SubWindowOptions; + QMdiSubWindow(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QMdiSubWindow(); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + void setWidget(QWidget *widget /Transfer/); +%MethodCode + // We have to implement /TransferBack/ on any existing widget. + QWidget *w = sipCpp->widget(); + + Py_BEGIN_ALLOW_THREADS + sipCpp->setWidget(a0); + Py_END_ALLOW_THREADS + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QWidget); + + if (wo) + sipTransferBack(wo); + } +%End + + QWidget *widget() const; + bool isShaded() const; + void setOption(QMdiSubWindow::SubWindowOption option, bool on = true); + bool testOption(QMdiSubWindow::SubWindowOption) const; + void setKeyboardSingleStep(int step); + int keyboardSingleStep() const; + void setKeyboardPageStep(int step); + int keyboardPageStep() const; + void setSystemMenu(QMenu *systemMenu /Transfer/); +%MethodCode + // We have to break the parent association on any existing menu. + QMenu *w = sipCpp->systemMenu(); + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QMenu); + + if (wo) + sipTransferTo(wo, 0); + } + + Py_BEGIN_ALLOW_THREADS + sipCpp->setSystemMenu(a0); + Py_END_ALLOW_THREADS +%End + + QMenu *systemMenu() const; + QMdiArea *mdiArea() const; + +signals: + void windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState); + void aboutToActivate(); + +public slots: + void showSystemMenu(); + void showShaded(); + +protected: + virtual bool eventFilter(QObject *object, QEvent *event); + virtual bool event(QEvent *event); + virtual void showEvent(QShowEvent *showEvent); + virtual void hideEvent(QHideEvent *hideEvent); + virtual void changeEvent(QEvent *changeEvent); + virtual void closeEvent(QCloseEvent *closeEvent); + virtual void leaveEvent(QEvent *leaveEvent); + virtual void resizeEvent(QResizeEvent *resizeEvent); + virtual void timerEvent(QTimerEvent *timerEvent); + virtual void moveEvent(QMoveEvent *moveEvent); + virtual void paintEvent(QPaintEvent *paintEvent); + virtual void mousePressEvent(QMouseEvent *mouseEvent); + virtual void mouseDoubleClickEvent(QMouseEvent *mouseEvent); + virtual void mouseReleaseEvent(QMouseEvent *mouseEvent); + virtual void mouseMoveEvent(QMouseEvent *mouseEvent); + virtual void keyPressEvent(QKeyEvent *keyEvent); + virtual void contextMenuEvent(QContextMenuEvent *contextMenuEvent); + virtual void focusInEvent(QFocusEvent *focusInEvent); + virtual void focusOutEvent(QFocusEvent *focusOutEvent); + virtual void childEvent(QChildEvent *childEvent); +}; diff --git a/sip/QtWidgets/qmenu.sip b/sip/QtWidgets/qmenu.sip new file mode 100644 index 0000000..70bfe75 --- /dev/null +++ b/sip/QtWidgets/qmenu.sip @@ -0,0 +1,147 @@ +// qmenu.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMenu : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QMenu(QWidget *parent /TransferThis/ = 0); + QMenu(const QString &title, QWidget *parent /TransferThis/ = 0); + virtual ~QMenu(); +%If (- Qt_6_3_0) + void addAction(QAction *); +%End +%If (- Qt_6_3_0) + QAction *addAction(const QString &text) /Transfer/; +%End +%If (- Qt_6_3_0) + QAction *addAction(const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, const QKeySequence &shortcut = 0) /Transfer/; +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a1, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipRes = sipCpp->addAction(*a0, receiver, slot_signature.constData(), *a2); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(1, a1); + } +%End + +%End +%If (- Qt_6_3_0) + QAction *addAction(const QIcon &icon, const QString &text) /Transfer/; +%End +%If (- Qt_6_3_0) + QAction *addAction(const QIcon &icon, const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, const QKeySequence &shortcut = 0) /Transfer/; +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a2, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipRes = sipCpp->addAction(*a0, *a1, receiver, slot_signature.constData(), *a3); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(2, a2); + } +%End + +%End + QAction *addMenu(QMenu *menu); + QMenu *addMenu(const QString &title) /Transfer/; + QMenu *addMenu(const QIcon &icon, const QString &title) /Transfer/; + QAction *addSeparator() /Transfer/; + QAction *insertMenu(QAction *before, QMenu *menu); + QAction *insertSeparator(QAction *before) /Transfer/; + void clear(); + void setTearOffEnabled(bool); + bool isTearOffEnabled() const; + bool isTearOffMenuVisible() const; + void hideTearOffMenu(); + void setDefaultAction(QAction * /KeepReference/); + QAction *defaultAction() const; + void setActiveAction(QAction *act); + QAction *activeAction() const; + void popup(const QPoint &p, QAction *action = 0); + QAction *exec() /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; + QAction *exec(const QPoint &p, QAction *action = 0) /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; + static QAction *exec(const QList &actions, const QPoint &pos, QAction *at = 0, QWidget *parent = 0) /PostHook=__pyQtPostEventLoopHook__,PreHook=__pyQtPreEventLoopHook__,ReleaseGIL/; + virtual QSize sizeHint() const; + QRect actionGeometry(QAction *) const; + QAction *actionAt(const QPoint &) const; + QAction *menuAction() const; + QString title() const; + void setTitle(const QString &title); + QIcon icon() const; + void setIcon(const QIcon &icon); + void setNoReplayFor(QWidget *widget); + +signals: + void aboutToHide(); + void aboutToShow(); + void hovered(QAction *action); + void triggered(QAction *action); + +protected: + int columnCount() const; + virtual void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; + virtual void changeEvent(QEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void wheelEvent(QWheelEvent *); + virtual void enterEvent(QEnterEvent *); + virtual void leaveEvent(QEvent *); + virtual void hideEvent(QHideEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void actionEvent(QActionEvent *); + virtual void timerEvent(QTimerEvent *); + virtual bool event(QEvent *); + virtual bool focusNextPrevChild(bool next); + +public: + bool isEmpty() const; + bool separatorsCollapsible() const; + void setSeparatorsCollapsible(bool collapse); + QAction *addSection(const QString &text) /Transfer/; + QAction *addSection(const QIcon &icon, const QString &text) /Transfer/; + QAction *insertSection(QAction *before, const QString &text) /Transfer/; + QAction *insertSection(QAction *before, const QIcon &icon, const QString &text) /Transfer/; + bool toolTipsVisible() const; + void setToolTipsVisible(bool visible); +%If (macOS) + void setAsDockMenu(); +%End + void showTearOffMenu(); + void showTearOffMenu(const QPoint &pos); +%If (Qt_6_3_0 -) + static QMenu *menuInAction(const QAction *action); +%End +}; diff --git a/sip/QtWidgets/qmenubar.sip b/sip/QtWidgets/qmenubar.sip new file mode 100644 index 0000000..f6edb36 --- /dev/null +++ b/sip/QtWidgets/qmenubar.sip @@ -0,0 +1,99 @@ +// qmenubar.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMenuBar : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QMenuBar(QWidget *parent /TransferThis/ = 0); + virtual ~QMenuBar(); +%If (- Qt_6_3_0) + void addAction(QAction *); +%End +%If (- Qt_6_3_0) + QAction *addAction(const QString &text) /Transfer/; +%End +%If (- Qt_6_3_0) + QAction *addAction(const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /Transfer/; +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a1, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipRes = sipCpp->addAction(*a0, receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(1, a1); + } +%End + +%End + QAction *addMenu(QMenu *menu); + QMenu *addMenu(const QString &title) /Transfer/; + QMenu *addMenu(const QIcon &icon, const QString &title) /Transfer/; + QAction *addSeparator() /Transfer/; + QAction *insertMenu(QAction *before, QMenu *menu); + QAction *insertSeparator(QAction *before) /Transfer/; + void clear(); + QAction *activeAction() const; + void setActiveAction(QAction *action); + void setDefaultUp(bool); + bool isDefaultUp() const; + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + virtual int heightForWidth(int) const; + QRect actionGeometry(QAction *) const; + QAction *actionAt(const QPoint &) const; + void setCornerWidget(QWidget *widget /Transfer/, Qt::Corner corner = Qt::TopRightCorner); + QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const; + virtual void setVisible(bool visible); + +signals: + void triggered(QAction *action); + void hovered(QAction *action); + +protected: + virtual void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; + virtual void changeEvent(QEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void leaveEvent(QEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void actionEvent(QActionEvent *); + virtual void focusOutEvent(QFocusEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual bool eventFilter(QObject *, QEvent *); + virtual bool event(QEvent *); + virtual void timerEvent(QTimerEvent *); + +public: + bool isNativeMenuBar() const; + void setNativeMenuBar(bool nativeMenuBar); +}; diff --git a/sip/QtWidgets/qmessagebox.sip b/sip/QtWidgets/qmessagebox.sip new file mode 100644 index 0000000..c4e7ead --- /dev/null +++ b/sip/QtWidgets/qmessagebox.sip @@ -0,0 +1,162 @@ +// qmessagebox.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QMessageBox : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + enum ButtonRole + { + InvalidRole, + AcceptRole, + RejectRole, + DestructiveRole, + ActionRole, + HelpRole, + YesRole, + NoRole, + ResetRole, + ApplyRole, + }; + + enum Icon + { + NoIcon, + Information, + Warning, + Critical, + Question, + }; + + enum StandardButton /BaseType=IntFlag/ + { + NoButton, + Ok, + Save, + SaveAll, + Open, + Yes, + YesToAll, + No, + NoToAll, + Abort, + Retry, + Ignore, + Close, + Cancel, + Discard, + Help, + Apply, + Reset, + RestoreDefaults, + FirstButton, + LastButton, + YesAll, + NoAll, + Default, + Escape, + FlagMask, + ButtonMask, + }; + + typedef QFlags StandardButtons; + typedef QMessageBox::StandardButton Button; + explicit QMessageBox(QWidget *parent /TransferThis/ = 0); + QMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::NoButton, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); + virtual ~QMessageBox(); + QString text() const; + void setText(const QString &); + QMessageBox::Icon icon() const; + void setIcon(QMessageBox::Icon); + QPixmap iconPixmap() const; + void setIconPixmap(const QPixmap &); + Qt::TextFormat textFormat() const; + void setTextFormat(Qt::TextFormat); + static QMessageBox::StandardButton information(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) /ReleaseGIL/; + static QMessageBox::StandardButton question(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::StandardButtons(QMessageBox::Yes | QMessageBox::No), QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) /ReleaseGIL/; + static QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) /ReleaseGIL/; + static QMessageBox::StandardButton critical(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) /ReleaseGIL/; + static void about(QWidget *parent, const QString &caption, const QString &text) /ReleaseGIL/; + static void aboutQt(QWidget *parent, const QString &title = QString()) /ReleaseGIL/; + static QPixmap standardIcon(QMessageBox::Icon icon); + +protected: + virtual bool event(QEvent *e); + virtual void resizeEvent(QResizeEvent *); + virtual void showEvent(QShowEvent *); + virtual void closeEvent(QCloseEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void changeEvent(QEvent *); + +public: + void addButton(QAbstractButton *button /Transfer/, QMessageBox::ButtonRole role); + QPushButton *addButton(const QString &text, QMessageBox::ButtonRole role) /Transfer/; + QPushButton *addButton(QMessageBox::StandardButton button) /Transfer/; + void removeButton(QAbstractButton *button /TransferBack/); + void setStandardButtons(QMessageBox::StandardButtons buttons); + QMessageBox::StandardButtons standardButtons() const; + QMessageBox::StandardButton standardButton(QAbstractButton *button) const; + QAbstractButton *button(QMessageBox::StandardButton which) const; + QPushButton *defaultButton() const; + void setDefaultButton(QPushButton *button /KeepReference/); + void setDefaultButton(QMessageBox::StandardButton button); + QAbstractButton *escapeButton() const; + void setEscapeButton(QAbstractButton *button /KeepReference/); + void setEscapeButton(QMessageBox::StandardButton button); + QAbstractButton *clickedButton() const; + QString informativeText() const; + void setInformativeText(const QString &text); + QString detailedText() const; + void setDetailedText(const QString &text); + void setWindowTitle(const QString &title); + void setWindowModality(Qt::WindowModality windowModality); + virtual void open(); + void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipCpp->open(receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End + + QList buttons() const; + QMessageBox::ButtonRole buttonRole(QAbstractButton *button) const; + +signals: + void buttonClicked(QAbstractButton *button); + +public: + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + void setCheckBox(QCheckBox *cb); + QCheckBox *checkBox() const; +}; diff --git a/sip/QtWidgets/qplaintextedit.sip b/sip/QtWidgets/qplaintextedit.sip new file mode 100644 index 0000000..48129f5 --- /dev/null +++ b/sip/QtWidgets/qplaintextedit.sip @@ -0,0 +1,189 @@ +// qplaintextedit.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPlainTextEdit : QAbstractScrollArea +{ +%TypeHeaderCode +#include +%End + +public: + enum LineWrapMode + { + NoWrap, + WidgetWidth, + }; + + explicit QPlainTextEdit(QWidget *parent /TransferThis/ = 0); + QPlainTextEdit(const QString &text, QWidget *parent /TransferThis/ = 0); + virtual ~QPlainTextEdit(); + void setDocument(QTextDocument *document /KeepReference/); + QTextDocument *document() const; + void setTextCursor(const QTextCursor &cursor); + QTextCursor textCursor() const; + bool isReadOnly() const; + void setReadOnly(bool ro); + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + void mergeCurrentCharFormat(const QTextCharFormat &modifier); + void setCurrentCharFormat(const QTextCharFormat &format); + QTextCharFormat currentCharFormat() const; + bool tabChangesFocus() const; + void setTabChangesFocus(bool b); + void setDocumentTitle(const QString &title); + QString documentTitle() const; + bool isUndoRedoEnabled() const; + void setUndoRedoEnabled(bool enable); + void setMaximumBlockCount(int maximum); + int maximumBlockCount() const; + QPlainTextEdit::LineWrapMode lineWrapMode() const; + void setLineWrapMode(QPlainTextEdit::LineWrapMode mode); + QTextOption::WrapMode wordWrapMode() const; + void setWordWrapMode(QTextOption::WrapMode policy); + void setBackgroundVisible(bool visible); + bool backgroundVisible() const; + void setCenterOnScroll(bool enabled); + bool centerOnScroll() const; + bool find(const QString &exp, QTextDocument::FindFlags options = QTextDocument::FindFlags()); + QString toPlainText() const; + void ensureCursorVisible(); + virtual QVariant loadResource(int type, const QUrl &name); + QMenu *createStandardContextMenu() /Factory/; + QMenu *createStandardContextMenu(const QPoint &position) /Factory/; + QTextCursor cursorForPosition(const QPoint &pos) const; + QRect cursorRect(const QTextCursor &cursor) const; + QRect cursorRect() const; + bool overwriteMode() const; + void setOverwriteMode(bool overwrite); + int cursorWidth() const; + void setCursorWidth(int width); + void setExtraSelections(const QList &selections); + QList extraSelections() const; + void moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); + bool canPaste() const; +%If (PyQt_Printer) + void print(QPagedPaintDevice *printer) const; +%End + int blockCount() const; + +public slots: + void setPlainText(const QString &text); + void cut(); + void copy(); + void paste(); + void undo(); + void redo(); + void clear(); + void selectAll(); + void insertPlainText(const QString &text); + void appendPlainText(const QString &text); + void appendHtml(const QString &html); + void centerCursor(); + +signals: + void textChanged(); + void undoAvailable(bool b); + void redoAvailable(bool b); + void copyAvailable(bool b); + void selectionChanged(); + void cursorPositionChanged(); + void updateRequest(const QRect &rect, int dy); + void blockCountChanged(int newBlockCount); + void modificationChanged(bool); + +protected: + virtual bool event(QEvent *e); + virtual void timerEvent(QTimerEvent *e); + virtual void keyPressEvent(QKeyEvent *e); + virtual void keyReleaseEvent(QKeyEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual void paintEvent(QPaintEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void mouseDoubleClickEvent(QMouseEvent *e); + virtual bool focusNextPrevChild(bool next); + virtual void contextMenuEvent(QContextMenuEvent *e); + virtual void dragEnterEvent(QDragEnterEvent *e); + virtual void dragLeaveEvent(QDragLeaveEvent *e); + virtual void dragMoveEvent(QDragMoveEvent *e); + virtual void dropEvent(QDropEvent *e); + virtual void focusInEvent(QFocusEvent *e); + virtual void focusOutEvent(QFocusEvent *e); + virtual void showEvent(QShowEvent *); + virtual void changeEvent(QEvent *e); + virtual void wheelEvent(QWheelEvent *e); + virtual void inputMethodEvent(QInputMethodEvent *); + +public: + virtual QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + +protected: + virtual QMimeData *createMimeDataFromSelection() const /Factory/; + virtual bool canInsertFromMimeData(const QMimeData *source) const; + virtual void insertFromMimeData(const QMimeData *source); + virtual void scrollContentsBy(int dx, int dy); + QTextBlock firstVisibleBlock() const; + QPointF contentOffset() const; + QRectF blockBoundingRect(const QTextBlock &block) const; + QRectF blockBoundingGeometry(const QTextBlock &block) const; + QAbstractTextDocumentLayout::PaintContext getPaintContext() const; + +public: + QString anchorAt(const QPoint &pos) const; + +public slots: + void zoomIn(int range = 1); + void zoomOut(int range = 1); + +public: + void setPlaceholderText(const QString &placeholderText); + QString placeholderText() const; + bool find(const QRegularExpression &exp, QTextDocument::FindFlags options = QTextDocument::FindFlags()); + QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; + qreal tabStopDistance() const; + void setTabStopDistance(qreal distance); +}; + +class QPlainTextDocumentLayout : QAbstractTextDocumentLayout +{ +%TypeHeaderCode +#include +%End + +public: + QPlainTextDocumentLayout(QTextDocument *document); + virtual ~QPlainTextDocumentLayout(); + virtual void draw(QPainter *, const QAbstractTextDocumentLayout::PaintContext &); + virtual int hitTest(const QPointF &, Qt::HitTestAccuracy) const; + virtual int pageCount() const; + virtual QSizeF documentSize() const; + virtual QRectF frameBoundingRect(QTextFrame *) const; + virtual QRectF blockBoundingRect(const QTextBlock &block) const; + void ensureBlockLayout(const QTextBlock &block) const; + void setCursorWidth(int width); + int cursorWidth() const; + void requestUpdate(); + +protected: + virtual void documentChanged(int from, int, int charsAdded); +}; diff --git a/sip/QtWidgets/qprogressbar.sip b/sip/QtWidgets/qprogressbar.sip new file mode 100644 index 0000000..c18e264 --- /dev/null +++ b/sip/QtWidgets/qprogressbar.sip @@ -0,0 +1,70 @@ +// qprogressbar.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QProgressBar : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + enum Direction + { + TopToBottom, + BottomToTop, + }; + + explicit QProgressBar(QWidget *parent /TransferThis/ = 0); + virtual ~QProgressBar(); + int minimum() const; + int maximum() const; + void setRange(int minimum, int maximum); + int value() const; + virtual QString text() const; + void setTextVisible(bool visible); + bool isTextVisible() const; + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment alignment); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + Qt::Orientation orientation() const; + void setInvertedAppearance(bool invert); + void setTextDirection(QProgressBar::Direction textDirection); + void setFormat(const QString &format); + QString format() const; + void resetFormat(); + +public slots: + void reset(); + void setMinimum(int minimum); + void setMaximum(int maximum); + void setValue(int value); + void setOrientation(Qt::Orientation); + +signals: + void valueChanged(int value); + +protected: + virtual void initStyleOption(QStyleOptionProgressBar *option) const; + virtual bool event(QEvent *e); + virtual void paintEvent(QPaintEvent *); +}; diff --git a/sip/QtWidgets/qprogressdialog.sip b/sip/QtWidgets/qprogressdialog.sip new file mode 100644 index 0000000..5237963 --- /dev/null +++ b/sip/QtWidgets/qprogressdialog.sip @@ -0,0 +1,85 @@ +// qprogressdialog.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QProgressDialog : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + QProgressDialog(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + QProgressDialog(const QString &labelText, const QString &cancelButtonText, int minimum, int maximum, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QProgressDialog(); + void setLabel(QLabel *label /Transfer/); + void setCancelButton(QPushButton *button /Transfer/); + void setBar(QProgressBar *bar /Transfer/); + bool wasCanceled() const; + int minimum() const; + int maximum() const; + void setRange(int minimum, int maximum); + int value() const; + virtual QSize sizeHint() const; + QString labelText() const; + int minimumDuration() const; + void setAutoReset(bool b); + bool autoReset() const; + void setAutoClose(bool b); + bool autoClose() const; + +public slots: + void cancel(); + void reset(); + void setMaximum(int maximum); + void setMinimum(int minimum); + void setValue(int progress); + void setLabelText(const QString &); + void setCancelButtonText(const QString &); + void setMinimumDuration(int ms); + +signals: + void canceled(); + +protected: + virtual void resizeEvent(QResizeEvent *); + virtual void closeEvent(QCloseEvent *); + virtual void changeEvent(QEvent *); + virtual void showEvent(QShowEvent *e); + void forceShow(); + +public: + void open(); + void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/); +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipCpp->open(receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(0, a0); + } +%End +}; diff --git a/sip/QtWidgets/qproxystyle.sip b/sip/QtWidgets/qproxystyle.sip new file mode 100644 index 0000000..d860c67 --- /dev/null +++ b/sip/QtWidgets/qproxystyle.sip @@ -0,0 +1,61 @@ +// qproxystyle.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QProxyStyle : QCommonStyle +{ +%TypeHeaderCode +#include +%End + +public: + QProxyStyle(QStyle *style /Transfer/ = 0); + QProxyStyle(const QString &key); + virtual ~QProxyStyle(); + QStyle *baseStyle() const; + void setBaseStyle(QStyle *style /Transfer/); + virtual void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; + virtual void drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const; + virtual void drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const; + virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; + virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const; + virtual QSize sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const; + virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const; + virtual QRect subControlRect(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QStyle::SubControl sc, const QWidget *widget) const; + virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const; + virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; + virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = 0) const; + virtual int styleHint(QStyle::StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const; + virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; + virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const; + virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option = 0, const QWidget *widget = 0) const; + virtual QPixmap standardPixmap(QStyle::StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const; + virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const; + virtual QPalette standardPalette() const; + virtual void polish(QWidget *widget); + virtual void polish(QPalette &pal /In,Out/); + virtual void polish(QApplication *app); + virtual void unpolish(QWidget *widget); + virtual void unpolish(QApplication *app); + +protected: + virtual bool event(QEvent *e); +}; diff --git a/sip/QtWidgets/qpushbutton.sip b/sip/QtWidgets/qpushbutton.sip new file mode 100644 index 0000000..6c40a88 --- /dev/null +++ b/sip/QtWidgets/qpushbutton.sip @@ -0,0 +1,57 @@ +// qpushbutton.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QPushButton : QAbstractButton +{ +%TypeHeaderCode +#include +%End + +public: + explicit QPushButton(QWidget *parent /TransferThis/ = 0); + QPushButton(const QString &text, QWidget *parent /TransferThis/ = 0); + QPushButton(const QIcon &icon, const QString &text, QWidget *parent /TransferThis/ = 0); + virtual ~QPushButton(); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + bool autoDefault() const; + void setAutoDefault(bool); + bool isDefault() const; + void setDefault(bool); + void setMenu(QMenu *menu /KeepReference/); + QMenu *menu() const; + void setFlat(bool); + bool isFlat() const; + +public slots: + void showMenu(); + +protected: + virtual void initStyleOption(QStyleOptionButton *option) const; + virtual bool event(QEvent *e) /ReleaseGIL/; + virtual void paintEvent(QPaintEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual void focusOutEvent(QFocusEvent *); + virtual bool hitButton(const QPoint &pos) const; + virtual void mouseMoveEvent(QMouseEvent *); +}; diff --git a/sip/QtWidgets/qpywidgets_qlist.sip b/sip/QtWidgets/qpywidgets_qlist.sip new file mode 100644 index 0000000..6f2732d --- /dev/null +++ b/sip/QtWidgets/qpywidgets_qlist.sip @@ -0,0 +1,120 @@ +// This is the SIP interface definition for the QList based mapped types +// specific to the QtWidgets module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%MappedType QList + /TypeHintIn="Iterable[QWizard.WizardButton]", + TypeHintOut="List[QWizard.WizardButton]", TypeHintValue="[]"/ +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + PyObject *l = PyList_New(sipCpp->size()); + + if (!l) + return 0; + + for (int i = 0; i < sipCpp->size(); ++i) + { + PyObject *eobj = sipConvertFromEnum(sipCpp->at(i), + sipType_QWizard_WizardButton); + + if (!eobj) + { + Py_DECREF(l); + + return 0; + } + + PyList_SetItem(l, i, eobj); + } + + return l; +%End + +%ConvertToTypeCode + PyObject *iter = PyObject_GetIter(sipPy); + + if (!sipIsErr) + { + PyErr_Clear(); + Py_XDECREF(iter); + + return (iter && !PyBytes_Check(sipPy) && !PyUnicode_Check(sipPy)); + } + + if (!iter) + { + *sipIsErr = 1; + + return 0; + } + + QList *ql = new QList; + + for (Py_ssize_t i = 0; ; ++i) + { + PyErr_Clear(); + PyObject *itm = PyIter_Next(iter); + + if (!itm) + { + if (PyErr_Occurred()) + { + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + break; + } + + int v = sipConvertToEnum(itm, sipType_QWizard_WizardButton); + + if (PyErr_Occurred()) + { + PyErr_Format(PyExc_TypeError, + "index %zd has type '%s' but 'QWizard.WizardButton' is expected", + i, sipPyTypeName(Py_TYPE(itm))); + + Py_DECREF(itm); + delete ql; + Py_DECREF(iter); + *sipIsErr = 1; + + return 0; + } + + ql->append(static_cast(v)); + + Py_DECREF(itm); + } + + Py_DECREF(iter); + + *sipCppPtr = ql; + + return sipGetState(sipTransferObj); +%End +}; diff --git a/sip/QtWidgets/qradiobutton.sip b/sip/QtWidgets/qradiobutton.sip new file mode 100644 index 0000000..b1bf02c --- /dev/null +++ b/sip/QtWidgets/qradiobutton.sip @@ -0,0 +1,42 @@ +// qradiobutton.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QRadioButton : QAbstractButton +{ +%TypeHeaderCode +#include +%End + +public: + explicit QRadioButton(QWidget *parent /TransferThis/ = 0); + QRadioButton(const QString &text, QWidget *parent /TransferThis/ = 0); + virtual ~QRadioButton(); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + +protected: + virtual void initStyleOption(QStyleOptionButton *button) const; + virtual bool hitButton(const QPoint &) const; + virtual bool event(QEvent *e); + virtual void paintEvent(QPaintEvent *); + virtual void mouseMoveEvent(QMouseEvent *); +}; diff --git a/sip/QtWidgets/qrubberband.sip b/sip/QtWidgets/qrubberband.sip new file mode 100644 index 0000000..81e4c53 --- /dev/null +++ b/sip/QtWidgets/qrubberband.sip @@ -0,0 +1,54 @@ +// qrubberband.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QRubberBand : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + enum Shape + { + Line, + Rectangle, + }; + + QRubberBand(QRubberBand::Shape, QWidget *parent /TransferThis/ = 0); + virtual ~QRubberBand(); + QRubberBand::Shape shape() const; + void setGeometry(const QRect &r); + void setGeometry(int ax, int ay, int aw, int ah); + void move(const QPoint &p); + void move(int ax, int ay); + void resize(int w, int h); + void resize(const QSize &s); + +protected: + virtual void initStyleOption(QStyleOptionRubberBand *option) const; + virtual bool event(QEvent *e); + virtual void paintEvent(QPaintEvent *); + virtual void changeEvent(QEvent *); + virtual void showEvent(QShowEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void moveEvent(QMoveEvent *); +}; diff --git a/sip/QtWidgets/qscrollarea.sip b/sip/QtWidgets/qscrollarea.sip new file mode 100644 index 0000000..0305d02 --- /dev/null +++ b/sip/QtWidgets/qscrollarea.sip @@ -0,0 +1,50 @@ +// qscrollarea.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QScrollArea : QAbstractScrollArea +{ +%TypeHeaderCode +#include +%End + +public: + explicit QScrollArea(QWidget *parent /TransferThis/ = 0); + virtual ~QScrollArea(); + QWidget *widget() const; + void setWidget(QWidget *w /Transfer/); + QWidget *takeWidget() /TransferBack/; + bool widgetResizable() const; + void setWidgetResizable(bool resizable); + Qt::Alignment alignment() const; + void setAlignment(Qt::Alignment); + virtual QSize sizeHint() const; + virtual bool focusNextPrevChild(bool next); + void ensureVisible(int x, int y, int xMargin = 50, int yMargin = 50); + void ensureWidgetVisible(QWidget *childWidget, int xMargin = 50, int yMargin = 50); + +protected: + virtual bool event(QEvent *); + virtual bool eventFilter(QObject *, QEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void scrollContentsBy(int dx, int dy); + virtual QSize viewportSizeHint() const; +}; diff --git a/sip/QtWidgets/qscrollbar.sip b/sip/QtWidgets/qscrollbar.sip new file mode 100644 index 0000000..89f3f56 --- /dev/null +++ b/sip/QtWidgets/qscrollbar.sip @@ -0,0 +1,46 @@ +// qscrollbar.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QScrollBar : QAbstractSlider +{ +%TypeHeaderCode +#include +%End + +public: + explicit QScrollBar(QWidget *parent /TransferThis/ = 0); + QScrollBar(Qt::Orientation orientation, QWidget *parent /TransferThis/ = 0); + virtual ~QScrollBar(); + virtual QSize sizeHint() const; + virtual bool event(QEvent *event); + +protected: + virtual void initStyleOption(QStyleOptionSlider *option) const; + virtual void paintEvent(QPaintEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void hideEvent(QHideEvent *); + virtual void contextMenuEvent(QContextMenuEvent *); + virtual void wheelEvent(QWheelEvent *); + virtual void sliderChange(QAbstractSlider::SliderChange change); +}; diff --git a/sip/QtWidgets/qscroller.sip b/sip/QtWidgets/qscroller.sip new file mode 100644 index 0000000..b4f7c2e --- /dev/null +++ b/sip/QtWidgets/qscroller.sip @@ -0,0 +1,87 @@ +// qscroller.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QScroller : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum State + { + Inactive, + Pressed, + Dragging, + Scrolling, + }; + + enum ScrollerGestureType + { + TouchGesture, + LeftMouseButtonGesture, + RightMouseButtonGesture, + MiddleMouseButtonGesture, + }; + + enum Input + { + InputPress, + InputMove, + InputRelease, + }; + + static bool hasScroller(QObject *target); + static QScroller *scroller(QObject *target); + static Qt::GestureType grabGesture(QObject *target, QScroller::ScrollerGestureType scrollGestureType = QScroller::TouchGesture); + static Qt::GestureType grabbedGesture(QObject *target); + static void ungrabGesture(QObject *target); + static QList activeScrollers(); + QObject *target() const; + QScroller::State state() const; + bool handleInput(QScroller::Input input, const QPointF &position, qint64 timestamp = 0); + void stop(); + QPointF velocity() const; + QPointF finalPosition() const; + QPointF pixelPerMeter() const; + QScrollerProperties scrollerProperties() const; + void setSnapPositionsX(const QList &positions); + void setSnapPositionsX(qreal first, qreal interval); + void setSnapPositionsY(const QList &positions); + void setSnapPositionsY(qreal first, qreal interval); + +public slots: + void setScrollerProperties(const QScrollerProperties &prop); + void scrollTo(const QPointF &pos); + void scrollTo(const QPointF &pos, int scrollTime); + void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin); + void ensureVisible(const QRectF &rect, qreal xmargin, qreal ymargin, int scrollTime); + void resendPrepareEvent(); + +signals: + void stateChanged(QScroller::State newstate); + void scrollerPropertiesChanged(const QScrollerProperties &); + +private: + QScroller(QObject *target); + virtual ~QScroller(); +}; diff --git a/sip/QtWidgets/qscrollerproperties.sip b/sip/QtWidgets/qscrollerproperties.sip new file mode 100644 index 0000000..354c493 --- /dev/null +++ b/sip/QtWidgets/qscrollerproperties.sip @@ -0,0 +1,80 @@ +// qscrollerproperties.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QScrollerProperties +{ +%TypeHeaderCode +#include +%End + +public: + QScrollerProperties(); + QScrollerProperties(const QScrollerProperties &sp); + virtual ~QScrollerProperties(); + bool operator==(const QScrollerProperties &sp) const; + bool operator!=(const QScrollerProperties &sp) const; + static void setDefaultScrollerProperties(const QScrollerProperties &sp); + static void unsetDefaultScrollerProperties(); + + enum OvershootPolicy + { + OvershootWhenScrollable, + OvershootAlwaysOff, + OvershootAlwaysOn, + }; + + enum FrameRates + { + Standard, + Fps60, + Fps30, + Fps20, + }; + + enum ScrollMetric + { + MousePressEventDelay, + DragStartDistance, + DragVelocitySmoothingFactor, + AxisLockThreshold, + ScrollingCurve, + DecelerationFactor, + MinimumVelocity, + MaximumVelocity, + MaximumClickThroughVelocity, + AcceleratingFlickMaximumTime, + AcceleratingFlickSpeedupFactor, + SnapPositionRatio, + SnapTime, + OvershootDragResistanceFactor, + OvershootDragDistanceFactor, + OvershootScrollDistanceFactor, + OvershootScrollTime, + HorizontalOvershootPolicy, + VerticalOvershootPolicy, + FrameRate, + ScrollMetricCount, + }; + + QVariant scrollMetric(QScrollerProperties::ScrollMetric metric) const; + void setScrollMetric(QScrollerProperties::ScrollMetric metric, const QVariant &value); +}; diff --git a/sip/QtWidgets/qsizegrip.sip b/sip/QtWidgets/qsizegrip.sip new file mode 100644 index 0000000..e8e8b0c --- /dev/null +++ b/sip/QtWidgets/qsizegrip.sip @@ -0,0 +1,45 @@ +// qsizegrip.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSizeGrip : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSizeGrip(QWidget *parent /TransferThis/); + virtual ~QSizeGrip(); + virtual QSize sizeHint() const; + virtual void setVisible(bool); + +protected: + virtual void paintEvent(QPaintEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *mouseEvent); + virtual void mouseMoveEvent(QMouseEvent *); + virtual bool eventFilter(QObject *, QEvent *); + virtual bool event(QEvent *); + virtual void moveEvent(QMoveEvent *moveEvent); + virtual void showEvent(QShowEvent *showEvent); + virtual void hideEvent(QHideEvent *hideEvent); +}; diff --git a/sip/QtWidgets/qsizepolicy.sip b/sip/QtWidgets/qsizepolicy.sip new file mode 100644 index 0000000..1a4c2e4 --- /dev/null +++ b/sip/QtWidgets/qsizepolicy.sip @@ -0,0 +1,108 @@ +// qsizepolicy.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSizePolicy +{ +%TypeHeaderCode +#include +%End + +public: + enum PolicyFlag /BaseType=IntFlag/ + { + GrowFlag, + ExpandFlag, + ShrinkFlag, + IgnoreFlag, + }; + + enum Policy + { + Fixed, + Minimum, + Maximum, + Preferred, + MinimumExpanding, + Expanding, + Ignored, + }; + + QSizePolicy(); + QSizePolicy(QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical, QSizePolicy::ControlType type = QSizePolicy::DefaultType); + QSizePolicy(const QVariant &variant /GetWrapper/) /NoDerived/; +%MethodCode + if (a0->canConvert()) + sipCpp = new QSizePolicy(a0->value()); + else + sipError = sipBadCallableArg(0, a0Wrapper); +%End + + QSizePolicy::Policy horizontalPolicy() const; + QSizePolicy::Policy verticalPolicy() const; + void setHorizontalPolicy(QSizePolicy::Policy d); + void setVerticalPolicy(QSizePolicy::Policy d); + Qt::Orientations expandingDirections() const; + void setHeightForWidth(bool b); + bool hasHeightForWidth() const; + bool operator==(const QSizePolicy &s) const; + bool operator!=(const QSizePolicy &s) const; + int horizontalStretch() const; + int verticalStretch() const; + void setHorizontalStretch(int stretchFactor); + void setVerticalStretch(int stretchFactor); + void transpose(); + QSizePolicy transposed() const; + + enum ControlType /BaseType=Flag/ + { + DefaultType, + ButtonBox, + CheckBox, + ComboBox, + Frame, + GroupBox, + Label, + Line, + LineEdit, + PushButton, + RadioButton, + Slider, + SpinBox, + TabWidget, + ToolButton, + }; + + typedef QFlags ControlTypes; + QSizePolicy::ControlType controlType() const; + void setControlType(QSizePolicy::ControlType type); + void setWidthForHeight(bool b); + bool hasWidthForHeight() const; + bool retainSizeWhenHidden() const; + void setRetainSizeWhenHidden(bool retainSize); + Py_hash_t __hash__() const; +%MethodCode + sipRes = qHash(*sipCpp); +%End +}; + +QDataStream &operator<<(QDataStream &, const QSizePolicy &) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &, QSizePolicy & /Constrained/) /ReleaseGIL/; diff --git a/sip/QtWidgets/qslider.sip b/sip/QtWidgets/qslider.sip new file mode 100644 index 0000000..2b6ba15 --- /dev/null +++ b/sip/QtWidgets/qslider.sip @@ -0,0 +1,57 @@ +// qslider.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSlider : QAbstractSlider +{ +%TypeHeaderCode +#include +%End + +public: + enum TickPosition + { + NoTicks, + TicksAbove, + TicksLeft, + TicksBelow, + TicksRight, + TicksBothSides, + }; + + explicit QSlider(QWidget *parent /TransferThis/ = 0); + QSlider(Qt::Orientation orientation, QWidget *parent /TransferThis/ = 0); + virtual ~QSlider(); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + void setTickPosition(QSlider::TickPosition position); + QSlider::TickPosition tickPosition() const; + void setTickInterval(int ti); + int tickInterval() const; + virtual bool event(QEvent *event); + +protected: + virtual void initStyleOption(QStyleOptionSlider *option) const; + virtual void paintEvent(QPaintEvent *ev); + virtual void mousePressEvent(QMouseEvent *ev); + virtual void mouseReleaseEvent(QMouseEvent *ev); + virtual void mouseMoveEvent(QMouseEvent *ev); +}; diff --git a/sip/QtWidgets/qspinbox.sip b/sip/QtWidgets/qspinbox.sip new file mode 100644 index 0000000..8a723ec --- /dev/null +++ b/sip/QtWidgets/qspinbox.sip @@ -0,0 +1,106 @@ +// qspinbox.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSpinBox : QAbstractSpinBox +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSpinBox(QWidget *parent /TransferThis/ = 0); + virtual ~QSpinBox(); + int value() const; + QString prefix() const; + void setPrefix(const QString &p); + QString suffix() const; + void setSuffix(const QString &s); + QString cleanText() const; + int singleStep() const; + void setSingleStep(int val); + int minimum() const; + void setMinimum(int min); + int maximum() const; + void setMaximum(int max); + void setRange(int min, int max); + +protected: + virtual QValidator::State validate(QString &input /In,Out/, int &pos /In,Out/) const; + virtual int valueFromText(const QString &text) const; + virtual QString textFromValue(int v) const; + virtual void fixup(QString &str /In,Out/) const; + virtual bool event(QEvent *e); + +public slots: + void setValue(int val); + +signals: + void valueChanged(int); + void textChanged(const QString &); + +public: + int displayIntegerBase() const; + void setDisplayIntegerBase(int base); + QAbstractSpinBox::StepType stepType() const; + void setStepType(QAbstractSpinBox::StepType stepType); +}; + +class QDoubleSpinBox : QAbstractSpinBox +{ +%TypeHeaderCode +#include +%End + +public: + explicit QDoubleSpinBox(QWidget *parent /TransferThis/ = 0); + virtual ~QDoubleSpinBox(); + double value() const; + QString prefix() const; + void setPrefix(const QString &p); + QString suffix() const; + void setSuffix(const QString &s); + QString cleanText() const; + double singleStep() const; + void setSingleStep(double val); + double minimum() const; + void setMinimum(double min); + double maximum() const; + void setMaximum(double max); + void setRange(double min, double max); + int decimals() const; + void setDecimals(int prec); + virtual QValidator::State validate(QString &input /In,Out/, int &pos /In,Out/) const; + virtual double valueFromText(const QString &text) const; + virtual QString textFromValue(double v) const; + virtual void fixup(QString &str /In,Out/) const; + +public slots: + void setValue(double val); + +signals: + void valueChanged(double); + void textChanged(const QString &); + +public: + QAbstractSpinBox::StepType stepType() const; + void setStepType(QAbstractSpinBox::StepType stepType); +}; diff --git a/sip/QtWidgets/qsplashscreen.sip b/sip/QtWidgets/qsplashscreen.sip new file mode 100644 index 0000000..93b7fba --- /dev/null +++ b/sip/QtWidgets/qsplashscreen.sip @@ -0,0 +1,50 @@ +// qsplashscreen.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSplashScreen : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QSplashScreen(const QPixmap &pixmap = QPixmap(), Qt::WindowFlags flags = Qt::WindowFlags()); + QSplashScreen(QScreen *screen, const QPixmap &pixmap = QPixmap(), Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QSplashScreen(); + void setPixmap(const QPixmap &pixmap); + const QPixmap pixmap() const; + void finish(QWidget *w); + void repaint(); + QString message() const; + +public slots: + void showMessage(const QString &message, int alignment = Qt::AlignLeft, const QColor &color = Qt::black); + void clearMessage(); + +signals: + void messageChanged(const QString &message); + +protected: + virtual void drawContents(QPainter *painter); + virtual bool event(QEvent *e); + virtual void mousePressEvent(QMouseEvent *); +}; diff --git a/sip/QtWidgets/qsplitter.sip b/sip/QtWidgets/qsplitter.sip new file mode 100644 index 0000000..651d978 --- /dev/null +++ b/sip/QtWidgets/qsplitter.sip @@ -0,0 +1,98 @@ +// qsplitter.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSplitter : QFrame +{ +%TypeHeaderCode +#include +%End + +public: + explicit QSplitter(QWidget *parent /TransferThis/ = 0); + QSplitter(Qt::Orientation orientation, QWidget *parent /TransferThis/ = 0); + virtual ~QSplitter(); + void addWidget(QWidget *widget /Transfer/); + void insertWidget(int index, QWidget *widget /Transfer/); + void setOrientation(Qt::Orientation); + Qt::Orientation orientation() const; + void setChildrenCollapsible(bool); + bool childrenCollapsible() const; + void setCollapsible(int index, bool); + bool isCollapsible(int index) const; + void setOpaqueResize(bool opaque = true); + bool opaqueResize() const; + void refresh(); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + QList sizes() const; + void setSizes(const QList &list); + QByteArray saveState() const; + bool restoreState(const QByteArray &state); + int handleWidth() const; + void setHandleWidth(int); + int indexOf(QWidget *w) const; + QWidget *widget(int index) const; + int count() const /__len__/; + void getRange(int index, int *, int *) const; + QSplitterHandle *handle(int index) const /Transfer/; + void setStretchFactor(int index, int stretch); + QWidget *replaceWidget(int index, QWidget *widget /Transfer/) /TransferBack/; + +signals: + void splitterMoved(int pos, int index); + +protected: + virtual QSplitterHandle *createHandle() /Transfer/; + virtual void childEvent(QChildEvent *); + virtual bool event(QEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void changeEvent(QEvent *); + void moveSplitter(int pos, int index); + void setRubberBand(int position); + int closestLegalPosition(int, int); +}; + +class QSplitterHandle : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QSplitterHandle(Qt::Orientation o, QSplitter *parent /TransferThis/); + virtual ~QSplitterHandle(); + void setOrientation(Qt::Orientation o); + Qt::Orientation orientation() const; + bool opaqueResize() const; + QSplitter *splitter() const; + virtual QSize sizeHint() const; + +protected: + virtual void paintEvent(QPaintEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual bool event(QEvent *); + void moveSplitter(int p); + int closestLegalPosition(int p); + virtual void resizeEvent(QResizeEvent *); +}; diff --git a/sip/QtWidgets/qstackedlayout.sip b/sip/QtWidgets/qstackedlayout.sip new file mode 100644 index 0000000..45378d3 --- /dev/null +++ b/sip/QtWidgets/qstackedlayout.sip @@ -0,0 +1,112 @@ +// qstackedlayout.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStackedLayout : QLayout +{ +%TypeHeaderCode +#include +%End + +public: + enum StackingMode + { + StackOne, + StackAll, + }; + + QStackedLayout(); + explicit QStackedLayout(QWidget *parent /TransferThis/); + explicit QStackedLayout(QLayout *parentLayout /TransferThis/); + virtual ~QStackedLayout(); + int addWidget(QWidget *w /GetWrapper/); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->addWidget(a0); + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a0Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows addWidget(QWidget()). + sipTransferTo(a0Wrapper, sipSelf); + } +%End + + int insertWidget(int index, QWidget *w /GetWrapper/); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipRes = sipCpp->insertWidget(a0, a1); + Py_END_ALLOW_THREADS + + // The layout's parent widget (if there is one) will now have ownership. + QWidget *parent = sipCpp->parentWidget(); + + if (parent) + { + PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget); + + if (py_parent) + sipTransferTo(a1Wrapper, py_parent); + } + else + { + // For now give the Python ownership to the layout. This maintains + // compatibility with previous versions and allows insertWidget(QWidget()). + sipTransferTo(a1Wrapper, sipSelf); + } +%End + + QWidget *currentWidget() const; + int currentIndex() const; + QWidget *widget(int) const; + virtual int count() const; + virtual void addItem(QLayoutItem *item /Transfer/); + virtual QSize sizeHint() const; + virtual QSize minimumSize() const; + virtual QLayoutItem *itemAt(int) const; + virtual QLayoutItem *takeAt(int) /TransferBack/; + virtual void setGeometry(const QRect &rect); + +signals: + void widgetRemoved(int index); + void currentChanged(int index); + +public slots: + void setCurrentIndex(int index); + void setCurrentWidget(QWidget *w); + +public: + QStackedLayout::StackingMode stackingMode() const; + void setStackingMode(QStackedLayout::StackingMode stackingMode); + virtual bool hasHeightForWidth() const; + virtual int heightForWidth(int width) const; +}; diff --git a/sip/QtWidgets/qstackedwidget.sip b/sip/QtWidgets/qstackedwidget.sip new file mode 100644 index 0000000..53b358d --- /dev/null +++ b/sip/QtWidgets/qstackedwidget.sip @@ -0,0 +1,51 @@ +// qstackedwidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStackedWidget : QFrame +{ +%TypeHeaderCode +#include +%End + +public: + explicit QStackedWidget(QWidget *parent /TransferThis/ = 0); + virtual ~QStackedWidget(); + int addWidget(QWidget *w /Transfer/); + int insertWidget(int index, QWidget *w /Transfer/); + void removeWidget(QWidget *w); + QWidget *currentWidget() const; + int currentIndex() const; + int indexOf(const QWidget *) const; + QWidget *widget(int) const; + int count() const /__len__/; + +public slots: + void setCurrentIndex(int index); + void setCurrentWidget(QWidget *w); + +signals: + void currentChanged(int); + void widgetRemoved(int index); + +protected: + virtual bool event(QEvent *e); +}; diff --git a/sip/QtWidgets/qstatusbar.sip b/sip/QtWidgets/qstatusbar.sip new file mode 100644 index 0000000..d713994 --- /dev/null +++ b/sip/QtWidgets/qstatusbar.sip @@ -0,0 +1,55 @@ +// qstatusbar.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStatusBar : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QStatusBar(QWidget *parent /TransferThis/ = 0); + virtual ~QStatusBar(); + void addWidget(QWidget *widget /Transfer/, int stretch = 0); + void addPermanentWidget(QWidget *widget /Transfer/, int stretch = 0); + void removeWidget(QWidget *widget); + void setSizeGripEnabled(bool); + bool isSizeGripEnabled() const; + QString currentMessage() const; + int insertWidget(int index, QWidget *widget /Transfer/, int stretch = 0); + int insertPermanentWidget(int index, QWidget *widget /Transfer/, int stretch = 0); + +public slots: + void showMessage(const QString &message, int msecs = 0); + void clearMessage(); + +signals: + void messageChanged(const QString &text); + +protected: + virtual void paintEvent(QPaintEvent *); + virtual void resizeEvent(QResizeEvent *); + void reformat(); + void hideOrShow(); + virtual bool event(QEvent *); + virtual void showEvent(QShowEvent *); +}; diff --git a/sip/QtWidgets/qstyle.sip b/sip/QtWidgets/qstyle.sip new file mode 100644 index 0000000..940b53a --- /dev/null +++ b/sip/QtWidgets/qstyle.sip @@ -0,0 +1,696 @@ +// qstyle.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStyle : QObject +{ +%TypeHeaderCode +#include +%End + +public: + QStyle(); + virtual ~QStyle(); + virtual void polish(QWidget *); + virtual void unpolish(QWidget *); + virtual void polish(QApplication *); + virtual void unpolish(QApplication *); + virtual void polish(QPalette & /In,Out/); + virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const; + virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; + virtual void drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; + virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const; + virtual QPalette standardPalette() const; + + enum StateFlag /BaseType=Flag/ + { + State_None, + State_Enabled, + State_Raised, + State_Sunken, + State_Off, + State_NoChange, + State_On, + State_DownArrow, + State_Horizontal, + State_HasFocus, + State_Top, + State_Bottom, + State_FocusAtBorder, + State_AutoRaise, + State_MouseOver, + State_UpArrow, + State_Selected, + State_Active, + State_Open, + State_Children, + State_Item, + State_Sibling, + State_Editing, + State_KeyboardFocusChange, + State_ReadOnly, + State_Window, + State_Small, + State_Mini, + }; + + typedef QFlags State; + + enum PrimitiveElement /BaseType=UIntEnum/ + { + PE_Frame, + PE_FrameDefaultButton, + PE_FrameDockWidget, + PE_FrameFocusRect, + PE_FrameGroupBox, + PE_FrameLineEdit, + PE_FrameMenu, + PE_FrameTabWidget, + PE_FrameWindow, + PE_FrameButtonBevel, + PE_FrameButtonTool, + PE_FrameTabBarBase, + PE_PanelButtonCommand, + PE_PanelButtonBevel, + PE_PanelButtonTool, + PE_PanelMenuBar, + PE_PanelToolBar, + PE_PanelLineEdit, + PE_IndicatorArrowDown, + PE_IndicatorArrowLeft, + PE_IndicatorArrowRight, + PE_IndicatorArrowUp, + PE_IndicatorBranch, + PE_IndicatorButtonDropDown, + PE_IndicatorCheckBox, + PE_IndicatorDockWidgetResizeHandle, + PE_IndicatorHeaderArrow, + PE_IndicatorMenuCheckMark, + PE_IndicatorProgressChunk, + PE_IndicatorRadioButton, + PE_IndicatorSpinDown, + PE_IndicatorSpinMinus, + PE_IndicatorSpinPlus, + PE_IndicatorSpinUp, + PE_IndicatorToolBarHandle, + PE_IndicatorToolBarSeparator, + PE_PanelTipLabel, + PE_IndicatorTabTear, + PE_PanelScrollAreaCorner, + PE_Widget, + PE_IndicatorColumnViewArrow, + PE_FrameStatusBarItem, + PE_IndicatorItemViewItemCheck, + PE_IndicatorItemViewItemDrop, + PE_PanelItemViewItem, + PE_PanelItemViewRow, + PE_PanelStatusBar, + PE_IndicatorTabClose, + PE_PanelMenu, + PE_IndicatorTabTearLeft, + PE_IndicatorTabTearRight, + PE_CustomBase, + }; + + virtual void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *widget = 0) const = 0; + + enum ControlElement /BaseType=UIntEnum/ + { + CE_PushButton, + CE_PushButtonBevel, + CE_PushButtonLabel, + CE_CheckBox, + CE_CheckBoxLabel, + CE_RadioButton, + CE_RadioButtonLabel, + CE_TabBarTab, + CE_TabBarTabShape, + CE_TabBarTabLabel, + CE_ProgressBar, + CE_ProgressBarGroove, + CE_ProgressBarContents, + CE_ProgressBarLabel, + CE_MenuItem, + CE_MenuScroller, + CE_MenuVMargin, + CE_MenuHMargin, + CE_MenuTearoff, + CE_MenuEmptyArea, + CE_MenuBarItem, + CE_MenuBarEmptyArea, + CE_ToolButtonLabel, + CE_Header, + CE_HeaderSection, + CE_HeaderLabel, + CE_ToolBoxTab, + CE_SizeGrip, + CE_Splitter, + CE_RubberBand, + CE_DockWidgetTitle, + CE_ScrollBarAddLine, + CE_ScrollBarSubLine, + CE_ScrollBarAddPage, + CE_ScrollBarSubPage, + CE_ScrollBarSlider, + CE_ScrollBarFirst, + CE_ScrollBarLast, + CE_FocusFrame, + CE_ComboBoxLabel, + CE_ToolBar, + CE_ToolBoxTabShape, + CE_ToolBoxTabLabel, + CE_HeaderEmptyArea, + CE_ColumnViewGrip, + CE_ItemViewItem, + CE_ShapedFrame, + CE_CustomBase, + }; + + virtual void drawControl(QStyle::ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *widget = 0) const = 0; + + enum SubElement /BaseType=UIntEnum/ + { + SE_PushButtonContents, + SE_PushButtonFocusRect, + SE_CheckBoxIndicator, + SE_CheckBoxContents, + SE_CheckBoxFocusRect, + SE_CheckBoxClickRect, + SE_RadioButtonIndicator, + SE_RadioButtonContents, + SE_RadioButtonFocusRect, + SE_RadioButtonClickRect, + SE_ComboBoxFocusRect, + SE_SliderFocusRect, + SE_ProgressBarGroove, + SE_ProgressBarContents, + SE_ProgressBarLabel, + SE_ToolBoxTabContents, + SE_HeaderLabel, + SE_HeaderArrow, + SE_TabWidgetTabBar, + SE_TabWidgetTabPane, + SE_TabWidgetTabContents, + SE_TabWidgetLeftCorner, + SE_TabWidgetRightCorner, + SE_TabBarTearIndicator, + SE_TreeViewDisclosureItem, + SE_LineEditContents, + SE_FrameContents, + SE_DockWidgetCloseButton, + SE_DockWidgetFloatButton, + SE_DockWidgetTitleBarText, + SE_DockWidgetIcon, + SE_CheckBoxLayoutItem, + SE_ComboBoxLayoutItem, + SE_DateTimeEditLayoutItem, + SE_LabelLayoutItem, + SE_ProgressBarLayoutItem, + SE_PushButtonLayoutItem, + SE_RadioButtonLayoutItem, + SE_SliderLayoutItem, + SE_SpinBoxLayoutItem, + SE_ToolButtonLayoutItem, + SE_FrameLayoutItem, + SE_GroupBoxLayoutItem, + SE_TabWidgetLayoutItem, + SE_ItemViewItemCheckIndicator, + SE_ItemViewItemDecoration, + SE_ItemViewItemText, + SE_ItemViewItemFocusRect, + SE_TabBarTabLeftButton, + SE_TabBarTabRightButton, + SE_TabBarTabText, + SE_ShapedFrameContents, + SE_ToolBarHandle, + SE_TabBarTearIndicatorLeft, + SE_TabBarScrollLeftButton, + SE_TabBarScrollRightButton, + SE_TabBarTearIndicatorRight, + SE_PushButtonBevel, + SE_CustomBase, + }; + + virtual QRect subElementRect(QStyle::SubElement subElement, const QStyleOption *option, const QWidget *widget = 0) const = 0; + + enum ComplexControl /BaseType=UIntEnum/ + { + CC_SpinBox, + CC_ComboBox, + CC_ScrollBar, + CC_Slider, + CC_ToolButton, + CC_TitleBar, + CC_Dial, + CC_GroupBox, + CC_MdiControls, + CC_CustomBase, + }; + + enum SubControl /BaseType=Flag/ + { + SC_None, + SC_ScrollBarAddLine, + SC_ScrollBarSubLine, + SC_ScrollBarAddPage, + SC_ScrollBarSubPage, + SC_ScrollBarFirst, + SC_ScrollBarLast, + SC_ScrollBarSlider, + SC_ScrollBarGroove, + SC_SpinBoxUp, + SC_SpinBoxDown, + SC_SpinBoxFrame, + SC_SpinBoxEditField, + SC_ComboBoxFrame, + SC_ComboBoxEditField, + SC_ComboBoxArrow, + SC_ComboBoxListBoxPopup, + SC_SliderGroove, + SC_SliderHandle, + SC_SliderTickmarks, + SC_ToolButton, + SC_ToolButtonMenu, + SC_TitleBarSysMenu, + SC_TitleBarMinButton, + SC_TitleBarMaxButton, + SC_TitleBarCloseButton, + SC_TitleBarNormalButton, + SC_TitleBarShadeButton, + SC_TitleBarUnshadeButton, + SC_TitleBarContextHelpButton, + SC_TitleBarLabel, + SC_DialGroove, + SC_DialHandle, + SC_DialTickmarks, + SC_GroupBoxCheckBox, + SC_GroupBoxLabel, + SC_GroupBoxContents, + SC_GroupBoxFrame, + SC_MdiMinButton, + SC_MdiNormalButton, + SC_MdiCloseButton, + SC_CustomBase, + SC_All, + }; + + typedef QFlags SubControls; + virtual void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget = 0) const = 0; + virtual QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget = 0) const = 0; + virtual QRect subControlRect(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QStyle::SubControl sc, const QWidget *widget = 0) const = 0; + + enum PixelMetric /BaseType=UIntEnum/ + { + PM_ButtonMargin, + PM_ButtonDefaultIndicator, + PM_MenuButtonIndicator, + PM_ButtonShiftHorizontal, + PM_ButtonShiftVertical, + PM_DefaultFrameWidth, + PM_SpinBoxFrameWidth, + PM_ComboBoxFrameWidth, + PM_MaximumDragDistance, + PM_ScrollBarExtent, + PM_ScrollBarSliderMin, + PM_SliderThickness, + PM_SliderControlThickness, + PM_SliderLength, + PM_SliderTickmarkOffset, + PM_SliderSpaceAvailable, + PM_DockWidgetSeparatorExtent, + PM_DockWidgetHandleExtent, + PM_DockWidgetFrameWidth, + PM_TabBarTabOverlap, + PM_TabBarTabHSpace, + PM_TabBarTabVSpace, + PM_TabBarBaseHeight, + PM_TabBarBaseOverlap, + PM_ProgressBarChunkWidth, + PM_SplitterWidth, + PM_TitleBarHeight, + PM_MenuScrollerHeight, + PM_MenuHMargin, + PM_MenuVMargin, + PM_MenuPanelWidth, + PM_MenuTearoffHeight, + PM_MenuDesktopFrameWidth, + PM_MenuBarPanelWidth, + PM_MenuBarItemSpacing, + PM_MenuBarVMargin, + PM_MenuBarHMargin, + PM_IndicatorWidth, + PM_IndicatorHeight, + PM_ExclusiveIndicatorWidth, + PM_ExclusiveIndicatorHeight, + PM_DialogButtonsSeparator, + PM_DialogButtonsButtonWidth, + PM_DialogButtonsButtonHeight, + PM_MdiSubWindowFrameWidth, + PM_MdiSubWindowMinimizedWidth, + PM_HeaderMargin, + PM_HeaderMarkSize, + PM_HeaderGripMargin, + PM_TabBarTabShiftHorizontal, + PM_TabBarTabShiftVertical, + PM_TabBarScrollButtonWidth, + PM_ToolBarFrameWidth, + PM_ToolBarHandleExtent, + PM_ToolBarItemSpacing, + PM_ToolBarItemMargin, + PM_ToolBarSeparatorExtent, + PM_ToolBarExtensionExtent, + PM_SpinBoxSliderHeight, + PM_ToolBarIconSize, + PM_ListViewIconSize, + PM_IconViewIconSize, + PM_SmallIconSize, + PM_LargeIconSize, + PM_FocusFrameVMargin, + PM_FocusFrameHMargin, + PM_ToolTipLabelFrameWidth, + PM_CheckBoxLabelSpacing, + PM_TabBarIconSize, + PM_SizeGripSize, + PM_DockWidgetTitleMargin, + PM_MessageBoxIconSize, + PM_ButtonIconSize, + PM_DockWidgetTitleBarButtonMargin, + PM_RadioButtonLabelSpacing, + PM_LayoutLeftMargin, + PM_LayoutTopMargin, + PM_LayoutRightMargin, + PM_LayoutBottomMargin, + PM_LayoutHorizontalSpacing, + PM_LayoutVerticalSpacing, + PM_TabBar_ScrollButtonOverlap, + PM_TextCursorWidth, + PM_TabCloseIndicatorWidth, + PM_TabCloseIndicatorHeight, + PM_ScrollView_ScrollBarSpacing, + PM_SubMenuOverlap, + PM_ScrollView_ScrollBarOverlap, + PM_TreeViewIndentation, + PM_HeaderDefaultSectionSizeHorizontal, + PM_HeaderDefaultSectionSizeVertical, + PM_TitleBarButtonIconSize, + PM_TitleBarButtonSize, +%If (Qt_6_2_0 -) + PM_LineEditIconSize, +%End +%If (Qt_6_3_0 -) + PM_LineEditIconMargin, +%End + PM_CustomBase, + }; + + virtual int pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const = 0; + + enum ContentsType /BaseType=UIntEnum/ + { + CT_PushButton, + CT_CheckBox, + CT_RadioButton, + CT_ToolButton, + CT_ComboBox, + CT_Splitter, + CT_ProgressBar, + CT_MenuItem, + CT_MenuBarItem, + CT_MenuBar, + CT_Menu, + CT_TabBarTab, + CT_Slider, + CT_ScrollBar, + CT_LineEdit, + CT_SpinBox, + CT_SizeGrip, + CT_TabWidget, + CT_DialogButtons, + CT_HeaderSection, + CT_GroupBox, + CT_MdiControls, + CT_ItemViewItem, + CT_CustomBase, + }; + + virtual QSize sizeFromContents(QStyle::ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget = 0) const = 0; + + enum StyleHint /BaseType=UIntEnum/ + { + SH_EtchDisabledText, + SH_DitherDisabledText, + SH_ScrollBar_MiddleClickAbsolutePosition, + SH_ScrollBar_ScrollWhenPointerLeavesControl, + SH_TabBar_SelectMouseType, + SH_TabBar_Alignment, + SH_Header_ArrowAlignment, + SH_Slider_SnapToValue, + SH_Slider_SloppyKeyEvents, + SH_ProgressDialog_CenterCancelButton, + SH_ProgressDialog_TextLabelAlignment, + SH_PrintDialog_RightAlignButtons, + SH_MainWindow_SpaceBelowMenuBar, + SH_FontDialog_SelectAssociatedText, + SH_Menu_AllowActiveAndDisabled, + SH_Menu_SpaceActivatesItem, + SH_Menu_SubMenuPopupDelay, + SH_ScrollView_FrameOnlyAroundContents, + SH_MenuBar_AltKeyNavigation, + SH_ComboBox_ListMouseTracking, + SH_Menu_MouseTracking, + SH_MenuBar_MouseTracking, + SH_ItemView_ChangeHighlightOnFocus, + SH_Widget_ShareActivation, + SH_Workspace_FillSpaceOnMaximize, + SH_ComboBox_Popup, + SH_TitleBar_NoBorder, + SH_BlinkCursorWhenTextSelected, + SH_RichText_FullWidthSelection, + SH_Menu_Scrollable, + SH_GroupBox_TextLabelVerticalAlignment, + SH_GroupBox_TextLabelColor, + SH_Menu_SloppySubMenus, + SH_Table_GridLineColor, + SH_LineEdit_PasswordCharacter, + SH_DialogButtons_DefaultButton, + SH_ToolBox_SelectedPageTitleBold, + SH_TabBar_PreferNoArrows, + SH_ScrollBar_LeftClickAbsolutePosition, + SH_UnderlineShortcut, + SH_SpinBox_AnimateButton, + SH_SpinBox_KeyPressAutoRepeatRate, + SH_SpinBox_ClickAutoRepeatRate, + SH_Menu_FillScreenWithScroll, + SH_ToolTipLabel_Opacity, + SH_DrawMenuBarSeparator, + SH_TitleBar_ModifyNotification, + SH_Button_FocusPolicy, + SH_MessageBox_UseBorderForButtonSpacing, + SH_TitleBar_AutoRaise, + SH_ToolButton_PopupDelay, + SH_FocusFrame_Mask, + SH_RubberBand_Mask, + SH_WindowFrame_Mask, + SH_SpinControls_DisableOnBounds, + SH_Dial_BackgroundRole, + SH_ComboBox_LayoutDirection, + SH_ItemView_EllipsisLocation, + SH_ItemView_ShowDecorationSelected, + SH_ItemView_ActivateItemOnSingleClick, + SH_ScrollBar_ContextMenu, + SH_ScrollBar_RollBetweenButtons, + SH_Slider_StopMouseOverSlider, + SH_Slider_AbsoluteSetButtons, + SH_Slider_PageSetButtons, + SH_Menu_KeyboardSearch, + SH_TabBar_ElideMode, + SH_DialogButtonLayout, + SH_ComboBox_PopupFrameStyle, + SH_MessageBox_TextInteractionFlags, + SH_DialogButtonBox_ButtonsHaveIcons, + SH_MessageBox_CenterButtons, + SH_Menu_SelectionWrap, + SH_ItemView_MovementWithoutUpdatingSelection, + SH_ToolTip_Mask, + SH_FocusFrame_AboveWidget, + SH_TextControl_FocusIndicatorTextCharFormat, + SH_WizardStyle, + SH_ItemView_ArrowKeysNavigateIntoChildren, + SH_Menu_Mask, + SH_Menu_FlashTriggeredItem, + SH_Menu_FadeOutOnHide, + SH_SpinBox_ClickAutoRepeatThreshold, + SH_ItemView_PaintAlternatingRowColorsForEmptyArea, + SH_FormLayoutWrapPolicy, + SH_TabWidget_DefaultTabPosition, + SH_ToolBar_Movable, + SH_FormLayoutFieldGrowthPolicy, + SH_FormLayoutFormAlignment, + SH_FormLayoutLabelAlignment, + SH_ItemView_DrawDelegateFrame, + SH_TabBar_CloseButtonPosition, + SH_DockWidget_ButtonsHaveFrame, + SH_ToolButtonStyle, + SH_RequestSoftwareInputPanel, + SH_ListViewExpand_SelectMouseType, + SH_ScrollBar_Transient, + SH_Menu_SupportsSections, + SH_ToolTip_WakeUpDelay, + SH_ToolTip_FallAsleepDelay, + SH_Widget_Animate, + SH_Splitter_OpaqueResize, + SH_LineEdit_PasswordMaskDelay, + SH_TabBar_ChangeCurrentDelay, + SH_Menu_SubMenuUniDirection, + SH_Menu_SubMenuUniDirectionFailCount, + SH_Menu_SubMenuSloppySelectOtherActions, + SH_Menu_SubMenuSloppyCloseTimeout, + SH_Menu_SubMenuResetWhenReenteringParent, + SH_Menu_SubMenuDontStartSloppyOnLeave, + SH_ItemView_ScrollMode, + SH_TitleBar_ShowToolTipsOnButtons, + SH_Widget_Animation_Duration, + SH_ComboBox_AllowWheelScrolling, + SH_SpinBox_ButtonsInsideFrame, + SH_SpinBox_StepModifier, +%If (Qt_6_1_0 -) + SH_TabBar_AllowWheelScrolling, +%End +%If (Qt_6_3_0 -) + SH_Table_AlwaysDrawLeftTopGridLines, +%End +%If (Qt_6_3_0 -) + SH_SpinBox_SelectOnStep, +%End + SH_CustomBase, + }; + + virtual int styleHint(QStyle::StyleHint stylehint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const = 0; + + enum StandardPixmap /BaseType=UIntEnum/ + { + SP_TitleBarMenuButton, + SP_TitleBarMinButton, + SP_TitleBarMaxButton, + SP_TitleBarCloseButton, + SP_TitleBarNormalButton, + SP_TitleBarShadeButton, + SP_TitleBarUnshadeButton, + SP_TitleBarContextHelpButton, + SP_DockWidgetCloseButton, + SP_MessageBoxInformation, + SP_MessageBoxWarning, + SP_MessageBoxCritical, + SP_MessageBoxQuestion, + SP_DesktopIcon, + SP_TrashIcon, + SP_ComputerIcon, + SP_DriveFDIcon, + SP_DriveHDIcon, + SP_DriveCDIcon, + SP_DriveDVDIcon, + SP_DriveNetIcon, + SP_DirOpenIcon, + SP_DirClosedIcon, + SP_DirLinkIcon, + SP_FileIcon, + SP_FileLinkIcon, + SP_ToolBarHorizontalExtensionButton, + SP_ToolBarVerticalExtensionButton, + SP_FileDialogStart, + SP_FileDialogEnd, + SP_FileDialogToParent, + SP_FileDialogNewFolder, + SP_FileDialogDetailedView, + SP_FileDialogInfoView, + SP_FileDialogContentsView, + SP_FileDialogListView, + SP_FileDialogBack, + SP_DirIcon, + SP_DialogOkButton, + SP_DialogCancelButton, + SP_DialogHelpButton, + SP_DialogOpenButton, + SP_DialogSaveButton, + SP_DialogCloseButton, + SP_DialogApplyButton, + SP_DialogResetButton, + SP_DialogDiscardButton, + SP_DialogYesButton, + SP_DialogNoButton, + SP_ArrowUp, + SP_ArrowDown, + SP_ArrowLeft, + SP_ArrowRight, + SP_ArrowBack, + SP_ArrowForward, + SP_DirHomeIcon, + SP_CommandLink, + SP_VistaShield, + SP_BrowserReload, + SP_BrowserStop, + SP_MediaPlay, + SP_MediaStop, + SP_MediaPause, + SP_MediaSkipForward, + SP_MediaSkipBackward, + SP_MediaSeekForward, + SP_MediaSeekBackward, + SP_MediaVolume, + SP_MediaVolumeMuted, + SP_DirLinkOpenIcon, + SP_LineEditClearButton, + SP_DialogYesToAllButton, + SP_DialogNoToAllButton, + SP_DialogSaveAllButton, + SP_DialogAbortButton, + SP_DialogRetryButton, + SP_DialogIgnoreButton, + SP_RestoreDefaultsButton, +%If (Qt_6_3_0 -) + SP_TabCloseButton, +%End + SP_CustomBase, + }; + + virtual QPixmap standardPixmap(QStyle::StandardPixmap standardPixmap, const QStyleOption *option = 0, const QWidget *widget = 0) const = 0; + virtual QIcon standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option = 0, const QWidget *widget = 0) const = 0; + virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const = 0; + static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect); + static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPos); + static int sliderPositionFromValue(int min, int max, int logicalValue, int span, bool upsideDown = false); + static int sliderValueFromPosition(int min, int max, int position, int span, bool upsideDown = false); + static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment); + static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle); + virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const = 0; + int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, QStyleOption *option = 0, QWidget *widget = 0) const; + + enum RequestSoftwareInputPanel + { + RSIP_OnMouseClickAndAlreadyFocused, + RSIP_OnMouseClick, + }; + + const QStyle *proxy() const; +%If (Qt_6_1_0 -) + QString name() const; +%End +}; diff --git a/sip/QtWidgets/qstyleditemdelegate.sip b/sip/QtWidgets/qstyleditemdelegate.sip new file mode 100644 index 0000000..983af1d --- /dev/null +++ b/sip/QtWidgets/qstyleditemdelegate.sip @@ -0,0 +1,46 @@ +// qstyleditemdelegate.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStyledItemDelegate : QAbstractItemDelegate +{ +%TypeHeaderCode +#include +%End + +public: + explicit QStyledItemDelegate(QObject *parent /TransferThis/ = 0); + virtual ~QStyledItemDelegate(); + virtual void paint(QPainter *painter, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const; + virtual QSize sizeHint(const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const; + virtual QWidget *createEditor(QWidget *parent /TransferThis/, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const /Factory/; + virtual void setEditorData(QWidget *editor, const QModelIndex &index) const; + virtual void setModelData(QWidget *editor, QAbstractItemModel *model /KeepReference/, const QModelIndex &index) const; + virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index) const; + QItemEditorFactory *itemEditorFactory() const; + void setItemEditorFactory(QItemEditorFactory *factory /KeepReference/); + virtual QString displayText(const QVariant &value, const QLocale &locale) const; + +protected: + virtual void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const; + virtual bool eventFilter(QObject *object, QEvent *event); + virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option /NoCopy/, const QModelIndex &index); +}; diff --git a/sip/QtWidgets/qstylefactory.sip b/sip/QtWidgets/qstylefactory.sip new file mode 100644 index 0000000..0e60180 --- /dev/null +++ b/sip/QtWidgets/qstylefactory.sip @@ -0,0 +1,32 @@ +// qstylefactory.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStyleFactory +{ +%TypeHeaderCode +#include +%End + +public: + static QStringList keys(); + static QStyle *create(const QString &) /Factory/; +}; diff --git a/sip/QtWidgets/qstyleoption.sip b/sip/QtWidgets/qstyleoption.sip new file mode 100644 index 0000000..c123d9a --- /dev/null +++ b/sip/QtWidgets/qstyleoption.sip @@ -0,0 +1,1069 @@ +// qstyleoption.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStyleOption +{ +%TypeHeaderCode +#include +%End + +%ConvertToSubClassCode + switch (sipCpp->type) + { + case QStyleOption::SO_Button: + sipType = sipType_QStyleOptionButton; + break; + + case QStyleOption::SO_ComboBox: + sipType = sipType_QStyleOptionComboBox; + break; + + case QStyleOption::SO_DockWidget: + sipType = sipType_QStyleOptionDockWidget; + break; + + case QStyleOption::SO_FocusRect: + sipType = sipType_QStyleOptionFocusRect; + break; + + case QStyleOption::SO_Frame: + sipType = sipType_QStyleOptionFrame; + break; + + case QStyleOption::SO_GraphicsItem: + sipType = sipType_QStyleOptionGraphicsItem; + break; + + case QStyleOption::SO_GroupBox: + sipType = sipType_QStyleOptionGroupBox; + break; + + case QStyleOption::SO_Header: + sipType = sipType_QStyleOptionHeader; + break; + + case QStyleOption::SO_MenuItem: + sipType = sipType_QStyleOptionMenuItem; + break; + + case QStyleOption::SO_ProgressBar: + sipType = sipType_QStyleOptionProgressBar; + break; + + case QStyleOption::SO_RubberBand: + sipType = sipType_QStyleOptionRubberBand; + break; + + case QStyleOption::SO_SizeGrip: + sipType = sipType_QStyleOptionSizeGrip; + break; + + case QStyleOption::SO_Slider: + sipType = sipType_QStyleOptionSlider; + break; + + case QStyleOption::SO_SpinBox: + sipType = sipType_QStyleOptionSpinBox; + break; + + case QStyleOption::SO_Tab: + sipType = sipType_QStyleOptionTab; + break; + + case QStyleOption::SO_TabBarBase: + sipType = sipType_QStyleOptionTabBarBase; + break; + + case QStyleOption::SO_TabWidgetFrame: + sipType = sipType_QStyleOptionTabWidgetFrame; + break; + + case QStyleOption::SO_TitleBar: + sipType = sipType_QStyleOptionTitleBar; + break; + + case QStyleOption::SO_ToolBar: + sipType = sipType_QStyleOptionToolBar; + break; + + case QStyleOption::SO_ToolBox: + sipType = sipType_QStyleOptionToolBox; + break; + + case QStyleOption::SO_ToolButton: + sipType = sipType_QStyleOptionToolButton; + break; + + case QStyleOption::SO_ViewItem: + sipType = sipType_QStyleOptionViewItem; + break; + + default: + if ((sipCpp->type & QStyleOption::SO_ComplexCustomBase) == QStyleOption::SO_ComplexCustomBase) + sipType = sipType_QStyleOptionComplex; + else + sipType = 0; + } +%End + +public: + enum OptionType + { + SO_Default, + SO_FocusRect, + SO_Button, + SO_Tab, + SO_MenuItem, + SO_Frame, + SO_ProgressBar, + SO_ToolBox, + SO_Header, + SO_DockWidget, + SO_ViewItem, + SO_TabWidgetFrame, + SO_TabBarBase, + SO_RubberBand, + SO_ToolBar, + SO_Complex, + SO_Slider, + SO_SpinBox, + SO_ToolButton, + SO_ComboBox, + SO_TitleBar, + SO_GroupBox, + SO_ComplexCustomBase, + SO_GraphicsItem, + SO_SizeGrip, + SO_CustomBase, + }; + + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + int version; + int type; + QStyle::State state; + Qt::LayoutDirection direction; + QRect rect; + QFontMetrics fontMetrics; + QPalette palette; + QObject *styleObject; + QStyleOption(int version = QStyleOption::Version, int type = QStyleOption::SO_Default); + QStyleOption(const QStyleOption &other); + ~QStyleOption(); + void initFrom(const QWidget *w); +}; + +class QStyleOptionFocusRect : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QColor backgroundColor; + QStyleOptionFocusRect(); + QStyleOptionFocusRect(const QStyleOptionFocusRect &other); +}; + +class QStyleOptionFrame : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + enum FrameFeature /BaseType=Flag/ + { + None, + Flat, + Rounded, + }; + + typedef QFlags FrameFeatures; + QStyleOptionFrame::FrameFeatures features; + QFrame::Shape frameShape; + int lineWidth; + int midLineWidth; + QStyleOptionFrame(); + QStyleOptionFrame(const QStyleOptionFrame &other); +}; + +class QStyleOptionTabWidgetFrame : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + int lineWidth; + int midLineWidth; + QTabBar::Shape shape; + QSize tabBarSize; + QSize rightCornerWidgetSize; + QSize leftCornerWidgetSize; + QRect tabBarRect; + QRect selectedTabRect; + QStyleOptionTabWidgetFrame(); + QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other); +}; + +class QStyleOptionTabBarBase : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QTabBar::Shape shape; + QRect tabBarRect; + QRect selectedTabRect; + bool documentMode; + QStyleOptionTabBarBase(); + QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other); +}; + +class QStyleOptionHeader : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + enum SectionPosition + { + Beginning, + Middle, + End, + OnlyOneSection, + }; + + enum SelectedPosition + { + NotAdjacent, + NextIsSelected, + PreviousIsSelected, + NextAndPreviousAreSelected, + }; + + enum SortIndicator + { + None, + SortUp, + SortDown, + }; + + int section; + QString text; + Qt::Alignment textAlignment; + QIcon icon; + Qt::Alignment iconAlignment; + QStyleOptionHeader::SectionPosition position; + QStyleOptionHeader::SelectedPosition selectedPosition; + QStyleOptionHeader::SortIndicator sortIndicator; + Qt::Orientation orientation; + QStyleOptionHeader(); + QStyleOptionHeader(const QStyleOptionHeader &other); +}; + +%If (Qt_6_1_0 -) + +class QStyleOptionHeaderV2 : QStyleOptionHeader +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QStyleOptionHeaderV2(); + QStyleOptionHeaderV2(const QStyleOptionHeaderV2 &other); + Qt::TextElideMode textElideMode; + bool isSectionDragTarget; +}; + +%End + +class QStyleOptionButton : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + enum ButtonFeature /BaseType=Flag/ + { + None, + Flat, + HasMenu, + DefaultButton, + AutoDefaultButton, + CommandLinkButton, + }; + + typedef QFlags ButtonFeatures; + QStyleOptionButton::ButtonFeatures features; + QString text; + QIcon icon; + QSize iconSize; + QStyleOptionButton(); + QStyleOptionButton(const QStyleOptionButton &other); +}; + +class QStyleOptionTab : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + enum TabPosition + { + Beginning, + Middle, + End, + OnlyOneTab, + }; + + enum SelectedPosition + { + NotAdjacent, + NextIsSelected, + PreviousIsSelected, + }; + + enum CornerWidget /BaseType=Flag/ + { + NoCornerWidgets, + LeftCornerWidget, + RightCornerWidget, + }; + + typedef QFlags CornerWidgets; + QTabBar::Shape shape; + QString text; + QIcon icon; + int row; + QStyleOptionTab::TabPosition position; + QStyleOptionTab::SelectedPosition selectedPosition; + QStyleOptionTab::CornerWidgets cornerWidgets; + QSize iconSize; + bool documentMode; + QSize leftButtonSize; + QSize rightButtonSize; + + enum TabFeature /BaseType=Flag/ + { + None, + HasFrame, + }; + + typedef QFlags TabFeatures; + QStyleOptionTab::TabFeatures features; + int tabIndex; + QStyleOptionTab(); + QStyleOptionTab(const QStyleOptionTab &other); +}; + +class QStyleOptionProgressBar : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + int minimum; + int maximum; + int progress; + QString text; + Qt::Alignment textAlignment; + bool textVisible; + bool invertedAppearance; + bool bottomToTop; + QStyleOptionProgressBar(); + QStyleOptionProgressBar(const QStyleOptionProgressBar &other); +}; + +class QStyleOptionMenuItem : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + enum MenuItemType + { + Normal, + DefaultItem, + Separator, + SubMenu, + Scroller, + TearOff, + Margin, + EmptyArea, + }; + + enum CheckType + { + NotCheckable, + Exclusive, + NonExclusive, + }; + + QStyleOptionMenuItem::MenuItemType menuItemType; + QStyleOptionMenuItem::CheckType checkType; + bool checked; + bool menuHasCheckableItems; + QRect menuRect; + QString text; + QIcon icon; + int maxIconWidth; + QFont font; + int reservedShortcutWidth; + QStyleOptionMenuItem(); + QStyleOptionMenuItem(const QStyleOptionMenuItem &other); +}; + +class QStyleOptionDockWidget : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QString title; + bool closable; + bool movable; + bool floatable; + bool verticalTitleBar; + QStyleOptionDockWidget(); + QStyleOptionDockWidget(const QStyleOptionDockWidget &other); +}; + +class QStyleOptionViewItem : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + enum Position + { + Left, + Right, + Top, + Bottom, + }; + + Qt::Alignment displayAlignment; + Qt::Alignment decorationAlignment; + Qt::TextElideMode textElideMode; + QStyleOptionViewItem::Position decorationPosition; + QSize decorationSize; + QFont font; + bool showDecorationSelected; + + enum ViewItemFeature /BaseType=Flag/ + { + None, + WrapText, + Alternate, + HasCheckIndicator, + HasDisplay, + HasDecoration, + }; + + typedef QFlags ViewItemFeatures; + QStyleOptionViewItem::ViewItemFeatures features; + QLocale locale; + const QWidget *widget; + + enum ViewItemPosition + { + Invalid, + Beginning, + Middle, + End, + OnlyOne, + }; + + QModelIndex index; + Qt::CheckState checkState; + QIcon icon; + QString text; + QStyleOptionViewItem::ViewItemPosition viewItemPosition; + QBrush backgroundBrush; + QStyleOptionViewItem(); + QStyleOptionViewItem(const QStyleOptionViewItem &other); +}; + +class QStyleOptionToolBox : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QString text; + QIcon icon; + + enum TabPosition + { + Beginning, + Middle, + End, + OnlyOneTab, + }; + + enum SelectedPosition + { + NotAdjacent, + NextIsSelected, + PreviousIsSelected, + }; + + QStyleOptionToolBox::TabPosition position; + QStyleOptionToolBox::SelectedPosition selectedPosition; + QStyleOptionToolBox(); + QStyleOptionToolBox(const QStyleOptionToolBox &other); +}; + +class QStyleOptionRubberBand : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QRubberBand::Shape shape; + bool opaque; + QStyleOptionRubberBand(); + QStyleOptionRubberBand(const QStyleOptionRubberBand &other); +}; + +class QStyleOptionComplex : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QStyle::SubControls subControls; + QStyle::SubControls activeSubControls; + QStyleOptionComplex(int version = QStyleOptionComplex::Version, int type = QStyleOption::SO_Complex); + QStyleOptionComplex(const QStyleOptionComplex &other); +}; + +class QStyleOptionSlider : QStyleOptionComplex +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + Qt::Orientation orientation; + int minimum; + int maximum; + QSlider::TickPosition tickPosition; + int tickInterval; + bool upsideDown; + int sliderPosition; + int sliderValue; + int singleStep; + int pageStep; + qreal notchTarget; + bool dialWrapping; + Qt::KeyboardModifiers keyboardModifiers; + QStyleOptionSlider(); + QStyleOptionSlider(const QStyleOptionSlider &other); +}; + +class QStyleOptionSpinBox : QStyleOptionComplex +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QAbstractSpinBox::ButtonSymbols buttonSymbols; + QAbstractSpinBox::StepEnabled stepEnabled; + bool frame; + QStyleOptionSpinBox(); + QStyleOptionSpinBox(const QStyleOptionSpinBox &other); +}; + +class QStyleOptionToolButton : QStyleOptionComplex +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + enum ToolButtonFeature /BaseType=Flag/ + { + None, + Arrow, + Menu, + PopupDelay, + MenuButtonPopup, + HasMenu, + }; + + typedef QFlags ToolButtonFeatures; + QStyleOptionToolButton::ToolButtonFeatures features; + QIcon icon; + QSize iconSize; + QString text; + Qt::ArrowType arrowType; + Qt::ToolButtonStyle toolButtonStyle; + QPoint pos; + QFont font; + QStyleOptionToolButton(); + QStyleOptionToolButton(const QStyleOptionToolButton &other); +}; + +class QStyleOptionComboBox : QStyleOptionComplex +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + bool editable; + QRect popupRect; + bool frame; + QString currentText; + QIcon currentIcon; + QSize iconSize; + Qt::Alignment textAlignment; + QStyleOptionComboBox(); + QStyleOptionComboBox(const QStyleOptionComboBox &other); +}; + +class QStyleOptionTitleBar : QStyleOptionComplex +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QString text; + QIcon icon; + int titleBarState; + Qt::WindowFlags titleBarFlags; + QStyleOptionTitleBar(); + QStyleOptionTitleBar(const QStyleOptionTitleBar &other); +}; + +class QStyleHintReturn +{ +%TypeHeaderCode +#include +%End + +public: + enum HintReturnType + { + SH_Default, + SH_Mask, + SH_Variant, + }; + + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QStyleHintReturn(int version = QStyleOption::Version, int type = QStyleHintReturn::SH_Default); + ~QStyleHintReturn(); + int version; + int type; +}; + +class QStyleHintReturnMask : QStyleHintReturn +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QStyleHintReturnMask(); + ~QStyleHintReturnMask(); + QRegion region; +}; + +class QStyleOptionToolBar : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + enum ToolBarPosition + { + Beginning, + Middle, + End, + OnlyOne, + }; + + enum ToolBarFeature /BaseType=Flag/ + { + None, + Movable, + }; + + typedef QFlags ToolBarFeatures; + QStyleOptionToolBar::ToolBarPosition positionOfLine; + QStyleOptionToolBar::ToolBarPosition positionWithinLine; + Qt::ToolBarArea toolBarArea; + QStyleOptionToolBar::ToolBarFeatures features; + int lineWidth; + int midLineWidth; + QStyleOptionToolBar(); + QStyleOptionToolBar(const QStyleOptionToolBar &other); +}; + +class QStyleOptionGroupBox : QStyleOptionComplex +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QStyleOptionFrame::FrameFeatures features; + QString text; + Qt::Alignment textAlignment; + QColor textColor; + int lineWidth; + int midLineWidth; + QStyleOptionGroupBox(); + QStyleOptionGroupBox(const QStyleOptionGroupBox &other); +}; + +class QStyleOptionSizeGrip : QStyleOptionComplex +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + Qt::Corner corner; + QStyleOptionSizeGrip(); + QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other); +}; + +class QStyleOptionGraphicsItem : QStyleOption +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QRectF exposedRect; + static qreal levelOfDetailFromTransform(const QTransform &worldTransform); + QStyleOptionGraphicsItem(); + QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other); +}; + +class QStyleHintReturnVariant : QStyleHintReturn +{ +%TypeHeaderCode +#include +%End + +public: + enum StyleOptionType + { + Type, + }; + + enum StyleOptionVersion + { + Version, + }; + + QStyleHintReturnVariant(); + ~QStyleHintReturnVariant(); + QVariant variant; +}; diff --git a/sip/QtWidgets/qstylepainter.sip b/sip/QtWidgets/qstylepainter.sip new file mode 100644 index 0000000..a5564ee --- /dev/null +++ b/sip/QtWidgets/qstylepainter.sip @@ -0,0 +1,41 @@ +// qstylepainter.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QStylePainter : QPainter +{ +%TypeHeaderCode +#include +%End + +public: + QStylePainter(); + explicit QStylePainter(QWidget *w); + QStylePainter(QPaintDevice *pd, QWidget *w); + bool begin(QWidget *w); + bool begin(QPaintDevice *pd, QWidget *w); + QStyle *style() const; + void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption &opt); + void drawControl(QStyle::ControlElement ce, const QStyleOption &opt); + void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex &opt); + void drawItemText(const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole = QPalette::NoRole); + void drawItemPixmap(const QRect &r, int flags, const QPixmap &pixmap); +}; diff --git a/sip/QtWidgets/qsystemtrayicon.sip b/sip/QtWidgets/qsystemtrayicon.sip new file mode 100644 index 0000000..a64a0d7 --- /dev/null +++ b/sip/QtWidgets/qsystemtrayicon.sip @@ -0,0 +1,78 @@ +// qsystemtrayicon.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QSystemTrayIcon : QObject +{ +%TypeHeaderCode +#include +%End + +public: + enum ActivationReason + { + Unknown, + Context, + DoubleClick, + Trigger, + MiddleClick, + }; + + enum MessageIcon + { + NoIcon, + Information, + Warning, + Critical, + }; + + QSystemTrayIcon(QObject *parent /TransferThis/ = 0); + QSystemTrayIcon(const QIcon &icon, QObject *parent /TransferThis/ = 0); + virtual ~QSystemTrayIcon(); + void setContextMenu(QMenu *menu /KeepReference/); + QMenu *contextMenu() const; + QRect geometry() const; + QIcon icon() const; + void setIcon(const QIcon &icon); + QString toolTip() const; + void setToolTip(const QString &tip); + static bool isSystemTrayAvailable(); + static bool supportsMessages(); + +public slots: + void showMessage(const QString &title, const QString &msg, QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int msecs = 10000); + void showMessage(const QString &title, const QString &msg, const QIcon &icon, int msecs = 10000); + +public: + bool isVisible() const; + +public slots: + void hide(); + void setVisible(bool visible); + void show(); + +signals: + void activated(QSystemTrayIcon::ActivationReason reason); + void messageClicked(); + +protected: + virtual bool event(QEvent *event); +}; diff --git a/sip/QtWidgets/qtabbar.sip b/sip/QtWidgets/qtabbar.sip new file mode 100644 index 0000000..6216b54 --- /dev/null +++ b/sip/QtWidgets/qtabbar.sip @@ -0,0 +1,163 @@ +// qtabbar.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTabBar : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTabBar(QWidget *parent /TransferThis/ = 0); + virtual ~QTabBar(); + + enum Shape + { + RoundedNorth, + RoundedSouth, + RoundedWest, + RoundedEast, + TriangularNorth, + TriangularSouth, + TriangularWest, + TriangularEast, + }; + + QTabBar::Shape shape() const; + void setShape(QTabBar::Shape shape); + int addTab(const QString &text); + int addTab(const QIcon &icon, const QString &text); + int insertTab(int index, const QString &text); + int insertTab(int index, const QIcon &icon, const QString &text); + void removeTab(int index); + bool isTabEnabled(int index) const; + void setTabEnabled(int index, bool); + QString tabText(int index) const; + void setTabText(int index, const QString &text); + QColor tabTextColor(int index) const; + void setTabTextColor(int index, const QColor &color); + QIcon tabIcon(int index) const; + void setTabIcon(int index, const QIcon &icon); + void setTabToolTip(int index, const QString &tip); + QString tabToolTip(int index) const; + void setTabWhatsThis(int index, const QString &text); + QString tabWhatsThis(int index) const; + void setTabData(int index, const QVariant &data); + QVariant tabData(int index) const; + int tabAt(const QPoint &pos) const; + QRect tabRect(int index) const; + int currentIndex() const; + int count() const /__len__/; + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + void setDrawBase(bool drawTheBase); + bool drawBase() const; + QSize iconSize() const; + void setIconSize(const QSize &size); + Qt::TextElideMode elideMode() const; + void setElideMode(Qt::TextElideMode); + void setUsesScrollButtons(bool useButtons); + bool usesScrollButtons() const; + +public slots: + void setCurrentIndex(int index); + +signals: + void currentChanged(int index); + +protected: + virtual void initStyleOption(QStyleOptionTab *option, int tabIndex) const; + virtual QSize tabSizeHint(int index) const; + virtual void tabInserted(int index); + virtual void tabRemoved(int index); + virtual void tabLayoutChange(); + virtual bool event(QEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void showEvent(QShowEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void changeEvent(QEvent *); + +public: + enum ButtonPosition + { + LeftSide, + RightSide, + }; + + enum SelectionBehavior + { + SelectLeftTab, + SelectRightTab, + SelectPreviousTab, + }; + + void moveTab(int from, int to); + bool tabsClosable() const; + void setTabsClosable(bool closable); + void setTabButton(int index, QTabBar::ButtonPosition position, QWidget *widget /Transfer/); + QWidget *tabButton(int index, QTabBar::ButtonPosition position) const; + QTabBar::SelectionBehavior selectionBehaviorOnRemove() const; + void setSelectionBehaviorOnRemove(QTabBar::SelectionBehavior behavior); + bool expanding() const; + void setExpanding(bool enabled); + bool isMovable() const; + void setMovable(bool movable); + bool documentMode() const; + void setDocumentMode(bool set); + +signals: + void tabCloseRequested(int index); + void tabMoved(int from, int to); + +protected: + virtual void hideEvent(QHideEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void wheelEvent(QWheelEvent *event); + virtual QSize minimumTabSizeHint(int index) const; + +signals: + void tabBarClicked(int index); + void tabBarDoubleClicked(int index); + +public: + bool autoHide() const; + void setAutoHide(bool hide); + bool changeCurrentOnDrag() const; + void setChangeCurrentOnDrag(bool change); + +protected: + virtual void timerEvent(QTimerEvent *event); + +public: +%If (PyQt_Accessibility) + QString accessibleTabName(int index) const; +%End +%If (PyQt_Accessibility) + void setAccessibleTabName(int index, const QString &name); +%End + bool isTabVisible(int index) const; + void setTabVisible(int index, bool visible); +}; diff --git a/sip/QtWidgets/qtableview.sip b/sip/QtWidgets/qtableview.sip new file mode 100644 index 0000000..b79d4c6 --- /dev/null +++ b/sip/QtWidgets/qtableview.sip @@ -0,0 +1,114 @@ +// qtableview.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTableView : QAbstractItemView +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTableView(QWidget *parent /TransferThis/ = 0); + virtual ~QTableView(); + virtual void setModel(QAbstractItemModel *model /KeepReference/); + virtual void setRootIndex(const QModelIndex &index); + virtual void setSelectionModel(QItemSelectionModel *selectionModel /KeepReference/); + QHeaderView *horizontalHeader() const; + QHeaderView *verticalHeader() const; + void setHorizontalHeader(QHeaderView *header /Transfer/); + void setVerticalHeader(QHeaderView *header /Transfer/); + int rowViewportPosition(int row) const; + void setRowHeight(int row, int height); + int rowHeight(int row) const; + int rowAt(int y) const; + int columnViewportPosition(int column) const; + void setColumnWidth(int column, int width); + int columnWidth(int column) const; + int columnAt(int x) const; + bool isRowHidden(int row) const; + void setRowHidden(int row, bool hide); + bool isColumnHidden(int column) const; + void setColumnHidden(int column, bool hide); + bool showGrid() const; + void setShowGrid(bool show); + Qt::PenStyle gridStyle() const; + void setGridStyle(Qt::PenStyle style); + virtual QRect visualRect(const QModelIndex &index) const; + virtual void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible); + virtual QModelIndex indexAt(const QPoint &p) const; + +public slots: + void selectRow(int row); + void selectColumn(int column); + void hideRow(int row); + void hideColumn(int column); + void showRow(int row); + void showColumn(int column); + void resizeRowToContents(int row); + void resizeRowsToContents(); + void resizeColumnToContents(int column); + void resizeColumnsToContents(); + +protected slots: + void rowMoved(int row, int oldIndex, int newIndex); + void columnMoved(int column, int oldIndex, int newIndex); + void rowResized(int row, int oldHeight, int newHeight); + void columnResized(int column, int oldWidth, int newWidth); + void rowCountChanged(int oldCount, int newCount); + void columnCountChanged(int oldCount, int newCount); + +protected: + virtual void scrollContentsBy(int dx, int dy); + virtual void paintEvent(QPaintEvent *e); + virtual void timerEvent(QTimerEvent *event); + virtual int horizontalOffset() const; + virtual int verticalOffset() const; + virtual QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command); + virtual QRegion visualRegionForSelection(const QItemSelection &selection) const; + virtual QModelIndexList selectedIndexes() const; + virtual void updateGeometries(); + virtual int sizeHintForRow(int row) const; + virtual int sizeHintForColumn(int column) const; + virtual void verticalScrollbarAction(int action); + virtual void horizontalScrollbarAction(int action); + virtual bool isIndexHidden(const QModelIndex &index) const; + virtual QSize viewportSizeHint() const; + +public: + void setSortingEnabled(bool enable); + bool isSortingEnabled() const; + void setSpan(int row, int column, int rowSpan, int columnSpan); + int rowSpan(int row, int column) const; + int columnSpan(int row, int column) const; + void sortByColumn(int column, Qt::SortOrder order); + void setWordWrap(bool on); + bool wordWrap() const; + void setCornerButtonEnabled(bool enable); + bool isCornerButtonEnabled() const; + void clearSpans(); + +protected: + virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + virtual void initViewItemOption(QStyleOptionViewItem *option) const; +}; diff --git a/sip/QtWidgets/qtablewidget.sip b/sip/QtWidgets/qtablewidget.sip new file mode 100644 index 0000000..bd4472d --- /dev/null +++ b/sip/QtWidgets/qtablewidget.sip @@ -0,0 +1,247 @@ +// qtablewidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTableWidgetSelectionRange +{ +%TypeHeaderCode +#include +%End + +public: + QTableWidgetSelectionRange(); + QTableWidgetSelectionRange(int top, int left, int bottom, int right); + int topRow() const; + int bottomRow() const; + int leftColumn() const; + int rightColumn() const; + int rowCount() const; + int columnCount() const; +}; + +class QTableWidgetItem /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + enum ItemType /BaseType=IntEnum/ + { + Type, + UserType, + }; + + explicit QTableWidgetItem(int type = QTableWidgetItem::Type); + QTableWidgetItem(const QString &text, int type = QTableWidgetItem::Type); + QTableWidgetItem(const QIcon &icon, const QString &text, int type = QTableWidgetItem::Type); + QTableWidgetItem(const QTableWidgetItem &other); + virtual ~QTableWidgetItem(); + virtual QTableWidgetItem *clone() const /Factory/; + QTableWidget *tableWidget() const; + Qt::ItemFlags flags() const; + QString text() const; + QIcon icon() const; + QString statusTip() const; + QString toolTip() const; + QString whatsThis() const; + QFont font() const; + int textAlignment() const; +%If (Qt_6_4_0 -) + void setTextAlignment(Qt::Alignment alignment); +%End + void setTextAlignment(int alignment); + Qt::CheckState checkState() const; + void setCheckState(Qt::CheckState state); + virtual QVariant data(int role) const; + virtual void setData(int role, const QVariant &value); + virtual bool operator<(const QTableWidgetItem &other /NoCopy/) const; + virtual void read(QDataStream &in) /ReleaseGIL/; + virtual void write(QDataStream &out) const /ReleaseGIL/; + int type() const; + void setFlags(Qt::ItemFlags aflags); + void setText(const QString &atext); + void setIcon(const QIcon &aicon); + void setStatusTip(const QString &astatusTip); + void setToolTip(const QString &atoolTip); + void setWhatsThis(const QString &awhatsThis); + void setFont(const QFont &afont); + QSize sizeHint() const; + void setSizeHint(const QSize &size); + QBrush background() const; + void setBackground(const QBrush &brush); + QBrush foreground() const; + void setForeground(const QBrush &brush); + int row() const; + int column() const; + void setSelected(bool aselect); + bool isSelected() const; + +private: + QTableWidgetItem &operator=(const QTableWidgetItem &); +}; + +QDataStream &operator<<(QDataStream &out, const QTableWidgetItem &item) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &in, QTableWidgetItem &item /Constrained/) /ReleaseGIL/; + +class QTableWidget : QTableView +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTableWidget(QWidget *parent /TransferThis/ = 0); + QTableWidget(int rows, int columns, QWidget *parent /TransferThis/ = 0); + virtual ~QTableWidget(); + void setRowCount(int rows); + int rowCount() const; + void setColumnCount(int columns); + int columnCount() const; + int row(const QTableWidgetItem *item) const; + int column(const QTableWidgetItem *item) const; + QTableWidgetItem *item(int row, int column) const; + void setItem(int row, int column, QTableWidgetItem *item /Transfer/); + QTableWidgetItem *takeItem(int row, int column) /TransferBack/; + QTableWidgetItem *verticalHeaderItem(int row) const; + void setVerticalHeaderItem(int row, QTableWidgetItem *item /Transfer/); + QTableWidgetItem *takeVerticalHeaderItem(int row) /TransferBack/; + QTableWidgetItem *horizontalHeaderItem(int column) const; + void setHorizontalHeaderItem(int column, QTableWidgetItem *item /Transfer/); + QTableWidgetItem *takeHorizontalHeaderItem(int column) /TransferBack/; + void setVerticalHeaderLabels(const QStringList &labels); + void setHorizontalHeaderLabels(const QStringList &labels); + int currentRow() const; + int currentColumn() const; + QTableWidgetItem *currentItem() const; + void setCurrentItem(QTableWidgetItem *item); + void setCurrentItem(QTableWidgetItem *item, QItemSelectionModel::SelectionFlags command); + void setCurrentCell(int row, int column); + void setCurrentCell(int row, int column, QItemSelectionModel::SelectionFlags command); + void sortItems(int column, Qt::SortOrder order = Qt::AscendingOrder); + void setSortingEnabled(bool enable); + bool isSortingEnabled() const; + void editItem(QTableWidgetItem *item); + void openPersistentEditor(QTableWidgetItem *item); + void closePersistentEditor(QTableWidgetItem *item); + QWidget *cellWidget(int row, int column) const; + void setCellWidget(int row, int column, QWidget *widget /Transfer/); +%MethodCode + // We have to break the association with any existing widget. + QWidget *w = sipCpp->cellWidget(a0, a1); + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QWidget); + + if (wo) + sipTransferTo(wo, 0); + } + + Py_BEGIN_ALLOW_THREADS + sipCpp->setCellWidget(a0, a1, a2); + Py_END_ALLOW_THREADS +%End + + void removeCellWidget(int arow, int acolumn); +%MethodCode + // We have to break the association with any existing widget. + QWidget *w = sipCpp->cellWidget(a0, a1); + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QWidget); + + if (wo) + sipTransferTo(wo, 0); + } + + Py_BEGIN_ALLOW_THREADS + sipCpp->removeCellWidget(a0, a1); + Py_END_ALLOW_THREADS +%End + + void setRangeSelected(const QTableWidgetSelectionRange &range, bool select); + QList selectedRanges() const; + QList selectedItems() const; + QList findItems(const QString &text, Qt::MatchFlags flags) const; + int visualRow(int logicalRow) const; + int visualColumn(int logicalColumn) const; + QTableWidgetItem *itemAt(const QPoint &p) const; + QTableWidgetItem *itemAt(int ax, int ay) const; + QRect visualItemRect(const QTableWidgetItem *item) const; + const QTableWidgetItem *itemPrototype() const; + void setItemPrototype(const QTableWidgetItem *item /Transfer/); + +public slots: + void scrollToItem(const QTableWidgetItem *item, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible); + void insertRow(int row); + void insertColumn(int column); + void removeRow(int row); + void removeColumn(int column); + void clear(); + void clearContents(); + +signals: + void itemPressed(QTableWidgetItem *item); + void itemClicked(QTableWidgetItem *item); + void itemDoubleClicked(QTableWidgetItem *item); + void itemActivated(QTableWidgetItem *item); + void itemEntered(QTableWidgetItem *item); + void itemChanged(QTableWidgetItem *item); + void currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous); + void itemSelectionChanged(); + void cellPressed(int row, int column); + void cellClicked(int row, int column); + void cellDoubleClicked(int row, int column); + void cellActivated(int row, int column); + void cellEntered(int row, int column); + void cellChanged(int row, int column); + void currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); + +protected: + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QList &items) const /TransferBack/; + virtual bool dropMimeData(int row, int column, const QMimeData *data, Qt::DropAction action); + virtual Qt::DropActions supportedDropActions() const; + +public: + QList items(const QMimeData *data) const; + QModelIndex indexFromItem(const QTableWidgetItem *item) const; + QTableWidgetItem *itemFromIndex(const QModelIndex &index) const; + +protected: + virtual bool event(QEvent *e); + virtual void dropEvent(QDropEvent *event); + +public: + bool isPersistentEditorOpen(QTableWidgetItem *item) const; + +private: + virtual void setModel(QAbstractItemModel *model /KeepReference/); +}; + +%If (Qt_6_3_0 -) +bool operator==(const QTableWidgetSelectionRange &lhs, const QTableWidgetSelectionRange &rhs); +%End +%If (Qt_6_3_0 -) +bool operator!=(const QTableWidgetSelectionRange &lhs, const QTableWidgetSelectionRange &rhs); +%End diff --git a/sip/QtWidgets/qtabwidget.sip b/sip/QtWidgets/qtabwidget.sip new file mode 100644 index 0000000..7259a6d --- /dev/null +++ b/sip/QtWidgets/qtabwidget.sip @@ -0,0 +1,132 @@ +// qtabwidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTabWidget : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTabWidget(QWidget *parent /TransferThis/ = 0); + virtual ~QTabWidget(); + void clear(); + int addTab(QWidget *widget /Transfer/, const QString &); + int addTab(QWidget *widget /Transfer/, const QIcon &icon, const QString &label); + int insertTab(int index, QWidget *widget /Transfer/, const QString &); + int insertTab(int index, QWidget *widget /Transfer/, const QIcon &icon, const QString &label); + void removeTab(int index); + bool isTabEnabled(int index) const; + void setTabEnabled(int index, bool); + QString tabText(int index) const; + void setTabText(int index, const QString &); + QIcon tabIcon(int index) const; + void setTabIcon(int index, const QIcon &icon); + void setTabToolTip(int index, const QString &tip); + QString tabToolTip(int index) const; + void setTabWhatsThis(int index, const QString &text); + QString tabWhatsThis(int index) const; + int currentIndex() const; + QWidget *currentWidget() const; + QWidget *widget(int index) const; + int indexOf(const QWidget *widget) const; + int count() const /__len__/; + + enum TabPosition + { + North, + South, + West, + East, + }; + + QTabWidget::TabPosition tabPosition() const; + void setTabPosition(QTabWidget::TabPosition); + + enum TabShape + { + Rounded, + Triangular, + }; + + QTabWidget::TabShape tabShape() const; + void setTabShape(QTabWidget::TabShape s); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + void setCornerWidget(QWidget *widget /Transfer/, Qt::Corner corner = Qt::TopRightCorner); + QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const; + +public slots: + void setCurrentIndex(int index); + void setCurrentWidget(QWidget *widget); + +signals: + void currentChanged(int index); + +protected: + virtual void initStyleOption(QStyleOptionTabWidgetFrame *option) const; + virtual void tabInserted(int index); + virtual void tabRemoved(int index); + virtual bool event(QEvent *); + virtual void showEvent(QShowEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void paintEvent(QPaintEvent *); + void setTabBar(QTabBar * /Transfer/); + +public: + QTabBar *tabBar() const; + +protected: + virtual void changeEvent(QEvent *); + +public: + Qt::TextElideMode elideMode() const; + void setElideMode(Qt::TextElideMode); + QSize iconSize() const; + void setIconSize(const QSize &size); + bool usesScrollButtons() const; + void setUsesScrollButtons(bool useButtons); + bool tabsClosable() const; + void setTabsClosable(bool closeable); + bool isMovable() const; + void setMovable(bool movable); + bool documentMode() const; + void setDocumentMode(bool set); + +signals: + void tabCloseRequested(int index); + +public: + virtual int heightForWidth(int width) const; + virtual bool hasHeightForWidth() const; + +signals: + void tabBarClicked(int index); + void tabBarDoubleClicked(int index); + +public: + bool tabBarAutoHide() const; + void setTabBarAutoHide(bool enabled); + bool isTabVisible(int index) const; + void setTabVisible(int index, bool visible); +}; diff --git a/sip/QtWidgets/qtextbrowser.sip b/sip/QtWidgets/qtextbrowser.sip new file mode 100644 index 0000000..269140b --- /dev/null +++ b/sip/QtWidgets/qtextbrowser.sip @@ -0,0 +1,82 @@ +// qtextbrowser.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextBrowser : QTextEdit +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTextBrowser(QWidget *parent /TransferThis/ = 0); + virtual ~QTextBrowser(); + QUrl source() const; + QStringList searchPaths() const; + void setSearchPaths(const QStringList &paths); + virtual QVariant loadResource(int type, const QUrl &name); + +public slots: + void setSource(const QUrl &name, QTextDocument::ResourceType type = QTextDocument::UnknownResource); + virtual void backward(); + virtual void forward(); + virtual void home(); + virtual void reload(); + +signals: + void backwardAvailable(bool); + void forwardAvailable(bool); + void sourceChanged(const QUrl &); + void highlighted(const QUrl &); + void anchorClicked(const QUrl &); + +protected: + virtual bool event(QEvent *e); + virtual void keyPressEvent(QKeyEvent *ev); + virtual void mouseMoveEvent(QMouseEvent *ev); + virtual void mousePressEvent(QMouseEvent *ev); + virtual void mouseReleaseEvent(QMouseEvent *ev); + virtual void focusOutEvent(QFocusEvent *ev); + virtual bool focusNextPrevChild(bool next); + virtual void paintEvent(QPaintEvent *e); + +public: + bool isBackwardAvailable() const; + bool isForwardAvailable() const; + void clearHistory(); + bool openExternalLinks() const; + void setOpenExternalLinks(bool open); + bool openLinks() const; + void setOpenLinks(bool open); + QString historyTitle(int) const; + QUrl historyUrl(int) const; + int backwardHistoryCount() const; + int forwardHistoryCount() const; + +signals: + void historyChanged(); + +public: + QTextDocument::ResourceType sourceType() const; + +protected: + virtual void doSetSource(const QUrl &name, QTextDocument::ResourceType type = QTextDocument::UnknownResource); +}; diff --git a/sip/QtWidgets/qtextedit.sip b/sip/QtWidgets/qtextedit.sip new file mode 100644 index 0000000..dff9dc2 --- /dev/null +++ b/sip/QtWidgets/qtextedit.sip @@ -0,0 +1,202 @@ +// qtextedit.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTextEdit : QAbstractScrollArea +{ +%TypeHeaderCode +#include +%End + +public: + struct ExtraSelection + { +%TypeHeaderCode +#include +%End + + QTextCursor cursor; + QTextCharFormat format; + }; + + enum LineWrapMode + { + NoWrap, + WidgetWidth, + FixedPixelWidth, + FixedColumnWidth, + }; + + enum AutoFormattingFlag /BaseType=Flag/ + { + AutoNone, + AutoBulletList, + AutoAll, + }; + + typedef QFlags AutoFormatting; + explicit QTextEdit(QWidget *parent /TransferThis/ = 0); + QTextEdit(const QString &text, QWidget *parent /TransferThis/ = 0); + virtual ~QTextEdit(); + void setDocument(QTextDocument *document /KeepReference/); + QTextDocument *document() const; + void setTextCursor(const QTextCursor &cursor); + QTextCursor textCursor() const; + bool isReadOnly() const; + void setReadOnly(bool ro); + qreal fontPointSize() const; + QString fontFamily() const; + int fontWeight() const; + bool fontUnderline() const; + bool fontItalic() const; + QColor textColor() const; + QFont currentFont() const; + Qt::Alignment alignment() const; + void mergeCurrentCharFormat(const QTextCharFormat &modifier); + void setCurrentCharFormat(const QTextCharFormat &format); + QTextCharFormat currentCharFormat() const; + QTextEdit::AutoFormatting autoFormatting() const; + void setAutoFormatting(QTextEdit::AutoFormatting features); + bool tabChangesFocus() const; + void setTabChangesFocus(bool b); + void setDocumentTitle(const QString &title); + QString documentTitle() const; + bool isUndoRedoEnabled() const; + void setUndoRedoEnabled(bool enable); + QTextEdit::LineWrapMode lineWrapMode() const; + void setLineWrapMode(QTextEdit::LineWrapMode mode); + int lineWrapColumnOrWidth() const; + void setLineWrapColumnOrWidth(int w); + QTextOption::WrapMode wordWrapMode() const; + void setWordWrapMode(QTextOption::WrapMode policy); + bool find(const QString &exp, QTextDocument::FindFlags options = QTextDocument::FindFlags()); + QString toPlainText() const; + QString toHtml() const; + void append(const QString &text); + void ensureCursorVisible(); + virtual QVariant loadResource(int type, const QUrl &name); + QMenu *createStandardContextMenu() /Factory/; + QMenu *createStandardContextMenu(const QPoint &position) /Factory/; + QTextCursor cursorForPosition(const QPoint &pos) const; + QRect cursorRect(const QTextCursor &cursor) const; + QRect cursorRect() const; + QString anchorAt(const QPoint &pos) const; + bool overwriteMode() const; + void setOverwriteMode(bool overwrite); + bool acceptRichText() const; + void setAcceptRichText(bool accept); + void setTextInteractionFlags(Qt::TextInteractionFlags flags); + Qt::TextInteractionFlags textInteractionFlags() const; + void setCursorWidth(int width); + int cursorWidth() const; + void setExtraSelections(const QList &selections); + QList extraSelections() const; + bool canPaste() const; + void moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); +%If (PyQt_Printer) + void print(QPagedPaintDevice *printer) const; +%End + +public slots: + void setFontPointSize(qreal s); + void setFontFamily(const QString &fontFamily); + void setFontWeight(int w); + void setFontUnderline(bool b); + void setFontItalic(bool b); + void setText(const QString &text); + void setTextColor(const QColor &c); + void setCurrentFont(const QFont &f); + void setAlignment(Qt::Alignment a); + void setPlainText(const QString &text); + void setHtml(const QString &text); + void cut(); + void copy(); + void paste(); + void clear(); + void selectAll(); + void insertPlainText(const QString &text); + void insertHtml(const QString &text); + void scrollToAnchor(const QString &name); + void redo(); + void undo(); + void zoomIn(int range = 1); + void zoomOut(int range = 1); + +signals: + void textChanged(); + void undoAvailable(bool b); + void redoAvailable(bool b); + void currentCharFormatChanged(const QTextCharFormat &format); + void copyAvailable(bool b); + void selectionChanged(); + void cursorPositionChanged(); + +protected: + virtual bool event(QEvent *e); + virtual void timerEvent(QTimerEvent *e); + virtual void keyPressEvent(QKeyEvent *e); + virtual void keyReleaseEvent(QKeyEvent *e); + virtual void resizeEvent(QResizeEvent *); + virtual void paintEvent(QPaintEvent *e); + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *e); + virtual void mouseReleaseEvent(QMouseEvent *e); + virtual void mouseDoubleClickEvent(QMouseEvent *e); + virtual bool focusNextPrevChild(bool next); + virtual void contextMenuEvent(QContextMenuEvent *e); + virtual void dragEnterEvent(QDragEnterEvent *e); + virtual void dragLeaveEvent(QDragLeaveEvent *e); + virtual void dragMoveEvent(QDragMoveEvent *e); + virtual void dropEvent(QDropEvent *e); + virtual void focusInEvent(QFocusEvent *e); + virtual void focusOutEvent(QFocusEvent *e); + virtual void showEvent(QShowEvent *); + virtual void changeEvent(QEvent *e); + virtual void wheelEvent(QWheelEvent *e); + virtual QMimeData *createMimeDataFromSelection() const /Factory/; + virtual bool canInsertFromMimeData(const QMimeData *source) const; + virtual void insertFromMimeData(const QMimeData *source); + virtual void inputMethodEvent(QInputMethodEvent *); + +public: + virtual QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + +protected: + virtual void scrollContentsBy(int dx, int dy); + +public: + QColor textBackgroundColor() const; + +public slots: + void setTextBackgroundColor(const QColor &c); + +public: + void setPlaceholderText(const QString &placeholderText); + QString placeholderText() const; + bool find(const QRegularExpression &exp, QTextDocument::FindFlags options = QTextDocument::FindFlags()); + QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const; + qreal tabStopDistance() const; + void setTabStopDistance(qreal distance); + QString toMarkdown(QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub) const; + +public slots: + void setMarkdown(const QString &markdown); +}; diff --git a/sip/QtWidgets/qtoolbar.sip b/sip/QtWidgets/qtoolbar.sip new file mode 100644 index 0000000..5d8f1ca --- /dev/null +++ b/sip/QtWidgets/qtoolbar.sip @@ -0,0 +1,121 @@ +// qtoolbar.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QToolBar : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + QToolBar(const QString &title, QWidget *parent /TransferThis/ = 0); + explicit QToolBar(QWidget *parent /TransferThis/ = 0); + virtual ~QToolBar(); + void setMovable(bool movable); + bool isMovable() const; + void setAllowedAreas(Qt::ToolBarAreas areas); + Qt::ToolBarAreas allowedAreas() const; + bool isAreaAllowed(Qt::ToolBarArea area) const; + void setOrientation(Qt::Orientation orientation); + Qt::Orientation orientation() const; + void clear(); +%If (- Qt_6_3_0) + void addAction(QAction *); +%End +%If (- Qt_6_3_0) + QAction *addAction(const QString &text) /Transfer/; +%End +%If (- Qt_6_3_0) + QAction *addAction(const QIcon &icon, const QString &text) /Transfer/; +%End +%If (- Qt_6_3_0) + QAction *addAction(const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /Transfer/; +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a1, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipRes = sipCpp->addAction(*a0, receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(1, a1); + } +%End + +%End +%If (- Qt_6_3_0) + QAction *addAction(const QIcon &icon, const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /Transfer/; +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a2, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipRes = sipCpp->addAction(*a0, *a1, receiver, slot_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(2, a2); + } +%End + +%End + QAction *addSeparator() /Transfer/; + QAction *insertSeparator(QAction *before) /Transfer/; + QAction *addWidget(QWidget *widget /Transfer/) /Transfer/; + QAction *insertWidget(QAction *before, QWidget *widget /Transfer/) /Transfer/; + QRect actionGeometry(QAction *action) const; + QAction *actionAt(const QPoint &p) const; + QAction *actionAt(int ax, int ay) const; + QAction *toggleViewAction() const; + QSize iconSize() const; + Qt::ToolButtonStyle toolButtonStyle() const; + QWidget *widgetForAction(QAction *action) const; + +public slots: + void setIconSize(const QSize &iconSize); + void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle); + +signals: + void actionTriggered(QAction *action); + void movableChanged(bool movable); + void allowedAreasChanged(Qt::ToolBarAreas allowedAreas); + void orientationChanged(Qt::Orientation orientation); + void iconSizeChanged(const QSize &iconSize); + void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle); + void topLevelChanged(bool topLevel); + void visibilityChanged(bool visible); + +protected: + virtual void initStyleOption(QStyleOptionToolBar *option) const; + virtual void actionEvent(QActionEvent *event); + virtual void changeEvent(QEvent *event); + virtual void paintEvent(QPaintEvent *event); + virtual bool event(QEvent *event); + +public: + bool isFloatable() const; + void setFloatable(bool floatable); + bool isFloating() const; +}; diff --git a/sip/QtWidgets/qtoolbox.sip b/sip/QtWidgets/qtoolbox.sip new file mode 100644 index 0000000..7909e6b --- /dev/null +++ b/sip/QtWidgets/qtoolbox.sip @@ -0,0 +1,64 @@ +// qtoolbox.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QToolBox : QFrame +{ +%TypeHeaderCode +#include +%End + +public: + QToolBox(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QToolBox(); + int addItem(QWidget *item /Transfer/, const QString &text); + int addItem(QWidget *item /Transfer/, const QIcon &iconSet, const QString &text); + int insertItem(int index, QWidget *item /Transfer/, const QString &text); + int insertItem(int index, QWidget *widget /Transfer/, const QIcon &icon, const QString &text); + void removeItem(int index); + void setItemEnabled(int index, bool enabled); + bool isItemEnabled(int index) const; + void setItemText(int index, const QString &text); + QString itemText(int index) const; + void setItemIcon(int index, const QIcon &icon); + QIcon itemIcon(int index) const; + void setItemToolTip(int index, const QString &toolTip); + QString itemToolTip(int index) const; + int currentIndex() const; + QWidget *currentWidget() const; + QWidget *widget(int index) const; + int indexOf(const QWidget *widget) const; + int count() const /__len__/; + +public slots: + void setCurrentIndex(int index); + void setCurrentWidget(QWidget *widget); + +signals: + void currentChanged(int index); + +protected: + virtual void itemInserted(int index); + virtual void itemRemoved(int index); + virtual bool event(QEvent *e); + virtual void showEvent(QShowEvent *e); + virtual void changeEvent(QEvent *); +}; diff --git a/sip/QtWidgets/qtoolbutton.sip b/sip/QtWidgets/qtoolbutton.sip new file mode 100644 index 0000000..91e34ac --- /dev/null +++ b/sip/QtWidgets/qtoolbutton.sip @@ -0,0 +1,76 @@ +// qtoolbutton.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QToolButton : QAbstractButton +{ +%TypeHeaderCode +#include +%End + +public: + enum ToolButtonPopupMode + { + DelayedPopup, + MenuButtonPopup, + InstantPopup, + }; + + explicit QToolButton(QWidget *parent /TransferThis/ = 0); + virtual ~QToolButton(); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + Qt::ToolButtonStyle toolButtonStyle() const; + Qt::ArrowType arrowType() const; + void setArrowType(Qt::ArrowType type); + void setMenu(QMenu *menu /KeepReference/); + QMenu *menu() const; + void setPopupMode(QToolButton::ToolButtonPopupMode mode); + QToolButton::ToolButtonPopupMode popupMode() const; + QAction *defaultAction() const; + void setAutoRaise(bool enable); + bool autoRaise() const; + +public slots: + void showMenu(); + void setToolButtonStyle(Qt::ToolButtonStyle style); + void setDefaultAction(QAction * /KeepReference/); + +signals: + void triggered(QAction *); + +protected: + virtual void initStyleOption(QStyleOptionToolButton *option) const; + virtual bool event(QEvent *e); + virtual void mousePressEvent(QMouseEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void actionEvent(QActionEvent *); + virtual void enterEvent(QEnterEvent *); + virtual void leaveEvent(QEvent *); + virtual void timerEvent(QTimerEvent *); + virtual void changeEvent(QEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void nextCheckState(); + virtual bool hitButton(const QPoint &pos) const; +%If (Qt_6_2_0 -) + virtual void checkStateSet(); +%End +}; diff --git a/sip/QtWidgets/qtooltip.sip b/sip/QtWidgets/qtooltip.sip new file mode 100644 index 0000000..231bda6 --- /dev/null +++ b/sip/QtWidgets/qtooltip.sip @@ -0,0 +1,40 @@ +// qtooltip.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QToolTip +{ +%TypeHeaderCode +#include +%End + + QToolTip(); + +public: + static void showText(const QPoint &pos, const QString &text, QWidget *widget = 0, const QRect &rect = {}, int msecShowTime = -1); + static QPalette palette(); + static void hideText(); + static void setPalette(const QPalette &); + static QFont font(); + static void setFont(const QFont &); + static bool isVisible(); + static QString text(); +}; diff --git a/sip/QtWidgets/qtreeview.sip b/sip/QtWidgets/qtreeview.sip new file mode 100644 index 0000000..8da070d --- /dev/null +++ b/sip/QtWidgets/qtreeview.sip @@ -0,0 +1,155 @@ +// qtreeview.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTreeView : QAbstractItemView +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTreeView(QWidget *parent /TransferThis/ = 0); + virtual ~QTreeView(); + virtual void setModel(QAbstractItemModel *model /KeepReference/); + virtual void setRootIndex(const QModelIndex &index); + virtual void setSelectionModel(QItemSelectionModel *selectionModel /KeepReference/); + QHeaderView *header() const; + void setHeader(QHeaderView *header /Transfer/); + int indentation() const; + void setIndentation(int i); + bool rootIsDecorated() const; + void setRootIsDecorated(bool show); + bool uniformRowHeights() const; + void setUniformRowHeights(bool uniform); + bool itemsExpandable() const; + void setItemsExpandable(bool enable); + int columnViewportPosition(int column) const; + int columnWidth(int column) const; + int columnAt(int x) const; + bool isColumnHidden(int column) const; + void setColumnHidden(int column, bool hide); + bool isRowHidden(int row, const QModelIndex &parent) const; + void setRowHidden(int row, const QModelIndex &parent, bool hide); + bool isExpanded(const QModelIndex &index) const; + void setExpanded(const QModelIndex &index, bool expand); + virtual void keyboardSearch(const QString &search); + virtual QRect visualRect(const QModelIndex &index) const; + virtual void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible); + virtual QModelIndex indexAt(const QPoint &p) const; + QModelIndex indexAbove(const QModelIndex &index) const; + QModelIndex indexBelow(const QModelIndex &index) const; + virtual void reset(); + +signals: + void expanded(const QModelIndex &index); + void collapsed(const QModelIndex &index); + +public: + virtual void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList &roles = QList()); + +public slots: + void hideColumn(int column); + void showColumn(int column); + void expand(const QModelIndex &index); + void expandAll(); + void collapse(const QModelIndex &index); + void collapseAll(); + void resizeColumnToContents(int column); + virtual void selectAll(); + +protected slots: + void columnResized(int column, int oldSize, int newSize); + void columnCountChanged(int oldCount, int newCount); + void columnMoved(); + void reexpand(); + void rowsRemoved(const QModelIndex &parent, int first, int last); + +protected: + virtual void scrollContentsBy(int dx, int dy); + virtual void rowsInserted(const QModelIndex &parent, int start, int end); + virtual void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); + virtual QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers); + virtual int horizontalOffset() const; + virtual int verticalOffset() const; + virtual void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command); + virtual QRegion visualRegionForSelection(const QItemSelection &selection) const; + virtual QModelIndexList selectedIndexes() const; + virtual void changeEvent(QEvent *event); + virtual void paintEvent(QPaintEvent *e); + virtual void timerEvent(QTimerEvent *event); + virtual void mouseReleaseEvent(QMouseEvent *event); + virtual void drawRow(QPainter *painter, const QStyleOptionViewItem &options /NoCopy/, const QModelIndex &index) const; + virtual void drawBranches(QPainter *painter, const QRect &rect, const QModelIndex &index) const; + void drawTree(QPainter *painter, const QRegion ®ion) const; + virtual void mousePressEvent(QMouseEvent *e); + virtual void mouseMoveEvent(QMouseEvent *event); + virtual void mouseDoubleClickEvent(QMouseEvent *e); + virtual void keyPressEvent(QKeyEvent *event); + virtual void updateGeometries(); + virtual int sizeHintForColumn(int column) const; + int indexRowSizeHint(const QModelIndex &index) const; + virtual void horizontalScrollbarAction(int action); + virtual bool isIndexHidden(const QModelIndex &index) const; + +public: + void setColumnWidth(int column, int width); + void setSortingEnabled(bool enable); + bool isSortingEnabled() const; + void setAnimated(bool enable); + bool isAnimated() const; + void setAllColumnsShowFocus(bool enable); + bool allColumnsShowFocus() const; + void sortByColumn(int column, Qt::SortOrder order); + int autoExpandDelay() const; + void setAutoExpandDelay(int delay); + bool isFirstColumnSpanned(int row, const QModelIndex &parent) const; + void setFirstColumnSpanned(int row, const QModelIndex &parent, bool span); + void setWordWrap(bool on); + bool wordWrap() const; + +public slots: + void expandToDepth(int depth); + +protected: + virtual void dragMoveEvent(QDragMoveEvent *event); + virtual bool viewportEvent(QEvent *event); + int rowHeight(const QModelIndex &index) const; + virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); + +public: + bool expandsOnDoubleClick() const; + void setExpandsOnDoubleClick(bool enable); + bool isHeaderHidden() const; + void setHeaderHidden(bool hide); + void setTreePosition(int logicalIndex); + int treePosition() const; + +protected: + virtual QSize viewportSizeHint() const; + +public: + void resetIndentation(); + +public slots: + void expandRecursively(const QModelIndex &index, int depth = -1); +}; diff --git a/sip/QtWidgets/qtreewidget.sip b/sip/QtWidgets/qtreewidget.sip new file mode 100644 index 0000000..7f64e27 --- /dev/null +++ b/sip/QtWidgets/qtreewidget.sip @@ -0,0 +1,246 @@ +// qtreewidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTreeWidgetItem /Supertype=PyQt6.sip.wrapper/ +{ +%TypeHeaderCode +#include +%End + +public: + enum ItemType /BaseType=IntEnum/ + { + Type, + UserType, + }; + + QTreeWidgetItem(QTreeWidgetItem *parent /TransferThis/, QTreeWidgetItem *after, int type = QTreeWidgetItem::Type); + QTreeWidgetItem(QTreeWidgetItem *parent /TransferThis/, const QStringList &strings, int type = QTreeWidgetItem::Type); + QTreeWidgetItem(QTreeWidgetItem *parent /TransferThis/, int type = QTreeWidgetItem::Type); + QTreeWidgetItem(QTreeWidget *parent /TransferThis/, QTreeWidgetItem *after, int type = QTreeWidgetItem::Type); + QTreeWidgetItem(QTreeWidget *parent /TransferThis/, const QStringList &strings, int type = QTreeWidgetItem::Type); + QTreeWidgetItem(QTreeWidget *parent /TransferThis/, int type = QTreeWidgetItem::Type); + QTreeWidgetItem(const QStringList &strings, int type = QTreeWidgetItem::Type); + explicit QTreeWidgetItem(int type = QTreeWidgetItem::Type); + QTreeWidgetItem(const QTreeWidgetItem &other); + virtual ~QTreeWidgetItem(); + virtual QTreeWidgetItem *clone() const /Factory/; + QTreeWidget *treeWidget() const; + Qt::ItemFlags flags() const; + QString text(int column) const; + QIcon icon(int column) const; + QString statusTip(int column) const; + QString toolTip(int column) const; + QString whatsThis(int column) const; + QFont font(int column) const; + int textAlignment(int column) const; +%If (Qt_6_4_0 -) + void setTextAlignment(int column, Qt::Alignment alignment); +%End + void setTextAlignment(int column, int alignment); + Qt::CheckState checkState(int column) const; + void setCheckState(int column, Qt::CheckState state); + virtual QVariant data(int column, int role) const; + virtual void setData(int column, int role, const QVariant &value); + virtual bool operator<(const QTreeWidgetItem &other /NoCopy/) const; + virtual void read(QDataStream &in) /ReleaseGIL/; + virtual void write(QDataStream &out) const /ReleaseGIL/; + QTreeWidgetItem *parent() const; + QTreeWidgetItem *child(int index) const; + int childCount() const; + int columnCount() const; + void addChild(QTreeWidgetItem *child /Transfer/); + void insertChild(int index, QTreeWidgetItem *child /Transfer/); + QTreeWidgetItem *takeChild(int index) /TransferBack/; + int type() const; + void setFlags(Qt::ItemFlags aflags); + void setText(int column, const QString &atext); + void setIcon(int column, const QIcon &aicon); + void setStatusTip(int column, const QString &astatusTip); + void setToolTip(int column, const QString &atoolTip); + void setWhatsThis(int column, const QString &awhatsThis); + void setFont(int column, const QFont &afont); + int indexOfChild(QTreeWidgetItem *achild) const; + QSize sizeHint(int column) const; + void setSizeHint(int column, const QSize &size); + void addChildren(const QList &children /Transfer/); + void insertChildren(int index, const QList &children /Transfer/); + QList takeChildren() /TransferBack/; + QBrush background(int column) const; + void setBackground(int column, const QBrush &brush); + QBrush foreground(int column) const; + void setForeground(int column, const QBrush &brush); + void sortChildren(int column, Qt::SortOrder order); + void setSelected(bool aselect); + bool isSelected() const; + void setHidden(bool ahide); + bool isHidden() const; + void setExpanded(bool aexpand); + bool isExpanded() const; + + enum ChildIndicatorPolicy + { + ShowIndicator, + DontShowIndicator, + DontShowIndicatorWhenChildless, + }; + + void setChildIndicatorPolicy(QTreeWidgetItem::ChildIndicatorPolicy policy); + QTreeWidgetItem::ChildIndicatorPolicy childIndicatorPolicy() const; + void removeChild(QTreeWidgetItem *child /TransferBack/); + void setFirstColumnSpanned(bool aspan); + bool isFirstColumnSpanned() const; + void setDisabled(bool disabled); + bool isDisabled() const; + +protected: + void emitDataChanged(); + +private: + QTreeWidgetItem &operator=(const QTreeWidgetItem &); +}; + +QDataStream &operator<<(QDataStream &out, const QTreeWidgetItem &item) /ReleaseGIL/; +QDataStream &operator>>(QDataStream &in, QTreeWidgetItem &item /Constrained/) /ReleaseGIL/; + +class QTreeWidget : QTreeView +{ +%TypeHeaderCode +#include +%End + +public: + explicit QTreeWidget(QWidget *parent /TransferThis/ = 0); + virtual ~QTreeWidget(); + int columnCount() const; + void setColumnCount(int columns); + QTreeWidgetItem *topLevelItem(int index) const; + int topLevelItemCount() const; + void insertTopLevelItem(int index, QTreeWidgetItem *item /Transfer/); + void addTopLevelItem(QTreeWidgetItem *item /Transfer/); + QTreeWidgetItem *takeTopLevelItem(int index) /TransferBack/; + int indexOfTopLevelItem(QTreeWidgetItem *item) const; + void insertTopLevelItems(int index, const QList &items /Transfer/); + void addTopLevelItems(const QList &items /Transfer/); + QTreeWidgetItem *headerItem() const; + void setHeaderItem(QTreeWidgetItem *item /Transfer/); + void setHeaderLabels(const QStringList &labels); + QTreeWidgetItem *currentItem() const; + int currentColumn() const; + void setCurrentItem(QTreeWidgetItem *item); + void setCurrentItem(QTreeWidgetItem *item, int column); + void setCurrentItem(QTreeWidgetItem *item, int column, QItemSelectionModel::SelectionFlags command); + QTreeWidgetItem *itemAt(const QPoint &p) const; + QTreeWidgetItem *itemAt(int ax, int ay) const; + QRect visualItemRect(const QTreeWidgetItem *item) const; + int sortColumn() const; + void sortItems(int column, Qt::SortOrder order); + void editItem(QTreeWidgetItem *item, int column = 0); + void openPersistentEditor(QTreeWidgetItem *item, int column = 0); + void closePersistentEditor(QTreeWidgetItem *item, int column = 0); + QWidget *itemWidget(QTreeWidgetItem *item, int column) const; + void setItemWidget(QTreeWidgetItem *item, int column, QWidget *widget /Transfer/); +%MethodCode + // We have to break the association with any existing widget. Note that I'm + // not sure this is really necessary as it should get tidied up when Qt + // destroys any current widget, except (possibly) when the widget wasn't + // created from PyQt. See also removeItemWidget(), QListWidget and + // QTableWidget. + QWidget *w = sipCpp->itemWidget(a0, a1); + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QWidget); + + if (wo) + sipTransferTo(wo, 0); + } + + Py_BEGIN_ALLOW_THREADS + sipCpp->setItemWidget(a0, a1, a2); + Py_END_ALLOW_THREADS +%End + + QList selectedItems() const; + QList findItems(const QString &text, Qt::MatchFlags flags, int column = 0) const; + +public slots: + void scrollToItem(const QTreeWidgetItem *item, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible); + void expandItem(const QTreeWidgetItem *item); + void collapseItem(const QTreeWidgetItem *item); + void clear(); + +signals: + void itemPressed(QTreeWidgetItem *item, int column); + void itemClicked(QTreeWidgetItem *item, int column); + void itemDoubleClicked(QTreeWidgetItem *item, int column); + void itemActivated(QTreeWidgetItem *item, int column); + void itemEntered(QTreeWidgetItem *item, int column); + void itemChanged(QTreeWidgetItem *item, int column); + void itemExpanded(QTreeWidgetItem *item); + void itemCollapsed(QTreeWidgetItem *item); + void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); + void itemSelectionChanged(); + +protected: + virtual QStringList mimeTypes() const; + virtual QMimeData *mimeData(const QList &items) const /TransferBack/; + virtual bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action); + virtual Qt::DropActions supportedDropActions() const; + +public: + QModelIndex indexFromItem(const QTreeWidgetItem *item, int column = 0) const; + QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const; + +protected: + virtual bool event(QEvent *e); + virtual void dropEvent(QDropEvent *event); + +public: + QTreeWidgetItem *invisibleRootItem() const /Transfer/; + void setHeaderLabel(const QString &alabel); + QTreeWidgetItem *itemAbove(const QTreeWidgetItem *item) const; + QTreeWidgetItem *itemBelow(const QTreeWidgetItem *item) const; + void removeItemWidget(QTreeWidgetItem *item, int column); +%MethodCode + // We have to break the association with any existing widget. + QWidget *w = sipCpp->itemWidget(a0, a1); + + if (w) + { + PyObject *wo = sipGetPyObject(w, sipType_QWidget); + + if (wo) + sipTransferTo(wo, 0); + } + + Py_BEGIN_ALLOW_THREADS + sipCpp->removeItemWidget(a0, a1); + Py_END_ALLOW_THREADS +%End + + virtual void setSelectionModel(QItemSelectionModel *selectionModel /KeepReference/); + bool isPersistentEditorOpen(QTreeWidgetItem *item, int column = 0) const; + +private: + virtual void setModel(QAbstractItemModel *model /KeepReference/); +}; diff --git a/sip/QtWidgets/qtreewidgetitemiterator.sip b/sip/QtWidgets/qtreewidgetitemiterator.sip new file mode 100644 index 0000000..010cd52 --- /dev/null +++ b/sip/QtWidgets/qtreewidgetitemiterator.sip @@ -0,0 +1,67 @@ +// qtreewidgetitemiterator.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QTreeWidgetItemIterator +{ +%TypeHeaderCode +#include +%End + +public: + enum IteratorFlag /BaseType=Flag/ + { + All, + Hidden, + NotHidden, + Selected, + Unselected, + Selectable, + NotSelectable, + DragEnabled, + DragDisabled, + DropEnabled, + DropDisabled, + HasChildren, + NoChildren, + Checked, + NotChecked, + Enabled, + Disabled, + Editable, + NotEditable, + UserFlag, + }; + + typedef QFlags IteratorFlags; + QTreeWidgetItemIterator(QTreeWidgetItem *item, QTreeWidgetItemIterator::IteratorFlags flags = QTreeWidgetItemIterator::All); + QTreeWidgetItemIterator(QTreeWidget *widget, QTreeWidgetItemIterator::IteratorFlags flags = QTreeWidgetItemIterator::All); + QTreeWidgetItemIterator(const QTreeWidgetItemIterator &it); + ~QTreeWidgetItemIterator(); + QTreeWidgetItem *value() const; +%MethodCode + // SIP doesn't support operator* so this is a thin wrapper around it. + sipRes = sipCpp->operator*(); +%End + + QTreeWidgetItemIterator &operator+=(int n); + QTreeWidgetItemIterator &operator-=(int n); +}; diff --git a/sip/QtWidgets/qundoview.sip b/sip/QtWidgets/qundoview.sip new file mode 100644 index 0000000..a39eb3a --- /dev/null +++ b/sip/QtWidgets/qundoview.sip @@ -0,0 +1,44 @@ +// qundoview.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QUndoView : QListView +{ +%TypeHeaderCode +#include +%End + +public: + explicit QUndoView(QWidget *parent /TransferThis/ = 0); + QUndoView(QUndoStack *stack, QWidget *parent /TransferThis/ = 0); + QUndoView(QUndoGroup *group, QWidget *parent /TransferThis/ = 0); + virtual ~QUndoView(); + QUndoStack *stack() const; + QUndoGroup *group() const; + void setEmptyLabel(const QString &label); + QString emptyLabel() const; + void setCleanIcon(const QIcon &icon); + QIcon cleanIcon() const; + +public slots: + void setStack(QUndoStack *stack /KeepReference/); + void setGroup(QUndoGroup *group /KeepReference/); +}; diff --git a/sip/QtWidgets/qwhatsthis.sip b/sip/QtWidgets/qwhatsthis.sip new file mode 100644 index 0000000..3d998c9 --- /dev/null +++ b/sip/QtWidgets/qwhatsthis.sip @@ -0,0 +1,38 @@ +// qwhatsthis.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QWhatsThis +{ +%TypeHeaderCode +#include +%End + + QWhatsThis(); + +public: + static void enterWhatsThisMode(); + static bool inWhatsThisMode(); + static void leaveWhatsThisMode(); + static void showText(const QPoint &pos, const QString &text, QWidget *widget = 0); + static void hideText(); + static QAction *createAction(QObject *parent /TransferThis/ = 0) /Factory/; +}; diff --git a/sip/QtWidgets/qwidget.sip b/sip/QtWidgets/qwidget.sip new file mode 100644 index 0000000..e4796eb --- /dev/null +++ b/sip/QtWidgets/qwidget.sip @@ -0,0 +1,515 @@ +// qwidget.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +const int QWIDGETSIZE_MAX; + +class QWidget : QObject, QPaintDevice +{ +%TypeHeaderCode +#include +%End + +%TypeCode +// Transfer the ownership of a single widget to a parent. +static void qtgui_TransferWidget(QWidget *w, PyObject *py_parent) +{ + PyObject *py_w = sipGetPyObject(w, sipType_QWidget); + + if (py_w) + sipTransferTo(py_w, py_parent); +} + + +// Transfer ownership of all widgets in a layout to their new parent. +static void qtwidgets_TransferLayoutWidgets(QLayout *lay, PyObject *pw) +{ + int n = lay->count(); + + for (int i = 0; i < n; ++i) + { + QLayoutItem *item = lay->itemAt(i); + QWidget *w = item->widget(); + + if (w) + { + qtgui_TransferWidget(w, pw); + } + else + { + QLayout *l = item->layout(); + + if (l) + qtwidgets_TransferLayoutWidgets(l, pw); + } + } + + QWidget *mb = lay->menuBar(); + + if (mb) + qtgui_TransferWidget(mb, pw); +} +%End + +public: + QWidget(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QWidget(); + virtual int devType() const; + QStyle *style() const; + void setStyle(QStyle * /KeepReference/); + bool isEnabledTo(const QWidget *) const; + +public slots: + void setEnabled(bool); + void setDisabled(bool); + void setWindowModified(bool); + +public: + QRect frameGeometry() const; + QRect normalGeometry() const; + int x() const; + int y() const; + QPoint pos() const; + QSize frameSize() const; + QRect childrenRect() const; + QRegion childrenRegion() const; + QSize minimumSize() const; + QSize maximumSize() const; + void setMinimumSize(int minw, int minh); + void setMaximumSize(int maxw, int maxh); + void setMinimumWidth(int minw); + void setMinimumHeight(int minh); + void setMaximumWidth(int maxw); + void setMaximumHeight(int maxh); + QSize sizeIncrement() const; + void setSizeIncrement(int w, int h); + QSize baseSize() const; + void setBaseSize(int basew, int baseh); + void setFixedSize(const QSize &); + void setFixedSize(int w, int h); + void setFixedWidth(int w); + void setFixedHeight(int h); + QPoint mapToGlobal(const QPoint &) const; + QPointF mapToGlobal(const QPointF &) const; + QPoint mapFromGlobal(const QPoint &) const; + QPointF mapFromGlobal(const QPointF &) const; + QPoint mapToParent(const QPoint &) const; + QPointF mapToParent(const QPointF &) const; + QPoint mapFromParent(const QPoint &) const; + QPointF mapFromParent(const QPointF &) const; + QPoint mapTo(const QWidget *, const QPoint &) const; + QPointF mapTo(const QWidget *, const QPointF &) const; + QPoint mapFrom(const QWidget *, const QPoint &) const; + QPointF mapFrom(const QWidget *, const QPointF &) const; + QWidget *window() const; + const QPalette &palette() const; + void setPalette(const QPalette &); + void setBackgroundRole(QPalette::ColorRole); + QPalette::ColorRole backgroundRole() const; + void setForegroundRole(QPalette::ColorRole); + QPalette::ColorRole foregroundRole() const; + void setFont(const QFont &); + QCursor cursor() const; + void setCursor(const QCursor &); + void unsetCursor(); + void setMask(const QBitmap &); + void setMask(const QRegion &); + QRegion mask() const; + void clearMask(); + void setWindowTitle(const QString &); + QString windowTitle() const; + void setWindowIcon(const QIcon &icon); + QIcon windowIcon() const; + void setWindowIconText(const QString &); + QString windowIconText() const; + void setWindowRole(const QString &); + QString windowRole() const; + void setWindowOpacity(qreal level); + qreal windowOpacity() const; + bool isWindowModified() const; + void setToolTip(const QString &); + QString toolTip() const; + void setStatusTip(const QString &); + QString statusTip() const; + void setWhatsThis(const QString &); + QString whatsThis() const; +%If (PyQt_Accessibility) + QString accessibleName() const; +%End +%If (PyQt_Accessibility) + void setAccessibleName(const QString &name); +%End +%If (PyQt_Accessibility) + QString accessibleDescription() const; +%End +%If (PyQt_Accessibility) + void setAccessibleDescription(const QString &description); +%End + void setLayoutDirection(Qt::LayoutDirection direction); + Qt::LayoutDirection layoutDirection() const; + void unsetLayoutDirection(); + bool isRightToLeft() const; + bool isLeftToRight() const; + +public slots: + void setFocus(); + +public: + bool isActiveWindow() const; + void activateWindow(); + void clearFocus(); + void setFocus(Qt::FocusReason reason); + Qt::FocusPolicy focusPolicy() const; + void setFocusPolicy(Qt::FocusPolicy policy); + bool hasFocus() const; + static void setTabOrder(QWidget *, QWidget *); + void setFocusProxy(QWidget * /KeepReference/); + QWidget *focusProxy() const; + Qt::ContextMenuPolicy contextMenuPolicy() const; + void setContextMenuPolicy(Qt::ContextMenuPolicy policy); + void grabMouse(); + void grabMouse(const QCursor &); + void releaseMouse(); + void grabKeyboard(); + void releaseKeyboard(); + int grabShortcut(const QKeySequence &key, Qt::ShortcutContext context = Qt::WindowShortcut); + void releaseShortcut(int id); + void setShortcutEnabled(int id, bool enabled = true); + static QWidget *mouseGrabber(); + static QWidget *keyboardGrabber(); + void setUpdatesEnabled(bool enable); + +public slots: + void update(); + void repaint(); + +public: + void update(const QRect &); + void update(const QRegion &); + void repaint(int x, int y, int w, int h); + void repaint(const QRect &); + void repaint(const QRegion &); + +public slots: + virtual void setVisible(bool visible); + void setHidden(bool hidden); + void show(); + void hide(); + void showMinimized(); + void showMaximized(); + void showFullScreen(); + void showNormal(); + bool close(); + void raise(); + void lower(); + +public: + void stackUnder(QWidget *); + void move(const QPoint &); + void resize(const QSize &); + void setGeometry(const QRect &); + void adjustSize(); + bool isVisibleTo(const QWidget *) const; + bool isMinimized() const; + bool isMaximized() const; + bool isFullScreen() const; + Qt::WindowStates windowState() const; + void setWindowState(Qt::WindowStates state); + void overrideWindowState(Qt::WindowStates state); + virtual QSize sizeHint() const; + virtual QSize minimumSizeHint() const; + QSizePolicy sizePolicy() const; + void setSizePolicy(QSizePolicy); + virtual int heightForWidth(int) const; + QRegion visibleRegion() const; + void setContentsMargins(int left, int top, int right, int bottom); + QRect contentsRect() const; + QLayout *layout() const; + void setLayout(QLayout * /Transfer/); +%MethodCode + Py_BEGIN_ALLOW_THREADS + sipCpp->setLayout(a0); + Py_END_ALLOW_THREADS + + // Internally Qt has reparented all of the widgets in the layout, so we need + // to update the ownership hierachy. + qtwidgets_TransferLayoutWidgets(a0, sipSelf); +%End + + void updateGeometry(); + void setParent(QWidget *parent /TransferThis/); + void setParent(QWidget *parent /TransferThis/, Qt::WindowFlags f); + void scroll(int dx, int dy); + void scroll(int dx, int dy, const QRect &); + QWidget *focusWidget() const; + QWidget *nextInFocusChain() const; + bool acceptDrops() const; + void setAcceptDrops(bool on); +%If (Qt_6_3_0 -) + QAction *addAction(const QIcon &icon, const QString &text) /Transfer/; +%End +%If (Qt_6_3_0 -) + QAction *addAction(const QIcon &icon, const QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, Qt::ConnectionType type = Qt::AutoConnection) /Transfer/; +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a2, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipRes = sipCpp->addAction(*a0, *a1, receiver, slot_signature.constData(), a3); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(2, a2); + } +%End + +%End +%If (Qt_6_3_0 -) + QAction *addAction(const QIcon &icon, const QString &text, const QKeySequence &shortcut) /Transfer/; +%End +%If (Qt_6_3_0 -) + QAction *addAction(const QIcon &icon, const QString &text, const QKeySequence &shortcut, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, Qt::ConnectionType type = Qt::AutoConnection) /Transfer/; +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a3, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipRes = sipCpp->addAction(*a0, *a1, *a2, receiver, slot_signature.constData(), a4); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(3, a3); + } +%End + +%End +%If (Qt_6_3_0 -) + QAction *addAction(const QString &text) /Transfer/; +%End +%If (Qt_6_3_0 -) + QAction *addAction(const QString &text, const QKeySequence &shortcut) /Transfer/; +%End +%If (Qt_6_3_0 -) + QAction *addAction(QString &text, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, Qt::ConnectionType type = Qt::AutoConnection) /Transfer/; +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a1, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipRes = sipCpp->addAction(*a0, receiver, slot_signature.constData(), a2); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(1, a1); + } +%End + +%End +%If (Qt_6_3_0 -) + QAction *addAction(const QString &text, const QKeySequence &shortcut, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/, Qt::ConnectionType type = Qt::AutoConnection) /Transfer/; +%MethodCode + QObject *receiver; + QByteArray slot_signature; + + if ((sipError = pyqt6_qtwidgets_get_connection_parts(a2, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone) + { + sipRes = sipCpp->addAction(*a0, *a1, receiver, slot_signature.constData(), a3); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(2, a2); + } +%End + +%End + void addAction(QAction *action); + void addActions(const QList &actions); + void insertAction(QAction *before, QAction *action); + void insertActions(QAction *before, const QList &actions); + void removeAction(QAction *action); + QList actions() const; + void setWindowFlags(Qt::WindowFlags type); + void overrideWindowFlags(Qt::WindowFlags type); + static QWidget *find(WId); + QWidget *childAt(const QPoint &p) const; + void setAttribute(Qt::WidgetAttribute attribute, bool on = true); + virtual QPaintEngine *paintEngine() const; + void ensurePolished() const; + bool isAncestorOf(const QWidget *child) const; + +signals: + void customContextMenuRequested(const QPoint &pos); + +protected: + virtual bool event(QEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void wheelEvent(QWheelEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void focusInEvent(QFocusEvent *); + virtual void focusOutEvent(QFocusEvent *); + virtual void enterEvent(QEnterEvent *event); + virtual void leaveEvent(QEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void moveEvent(QMoveEvent *); + virtual void resizeEvent(QResizeEvent *); + virtual void closeEvent(QCloseEvent *); + virtual void contextMenuEvent(QContextMenuEvent *); + virtual void tabletEvent(QTabletEvent *); + virtual void actionEvent(QActionEvent *); + virtual void dragEnterEvent(QDragEnterEvent *); + virtual void dragMoveEvent(QDragMoveEvent *); + virtual void dragLeaveEvent(QDragLeaveEvent *); + virtual void dropEvent(QDropEvent *); + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + virtual void changeEvent(QEvent *); + virtual int metric(QPaintDevice::PaintDeviceMetric) const; + virtual void inputMethodEvent(QInputMethodEvent *); + +public: + virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; + +protected: + void updateMicroFocus(Qt::InputMethodQuery query = Qt::ImQueryAll); + void create(WId window = 0, bool initializeWindow = true, bool destroyOldWindow = true); + void destroy(bool destroyWindow = true, bool destroySubWindows = true); + virtual bool focusNextPrevChild(bool next); + bool focusNextChild(); + bool focusPreviousChild(); + +public: + QWidget *childAt(int ax, int ay) const; + Qt::WindowType windowType() const; + Qt::WindowFlags windowFlags() const; + WId winId() const; + bool isWindow() const; + bool isEnabled() const; + bool isModal() const; + int minimumWidth() const; + int minimumHeight() const; + int maximumWidth() const; + int maximumHeight() const; + void setMinimumSize(const QSize &s); + void setMaximumSize(const QSize &s); + void setSizeIncrement(const QSize &s); + void setBaseSize(const QSize &s); + const QFont &font() const; + QFontMetrics fontMetrics() const; + QFontInfo fontInfo() const; + void setMouseTracking(bool enable); + bool hasMouseTracking() const; + bool underMouse() const; + bool updatesEnabled() const; + void update(int ax, int ay, int aw, int ah); + bool isVisible() const; + bool isHidden() const; + void move(int ax, int ay); + void resize(int w, int h); + void setGeometry(int ax, int ay, int aw, int ah); + QRect rect() const; + const QRect &geometry() const; + QSize size() const; + int width() const; + int height() const; + QWidget *parentWidget() const; + void setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver); + bool testAttribute(Qt::WidgetAttribute attribute) const; + Qt::WindowModality windowModality() const; + void setWindowModality(Qt::WindowModality windowModality); + bool autoFillBackground() const; + void setAutoFillBackground(bool enabled); + void setStyleSheet(const QString &styleSheet); + QString styleSheet() const; + void setShortcutAutoRepeat(int id, bool enabled = true); + QByteArray saveGeometry() const; + bool restoreGeometry(const QByteArray &geometry); + + enum RenderFlag /BaseType=Flag/ + { + DrawWindowBackground, + DrawChildren, + IgnoreMask, + }; + + typedef QFlags RenderFlags; + void render(QPaintDevice *target, const QPoint &targetOffset = QPoint(), const QRegion &sourceRegion = QRegion(), QWidget::RenderFlags flags = QWidget::RenderFlags(QWidget::DrawWindowBackground | QWidget::DrawChildren)); + void render(QPainter *painter, const QPoint &targetOffset = QPoint(), const QRegion &sourceRegion = QRegion(), QWidget::RenderFlags flags = QWidget::RenderFlags(QWidget::DrawWindowBackground | QWidget::DrawChildren)); + void setLocale(const QLocale &locale); + QLocale locale() const; + void unsetLocale(); + WId effectiveWinId() const; + QWidget *nativeParentWidget() const; + void setWindowFilePath(const QString &filePath); + QString windowFilePath() const; + QGraphicsProxyWidget *graphicsProxyWidget() const; + QGraphicsEffect *graphicsEffect() const; + void setGraphicsEffect(QGraphicsEffect *effect /Transfer/); + void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); + void ungrabGesture(Qt::GestureType type); + void setContentsMargins(const QMargins &margins); + QMargins contentsMargins() const; + QWidget *previousInFocusChain() const; + Qt::InputMethodHints inputMethodHints() const; + void setInputMethodHints(Qt::InputMethodHints hints); + virtual bool hasHeightForWidth() const; + QPixmap grab(const QRect &rectangle = QRect(QPoint(0, 0), QSize(-1, -1))); + static SIP_PYOBJECT createWindowContainer(QWindow *window /GetWrapper/, QWidget *parent /GetWrapper/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()) /Factory,TypeHint="QWidget"/; +%MethodCode + // Ownersip issues are complicated so we handle them explicitly. + + QWidget *w = QWidget::createWindowContainer(a0, a1, *a2); + + sipRes = sipConvertFromNewType(w, sipType_QWidget, a1Wrapper); + + if (sipRes) + sipTransferTo(a0Wrapper, sipRes); +%End + + QWindow *windowHandle() const; + +protected: + virtual bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result /Out/); + virtual QPainter *sharedPainter() const; + virtual void initPainter(QPainter *painter) const; + +public: + void setToolTipDuration(int msec); + int toolTipDuration() const; + +signals: + void windowTitleChanged(const QString &title); + void windowIconChanged(const QIcon &icon); + void windowIconTextChanged(const QString &iconText); + +public: + void setTabletTracking(bool enable); + bool hasTabletTracking() const; + void setWindowFlag(Qt::WindowType, bool on = true); + QScreen *screen() const; + void setScreen(QScreen *); +}; diff --git a/sip/QtWidgets/qwidgetaction.sip b/sip/QtWidgets/qwidgetaction.sip new file mode 100644 index 0000000..5a52d51 --- /dev/null +++ b/sip/QtWidgets/qwidgetaction.sip @@ -0,0 +1,43 @@ +// qwidgetaction.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QWidgetAction : QAction +{ +%TypeHeaderCode +#include +%End + +public: + explicit QWidgetAction(QObject *parent /TransferThis/); + virtual ~QWidgetAction(); + void setDefaultWidget(QWidget *w /Transfer/); + QWidget *defaultWidget() const; + QWidget *requestWidget(QWidget *parent /TransferThis/) /Factory/; + void releaseWidget(QWidget *widget /TransferBack/); + +protected: + virtual bool event(QEvent *); + virtual bool eventFilter(QObject *, QEvent *); + virtual QWidget *createWidget(QWidget *parent /TransferThis/) /Factory/; + virtual void deleteWidget(QWidget *widget /Transfer/); + QList createdWidgets() const; +}; diff --git a/sip/QtWidgets/qwizard.sip b/sip/QtWidgets/qwizard.sip new file mode 100644 index 0000000..ceba326 --- /dev/null +++ b/sip/QtWidgets/qwizard.sip @@ -0,0 +1,238 @@ +// qwizard.sip generated by MetaSIP +// +// This file is part of the QtWidgets Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QWizard : QDialog +{ +%TypeHeaderCode +#include +%End + +public: + enum WizardButton + { + BackButton, + NextButton, + CommitButton, + FinishButton, + CancelButton, + HelpButton, + CustomButton1, + CustomButton2, + CustomButton3, + Stretch, + }; + + enum WizardPixmap + { + WatermarkPixmap, + LogoPixmap, + BannerPixmap, + BackgroundPixmap, + }; + + enum WizardStyle + { + ClassicStyle, + ModernStyle, + MacStyle, + AeroStyle, + }; + + enum WizardOption /BaseType=Flag/ + { + IndependentPages, + IgnoreSubTitles, + ExtendedWatermarkPixmap, + NoDefaultButton, + NoBackButtonOnStartPage, + NoBackButtonOnLastPage, + DisabledBackButtonOnLastPage, + HaveNextButtonOnLastPage, + HaveFinishButtonOnEarlyPages, + NoCancelButton, + CancelButtonOnLeft, + HaveHelpButton, + HelpButtonOnRight, + HaveCustomButton1, + HaveCustomButton2, + HaveCustomButton3, + NoCancelButtonOnLastPage, + }; + + typedef QFlags WizardOptions; + QWizard(QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags()); + virtual ~QWizard(); + int addPage(QWizardPage *page /Transfer/); + void setPage(int id, QWizardPage *page /Transfer/); + QWizardPage *page(int id) const; + bool hasVisitedPage(int id) const; + QList visitedIds() const; + void setStartId(int id); + int startId() const; + QWizardPage *currentPage() const; + int currentId() const; + virtual bool validateCurrentPage(); + virtual int nextId() const; + void setField(const QString &name, const QVariant &value); + QVariant field(const QString &name) const; + void setWizardStyle(QWizard::WizardStyle style); + QWizard::WizardStyle wizardStyle() const; + void setOption(QWizard::WizardOption option, bool on = true); + bool testOption(QWizard::WizardOption option) const; + void setOptions(QWizard::WizardOptions options); + QWizard::WizardOptions options() const; + void setButtonText(QWizard::WizardButton which, const QString &text); + QString buttonText(QWizard::WizardButton which) const; + void setButtonLayout(const QList &layout); + void setButton(QWizard::WizardButton which, QAbstractButton *button /Transfer/); + QAbstractButton *button(QWizard::WizardButton which) const /Transfer/; + void setTitleFormat(Qt::TextFormat format); + Qt::TextFormat titleFormat() const; + void setSubTitleFormat(Qt::TextFormat format); + Qt::TextFormat subTitleFormat() const; + void setPixmap(QWizard::WizardPixmap which, const QPixmap &pixmap); + QPixmap pixmap(QWizard::WizardPixmap which) const; + void setDefaultProperty(const char *className, const char *property, SIP_PYOBJECT changedSignal /TypeHint="PYQT_SIGNAL"/); +%MethodCode + QByteArray signal_signature; + + if ((sipError = pyqt6_qtwidgets_get_signal_signature(a2, 0, signal_signature)) == sipErrorNone) + { + sipCpp->setDefaultProperty(a0, a1, signal_signature.constData()); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(2, a2); + } +%End + + virtual void setVisible(bool visible); + virtual QSize sizeHint() const; + +signals: + void currentIdChanged(int id); + void helpRequested(); + void customButtonClicked(int which); + +public slots: + void back(); + void next(); + void restart(); + +protected: + virtual bool event(QEvent *event); + virtual void resizeEvent(QResizeEvent *event); + virtual void paintEvent(QPaintEvent *event); + virtual void done(int result); + virtual void initializePage(int id); + virtual void cleanupPage(int id); + +public: + void removePage(int id); + QList pageIds() const; + void setSideWidget(QWidget *widget /Transfer/); + QWidget *sideWidget() const; + +signals: + void pageAdded(int id); + void pageRemoved(int id); + +public slots: +%If (Qt_6_4_0 -) + void setCurrentId(int id); +%End +}; + +class QWizardPage : QWidget +{ +%TypeHeaderCode +#include +%End + +public: + explicit QWizardPage(QWidget *parent /TransferThis/ = 0); + virtual ~QWizardPage(); + void setTitle(const QString &title); + QString title() const; + void setSubTitle(const QString &subTitle); + QString subTitle() const; + void setPixmap(QWizard::WizardPixmap which, const QPixmap &pixmap); + QPixmap pixmap(QWizard::WizardPixmap which) const; + void setFinalPage(bool finalPage); + bool isFinalPage() const; + void setCommitPage(bool commitPage); + bool isCommitPage() const; + void setButtonText(QWizard::WizardButton which, const QString &text); + QString buttonText(QWizard::WizardButton which) const; + virtual void initializePage(); + virtual void cleanupPage(); + virtual bool validatePage(); + virtual bool isComplete() const; + virtual int nextId() const; + +signals: + void completeChanged(); + +protected: + void setField(const QString &name, const QVariant &value); + QVariant field(const QString &name) const; + void registerField(const QString &name, QWidget *widget, const char *property = 0, SIP_PYOBJECT changedSignal /TypeHint="PYQT_SIGNAL"/ = 0) [void (const QString &name, QWidget *widget, const char *property = 0, const char *changedSignal = 0)]; +%MethodCode + typedef sipErrorState (*pyqt6_get_signal_signature_t)(PyObject *, QObject *, QByteArray &); + + static pyqt6_get_signal_signature_t pyqt6_get_signal_signature = 0; + + if (!pyqt6_get_signal_signature) + { + pyqt6_get_signal_signature = (pyqt6_get_signal_signature_t)sipImportSymbol("pyqt6_get_signal_signature"); + Q_ASSERT(pyqt6_get_signal_signature); + } + + QByteArray signal_signature; + const char *signal = 0; + + if (a3 && a3 != Py_None) + { + if ((sipError = pyqt6_get_signal_signature(a3, a1, signal_signature)) == sipErrorNone) + { + signal = signal_signature.constData(); + } + else if (sipError == sipErrorContinue) + { + sipError = sipBadCallableArg(3, a3); + } + } + + if (sipError == sipErrorNone) + { + Py_BEGIN_ALLOW_THREADS + #if defined(SIP_PROTECTED_IS_PUBLIC) + sipCpp->registerField(*a0, a1, a2, signal); + #else + sipCpp->sipProtect_registerField(*a0, a1, a2, signal); + #endif + Py_END_ALLOW_THREADS + } +%End + + QWizard *wizard() const; +}; diff --git a/sip/QtXml/QtXmlmod.sip b/sip/QtXml/QtXmlmod.sip new file mode 100644 index 0000000..962d35b --- /dev/null +++ b/sip/QtXml/QtXmlmod.sip @@ -0,0 +1,48 @@ +// QtXmlmod.sip generated by MetaSIP +// +// This file is part of the QtXml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +%Module(name=PyQt6.QtXml, keyword_arguments="Optional", use_limited_api=True) + +%Import QtCore/QtCoremod.sip + +%Copying +Copyright (c) 2023 Riverbank Computing Limited + +This file is part of PyQt6. + +This file may be used under the terms of the GNU General Public License +version 3.0 as published by the Free Software Foundation and appearing in +the file LICENSE included in the packaging of this file. Please review the +following information to ensure the GNU General Public License version 3.0 +requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you do not wish to use this file under the terms of the GPL version 3.0 +then you may purchase a commercial license. For more information contact +info@riverbankcomputing.com. + +This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +%End + +%DefaultSupertype PyQt6.sip.simplewrapper + +%Include qdom.sip diff --git a/sip/QtXml/qdom.sip b/sip/QtXml/qdom.sip new file mode 100644 index 0000000..60c3ce7 --- /dev/null +++ b/sip/QtXml/qdom.sip @@ -0,0 +1,528 @@ +// qdom.sip generated by MetaSIP +// +// This file is part of the QtXml Python extension module. +// +// Copyright (c) 2023 Riverbank Computing Limited +// +// This file is part of PyQt6. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +class QDomImplementation +{ +%TypeHeaderCode +#include +%End + +public: + QDomImplementation(); + QDomImplementation(const QDomImplementation &); + ~QDomImplementation(); + bool operator==(const QDomImplementation &) const; + bool operator!=(const QDomImplementation &) const; + bool hasFeature(const QString &feature, const QString &version) const; + QDomDocumentType createDocumentType(const QString &qName, const QString &publicId, const QString &systemId); + QDomDocument createDocument(const QString &nsURI, const QString &qName, const QDomDocumentType &doctype); + + enum InvalidDataPolicy + { + AcceptInvalidChars, + DropInvalidChars, + ReturnNullNode, + }; + + static QDomImplementation::InvalidDataPolicy invalidDataPolicy(); + static void setInvalidDataPolicy(QDomImplementation::InvalidDataPolicy policy); + bool isNull(); +}; + +class QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + enum NodeType + { + ElementNode, + AttributeNode, + TextNode, + CDATASectionNode, + EntityReferenceNode, + EntityNode, + ProcessingInstructionNode, + CommentNode, + DocumentNode, + DocumentTypeNode, + DocumentFragmentNode, + NotationNode, + BaseNode, + CharacterDataNode, + }; + + enum EncodingPolicy + { + EncodingFromDocument, + EncodingFromTextStream, + }; + + QDomNode(); + QDomNode(const QDomNode &); + ~QDomNode(); + bool operator==(const QDomNode &) const; + bool operator!=(const QDomNode &) const; + QDomNode insertBefore(const QDomNode &newChild, const QDomNode &refChild); + QDomNode insertAfter(const QDomNode &newChild, const QDomNode &refChild); + QDomNode replaceChild(const QDomNode &newChild, const QDomNode &oldChild); + QDomNode removeChild(const QDomNode &oldChild); + QDomNode appendChild(const QDomNode &newChild); + bool hasChildNodes() const; + QDomNode cloneNode(bool deep = true) const; + void normalize(); + bool isSupported(const QString &feature, const QString &version) const; + QString nodeName() const; + QDomNode::NodeType nodeType() const; + QDomNode parentNode() const; + QDomNodeList childNodes() const; + QDomNode firstChild() const; + QDomNode lastChild() const; + QDomNode previousSibling() const; + QDomNode nextSibling() const; + QDomNamedNodeMap attributes() const; + QDomDocument ownerDocument() const; + QString namespaceURI() const; + QString localName() const; + bool hasAttributes() const; + QString nodeValue() const; + void setNodeValue(const QString &); + QString prefix() const; + void setPrefix(const QString &pre); + bool isAttr() const; + bool isCDATASection() const; + bool isDocumentFragment() const; + bool isDocument() const; + bool isDocumentType() const; + bool isElement() const; + bool isEntityReference() const; + bool isText() const; + bool isEntity() const; + bool isNotation() const; + bool isProcessingInstruction() const; + bool isCharacterData() const; + bool isComment() const; + QDomNode namedItem(const QString &name) const; + bool isNull() const; + void clear(); + QDomAttr toAttr() const; + QDomCDATASection toCDATASection() const; + QDomDocumentFragment toDocumentFragment() const; + QDomDocument toDocument() const; + QDomDocumentType toDocumentType() const; + QDomElement toElement() const; + QDomEntityReference toEntityReference() const; + QDomText toText() const; + QDomEntity toEntity() const; + QDomNotation toNotation() const; + QDomProcessingInstruction toProcessingInstruction() const; + QDomCharacterData toCharacterData() const; + QDomComment toComment() const; + void save(QTextStream &, int, QDomNode::EncodingPolicy = QDomNode::EncodingFromDocument) const /ReleaseGIL/; + QDomElement firstChildElement(const QString &tagName = QString(), const QString &namespaceURI = QString()) const; + QDomElement lastChildElement(const QString &tagName = QString(), const QString &namespaceURI = QString()) const; + QDomElement previousSiblingElement(const QString &tagName = QString(), const QString &namespaceURI = QString()) const; + QDomElement nextSiblingElement(const QString &taName = QString(), const QString &namespaceURI = QString()) const; + int lineNumber() const; + int columnNumber() const; +}; + +class QDomNodeList +{ +%TypeHeaderCode +#include +%End + +public: + QDomNodeList(); + QDomNodeList(const QDomNodeList &); + ~QDomNodeList(); + bool operator==(const QDomNodeList &) const; + bool operator!=(const QDomNodeList &) const; + QDomNode item(int index) const; + QDomNode at(int index) const; + int length() const; + int count() const /__len__/; + int size() const; + bool isEmpty() const; +}; + +class QDomDocumentType : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomDocumentType(); + QDomDocumentType(const QDomDocumentType &x); + QString name() const; + QDomNamedNodeMap entities() const; + QDomNamedNodeMap notations() const; + QString publicId() const; + QString systemId() const; + QString internalSubset() const; + QDomNode::NodeType nodeType() const; +}; + +class QDomDocument : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomDocument(); + explicit QDomDocument(const QString &name); + explicit QDomDocument(const QDomDocumentType &doctype); + QDomDocument(const QDomDocument &x); + ~QDomDocument(); + QDomElement createElement(const QString &tagName); + QDomDocumentFragment createDocumentFragment(); + QDomText createTextNode(const QString &data); + QDomComment createComment(const QString &data); + QDomCDATASection createCDATASection(const QString &data); + QDomProcessingInstruction createProcessingInstruction(const QString &target, const QString &data); + QDomAttr createAttribute(const QString &name); + QDomEntityReference createEntityReference(const QString &name); + QDomNodeList elementsByTagName(const QString &tagname) const; + QDomNode importNode(const QDomNode &importedNode, bool deep); + QDomElement createElementNS(const QString &nsURI, const QString &qName); + QDomAttr createAttributeNS(const QString &nsURI, const QString &qName); + QDomNodeList elementsByTagNameNS(const QString &nsURI, const QString &localName); + QDomElement elementById(const QString &elementId); + QDomDocumentType doctype() const; + QDomImplementation implementation() const; + QDomElement documentElement() const; + QDomNode::NodeType nodeType() const; +%If (Qt_6_5_0 -) + + enum class ParseOption + { + Default, + UseNamespaceProcessing, + PreserveSpacingOnlyNodes, + }; + +%End +%If (Qt_6_5_0 -) + typedef QFlags ParseOptions; +%End +%If (Qt_6_5_0 -) + SIP_PYOBJECT setContent(QXmlStreamReader *reader, QDomDocument::ParseOptions options = QDomDocument::ParseOption::Default) /ReleaseGIL,TypeHint="Tuple [bool, str, int, int]"/; +%MethodCode + QDomDocument::ParseResult pr; + + Py_BEGIN_ALLOW_THREADS + pr = sipCpp->setContent(a0, *a1); + Py_END_ALLOW_THREADS + + return sipBuildResult(NULL, "(bNnn)", + (int)bool(pr), + new QString(pr.errorMessage), sipType_QString, NULL, + (long long)pr.errorLine, + (long long)pr.errorColumn); +%End + +%End +%If (Qt_6_5_0 -) + SIP_PYOBJECT setContent(QIODevice *device, QDomDocument::ParseOptions options = QDomDocument::ParseOption::Default) /ReleaseGIL,TypeHint="Tuple [bool, str, int, int]"/; +%MethodCode + QDomDocument::ParseResult pr; + + Py_BEGIN_ALLOW_THREADS + pr = sipCpp->setContent(a0, *a1); + Py_END_ALLOW_THREADS + + return sipBuildResult(NULL, "(bNnn)", + (int)bool(pr), + new QString(pr.errorMessage), sipType_QString, NULL, + (long long)pr.errorLine, + (long long)pr.errorColumn); +%End + +%End +%If (Qt_6_5_0 -) + SIP_PYOBJECT setContent(QAnyStringView data, QDomDocument::ParseOptions options = QDomDocument::ParseOption::Default) /TypeHint="Tuple [bool, str, int, int]"/; +%MethodCode + QDomDocument::ParseResult pr; + + pr = sipCpp->setContent(*a0, *a1); + + return sipBuildResult(NULL, "(bNnn)", + (int)bool(pr), + new QString(pr.errorMessage), sipType_QString, NULL, + (long long)pr.errorLine, + (long long)pr.errorColumn); +%End + +%End + bool setContent(const QByteArray &text, bool namespaceProcessing, QString *errorMsg /Out/ = 0, int *errorLine = 0, int *errorColumn = 0); + bool setContent(const QString &text, bool namespaceProcessing, QString *errorMsg /Out/ = 0, int *errorLine = 0, int *errorColumn = 0); + bool setContent(QIODevice *dev, bool namespaceProcessing, QString *errorMsg /Out/ = 0, int *errorLine = 0, int *errorColumn = 0) /ReleaseGIL/; +%If (- Qt_6_5_0) + bool setContent(const QByteArray &text, QString *errorMsg /Out/ = 0, int *errorLine = 0, int *errorColumn = 0); +%End +%If (- Qt_6_5_0) + bool setContent(const QString &text, QString *errorMsg /Out/ = 0, int *errorLine = 0, int *errorColumn = 0); +%End +%If (- Qt_6_5_0) + bool setContent(QIODevice *dev, QString *errorMsg /Out/ = 0, int *errorLine = 0, int *errorColumn = 0) /ReleaseGIL/; +%End + bool setContent(QXmlStreamReader *reader, bool namespaceProcessing, QString *errorMsg /Out/ = 0, int *errorLine = 0, int *errorColumn = 0); + QString toString(int indent = 1) const; + QByteArray toByteArray(int indent = 1) const; +}; + +class QDomNamedNodeMap +{ +%TypeHeaderCode +#include +%End + +public: + QDomNamedNodeMap(); + QDomNamedNodeMap(const QDomNamedNodeMap &); + ~QDomNamedNodeMap(); + bool operator==(const QDomNamedNodeMap &) const; + bool operator!=(const QDomNamedNodeMap &) const; + QDomNode namedItem(const QString &name) const; + QDomNode setNamedItem(const QDomNode &newNode); + QDomNode removeNamedItem(const QString &name); + QDomNode item(int index) const; + QDomNode namedItemNS(const QString &nsURI, const QString &localName) const; + QDomNode setNamedItemNS(const QDomNode &newNode); + QDomNode removeNamedItemNS(const QString &nsURI, const QString &localName); + int length() const; + int count() const /__len__/; + int size() const; + bool isEmpty() const; + bool contains(const QString &name) const; +}; + +class QDomDocumentFragment : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomDocumentFragment(); + QDomDocumentFragment(const QDomDocumentFragment &x); + QDomNode::NodeType nodeType() const; +}; + +class QDomCharacterData : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomCharacterData(); + QDomCharacterData(const QDomCharacterData &x); + QString substringData(unsigned long offset, unsigned long count); + void appendData(const QString &arg); + void insertData(unsigned long offset, const QString &arg); + void deleteData(unsigned long offset, unsigned long count); + void replaceData(unsigned long offset, unsigned long count, const QString &arg); + int length() const; + QString data() const; + void setData(const QString &); + QDomNode::NodeType nodeType() const; +}; + +class QDomAttr : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomAttr(); + QDomAttr(const QDomAttr &x); + QString name() const; + bool specified() const; + QDomElement ownerElement() const; + QString value() const; + void setValue(const QString &); + QDomNode::NodeType nodeType() const; +}; + +class QDomElement : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomElement(); + QDomElement(const QDomElement &x); + QString attribute(const QString &name, const QString &defaultValue = QString()) const; + void setAttribute(const QString &name, const QString &value); + void setAttribute(const QString &name, qlonglong value); + void setAttribute(const QString &name, qulonglong value); + void setAttribute(const QString &name, double value /Constrained/); + void setAttribute(const QString &name, int value); + void removeAttribute(const QString &name); + QDomAttr attributeNode(const QString &name); + QDomAttr setAttributeNode(const QDomAttr &newAttr); + QDomAttr removeAttributeNode(const QDomAttr &oldAttr); + QDomNodeList elementsByTagName(const QString &tagname) const; + bool hasAttribute(const QString &name) const; + QString attributeNS(const QString &nsURI, const QString &localName, const QString &defaultValue = QString()) const; + void setAttributeNS(const QString &nsURI, const QString &qName, const QString &value); + void setAttributeNS(const QString &nsURI, const QString &qName, double value /Constrained/); + void setAttributeNS(const QString &nsURI, const QString &qName, SIP_PYOBJECT value /TypeHint="int"/); +%MethodCode + qlonglong val = sipLong_AsLongLong(a2); + + if (!PyErr_Occurred()) + { + sipCpp->setAttributeNS(*a0, *a1, val); + } + else + { + // If it is positive then it might fit an unsigned long long. + + qulonglong uval = sipLong_AsUnsignedLongLong(a2); + + if (!PyErr_Occurred()) + { + sipCpp->setAttributeNS(*a0, *a1, uval); + } + else + { + sipError = (PyErr_ExceptionMatches(PyExc_OverflowError) + ? sipErrorFail : sipErrorContinue); + } + } +%End + + void removeAttributeNS(const QString &nsURI, const QString &localName); + QDomAttr attributeNodeNS(const QString &nsURI, const QString &localName); + QDomAttr setAttributeNodeNS(const QDomAttr &newAttr); + QDomNodeList elementsByTagNameNS(const QString &nsURI, const QString &localName) const; + bool hasAttributeNS(const QString &nsURI, const QString &localName) const; + QString tagName() const; + void setTagName(const QString &name); + QDomNamedNodeMap attributes() const; + QDomNode::NodeType nodeType() const; + QString text() const; +}; + +class QDomText : QDomCharacterData +{ +%TypeHeaderCode +#include +%End + +public: + QDomText(); + QDomText(const QDomText &x); + QDomText splitText(int offset); + QDomNode::NodeType nodeType() const; +}; + +class QDomComment : QDomCharacterData +{ +%TypeHeaderCode +#include +%End + +public: + QDomComment(); + QDomComment(const QDomComment &x); + QDomNode::NodeType nodeType() const; +}; + +class QDomCDATASection : QDomText +{ +%TypeHeaderCode +#include +%End + +public: + QDomCDATASection(); + QDomCDATASection(const QDomCDATASection &x); + QDomNode::NodeType nodeType() const; +}; + +class QDomNotation : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomNotation(); + QDomNotation(const QDomNotation &x); + QString publicId() const; + QString systemId() const; + QDomNode::NodeType nodeType() const; +}; + +class QDomEntity : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomEntity(); + QDomEntity(const QDomEntity &x); + QString publicId() const; + QString systemId() const; + QString notationName() const; + QDomNode::NodeType nodeType() const; +}; + +class QDomEntityReference : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomEntityReference(); + QDomEntityReference(const QDomEntityReference &x); + QDomNode::NodeType nodeType() const; +}; + +class QDomProcessingInstruction : QDomNode +{ +%TypeHeaderCode +#include +%End + +public: + QDomProcessingInstruction(); + QDomProcessingInstruction(const QDomProcessingInstruction &x); + QString target() const; + QString data() const; + void setData(const QString &d); + QDomNode::NodeType nodeType() const; +}; + +QTextStream &operator<<(QTextStream &, const QDomNode &) /ReleaseGIL/; diff --git a/sip/pyqt-gpl.sip b/sip/pyqt-gpl.sip new file mode 100644 index 0000000..bec8f9e --- /dev/null +++ b/sip/pyqt-gpl.sip @@ -0,0 +1 @@ +%License /Type="gpl"/ diff --git a/uic/Compiler/__init__.py b/uic/Compiler/__init__.py new file mode 100644 index 0000000..03b3b49 --- /dev/null +++ b/uic/Compiler/__init__.py @@ -0,0 +1,20 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# diff --git a/uic/Compiler/as_string.py b/uic/Compiler/as_string.py new file mode 100644 index 0000000..f2804d8 --- /dev/null +++ b/uic/Compiler/as_string.py @@ -0,0 +1,40 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# + + +import re + + +def as_string(obj): + if isinstance(obj, str): + return '"' + _escape(obj) + '"' + + return str(obj) + + +_esc_regex = re.compile(r"(\"|\'|\\)") + +def _escape(text): + # This escapes any escaped single or double quote or backslash. + x = _esc_regex.sub(r"\\\1", text) + + # This replaces any '\n' with an escaped version and a real line break. + return re.sub(r'\n', r'\\n"\n"', x) diff --git a/uic/Compiler/compiler.py b/uic/Compiler/compiler.py new file mode 100644 index 0000000..757e6bf --- /dev/null +++ b/uic/Compiler/compiler.py @@ -0,0 +1,107 @@ +# Copyright (c) 2023 Riverbank Computing Limited. +# Copyright (c) 2006 Thorsten Marek. +# All right reserved. +# +# This file is part of PyQt. +# +# You may use this file under the terms of the GPL v3 or the revised BSD +# license as follows: +# +# "Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the Riverbank Computing Limited nor the names +# of its contributors may be used to endorse or promote products +# derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + +import sys + +from ..properties import Properties +from ..uiparser import UIParser +from . import qtproxies +from .indenter import createCodeIndenter, getIndenter, write_code +from .qobjectcreator import CompilerCreatorPolicy + + +class UICompiler(UIParser): + def __init__(self): + UIParser.__init__(self, qtproxies.QtCore, qtproxies.QtGui, + qtproxies.QtWidgets, CompilerCreatorPolicy()) + + def reset(self): + qtproxies.i18n_strings = [] + UIParser.reset(self) + + def setContext(self, context): + qtproxies.i18n_context = context + + def createToplevelWidget(self, classname, widgetname): + indenter = getIndenter() + indenter.level = 0 + + indenter.write("from PyQt6 import QtCore, QtGui, QtWidgets") + indenter.write("") + + indenter.write("") + indenter.write("class Ui_%s(object):" % self.uiname) + indenter.indent() + indenter.write("def setupUi(self, %s):" % widgetname) + indenter.indent() + w = self.factory.createQtObject(classname, widgetname, + is_attribute=False, no_instantiation=True) + w.baseclass = classname + w.uiclass = "Ui_%s" % self.uiname + return w + + def setDelayedProps(self): + write_code("") + write_code("self.retranslateUi(%s)" % self.toplevelWidget) + UIParser.setDelayedProps(self) + + def finalize(self): + indenter = getIndenter() + indenter.level = 1 + indenter.write("") + indenter.write("def retranslateUi(self, %s):" % self.toplevelWidget) + + indenter.indent() + + if qtproxies.i18n_strings: + indenter.write("_translate = QtCore.QCoreApplication.translate") + for s in qtproxies.i18n_strings: + indenter.write(s) + else: + indenter.write("pass") + + indenter.dedent() + indenter.dedent() + + def compileUi(self, input_stream, output_stream): + createCodeIndenter(output_stream) + w = self.parse(input_stream) + + self.factory._cpolicy._writeOutImports() + + return {"widgetname": str(w), + "uiclass" : w.uiclass, + "baseclass" : w.baseclass} diff --git a/uic/Compiler/indenter.py b/uic/Compiler/indenter.py new file mode 100644 index 0000000..9c92ad5 --- /dev/null +++ b/uic/Compiler/indenter.py @@ -0,0 +1,77 @@ +############################################################################# +## +## Copyright (C) 2014 Riverbank Computing Limited. +## Copyright (C) 2006 Thorsten Marek. +## All right reserved. +## +## This file is part of PyQt. +## +## You may use this file under the terms of the GPL v2 or the revised BSD +## license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of the Riverbank Computing Limited nor the names +## of its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +indentwidth = 4 + +_indenter = None + +class _IndentedCodeWriter(object): + def __init__(self, output): + self.level = 0 + self.output = output + + def indent(self): + self.level += 1 + + def dedent(self): + self.level -= 1 + + def write(self, line): + if line.strip(): + if indentwidth > 0: + indent = " " * indentwidth + line = line.replace("\t", indent) + else: + indent = "\t" + + self.output.write("%s%s\n" % (indent * self.level, line)) + else: + self.output.write("\n") + + +def createCodeIndenter(output): + global _indenter + _indenter = _IndentedCodeWriter(output) + +def getIndenter(): + return _indenter + +def write_code(string): + _indenter.write(string) diff --git a/uic/Compiler/misc.py b/uic/Compiler/misc.py new file mode 100644 index 0000000..0dcf181 --- /dev/null +++ b/uic/Compiler/misc.py @@ -0,0 +1,59 @@ +############################################################################# +## +## Copyright (C) 2016 Riverbank Computing Limited. +## Copyright (C) 2006 Thorsten Marek. +## All right reserved. +## +## This file is part of PyQt. +## +## You may use this file under the terms of the GPL v2 or the revised BSD +## license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of the Riverbank Computing Limited nor the names +## of its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +def moduleMember(module, name): + if module: + return "%s.%s" % (module, name) + + return name + + +class Literal(object): + """Literal(string) -> new literal + + string will not be quoted when put into an argument list""" + def __init__(self, string): + self.string = string + + def __str__(self): + return self.string + + def __or__(self, r_op): + return Literal("%s|%s" % (self, r_op)) diff --git a/uic/Compiler/proxy_metaclass.py b/uic/Compiler/proxy_metaclass.py new file mode 100644 index 0000000..c997b84 --- /dev/null +++ b/uic/Compiler/proxy_metaclass.py @@ -0,0 +1,100 @@ +############################################################################# +## +## Copyright (C) 2014 Riverbank Computing Limited. +## Copyright (C) 2006 Thorsten Marek. +## All right reserved. +## +## This file is part of PyQt. +## +## You may use this file under the terms of the GPL v2 or the revised BSD +## license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of the Riverbank Computing Limited nor the names +## of its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +from .misc import Literal, moduleMember + + +class ProxyMetaclass(type): + """ ProxyMetaclass is the meta-class for proxies. """ + + def __init__(*args): + """ Initialise the meta-class. """ + + # Initialise as normal. + type.__init__(*args) + + # The proxy type object we have created. + proxy = args[0] + + # Go through the proxy's attributes looking for other proxies. + for sub_proxy in proxy.__dict__.values(): + if type(sub_proxy) is ProxyMetaclass: + # Set the module name of the contained proxy to the name of the + # container proxy. + sub_proxy.module = proxy.__name__ + + # Attribute hierachies are created depth first so any proxies + # contained in the sub-proxy whose module we have just set will + # already exist and have an incomplete module name. We need to + # revisit them and prepend the new name to their module names. + # Note that this should be recursive but with current usage we + # know there will be only one level to revisit. + for sub_sub_proxy in sub_proxy.__dict__.values(): + if type(sub_sub_proxy) is ProxyMetaclass: + sub_sub_proxy.module = '%s.%s' % (proxy.__name__, sub_sub_proxy.module) + + # Makes sure there is a 'module' attribute. + if not hasattr(proxy, 'module'): + proxy.module = '' + + def __getattribute__(cls, name): + try: + return type.__getattribute__(cls, name) + except AttributeError: + # Make sure __init__()'s use of hasattr() works. + if name == 'module': + raise + + # Avoid a circular import. + from .qtproxies import LiteralProxyClass + + return type(name, (LiteralProxyClass, ), + {"module": moduleMember(type.__getattribute__(cls, "module"), + type.__getattribute__(cls, "__name__"))}) + + def __str__(cls): + return moduleMember(type.__getattribute__(cls, "module"), + type.__getattribute__(cls, "__name__")) + + def __or__(self, r_op): + return Literal("%s|%s" % (self, r_op)) + + def __eq__(self, other): + return str(self) == str(other) diff --git a/uic/Compiler/qobjectcreator.py b/uic/Compiler/qobjectcreator.py new file mode 100644 index 0000000..e032747 --- /dev/null +++ b/uic/Compiler/qobjectcreator.py @@ -0,0 +1,178 @@ +############################################################################# +## +## Copyright (C) 2023 Riverbank Computing Limited. +## Copyright (C) 2006 Thorsten Marek. +## All right reserved. +## +## This file is part of PyQt. +## +## You may use this file under the terms of the GPL v2 or the revised BSD +## license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of the Riverbank Computing Limited nor the names +## of its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +import logging +import sys + +from .as_string import as_string +from .indenter import write_code +from .qtproxies import QtGui, QtWidgets, Literal, strict_getattr + + +logger = logging.getLogger(__name__) +DEBUG = logger.debug + + +class _QtWrapper(object): + @classmethod + def search(cls, name): + try: + return strict_getattr(cls.module, name) + except AttributeError: + return None + + +class _QtGuiWrapper(_QtWrapper): + module = QtGui + + +class _QtWidgetsWrapper(_QtWrapper): + module = QtWidgets + + +class _ModuleWrapper(object): + def __init__(self, name, classes): + if "." in name: + idx = name.rfind(".") + self._package = name[:idx] + self._module = name[idx + 1:] + else: + self._package = None + self._module = name + + self._classes = classes + self._used = False + + def search(self, cls): + if cls in self._classes: + self._used = True + + # Remove any C++ scope. + cls = cls.split('.')[-1] + + return type(cls, (QtWidgets.QWidget,), {"module": self._module}) + else: + return None + + def _writeImportCode(self): + if self._used: + if self._package is None: + write_code("import %s" % self._module) + else: + write_code("from %s import %s" % (self._package, self._module)) + + +class _CustomWidgetLoader(object): + def __init__(self): + self._widgets = {} + self._usedWidgets = set() + + def addCustomWidget(self, widgetClass, baseClass, module): + assert widgetClass not in self._widgets + self._widgets[widgetClass] = (baseClass, module) + + def _resolveBaseclass(self, baseClass): + try: + for x in range(0, 10): + try: return strict_getattr(QtWidgets, baseClass) + except AttributeError: pass + + baseClass = self._widgets[baseClass][0] + else: + raise ValueError("baseclass resolve took too long, check custom widgets") + + except KeyError: + raise ValueError("unknown baseclass %s" % baseClass) + + def search(self, cls): + try: + baseClass = self._resolveBaseclass(self._widgets[cls][0]) + DEBUG("resolved baseclass of %s: %s" % (cls, baseClass)) + except KeyError: + return None + + self._usedWidgets.add(cls) + + return type(cls, (baseClass, ), {"module" : ""}) + + def _writeImportCode(self): + imports = {} + for widget in self._usedWidgets: + _, module = self._widgets[widget] + imports.setdefault(module, []).append(widget) + + for module, classes in sorted(imports.items()): + write_code("from %s import %s" % (module, ", ".join(sorted(classes)))) + + +class CompilerCreatorPolicy(object): + def __init__(self): + self._modules = [] + + def createQtGuiWidgetsWrappers(self): + return [_QtGuiWrapper, _QtWidgetsWrapper] + + def createModuleWrapper(self, name, classes): + mw = _ModuleWrapper(name, classes) + self._modules.append(mw) + return mw + + def createCustomWidgetLoader(self): + cw = _CustomWidgetLoader() + self._modules.append(cw) + return cw + + def instantiate(self, ctor, object_name, ctor_args, ctor_kwargs, + is_attribute, no_instantiation): + return ctor(object_name, ctor_args, ctor_kwargs, is_attribute, + no_instantiation) + + def invoke(self, rname, method, args): + return method(rname, *args) + + def getSlot(self, object, slotname): + return Literal("%s.%s" % (object, slotname)) + + def asString(self, s): + return as_string(s) + + def _writeOutImports(self): + for module in self._modules: + module._writeImportCode() diff --git a/uic/Compiler/qtproxies.py b/uic/Compiler/qtproxies.py new file mode 100644 index 0000000..b62f5be --- /dev/null +++ b/uic/Compiler/qtproxies.py @@ -0,0 +1,471 @@ +############################################################################# +## +## Copyright (C) 2023 Riverbank Computing Limited. +## Copyright (C) 2006 Thorsten Marek. +## All right reserved. +## +## This file is part of PyQt. +## +## You may use this file under the terms of the GPL v2 or the revised BSD +## license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of the Riverbank Computing Limited nor the names +## of its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +import sys +import re + +from .as_string import as_string +from .indenter import write_code +from .misc import Literal, moduleMember +from .proxy_metaclass import ProxyMetaclass + + +i18n_strings = [] +i18n_context = "" + +def i18n_print(string): + i18n_strings.append(string) + +def i18n_void_func(name): + def _printer(self, *args): + i18n_print("%s.%s(%s)" % (self, name, ", ".join(map(as_string, args)))) + return _printer + +def i18n_func(name): + def _printer(self, rname, *args): + i18n_print("%s = %s.%s(%s)" % (rname, self, name, ", ".join(map(as_string, args)))) + return Literal(rname) + + return _printer + +def strict_getattr(module, clsname): + cls = getattr(module, clsname) + if issubclass(cls, LiteralProxyClass): + raise AttributeError(cls) + else: + return cls + + +class i18n_string(object): + def __init__(self, string, disambig): + self.string = string + self.disambig = disambig + + def __str__(self): + if self.disambig is None: + return '_translate("%s", %s)' % (i18n_context, as_string(self.string)) + + return '_translate("%s", %s, %s)' % (i18n_context, as_string(self.string), as_string(self.disambig)) + + +# Classes with this flag will be handled as literal values. If functions are +# called on these classes, the literal value changes. +# Example: +# the code +# >>> QSize(9,10).expandedTo(...) +# will print just that code. +AS_ARGUMENT = 0x02 + +# Classes with this flag may have members that are signals which themselves +# will have a connect() member. +AS_SIGNAL = 0x01 + +# ATTENTION: currently, classes can either be literal or normal. If a class +# should need both kinds of behaviour, the code has to be changed. + +class ProxyClassMember(object): + def __init__(self, proxy, function_name, flags): + self.proxy = proxy + self.function_name = function_name + self.flags = flags + + def __str__(self): + return "%s.%s" % (self.proxy, self.function_name) + + def __call__(self, *args): + if self.function_name == 'setProperty': + str_args = (as_string(args[0]), as_string(args[1])) + else: + str_args = map(as_string, args) + + func_call = "%s.%s(%s)" % (self.proxy, + self.function_name, + ", ".join(str_args)) + if self.flags & AS_ARGUMENT: + self.proxy._uic_name = func_call + return self.proxy + else: + needs_translation = False + for arg in args: + if isinstance(arg, i18n_string): + needs_translation = True + if needs_translation: + i18n_print(func_call) + else: + if self.function_name == 'connect': + func_call += ' # type: ignore' + + write_code(func_call) + + def __getattribute__(self, attribute): + """ Reimplemented to create a proxy connect() if requested and this + might be a proxy for a signal. + """ + + try: + return object.__getattribute__(self, attribute) + except AttributeError: + if attribute == 'connect' and self.flags & AS_SIGNAL: + return ProxyClassMember(self, attribute, 0) + + raise + + def __getitem__(self, idx): + """ Reimplemented to create a proxy member that should be a signal that + passes arguments. We handle signals without arguments before we get + here and never apply the index notation to them. + """ + + return ProxySignalWithArguments(self.proxy, self.function_name, idx) + + +class ProxySignalWithArguments(object): + """ This is a proxy for (what should be) a signal that passes arguments. + """ + + def __init__(self, sender, signal_name, signal_index): + self._sender = sender + self._signal_name = signal_name + + # Convert the signal index, which will be a single argument or a tuple + # of arguments, to quoted strings. + if isinstance(signal_index, tuple): + self._signal_index = ','.join(["'%s'" % a for a in signal_index]) + else: + self._signal_index = "'%s'" % signal_index + + def connect(self, slot): + write_code("%s.%s[%s].connect(%s) # type: ignore" % (self._sender, self._signal_name, self._signal_index, slot)) + + +class ProxyBase(metaclass=ProxyMetaclass): + """ A base class for proxies using Python v3 syntax for setting the + meta-class. + """ + + +class ProxyClass(ProxyBase): + flags = 0 + + def __init__(self, object_name, ctor_args=None, ctor_kwargs=None, + is_attribute=False, no_instantiation=True): + if object_name: + if is_attribute: + object_name = 'self.' + object_name + + self._uic_name = object_name + else: + self._uic_name = "Unnamed" + + if not no_instantiation: + args = [] if ctor_args is None else list(map(str, ctor_args)) + + if ctor_kwargs is not None: + for k, v in ctor_kwargs.items(): + args.append(k + '=' + str(v)) + + fun_call = '%s(%s)' % \ + (moduleMember(self.module, self.__class__.__name__), + ', '.join(args)) + + if object_name: + fun_call = '%s = %s' % (object_name, fun_call) + + write_code(fun_call) + + def __str__(self): + return self._uic_name + + def __getattribute__(self, attribute): + try: + return object.__getattribute__(self, attribute) + except AttributeError: + return ProxyClassMember(self, attribute, self.flags) + + +class LiteralProxyClass(ProxyClass): + """LiteralObject(*args) -> new literal class + + a literal class can be used as argument in a function call + + >>> class Foo(LiteralProxyClass): pass + >>> str(Foo(1,2,3)) == "Foo(1,2,3)" + """ + flags = AS_ARGUMENT + + def __init__(self, *args): + self._uic_name = "%s(%s)" % \ + (moduleMember(self.module, self.__class__.__name__), + ", ".join(map(as_string, args))) + + +class ProxyNamespace(ProxyBase): + pass + + +# These are all the Qt classes used by pyuic6 in their namespaces. If a class +# is missing, the compiler will fail, normally with an AttributeError. +# +# For adding new classes: +# - utility classes used as literal values do not need to be listed +# because they are created on the fly as subclasses of LiteralProxyClass +# - classes which are *not* QWidgets inherit from ProxyClass and they +# have to be listed explicitly in the correct namespace. These classes +# are created via a ProxyQObjectCreator +# - new QWidget-derived classes have to inherit from qtproxies.QWidget +# If the widget does not need any special methods, it can be listed +# in _qwidgets + +class QtCore(ProxyNamespace): + class Qt(ProxyNamespace): + pass + + ## connectSlotsByName and connect have to be handled as class methods, + ## otherwise they would be created as LiteralProxyClasses and never be + ## printed + class QMetaObject(ProxyClass): + @classmethod + def connectSlotsByName(cls, *args): + ProxyClassMember(cls, "connectSlotsByName", 0)(*args) + + class QObject(ProxyClass): + flags = AS_SIGNAL + + def metaObject(self): + class _FakeMetaObject(object): + def className(*args): + return self.__class__.__name__ + return _FakeMetaObject() + + def objectName(self): + return self._uic_name.split(".")[-1] + + +class QtGui(ProxyNamespace): + class QIcon(ProxyClass): + class fromTheme(ProxyClass): pass + + class QConicalGradient(ProxyClass): pass + class QLinearGradient(ProxyClass): pass + class QRadialGradient(ProxyClass): pass + class QBrush(ProxyClass): pass + class QPainter(ProxyClass): pass + class QPalette(ProxyClass): pass + class QFont(ProxyClass): pass + class QFontDatabase(ProxyClass): pass + # QActions inherit from QObject for the meta-object stuff and the hierarchy + # has to be correct since we have a isinstance(x, QtWidgets.QLayout) call + # in the UI parser. + class QAction(QtCore.QObject): pass + class QActionGroup(QtCore.QObject): pass + + +# These sub-class QWidget but aren't themselves sub-classed. +_qwidgets = ("QCalendarWidget", "QDialogButtonBox", "QDockWidget", "QGroupBox", + "QLineEdit", "QMainWindow", "QMenuBar", "QOpenGLWidget", + "QProgressBar", "QStatusBar", "QToolBar", "QWizardPage") + +class QtWidgets(ProxyNamespace): + class QApplication(QtCore.QObject): + @staticmethod + def translate(uiname, text, disambig): + return i18n_string(text or "", disambig) + + class QSpacerItem(ProxyClass): pass + class QSizePolicy(ProxyClass): pass + class QButtonGroup(QtCore.QObject): pass + class QLayout(QtCore.QObject): pass + class QGridLayout(QLayout): pass + class QBoxLayout(QLayout): pass + class QHBoxLayout(QBoxLayout): pass + class QVBoxLayout(QBoxLayout): pass + class QFormLayout(QLayout): pass + + class QWidget(QtCore.QObject): + def font(self): + return Literal("%s.font()" % self) + + def minimumSizeHint(self): + return Literal("%s.minimumSizeHint()" % self) + + def sizePolicy(self): + sp = LiteralProxyClass() + sp._uic_name = "%s.sizePolicy()" % self + return sp + + class QDialog(QWidget): pass + class QColorDialog(QDialog): pass + class QFileDialog(QDialog): pass + class QFontDialog(QDialog): pass + class QInputDialog(QDialog): pass + class QMessageBox(QDialog): pass + class QWizard(QDialog): pass + + class QAbstractSlider(QWidget): pass + class QDial(QAbstractSlider): pass + class QScrollBar(QAbstractSlider): pass + class QSlider(QAbstractSlider): pass + + class QMenu(QWidget): + def menuAction(self): + return Literal("%s.menuAction()" % self) + + class QTabWidget(QWidget): + def addTab(self, *args): + text = args[-1] + + if isinstance(text, i18n_string): + i18n_print("%s.setTabText(%s.indexOf(%s), %s)" % \ + (self._uic_name, self._uic_name, args[0], text)) + args = args[:-1] + ("", ) + + ProxyClassMember(self, "addTab", 0)(*args) + + def indexOf(self, page): + return Literal("%s.indexOf(%s)" % (self, page)) + + class QComboBox(QWidget): pass + class QFontComboBox(QComboBox): pass + + class QAbstractSpinBox(QWidget): pass + class QDoubleSpinBox(QAbstractSpinBox): pass + class QSpinBox(QAbstractSpinBox): pass + + class QDateTimeEdit(QAbstractSpinBox): pass + class QDateEdit(QDateTimeEdit): pass + class QTimeEdit(QDateTimeEdit): pass + + class QFrame(QWidget): pass + class QLabel(QFrame): pass + class QLCDNumber(QFrame): pass + class QSplitter(QFrame): pass + class QStackedWidget(QFrame): pass + + class QToolBox(QFrame): + def addItem(self, *args): + text = args[-1] + + if isinstance(text, i18n_string): + i18n_print("%s.setItemText(%s.indexOf(%s), %s)" % \ + (self._uic_name, self._uic_name, args[0], text)) + args = args[:-1] + ("", ) + + ProxyClassMember(self, "addItem", 0)(*args) + + def indexOf(self, page): + return Literal("%s.indexOf(%s)" % (self, page)) + + def layout(self): + return QtWidgets.QLayout('%s.layout()' % self) + + class QAbstractScrollArea(QFrame): + def viewport(self): + return QtWidgets.QWidget('%s.viewport()' % self) + + class QGraphicsView(QAbstractScrollArea): pass + class QMdiArea(QAbstractScrollArea): pass + class QPlainTextEdit(QAbstractScrollArea): pass + class QScrollArea(QAbstractScrollArea): pass + + class QTextEdit(QAbstractScrollArea): pass + class QTextBrowser(QTextEdit): pass + + class QAbstractItemView(QAbstractScrollArea): pass + class QColumnView(QAbstractItemView): pass + class QHeaderView(QAbstractItemView): pass + class QListView(QAbstractItemView): pass + + class QTableView(QAbstractItemView): + def horizontalHeader(self): + return QtWidgets.QHeaderView('%s.horizontalHeader()' % self) + + def verticalHeader(self): + return QtWidgets.QHeaderView('%s.verticalHeader()' % self) + + class QTreeView(QAbstractItemView): + def header(self): + return QtWidgets.QHeaderView('%s.header()' % self) + + class QUndoView(QListView): pass + + class QListWidgetItem(ProxyClass): pass + + class QListWidget(QListView): + setSortingEnabled = i18n_void_func("setSortingEnabled") + isSortingEnabled = i18n_func("isSortingEnabled") + item = i18n_func("item") + + class QTableWidgetItem(ProxyClass): pass + + class QTableWidget(QTableView): + setSortingEnabled = i18n_void_func("setSortingEnabled") + isSortingEnabled = i18n_func("isSortingEnabled") + item = i18n_func("item") + horizontalHeaderItem = i18n_func("horizontalHeaderItem") + verticalHeaderItem = i18n_func("verticalHeaderItem") + + class QTreeWidgetItem(ProxyClass): + def child(self, index): + return QtWidgets.QTreeWidgetItem('%s.child(%i)' % (self, index)) + + class QTreeWidget(QTreeView): + setSortingEnabled = i18n_void_func("setSortingEnabled") + isSortingEnabled = i18n_func("isSortingEnabled") + + def headerItem(self): + return QtWidgets.QWidget('%s.headerItem()' % self) + + def topLevelItem(self, index): + return QtWidgets.QTreeWidgetItem( + '%s.topLevelItem(%i)' % (self, index)) + + class QAbstractButton(QWidget): pass + class QCheckBox(QAbstractButton): pass + class QRadioButton(QAbstractButton): pass + class QToolButton(QAbstractButton): pass + + class QPushButton(QAbstractButton): pass + class QCommandLinkButton(QPushButton): pass + class QKeySequenceEdit(QWidget): pass + + # Add all remaining classes. + for _class in _qwidgets: + if _class not in locals(): + locals()[_class] = type(_class, (QWidget, ), {}) diff --git a/uic/Loader/__init__.py b/uic/Loader/__init__.py new file mode 100644 index 0000000..03b3b49 --- /dev/null +++ b/uic/Loader/__init__.py @@ -0,0 +1,20 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# diff --git a/uic/Loader/loader.py b/uic/Loader/loader.py new file mode 100644 index 0000000..14339b0 --- /dev/null +++ b/uic/Loader/loader.py @@ -0,0 +1,62 @@ +# Copyright (c) 2023 Riverbank Computing Limited. +# Copyright (c) 2006 Thorsten Marek. +# All right reserved. +# +# This file is part of PyQt. +# +# You may use this file under the terms of the GPL v3 or the revised BSD +# license as follows: +# +# "Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the Riverbank Computing Limited nor the names +# of its contributors may be used to endorse or promote products +# derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + +from PyQt6 import QtCore, QtGui, QtWidgets + +from ..uiparser import UIParser +from .qobjectcreator import LoaderCreatorPolicy + + +class DynamicUILoader(UIParser): + def __init__(self, package): + UIParser.__init__(self, QtCore, QtGui, QtWidgets, + LoaderCreatorPolicy(package)) + + def createToplevelWidget(self, classname, widgetname): + if self.toplevelInst is None: + return self.factory.createQtObject(classname, widgetname) + + if not isinstance(self.toplevelInst, self.factory.findQObjectType(classname)): + raise TypeError( + ("Wrong base class of toplevel widget", + (type(self.toplevelInst), classname))) + + return self.toplevelInst + + def loadUi(self, filename, toplevelInst): + self.toplevelInst = toplevelInst + + return self.parse(filename) diff --git a/uic/Loader/qobjectcreator.py b/uic/Loader/qobjectcreator.py new file mode 100644 index 0000000..e556e53 --- /dev/null +++ b/uic/Loader/qobjectcreator.py @@ -0,0 +1,158 @@ +############################################################################# +## +## Copyright (C) 2023 Riverbank Computing Limited. +## Copyright (C) 2006 Thorsten Marek. +## All right reserved. +## +## This file is part of PyQt. +## +## You may use this file under the terms of the GPL v2 or the revised BSD +## license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of the Riverbank Computing Limited nor the names +## of its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +import sys + +from PyQt6 import QtGui, QtWidgets + + +class _QtWrapper(object): + @classmethod + def search(cls, name): + return getattr(cls.module, name, None) + + +class _QtGuiWrapper(_QtWrapper): + module = QtGui + + +class _QtWidgetsWrapper(_QtWrapper): + module = QtWidgets + + +class _ModuleWrapper(object): + def __init__(self, moduleName, classes): + self._moduleName = moduleName + self._module = None + self._classes = classes + + def search(self, cls): + if cls in self._classes: + if self._module is None: + self._module = __import__(self._moduleName, {}, {}, self._classes) + # Remove any C++ scope. + cls = cls.split('.')[-1] + + return getattr(self._module, cls) + + return None + + +class _CustomWidgetLoader(object): + def __init__(self, package): + # should it stay this way? + if '.' not in sys.path: + sys.path.append('.') + + self._widgets = {} + self._modules = {} + self._package = package + + def addCustomWidget(self, widgetClass, baseClass, module): + assert widgetClass not in self._widgets + self._widgets[widgetClass] = module + + def search(self, cls): + module_name = self._widgets.get(cls) + if module_name is None: + return None + + module = self._modules.get(module_name) + if module is None: + if module_name.startswith('.'): + if self._package == '': + raise ImportError( + "relative import of %s without base package specified" % module_name) + + if self._package.startswith('.'): + raise ImportError( + "base package %s is relative" % self._package) + + mname = self._package + module_name + else: + mname = module_name + + try: + module = __import__(mname, {}, {}, (cls,)) + except ValueError: + # Raise a more helpful exception. + raise ImportError("unable to import module %s" % mname) + + self._modules[module_name] = module + + return getattr(module, cls) + + +class LoaderCreatorPolicy(object): + def __init__(self, package): + self._package = package + + def createQtGuiWidgetsWrappers(self): + return [_QtGuiWrapper, _QtWidgetsWrapper] + + def createModuleWrapper(self, moduleName, classes): + return _ModuleWrapper(moduleName, classes) + + def createCustomWidgetLoader(self): + return _CustomWidgetLoader(self._package) + + def instantiate(self, ctor, object_name, ctor_args, ctor_kwargs, + is_attribute, no_instantiation): + + if ctor_args is None: + ctor_args = () + + if ctor_kwargs is None: + ctor_kwargs = {} + + return ctor(*ctor_args, **ctor_kwargs) + + def invoke(self, rname, method, args): + return method(*args) + + def getSlot(self, object, slotname): + # Rename slots that correspond to Python keyword arguments. + if slotname == 'raise': + slotname += '_' + + return getattr(object, slotname) + + def asString(self, s): + return s diff --git a/uic/__init__.py b/uic/__init__.py new file mode 100644 index 0000000..949dbd0 --- /dev/null +++ b/uic/__init__.py @@ -0,0 +1,23 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +# The public API. +from .compile_ui import compileUi, compileUiDir +from .load_ui import loadUi, loadUiType +from .objcreator import widgetPluginPath +from .ui_file import UIFile diff --git a/uic/compile_ui.py b/uic/compile_ui.py new file mode 100644 index 0000000..e51bdc8 --- /dev/null +++ b/uic/compile_ui.py @@ -0,0 +1,172 @@ +# Copyright (c) 2023 Riverbank Computing Limited. +# Copyright (c) 2006 Thorsten Marek. +# All right reserved. +# +# This file is part of PyQt. +# +# You may use this file under the terms of the GPL v3 or the revised BSD +# license as follows: +# +# "Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the Riverbank Computing Limited nor the names +# of its contributors may be used to endorse or promote products +# derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + +from .Compiler import indenter, compiler + + +_header = """# Form implementation generated from reading ui file '{}' +# +# Created by: PyQt6 UI code generator {} +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +""" + + +_display_code = """ + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + %(widgetname)s = QtWidgets.%(baseclass)s() + ui = %(uiclass)s() + ui.setupUi(%(widgetname)s) + %(widgetname)s.show() + sys.exit(app.exec())""" + + +def compileUiDir(dir, recurse=False, map=None, max_workers=0, **compileUi_args): + """compileUiDir(dir, recurse=False, map=None, **compileUi_args) + + Creates Python modules from Qt Designer .ui files in a directory or + directory tree. + + dir is the name of the directory to scan for files whose name ends with + '.ui'. By default the generated Python module is created in the same + directory ending with '.py'. + recurse is set if any sub-directories should be scanned. The default is + False. + map is an optional callable that is passed the name of the directory + containing the '.ui' file and the name of the Python module that will be + created. The callable should return a tuple of the name of the directory + in which the Python module will be created and the (possibly modified) + name of the module. The default is None. + max_workers is the maximum number of worker processes to use. A value of 0 + means only the current process is used. A value of None means that the + number of processors on the machine is used. + compileUi_args are any additional keyword arguments that are passed to + the compileUi() function that is called to create each Python module. + """ + + from functools import partial + import os + + jobs = [] + + # Add a compilation job. + def add_job(ui_dir, ui_file): + # Ignore if it doesn't seem to be a .ui file. + if ui_file.endswith('.ui'): + py_dir = ui_dir + py_file = ui_file[:-3] + '.py' + + # Allow the caller to change the name of the .py file or generate + # it in a different directory. + if map is not None: + py_dir, py_file = map(py_dir, py_file) + + ui_path = os.path.join(ui_dir, ui_file) + + jobs.append((ui_path, py_dir, py_file)) + + if recurse: + for root, _, files in os.walk(dir): + for ui in files: + add_job(root, ui) + else: + for ui in os.listdir(dir): + if os.path.isfile(os.path.join(dir, ui)): + add_job(dir, ui) + + if jobs and max_workers != 0: + from concurrent.futures import ProcessPoolExecutor + + with ProcessPoolExecutor(max_workers=max_workers) as executor: + executor.map(partial(_run_job, **compileUi_args), jobs) + else: + for job in jobs: + _run_job(job, **compileUi_args) + + +def _run_job(job, **compileUi_args): + """ Run a job to compile a single .ui file. """ + + import os + + ui_path, py_dir, py_file = job + + # Make sure the destination directory exists. + try: + os.makedirs(py_dir) + except: + pass + + py_path = os.path.join(py_dir, py_file) + + with open(py_path, 'w', encoding='utf-8') as py_f: + compileUi(ui_path, py_f, **compileUi_args) + + +def compileUi(uifile, pyfile, execute=False, indent=4): + """compileUi(uifile, pyfile, execute=False, indent=4) + + Creates a Python module from a Qt Designer .ui file. + + uifile is a file name or file-like object containing the .ui file. + pyfile is the file-like object to which the Python code will be written to. + execute is optionally set to generate extra Python code that allows the + code to be run as a standalone application. The default is False. + indent is the optional indentation width using spaces. If it is 0 then a + tab is used. The default is 4. + """ + + from PyQt6.QtCore import PYQT_VERSION_STR + + try: + uifname = uifile.name + except AttributeError: + uifname = uifile + + indenter.indentwidth = indent + + pyfile.write(_header.format(uifname, PYQT_VERSION_STR)) + + winfo = compiler.UICompiler().compileUi(uifile, pyfile) + + if execute: + indenter.write_code(_display_code % winfo) diff --git a/uic/enum_map.py b/uic/enum_map.py new file mode 100644 index 0000000..7dbc906 --- /dev/null +++ b/uic/enum_map.py @@ -0,0 +1,494 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +# Map enum member names to fully scoped names. +EnumMap = { + 'Qt::AlignHCenter': 'Qt::AlignmentFlag::AlignHCenter', + 'Qt::AlignJustify': 'Qt::AlignmentFlag::AlignJustify', + 'Qt::AlignLeft': 'Qt::AlignmentFlag::AlignLeft', + 'Qt::AlignRight': 'Qt::AlignmentFlag::AlignRight', + + 'Qt::AlignBaseline': 'Qt::AlignmentFlag::AlignBaseline', + 'Qt::AlignBottom': 'Qt::AlignmentFlag::AlignBottom', + 'Qt::AlignTop': 'Qt::AlignmentFlag::AlignTop', + 'Qt::AlignVCenter': 'Qt::AlignmentFlag::AlignVCenter', + + 'Qt::AlignAbsolute': 'Qt::AlignmentFlag::AlignAbsolute', + 'Qt::AlignLeading': 'Qt::AlignmentFlag::AlignLeading', + 'Qt::AlignTrailing': 'Qt::AlignmentFlag::AlignTrailing', + + 'Qt::AlignCenter': 'Qt::AlignmentFlag::AlignCenter', + + 'Qt::AlignHorizontal_Mask': 'Qt::AlignmentFlag::AlignHorizontal_Mask', + 'Qt::AlignVertical_Mask': 'Qt::AlignmentFlag::AlignVertical_Mask', + + 'Qt::DownArrow': 'Qt::ArrowType::DownArrow', + 'Qt::LeftArrow': 'Qt::ArrowType::LeftArrow', + 'Qt::NoArrow': 'Qt::ArrowType::NoArrow', + 'Qt::RightArrow': 'Qt::ArrowType::RightArrow', + 'Qt::UpArrow': 'Qt::ArrowType::UpArrow', + + 'Qt::Checked': 'Qt::CheckState::Checked', + 'Qt::PartiallyChecked': 'Qt::CheckState::PartiallyChecked', + 'Qt::Unchecked': 'Qt::CheckState::Unchecked', + + 'Qt::ActionsContextMenu': 'Qt::ContextMenuPolicy::ActionsContextMenu', + 'Qt::CustomContextMenu': 'Qt::ContextMenuPolicy::CustomContextMenu', + 'Qt::DefaultContextMenu': 'Qt::ContextMenuPolicy::DefaultContextMenu', + 'Qt::NoContextMenu': 'Qt::ContextMenuPolicy::NoContextMenu', + 'Qt::PreventContextMenu': 'Qt::ContextMenuPolicy::PreventContextMenu', + + 'Qt::LogicalMoveStyle': 'Qt::CursorMoveStyle::LogicalMoveStyle', + 'Qt::VisualMoveStyle': 'Qt::CursorMoveStyle::VisualMoveStyle', + + 'Qt::Monday': 'Qt::DayOfWeek::Monday', + 'Qt::Tuesday': 'Qt::DayOfWeek::Tuesday', + 'Qt::Wednesday': 'Qt::DayOfWeek::Wednesday', + 'Qt::Thursday': 'Qt::DayOfWeek::Thursday', + 'Qt::Friday': 'Qt::DayOfWeek::Friday', + 'Qt::Saturday': 'Qt::DayOfWeek::Saturday', + 'Qt::Sunday': 'Qt::DayOfWeek::Sunday', + + 'Qt::AllDockWidgetAreas': 'Qt::DockWidgetArea::AllDockWidgetAreas', + 'Qt::LeftDockWidgetArea': 'Qt::DockWidgetArea::LeftDockWidgetArea', + 'Qt::RightDockWidgetArea': 'Qt::DockWidgetArea::RightDockWidgetArea', + 'Qt::TopDockWidgetArea': 'Qt::DockWidgetArea::TopDockWidgetArea', + 'Qt::BottomDockWidgetArea': 'Qt::DockWidgetArea::BottomDockWidgetArea', + 'Qt::NoDockWidgetArea': 'Qt::DockWidgetArea::NoDockWidgetArea', + + 'Qt::ActionMask': 'Qt::DropAction::ActionMask', + 'Qt::CopyAction': 'Qt::DropAction::CopyAction', + 'Qt::IgnoreAction': 'Qt::DropAction::IgnoreAction', + 'Qt::LinkAction': 'Qt::DropAction::LinkAction', + 'Qt::MoveAction': 'Qt::DropAction::MoveAction', + 'Qt::TargetMoveAction': 'Qt::DropAction::TargetMoveAction', + + 'Qt::ClickFocus': 'Qt::FocusPolicy::ClickFocus', + 'Qt::NoFocus': 'Qt::FocusPolicy::NoFocus', + 'Qt::TabFocus': 'Qt::FocusPolicy::TabFocus', + 'Qt::StrongFocus': 'Qt::FocusPolicy::StrongFocus', + 'Qt::WheelFocus': 'Qt::FocusPolicy::WheelFocus', + + 'Qt::ImhDate': 'Qt::InputMethodHint::ImhDate', + 'Qt::ImhDialableCharactersOnly': 'Qt::InputMethodHint::ImhDialableCharactersOnly', + 'Qt::ImhDigitsOnly': 'Qt::InputMethodHint::ImhDigitsOnly', + 'Qt::ImhEmailCharactersOnly': 'Qt::InputMethodHint::ImhEmailCharactersOnly', + 'Qt::ImhExclusiveInputMask': 'Qt::InputMethodHint::ImhExclusiveInputMask', + 'Qt::ImhFormattedNumbersOnly': 'Qt::InputMethodHint::ImhFormattedNumbersOnly', + 'Qt::ImhHiddenText': 'Qt::InputMethodHint::ImhHiddenText', + 'Qt::ImhLatinOnly': 'Qt::InputMethodHint::ImhLatinOnly', + 'Qt::ImhLowercaseOnly': 'Qt::InputMethodHint::ImhLowercaseOnly', + 'Qt::ImhMultiLine': 'Qt::InputMethodHint::ImhMultiLine', + 'Qt::ImhNoAutoUppercase': 'Qt::InputMethodHint::ImhNoAutoUppercase', + 'Qt::ImhNoEditMenu': 'Qt::InputMethodHint::ImhNoEditMenu', + 'Qt::ImhNoPredictiveText': 'Qt::InputMethodHint::ImhNoPredictiveText', + 'Qt::ImhNoTextHandles': 'Qt::InputMethodHint::ImhNoTextHandles', + 'Qt::ImhNone': 'Qt::InputMethodHint::ImhNone', + 'Qt::ImhPreferLatin': 'Qt::InputMethodHint::ImhPreferLatin', + 'Qt::ImhPreferLowercase': 'Qt::InputMethodHint::ImhPreferLowercase', + 'Qt::ImhPreferNumbers': 'Qt::InputMethodHint::ImhPreferNumbers', + 'Qt::ImhPreferUppercase': 'Qt::InputMethodHint::ImhPreferUppercase', + 'Qt::ImhSensitiveData': 'Qt::InputMethodHint::ImhSensitiveData', + 'Qt::ImhTime': 'Qt::InputMethodHint::ImhTime', + 'Qt::ImhUppercaseOnly': 'Qt::InputMethodHint::ImhUppercaseOnly', + 'Qt::ImhUrlCharactersOnly': 'Qt::InputMethodHint::ImhUrlCharactersOnly', + + 'Qt::ItemIsAutoTristate': 'Qt::ItemFlag::ItemIsAutoTristate', + 'Qt::ItemIsDragEnabled': 'Qt::ItemFlag::ItemIsDragEnabled', + 'Qt::ItemIsDropEnabled': 'Qt::ItemFlag::ItemIsDropEnabled', + 'Qt::ItemIsEditable': 'Qt::ItemFlag::ItemIsEditable', + 'Qt::ItemIsEnabled': 'Qt::ItemFlag::ItemIsEnabled', + 'Qt::ItemIsSelectable': 'Qt::ItemFlag::ItemIsSelectable', + 'Qt::ItemIsUserCheckable': 'Qt::ItemFlag::ItemIsUserCheckable', + 'Qt::ItemIsUserTristate': 'Qt::ItemFlag::ItemIsUserTristate', + 'Qt::ItemNeverHasChildren': 'Qt::ItemFlag::ItemNeverHasChildren', + 'Qt::NoItemFlags': 'Qt::ItemFlag::NoItemFlags', + + 'Qt::ContainsItemBoundingRect': 'Qt::ItemSelectionMode::ContainsItemBoundingRect', + 'Qt::ContainsItemShape': 'Qt::ItemSelectionMode::ContainsItemShape', + 'Qt::IntersectsItemBoundingRect': 'Qt::ItemSelectionMode::IntersectsItemBoundingRect', + 'Qt::IntersectsItemShape': 'Qt::ItemSelectionMode::IntersectsItemShape', + + 'Qt::LayoutDirectionAuto': 'Qt::LayoutDirection::LayoutDirectionAuto', + 'Qt::LeftToRight': 'Qt::LayoutDirection::LeftToRight', + 'Qt::RightToLeft': 'Qt::LayoutDirection::RightToLeft', + + 'Qt::Horizontal': 'Qt::Orientation::Horizontal', + 'Qt::Vertical': 'Qt::Orientation::Vertical', + + 'Qt::CustomDashLine': 'Qt::PenStyle::CustomDashLine', + 'Qt::DashDotDotLine': 'Qt::PenStyle::DashDotDotLine', + 'Qt::DashDotLine': 'Qt::PenStyle::DashDotLine', + 'Qt::DashLine': 'Qt::PenStyle::DashLine', + 'Qt::DotLine': 'Qt::PenStyle::DotLine', + 'Qt::NoPen': 'Qt::PenStyle::NoPen', + 'Qt::SolidLine': 'Qt::PenStyle::SolidLine', + + 'Qt::ScrollBarAlwaysOff': 'Qt::ScrollBarPolicy::ScrollBarAlwaysOff', + 'Qt::ScrollBarAlwaysOn': 'Qt::ScrollBarPolicy::ScrollBarAlwaysOn', + 'Qt::ScrollBarAsNeeded': 'Qt::ScrollBarPolicy::ScrollBarAsNeeded', + + 'Qt::ApplicationShortcut': 'Qt::ShortcutContext::ApplicationShortcut', + 'Qt::WidgetShortcut': 'Qt::ShortcutContext::WidgetShortcut', + 'Qt::WidgetWithChildrenShortcut': 'Qt::ShortcutContext::WidgetWithChildrenShortcut', + 'Qt::WindowShortcut': 'Qt::ShortcutContext::WindowShortcut', + + 'Qt::ElideLeft': 'Qt::TextElideMode::ElideLeft', + 'Qt::ElideRight': 'Qt::TextElideMode::ElideRight', + 'Qt::ElideMiddle': 'Qt::TextElideMode::ElideMiddle', + 'Qt::ElideNone': 'Qt::TextElideMode::ElideNone', + + 'Qt::NoTextInteraction': 'Qt::TextInteractionFlag::NoTextInteraction', + 'Qt::TextSelectableByMouse': 'Qt::TextInteractionFlag::TextSelectableByMouse', + 'Qt::TextSelectableByKeyboard': 'Qt::TextInteractionFlag::TextSelectableByKeyboard', + 'Qt::LinksAccessibleByMouse': 'Qt::TextInteractionFlag::LinksAccessibleByMouse', + 'Qt::LinksAccessibleByKeyboard': 'Qt::TextInteractionFlag::LinksAccessibleByKeyboard', + 'Qt::TextEditable': 'Qt::TextInteractionFlag::TextEditable', + 'Qt::TextEditorInteraction': 'Qt::TextInteractionFlag::TextEditorInteraction', + 'Qt::TextBrowserInteraction': 'Qt::TextInteractionFlag::TextBrowserInteraction', + + 'Qt::AutoText': 'Qt::TextFormat::AutoText', + 'Qt::MarkdownText': 'Qt::TextFormat::MarkdownText', + 'Qt::PlainText': 'Qt::TextFormat::PlainText', + 'Qt::RichText': 'Qt::TextFormat::RichText', + + 'Qt::LocalTime': 'Qt::TimeSpec::LocalTime', + 'Qt::OffsetFromUTC': 'Qt::TimeSpec::OffsetFromUTC', + 'Qt::TimeZone': 'Qt::TimeSpec::TimeZone', + 'Qt::UTC': 'Qt::TimeSpec::UTC', + + 'Qt::LeftToolBarArea': 'Qt::ToolBarArea::LeftToolBarArea', + 'Qt::RightToolBarArea': 'Qt::ToolBarArea::RightToolBarArea', + 'Qt::TopToolBarArea': 'Qt::ToolBarArea::TopToolBarArea', + 'Qt::BottomToolBarArea': 'Qt::ToolBarArea::BottomToolBarArea', + 'Qt::AllToolBarAreas': 'Qt::ToolBarArea::AllToolBarAreas', + 'Qt::NoToolBarArea': 'Qt::ToolBarArea::NoToolBarArea', + + 'Qt::ToolButtonFollowStyle': 'Qt::ToolButtonStyle::ToolButtonFollowStyle', + 'Qt::ToolButtonIconOnly': 'Qt::ToolButtonStyle::ToolButtonIconOnly', + 'Qt::ToolButtonTextBesideIcon': 'Qt::ToolButtonStyle::ToolButtonTextBesideIcon', + 'Qt::ToolButtonTextOnly': 'Qt::ToolButtonStyle::ToolButtonTextOnly', + 'Qt::ToolButtonTextUnderIcon': 'Qt::ToolButtonStyle::ToolButtonTextUnderIcon', + + 'Qt::ApplicationModal': 'Qt::WindowModality::ApplicationModal', + 'Qt::NonModal': 'Qt::WindowModality::NonModal', + 'Qt::WindowModal': 'Qt::WindowModality::WindowModal', + + 'QAbstractItemView::NoDragDrop': 'QAbstractItemView::DragDropMode::NoDragDrop', + 'QAbstractItemView::DragOnly': 'QAbstractItemView::DragDropMode::DragOnly', + 'QAbstractItemView::DropOnly': 'QAbstractItemView::DragDropMode::DropOnly', + 'QAbstractItemView::DragDrop': 'QAbstractItemView::DragDropMode::DragDrop', + 'QAbstractItemView::InternalMove': 'QAbstractItemView::DragDropMode::InternalMove', + + 'QAbstractItemView::NoEditTriggers': 'QAbstractItemView::EditTrigger::NoEditTriggers', + 'QAbstractItemView::CurrentChanged': 'QAbstractItemView::EditTrigger::CurrentChanged', + 'QAbstractItemView::DoubleClicked': 'QAbstractItemView::EditTrigger::DoubleClicked', + 'QAbstractItemView::SelectedClicked': 'QAbstractItemView::EditTrigger::SelectedClicked', + 'QAbstractItemView::EditKeyPressed': 'QAbstractItemView::EditTrigger::EditKeyPressed', + 'QAbstractItemView::AnyKeyPressed': 'QAbstractItemView::EditTrigger::AnyKeyPressed', + 'QAbstractItemView::AllEditTriggers': 'QAbstractItemView::EditTrigger::AllEditTriggers', + + 'QAbstractItemView::ScrollPerItem': 'QAbstractItemView::ScrollMode::ScrollPerItem', + 'QAbstractItemView::ScrollPerPixel': 'QAbstractItemView::ScrollMode::ScrollPerPixel', + + 'QAbstractItemView::SelectColumns': 'QAbstractItemView::SelectionBehavior::SelectColumns', + 'QAbstractItemView::SelectItems': 'QAbstractItemView::SelectionBehavior::SelectItems', + 'QAbstractItemView::SelectRows': 'QAbstractItemView::SelectionBehavior::SelectRows', + + 'QAbstractItemView::NoSelection': 'QAbstractItemView::SelectionMode::NoSelection', + 'QAbstractItemView::SingleSelection': 'QAbstractItemView::SelectionMode::SingleSelection', + 'QAbstractItemView::MultiSelection': 'QAbstractItemView::SelectionMode::MultiSelection', + 'QAbstractItemView::ExtendedSelection': 'QAbstractItemView::SelectionMode::ExtendedSelection', + 'QAbstractItemView::ContiguousSelection': 'QAbstractItemView::SelectionMode::ContiguousSelection', + + 'QAbstractScrollArea::AdjustIgnored': 'QAbstractScrollArea::SizeAdjustPolicy::AdjustIgnored', + 'QAbstractScrollArea::AdjustToContents': 'QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents', + 'QAbstractScrollArea::AdjustToContentsOnFirstShow': 'QAbstractScrollArea::SizeAdjustPolicy::AdjustToContentsOnFirstShow', + + 'QAbstractSpinBox::NoButtons': 'QAbstractSpinBox::ButtonSymbols::NoButtons', + 'QAbstractSpinBox::PlusMinus': 'QAbstractSpinBox::ButtonSymbols::PlusMinus', + 'QAbstractSpinBox::UpDownArrows': 'QAbstractSpinBox::ButtonSymbols::UpDownArrows', + + 'QAbstractSpinBox::CorrectToNearestValue': 'QAbstractSpinBox::CorrectionMode::CorrectToNearestValue', + 'QAbstractSpinBox::CorrectToPreviousValue': 'QAbstractSpinBox::CorrectionMode::CorrectToPreviousValue', + + 'QAbstractSpinBox::AdaptiveDecimalStepType': 'QAbstractSpinBox::StepType::AdaptiveDecimalStepType', + 'QAbstractSpinBox::DefaultStepType': 'QAbstractSpinBox::StepType::DefaultStepType', + + 'QAction::NoRole': 'QAction::MenuRole::NoRole', + 'QAction::TextHeuristicRole': 'QAction::MenuRole::TextHeuristicRole', + 'QAction::ApplicationSpecificRole': 'QAction::MenuRole::ApplicationSpecificRole', + 'QAction::AboutQtRole': 'QAction::MenuRole::AboutQtRole', + 'QAction::AboutRole': 'QAction::MenuRole::AboutRole', + 'QAction::PreferencesRole': 'QAction::MenuRole::PreferencesRole', + 'QAction::QuitRole': 'QAction::MenuRole::QuitRole', + + 'QCalendarWidget::LongDayNames': 'QCalendarWidget::HorizontalHeaderFormat::LongDayNames', + 'QCalendarWidget::NoHorizontalHeader': 'QCalendarWidget::HorizontalHeaderFormat::NoHorizontalHeader', + 'QCalendarWidget::ShortDayNames': 'QCalendarWidget::HorizontalHeaderFormat::ShortDayNames', + 'QCalendarWidget::SingleLetterDayNames': 'QCalendarWidget::HorizontalHeaderFormat::SingleLetterDayNames', + + 'QCalendarWidget::NoSelection': 'QCalendarWidget::SelectionMode::NoSelection', + 'QCalendarWidget::SingleSelection': 'QCalendarWidget::SelectionMode::SingleSelection', + + 'QCalendarWidget::ISOWeekNumbers': 'QCalendarWidget::VerticalHeaderFormat::ISOWeekNumbers', + 'QCalendarWidget::NoVerticalHeader': 'QCalendarWidget::VerticalHeaderFormat::NoVerticalHeader', + + 'QComboBox::InsertAfterCurrent': 'QComboBox::InsertPolicy::InsertAfterCurrent', + 'QComboBox::InsertAlphabetically': 'QComboBox::InsertPolicy::InsertAlphabetically', + 'QComboBox::InsertAtBottom': 'QComboBox::InsertPolicy::InsertAtBottom', + 'QComboBox::InsertAtCurrent': 'QComboBox::InsertPolicy::InsertAtCurrent', + 'QComboBox::InsertAtTop': 'QComboBox::InsertPolicy::InsertAtTop', + 'QComboBox::InsertBeforeCurrent': 'QComboBox::InsertPolicy::InsertBeforeCurrent', + 'QComboBox::NoInsert': 'QComboBox::InsertPolicy::NoInsert', + + 'QComboBox::AdjustToContents': 'QComboBox::SizeAdjustPolicy::AdjustToContents', + 'QComboBox::AdjustToContentsOnFirstShow': 'QComboBox::SizeAdjustPolicy::AdjustToContentsOnFirstShow', + 'QComboBox::AdjustToMinimumContentsLengthWithIcon': 'QComboBox::SizeAdjustPolicy::AdjustToMinimumContentsLengthWithIcon', + + 'QDateTimeEdit::NoSection': 'QDateTimeEdit::Section::NoSection', + 'QDateTimeEdit::AmPmSection': 'QDateTimeEdit::Section::AmPmSection', + 'QDateTimeEdit::MSecSection': 'QDateTimeEdit::Section::MSecSection', + 'QDateTimeEdit::SecondSection': 'QDateTimeEdit::Section::SecondSection', + 'QDateTimeEdit::MinuteSection': 'QDateTimeEdit::Section::MinuteSection', + 'QDateTimeEdit::HourSection': 'QDateTimeEdit::Section::HourSection', + 'QDateTimeEdit::DaySection': 'QDateTimeEdit::Section::DaySection', + 'QDateTimeEdit::MonthSection': 'QDateTimeEdit::Section::MonthSection', + 'QDateTimeEdit::YearSection': 'QDateTimeEdit::Section::YearSection', + + 'QDialogButtonBox::NoButton': 'QDialogButtonBox::StandardButton::NoButton', + 'QDialogButtonBox::Ok': 'QDialogButtonBox::StandardButton::Ok', + 'QDialogButtonBox::Save': 'QDialogButtonBox::StandardButton::Save', + 'QDialogButtonBox::SaveAll': 'QDialogButtonBox::StandardButton::SaveAll', + 'QDialogButtonBox::Open': 'QDialogButtonBox::StandardButton::Open', + 'QDialogButtonBox::Yes': 'QDialogButtonBox::StandardButton::Yes', + 'QDialogButtonBox::YesToAll': 'QDialogButtonBox::StandardButton::YesToAll', + 'QDialogButtonBox::No': 'QDialogButtonBox::StandardButton::No', + 'QDialogButtonBox::NoToAll': 'QDialogButtonBox::StandardButton::NoToAll', + 'QDialogButtonBox::Abort': 'QDialogButtonBox::StandardButton::Abort', + 'QDialogButtonBox::Retry': 'QDialogButtonBox::StandardButton::Retry', + 'QDialogButtonBox::Ignore': 'QDialogButtonBox::StandardButton::Ignore', + 'QDialogButtonBox::Close': 'QDialogButtonBox::StandardButton::Close', + 'QDialogButtonBox::Cancel': 'QDialogButtonBox::StandardButton::Cancel', + 'QDialogButtonBox::Discard': 'QDialogButtonBox::StandardButton::Discard', + 'QDialogButtonBox::Help': 'QDialogButtonBox::StandardButton::Help', + 'QDialogButtonBox::Apply': 'QDialogButtonBox::StandardButton::Apply', + 'QDialogButtonBox::Reset': 'QDialogButtonBox::StandardButton::Reset', + 'QDialogButtonBox::RestoreDefaults': 'QDialogButtonBox::StandardButton::RestoreDefaults', + + 'QDockWidget::DockWidgetClosable': 'QDockWidget::DockWidgetFeature::DockWidgetClosable', + 'QDockWidget::DockWidgetFloatable': 'QDockWidget::DockWidgetFeature::DockWidgetFloatable', + 'QDockWidget::DockWidgetMovable': 'QDockWidget::DockWidgetFeature::DockWidgetMovable', + 'QDockWidget::DockWidgetVerticalTitleBar': 'QDockWidget::DockWidgetFeature::DockWidgetVerticalTitleBar', + 'QDockWidget::NoDockWidgetFeatures': 'QDockWidget::DockWidgetFeature::NoDockWidgetFeatures', + + 'QFontComboBox::AllFonts': 'QFontComboBox::FontFilter::AllFonts', + 'QFontComboBox::MonospacedFonts': 'QFontComboBox::FontFilter::MonospacedFonts', + 'QFontComboBox::NonScalableFonts': 'QFontComboBox::FontFilter::NonScalableFonts', + 'QFontComboBox::ProportionalFonts': 'QFontComboBox::FontFilter::ProportionalFonts', + 'QFontComboBox::ScalableFonts': 'QFontComboBox::FontFilter::ScalableFonts', + + 'QFontDatabase::Any': 'QFontDatabase::WritingSystem::Any', + 'QFontDatabase::Latin': 'QFontDatabase::WritingSystem::Latin', + 'QFontDatabase::Greek': 'QFontDatabase::WritingSystem::Greek', + 'QFontDatabase::Cyrillic': 'QFontDatabase::WritingSystem::Cyrillic', + 'QFontDatabase::Armenian': 'QFontDatabase::WritingSystem::Armenian', + 'QFontDatabase::Hebrew': 'QFontDatabase::WritingSystem::Hebrew', + 'QFontDatabase::Arabic': 'QFontDatabase::WritingSystem::Arabic', + 'QFontDatabase::Syriac': 'QFontDatabase::WritingSystem::Syriac', + 'QFontDatabase::Thaana': 'QFontDatabase::WritingSystem::Thaana', + 'QFontDatabase::Devanagari': 'QFontDatabase::WritingSystem::Devanagari', + 'QFontDatabase::Bengali': 'QFontDatabase::WritingSystem::Bengali', + 'QFontDatabase::Gurmukhi': 'QFontDatabase::WritingSystem::Gurmukhi', + 'QFontDatabase::Gujarati': 'QFontDatabase::WritingSystem::Gujarati', + 'QFontDatabase::Oriya': 'QFontDatabase::WritingSystem::Oriya', + 'QFontDatabase::Tamil': 'QFontDatabase::WritingSystem::Tamil', + 'QFontDatabase::Telugu': 'QFontDatabase::WritingSystem::Telugu', + 'QFontDatabase::Kannada': 'QFontDatabase::WritingSystem::Kannada', + 'QFontDatabase::Malayalam': 'QFontDatabase::WritingSystem::Malayalam', + 'QFontDatabase::Sinhala': 'QFontDatabase::WritingSystem::Sinhala', + 'QFontDatabase::Thai': 'QFontDatabase::WritingSystem::Thai', + 'QFontDatabase::Lao': 'QFontDatabase::WritingSystem::Lao', + 'QFontDatabase::Tibetan': 'QFontDatabase::WritingSystem::Tibetan', + 'QFontDatabase::Myanmar': 'QFontDatabase::WritingSystem::Myanmar', + 'QFontDatabase::Georgian': 'QFontDatabase::WritingSystem::Georgian', + 'QFontDatabase::Khmer': 'QFontDatabase::WritingSystem::Khmer', + 'QFontDatabase::SimplifiedChinese': 'QFontDatabase::WritingSystem::SimplifiedChinese', + 'QFontDatabase::TraditionalChinese': 'QFontDatabase::WritingSystem::TraditionalChinese', + 'QFontDatabase::Japanese': 'QFontDatabase::WritingSystem::Japanese', + 'QFontDatabase::Korean': 'QFontDatabase::WritingSystem::Korean', + 'QFontDatabase::Vietnamese': 'QFontDatabase::WritingSystem::Vietnamese', + 'QFontDatabase::Other': 'QFontDatabase::WritingSystem::Other', + 'QFontDatabase::Symbol': 'QFontDatabase::WritingSystem::Symbol', + 'QFontDatabase::Ogham': 'QFontDatabase::WritingSystem::Ogham', + 'QFontDatabase::Runic': 'QFontDatabase::WritingSystem::Runic', + 'QFontDatabase::Nko': 'QFontDatabase::WritingSystem::Nko', + + 'QFormLayout::AllNonFixedFieldsGrow': 'QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow', + 'QFormLayout::ExpandingFieldsGrow': 'QFormLayout::FieldGrowthPolicy::ExpandingFieldsGrow', + 'QFormLayout::FieldsStayAtSizeHint': 'QFormLayout::FieldGrowthPolicy::FieldsStayAtSizeHint', + + 'QFormLayout::DontWrapRows': 'QFormLayout::RowWrapPolicy::DontWrapRows', + 'QFormLayout::WrapLongRows': 'QFormLayout::RowWrapPolicy::WrapLongRows', + 'QFormLayout::WrapAllRows': 'QFormLayout::RowWrapPolicy::WrapAllRows', + + 'QFrame::Box': 'QFrame::Shape::Box', + 'QFrame::HLine': 'QFrame::Shape::HLine', + 'QFrame::NoFrame': 'QFrame::Shape::NoFrame', + 'QFrame::Panel': 'QFrame::Shape::Panel', + 'QFrame::StyledPanel': 'QFrame::Shape::StyledPanel', + 'QFrame::VLine': 'QFrame::Shape::VLine', + 'QFrame::WinPanel': 'QFrame::Shape::WinPanel', + + 'QFrame::Plain': 'QFrame::Shadow::Plain', + 'QFrame::Raised': 'QFrame::Shadow::Raised', + 'QFrame::Sunken': 'QFrame::Shadow::Sunken', + + 'QGraphicsView::CacheNone': 'QGraphicsView::CacheMode::CacheNone', + 'QGraphicsView::CacheBackground': 'QGraphicsView::CacheMode::CacheBackground', + + 'QGraphicsView::DontAdjustForAntialiasing': 'QGraphicsView::OptimizationFlags::DontAdjustForAntialiasing', + 'QGraphicsView::DontSavePainterState': 'QGraphicsView::OptimizationFlags::DontSavePainterState', + + 'QGraphicsView::NoAnchor': 'QGraphicsView::ViewportAnchor::NoAnchor', + 'QGraphicsView::AnchorViewCenter': 'QGraphicsView::ViewportAnchor::AnchorViewCenter', + 'QGraphicsView::AnchorUnderMouse': 'QGraphicsView::ViewportAnchor::AnchorUnderMouse', + + 'QGraphicsView::BoundingRectViewportUpdate': 'QGraphicsView::ViewportUpdateMode::BoundingRectViewportUpdate', + 'QGraphicsView::FullViewportUpdate': 'QGraphicsView::ViewportUpdateMode::FullViewportUpdate', + 'QGraphicsView::MinimalViewportUpdate': 'QGraphicsView::ViewportUpdateMode::MinimalViewportUpdate', + 'QGraphicsView::NoViewportUpdate': 'QGraphicsView::ViewportUpdateMode::NoViewportUpdate', + 'QGraphicsView::SmartViewportUpdate': 'QGraphicsView::ViewportUpdateMode::SmartViewportUpdate', + + 'QLayout::SetDefaultConstraint': 'QLayout::SizeConstraint::SetDefaultConstraint', + 'QLayout::SetFixedSize': 'QLayout::SizeConstraint::SetFixedSize', + 'QLayout::SetMaximumSize': 'QLayout::SizeConstraint::SetMaximumSize', + 'QLayout::SetMinAndMaxSize': 'QLayout::SizeConstraint::SetMinAndMaxSize', + 'QLayout::SetMinimumSize': 'QLayout::SizeConstraint::SetMinimumSize', + 'QLayout::SetNoConstraint': 'QLayout::SizeConstraint::SetNoConstraint', + + 'QLCDNumber::Bin': 'QLCDNumber::Mode::Bin', + 'QLCDNumber::Dec': 'QLCDNumber::Mode::Dec', + 'QLCDNumber::Hex': 'QLCDNumber::Mode::Hex', + 'QLCDNumber::Oct': 'QLCDNumber::Mode::Oct', + + 'QLCDNumber::Filled': 'QLCDNumber::SegmentStyle::Filled', + 'QLCDNumber::Flat': 'QLCDNumber::SegmentStyle::Flat', + 'QLCDNumber::Outline': 'QLCDNumber::SegmentStyle::Outline', + + 'QLineEdit::NoEcho': 'QLineEdit::EchoMode::NoEcho', + 'QLineEdit::Normal': 'QLineEdit::EchoMode::Normal', + 'QLineEdit::Password': 'QLineEdit::EchoMode::Password', + 'QLineEdit::PasswordEchoOnEdit': 'QLineEdit::EchoMode::PasswordEchoOnEdit', + + 'QListView::LeftToRight': 'QListView::Flow::LeftToRight', + 'QListView::TopToBottom': 'QListView::Flow::TopToBottom', + + 'QListView::Batched': 'QListView::LayoutMode::Batched', + 'QListView::SinglePass': 'QListView::LayoutMode::SinglePass', + + 'QListView::Free': 'QListView::Movement::Free', + 'QListView::Snap': 'QListView::Movement::Snap', + 'QListView::Static': 'QListView::Movement::Static', + + 'QListView::Adjust': 'QListView::ResizeMode::Adjust', + 'QListView::Fixed': 'QListView::ResizeMode::Fixed', + + 'QListView::IconMode': 'QListView::ViewMode::IconMode', + 'QListView::ListMode': 'QListView::ViewMode::ListMode', + + 'QMdiArea::SubWindowView': 'QMdiArea::ViewMode::SubWindowView', + 'QMdiArea::TabbedView': 'QMdiArea::ViewMode::TabbedView', + + 'QMdiArea::ActivationHistoryOrder': 'QMdiArea::WindowOrder::ActivationHistoryOrder', + 'QMdiArea::CreationOrder': 'QMdiArea::WindowOrder::CreationOrder', + 'QMdiArea::StackingOrder': 'QMdiArea::WindowOrder::StackingOrder', + + 'QPainter::Antialiasing': 'QPainter::RenderHint::Antialiasing', + 'QPainter::LosslessImageRendering': 'QPainter::RenderHint::LosslessImageRendering', + 'QPainter::SmoothPixmapTransform': 'QPainter::RenderHint::SmoothPixmapTransform', + 'QPainter::TextAntialiasing': 'QPainter::RenderHint::TextAntialiasing', + + 'QPlainTextEdit::NoWrap': 'QPlainTextEdit::LineWrapMode::NoWrap', + 'QPlainTextEdit::WidgetWidth': 'QPlainTextEdit::LineWrapMode::WidgetWidth', + + 'QProgressBar::BottomToTop': 'QProgressBar::Direction::BottomToTop', + 'QProgressBar::TopToBottom': 'QProgressBar::Direction::TopToBottom', + + 'QQuickWidget::SizeRootObjectToView': 'QQuickWidget::ResizeMode::SizeRootObjectToView', + 'QQuickWidget::SizeViewToRootObject': 'QQuickWidget::ResizeMode::SizeViewToRootObject', + + 'QSizePolicy::Fixed': 'QSizePolicy::Policy::Fixed', + 'QSizePolicy::Minimum': 'QSizePolicy::Policy::Minimum', + 'QSizePolicy::Maximum': 'QSizePolicy::Policy::Maximum', + 'QSizePolicy::Preferred': 'QSizePolicy::Policy::Preferred', + 'QSizePolicy::MinimumExpanding': 'QSizePolicy::Policy::MinimumExpanding', + 'QSizePolicy::Expanding': 'QSizePolicy::Policy::Expanding', + 'QSizePolicy::Ignored': 'QSizePolicy::Policy::Ignored', + + 'QSlider::NoTicks': 'QSlider::TickPosition::NoTicks', + 'QSlider::TicksAbove': 'QSlider::TickPosition::TicksAbove', + 'QSlider::TicksBelow': 'QSlider::TickPosition::TicksBelow', + 'QSlider::TicksBothSides': 'QSlider::TickPosition::TicksBothSides', + 'QSlider::TicksLeft': 'QSlider::TickPosition::TicksLeft', + 'QSlider::TicksRight': 'QSlider::TickPosition::TicksRight', + + 'QTabWidget::North': 'QTabWidget::TabPosition::North', + 'QTabWidget::South': 'QTabWidget::TabPosition::South', + 'QTabWidget::West': 'QTabWidget::TabPosition::West', + 'QTabWidget::East': 'QTabWidget::TabPosition::East', + + 'QTabWidget::Rounded': 'QTabWidget::TabShape::Rounded', + 'QTabWidget::Triangular': 'QTabWidget::TabShape::Triangular', + + 'QTextEdit::AutoAll': 'QTextEdit::AutoFormattingFlag::AutoAll', + 'QTextEdit::AutoBulletList': 'QTextEdit::AutoFormattingFlag::AutoBulletList', + 'QTextEdit::AutoNone': 'QTextEdit::AutoFormattingFlag::AutoNone', + + 'QTextEdit::FixedColumnWidth': 'QTextEdit::LineWrapMode::FixedColumnWidth', + 'QTextEdit::FixedPixelWidth': 'QTextEdit::LineWrapMode::FixedPixelWidth', + 'QTextEdit::NoWrap': 'QTextEdit::LineWrapMode::NoWrap', + 'QTextEdit::WidgetWidth': 'QTextEdit::LineWrapMode::WidgetWidth', + + 'QToolButton::DelayedPopup': 'QToolButton::ToolButtonPopupMode::DelayedPopup', + 'QToolButton::InstantPopup': 'QToolButton::ToolButtonPopupMode::InstantPopup', + 'QToolButton::MenuButtonPopup': 'QToolButton::ToolButtonPopupMode::MenuButtonPopup', + + 'QWizard::CancelButtonOnLeft': 'QWizard::WizardOption::CancelButtonOnLeft', + 'QWizard::DisabledBackButtonOnLastPage': 'QWizard::WizardOption::DisabledBackButtonOnLastPage', + 'QWizard::ExtendedWatermarkPixmap': 'QWizard::WizardOption::ExtendedWatermarkPixmap', + 'QWizard::HaveCustomButton1': 'QWizard::WizardOption::HaveCustomButton1', + 'QWizard::HaveCustomButton2': 'QWizard::WizardOption::HaveCustomButton2', + 'QWizard::HaveCustomButton3': 'QWizard::WizardOption::HaveCustomButton3', + 'QWizard::HaveFinishButtonOnEarlyPages': 'QWizard::WizardOption::HaveFinishButtonOnEarlyPages', + 'QWizard::HaveHelpButton': 'QWizard::WizardOption::HaveHelpButton', + 'QWizard::HaveNextButtonOnLastPage': 'QWizard::WizardOption::HaveNextButtonOnLastPage', + 'QWizard::HelpButtonOnRight': 'QWizard::WizardOption::HelpButtonOnRight', + 'QWizard::IgnoreSubTitles': 'QWizard::WizardOption::IgnoreSubTitles', + 'QWizard::IndependentPages': 'QWizard::WizardOption::IndependentPages', + 'QWizard::NoBackButtonOnLastPage': 'QWizard::WizardOption::NoBackButtonOnLastPage', + 'QWizard::NoBackButtonOnStartPage': 'QWizard::WizardOption::NoBackButtonOnStartPage', + 'QWizard::NoCancelButton': 'QWizard::WizardOption::NoCancelButton', + 'QWizard::NoCancelButtonOnLastPage': 'QWizard::WizardOption::NoCancelButtonOnLastPage', + 'QWizard::NoDefaultButton': 'QWizard::WizardOption::NoDefaultButton', + + 'QWizard::AeroStyle': 'QWizard::WizardStyle::AeroStyle', + 'QWizard::ClassicStyle': 'QWizard::WizardStyle::ClassicStyle', + 'QWizard::MacStyle': 'QWizard::WizardStyle::MacStyle', + 'QWizard::ModernStyle': 'QWizard::WizardStyle::ModernStyle', +} diff --git a/uic/exceptions.py b/uic/exceptions.py new file mode 100644 index 0000000..e9244b9 --- /dev/null +++ b/uic/exceptions.py @@ -0,0 +1,70 @@ +############################################################################# +## +## Copyright (C) 2020 Riverbank Computing Limited. +## Copyright (C) 2006 Thorsten Marek. +## All right reserved. +## +## This file is part of PyQt. +## +## You may use this file under the terms of the GPL v2 or the revised BSD +## license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of the Riverbank Computing Limited nor the names +## of its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +class NoSuchClassError(Exception): + def __str__(self): + return "Unknown C++ class: %s" % self.args[0] + + +class NoSuchWidgetError(Exception): + def __str__(self): + return "Unknown Qt widget: %s" % self.args[0] + + +class UIFileException(Exception): + """ An exception pertaining to a .ui file. """ + + def __init__(self, ui_file, message, detail=''): + """ Initialise the exception. """ + + text = '{}: {}'.format(ui_file, message) + + if detail: + text += ': {}'.format(detail) + + super().__init__(text) + + +class UnsupportedPropertyError(Exception): + pass + + +class WidgetPluginError(Exception): + pass diff --git a/uic/icon_cache.py b/uic/icon_cache.py new file mode 100644 index 0000000..b30f650 --- /dev/null +++ b/uic/icon_cache.py @@ -0,0 +1,159 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# + + +import os.path + + +class IconCache(object): + """Maintain a cache of icons. If an icon is used more than once by a GUI + then ensure that only one copy is created. + """ + + def __init__(self, object_factory, qtgui_module): + """Initialise the cache.""" + + self._object_factory = object_factory + self._qtgui_module = qtgui_module + self._base_dir = '' + self._cache = [] + + def set_base_dir(self, base_dir): + """ Set the base directory to be used for all relative filenames. """ + + self._base_dir = base_dir + + def get_icon(self, iconset): + """Return an icon described by the given iconset tag.""" + + # Handle a themed icon. + theme = iconset.attrib.get('theme') + if theme is not None: + return self._object_factory.createQtObject('QIcon.fromTheme', + 'icon', ctor_args=(self._object_factory.asString(theme), ), + is_attribute=False) + + # Handle an empty iconset property. + if iconset.text is None: + return None + + iset = _IconSet(iconset, self._base_dir) + + try: + idx = self._cache.index(iset) + except ValueError: + idx = -1 + + if idx >= 0: + # Return the icon from the cache. + iset = self._cache[idx] + else: + # Follow uic's naming convention. + name = 'icon' + idx = len(self._cache) + + if idx > 0: + name += str(idx) + + icon = self._object_factory.createQtObject('QIcon', name, + is_attribute=False) + iset.set_icon(icon, self._qtgui_module) + self._cache.append(iset) + + return iset.icon + + +class _IconSet(object): + """An icon set, ie. the mode and state and the pixmap used for each.""" + + def __init__(self, iconset, base_dir): + """Initialise the icon set from an XML tag.""" + + # Set the pre-Qt v4.4 fallback (ie. with no roles). + self._fallback = self._file_name(iconset.text, base_dir) + self._use_fallback = True + + # Parse the icon set. + self._roles = {} + + for i in iconset: + file_name = i.text + if file_name is not None: + file_name = self._file_name(file_name, base_dir) + + self._roles[i.tag] = file_name + self._use_fallback = False + + # There is no real icon yet. + self.icon = None + + @staticmethod + def _file_name(fname, base_dir): + """ Convert a relative filename if we have a base directory. """ + + fname = fname.replace("\\", "\\\\") + + if base_dir != '' and fname[0] != ':' and not os.path.isabs(fname): + fname = os.path.join(base_dir, fname) + + return fname + + def set_icon(self, icon, qtgui_module): + """Save the icon and set its attributes.""" + + if self._use_fallback: + icon.addFile(self._fallback) + else: + for role, pixmap in self._roles.items(): + if role.endswith("off"): + mode = role[:-3] + state = qtgui_module.QIcon.State.Off + elif role.endswith("on"): + mode = role[:-2] + state = qtgui_module.QIcon.State.On + else: + continue + + mode = getattr(qtgui_module.QIcon.Mode, mode.title()) + + if pixmap: + icon.addPixmap(qtgui_module.QPixmap(pixmap), mode, state) + else: + icon.addPixmap(qtgui_module.QPixmap(), mode, state) + + self.icon = icon + + def __eq__(self, other): + """Compare two icon sets for equality.""" + + if not isinstance(other, type(self)): + return NotImplemented + + if self._use_fallback: + if other._use_fallback: + return self._fallback == other._fallback + + return False + + if other._use_fallback: + return False + + return self._roles == other._roles diff --git a/uic/load_ui.py b/uic/load_ui.py new file mode 100644 index 0000000..fd0dac7 --- /dev/null +++ b/uic/load_ui.py @@ -0,0 +1,86 @@ +# Copyright (c) 2020 Riverbank Computing Limited. +# Copyright (c) 2006 Thorsten Marek. +# All right reserved. +# +# This file is part of PyQt. +# +# You may use this file under the terms of the GPL v3 or the revised BSD +# license as follows: +# +# "Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the Riverbank Computing Limited nor the names +# of its contributors may be used to endorse or promote products +# derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + +def loadUiType(uifile): + """loadUiType(uifile) -> (form class, base class) + + Load a Qt Designer .ui file and return the generated form class and the Qt + base class. + + uifile is a file name or file-like object containing the .ui file. + """ + + import io + import sys + + from PyQt6 import QtWidgets + + from .Compiler import compiler + + code_string = io.StringIO() + winfo = compiler.UICompiler().compileUi(uifile, code_string) + + ui_globals = {} + exec(code_string.getvalue(), ui_globals) + + uiclass = winfo["uiclass"] + baseclass = winfo["baseclass"] + + # Assume that the base class is a custom class exposed in the globals. + ui_base = ui_globals.get(baseclass) + if ui_base is None: + # Otherwise assume it is in the QtWidgets module. + ui_base = getattr(QtWidgets, baseclass) + + return (ui_globals[uiclass], ui_base) + + +def loadUi(uifile, baseinstance=None, package=''): + """loadUi(uifile, baseinstance=None, package='') -> widget + + Load a Qt Designer .ui file and return an instance of the user interface. + + uifile is a file name or file-like object containing the .ui file. + baseinstance is an optional instance of the Qt base class. If specified + then the user interface is created in it. Otherwise a new instance of the + base class is automatically created. + package is the optional package which is used as the base for any relative + imports of custom widgets. + """ + + from .Loader.loader import DynamicUILoader + + return DynamicUILoader(package).loadUi(uifile, baseinstance) diff --git a/uic/objcreator.py b/uic/objcreator.py new file mode 100644 index 0000000..13696de --- /dev/null +++ b/uic/objcreator.py @@ -0,0 +1,165 @@ +############################################################################# +## +## Copyright (C) 2015 Riverbank Computing Limited. +## Copyright (C) 2006 Thorsten Marek. +## All right reserved. +## +## This file is part of PyQt. +## +## You may use this file under the terms of the GPL v2 or the revised BSD +## license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of the Riverbank Computing Limited nor the names +## of its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +import os.path + +from .exceptions import NoSuchWidgetError, WidgetPluginError + + +# The list of directories that are searched for widget plugins. This is +# exposed as part of the API. +widgetPluginPath = [os.path.join(os.path.dirname(__file__), 'widget-plugins')] + + +MATCH = True +NO_MATCH = False +MODULE = 0 +CW_FILTER = 1 + + +class QObjectCreator(object): + def __init__(self, creatorPolicy): + self._cpolicy = creatorPolicy + + self._cwFilters = [] + self._modules = self._cpolicy.createQtGuiWidgetsWrappers() + + # Get the optional plugins. + for plugindir in widgetPluginPath: + try: + plugins = os.listdir(plugindir) + except: + plugins = [] + + for filename in plugins: + if not filename.endswith('.py'): + continue + + filename = os.path.join(plugindir, filename) + + plugin_globals = { + "MODULE": MODULE, + "CW_FILTER": CW_FILTER, + "MATCH": MATCH, + "NO_MATCH": NO_MATCH} + + plugin_locals = {} + + if self.load_plugin(filename, plugin_globals, plugin_locals): + pluginType = plugin_locals["pluginType"] + if pluginType == MODULE: + modinfo = plugin_locals["moduleInformation"]() + self._modules.append(self._cpolicy.createModuleWrapper(*modinfo)) + elif pluginType == CW_FILTER: + self._cwFilters.append(plugin_locals["getFilter"]()) + else: + raise WidgetPluginError("Unknown plugin type of %s" % filename) + + self._customWidgets = self._cpolicy.createCustomWidgetLoader() + self._modules.append(self._customWidgets) + + def createQtObject(self, ctor_name, object_name, ctor_args=None, + ctor_kwargs=None, is_attribute=True, no_instantiation=False): + # Handle regular and custom widgets. + ctor = self.findQObjectType(ctor_name) + + if ctor is None: + # Handle scoped names, typically static factory methods. + parts = ctor_name.split('.') + + if len(parts) > 1: + ctor = self.findQObjectType(parts[0]) + + if ctor is not None: + for part in parts[1:]: + ctor = getattr(ctor, part, None) + if ctor is None: + break + + if ctor is None: + raise NoSuchWidgetError(ctor_name) + + return self._cpolicy.instantiate(ctor, object_name, ctor_args, + ctor_kwargs, is_attribute, no_instantiation) + + def invoke(self, rname, method, args=()): + return self._cpolicy.invoke(rname, method, args) + + def findQObjectType(self, classname): + for module in self._modules: + w = module.search(classname) + if w is not None: + return w + return None + + def getSlot(self, obj, slotname): + return self._cpolicy.getSlot(obj, slotname) + + def asString(self, s): + return self._cpolicy.asString(s) + + def addCustomWidget(self, widgetClass, baseClass, module): + for cwFilter in self._cwFilters: + match, result = cwFilter(widgetClass, baseClass, module) + if match: + widgetClass, baseClass, module = result + break + + self._customWidgets.addCustomWidget(widgetClass, baseClass, module) + + @staticmethod + def load_plugin(filename, plugin_globals, plugin_locals): + """ Load the plugin from the given file. Return True if the plugin was + loaded, or False if it wanted to be ignored. Raise an exception if + there was an error. + """ + + plugin = open(filename) + + try: + exec(plugin.read(), plugin_globals, plugin_locals) + except ImportError: + return False + except Exception as e: + raise WidgetPluginError("%s: %s" % (e.__class__, str(e))) + finally: + plugin.close() + + return True diff --git a/uic/properties.py b/uic/properties.py new file mode 100644 index 0000000..2eb08c2 --- /dev/null +++ b/uic/properties.py @@ -0,0 +1,538 @@ +############################################################################# +## +## Copyright (C) 2023 Riverbank Computing Limited. +## Copyright (C) 2006 Thorsten Marek. +## All right reserved. +## +## This file is part of PyQt. +## +## You may use this file under the terms of the GPL v2 or the revised BSD +## license as follows: +## +## "Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions are +## met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in +## the documentation and/or other materials provided with the +## distribution. +## * Neither the name of the Riverbank Computing Limited nor the names +## of its contributors may be used to endorse or promote products +## derived from this software without specific prior written +## permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +## +############################################################################# + + +import logging +import os.path +import sys + +from .enum_map import EnumMap +from .exceptions import NoSuchClassError, UnsupportedPropertyError +from .icon_cache import IconCache + + +logger = logging.getLogger(__name__) +DEBUG = logger.debug + + +QtCore = None +QtGui = None +QtWidgets = None + + +def int_list(prop): + return [int(child.text) for child in prop] + +def float_list(prop): + return [float(child.text) for child in prop] + +bool_ = lambda v: v == "true" + +def qfont_style_strategy(v): + return getattr(QtGui.QFont.StyleStrategy, v) + +def needsWidget(func): + func.needsWidget = True + return func + + +# A translation table for converting ASCII lower case to upper case. +_ascii_trans_table = bytes.maketrans(b'abcdefghijklmnopqrstuvwxyz', + b'ABCDEFGHIJKLMNOPQRSTUVWXYZ') + +def ascii_upper(s): + """ Convert a string to ASCII upper case irrespective of the current + locale. + """ + + return s.translate(_ascii_trans_table) + + +class Properties(object): + def __init__(self, factory, qtcore_module, qtgui_module, qtwidgets_module): + self.factory = factory + + global QtCore, QtGui, QtWidgets + QtCore = qtcore_module + QtGui = qtgui_module + QtWidgets = qtwidgets_module + + self._base_dir = '' + + self.reset() + + def set_base_dir(self, base_dir): + """ Set the base directory to be used for all relative filenames. """ + + self._base_dir = base_dir + self.icon_cache.set_base_dir(base_dir) + + def reset(self): + self.buddies = [] + self.delayed_props = [] + self.icon_cache = IconCache(self.factory, QtGui) + + def _pyEnumMember(self, cpp_name): + if '::' not in cpp_name: + cpp_name = 'Qt::' + cpp_name + + cpp_name = EnumMap.get(cpp_name, cpp_name) + + parts = cpp_name.split('::') + + if parts[0] == 'Qt': + scope = QtCore.Qt + else: + scope = self.factory.findQObjectType(parts[0]) + if scope is None: + raise NoSuchClassError(parts[0]) + + for tail in parts[1:]: + scope = getattr(scope, tail) + + return scope + + def _set(self, prop): + expr = [self._pyEnumMember(v) for v in prop.text.split('|')] + + value = expr[0] + for v in expr[1:]: + value |= v + + return value + + def _enum(self, prop): + return self._pyEnumMember(prop.text) + + def _number(self, prop): + return int(prop.text) + + _UInt = _uInt = _longLong = _uLongLong = _number + + def _double(self, prop): + return float(prop.text) + + def _bool(self, prop): + return prop.text == 'true' + + def _stringlist(self, prop): + return [self._string(p, notr='true') for p in prop] + + def _string(self, prop, notr=None): + text = prop.text + + if text is None: + return "" + + if prop.get('notr', notr) == 'true': + return text + + disambig = prop.get('comment') + + return QtWidgets.QApplication.translate(self.uiname, text, disambig) + + _char = _string + + def _cstring(self, prop): + return str(prop.text) + + def _color(self, prop): + args = int_list(prop) + + # Handle the optional alpha component. + alpha = int(prop.get("alpha", "255")) + + if alpha != 255: + args.append(alpha) + + return QtGui.QColor(*args) + + def _point(self, prop): + return QtCore.QPoint(*int_list(prop)) + + def _pointf(self, prop): + return QtCore.QPointF(*float_list(prop)) + + def _rect(self, prop): + return QtCore.QRect(*int_list(prop)) + + def _rectf(self, prop): + return QtCore.QRectF(*float_list(prop)) + + def _size(self, prop): + return QtCore.QSize(*int_list(prop)) + + def _sizef(self, prop): + return QtCore.QSizeF(*float_list(prop)) + + def _pixmap(self, prop): + if prop.text: + fname = prop.text.replace("\\", "\\\\") + if self._base_dir != '' and fname[0] != ':' and not os.path.isabs(fname): + fname = os.path.join(self._base_dir, fname) + + return QtGui.QPixmap(fname) + + # Don't bother to set the property if the pixmap is empty. + return None + + def _iconset(self, prop): + return self.icon_cache.get_icon(prop) + + def _url(self, prop): + return QtCore.QUrl(prop[0].text) + + def _locale(self, prop): + lang = getattr(QtCore.QLocale.Language, prop.attrib['language']) + country = getattr(QtCore.QLocale.Country, prop.attrib['country']) + return QtCore.QLocale(lang, country) + + def _date(self, prop): + return QtCore.QDate(*int_list(prop)) + + def _datetime(self, prop): + args = int_list(prop) + return QtCore.QDateTime(QtCore.QDate(*args[-3:]), QtCore.QTime(*args[:-3])) + + def _time(self, prop): + return QtCore.QTime(*int_list(prop)) + + def _gradient(self, prop): + name = 'gradient' + + # Create the specific gradient. + gtype = prop.get('type', '') + + if gtype == 'LinearGradient': + startx = float(prop.get('startx')) + starty = float(prop.get('starty')) + endx = float(prop.get('endx')) + endy = float(prop.get('endy')) + gradient = self.factory.createQtObject('QLinearGradient', name, + ctor_args=(startx, starty, endx, endy), is_attribute=False) + + elif gtype == 'ConicalGradient': + centralx = float(prop.get('centralx')) + centraly = float(prop.get('centraly')) + angle = float(prop.get('angle')) + gradient = self.factory.createQtObject('QConicalGradient', name, + ctor_args=(centralx, centraly, angle), is_attribute=False) + + elif gtype == 'RadialGradient': + centralx = float(prop.get('centralx')) + centraly = float(prop.get('centraly')) + radius = float(prop.get('radius')) + focalx = float(prop.get('focalx')) + focaly = float(prop.get('focaly')) + gradient = self.factory.createQtObject('QRadialGradient', name, + ctor_args=(centralx, centraly, radius, focalx, focaly), + is_attribute=False) + + else: + raise UnsupportedPropertyError(prop.tag) + + # Set the common values. + spread = prop.get('spread') + if spread: + gradient.setSpread(getattr(QtGui.QGradient.Spread, spread)) + + cmode = prop.get('coordinatemode') + if cmode: + gradient.setCoordinateMode( + getattr(QtGui.QGradient.CoordinateMode, cmode)) + + # Get the gradient stops. + for gstop in prop: + if gstop.tag != 'gradientstop': + raise UnsupportedPropertyError(gstop.tag) + + position = float(gstop.get('position')) + color = self._color(gstop[0]) + + gradient.setColorAt(position, color) + + return gradient + + def _palette(self, prop): + palette = self.factory.createQtObject('QPalette', 'palette', + is_attribute=False) + + for palette_elem in prop: + sub_palette = getattr(QtGui.QPalette.ColorGroup, + palette_elem.tag.title()) + + for role, color in enumerate(palette_elem): + if color.tag == 'color': + # Handle simple colour descriptions where the role is + # implied by the colour's position. + palette.setColor(sub_palette, + QtGui.QPalette.ColorRole(role), self._color(color)) + elif color.tag == 'colorrole': + role = getattr(QtGui.QPalette.ColorRole, color.get('role')) + brush = self._brush(color[0]) + palette.setBrush(sub_palette, role, brush) + else: + raise UnsupportedPropertyError(color.tag) + + return palette + + def _brush(self, prop): + brushstyle = prop.get('brushstyle') + + if brushstyle in ('LinearGradientPattern', 'ConicalGradientPattern', 'RadialGradientPattern'): + gradient = self._gradient(prop[0]) + brush = self.factory.createQtObject('QBrush', 'brush', + ctor_args=(gradient, ), is_attribute=False) + else: + color = self._color(prop[0]) + brush = self.factory.createQtObject('QBrush', 'brush', + ctor_args=(color, ), is_attribute=False) + + brushstyle = getattr(QtCore.Qt.BrushStyle, brushstyle) + brush.setStyle(brushstyle) + + return brush + + #@needsWidget + def _sizepolicy(self, prop, widget): + values = [int(child.text) for child in prop] + + if len(values) == 2: + # Qt v4.3.0 and later. + horstretch, verstretch = values + hsizetype = getattr(QtWidgets.QSizePolicy.Policy, prop.get('hsizetype')) + vsizetype = getattr(QtWidgets.QSizePolicy.Policy, prop.get('vsizetype')) + else: + hsizetype, vsizetype, horstretch, verstretch = values + hsizetype = QtWidgets.QSizePolicy.Policy(hsizetype) + vsizetype = QtWidgets.QSizePolicy.Policy(vsizetype) + + sizePolicy = self.factory.createQtObject('QSizePolicy', 'sizePolicy', + ctor_args=(hsizetype, vsizetype), is_attribute=False) + sizePolicy.setHorizontalStretch(horstretch) + sizePolicy.setVerticalStretch(verstretch) + sizePolicy.setHeightForWidth(widget.sizePolicy().hasHeightForWidth()) + return sizePolicy + _sizepolicy = needsWidget(_sizepolicy) + + # font needs special handling/conversion of all child elements. + _font_attributes = (("Family", lambda s: s), + ("PointSize", int), + ("Bold", bool_), + ("Italic", bool_), + ("Underline", bool_), + ("Weight", int), + ("StrikeOut", bool_), + ("Kerning", bool_), + ("StyleStrategy", qfont_style_strategy)) + + def _font(self, prop): + newfont = self.factory.createQtObject('QFont', 'font', + is_attribute=False) + for attr, converter in self._font_attributes: + v = prop.findtext("./%s" % (attr.lower(),)) + if v is None: + continue + + getattr(newfont, "set%s" % (attr,))(converter(v)) + return newfont + + def _cursor(self, prop): + return QtGui.QCursor(QtCore.Qt.CursorShape(int(prop.text))) + + def _cursorShape(self, prop): + return QtGui.QCursor(getattr(QtCore.Qt.CursorShape, prop.text)) + + def convert(self, prop, widget=None): + try: + func = getattr(self, "_" + prop[0].tag) + except AttributeError: + raise UnsupportedPropertyError(prop[0].tag) + else: + args = {} + if getattr(func, "needsWidget", False): + assert widget is not None + args["widget"] = widget + + return func(prop[0], **args) + + + def _getChild(self, elem_tag, elem, name, default=None): + for prop in elem.findall(elem_tag): + if prop.attrib["name"] == name: + return self.convert(prop) + else: + return default + + def getProperty(self, elem, name, default=None): + return self._getChild("property", elem, name, default) + + def getAttribute(self, elem, name, default=None): + return self._getChild("attribute", elem, name, default) + + def setProperties(self, widget, elem): + # Lines are sunken unless the frame shadow is explicitly set. + set_sunken = (elem.attrib.get('class') == 'Line') + + for prop in elem.findall('property'): + prop_name = prop.attrib['name'] + DEBUG("setting property %s" % (prop_name,)) + + if prop_name == 'frameShadow': + set_sunken = False + + try: + stdset = bool(int(prop.attrib['stdset'])) + except KeyError: + stdset = True + + if not stdset: + self._setViaSetProperty(widget, prop) + elif hasattr(self, prop_name): + getattr(self, prop_name)(widget, prop) + else: + prop_value = self.convert(prop, widget) + if prop_value is not None: + getattr(widget, 'set%s%s' % (ascii_upper(prop_name[0]), prop_name[1:]))(prop_value) + + if set_sunken: + widget.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) + + # SPECIAL PROPERTIES + # If a property has a well-known value type but needs special, + # context-dependent handling, the default behaviour can be overridden here. + + # Delayed properties will be set after the whole widget tree has been + # populated. + def _delayed_property(self, widget, prop): + prop_value = self.convert(prop) + if prop_value is not None: + prop_name = prop.attrib["name"] + self.delayed_props.append((widget, False, + 'set%s%s' % (ascii_upper(prop_name[0]), prop_name[1:]), + prop_value)) + + # These properties will be set with a widget.setProperty call rather than + # calling the set function. + def _setViaSetProperty(self, widget, prop): + prop_value = self.convert(prop, widget) + if prop_value is not None: + prop_name = prop.attrib['name'] + + # This appears to be a Designer/uic hack where stdset=0 means that + # the viewport should be used. + if prop[0].tag == 'cursorShape': + widget.viewport().setProperty(prop_name, prop_value) + else: + widget.setProperty(prop_name, prop_value) + + # Ignore the property. + def _ignore(self, widget, prop): + pass + + # Define properties that use the canned handlers. + currentIndex = _delayed_property + currentRow = _delayed_property + + showDropIndicator = _setViaSetProperty + intValue = _setViaSetProperty + value = _setViaSetProperty + + objectName = _ignore + margin = _ignore + leftMargin = _ignore + topMargin = _ignore + rightMargin = _ignore + bottomMargin = _ignore + spacing = _ignore + horizontalSpacing = _ignore + verticalSpacing = _ignore + + # tabSpacing is actually the spacing property of the widget's layout. + def tabSpacing(self, widget, prop): + prop_value = self.convert(prop) + if prop_value is not None: + self.delayed_props.append((widget, True, 'setSpacing', prop_value)) + + # buddy setting has to be done after the whole widget tree has been + # populated. We can't use delay here because we cannot get the actual + # buddy yet. + def buddy(self, widget, prop): + buddy_name = prop[0].text + if buddy_name: + self.buddies.append((widget, buddy_name)) + + # geometry is handled specially if set on the toplevel widget. + def geometry(self, widget, prop): + if widget.objectName() == self.uiname: + geom = int_list(prop[0]) + widget.resize(geom[2], geom[3]) + else: + widget.setGeometry(self._rect(prop[0])) + + def orientation(self, widget, prop): + # If the class is a QFrame, it's a line. + if widget.metaObject().className() == 'QFrame': + widget.setFrameShape( + {'Qt::Horizontal': QtWidgets.QFrame.Shape.HLine, + 'Qt::Vertical' : QtWidgets.QFrame.Shape.VLine}[prop[0].text]) + else: + widget.setOrientation(self._enum(prop[0])) + + # The isWrapping attribute of QListView is named inconsistently, it should + # be wrapping. + def isWrapping(self, widget, prop): + widget.setWrapping(self.convert(prop)) + + # This is a pseudo-property injected to deal with margins. + def pyuicMargins(self, widget, prop): + widget.setContentsMargins(*int_list(prop)) + + # This is a pseudo-property injected to deal with spacing. + def pyuicSpacing(self, widget, prop): + horiz, vert = int_list(prop) + + if horiz == vert: + widget.setSpacing(horiz) + else: + if horiz >= 0: + widget.setHorizontalSpacing(horiz) + + if vert >= 0: + widget.setVerticalSpacing(vert) diff --git a/uic/pyuic.py b/uic/pyuic.py new file mode 100644 index 0000000..3b8f68b --- /dev/null +++ b/uic/pyuic.py @@ -0,0 +1,179 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +import os +import sys + + +def main(): + """ Convert a .ui file to a .py file. """ + + import argparse + + from PyQt6.QtCore import PYQT_VERSION_STR + + from .exceptions import (NoSuchClassError, NoSuchWidgetError, + UIFileException) + + # The program name. + PROGRAM_NAME = 'pyuic6' + + # Parse the command line. + parser = argparse.ArgumentParser(prog=PROGRAM_NAME, + description="Python User Interface Compiler") + + parser.add_argument('-V', '--version', action='version', + version=PYQT_VERSION_STR) + parser.add_argument('-p', '--preview', dest='preview', action='store_true', + default=False, + help="show a preview of the UI instead of generating code") + parser.add_argument('-o', '--output', dest='output', default='-', + metavar="FILE", + help="write generated code to FILE instead of stdout") + parser.add_argument('-x', '--execute', dest='execute', action='store_true', + default=False, + help="generate extra code to test and display the class") + parser.add_argument('-d', '--debug', dest='debug', action='store_true', + default=False, help="show debug output") + parser.add_argument('-i', '--indent', dest='indent', action='store', + type=int, default=4, metavar="N", + help="set indent width to N spaces, tab if N is 0 [default: 4]") + parser.add_argument('-w', '--max-workers', dest='max_workers', + action='store', type=int, default=0, metavar="N", + help="use a maximum of N worker processes when converting a directory [default: 0]") + parser.add_argument('ui', + help="the .ui file created by Qt Designer or a directory containing .ui files") + + args = parser.parse_args() + + # Carry out the required action. + if args.debug: + configure_logging() + + exit_status = 1 + + try: + if args.preview: + if os.path.isfile(args.ui): + exit_status = preview(args.ui) + else: + raise UIFileException(args.ui, "must be a file") + else: + generate(args.ui, args.output, args.indent, args.execute, + args.max_workers) + exit_status = 0 + + except IOError as e: + print("Error: {0}: '{1}'".format(e.strerror, e.filename), + file=sys.stderr) + + except SyntaxError as e: + print("Error in input file: {0}".format(e), file=sys.stderr) + + except (NoSuchClassError, NoSuchWidgetError, UIFileException) as e: + print(e, file=sys.stderr) + + except Exception as e: + if args.debug: + import traceback + + traceback.print_exception(*sys.exc_info()) + else: + print("""An unexpected error occurred. +Check that you are using the latest version of {name} and send an error report +to the PyQt mailing list and include the following information: + +- your version of {name} ({version}) +- the .ui file that caused this error +- the debug output of {name} (use the --debug flag when calling {name})""".format(name=PROGRAM_NAME, version=PYQT_VERSION_STR), file=sys.stderr) + + return exit_status + + +def configure_logging(): + """ Configure logging when debug is enabled. """ + + import logging + + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter("%(name)s: %(message)s")) + + logger = logging.getLogger('PyQt6.uic') + logger.addHandler(handler) + logger.setLevel(logging.DEBUG) + + +def generate(ui_file, output, indent, execute, max_workers): + """ Generate the Python code. """ + + from .exceptions import UIFileException + + if os.path.isdir(ui_file): + if output == '-': + map = None + elif os.path.isdir(output) or not os.path.exists(output): + map = lambda d, f: (output, f) + else: + raise UIFileException(output, + f"must be a directory as {ui_file} is a directory") + + from .compile_ui import compileUiDir + + compileUiDir(ui_file, recurse=False, map=map, max_workers=max_workers, + indent=indent, execute=execute) + + elif os.path.isdir(output): + raise UIFileException(output, + f"cannot be a directory unless {ui_file} is a directory") + else: + from .compile_ui import compileUi + + if output == '-': + import io + + pyfile = io.TextIOWrapper(sys.stdout.buffer, encoding='utf8') + needs_close = False + else: + pyfile = open(output, 'wt', encoding='utf8') + needs_close = True + + compileUi(ui_file, pyfile, execute, indent) + + if needs_close: + pyfile.close() + + +def preview(ui_file): + """ Preview the .ui file. Return the exit status to be passed back to the + parent process. + """ + + from PyQt6.QtWidgets import QApplication + + from .load_ui import loadUi + + app = QApplication([ui_file]) + + ui = loadUi(ui_file) + ui.show() + + return app.exec() + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/uic/ui_file.py b/uic/ui_file.py new file mode 100644 index 0000000..8426307 --- /dev/null +++ b/uic/ui_file.py @@ -0,0 +1,92 @@ +# Copyright (c) 2023 Riverbank Computing Limited +# +# This file is part of PyQt6. +# +# This file may be used under the terms of the GNU General Public License +# version 3.0 as published by the Free Software Foundation and appearing in +# the file LICENSE included in the packaging of this file. Please review the +# following information to ensure the GNU General Public License version 3.0 +# requirements will be met: http://www.gnu.org/copyleft/gpl.html. +# +# If you do not wish to use this file under the terms of the GPL version 3.0 +# then you may purchase a commercial license. For more information contact +# info@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +from xml.etree import ElementTree + + +class UIFile: + """ Encapsulate a Designer .ui file. """ + + def __init__(self, ui_file): + """ Initialise the .ui file. """ + + # Get the name of the .ui file allowing it to be a file object. + if hasattr(ui_file, 'read'): + self._ui_file = getattr(ui_file, 'name', "unknown") + else: + self._ui_file = ui_file + + try: + document = ElementTree.parse(ui_file) + except Exception as e: + self._raise_exception("invalid Qt Designer file", detail=str(e)) + + # Perform some sanity checks. + root = document.getroot() + + if root.tag != 'ui': + self._raise_exception("not created by Qt Designer") + + version = root.get('version') + if version is None: + self._raise_exception("missing version number") + + if version != '4.0': + self._raise_exception("only Qt Designer files v4.0 are supported") + + # Extract the top-level elements. + self.button_groups = None + self.connections = None + self.custom_widgets = None + self.layout_default = None + self.tab_stops = None + self.widget = None + + self.class_name = None + + for el in root: + if el.tag == 'class': + self.class_name = el.text + elif el.tag == 'buttongroups': + self.button_groups = el + elif el.tag == 'connections': + self.connections = el + elif el.tag == 'customwidgets': + self.custom_widgets = el + elif el.tag == 'layoutdefault': + self.layout_default = el + elif el.tag == 'tabstops': + self.tab_stops = el + elif el.tag == 'widget': + self.widget = el + + # The element was optional in legacy versions of the schema. + if not self.class_name: + if self.widget is not None: + self.class_name = self.widget.get('name') + + if not self.class_name: + self._raise_exception( + "unable to determine the name of the UI class") + + def _raise_exception(self, message, detail=''): + """ Raise a UIFileException. """ + + from .exceptions import UIFileException + + raise UIFileException(self._ui_file, message, detail=detail) diff --git a/uic/uiparser.py b/uic/uiparser.py new file mode 100644 index 0000000..4a3d2c3 --- /dev/null +++ b/uic/uiparser.py @@ -0,0 +1,1038 @@ +# Copyright (c) 2023 Riverbank Computing Limited. +# Copyright (c) 2006 Thorsten Marek. +# All right reserved. +# +# This file is part of PyQt. +# +# You may use this file under the terms of the GPL v3 or the revised BSD +# license as follows: +# +# "Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of the Riverbank Computing Limited nor the names +# of its contributors may be used to endorse or promote products +# derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + + +import sys +import logging +import os +import re +from xml.etree.ElementTree import SubElement + +from .objcreator import QObjectCreator +from .properties import Properties +from .ui_file import UIFile + + +logger = logging.getLogger(__name__) +DEBUG = logger.debug + +QtCore = None +QtGui = None +QtWidgets = None + + +def _parse_alignment(alignment): + """ Convert a C++ alignment to the corresponding flags. """ + + align_flags = None + for qt_align in alignment.split('|'): + _, qt_align = qt_align.split('::') + align = getattr(QtCore.Qt.AlignmentFlag, qt_align) + + if align_flags is None: + align_flags = align + else: + align_flags |= align + + return align_flags + + +def _layout_position(elem): + """ Return either (), (0, alignment), (row, column, rowspan, colspan) or + (row, column, rowspan, colspan, alignment) depending on the type of layout + and its configuration. The result will be suitable to use as arguments to + the layout. + """ + + row = elem.attrib.get('row') + column = elem.attrib.get('column') + alignment = elem.attrib.get('alignment') + + # See if it is a box layout. + if row is None or column is None: + if alignment is None: + return () + + return (0, _parse_alignment(alignment)) + + # It must be a grid or a form layout. + row = int(row) + column = int(column) + + rowspan = int(elem.attrib.get('rowspan', 1)) + colspan = int(elem.attrib.get('colspan', 1)) + + if alignment is None: + return (row, column, rowspan, colspan) + + return (row, column, rowspan, colspan, _parse_alignment(alignment)) + + +class WidgetStack(list): + topwidget = None + def push(self, item): + DEBUG("push %s %s" % (item.metaObject().className(), + item.objectName())) + self.append(item) + if isinstance(item, QtWidgets.QWidget): + self.topwidget = item + + def popLayout(self): + layout = list.pop(self) + DEBUG("pop layout %s %s" % (layout.metaObject().className(), + layout.objectName())) + return layout + + def popWidget(self): + widget = list.pop(self) + DEBUG("pop widget %s %s" % (widget.metaObject().className(), + widget.objectName())) + for item in reversed(self): + if isinstance(item, QtWidgets.QWidget): + self.topwidget = item + break + else: + self.topwidget = None + DEBUG("new topwidget %s" % (self.topwidget,)) + return widget + + def peek(self): + return self[-1] + + def topIsLayout(self): + return isinstance(self[-1], QtWidgets.QLayout) + + def topIsLayoutWidget(self): + # A plain QWidget is a layout widget unless it's parent is a + # QMainWindow or a container widget. Note that the corresponding uic + # test is a little more complicated as it involves features not + # supported by pyuic. + + if type(self[-1]) is not QtWidgets.QWidget: + return False + + if len(self) < 2: + return False + + parent = self[-2] + + return isinstance(parent, QtWidgets.QWidget) and type(parent) not in ( + QtWidgets.QMainWindow, + QtWidgets.QStackedWidget, + QtWidgets.QToolBox, + QtWidgets.QTabWidget, + QtWidgets.QScrollArea, + QtWidgets.QMdiArea, + QtWidgets.QWizard, + QtWidgets.QDockWidget) + + +class ButtonGroup(object): + """ Encapsulate the configuration of a button group and its implementation. + """ + + def __init__(self): + """ Initialise the button group. """ + + self.exclusive = True + self.object = None + + +class UIParser(object): + def __init__(self, qtcore_module, qtgui_module, qtwidgets_module, creatorPolicy): + self.factory = QObjectCreator(creatorPolicy) + self.wprops = Properties(self.factory, qtcore_module, qtgui_module, + qtwidgets_module) + + global QtCore, QtGui, QtWidgets + QtCore = qtcore_module + QtGui = qtgui_module + QtWidgets = qtwidgets_module + + self.reset() + + def uniqueName(self, name): + """UIParser.uniqueName(string) -> string + + Create a unique name from a string. + >>> p = UIParser(QtCore, QtGui, QtWidgets) + >>> p.uniqueName("foo") + 'foo' + >>> p.uniqueName("foo") + 'foo1' + """ + try: + suffix = self.name_suffixes[name] + except KeyError: + self.name_suffixes[name] = 0 + return name + + suffix += 1 + self.name_suffixes[name] = suffix + + return "%s%i" % (name, suffix) + + def reset(self): + try: self.wprops.reset() + except AttributeError: pass + self.toplevelWidget = None + self.stack = WidgetStack() + self.name_suffixes = {} + self.defaults = {'spacing': -1, 'margin': -1} + self.actions = [] + self.currentActionGroup = None + self.button_groups = {} + + def _setupObject(self, class_name, parent, branch, is_attribute=True, + parent_is_optional=True): + object_name = self.uniqueName( + branch.attrib.get('name') or class_name[1:].lower()) + + if parent is None: + ctor_args = () + ctor_kwargs = {} + elif parent_is_optional: + ctor_args = () + ctor_kwargs = dict(parent=parent) + else: + ctor_args = (parent, ) + ctor_kwargs = {} + + obj = self.factory.createQtObject(class_name, object_name, + ctor_args=ctor_args, ctor_kwargs=ctor_kwargs, + is_attribute=is_attribute) + + self.wprops.setProperties(obj, branch) + obj.setObjectName(object_name) + + if is_attribute: + setattr(self.toplevelWidget, object_name, obj) + + return obj + + def getProperty(self, elem, name): + for prop in elem.findall('property'): + if prop.attrib['name'] == name: + return prop + + return None + + def createWidget(self, elem): + self.column_counter = 0 + self.row_counter = 0 + self.item_nr = 0 + self.itemstack = [] + self.sorting_enabled = None + + widget_class = elem.attrib['class'].replace('::', '.') + if widget_class == 'Line': + widget_class = 'QFrame' + + # Ignore the parent if it is a container. + parent = self.stack.topwidget + if isinstance(parent, (QtWidgets.QDockWidget, QtWidgets.QMdiArea, + QtWidgets.QScrollArea, QtWidgets.QStackedWidget, + QtWidgets.QToolBox, QtWidgets.QTabWidget, + QtWidgets.QWizard)): + parent = None + + self.stack.push(self._setupObject(widget_class, parent, elem)) + + if isinstance(self.stack.topwidget, QtWidgets.QTableWidget): + if self.getProperty(elem, 'columnCount') is None: + self.stack.topwidget.setColumnCount(len(elem.findall("column"))) + + if self.getProperty(elem, 'rowCount') is None: + self.stack.topwidget.setRowCount(len(elem.findall("row"))) + + self.traverseWidgetTree(elem) + widget = self.stack.popWidget() + + if isinstance(widget, QtWidgets.QTreeView): + self.handleHeaderView(elem, "header", widget.header()) + + elif isinstance(widget, QtWidgets.QTableView): + self.handleHeaderView(elem, "horizontalHeader", + widget.horizontalHeader()) + self.handleHeaderView(elem, "verticalHeader", + widget.verticalHeader()) + + elif isinstance(widget, QtWidgets.QAbstractButton): + bg_i18n = self.wprops.getAttribute(elem, "buttonGroup") + if bg_i18n is not None: + # This should be handled properly in case the problem arises + # elsewhere as well. + try: + # We are compiling the .ui file. + bg_name = bg_i18n.string + except AttributeError: + # We are loading the .ui file. + bg_name = bg_i18n + + # Designer allows the creation of .ui files without explicit + # button groups, even though uic then issues warnings. We + # handle it in two stages by first making sure it has a name + # and then making sure one exists with that name. + if not bg_name: + bg_name = 'buttonGroup' + + try: + bg = self.button_groups[bg_name] + except KeyError: + bg = self.button_groups[bg_name] = ButtonGroup() + + if bg.object is None: + bg.object = self.factory.createQtObject('QButtonGroup', + bg_name, ctor_args=(self.toplevelWidget, )) + setattr(self.toplevelWidget, bg_name, bg.object) + + bg.object.setObjectName(bg_name) + + if not bg.exclusive: + bg.object.setExclusive(False) + + bg.object.addButton(widget) + + if self.sorting_enabled is not None: + widget.setSortingEnabled(self.sorting_enabled) + self.sorting_enabled = None + + if self.stack.topIsLayout(): + lay = self.stack.peek() + lp = elem.attrib['layout-position'] + + if isinstance(lay, QtWidgets.QFormLayout): + lay.setWidget(lp[0], self._form_layout_role(lp), widget) + else: + lay.addWidget(widget, *lp) + + topwidget = self.stack.topwidget + + if isinstance(topwidget, QtWidgets.QToolBox): + icon = self.wprops.getAttribute(elem, "icon") + if icon is not None: + topwidget.addItem(widget, icon, self.wprops.getAttribute(elem, "label")) + else: + topwidget.addItem(widget, self.wprops.getAttribute(elem, "label")) + + tooltip = self.wprops.getAttribute(elem, "toolTip") + if tooltip is not None: + topwidget.setItemToolTip(topwidget.indexOf(widget), tooltip) + + elif isinstance(topwidget, QtWidgets.QTabWidget): + icon = self.wprops.getAttribute(elem, "icon") + if icon is not None: + topwidget.addTab(widget, icon, self.wprops.getAttribute(elem, "title")) + else: + topwidget.addTab(widget, self.wprops.getAttribute(elem, "title")) + + tooltip = self.wprops.getAttribute(elem, "toolTip") + if tooltip is not None: + topwidget.setTabToolTip(topwidget.indexOf(widget), tooltip) + + elif isinstance(topwidget, QtWidgets.QWizard): + topwidget.addPage(widget) + + elif isinstance(topwidget, QtWidgets.QStackedWidget): + topwidget.addWidget(widget) + + elif isinstance(topwidget, (QtWidgets.QDockWidget, QtWidgets.QScrollArea)): + topwidget.setWidget(widget) + + elif isinstance(topwidget, QtWidgets.QMainWindow): + if type(widget) == QtWidgets.QWidget: + topwidget.setCentralWidget(widget) + elif isinstance(widget, QtWidgets.QToolBar): + tbArea = self.wprops.getAttribute(elem, "toolBarArea") + + if tbArea is None: + topwidget.addToolBar(widget) + else: + topwidget.addToolBar(tbArea, widget) + + tbBreak = self.wprops.getAttribute(elem, "toolBarBreak") + + if tbBreak: + topwidget.insertToolBarBreak(widget) + + elif isinstance(widget, QtWidgets.QMenuBar): + topwidget.setMenuBar(widget) + elif isinstance(widget, QtWidgets.QStatusBar): + topwidget.setStatusBar(widget) + elif isinstance(widget, QtWidgets.QDockWidget): + dwArea = self.wprops.getAttribute(elem, "dockWidgetArea") + topwidget.addDockWidget(QtCore.Qt.DockWidgetArea(dwArea), + widget) + + def handleHeaderView(self, elem, name, header): + value = self.wprops.getAttribute(elem, name + "Visible") + if value is not None: + header.setVisible(value) + + value = self.wprops.getAttribute(elem, name + "CascadingSectionResizes") + if value is not None: + header.setCascadingSectionResizes(value) + + value = self.wprops.getAttribute(elem, name + "DefaultSectionSize") + if value is not None: + header.setDefaultSectionSize(value) + + value = self.wprops.getAttribute(elem, name + "HighlightSections") + if value is not None: + header.setHighlightSections(value) + + value = self.wprops.getAttribute(elem, name + "MinimumSectionSize") + if value is not None: + header.setMinimumSectionSize(value) + + value = self.wprops.getAttribute(elem, name + "ShowSortIndicator") + if value is not None: + header.setSortIndicatorShown(value) + + value = self.wprops.getAttribute(elem, name + "StretchLastSection") + if value is not None: + header.setStretchLastSection(value) + + def createSpacer(self, elem): + width = elem.findtext("property/size/width") + height = elem.findtext("property/size/height") + + if width is None or height is None: + size_args = () + else: + size_args = (int(width), int(height)) + + sizeType = self.wprops.getProperty(elem, "sizeType", + QtWidgets.QSizePolicy.Policy.Expanding) + + policy = (QtWidgets.QSizePolicy.Policy.Minimum, sizeType) + + if self.wprops.getProperty(elem, "orientation") == QtCore.Qt.Orientation.Horizontal: + policy = policy[1], policy[0] + + spacer = self.factory.createQtObject('QSpacerItem', + self.uniqueName('spacerItem'), ctor_args=size_args + policy, + is_attribute=False) + + if self.stack.topIsLayout(): + lay = self.stack.peek() + lp = elem.attrib['layout-position'] + + if isinstance(lay, QtWidgets.QFormLayout): + lay.setItem(lp[0], self._form_layout_role(lp), spacer) + else: + lay.addItem(spacer, *lp) + + def createLayout(self, elem): + # We use an internal property to handle margins which will use separate + # left, top, right and bottom margins if they are found to be + # different. The following will select, in order of preference, + # separate margins, the same margin in all directions, and the default + # margin. + margin = -1 if self.stack.topIsLayout() else self.defaults['margin'] + margin = self.wprops.getProperty(elem, 'margin', margin) + left = self.wprops.getProperty(elem, 'leftMargin', margin) + top = self.wprops.getProperty(elem, 'topMargin', margin) + right = self.wprops.getProperty(elem, 'rightMargin', margin) + bottom = self.wprops.getProperty(elem, 'bottomMargin', margin) + + # A layout widget should, by default, have no margins. + if self.stack.topIsLayoutWidget(): + if left < 0: left = 0 + if top < 0: top = 0 + if right < 0: right = 0 + if bottom < 0: bottom = 0 + + if left >= 0 or top >= 0 or right >= 0 or bottom >= 0: + # We inject the new internal property. + cme = SubElement(elem, 'property', name='pyuicMargins') + SubElement(cme, 'number').text = str(left) + SubElement(cme, 'number').text = str(top) + SubElement(cme, 'number').text = str(right) + SubElement(cme, 'number').text = str(bottom) + + # We use an internal property to handle spacing which will use separate + # horizontal and vertical spacing if they are found to be different. + # The following will select, in order of preference, separate + # horizontal and vertical spacing, the same spacing in both directions, + # and the default spacing. + spacing = self.wprops.getProperty(elem, 'spacing', + self.defaults['spacing']) + horiz = self.wprops.getProperty(elem, 'horizontalSpacing', spacing) + vert = self.wprops.getProperty(elem, 'verticalSpacing', spacing) + + if horiz >= 0 or vert >= 0: + # We inject the new internal property. + cme = SubElement(elem, 'property', name='pyuicSpacing') + SubElement(cme, 'number').text = str(horiz) + SubElement(cme, 'number').text = str(vert) + + classname = elem.attrib["class"] + if self.stack.topIsLayout(): + parent = None + else: + parent = self.stack.topwidget + if "name" not in elem.attrib: + elem.attrib["name"] = classname[1:].lower() + self.stack.push( + self._setupObject(classname, parent, elem, + parent_is_optional=False)) + self.traverseWidgetTree(elem) + + layout = self.stack.popLayout() + self.configureLayout(elem, layout) + + if self.stack.topIsLayout(): + top_layout = self.stack.peek() + lp = elem.attrib['layout-position'] + + if isinstance(top_layout, QtWidgets.QFormLayout): + top_layout.setLayout(lp[0], self._form_layout_role(lp), layout) + else: + top_layout.addLayout(layout, *lp) + + def configureLayout(self, elem, layout): + if isinstance(layout, QtWidgets.QGridLayout): + self.setArray(elem, 'columnminimumwidth', + layout.setColumnMinimumWidth) + self.setArray(elem, 'rowminimumheight', + layout.setRowMinimumHeight) + self.setArray(elem, 'columnstretch', layout.setColumnStretch) + self.setArray(elem, 'rowstretch', layout.setRowStretch) + + elif isinstance(layout, QtWidgets.QBoxLayout): + self.setArray(elem, 'stretch', layout.setStretch) + + def setArray(self, elem, name, setter): + array = elem.attrib.get(name) + if array: + for idx, value in enumerate(array.split(',')): + value = int(value) + if value > 0: + setter(idx, value) + + def disableSorting(self, w): + if self.item_nr == 0: + self.sorting_enabled = self.factory.invoke("__sortingEnabled", + w.isSortingEnabled) + w.setSortingEnabled(False) + + def handleItem(self, elem): + if self.stack.topIsLayout(): + elem[0].attrib['layout-position'] = _layout_position(elem) + self.traverseWidgetTree(elem) + else: + w = self.stack.topwidget + + if isinstance(w, QtWidgets.QComboBox): + text = self.wprops.getProperty(elem, "text") + icon = self.wprops.getProperty(elem, "icon") + + if icon: + w.addItem(icon, '') + else: + w.addItem('') + + w.setItemText(self.item_nr, text) + + elif isinstance(w, QtWidgets.QListWidget): + self.disableSorting(w) + item = self.createWidgetItem('QListWidgetItem', elem, w.item, + self.item_nr) + w.addItem(item) + + elif isinstance(w, QtWidgets.QTreeWidget): + if self.itemstack: + parent, _ = self.itemstack[-1] + _, nr_in_root = self.itemstack[0] + else: + parent = w + nr_in_root = self.item_nr + + item = self.factory.createQtObject('QTreeWidgetItem', + 'item_%d' % len(self.itemstack), ctor_args=(parent, ), + is_attribute=False) + + if self.item_nr == 0 and not self.itemstack: + self.sorting_enabled = self.factory.invoke("__sortingEnabled", w.isSortingEnabled) + w.setSortingEnabled(False) + + self.itemstack.append((item, self.item_nr)) + self.item_nr = 0 + + # We have to access the item via the tree when setting the + # text. + titm = w.topLevelItem(nr_in_root) + for child, nr_in_parent in self.itemstack[1:]: + titm = titm.child(nr_in_parent) + + column = -1 + for prop in elem.findall('property'): + c_prop = self.wprops.convert(prop) + c_prop_name = prop.attrib['name'] + + if c_prop_name == 'text': + column += 1 + if c_prop: + titm.setText(column, c_prop) + elif c_prop_name == 'statusTip': + item.setStatusTip(column, c_prop) + elif c_prop_name == 'toolTip': + item.setToolTip(column, c_prop) + elif c_prop_name == 'whatsThis': + item.setWhatsThis(column, c_prop) + elif c_prop_name == 'font': + item.setFont(column, c_prop) + elif c_prop_name == 'icon': + item.setIcon(column, c_prop) + elif c_prop_name == 'background': + item.setBackground(column, c_prop) + elif c_prop_name == 'foreground': + item.setForeground(column, c_prop) + elif c_prop_name == 'flags': + item.setFlags(c_prop) + elif c_prop_name == 'checkState': + item.setCheckState(column, c_prop) + + self.traverseWidgetTree(elem) + _, self.item_nr = self.itemstack.pop() + + elif isinstance(w, QtWidgets.QTableWidget): + row = int(elem.attrib['row']) + col = int(elem.attrib['column']) + + self.disableSorting(w) + item = self.createWidgetItem('QTableWidgetItem', elem, w.item, + row, col) + w.setItem(row, col, item) + + self.item_nr += 1 + + def addAction(self, elem): + self.actions.append((self.stack.topwidget, elem.attrib["name"])) + + @staticmethod + def any_i18n(*args): + """ Return True if any argument appears to be an i18n string. """ + + for a in args: + if a is not None and not isinstance(a, str): + return True + + return False + + def createWidgetItem(self, item_type, elem, getter, *getter_args): + """ Create a specific type of widget item. """ + + item = self.factory.createQtObject(item_type, 'item', + is_attribute=False) + props = self.wprops + + # Note that not all types of widget items support the full set of + # properties. + + text = props.getProperty(elem, 'text') + status_tip = props.getProperty(elem, 'statusTip') + tool_tip = props.getProperty(elem, 'toolTip') + whats_this = props.getProperty(elem, 'whatsThis') + + if self.any_i18n(text, status_tip, tool_tip, whats_this): + self.factory.invoke("item", getter, getter_args) + + if text: + item.setText(text) + + if status_tip: + item.setStatusTip(status_tip) + + if tool_tip: + item.setToolTip(tool_tip) + + if whats_this: + item.setWhatsThis(whats_this) + + text_alignment = props.getProperty(elem, 'textAlignment') + if text_alignment: + item.setTextAlignment(text_alignment) + + font = props.getProperty(elem, 'font') + if font: + item.setFont(font) + + icon = props.getProperty(elem, 'icon') + if icon: + item.setIcon(icon) + + background = props.getProperty(elem, 'background') + if background: + item.setBackground(background) + + foreground = props.getProperty(elem, 'foreground') + if foreground: + item.setForeground(foreground) + + flags = props.getProperty(elem, 'flags') + if flags: + item.setFlags(flags) + + check_state = props.getProperty(elem, 'checkState') + if check_state: + item.setCheckState(check_state) + + return item + + def addHeader(self, elem): + w = self.stack.topwidget + + if isinstance(w, QtWidgets.QTreeWidget): + props = self.wprops + col = self.column_counter + + text = props.getProperty(elem, 'text') + if text: + w.headerItem().setText(col, text) + + status_tip = props.getProperty(elem, 'statusTip') + if status_tip: + w.headerItem().setStatusTip(col, status_tip) + + tool_tip = props.getProperty(elem, 'toolTip') + if tool_tip: + w.headerItem().setToolTip(col, tool_tip) + + whats_this = props.getProperty(elem, 'whatsThis') + if whats_this: + w.headerItem().setWhatsThis(col, whats_this) + + text_alignment = props.getProperty(elem, 'textAlignment') + if text_alignment: + w.headerItem().setTextAlignment(col, text_alignment) + + font = props.getProperty(elem, 'font') + if font: + w.headerItem().setFont(col, font) + + icon = props.getProperty(elem, 'icon') + if icon: + w.headerItem().setIcon(col, icon) + + background = props.getProperty(elem, 'background') + if background: + w.headerItem().setBackground(col, background) + + foreground = props.getProperty(elem, 'foreground') + if foreground: + w.headerItem().setForeground(col, foreground) + + self.column_counter += 1 + + elif isinstance(w, QtWidgets.QTableWidget): + if len(elem) != 0: + if elem.tag == 'column': + item = self.createWidgetItem('QTableWidgetItem', elem, + w.horizontalHeaderItem, self.column_counter) + w.setHorizontalHeaderItem(self.column_counter, item) + self.column_counter += 1 + elif elem.tag == 'row': + item = self.createWidgetItem('QTableWidgetItem', elem, + w.verticalHeaderItem, self.row_counter) + w.setVerticalHeaderItem(self.row_counter, item) + self.row_counter += 1 + + def setZOrder(self, elem): + # Designer can generate empty zorder elements. + if elem.text is None: + return + + # Designer allows the z-order of spacer items to be specified even + # though they can't be raised, so ignore any missing raise_() method. + try: + getattr(self.toplevelWidget, elem.text).raise_() + except AttributeError: + # Note that uic issues a warning message. + pass + + def createAction(self, elem): + self._setupObject('QAction', + self.currentActionGroup or self.toplevelWidget, elem) + + def createActionGroup(self, elem): + action_group = self._setupObject('QActionGroup', self.toplevelWidget, + elem, parent_is_optional=False) + self.currentActionGroup = action_group + self.traverseWidgetTree(elem) + self.currentActionGroup = None + + widgetTreeItemHandlers = { + "widget" : createWidget, + "addaction" : addAction, + "layout" : createLayout, + "spacer" : createSpacer, + "item" : handleItem, + "action" : createAction, + "actiongroup": createActionGroup, + "column" : addHeader, + "row" : addHeader, + "zorder" : setZOrder, + } + + def traverseWidgetTree(self, elem): + for child in iter(elem): + try: + handler = self.widgetTreeItemHandlers[child.tag] + except KeyError: + continue + + handler(self, child) + + def _handle_widget(self, el): + """ Handle the top-level element. """ + + # Get the names of the class and widget. + cname = el.attrib["class"] + wname = el.attrib["name"] + + # If there was no widget name then derive it from the class name. + if not wname: + wname = cname + + if wname.startswith("Q"): + wname = wname[1:] + + wname = wname[0].lower() + wname[1:] + + self.toplevelWidget = self.createToplevelWidget(cname, wname) + self.toplevelWidget.setObjectName(wname) + DEBUG("toplevel widget is %s", + self.toplevelWidget.metaObject().className()) + self.wprops.setProperties(self.toplevelWidget, el) + self.stack.push(self.toplevelWidget) + self.traverseWidgetTree(el) + self.stack.popWidget() + self.addActions() + self.setBuddies() + self.setDelayedProps() + + def addActions(self): + for widget, action_name in self.actions: + if action_name == "separator": + widget.addSeparator() + else: + DEBUG("add action %s to %s", action_name, widget.objectName()) + action_obj = getattr(self.toplevelWidget, action_name) + if isinstance(action_obj, QtWidgets.QMenu): + widget.addAction(action_obj.menuAction()) + elif not isinstance(action_obj, QtGui.QActionGroup): + widget.addAction(action_obj) + + def setDelayedProps(self): + for widget, layout, setter, args in self.wprops.delayed_props: + if layout: + widget = widget.layout() + + setter = getattr(widget, setter) + setter(args) + + def setBuddies(self): + for widget, buddy in self.wprops.buddies: + DEBUG("%s is buddy of %s", buddy, widget.objectName()) + try: + widget.setBuddy(getattr(self.toplevelWidget, buddy)) + except AttributeError: + DEBUG("ERROR in ui spec: %s (buddy of %s) does not exist", + buddy, widget.objectName()) + + def setContext(self, context): + """ + Reimplemented by a sub-class if it needs to know the translation + context. + """ + pass + + def _handle_layout_default(self, el): + """ Handle the element. """ + + self.defaults['margin'] = int(el.attrib['margin']) + self.defaults['spacing'] = int(el.attrib['spacing']) + + def _handle_tab_stops(self, el): + """ Handle the element. """ + + lastwidget = None + for widget_el in el: + widget = getattr(self.toplevelWidget, widget_el.text) + + if lastwidget is not None: + self.toplevelWidget.setTabOrder(lastwidget, widget) + + lastwidget = widget + + def _handle_connections(self, el): + """ Handle the element. """ + + def name2object(obj): + if obj == self.uiname: + return self.toplevelWidget + else: + return getattr(self.toplevelWidget, obj) + + for conn in el: + signal = conn.findtext('signal') + signal_name, signal_args = signal.split('(') + signal_args = signal_args[:-1].replace(' ', '') + sender = name2object(conn.findtext('sender')) + bound_signal = getattr(sender, signal_name) + + slot = self.factory.getSlot(name2object(conn.findtext('receiver')), + conn.findtext('slot').split('(')[0]) + + if signal_args == '': + bound_signal.connect(slot) + else: + signal_args = signal_args.split(',') + + if len(signal_args) == 1: + bound_signal[signal_args[0]].connect(slot) + else: + bound_signal[tuple(signal_args)].connect(slot) + + QtCore.QMetaObject.connectSlotsByName(self.toplevelWidget) + + def _handle_custom_widgets(self, el): + """ Handle the element. """ + + def header2module(header): + """header2module(header) -> string + + Convert paths to C++ header files to according Python modules + >>> header2module("foo/bar/baz.h") + 'foo.bar.baz' + """ + if header.endswith(".h"): + header = header[:-2] + + mpath = [] + for part in header.split('/'): + # Ignore any empty parts or those that refer to the current + # directory. + if part not in ('', '.'): + if part == '..': + # We should allow this for Python3. + raise SyntaxError("custom widget header file name may not contain '..'.") + + mpath.append(part) + + return '.'.join(mpath) + + for custom_widget in el: + classname = custom_widget.findtext("class") + self.factory.addCustomWidget(classname, + custom_widget.findtext("extends") or "QWidget", + header2module(custom_widget.findtext("header"))) + + def createToplevelWidget(self, classname, widgetname): + raise NotImplementedError + + def _handle_button_groups(self, el): + """ Handle the element. """ + + for button_group in el: + if button_group.tag == 'buttongroup': + bg_name = button_group.attrib['name'] + bg = ButtonGroup() + self.button_groups[bg_name] = bg + + prop = self.getProperty(button_group, 'exclusive') + if prop is not None: + if prop.findtext('bool') == 'false': + bg.exclusive = False + + # finalize will be called after the whole tree has been parsed and can be + # overridden. + def finalize(self): + pass + + def parse(self, filename): + if hasattr(filename, 'read'): + base_dir = '' + else: + base_dir = os.path.dirname(filename) + + self.wprops.set_base_dir(base_dir) + + ui_file = UIFile(filename) + + self.uiname = ui_file.class_name + self.wprops.uiname = ui_file.class_name + self.setContext(ui_file.class_name) + + # The order in which the elements are handled is important. The widget + # handler relies on all custom widgets being known, and in order to + # create the connections, all widgets have to be populated. + if ui_file.layout_default is not None: + self._handle_layout_default(ui_file.layout_default) + + if ui_file.button_groups is not None: + self._handle_button_groups(ui_file.button_groups) + + if ui_file.custom_widgets is not None: + self._handle_custom_widgets(ui_file.custom_widgets) + + if ui_file.widget is not None: + self._handle_widget(ui_file.widget) + + if ui_file.connections is not None: + self._handle_connections(ui_file.connections) + + if ui_file.tab_stops is not None: + self._handle_tab_stops(ui_file.tab_stops) + + self.finalize() + + w = self.toplevelWidget + self.reset() + + return w + + @staticmethod + def _form_layout_role(layout_position): + if layout_position[3] > 1: + role = QtWidgets.QFormLayout.ItemRole.SpanningRole + elif layout_position[1] == 1: + role = QtWidgets.QFormLayout.ItemRole.FieldRole + else: + role = QtWidgets.QFormLayout.ItemRole.LabelRole + + return role diff --git a/uic/widget-plugins/qaxcontainer.py b/uic/widget-plugins/qaxcontainer.py new file mode 100644 index 0000000..dd15858 --- /dev/null +++ b/uic/widget-plugins/qaxcontainer.py @@ -0,0 +1,33 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# + + +# If pluginType is MODULE, the plugin loader will call moduleInformation. The +# variable MODULE is inserted into the local namespace by the plugin loader. +pluginType = MODULE + + +# moduleInformation() must return a tuple (module, widget_list). If "module" +# is "A" and any widget from this module is used, the code generator will write +# "import A". If "module" is "A[.B].C", the code generator will write +# "from A[.B] import C". Each entry in "widget_list" must be unique. +def moduleInformation(): + return "PyQt6.QAxContainer", ("QAxWidget", ) diff --git a/uic/widget-plugins/qscintilla.py b/uic/widget-plugins/qscintilla.py new file mode 100644 index 0000000..ee1a5db --- /dev/null +++ b/uic/widget-plugins/qscintilla.py @@ -0,0 +1,33 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# + + +# If pluginType is MODULE, the plugin loader will call moduleInformation. The +# variable MODULE is inserted into the local namespace by the plugin loader. +pluginType = MODULE + + +# moduleInformation() must return a tuple (module, widget_list). If "module" +# is "A" and any widget from this module is used, the code generator will write +# "import A". If "module" is "A[.B].C", the code generator will write +# "from A[.B] import C". Each entry in "widget_list" must be unique. +def moduleInformation(): + return "PyQt6.Qsci", ("QsciScintilla", ) diff --git a/uic/widget-plugins/qtcharts.py b/uic/widget-plugins/qtcharts.py new file mode 100644 index 0000000..e2385e0 --- /dev/null +++ b/uic/widget-plugins/qtcharts.py @@ -0,0 +1,33 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# + + +# If pluginType is MODULE, the plugin loader will call moduleInformation. The +# variable MODULE is inserted into the local namespace by the plugin loader. +pluginType = MODULE + + +# moduleInformation() must return a tuple (module, widget_list). If "module" +# is "A" and any widget from this module is used, the code generator will write +# "import A". If "module" is "A[.B].C", the code generator will write +# "from A[.B] import C". Each entry in "widget_list" must be unique. +def moduleInformation(): + return 'PyQt6.QtChart', ('QtCharts.QChartView', ) diff --git a/uic/widget-plugins/qtprintsupport.py b/uic/widget-plugins/qtprintsupport.py new file mode 100644 index 0000000..8bc638d --- /dev/null +++ b/uic/widget-plugins/qtprintsupport.py @@ -0,0 +1,33 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# + + +# If pluginType is MODULE, the plugin loader will call moduleInformation. The +# variable MODULE is inserted into the local namespace by the plugin loader. +pluginType = MODULE + + +# moduleInformation() must return a tuple (module, widget_list). If "module" +# is "A" and any widget from this module is used, the code generator will write +# "import A". If "module" is "A[.B].C", the code generator will write +# "from A[.B] import C". Each entry in "widget_list" must be unique. +def moduleInformation(): + return 'PyQt6.QtPrintSupport', ('QAbstractPrintDialog', 'QPageSetupDialog') diff --git a/uic/widget-plugins/qtquickwidgets.py b/uic/widget-plugins/qtquickwidgets.py new file mode 100644 index 0000000..eff80a4 --- /dev/null +++ b/uic/widget-plugins/qtquickwidgets.py @@ -0,0 +1,33 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# + + +# If pluginType is MODULE, the plugin loader will call moduleInformation. The +# variable MODULE is inserted into the local namespace by the plugin loader. +pluginType = MODULE + + +# moduleInformation() must return a tuple (module, widget_list). If "module" +# is "A" and any widget from this module is used, the code generator will write +# "import A". If "module" is "A[.B].C", the code generator will write +# "from A[.B] import C". Each entry in "widget_list" must be unique. +def moduleInformation(): + return "PyQt6.QtQuickWidgets", ("QQuickWidget", ) diff --git a/uic/widget-plugins/qtwebenginewidgets.py b/uic/widget-plugins/qtwebenginewidgets.py new file mode 100644 index 0000000..d2968ce --- /dev/null +++ b/uic/widget-plugins/qtwebenginewidgets.py @@ -0,0 +1,33 @@ +############################################################################# +## +## Copyright (c) 2023 Riverbank Computing Limited +## +## This file is part of PyQt6. +## +## This file may be used under the terms of the GNU General Public License +## version 3.0 as published by the Free Software Foundation and appearing in +## the file LICENSE included in the packaging of this file. Please review the +## following information to ensure the GNU General Public License version 3.0 +## requirements will be met: http://www.gnu.org/copyleft/gpl.html. +## +## If you do not wish to use this file under the terms of the GPL version 3.0 +## then you may purchase a commercial license. For more information contact +## info@riverbankcomputing.com. +## +## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +## +############################################################################# + + +# If pluginType is MODULE, the plugin loader will call moduleInformation. The +# variable MODULE is inserted into the local namespace by the plugin loader. +pluginType = MODULE + + +# moduleInformation() must return a tuple (module, widget_list). If "module" +# is "A" and any widget from this module is used, the code generator will write +# "import A". If "module" is "A[.B].C", the code generator will write +# "from A[.B] import C". Each entry in "widget_list" must be unique. +def moduleInformation(): + return "PyQt6.QtWebEngineWidgets", ("QWebEngineView", ) -- 2.30.2