On Wednesday, September 11, 2013 14:29:44 [email protected] wrote:
> Hello,
> 
> I'd like to use qMetaTypeId<>() in a constexpr expression. I have my own
> custom type declared as such:
> 
> class MyCustomClass : public QObject
> {
>      Q_OBJECT
> 
>      // ...
> };
> 
> Q_DECLARE_METATYPE(MyCustomClass*)

Unless you need to stay Qt 4 compatible, you can remove this line. Pointers to 
QObject derived types are automatically treated as metatypes if needed.

> 
> I then try the following:
> 
> constexpr qint32 metaTypeId = qMetaTypeId<MyCustomClass*>();

This only works for built-in metatypes which have an id value defined in the 
QMetaType::Type enum.

Thanks,

-- 
Join us in October at Qt Developer Days 2013 - https://devdays.kdab.com

Stephen Kelly <[email protected]> | 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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to