×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    19

    How do use my own Class in a plugin interface

    Hi,

    I would like to write a plugin interface which uses non standard Qt class like QString or what ever but my own class. Here is what I would like to do:

    myplugin.h

    Code:
    namespace MyPlugin
    {
        class MyClass : public QObject
        {
    	Q_OBJECT
    
            public:
                MyClass(int id, QString string) {
                   this->id = id;
                   this->string = string;
                };
            private:
                int id;
                QString string;
        };
    
        //Plugin interface
        class MyPluginInterface : public QObject
        {
            Q_OBJECT
    
     	virtual ~MyPluginInterface() = 0;
            // I don't want to write something like
            //virtual int getSomeId() = 0;
            //virtual QString getSomeString() = 0;
            //From a plugin, but just
            virtual MyClass getMyClass() = 0;
            // With MyClass already created in a plugin
       };
    }
    
    Q_DECLARE_INTERFACE(MyPlugin::MyPluginInterface,
    		    "com.foo6321.internal.myplugin.myplugininterface/0.1")
    Is it doable ?


    Thanks

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How do use my own Class in a plugin interface

    Two things:
    1. Using get in a name of getter is against Qt naming policy. It's very different from Gtk2.
    2. You are supposed to expose only interface of your plugin, not it's class implementation.

Similar Threads

  1. class or interface expected
    By littleson in forum Mobile Java General
    Replies: 5
    Last Post: 2009-02-11, 05:23
  2. C++ Symbols class(), class()->,class. ????
    By PACALA_BA in forum Symbian
    Replies: 7
    Last Post: 2008-09-15, 20:57
  3. Singleton class implementation
    By MehulPatel in forum Symbian
    Replies: 5
    Last Post: 2008-04-11, 11:46
  4. send array[0] different class
    By gift_te in forum Symbian
    Replies: 0
    Last Post: 2007-03-28, 13:04
  5. S80 Ethernet Plugin, INterface Address of WLAN/PDP Context
    By jayantjain in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-10-11, 03:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×