[Interest] Re: qRegisterMetaType<QList<QSslError> > and type flags

Jan Kundrát jkt at flaska.net
Sat Jan 5 12:39:16 CET 2013


On Saturday, 5 January 2013 03:12:48 CEST, Thiago Macieira wrote:
>> - qRegisterMetatype<NS::Class*>();
>> - using namespace NS; qRegisterMetaType<Class*>();
>> - namespace NS { void reg() { qRegisterMetaType<Class*>(); } } NS::reg();
>> - typedef NS::Class Class; qRegisterMetaType<Class*>();
>
> Why don't they work?

I need these for a QSignalSpy, the full type name is actually Imap::Mailbox::ImapTask*. The error message I get when using any of these is the following:

  Don't know how to handle 'ImapTask*', use qRegisterMetaType to register it.

The Imap::Mailbox::ImapTask class in question defines the signal with a non-namespaced argument, i.e. like this:

  signals:
    void completed(ImapTask *task);

It looks that one has to use the identical signature in the SIGNAL macro as what was used in the class' definition (otherwise one gets an error like QSignalSpy: No such signal: 'completed(Imap::Mailbox::ImapTask*)').

And it also seems that the best approach is to always use the fully-namespaced version everywhere, including the signal definition in the class' definition, the qRegisterMetaType and the SIGNAL macro.

Cheers,
Jan

-- 
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/



More information about the Interest mailing list