diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-07-27 14:45:25 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-27 22:40:47 +0000 |
commit | a623a5755c9cf7b8bf6411bd773671cd57a616d7 (patch) | |
tree | 4aa1b6df915625d3437194949e5e7beb8c9cf266 | |
parent | 208c0bc5987f84c3bb67654b00c00caabfe4a0c2 (diff) |
PySide6: Use constData() in snippets where applicable
Change-Id: Iafa3a7f4e0a81733c5a99a907e808391270ce8c6
Reviewed-by: Christian Tismer <tismer@stackless.com>
(cherry picked from commit b9864c4f27b93d6c6948c0fc750af6fb976fe8dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/pyside6/PySide6/glue/qtcore.cpp | 6 | ||||
-rw-r--r-- | sources/pyside6/PySide6/glue/qtgui.cpp | 2 | ||||
-rw-r--r-- | sources/pyside6/PySide6/templates/gui_common.xml | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp index 8228e3c19..41817a2c7 100644 --- a/sources/pyside6/PySide6/glue/qtcore.cpp +++ b/sources/pyside6/PySide6/glue/qtcore.cpp @@ -647,8 +647,8 @@ static void msgHandlerCallback(QtMsgType type, const QMessageLogContext &ctx, co PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[QtMsgType](type)); PyTuple_SET_ITEM(arglist, 1, %CONVERTTOPYTHON[QMessageLogContext &](ctx)); QByteArray array = msg.toUtf8(); // Python handler requires UTF-8 - char *data = array.data(); - PyTuple_SET_ITEM(arglist, 2, %CONVERTTOPYTHON[char *](data)); + const char *data = array.constData(); + PyTuple_SET_ITEM(arglist, 2, %CONVERTTOPYTHON[const char *](data)); Shiboken::AutoDecRef ret(PyObject_CallObject(qtmsghandler, arglist)); } static void QtCoreModuleExit() @@ -1427,7 +1427,7 @@ if (result == -1) { Py_INCREF(Py_None); %PYARG_0 = Py_None; } else { - %PYARG_0 = PyBytes_FromStringAndSize(data.data(), result); + %PYARG_0 = PyBytes_FromStringAndSize(data.constData(), result); } // @snippet qdatastream-readrawdata diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp index 6b30952d2..5b91790cf 100644 --- a/sources/pyside6/PySide6/glue/qtgui.cpp +++ b/sources/pyside6/PySide6/glue/qtgui.cpp @@ -474,7 +474,7 @@ const auto points = PySide::Numpy::xyDataToQPointFList(%PYARG_1, %PYARG_2); // @snippet qpainter-drawpointsnp-numpy-x-y // @snippet qpainter-drawpolygon -%CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); +%CPPSELF.%FUNCTION_NAME(%1.constData(), %1.size(), %2); // @snippet qpainter-drawpolygon // @snippet qmatrix4x4 diff --git a/sources/pyside6/PySide6/templates/gui_common.xml b/sources/pyside6/PySide6/templates/gui_common.xml index 874f8df5f..b802054a8 100644 --- a/sources/pyside6/PySide6/templates/gui_common.xml +++ b/sources/pyside6/PySide6/templates/gui_common.xml @@ -172,7 +172,7 @@ </template> <template name="qpainter_drawlist"> - %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size()); + %CPPSELF.%FUNCTION_NAME(%1.constData(), %1.size()); </template> <template name="inplace_add"> |