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
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
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
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
Got a URL?Originally Posted by rianquinn
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?![]()
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
shouldn't INTERFACE be 'plugin_menu_interface'? from the plug&paint example:
Qt Code:
Q_EXPORT_PLUGIN2(pnp_basictools, BasicToolsPlugin)To copy to clipboard, switch view to plain text mode
where BasicToolsPlugin header is:
Qt Code:
public BrushInterface, public ShapeInterface, public FilterInterfaceTo 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?![]()
Bookmarks