QMetaType::metaObjectForType returns NULL



  • Hi;

    QMetaType::metaObjectForType(QMetaType::type("IChRSMSession*")) returns NULL.

    IChRSMSession is interface that defined in DLL/Library as above;

    class IChRSMSession
    {
    Q_GADGET
    ..
    };

    QT_BEGIN_NAMESPACE

    #define IChRSMSession_IID "com.motiontrue.plugins.IChRSMSession"

    Q_DECLARE_INTERFACE(IChRSMSession, IChRSMSession_IID)

    QT_END_NAMESPACE

    Q_DECLARE_METATYPE(IChRSMSession*)


  • Moderators



  • @jsulm Yes, I did. qRegisterMetaType<IChRSMSession*>();


  • Lifetime Qt Champion

    Hi,

    Because there are none. A Q_GADGET is not a QObject based class. You only have the staticMetaObject like describe in the macro documentation.


  • Qt Champions 2016

    As @SGaist said there's no such thing, but to pile on IChRSMSession* isn't even a gadget it's simply a pointer.



  • Thanks your returns. I wrote virtual function to get QMetaObject of the up class of interface class.


  • Lifetime Qt Champion

    How did you do that ?


Log in to reply