QTPlugin Constructor arguments



  • Hi all, maybe its just been a long day but i can't seem to spot my fault here .

    I'm trying to create a plugin where the constructor interface has some required arguments.

    for example take this

    Interface:
    @
    QT_BEGIN_NAMESPACE
    class QObject;
    QT_END_NAMESPACE

    namespace INTERFACE
    {
         class testInterfacePlugin: public QObject
         {
         public:
    
             testInterfacePlugin(FOO x)
    
             virtual ~testInterfacePlugin(){}
    
         };
    }
    

    QT_BEGIN_NAMESPACE

    #define testInterfacePlugin_iid "testInterfacePlugin"

    Q_DECLARE_INTERFACE(INTERFACE::testInterfacePlugin, testInterfacePlugin_iid)
    @

    Plugin:
    @
    namespace INTERFACE
    {
    class Test_plugin: public INTERFACE:testInterfacePlugin
    {

            Q_OBJECT
            Q_PLUGIN_METADATA(IID "testInterfacePlugin_iid " FILE "test_plugin.json")
            Q_INTERFACES(INTERFACE::testInterfacePlugin)
    
        public:
    
            Test_plugin(FOO x);
    
    
        };
    }
    

    @

    where the JSON file is empty, however when I go to compile this I keep getting a "no matching call to a testInterfacePlugin(FOO)" error message, almost like it can't tell that the interface has that constructor. Has anyone come across this before and do they know how to resolve it.



  • U did not implement constructor for interface. Also don't inherit interface from who jet.



  • Thanks for the response Dheerendra but i'm not sure i follow your statement, the interface has a constructor testInterfacePlugin(FOO x), and i'm not to sure what you meant by "Also don't inherit interface from who jet" would you mind elaborating.
    Thanks
    [quote author="Dheerendra" date="1410112988"]U did not implement constructor for interface. Also don't inherit interface from who jet.[/quote]



  • You need implement constructor in interface definition. Don't inherit interface from qobject. Sorry due to some auto completion qobject has become jet. .


Log in to reply
 

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