/ qvariantlessthan.cpp
qvariantlessthan.cpp
1 #include "qvariantlessthan.h" 2 3 namespace qqsfpm { 4 5 /*! 6 \brief Less-than operator for generic QVariants 7 8 For the pre Qt 6 versions the < operator is used, even though it's deprecated 9 since 5.15, to avoid using complicated, potentially error-prone custom 10 implementations and to keep consistency between 5.15 and earlier versions. 11 Since Qt 6 QVariant::compare is used. 12 */ 13 bool lessThan(const QVariant &lhs, const QVariant &rhs) 14 { 15 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 16 return QPartialOrdering::Less == QVariant::compare(lhs, rhs); 17 #else 18 return lhs < rhs; 19 #endif 20 } 21 22 } // namespace qqsfpm