How to compare QVariant values in Qt 5.15?

Viewed 29

Qt 5.15 has QVariant compare operators deprecated:

#if QT_DEPRECATED_SINCE(5, 15)
    QT_DEPRECATED inline bool operator<(const QVariant &v) const
    { return compare(v) < 0; }
    QT_DEPRECATED inline bool operator<=(const QVariant &v) const
    { return compare(v) <= 0; }
    QT_DEPRECATED inline bool operator>(const QVariant &v) const
    { return compare(v) > 0; }
    QT_DEPRECATED inline bool operator>=(const QVariant &v) const
    { return compare(v) >= 0; }
#endif

There is the protected compare function, as seen used above:

int compare(const QVariant &other) const;

But, as said, it is protected.

How to compare QVariant values in Qt 5.15 when using QT_DEPRECATED_SINCE(5, 15), with the same (arguably broken) semantics that were used before?

0 Answers
Related