X-Git-Url: https://vaikene.ee/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Flibs%2FCommon%2Futil.h;h=4b5e4c9fd81ce62aa7778f8a233b11c5e157d116;hb=f01d61fb753b347bbff2ffb7f224650ac3f9d81e;hp=80fae6236eb60c3236de95675e9ebfe6b31888e9;hpb=0f2257a3a58aaa329d11c9fadd06314edb924af5;p=evaf diff --git a/src/libs/Common/util.h b/src/libs/Common/util.h index 80fae62..4b5e4c9 100644 --- a/src/libs/Common/util.h +++ b/src/libs/Common/util.h @@ -63,6 +63,15 @@ inline bool isFalse(QString const & str) * This function converts strings to variant values. The type of the expected value is determined * from the default value. If the string fails to convert to the expected type, returns the * default value. + * + * If the default value is of one of the following types, then the following conversion rules are applied: + * @li QVariant::UInt - if the string begins with "0x", base 16 is used; if the string begins with "0", + * base 8 is used; otherwise base 10 is used; + * @li QVariant::Int - base 10 is used; + * @li QVariant::Double - the decimal point is expecte to be '.' regardless which locale is used; + * @li QVariant::Bool - tries to use isTrue() and isFalse() methods; otherwise performs a conversion to QVariant::uint; + * @li QVariant::Char - if the string begins with "\0x", expects it to be an ASCII code in hex; if the + * string begins with "\0", expects it to be an ASCII code in oct; otherwise uses the first character in the string; */ COMMON_EXPORT QVariant toVariant(QString const & value, QVariant const & defaultValue);