Results 1 to 8 of 8

Thread: Any ideas on how to load a QT plug-in into your own application?

  1. #1
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Question Any ideas on how to load a QT plug-in into your own application?

    Hi everyone.

    Basically I have an application and I want the ability to add plug-ins to my program (QT plug-ins). So I want someone to be able to write a QT plug-in and my program read and integrate the plug-in into my application.


    I know qt allows you to write qt plug-ins, but how would I get my application to load the QT plug-in they wrote?


    Thanks

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

    Default Re: Any ideas on how to load a QT plug-in into your own application?

    What exactly do you mean by loading Qt plugins into your own application? Qt loads its plugins automatically when Q(Core)Application object is created.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    technoViking (6th January 2010)

  4. #3
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default Re: Any ideas on how to load a QT plug-in into your own application?

    Okay so say I have an application, I supply the users with a limited QT API to write a plug-in for my application. Once they write that qt plug-in I need a way to register that plug-in with my application so my application can use that plug-in.

    So my application would have a drop down, click install plug-in, browse to the user created plug-in and load it. Once its loaded a button would appear on my application, and when they click that button their plug-in would be launched.

    Thats my ultimate goal. The part i'm confused on is how I tell my application to register that plug-in and use it.

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

    Default Re: Any ideas on how to load a QT plug-in into your own application?

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    technoViking (6th January 2010)

  7. #5
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default Re: Any ideas on how to load a QT plug-in into your own application?

    thanks a ton! thats just what I needed.

    I noticed it said the QPluginLoader will check to make sure the QT API's match. If i wanted to supply the user a LIMITED Qt API and I wanted to make sure they are only using the limited libraries do you know the best way to check for this? I was thinking I could search the .dll but I don't believe thats possible to search through a .dll and see which libraries they are using in the plug-in.

    The reason it needs to be a limited API is to make sure they aren't writing any software that could break the system.

  8. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Any ideas on how to load a QT plug-in into your own application?

    The users have to have a more-or-less full Qt and compiler suite that matches your in order to pass the check that QPluginLoader will do (i.e. same Qt version, compiler, and interface version). The user is limited to what can be achieved inside the program core using the interfaces you expose from the main application. To lock them down don't expose things they shouldn't touch etc. It's a hard task to block every possible type of malicious intent.

    Depending on the sort of thing you want users to do you might be able to use the scripting abilities of QtScript rather than have users build native code.

  9. The following user says thank you to ChrisW67 for this useful post:

    technoViking (7th January 2010)

  10. #7
    Join Date
    Oct 2009
    Posts
    47
    Thanks
    10

    Default Re: Any ideas on how to load a QT plug-in into your own application?

    Cool thanks!

    I'm actually thinking about using Qt Webkit to allow people to use plug-ins. I still need to do some research but it looks like people can load plug-ins if you have a Qt Webkit using the FactoryPlugin

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

    Default Re: Any ideas on how to load a QT plug-in into your own application?

    If you are just about plugins and don't need WebKit functionality then leave it alone, it wouldn't do you any good. QPluginLoader is all you need. And unfortunately you have to agree that your users will be able to break the software, you just can't stop them from doing that - it's just a matter of time and effort to work around protections. The only thing you can do is provide scripting support instead of compiled plugins but even then someone can hook into your application and do almost whatever he desires.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. printing an application - any ideas?
    By lamera in forum Qt Programming
    Replies: 2
    Last Post: 1st November 2008, 13:48
  2. Qt plug-in for GLib event loop based application
    By profoX in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2008, 14:27
  3. Any ideas on determining cpu load in run-time?
    By a550ee in forum Qt Programming
    Replies: 3
    Last Post: 24th November 2006, 08:38
  4. Application plug-in architecture
    By brcain in forum Qt Programming
    Replies: 3
    Last Post: 13th September 2006, 00: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
  •  
Qt is a trademark of The Qt Company.