[Development] QVariant comparison in Qt6

Allan Sandfeld Jensen kde at carewolf.com
Fri Sep 18 10:19:56 CEST 2020

On Freitag, 18. September 2020 02:54:53 CEST Thiago Macieira wrote:
> On Thursday, 17 September 2020 16:15:47 PDT Bernhard Lindner wrote:
> > Hi!
> > 
> > There was a discussion about the decision to deprecate (remove?) QVariant
> > comparison (<,>) in Qt6 completely.
> > 
> > Has anything changed for Qt6 (especially regarding comparison of equal
> > and/or convertible types)? Is the complete deprecation still the latest
> > decision?
> Yes, it's changed; no, it's not deprecation.
> What's been removed is the conversion. Aside from the numeric types,
> comparing two variants of different types will always result in false. If
> you want to compare across types, convert one to the other's type or to a
> common third type. You know what data you put in there and you should know
> what conversions can be lossy or not.

I found comparing two variants of the same type also always returned false, 
perhaps because it wasn't a native qvariant type?

See https://codereview.qt-project.org/c/qt/qtwebengine/+/312364/7/tests/auto/


More information about the Development mailing list