Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-23 Thread Robert Buchinger
On Donnerstag, 23. Februar 2017 09:03:03 CET Thiago Macieira wrote: > On quarta-feira, 22 de fevereiro de 2017 23:58:29 PST Thiago Macieira wrote: > > int x = abs(getValue1()), > > > > y = abs(getValue2()); > > > > if (x * y < x) > > > >

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-23 Thread Thiago Macieira
On quarta-feira, 22 de fevereiro de 2017 23:58:29 PST Thiago Macieira wrote: > int x = abs(getValue1()), > y = abs(getValue2()); > if (x * y < x) > throw overflowError(); > > According to the standard, the exception above can never be thrown. No, sorry,

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-23 Thread Thiago Macieira
On quarta-feira, 22 de fevereiro de 2017 15:37:16 PST Ch'Gans wrote: > OK, I take it as "Undefined Behaviour", since you mentioned this above. > As my code works, i'll keep it for now (not mission-critical) That's what everyone who was affected by the compiler optimising away UB said, then they w

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-23 Thread Thiago Macieira
On quarta-feira, 22 de fevereiro de 2017 15:26:09 PST Ch'Gans wrote: > On 23 February 2017 at 05:42, Thiago Macieira wrote: > > On quarta-feira, 22 de fevereiro de 2017 02:40:37 PST Ch'Gans wrote: > [...] > > >> Tanks for all your inputs, but I'm still puzzled, I can't believe this > >> is not a

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-22 Thread Henry Skoglund
Den 2017-02-23 kl. 00:26, skrev Ch'Gans: On 23 February 2017 at 05:42, Thiago Macieira wrote: On quarta-feira, 22 de fevereiro de 2017 02:40:37 PST Ch'Gans wrote: [...] Tanks for all your inputs, but I'm still puzzled, I can't believe this is not achievable in a generic way... It is achieva

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-22 Thread Ch'Gans
On 23 February 2017 at 05:42, Thiago Macieira wrote: > On quarta-feira, 22 de fevereiro de 2017 02:40:37 PST Ch'Gans wrote: >> > If you're going to call the QVariant constructor with a pointer, you MUST >> > pass a pointer to the correct, concrete object. Forget that it was a >> > template: just >

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-22 Thread Ch'Gans
On 23 February 2017 at 05:42, Thiago Macieira wrote: > On quarta-feira, 22 de fevereiro de 2017 02:40:37 PST Ch'Gans wrote: [...] >> Tanks for all your inputs, but I'm still puzzled, I can't believe this >> is not achievable in a generic way... > > It is achievable. I'm saying that the Qt metatype

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-22 Thread Thiago Macieira
On quarta-feira, 22 de fevereiro de 2017 08:42:13 PST Thiago Macieira wrote: > The point of the metatype system is to like std::any. It is a simple way of > registering functions to register in a central database a set of functions > to manipulate types. That's what you get for answering emails be

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-22 Thread Thiago Macieira
On quarta-feira, 22 de fevereiro de 2017 02:40:37 PST Ch'Gans wrote: > > If you're going to call the QVariant constructor with a pointer, you MUST > > pass a pointer to the correct, concrete object. Forget that it was a > > template: just > Well that's my problem, i cannot instanciate and assign th

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-22 Thread Ch'Gans
On 22 February 2017 at 20:58, Thiago Macieira wrote: > On terça-feira, 21 de fevereiro de 2017 18:20:50 PST Ch'Gans wrote: >> Hi there, >> >> I can create a valid QVariant that contains a MyObject pointer with >> just the class name (ie, QString("MyObject")) and no access to the >> class declarati

Re: [Interest] Creating a QVariant of QList knowing only the class name

2017-02-21 Thread Thiago Macieira
On terça-feira, 21 de fevereiro de 2017 18:20:50 PST Ch'Gans wrote: > Hi there, > > I can create a valid QVariant that contains a MyObject pointer with > just the class name (ie, QString("MyObject")) and no access to the > class declaration. MyObject is derived from QObject. > > This QVariant has

[Interest] Creating a QVariant of QList knowing only the class name

2017-02-21 Thread Ch'Gans
Hi there, I can create a valid QVariant that contains a MyObject pointer with just the class name (ie, QString("MyObject")) and no access to the class declaration. MyObject is derived from QObject. This QVariant has the following properties: - type() == QVariant::UserType - userType() == QMetaTyp