[OT] plugins and QDockWidget

kitts kitts.mailinglists at gmail.com
Sat Mar 24 20:13:48 UTC 2007


On Sunday 25 Mar 2007 IST, Andreas Pakulat wrote:
> > > No, at least not in KDevelop4. We'd like to hide the mainwindow from
> > > any plugins as we will have multiple mainwindows but only 1 instance
> > > of a plugin. The plugin just provides a factory to create widgets for
> > > the dockwidgets and hopefully it'll also provide a way to create a
> > > central widget if it needs to.
> > >
> > > However there are also plugins in KDev4 that don't provide any of the
> > > two and just "do some work", like the project managers or project
> > > builders.
> >
> > So the plugin itself cannot initiate the creation of a new dockwidget
> > but will list them out when queried by the main app? The 'scope' of the
> > plugin is set by the main app. I have in mind the situation where
> > perhaps a new dockwidget is created/modified by the plugin based on the
> > selection within its view. Of course, this could also be achieved by it
> > rising a signal that is understood by the main app.
>
> No, you misunderstood. The plugin will have a QWidget derived class
> (which may know about the plugin class itself, even connected to its
> signals) and the plugin will provide a factory which can create an
> instance of this qwidget derived class. The application then asks the
> factory to create a new widget when the plugin is loaded and embeds that
> widget into a qdockwidget. Later on the user can decide to create
> another toolview and then the factory is asked to create another such
> qwidget derived class and its embedded in a new qdockwidget.
>
> The plugin still somewhat controls when the first qdockwidget shows up,
> because it needs to call addToolView to make the factory known to the
> main app. But after that the mainwindow/uicontroller in KDev4 controls
> when to create new dockwidgets.
>
> The communication between plugin's view, plugin and toolview would need
> to be done via signal/slots, i.e. if the view signals some change to the
> plugin this one can send out a signal which is catched by all
> toolview-widgets and they act accordingly.

Let me take the example of designer being embedded. Designer uses several 
toolviews (dockwidgets) for each view. Among them is a widget properties 
toolview. At the time of the view creation this tool view did not exist. 
Subsequently when one of the widgets is selected in its view, a new 
toolview is created for properties.

This may not be the perfect example as it is very predictable but i was 
referring to such a situation where the need for creation of a new toolview 
for an existing view is raised by view/plugin or maybe another toolview 
itself.
-- 
Cheers!
kitts

Ps. I really appreciate you taking the time to explain these little things 
to me. I have benefited a lot just be reading the devel mailing lists. I 
hope this helps other novices' like me, now or in the future.




More information about the KDevelop-devel mailing list