Results 1 to 1 of 1

Thread: SOLVED: error using qobject_cast against instance of a plugin

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Posts
    121
    Thanks
    38
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default SOLVED: error using qobject_cast against instance of a plugin

    The problem was that Q_DECLARE_INTERFACE should be used in the same header where interface is declared.

    I have a plugin that I can successfully load, i.e. instance() returned by pluginloader is not null and I can see that the plugin class instantiates successfully under debugger. However, I can't compile the casting of returned QObject* to my interface.

    For this line:
    Qt Code:
    1. tit::testdata::ITestData* fd = qobject_cast< tit::testdata::ITestData*> (loader.instance());
    To copy to clipboard, switch view to plain text mode 

    compiler returns the error:

    error C2039: 'staticMetaObject' : is not a member of 'tit::testdata::ITestData'

    According to the doc example interface classes do not have any reference to Qt. (like FilterInterface in <QT>/doc/html/plugins-howto.html#the-lower-level-api-extending-qt-applications ).

    my interface declarations are:
    header:

    using namespace tit::testdata;
    Q_DECLARE_INTERFACE(ITestData, "tit.testdata/1.0")

    source:
    Q_EXPORT_PLUGIN2("myplugin", CTestData)

    CTestData implements ITestData

    What am I doing wrong?
    Last edited by QPlace; 12th November 2009 at 21:25.

Similar Threads

  1. Extending a plugin in a static library
    By ultim8 in forum Qt Programming
    Replies: 5
    Last Post: 25th March 2010, 15:10
  2. Trouble with plugin system's documentation
    By niklas in forum Qt Programming
    Replies: 8
    Last Post: 6th March 2009, 22:07
  3. Plugin implementation question
    By JPNaude in forum Qt Programming
    Replies: 12
    Last Post: 27th August 2008, 20:24
  4. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.