From 4d943225eb7b8de22e33771b9389c919d59a4bd3 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 18 Sep 2020 15:45:36 +0200 Subject: Add a QVariant::compare() method Add a method that allows comparing two variants. The method returns a std::optional, as comparing two variants of different type is not meaningful, or the types could not be comparable. Change-Id: If4ae838d671e051dda1b474f25a2f9dcf85dc265 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qvariant.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/kernel/qvariant.h') diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 83cb40a7c7..c28f841356 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -492,6 +492,8 @@ class Q_CORE_EXPORT QVariant inline bool operator!=(const QVariant &v) const { return !equals(v); } + static std::optional compare(const QVariant &lhs, const QVariant &rhs); + protected: friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &); #ifndef QT_NO_DEBUG_STREAM -- cgit v1.2.3