Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, June 2007
Please Help !!!! How to create Custom Widget as Plugin using Qt 3.3.4 and CMake 2.4.6 in Windows


Message 1 in thread

hello,

I want to export a set of custom widgets as a plugin --- as i want to export
these set of widgets as a module. So when my application loads, it will look
for all the plugin modules that are present in plugin's "widgets" directory
and load them dynamically.

I am using Qt 3.3.4 and i use CMake 2.4 with Visual Studio .NET 2003

Can someone please help me with an example of how to write the
CMakeLists.txt for exporting the modules as a plugin ? I have found no help
in the mailing list on this issue.

>> Should i create a seperate CMake Project for each of the plugin.

>> I think It would be convenient for our developers, if i can add all the
projects ( main software + module plugins ) in the same visual studion .net
2003 solution ?

>> I wrote a class that inherits from QWidgetPlugin, and i want to allow
only one custom widget class to be created in QWidgetPlugin::Create.
However this custom widget class uses few other custom widget classes. Is it
compulsory to export them as well in QWidgetPlugin::Create and
QWidgetPlugin::keys.

Thanks in advance.

Regards,

Deepak

Message 2 in thread

Hello,

I have made some advances since my last post, however still i am not able to
load the plugins.

I created a class CustomWidgetPlugin that inherits from QWidgetPlugin. I
have provided the implementation to the two pure virtual functions
QWidgetPlugin::Create and QWidgetPlugin::keys.

I successfully got my plugin compiled and linked and got
CustomWidgetPlugin.lib and CustomWidgetPlugin.dll generated.

Using the above strategy i have exported various modules as various plugins.


For example:  I have exported ----------> ModuleOnePlugin , ModuleTwoPlugin,
ModuleThreePlugin  ( All classes are derived from QWidgetPlugin ).

Now i have placed the *.lib and *.dll of these plugins ----------- in
Application Dir --------> widgets

Now in the main software, i want to dynamically load these plugins and i
assume that the names of the modules/classes are not known to me -----> i
want to only load those plugins that are present in the plugins/widgets
directory so that when we deploy the client gets to see only those plugins
which we provide him with.

Is there a way i can get access to QWidgetPlugin derived classes that i
created ( ModuleOnePlugin , ModuleTwoPlugin etc ), so that i can use
QWidgetPlugin::Keys to know the classnames, and QWidgetPlugin::create

Also it is not clear to me, how to instantiate the objects of the classes
that i export in each plugin ???

Regards,

Deepak

On 6/25/07, Deepak Roy <cdeepakroy@xxxxxxxxx> wrote:
>
> hello,
>
> I want to export a set of custom widgets as a plugin --- as i want to
> export these set of widgets as a module. So when my application loads, it
> will look for all the plugin modules that are present in plugin's "widgets"
> directory and load them dynamically.
>
> I am using Qt 3.3.4 and i use CMake 2.4 with Visual Studio .NET 2003
>
> Can someone please help me with an example of how to write the
> CMakeLists.txt for exporting the modules as a plugin ? I have found no
> help in the mailing list on this issue.
>
> >> Should i create a seperate CMake Project for each of the plugin.
>
> >> I think It would be convenient for our developers, if i can add all the
> projects ( main software + module plugins ) in the same visual studion .net
> 2003 solution ?
>
> >> I wrote a class that inherits from QWidgetPlugin, and i want to allow
> only one custom widget class to be created in QWidgetPlugin::Create.
> However this custom widget class uses few other custom widget classes. Is it
> compulsory to export them as well in QWidgetPlugin::Create and
> QWidgetPlugin::keys.
>
> Thanks in advance.
>
> Regards,
>
> Deepak
>
>