summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qvariant_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-06-08 12:55:43 +0200
committerLars Knoll <lars.knoll@qt.io>2020-08-13 08:48:03 +0200
commit50c96c17b6c87d48418336dc124a6de3f1f1958b (patch)
tree962402f22076847ba61a1877a269bac8460beb3b /src/corelib/kernel/qvariant_p.h
parent2002158a13517411ba797788331e8865cca514e5 (diff)
Use the new support for comparisons in QMetaType for QVariant
Remove the compare method in the QVariant::Handler struct. Rely on the generic support provided by QMetaType instead. [ChangeLog][Important Behavior Changes][QVariant] QVariant will now use builtin support in QMetaType to compare its content. This implies a behavioral change for some graphical types like QPixmap, QImage and QIcon that will never compare equal in Qt 6 (as they do not have a comparison operator). Change-Id: I30a6e7116c89124d11ed9052537cecc23f78116e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/kernel/qvariant_p.h')
-rw-r--r--src/corelib/kernel/qvariant_p.h43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 8739cb5173..2cec8ff65b 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -212,49 +212,6 @@ public:
}
};
-template<class Filter>
-class QVariantComparator {
- template<typename T, bool IsAcceptedType = Filter::template Acceptor<T>::IsAccepted>
- struct FilteredComparator {
- static bool compare(const QVariant::Private *a, const QVariant::Private *b)
- {
- return *v_cast<T>(a) == *v_cast<T>(b);
- }
- };
- template<typename T>
- struct FilteredComparator<T, /* IsAcceptedType = */ false> {
- static bool compare(const QVariant::Private *, const QVariant::Private *)
- {
- // It is not possible to construct a QVariant containing not fully defined type
- Q_ASSERT(false);
- return false;
- }
- };
-public:
- QVariantComparator(const QVariant::Private *a, const QVariant::Private *b)
- : m_a(a), m_b(b)
- {
- Q_ASSERT(a->type() == b->type());
- }
-
- template<typename T>
- bool delegate(const T*)
- {
- return FilteredComparator<T>::compare(m_a, m_b);
- }
-
- bool delegate(const void*) { Q_ASSERT(false); return true; }
- bool delegate(const QMetaTypeSwitcher::UnknownType*)
- {
- return true; // for historical reason invalid variant == invalid variant
- }
- bool delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return false; }
-protected:
- const QVariant::Private *m_a;
- const QVariant::Private *m_b;
-};
-
-
Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler();
template<class Filter>