Commit 11061e04 authored by Pierre's avatar Pierre

Set bool conversion prior to int in order to recover boolean and not integers

parent 987fc24f
......@@ -559,15 +559,17 @@ namespace Namespace {
QVariant v;
while (PyDict_Next($input, &pos, &key, &value)) {
QString k = QString(PyString_AsString(key));
if(k == "exe")
{ qDebug() << PyString_Check(value) << PyBool_Check(value) << PyInt_Check(value); }
if (PyString_Check(value)) {
v = QVariant::fromValue(QString(PyString_AsString(value)));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else if (PyLong_Check(value)) {
v = QVariant::fromValue(PyInt_AsLong(value));
} else if (PyFloat_Check(value)) {
v = QVariant::fromValue(PyFloat_AsDouble(value));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else {
qDebug("Value type is not handled. Empty QVariant is set.");
}
......@@ -586,15 +588,17 @@ namespace Namespace {
QVariant v;
while (PyDict_Next($input, &pos, &key, &value)) {
QString k = QString(PyString_AsString(key));
if(k == "exe")
{ qDebug() << PyString_Check(value) << PyBool_Check(value) << PyInt_Check(value); }
if (PyString_Check(value)) {
v = QVariant::fromValue(QString(PyString_AsString(value)));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else if (PyLong_Check(value)) {
v = QVariant::fromValue(PyInt_AsLong(value));
} else if (PyFloat_Check(value)) {
v = QVariant::fromValue(PyFloat_AsDouble(value));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else {
qDebug("Value type is not handled. Empty QVariant is set.");
}
......@@ -619,15 +623,17 @@ namespace Namespace {
QVariant v;
while (PyDict_Next(dict, &pos, &key, &value)) {
QString k = QString(PyString_AsString(key));
if(k == "exe")
{ qDebug() << PyString_Check(value) << PyBool_Check(value) << PyInt_Check(value); }
if (PyString_Check(value)) {
v = QVariant::fromValue(QString(PyString_AsString(value)));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else if (PyInt_Check(value) || PyLong_Check(value)) {
v = QVariant::fromValue(PyInt_AsLong(value));
} else if (PyFloat_Check(value)) {
v = QVariant::fromValue(PyFloat_AsDouble(value));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else {
qDebug("Value type is not handled. Empty QVariant is set.");
}
......@@ -647,15 +653,17 @@ namespace Namespace {
QVariant v;
while (PyDict_Next(dict, &pos, &key, &value)) {
QString k = QString(PyString_AsString(key));
if(k == "exe")
{ qDebug() << PyString_Check(value) << PyBool_Check(value) << PyInt_Check(value); }
if (PyString_Check(value)) {
v = QVariant::fromValue(QString(PyString_AsString(value)));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else if (PyInt_Check(value) || PyLong_Check(value)) {
v = QVariant::fromValue(PyInt_AsLong(value));
} else if (PyFloat_Check(value)) {
v = QVariant::fromValue(PyFloat_AsDouble(value));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else {
qDebug("Value type is not handled. Empty QVariant is set.");
}
......@@ -675,15 +683,17 @@ namespace Namespace {
QVariant v;
while (PyDict_Next(dict, &pos, &key, &value)) {
QString k = QString(PyString_AsString(key));
if(k == "exe")
{ qDebug() << PyString_Check(value) << PyBool_Check(value) << PyInt_Check(value); }
if (PyString_Check(value)) {
v = QVariant::fromValue(QString(PyString_AsString(value)));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else if (PyInt_Check(value) || PyLong_Check(value)) {
v = QVariant::fromValue(PyInt_AsLong(value));
} else if (PyFloat_Check(value)) {
v = QVariant::fromValue(PyFloat_AsDouble(value));
} else if (PyBool_Check(value)) {
bool b = (value == Py_True);
v = QVariant::fromValue(b);
} else {
qDebug("Value type is not handled. Empty QVariant is set.");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment