#include "util.h"
+#include <stdio.h>
//-------------------------------------------------------------------
break;
}
case QVariant::Bool: {
- bool ok;
- uint v = value.toUInt(&ok, 0);
if (eVaf::Common::isTrue(value))
return QVariant(true);
else if (eVaf::Common::isFalse(value))
return QVariant(false);
- else
- return QVariant(v);
+ else {
+ bool ok;
+ uint v = value.toUInt(&ok, 0);
+ if (ok)
+ return QVariant(v);
+ else
+ return defaultValue;
+ }
break;
}
case QVariant::Char: {
- if (value.size() > 0)
- return QVariant(value.at(0));
- else
- return defaultValue;
+ if (value.size() > 0) {
+ if (value.startsWith("\\0x")) {
+ bool ok;
+ char c = value.mid(1).toUInt(&ok, 16);
+ if (ok)
+ return QVariant(c);
+ }
+ else if (value.startsWith("\\0")) {
+ bool ok;
+ char c = value.mid(1).toUInt(&ok, 8);
+ if (ok)
+ return QVariant(c);
+ }
+ else
+ return QVariant(value.at(0));
+ }
+ return defaultValue;
break;
}
default: