[Interest] metaObject from class name

Stephen Kelly stephen.kelly at kdab.com
Fri Feb 14 16:47:30 CET 2014


On Friday, February 14, 2014 09:21:20 Keith Gardner wrote:
> class Foo : public QObject
> {
>     ...
> };

> Q_DECLARE_METATYPE(Foo*)

This is not needed.

> 
> const char *string = "Foo";
> const QMetaObject* metaObject =
> QMetaType::metaObjectForType(QMetaType::type(string));
> 
> I haven't tried compiling this but I believe this is how it will work based
> off of the docs for QMetaType.

QMetaType::metaObjectForType is not documented.

Thanks,

-- 
Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140214/1c7e877b/attachment.sig>


More information about the Interest mailing list