[Interest] QVariant compare operator

Thiago Macieira thiago.macieira at intel.com
Sun Apr 19 17:42:16 CEST 2020


On Sunday, 19 April 2020 09:39:40 -03 André Pönitz wrote:
> > What about non-integral types?
> 
> They are compared by typeName(). So any QChar would be less-than any
> QRegularExpression.

We can order by type, but I don't think we should. But that's a choice.

As Allan said, QVariant to QVariant comparison needs to be weak, partial 
ordering already. Some types aren't orderable (QSize, QPoint, etc.) and some 
have non-comparable values (double, float).

> 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.

Some different types I think we should compare: all numeric ones. We already 
have the proper promotion rules implemented. But I don't think we should 
convert anything else, not even QPoint to QPointF.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products





More information about the Interest mailing list