summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qvariant.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.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.h')
-rw-r--r--src/corelib/kernel/qvariant.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index e7b64c2aed..498ba57399 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -470,20 +470,18 @@ class Q_CORE_EXPORT QVariant
};
public:
typedef bool (*f_null)(const Private *);
- typedef bool (*f_compare)(const Private *, const Private *);
typedef bool (*f_convert)(const QVariant::Private *d, int t, void *, bool *);
typedef void (*f_debugStream)(QDebug, const QVariant &);
struct Handler {
f_null isNull;
- f_compare compare;
f_convert convert;
f_debugStream debugStream;
};
inline bool operator==(const QVariant &v) const
- { return cmp(v); }
+ { return equals(v); }
inline bool operator!=(const QVariant &v) const
- { return !cmp(v); }
+ { return !equals(v); }
protected:
friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
@@ -501,7 +499,7 @@ public:
#endif
Private d;
void create(int type, const void *copy);
- bool cmp(const QVariant &other) const;
+ bool equals(const QVariant &other) const;
bool convert(const int t, void *ptr) const; // ### Qt6: drop const
private:
@@ -584,7 +582,7 @@ private:
inline bool operator==(const QVariant &v1, const QVariantComparisonHelper &v2)
{
- return v1.cmp(*v2.v);
+ return v1.equals(*v2.v);
}
inline bool operator!=(const QVariant &v1, const QVariantComparisonHelper &v2)