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
Forum Update on Monday, May 27th 2025

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 7 Sept 2014, 14:12 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
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 7 Sept 2014, 18:03 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 7 Sept 2014, 19:38 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
        • D Offline
          D Offline
          dheerendra
          Qt Champions 2022
          wrote on 8 Sept 2014, 01:18 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

          4/4

          8 Sept 2014, 01:18

          • Login

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