Function: qgsVariantCompare¶
- qgis.core.qgsVariantCompare(lhs: Any, rhs: Any, strictTypeCheck: bool = False) int ¶
Compares two QVariant values.
- Return type:
int
- Returns:
< 0 if lhs < rhs, > 0 if lhs > rhs, or 0 if lhs == rhs
Useful for sorting lists of variants, correctly handling sorting of the various QVariant data types (such as strings, numeric values, dates and times)
Invalid < NULL < Values
Since QGIS 4.0 the
strictTypeCheck
argument can be used to specify that variants of different types should be compared using their userType ID only, and not attempt to check the actual variant value.See also
See also
Added in version 3.44.
- Parameters:
lhs (Any)
rhs (Any)
strictTypeCheck (bool = False)