[Interest] Qt 4.8, MetaType

Thiago Macieira thiago.macieira at intel.com
Fri Jul 26 17:52:36 CEST 2013


On sexta-feira, 26 de julho de 2013 09:22:07, Alexander Syvak wrote:
> Why is it sufficient then to use Q_DECLARE_METATYPE for any template using
> the declared type?

Because those template functions you referred to will do the registration for 
you if necessary, before accessing the information that is stored with the 
registration (namely, the functions to create and destroy).

> qRegisterMetaType only puts the type to be registered into customTypes
> vector registering constructor and destructor for the type with an ID
> (optionally an user may register operator>> and operator<< for the type).
> Why is it needed to use queued signal and slot connections and
> QObject::property() API?

Because at that point there is no code that will do the registration for you. 
It needs to access the constructor and destructor and all it knows at that 
point is the name of the type (as found in the meta object).

This is fixed in Qt 5.0.

> Furthermore, Q_OBJECT is required for a type using slots/signals. QObject
> does not meet CopyConstructible requirement for using either
> Q_DECLARE_METATYPE or qRegisterMetaType.

Correct. That is not a question.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130726/fe11930f/attachment.sig>


More information about the Interest mailing list