diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-03 16:18:44 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-03 16:18:47 +0200 |
commit | db8256ab0f983f164d70b9874e114d234357cda5 (patch) | |
tree | bae615305992fc1f74fb488f37a16ad2276b57d8 /sources/pyside2/PySide2/QtCore | |
parent | 9b01aae7777c7ccde9eed1a8c55aead1524e00e5 (diff) | |
parent | 8f6611ca89adf2a4c8a84049a7b5b8ba405236ba (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.11
Change-Id: I15e8a6120c249bfc5a0e2b3fa262989fafccbf57
Diffstat (limited to 'sources/pyside2/PySide2/QtCore')
12 files changed, 102 insertions, 22 deletions
diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp index 593b4bfba..22825a5cb 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp +++ b/sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp new file mode 100644 index 000000000..6a997c852 --- /dev/null +++ b/sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt for Python. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +if (PyIndex_Check(_key)) { + Py_ssize_t _i; + _i = PyNumber_AsSsize_t(_key, PyExc_IndexError); + if (_i < 0 || _i >= %CPPSELF.size()) { + PyErr_SetString(PyExc_IndexError, "index out of bounds"); + return 0; + } else { + char res[2]; + res[0] = %CPPSELF.at(_i); + res[1] = 0; + return PyBytes_FromStringAndSize(res, 1); + } +} else if (PySlice_Check(_key)) { + Py_ssize_t start, stop, step, slicelength, cur; + +#ifdef IS_PY3K + PyObject *key = _key; +#else + PySliceObject *key = reinterpret_cast<PySliceObject *>(_key); +#endif + if (PySlice_GetIndicesEx(key, %CPPSELF.count(), &start, &stop, &step, &slicelength) < 0) { + return NULL; + } + + QByteArray ba; + if (slicelength <= 0) { + return %CONVERTTOPYTHON[QByteArray](ba); + } else if (step == 1) { + Py_ssize_t max = %CPPSELF.count(); + start = qBound(Py_ssize_t(0), start, max); + stop = qBound(Py_ssize_t(0), stop, max); + QByteArray ba; + if (start < stop) + ba = %CPPSELF.mid(start, stop - start); + return %CONVERTTOPYTHON[QByteArray](ba); + } else { + QByteArray ba; + for (cur = start; slicelength > 0; cur += static_cast<size_t>(step), slicelength--) { + ba.append(%CPPSELF.at(cur)); + } + return %CONVERTTOPYTHON[QByteArray](ba); + } +} else { + PyErr_Format(PyExc_TypeError, + "list indices must be integers or slices, not %.200s", + _key->ob_type->tp_name); + return NULL; +} diff --git a/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp b/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp index b2dfae38f..9bdaa011e 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp +++ b/sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp index 6955b1149..5d28fbf41 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp +++ b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h index 39acac5d5..7053d808c 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h +++ b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp b/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp index 5690112ca..ed37cef34 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp +++ b/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp b/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp index 5aa75566e..464fb68b1 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp +++ b/sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core.xml.in b/sources/pyside2/PySide2/QtCore/typesystem_core.xml.in index 58caaee55..8be5bba4e 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core.xml.in +++ b/sources/pyside2/PySide2/QtCore/typesystem_core.xml.in @@ -5,7 +5,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 19975b1dc..1e239f38b 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -5,7 +5,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage @@ -2017,6 +2017,7 @@ </object-type> <object-type name="QThread"> <enum-type name="Priority"/> + <modify-function signature="currentThreadId()" remove="all"/> <modify-function signature="run()" thread="yes" /> <modify-function signature="exec()" rename="exec_" allow-thread="yes" /> <modify-function signature="msleep(unsigned long)" allow-thread="yes" /> @@ -2795,6 +2796,9 @@ } </inject-code> </add-function> + <add-function signature="__mgetitem__"> + <inject-code class="target" position="beginning" file="glue/qbytearray_mgetitem.cpp" /> + </add-function> <add-function signature="__setitem__"> <inject-code class="target" position="beginning"> %CPPSELF.remove(_i, 1); @@ -2805,17 +2809,6 @@ return !result ? -1 : 0; </inject-code> </add-function> - <add-function signature="__getslice__"> - <inject-code class="target" position="beginning"> - Py_ssize_t max = %CPPSELF.count(); - _i1 = qBound(Py_ssize_t(0), _i1, max); - _i2 = qBound(Py_ssize_t(0), _i2, max); - QByteArray ba; - if (_i1 < _i2) - ba = %CPPSELF.mid(_i1, _i2 - _i1); - return %CONVERTTOPYTHON[QByteArray](ba); - </inject-code> - </add-function> </value-type> <value-type name="QTextBoundaryFinder"> <enum-type name="BoundaryReason" flags="BoundaryReasons"/> diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_mac.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_mac.xml index be4832c01..583c1c08e 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_mac.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_mac.xml @@ -5,7 +5,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_win.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_win.xml index c9c9f73c5..410187281 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_win.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_win.xml @@ -5,7 +5,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_x11.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_x11.xml index 801c52b0f..d5b0bae3b 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_x11.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_x11.xml @@ -5,7 +5,7 @@ ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of PySide2. +** This file is part of Qt for Python. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage |