diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2011-02-03 18:31:39 -0200 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:53:53 -0300 |
commit | 143e81278c6d2337e7ff64baaec00d14e3df5841 (patch) | |
tree | 4ebf96d16a9a0a208f29748b6fb28a8490485eaf /PySide | |
parent | c662028d3dbefcfb0abc2090ec6df3d4915bb1a6 (diff) |
Export QTranslator::translate and QTranslator::load.
Reviewer: Renato Araújo <renato.filho@openbossa.org>
Lauro Moura <lauro.neto@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 692cf9ad7..51019778c 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2014,8 +2014,26 @@ <enum-type name="State"/> </object-type> <object-type name="QTranslator"> - <modify-function signature="translate(const char*,const char*,const char*,int)const" remove="all" /> - <modify-function signature="load(const uchar*, int)" remove="all" /> + <modify-function signature="load(const uchar*, int)"> + <modify-argument index="1"> + <replace-type modified-type="PyObject" /> + </modify-argument> + <modify-argument index="2"> + <remove-argument /> + </modify-argument> + <inject-code> + PyTypeObject* pyType = %PYARG_1->ob_type; + if (pyType->tp_as_buffer + && pyType->tp_as_buffer->bf_getreadbuffer + && pyType->tp_as_buffer->bf_getsegcount(%PYARG_1, 0) == 1) { + void* ptr; + Py_ssize_t size = pyType->tp_as_buffer->bf_getreadbuffer(%PYARG_1, 0, &ptr); + %PYARG_0 = %CONVERTTOPYTHON[bool](%CPPSELF.%FUNCTION_NAME(const_cast<const uchar*>((uchar*)ptr), size)); + } else { + PyErr_SetString(PyExc_TypeError, "The object must support buffer protocol with just one segment."); + } + </inject-code> + </modify-function> </object-type> <object-type name="QWaitCondition"> <modify-function signature="wait(QMutex*, unsigned long)" allow-thread="yes"/> |