Results 1 to 4 of 4

Thread: Plugins

  1. #1
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Plugins

    I've never made any application with plugins before, but I might need to soon. A way to add functionality to a program that is already compiled. Like the extensions of firefox, for example (but not nessesarily in the exact same way).

    What is the best / most frequently used way to do this? What sort of file will the plugin be? How does the application communicate with it? What sort of techniques are used? Doesn't have to be QT, so I post it here.

    Thanks!
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Plugins

    There is no one simple answer for your question. You can have binary plugins which are implemented as shared objects and loaded into the main app using APIs like dlopen() and dlsym() or QLibrary. You can have scripting plugins, where plugins are text scripts (for example in perl, python, QSA or whatever other language you find convinient) which are interpreted by some interpreter embedded into the main application.

    It all depends what should those plugins do...

  3. #3
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Thanks
    9
    Thanked 29 Times in 29 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Plugins

    Yes. Of course. I'm interested in the binary ones, since most of what I need would be way too difficult (if not impossible) for scripting plugins. A simple example of what I need:

    There is a complex datastructure in the application. Each member has an acceptVisitor() function, so the visitor pattern can be applied. The new plugin will need:

    * A new visitor (a subclass of an already existing Visitor class in the app) to traverse the datastructure.

    * A new toolbar button to let it do its work.

    * Access to an existing class which uses the singleton pattern, in which the visitor will change data.

    How would I go about that? An online tutorial or something would be great.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Plugins

    You might try the C++ dlopen mini-HowTo.

Similar Threads

  1. Container plugins
    By Benne Gesserit in forum Qt Tools
    Replies: 4
    Last Post: 20th November 2008, 23:43
  2. Replies: 1
    Last Post: 31st October 2008, 14:35
  3. Qt Plugins Error
    By nathanpackard in forum Qt Programming
    Replies: 1
    Last Post: 17th August 2007, 23:19
  4. Qt plugins - how to do a libtool-style autoload
    By KShots in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2007, 12:40
  5. Plugins as small application
    By blackliteon in forum Qt Programming
    Replies: 4
    Last Post: 12th January 2006, 09:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.