[Interest] Fwd: Qt 4.8, MetaType

Alexander Syvak alexander.svk at gmail.com
Fri Jul 26 20:20:57 CEST 2013


About the last statement. If an object uses internally slots and signals,
it should inherit QObject.
QObject is not copyconstructible, thus, the descendant as well.
If the object requires queued signals or QObject::property() API then
qRegisterMetaType() should be called, which
requires CopyConstructible property of the object. It's a cycle here.
Where is a misunderstanding?


2013/7/26 Thiago Macieira <thiago.macieira at intel.com>

> 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
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130726/00c8ebf7/attachment.html>


More information about the Interest mailing list