[Development] QVariant comparison in Qt6 (URGENT)

Lars Knoll lars.knoll at qt.io
Mon Nov 23 11:29:40 CET 2020


> On 23 Nov 2020, at 09:57, Giuseppe D'Angelo via Development <development at qt-project.org> wrote:
> 
> Hi,
> 
> On 22/09/2020 16:17, Thiago Macieira wrote:
>> And especially if there's no impact to how the user uses the API.
>>> 1)
>>> std::optional<int> compare();
>>> 
>>> 2)
>>> enum class Ordering { Less = -1, Equal = 0, Greater = 1, Unordered = 0xff
>>> };
>>>  Ordering compare();
>>> 
>>> 3)
>>> Implement a Qt replacement for std::partial_ordering (could use the std
>>> stuff if C++ 20 is available) and use that.
>> I'd rather stay simple and allow extending for <compare> where more details
>> are necessary.
>> For that, I think #1.
> 
> I'm reopening this old thread (which I somehow missed) because eventually #1 was implemented. But optional<int> is the wrong API for a comparison result.
> 
> I've quickly implemented 3) and pushed it here. It's only missing docs.
> 
> https://codereview.qt-project.org/c/qt/qtbase/+/322900
> 
> (includes the rationale of why optional is the wrong datatype)
> 
I like this approach.
> 
> Still in time to target 6.0.0?

I guess it’s now or never ;-)

Have you checked that it doesn’t cause issues in other modules? The API is new, so I doubt it’s used widely. 

Cheers,
Lars



More information about the Development mailing list