Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-07 Thread Alan Alpert
On Wed, Mar 6, 2013 at 11:58 PM, Knoll Lars wrote: > > > On 3/6/13 8:23 PM, "Alan Alpert" <4163654...@gmail.com> wrote: > >>On Wed, Mar 6, 2013 at 3:11 AM, Laszlo Papp wrote: >>> On Wed, Mar 6, 2013 at 9:48 AM, Olivier Goffart >>>wrote: This is not a warning, this is an error in C++ >>

Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-06 Thread Knoll Lars
On 3/6/13 8:23 PM, "Alan Alpert" <4163654...@gmail.com> wrote: >On Wed, Mar 6, 2013 at 3:11 AM, Laszlo Papp wrote: >> On Wed, Mar 6, 2013 at 9:48 AM, Olivier Goffart >>wrote: >>> >>> This is not a warning, this is an error in C++ >>> >>> enum Foo { A , B }; >>> Foo bar = 1; // error: invalid

Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-06 Thread Laszlo Papp
On Wed, Mar 6, 2013 at 7:23 PM, Alan Alpert <4163654...@gmail.com> wrote: > The problem with a warning on the console is that these are emitted > every time the application runs. So if you've written your application > correctly and are happy with it, the user shouldn't be seeing the > console flo

Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-06 Thread Olivier Goffart
On Wednesday 06 March 2013 11:23:49 Alan Alpert wrote: [...] > We can't have explicit casts because the scripts are in JavaScript, > which is dynamically typed. Yes. Considering that, I guess implicit cast are ok. But don't pretend it is to match C++ :-) -- Olivier Woboq - Qt services and supp

Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-06 Thread Alan Alpert
On Wed, Mar 6, 2013 at 3:11 AM, Laszlo Papp wrote: > On Wed, Mar 6, 2013 at 9:48 AM, Olivier Goffart wrote: >> >> This is not a warning, this is an error in C++ >> >> enum Foo { A , B }; >> Foo bar = 1; // error: invalid conversion from ‘int’ to ‘Foo’ >> int blah = bar; // No warning. unless you

Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-06 Thread Laszlo Papp
On Wed, Mar 6, 2013 at 9:48 AM, Olivier Goffart wrote: > This is not a warning, this is an error in C++ > > enum Foo { A , B }; > Foo bar = 1; // error: invalid conversion from ‘int’ to ‘Foo’ > int blah = bar; // No warning. unless you use enum class then it is a > error. > At least, I can sec

Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-06 Thread Olivier Goffart
On Tuesday 05 March 2013 13:34:14 Alan Alpert wrote: > I'd like to make a slight change to enum property behavior in QML. > Currently you get a compile error if you assign an int to an enum > property, similar to the warning you'll get in C++ if you do the same. > However in C++ you can easily work

Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-05 Thread Laszlo Papp
On Wed, Mar 6, 2013 at 12:17 AM, Alan Alpert <4163654...@gmail.com> wrote: > >> -Matches expectations from C++ users a little better > > > > > > What do you mean by this? I personally prefer that the enum is getting > > strongly typed with C++11.On the conrary, I have always used int enums in > >

Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-05 Thread Aleix Pol
On Tue, Mar 5, 2013 at 10:53 PM, Laszlo Papp wrote: > On Tue, Mar 5, 2013 at 9:34 PM, Alan Alpert <4163654...@gmail.com> wrote: > >> -Matches expectations from C++ users a little better >> > > What do you mean by this? I personally prefer that the enum is getting > strongly typed with C++11. On t

Re: [Development] [QML] Assigning ints to enumeration properties

2013-03-05 Thread Laszlo Papp
On Tue, Mar 5, 2013 at 9:34 PM, Alan Alpert <4163654...@gmail.com> wrote: > -Matches expectations from C++ users a little better > What do you mean by this? I personally prefer that the enum is getting strongly typed with C++11. On the conrary, I have always used int enums in QML applications. L

[Development] [QML] Assigning ints to enumeration properties

2013-03-05 Thread Alan Alpert
I'd like to make a slight change to enum property behavior in QML. Currently you get a compile error if you assign an int to an enum property, similar to the warning you'll get in C++ if you do the same. However in C++ you can easily work around this by casting it to the enum, or just ignoring the