Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTPlugin Constructor arguments
QtWS25 Last Chance

QTPlugin Constructor arguments

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Suths
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

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

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Suths
        wrote on last edited by
        #3

        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]

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

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

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved