Probably the best way to handle this is for the model to maintain a map of column affinity, specified as QMetaType::Type, to compare items. The items themselves should also have an individual type. A database application will only need column affinity, a spreadsheet app will need item affinity. Then the model (as part of the model classes ( filter, sort)) should implement the automatic comparisons.
Python's repr() function is ideal for this. Not sure how Qt could support this, but I really enjoy repr()
Sent: Saturday, April 18, 2020 at 5:43 AM
From: "evilruff" <evilr...@gmail.com>
To: interest@qt-project.org
Subject: Re: [Interest] QVariant compare operator
From: "evilruff" <evilr...@gmail.com>
To: interest@qt-project.org
Subject: Re: [Interest] QVariant compare operator
Hi Thiago,
I am happy ro redesign my code, but how then sorting/filtering models will work? As data() returns QVariant. Or you plan to use setSorting based on lambda's and std::function to provide strict types sorting?
And what if from API point of view user want just to specify column without aware of data types.
Am I missing something? Woukd really appreceate if you can point me to some direction to look at.
Regards,
Yuri
removed because they are a misfeaure. Redesign your code so your question does
not need to be asked.
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest