+ // Return the cached value if it is already set and the type is the same than the default value type
+ if (valueObject->value.isValid() && (!defaultValue.isValid() || valueObject->value.type() == defaultValue.type()))
+ return valueObject->value;
+
+ // Convert to the proper type
+ if (defaultValue.type() == QVariant::ByteArray || defaultValue.type() == QVariant::String) {
+ // Remove single and double quotes
+ QByteArray v = valueObject->paramValue;
+ if (v.startsWith('\"')) {
+ v.remove(0, 1);
+ if (v.endsWith('\"'))
+ v.remove(v.size() - 1, 1);
+ }
+ else if (v.startsWith('\'')) {
+ v.remove(0, 1);
+ if (v.endsWith('\''))
+ v.remove(v.size() - 1, 1);
+ }
+
+ // Convert from the escaped character array
+ if (defaultValue.type() == QVariant::String)
+ valueObject->value = QVariant(strFromEscapedCharArray(v));
+ else
+ valueObject->value = QVariant(binFromEscapedCharArray(v));
+ }
+ else
+ valueObject->value = toVariant(valueObject->paramValue, defaultValue);
+
+ return valueObject->value;