Accessing View from Plugin Part

Alexander Dymo dymo at ukrpost.ua
Mon Mar 12 11:48:23 UTC 2007


Yes, Andreas described it correctly. You don't need to have a part which
knows about toolviews, you need to have toolviews that know about a part.

To see how it is done you can look at filemanager too 
(kdevfilemanagerpart.cpp#42).

When you need part to tell something to toolviews you just need to emit
a signal from a part and have slots in the toolview to catch those signals.

But if you really really need a part to know about toolviews, it's perfectly
possible as well. Just implement a list in the part and change the toolview
factory to add newly created toolviews to that list.
IMHO that's not a great design though. If you take this way, make sure
you know when those views are deleted (i.e. use QPointer<MyToolView>).

--------
PS: in any case your part creates a toolview in the factory, so it 
knows about it. You shouldn't access to the real QDockWidget
in the mainwindow. That's stuff internal to the shell. You just need
to manage a widget inside QDockWidget (the one that is created by
the factory).




More information about the KDevelop-devel mailing list