Commit aa3e9564 authored by KLOCZKO Thibaud's avatar KLOCZKO Thibaud
Browse files

Add boolean case for QMap

parent 2170cd10
......@@ -318,6 +318,9 @@ namespace Namespace {
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.");
}
......@@ -342,6 +345,9 @@ namespace Namespace {
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.");
}
......@@ -372,6 +378,9 @@ namespace Namespace {
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.");
}
......@@ -397,6 +406,9 @@ namespace Namespace {
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.");
}
......@@ -422,6 +434,9 @@ namespace Namespace {
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.");
}
......@@ -584,6 +599,9 @@ namespace Namespace {
v = PyFloat_AsDouble(val.value<double>());
} else if (type == QMetatype::QString) {
v = PyString_FromString(qPrintable(val.value<QString>()))
} else if (type == QMetatype::Bool) {
bool b = val.value<bool>();
v = b ? Py_True : Py_False;
}
PyDict_SET_ITEM($result, k, v);
}
......@@ -611,6 +629,9 @@ namespace Namespace {
v = PyFloat_AsDouble(val.value<double>());
} else if (type == QMetatype::QString) {
v = PyString_FromString(qPrintable(val.value<QString>()))
} else if (type == QMetatype::Bool) {
bool b = val.value<bool>();
v = b ? Py_True : Py_False;
}
PyDict_SET_ITEM(map, k, v);
}
......
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