A lot of plugins questions.



  • Hello all,
    I have some questions to Qt4 masters,
    I'm the developer of "GLC_lib":http://www.glc-lib.net and "GLC_Player":http://www.glc-player.net... From now, I need to use more powerful functionality of Qt4.
    To do that, I have done some research and I'haven't found clear answer about plugin's related questions :

    Can I use Plugins in a DLL which depend of this DLL (ia GLC_lib plugins which depends of GLC_lib)

    It's possible to catch exceptions in a plugin ?

    It's possible to use more than one interface in a plugin implementation ?

    It's possible to send signals to a plugin class ?

    If yes, where I should declare signals ? (In the interface or in the implementation of the plugin or somewhere else?)

    It's possible to receive signals from a plugin class ?

    If yes, where I should declare signals ? (In the interface or in the implementation of the plugin or somewhere else?)

    It's possible to use a powerful plugin class which use a some QWidget with Signals and Slots ?

    And finally, if the answer is yes have you some samples ?

    Thanks.



  • bq. Can I use Plugins in a DLL which depend of this DLL (ia GLC_lib plugins which depends of GLC_lib)

    Yes.

    bq. It's possible to catch exceptions in a plugin ?

    Yes. To be useful you would have to know the type of exception. When in doubt, you can do catch(...) but that might also catch exceptions that you don't know how to handle.
    @try {
    myPlugin->doSomething();
    } catch(SomeException &ex) {
    qWarning("Exception occurred");
    }@

    bq. It's possible to use more than one interface in a plugin implementation ?

    Yes.
    @class MyPlugin : public Interface1, public Interface2, public QObject
    {
    Q_OBJECT
    Q_INTERFACES(Interface1 Interface2)

    // The rest of your class implementation
    

    };@

    bq. It's possible to send signals to a plugin class ?

    Yes. You can send signals everywhere. Or better said, you can connect signals and slots to any signal you can access.

    bq. If yes, where I should declare signals ? (In the interface or in the implementation of the plugin or somewhere else?)

    You declare signals in the class you emit them from.

    bq. It's possible to receive signals from a plugin class ?

    Yes.

    bq. If yes, where I should declare signals ? (In the interface or in the implementation of the plugin or somewhere else?)

    Declare them in your plug-in implementation. One of the drawbacks of the plug-in system is that you cannot publicly declare signals and slots without the plug-in being dependent on a dll that implements the QObject part of the interface.

    @class MyPlugin : public Interface1, public QObject
    {
    Q_OBJECT
    Q_INTERFACES(Interface1)

    Q_SIGNALS:
    void progressChanged(int);

    // The rest of your class implementation
    

    };@

    bq. It's possible to use a powerful plugin class which use a some QWidget with Signals and Slots ?

    Yes.



  • Thanks a lot Franzk.

    Now, it's clear for me. Qt does all the things I need with plugin.


Log in to reply
 

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