[Interest] QVariant compare operator

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Sat Apr 18 17:57:55 CEST 2020


Il 18/04/20 16:53, Bernhard Lindner ha scritto:
>> Not comparing for equality. Comparing for ordering.
>>
>> What comes first, QSize(1, 1) or QRegularExpression("^$") ?
> Well, if QVariant::canConvert() says right operand can be converted to type of left, then
> convert and compare the result. If it can't convert, behavior should be undefined and
> qFatal() should be called (or whatever Qt 5.15 prefers to do in detectable cases of
> undefined behavior).

The biggest problem right now is that the behaviour of QVariant 
comparisons is largely undocumented, that is, dictated by the 
implementation. Any change to the these behaviours, as sensible as it 
could be, will lead to silent breakages.

I guess that's the reason for dropping the comparisons in 6.0 and, 
eventually, reintroduce it in 7.0. With the hope that we've learned the 
lesson and proceed at _specifying_ the behaviour before implementing it.

My 2 c,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200418/5b35b7da/attachment.bin>


More information about the Interest mailing list