Updated QtScript modue to works with python 2.x and 3.x
This commit is contained in:
parent
d9dd319232
commit
1f1fbfbfa8
1 changed files with 2 additions and 2 deletions
|
|
@ -62,7 +62,7 @@
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
if (%CPPSELF.isVariant() || %CPPSELF.isString()) {
|
if (%CPPSELF.isVariant() || %CPPSELF.isString()) {
|
||||||
QString format = QString().sprintf("%s(\"%s\")", ((PyObject*)%PYSELF)->ob_type->tp_name, qPrintable(%CPPSELF.toString()));
|
QString format = QString().sprintf("%s(\"%s\")", ((PyObject*)%PYSELF)->ob_type->tp_name, qPrintable(%CPPSELF.toString()));
|
||||||
%PYARG_0 = PyString_FromString(qPrintable(format));
|
%PYARG_0 = Shiboken::String::fromCString(qPrintable(format));
|
||||||
} else {
|
} else {
|
||||||
%PYARG_0 = PyObject_Str((PyObject*)%PYSELF);
|
%PYARG_0 = PyObject_Str((PyObject*)%PYSELF);
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
<add-function signature="__mgetitem__">
|
<add-function signature="__mgetitem__">
|
||||||
<inject-code>
|
<inject-code>
|
||||||
Shiboken::AutoDecRef key(PyObject_Str(_key));
|
Shiboken::AutoDecRef key(PyObject_Str(_key));
|
||||||
QVariant res = %CPPSELF.property(PyString_AS_STRING(key.object())).toVariant();
|
QVariant res = %CPPSELF.property(Shiboken::String::toCString(key.object())).toVariant();
|
||||||
if (res.isValid()) {
|
if (res.isValid()) {
|
||||||
return %CONVERTTOPYTHON[QVariant](res);
|
return %CONVERTTOPYTHON[QVariant](res);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue