Namespace KParts


Table of contents
Modules
kparts Classes
All Classes
Module kparts
Namespace KParts

A template for a KParts.Factory implementation. It implements the pure virtual createPartObject method by instantiating the template argument when requested through the className field. In addition it is a container for a part's KComponentData object, by providing a static KComponentData componentData() method.

The template argument has to inherit from KParts.Part and has to implement two methods: 1) There needs to be a public constructor with the following signature: MyPart( QWidget *parentWidget, QObject *parent, const QStringList& args )

2) It needs to provide one static method to create a KAboutData object per request, holding information about the component's name, its authors, license, etc. The signature of that static method has to be KAboutData *createAboutData()

The template will take care of memory management of the KComponentData and the KAboutData object, meaning ownership of what createAboutData returns is passed to the caller (this template) .

For advanced use you can also inherit from the template and re-implement additionally the virtual KComponentData createComponentData() method, for example in case you want to extend the paths of your instance's KStandardDirs object.

If a KParts.ReadOnlyPart is requested through this factory and the template argument implements a KParts.ReadWritePart then setReadWrite( false ) will automatically be called in createPartObject.

Use the factory through the K_EXPORT_COMPONENT_FACTORY macro, like that:

typedef KParts.GenericFactory<YourKPart> YourKPartFactory;
K_EXPORT_COMPONENT_FACTORY( yourlibrary, YourKPartFactory )
yourlibrary is the library name that you compiled your KPart into. Internal Internal Internal Internal Internal vim: et sw=4