Support for the sequence protocol is achieved adding functions with special names, this is done using the add-function tag.
The special function names are:
PyObject* self, Py_ssize_t _i
PyObject* self, Py_ssize_t _i, PyObject* _value
PyObject* self, PyObject* _value
PyObject* self, PyObject* _other
You just need to inform the function name to the add-function tag, without any parameter or return type information, when you do it, Shiboken will create a C function with parameters and return type defined by the table above.
The function needs to follow the same semantics of the CPython equivalent function, the only way to do it is using the inject-code tag.
A concrete example how to add sequence protocol support to a class can be found
on shiboken tests, more precisely in the definition of the Str class in
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.