aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PySide/QtScript/typesystem_script.xml10
1 files changed, 10 insertions, 0 deletions
diff --git a/PySide/QtScript/typesystem_script.xml b/PySide/QtScript/typesystem_script.xml
index 8c7ac10b2..738c44bda 100644
--- a/PySide/QtScript/typesystem_script.xml
+++ b/PySide/QtScript/typesystem_script.xml
@@ -49,6 +49,16 @@
<enum-type name="PropertyFlag" flags="PropertyFlags"/>
<enum-type name="ResolveFlag" flags="ResolveFlags"/>
<enum-type name="SpecialValue"/>
+ <add-function signature="__repr__" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ if (%CPPSELF.isVariant() || %CPPSELF.isString()) {
+ QString format = QString().sprintf("%s(\"%s\")", ((PyObject*)%PYSELF)->ob_type->tp_name, qPrintable(%CPPSELF.toString()));
+ %PYARG_0 = PyString_FromString(qPrintable(format));
+ } else {
+ %PYARG_0 = PyObject_Str((PyObject*)%PYSELF);
+ }
+ </inject-code>
+ </add-function>
<add-function signature="__mgetitem__">
<inject-code>
Shiboken::AutoDecRef key(PyObject_Str(_key));