[Development] QVariant comparison in Qt6
Lars Knoll
lars.knoll at qt.io
Mon Sep 21 10:17:58 CEST 2020
> On 18 Sep 2020, at 17:11, Thiago Macieira <thiago.macieira at intel.com> wrote:
>
> On Friday, 18 September 2020 06:48:50 PDT Lars Knoll wrote:
>> std::optional<int> QVariant::compare(const QVariant &other);
>>
>> Would that be good enough?
>
> Why the optional?
Because there is no valid comparison we could do between a QDate and a QPoint. And because a QPolygon doesn’t provide any ordering even when comparing two of them.
Cheers,
Lars
>
> We should use one of the types from <compare>[1]. Yes, it's C++20; we can make
> our internal API return an integer that is convertible to those types in the
> front-end API, under #if __has_include(<compare>).
>
> [1] https://en.cppreference.com/w/cpp/header/compare
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel DPG Cloud Engineering
>
>
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development
More information about the Development
mailing list