[Interest] QMetaType create
Jérôme Godbout
jerome at bodycad.com
Thu Oct 6 17:14:41 CEST 2016
For the other peoples that may look for this into the future:
2 options:
- Constructor need to be Q_INVOKABLE (a little bit of a bummer if you
have a library that use Qt and your not resposible for it, in my case I
think I will go with this)
- Specialize the template<>qMetaTypeConstructHelper<MyClass>(const
MyClass* t)
The later should be used when the first cannot be done, since your creation
will now depend on knowing each of those class now and include all of them
to compile (killing the point of it in the first place).
On Thu, Oct 6, 2016 at 9:24 AM, Jérôme Godbout <jerome at bodycad.com> wrote:
> Yeah you're right, the ctor executed during the call is indeed a pointer
> type (8 bytes, 64 bits platform).
>
> Thanks for the pointer, punt intended ;-)
>
> Jerome
>
> On Wed, Oct 5, 2016 at 11:42 PM, Konstantin Shegunov <kshegunov at gmail.com>
> wrote:
>
>> On Wed, Oct 5, 2016 at 11:42 PM, Jérôme Godbout <jerome at bodycad.com> w
>> rote:
>>
>>> Hi,
>>> I was looking for a way to create object dynamicaly out of a classname.
>>> I have the classname which I can convert properly to QMetaType.
>>>
>>
>> Hi,
>> My best guess is you're creating a pointer to the object, not the object
>> itself. Have you followed this thread[1] from this same mailing list? If
>> not, my advice is to have a look at it, it's full of good info on how the
>> meta-type system works.
>>
>> Kind regards.
>>
>> [1]: http://lists.qt-project.org/pipermail/interest/2016-Mar
>> ch/021131.html
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161006/bd111a7d/attachment.html>
More information about the Interest
mailing list