Commit 8d4e31e8 authored by Pierre's avatar Pierre

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

Set bool conversion prior to int in order to recover boolean and not integers for QMap<long, QVariant> too
parent 11061e04
......@@ -419,13 +419,13 @@ namespace Namespace {
long k = PyInt_AS_LONG(key);
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.");
}
......@@ -446,13 +446,13 @@ namespace Namespace {
long k = PyInt_AS_LONG(key);
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.");
}
......@@ -479,13 +479,13 @@ namespace Namespace {
long k = PyInt_AS_LONG(key);
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.");
}
......@@ -507,13 +507,13 @@ namespace Namespace {
long k = PyInt_AS_LONG(key);
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.");
}
......@@ -535,13 +535,13 @@ namespace Namespace {
long k = PyInt_AS_LONG(key);
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.");
}
......@@ -559,8 +559,6 @@ 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)) {
......@@ -588,8 +586,6 @@ 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)) {
......@@ -623,8 +619,6 @@ 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)) {
......@@ -653,8 +647,6 @@ 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)) {
......@@ -683,8 +675,6 @@ 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)) {
......
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