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. Create application plugin

Create application plugin

Scheduled Pinned Locked Moved Unsolved General and Desktop
pluginsqt5qt 5.4.1
3 Posts 3 Posters 1.1k 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
    swordfish
    wrote on 21 Sept 2017, 14:01 last edited by
    #1

    I have created a Qt application (it uses R for running analyses). I want to make the application extendable using application plugins - in the sense, I want to allow anyone to make a new analysis (say linear-regression), with it's own user interface and an r package. How do I make this into a plugin?

    In the future, I want to be able to download the new "analysis-plugin" (maybe from an app store) and my qt application should be able to run it. How do I do this?

    Currently I just ship all the analyses in each release.

    R 1 Reply Last reply 21 Sept 2017, 14:35
    0
    • S swordfish
      21 Sept 2017, 14:01

      I have created a Qt application (it uses R for running analyses). I want to make the application extendable using application plugins - in the sense, I want to allow anyone to make a new analysis (say linear-regression), with it's own user interface and an r package. How do I make this into a plugin?

      In the future, I want to be able to download the new "analysis-plugin" (maybe from an app store) and my qt application should be able to run it. How do I do this?

      Currently I just ship all the analyses in each release.

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 21 Sept 2017, 14:35 last edited by
      #2

      @swordfish
      First read this

      Then you need to think about a (robust) generic abstract interface which each plugin need to implement.
      Also the link from above says:

      1. Define a set of interfaces (classes with only pure virtual functions) used to talk to the plugins.
      2. Use the Q_DECLARE_INTERFACE() macro to tell Qt's meta-object system about the interface.
      3. Use QPluginLoader in the application to load the plugins.
      4. Use qobject_cast() to test whether a plugin implements a given interface.

      You can use QPluginLoader to load plugins from a custom folder name which then needs to rely next to the Qt plugins (somewhere in the import paths).

      The interface class can have methods like:

      class MyInterface
      {
      public:
          virtual ~MyInterface() {}
      
          virtual QWidget* getGui() const = 0;
          virtual void calculate() = 0;
      
          ..... whatever information the application needs
      };
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      3
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 21 Sept 2017, 14:55 last edited by
        #3

        Hi
        Also for my first attempt i used
        http://doc.qt.io/qt-5/qtwidgets-tools-echoplugin-example.html

        which is pretty small and easy to understand.

        1 Reply Last reply
        1

        3/3

        21 Sept 2017, 14:55

        • Login

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