[Development] QVariant comparison in Qt6
annulen at yandex.ru
Fri Sep 18 10:50:50 CEST 2020
18.09.2020, 11:40, "Lars Knoll" <lars.knoll at qt.io>:
>> On 18 Sep 2020, at 10:28, Albert Astals Cid <albert.astals.cid at kdab.com> wrote:
>> El divendres, 18 de setembre de 2020, a les 10:22:16 CEST, Lars Knoll va escriure:
>>> Sorting and equality are two different things. QVariant has never supported
>>> a lessThan operator.
>> Yes, it has
> You’re right. I thought it didn’t support that.
> What is it you need? Just some total ordering of variants? The method you mentioned in QAbstractItemModel also only does ordering for some types, otherwise falling back to strings.
In Qt4 times comparison operators for QVariant were missing and from my experience main limitation was that it wasn't possible to have QVariant as a key in QMap without defining one manually.
More information about the Development