[Qt-interest] QMetaType::type succeeds or fails seemingly randomly

Thiago Macieira thiago at kde.org
Mon Sep 26 16:59:58 CEST 2011


On Monday, 26 de September de 2011 16:25:26 Schimkowitsch Robert wrote:
> Whether QMetaType::type fails or succeeds is not related to my type
> string.
> It works after I have called the following line of code:
> int id = qMetaTypeId<CCmn_UIUpdateTimer*>();
>  
> If I put that line first, both calls to QMetaType::type succeed
> I would greatly appreciate if someone could explain why that is so, or
> if there are other ways to ensure QMetaType::type succeeds.

qMetaTypeId implicitly registers your type if you haven't registered it yet.

The Meta Type system doesn't know about your type until you register it 
(qRegisterMetaType).

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110926/e281f342/attachment.bin 


More information about the Qt-interest-old mailing list