From 17e3d0da85c7dc98ab5ff4b69b7a839ab16627ef Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Fri, 15 Jul 2011 17:47:45 -0300 Subject: Fix bug 924 - "Allow QScriptValue to be accessed via []" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer: Marcelo Lira Renato Araújo --- PySide/QtScript/typesystem_script.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'PySide') diff --git a/PySide/QtScript/typesystem_script.xml b/PySide/QtScript/typesystem_script.xml index 870aec089..8c7ac10b2 100644 --- a/PySide/QtScript/typesystem_script.xml +++ b/PySide/QtScript/typesystem_script.xml @@ -49,6 +49,19 @@ + + + Shiboken::AutoDecRef key(PyObject_Str(_key)); + QVariant res = %CPPSELF.property(PyString_AS_STRING(key.object())).toVariant(); + if (res.isValid()) { + return %CONVERTTOPYTHON[QVariant](res); + } else { + PyObject* errorType = PyInt_Check(_key) ? PyExc_IndexError : PyExc_KeyError; + PyErr_SetString(errorType, "Key not found."); + return 0; + } + + -- cgit v1.2.3