Results 1 to 10 of 10

Thread: QPluginLoader Qt 4

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    52
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPluginLoader Qt 4

    I don't know if you have looked at this sample. It worked for me:

    http://doc.trolltech.com/4.1/tools-p...asictools.html

  2. #2
    Join Date
    Jan 2006
    Posts
    30
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPluginLoader Qt 4

    Thanks for your replies, The Q_EXPORT_PLUGIN2 didn't work.

    Can't use QLibrary. This would require me to extern all my interfaces to "C" code which can't be done. Also, the QPluginLoader is new to Qt 4, which adds a much needed Interface Layer to plugins that should become the future of all Qt programming. This is something (in my opinion) that should be figured out instead of avoiding.

    So far no luck. I am currently working with Troll Tech to figure out what is wrong. It has to be something simple. At this point, sample code is going to be the most useful thing. Has anyone actually gotten this to work. Is there an open source example, that I can diff with my code.

    Thanks Guys for all of your help. I would like to be able to post a complete solution to this thread to help others in the future.

    Rian

  3. #3
    Join Date
    Jan 2006
    Posts
    30
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPluginLoader Qt 4

    Ok,

    Here is the solution!!! YEAH

    Q_EXPORT_PLUGIN2 needs to be in the following format.

    Q_EXPORT_PLUGIN2(TARGET, INTERFACE)

    TARGET is the name of the library (meaning in your .pro file, you specify the output file name by using the variable TARGET). Mine should have been "menu".

    INTERFACE is the name of the interface that you are using. Mine is plugin_interface

    Finally, the constructor of the QPluginLoader, simply specifies the plugin file name and path. You still have to run the load function.

    If anyone needs an example of this code, you can look at the open source "Programmers Editor" on source forge.

    Rian

  4. #4
    Join Date
    Jan 2006
    Location
    Lincoln, NE USA
    Posts
    177
    Thanks
    3
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: QPluginLoader Qt 4

    Quote Originally Posted by rianquinn
    ...snip...
    If anyone needs an example of this code, you can look at the open source "Programmers Editor" on source forge.
    Rian
    Got a URL?
    I searched for "Programmers Editor" on source forge and the only project by that name was using Python. There are lots of "Programmers something Editor". Which one are you?

  5. #5
    Join Date
    Jan 2006
    Posts
    30
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPluginLoader Qt 4

    programmersedit.sourceforge.net, however code won't be available until this summer when I have more time (college student). However, the surrent code is working really good. Qt 4's model view architecture is amazing for such a concept.

    Thanks

  6. #6
    Join Date
    Sep 2006
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QPluginLoader Qt 4

    Quote Originally Posted by rianquinn View Post
    Q_EXPORT_PLUGIN2(TARGET, INTERFACE)

    [...]

    INTERFACE is the name of the interface that you are using. Mine is plugin_interface
    shouldn't INTERFACE be 'plugin_menu_interface'? from the plug&paint example:

    Qt Code:
    1. Q_EXPORT_PLUGIN2(pnp_basictools, BasicToolsPlugin)
    To copy to clipboard, switch view to plain text mode 

    where BasicToolsPlugin header is:

    Qt Code:
    1. class BasicToolsPlugin : public QObject,
    2. public BrushInterface,
    3. public ShapeInterface,
    4. public FilterInterface
    To copy to clipboard, switch view to plain text mode 

    Using 'plugin_interface' in Q_EXPORT_PLUGIN2 will make the compiler complain as the macro will try to create an instance of the plugin_interface class which cannot be instantiated as being pure virtual.

    G.

    PS anyway I cannot make it work nor cannot debug QPluginLoader..trolltech should do something about that, who can I complain with?

Similar Threads

  1. QPluginLoader doesn't load plugin
    By BeS in forum Qt Programming
    Replies: 6
    Last Post: 26th November 2008, 19:12
  2. QPluginLoader instance
    By Jeff100 in forum Qt Programming
    Replies: 1
    Last Post: 22nd November 2007, 06:47
  3. QPluginLoader question
    By QPlace in forum Qt Programming
    Replies: 1
    Last Post: 29th July 2007, 11:16
  4. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13
  5. QPluginLoader fails when using "debug" config
    By paradiza in forum Qt Programming
    Replies: 22
    Last Post: 14th February 2007, 06:59

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.