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

Stefan Majewsky stefan.majewsky at googlemail.com
Wed Sep 28 10:15:34 CEST 2011


On Mon, Sep 26, 2011 at 4:50 PM, Schimkowitsch Robert
<Robert.Schimkowitsch at andritz.com> wrote:
> Which brings up the question: When does Q_DECLARE_METATYPE run, and how
> do I make it run?

Looking at the definition of Q_DECLARE_METATYPE, in
include/QtCore/qmetatype.h, you should be able to "make it run" by

    (void) QMetaType<MyType>::qt_metatype_id();

before the QMetaType::type() call. I don't know about the ABI
stability policy for this macro, but I think this should be
binary-compatible until at least Qt 5.

Greetings
Stefan



More information about the Qt-interest-old mailing list