[Interest] QVariant compare operator

André Pönitz apoenitz at t-online.de
Sun Apr 19 14:39:40 CEST 2020


On Sun, Apr 19, 2020 at 02:21:39PM +0200, Allan Sandfeld Jensen wrote:
> > I don't think we need "incomparable" here.
> > 
> > QVariant(TypeA) and QVariant(TypeB) can be ordered for different TypeA and
> > TypeB based e.g. on alphabetical order of their .typeName().
> > 
> > If wanted, this can be refined to make e.g. all integral types comparable.
> > 
> What about non-integral types? 

They are compared by typeName(). So any QChar would be less-than any
QRegularExpression. 

> QVariants can't really be anything but weakly ordered as I see it,
> as some of the things it contains are either non- comparable or
> weakly ordered themselves.

On the inner level the situation is up to the actual type, that's no
different than today, and would also not be affected by disallowing
comparisons between different types. 

Andre'


More information about the Interest mailing list