diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-04-25 10:10:37 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:13 -0300 |
commit | 047d42c704cf2bf8aabd61b7d405746506b7e37d (patch) | |
tree | a58adb8fcdaff05e40cec7a3cdae192b9d594752 | |
parent | c9a260df4b5d9b07e398c0dc1a3168371e71ccfb (diff) |
Implemented conversion from QMultiMap to Python dictonary.
Fixes bug #773.
Reviewer: Lauro Moura <lauro.neto@openbossa.org>
Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r-- | PySide/QtWebKit/typesystem_webkit.xml | 15 | ||||
-rw-r--r-- | PySide/typesystem_templates.xml | 13 |
2 files changed, 26 insertions, 2 deletions
diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index eb645c25f..5187cea9d 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -54,8 +54,19 @@ </modify-argument> </modify-function> <modify-function signature="print(QPrinter*)const" rename="print_" /> - <!-- See BUG 773 --> - <modify-function signature="metaData()const" remove="all" /> + <modify-function signature="metaData()const"> + <modify-argument index="return"> + <replace-type modified-type="PyObject" /> + </modify-argument> + <inject-code position="end"> + <insert-template name="convertFromMultiMap"> + <replace from="%MAP_NAME" to="%0"/> + <replace from="%RETURN_NAME" to="%PYARG_0"/> + <replace from="%KEY_TYPE" to="QString"/> + <replace from="%VALUE_TYPE" to="QString"/> + </insert-template> + </inject-code> + </modify-function> </object-type> <object-type name="QWebSettings"> diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 613a2b9ae..8d5390b53 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -346,6 +346,19 @@ <template name="ObjectDescription.fromIndex"> %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%RETURN_TYPE::fromIndex(%1)); </template> + <template name="convertFromMultiMap"> + %RETURN_NAME = PyDict_New(); + foreach(%KEY_TYPE _key, %MAP_NAME.keys()) { + Shiboken::AutoDecRef _pyValueList(PyList_New(0)); + foreach(%VALUE_TYPE _value, %MAP_NAME.values(_key)) { + Shiboken::AutoDecRef _pyValue(%CONVERTTOPYTHON[%VALUE_TYPE](_value)); + PyList_Append(_pyValueList, _pyValue); + } + + Shiboken::AutoDecRef _pyKey(%CONVERTTOPYTHON[%KEY_TYPE](_key)); + PyDict_SetItem(%RETURN_NAME, _pyKey, _pyValueList); + } + </template> </typesystem> |