KParts::Factory change

Simon Hausmann hausmann at kde.org
Mon Jun 10 13:05:05 BST 2002


On Sun, Jun 09, 2002 at 06:49:59PM +0200, Christoph Cullmann wrote:
> Hi,
> have made following change to the kparts factory, if that is a problem, I will revert it, here comes the diff
> 
> With the patch, the factory no longer asserts if the parent is no QWidget, but nulls the parentWidget and uses the given
> qobject parent, that looks much better than the assert, and why shouldn't that work ?

I think this change is wrong, as it can lead to unexpected toplevel
widgets. Any code wanting to create a part without using the
createPart method of KParts::Factory but not passing a QWidget as
parent object is broken. If you really want to create a part where
the document has a normal parent object and the view is a toplevel
widget then you should use the dedicated KParts::Factory::createPart
method (or easier, KParts::ComponentFactory), where from the caller
code you can immediately see this very intention, unlike when using
the old-style create method which isn't designed for creating
instances of parts.


Simon




More information about the kde-core-devel mailing list