Class has no metaobject information?



  • Hi,

    I've created a singleton class(dll ), plain dll and another COM dll in QT(non GUI, all derving from QObject & Q_OBJECT also added). Now, When I'm accessing the singleton class/plain dll methods inside the COM dll, an error pops up "Class has no metaobject information?" . I don't understand the meaning of it. I'm using VS2010 and QT4.7.4.

    After searching for information regarding this error in qtfroum , i found some similar topic "here":http://developer.qt.nokia.com/forums/viewthread/10836 , But, cmdline i've not tried and expecting some solution might be there.

    Totally stuck here!!! :(. Need some direction.



  • From what you write, it's hard to say where the problem is.
    First of all, I asume you are on windows (COM :-) ).
    Which compiler tool chain do you use?
    How do your classes (especially the exported ones) look like?



  • Ok, I've tried from CMDLine its working. But like to know the root cause for it.
    Here is my class interface,

    @
    // COM dll (no UI component)
    #include <ActiveQt/QAxBindable>

    #include "classM.h"
    #include "classA_global.h"

    #include <qobject.h>
    #include <QMetaObject>

    struct key {

    int someVar;
    };

    // ,
    class CLASSA_EXPORT classA : public QObject, public QAxBindable , public scanner
    {
    Q_OBJECT
    public:
    classA( QObject p = 0);
    STDMETHOD(Init)(LPTNTDRVINFO pDrvInfo); // 3rd part "scanner" virtual function
    ULONG STDMETHODCALLTYPE AddRef( void);
    ULONG STDMETHODCALLTYPE Release( void);
    STDMETHOD(QueryInterface)(
    /
    [in] / REFIID riid,
    /
    [iid_is][out] */ __RPC__deref_out void __RPC_FAR *__RPC_FAR *ppvObject);

    public slots:
    QString getSaampleData();
    private:
    //bla bla bla...
    };

    QAXFACTORY_DEFAULT(classA,
    "{20C63A76-5FEF-49C8-8E83-26957590748B}",
    "{BE690126-A3413-47D1-A278-1E69FCD1B61E}",
    "{0DED1E03-D4F2-44C3-8B67-56F4D7D87661}",
    "{5263E150-F234-4AE0-9E38-CBE753E936C0}",
    "{96AB3485-1234-4B60-BB62-5C77C22EF154}")

    // singleton class interface. dll
    #include <QObject>
    #include<QVariant>
    #include <QList>
    #include <QMetaObject>
    #include "singleton_global.h"
    #include <qDebug.h>

    class SINGLETON_EXPORT singleton : public QObject
    {

    Q_OBJECT

    static bool instanceFlag;
    static singleton single;
    singleton();
    singleton(const singleton&);
    public:
    static singleton
    getInstance();
    ~singleton();
    QMap<QString, struct key*> getMapVar();

    private:
    QMap<QString, struct key*> MapVar;

    };

    // implementation of CLASSA(COM object).

    QString ClassA::getSaampleData(){

    QMap<QString, struct key*> tempMapVar;
    tempMapVar = singleton::getInstance()->getMapVar(); // gives error while building , class do not have metaobject...

    }

    // console application

    main() {

    ClassALib::IClassPtr obj;
    HRESULT hr = CoInitialize(NULL);
    if (FAILED(hr))
    {
    #if _DEBUG
    qDebug("CoInitialize Failed");
    #endif
    return -1;
    }

    obj.CreateInstance("{20C63A76-5FEF-49C8-8E83-26957590748B}");
    if(!obj) {
    return -1;
    }
    obj->getSaampleData();

    }
    @

    This is how my interface looks like,


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.