Re: [Interest] QVariant compare operator

2020-04-21 Thread Matthew Woehlke
On 20/04/2020 12.21, André Pönitz wrote: On Mon, Apr 20, 2020 at 10:04:38AM -0400, Matthew Woehlke wrote: On 19/04/2020 08.23, André Pönitz wrote: QVariant(TypeA) and QVariant(TypeB) can be ordered for different TypeA and TypeB based e.g. on alphabetical order of their .typeName(). If wanted,

Re: [Interest] QVariant compare operator

2020-04-20 Thread Florian Bruhin
On Mon, Apr 20, 2020 at 09:50:06AM -0600, Thiago Macieira wrote: > On Monday, 20 April 2020 03:28:48 MDT Florian Bruhin wrote: > > FWIW that's the choice Python had taken with Python 2 (ordering different > > types by their type name). It was widely regarded as a bad decision and > > replaced by a

Re: [Interest] QVariant compare operator

2020-04-20 Thread André Pönitz
On Mon, Apr 20, 2020 at 10:04:38AM -0400, Matthew Woehlke wrote: > On 19/04/2020 08.23, André Pönitz wrote: > > QVariant(TypeA) and QVariant(TypeB) can be ordered for different TypeA and > > TypeB based e.g. on alphabetical order of their .typeName(). > > > > If wanted, this can be refined to

Re: [Interest] QVariant compare operator

2020-04-20 Thread Thiago Macieira
On Monday, 20 April 2020 08:04:38 MDT Matthew Woehlke wrote: > On 19/04/2020 08.23, André Pönitz wrote: > > QVariant(TypeA) and QVariant(TypeB) can be ordered for different TypeA and > > TypeB based e.g. on alphabetical order of their .typeName(). > > > > If wanted, this can be refined to make

Re: [Interest] QVariant compare operator

2020-04-20 Thread Thiago Macieira
On Monday, 20 April 2020 03:28:48 MDT Florian Bruhin wrote: > FWIW that's the choice Python had taken with Python 2 (ordering different > types by their type name). It was widely regarded as a bad decision and > replaced by a TypeError exception in Python 3. Interesting. Do you have more

Re: [Interest] QVariant compare operator

2020-04-20 Thread Matthew Woehlke
On 19/04/2020 08.23, André Pönitz wrote: QVariant(TypeA) and QVariant(TypeB) can be ordered for different TypeA and TypeB based e.g. on alphabetical order of their .typeName(). If wanted, this can be refined to make e.g. all integral types comparable. No: int{5} <=> JsonObject{...} =>

Re: [Interest] QVariant compare operator

2020-04-20 Thread Bernhard Lindner
Hi! > In other cases this such silent breakage is called "bug fix" > and has a positive connotation. YMMD :-) For this reason, Qt does not have a formal requirements engineering sub-process. Without requirements, everything is debatable and you can pretty much do what you want. Including

Re: [Interest] QVariant compare operator

2020-04-20 Thread André Pönitz
On Mon, Apr 20, 2020 at 11:40:24AM +0200, Giuseppe D'Angelo via Interest wrote: > Before bikeshedding on the actual semantics we _want_ to have: if they > don't 100% match the ones we have right now, then it's a silent breakage > for end-users, which is a very bad idea. In other cases this such

Re: [Interest] QVariant compare operator

2020-04-20 Thread Bernhard Lindner
> So, if we ever want to have the relational operators in QVariant with > "better" semantics, we need an upgrade path that clearly signals the > breakage. Any proposals for that? qFatal() would be a clear signal. It depends from the actual solution if all changes result in qFatal. -- Best

Re: [Interest] QVariant compare operator

2020-04-20 Thread Giuseppe D'Angelo via Interest
(Sorry, this was meant to go to the list!) On 4/19/20 2:21 PM, Allan Sandfeld Jensen wrote: I don't think we need "incomparable" here. QVariant(TypeA) and QVariant(TypeB) can be ordered for different TypeA and TypeB based e.g. on alphabetical order of their .typeName(). If wanted, this can be

Re: [Interest] QVariant compare operator

2020-04-20 Thread Florian Bruhin
On Sun, Apr 19, 2020 at 12:42:16PM -0300, Thiago Macieira wrote: > On Sunday, 19 April 2020 09:39:40 -03 André Pönitz wrote: > > > What about non-integral types? > > > > They are compared by typeName(). So any QChar would be less-than any > > QRegularExpression. > > We can order by type, but I

Re: [Interest] QVariant compare operator

2020-04-20 Thread Yves Maurischat
Hi Yuri, I assume you're implementing a QSortFilterProxyModel for sorting and filtering: you can reimplement QSortFilterProxyModel::lessThan() . Basically you'll do the following (in pseudo code): bool

Re: [Interest] QVariant compare operator

2020-04-19 Thread Thiago Macieira
On Sunday, 19 April 2020 00:59:25 -03 Nyall Dawson wrote: > Just to clarify -- are you saying it's been deprecated IN qt 6, or > removed in qt 6? Deprecated in 5.15. It's not been removed in Qt 6 yet but it might be. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect -

Re: [Interest] QVariant compare operator

2020-04-19 Thread Thiago Macieira
On Sunday, 19 April 2020 08:05:05 -03 André Pönitz wrote: > > We can't do that right now because we can't rely on C++20. In fact, no > > current compiler supports the spaceship operator. So that has to be Qt 7. > > How comes the spaceship operator comes into play here? > > It's syntactical sugar

Re: [Interest] QVariant compare operator

2020-04-19 Thread Thiago Macieira
On Sunday, 19 April 2020 09:39:40 -03 André Pönitz wrote: > > What about non-integral types? > > They are compared by typeName(). So any QChar would be less-than any > QRegularExpression. We can order by type, but I don't think we should. But that's a choice. As Allan said, QVariant to QVariant

Re: [Interest] QVariant compare operator

2020-04-19 Thread Allan Sandfeld Jensen
On Sonntag, 19. April 2020 14:39:40 CEST André Pönitz wrote: > On Sun, Apr 19, 2020 at 02:21:39PM +0200, Allan Sandfeld Jensen wrote: > > > I don't think we need "incomparable" here. > > > > > > QVariant(TypeA) and QVariant(TypeB) can be ordered for different TypeA > > > and > > > TypeB based

Re: [Interest] QVariant compare operator

2020-04-19 Thread André Pönitz
On Sun, Apr 19, 2020 at 02:21:39PM +0200, Allan Sandfeld Jensen wrote: > > I don't think we need "incomparable" here. > > > > QVariant(TypeA) and QVariant(TypeB) can be ordered for different TypeA and > > TypeB based e.g. on alphabetical order of their .typeName(). > > > > If wanted, this can be

Re: [Interest] QVariant compare operator

2020-04-19 Thread Allan Sandfeld Jensen
On Sonntag, 19. April 2020 14:23:56 CEST André Pönitz wrote: > On Sun, Apr 19, 2020 at 01:28:32PM +0200, Allan Sandfeld Jensen wrote: > > On Sonntag, 19. April 2020 13:05:05 CEST André Pönitz wrote: > > > On Sat, Apr 18, 2020 at 09:44:40PM -0300, Thiago Macieira wrote: > > > > On Saturday, 18

Re: [Interest] QVariant compare operator

2020-04-19 Thread André Pönitz
On Sun, Apr 19, 2020 at 01:28:32PM +0200, Allan Sandfeld Jensen wrote: > On Sonntag, 19. April 2020 13:05:05 CEST André Pönitz wrote: > > On Sat, Apr 18, 2020 at 09:44:40PM -0300, Thiago Macieira wrote: > > > On Saturday, 18 April 2020 12:57:55 -03 Giuseppe D'Angelo via Interest > wrote: > > > >

Re: [Interest] QVariant compare operator

2020-04-19 Thread Allan Sandfeld Jensen
On Sonntag, 19. April 2020 13:05:05 CEST André Pönitz wrote: > On Sat, Apr 18, 2020 at 09:44:40PM -0300, Thiago Macieira wrote: > > On Saturday, 18 April 2020 12:57:55 -03 Giuseppe D'Angelo via Interest wrote: > > > I guess that's the reason for dropping the comparisons in 6.0 and, > > >

Re: [Interest] QVariant compare operator

2020-04-19 Thread André Pönitz
On Sat, Apr 18, 2020 at 09:44:40PM -0300, Thiago Macieira wrote: > On Saturday, 18 April 2020 12:57:55 -03 Giuseppe D'Angelo via Interest wrote: > > 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 > >

Re: [Interest] QVariant compare operator

2020-04-18 Thread Nyall Dawson
On Sun, 19 Apr 2020 at 10:48, Thiago Macieira wrote: > > On Saturday, 18 April 2020 12:57:55 -03 Giuseppe D'Angelo via Interest wrote: > > 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

Re: [Interest] QVariant compare operator

2020-04-18 Thread Thiago Macieira
On Saturday, 18 April 2020 12:57:55 -03 Giuseppe D'Angelo via Interest wrote: > 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.

Re: [Interest] QVariant compare operator

2020-04-18 Thread evilruff
With all respect to Thiago opinion I coldnt agree with it. There is nothing wrong at all with forwarding comparison of the values with the same data types to original classes within universal coontainer like QVariant as mentioned in the previous answer. However I agree that comparing

Re: [Interest] QVariant compare operator

2020-04-18 Thread Bernhard Lindner
Hi! > 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. Well, if the chance to create documention

Re: [Interest] QVariant compare operator

2020-04-18 Thread Bernhard Lindner
Hi! > The problem are not missing conversions, but too many conversions. If it is not possible to document and fix conversions to behave consistently (which should be possible), it still is reasonable to allow >/< comparisons for equal types only. That is easy to implement, simple to document,

Re: [Interest] QVariant compare operator

2020-04-18 Thread André Pönitz
On Sat, Apr 18, 2020 at 04:53:04PM +0200, Bernhard Lindner wrote: > Hi! > > > > > Relational comparisons with QVariant are deprecated in 5.15 and will be > > > > removed because they are a misfeaure. > > > > Redesign your code so your question does not need to be asked. > > > > > > Could you

Re: [Interest] QVariant compare operator

2020-04-18 Thread Giuseppe D'Angelo via Interest
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

Re: [Interest] QVariant compare operator

2020-04-18 Thread Bernhard Lindner
Hi! > > > Relational comparisons with QVariant are deprecated in 5.15 and will be > > > removed because they are a misfeaure. > > > Redesign your code so your question does not need to be asked. > > > > Could you please explain why comparing two QVariants is a misfeature? > > Not comparing for

Re: [Interest] QVariant compare operator

2020-04-18 Thread Jason H
nterest@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?  

Re: [Interest] QVariant compare operator

2020-04-18 Thread Thiago Macieira
On Saturday, 18 April 2020 07:28:59 -03 Bernhard Lindner wrote: > Hi! > > > Relational comparisons with QVariant are deprecated in 5.15 and will be > > removed because they are a misfeaure. > > Redesign your code so your question does not need to be asked. > > Could you please explain why

Re: [Interest] QVariant compare operator

2020-04-18 Thread Bernhard Lindner
Hi! > Relational comparisons with QVariant are deprecated in 5.15 and will be > removed because they are a misfeaure. > Redesign your code so your question does not need to be asked. Could you please explain why comparing two QVariants is a misfeature? -- Best Regards, Bernhard Lindner

Re: [Interest] QVariant compare operator

2020-04-18 Thread evilruff
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

Re: [Interest] QVariant compare operator

2020-04-17 Thread Thiago Macieira
On Friday, 17 April 2020 19:15:56 -03 evilruff wrote: > Hi,Recently I was debugging one of my project and ended up with something > which really surprise me.Are there any special reasons why QVariant compare Relational comparisons with QVariant are deprecated in 5.15 and will be removed because

[Interest] QVariant compare operator

2020-04-17 Thread evilruff
Hi,Recently I was debugging one of my project and ended up with something which really surprise me.Are there any special reasons why QVariant compare < not fully cover appropriate operators from other Qt classes.For example QByteArray has own operator < but within QVariant switch QByteArray