toUInt() [Variant class]

Returns the value of the variant to unsigned (unsigned int, 32-bit unsigned), converting the type if necessary. The original value is left unchanged.

Source Result
bool false → 0, true → 1
numeric unchanged
String string number → 32-bit unsigned integer
other conversion fails

There are two overloads, one that takes an ok parameter passed by reference, which is filled in as true if the data is already this type or can be converted.

unsigned toUInt() const;
unsigned toUInt(bool& ok) const;

See value, as, and to for when to use the toXXX() vs. other accessors.