class GenericFactory

# class GenericFactory | A template for a KParts::Factory implementation. More...
Full name | `KParts::GenericFactory`
Definition | `#include <genericfactory.h>`
Template form | GenericFactory<class T1, class T2>
Inherits | KParts::GenericFactoryBase [public ], KParts::GenericFactoryBase [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- GenericFactory ()
- virtual KParts::Part * createPartObject ( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *className, const QStringList &args )
- GenericFactory ()
- virtual KParts::Part * createPartObject ( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *className, const QStringList &args )

## Detailed Description

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 KInstance object, by providing a static KInstance *instance() 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, const char *widgetName, QObject *parent, const char *name, 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 KInstance and the KAboutData object.

For advanced use you can also inherit from the template and re-implement additionally the virtual KInstance *createInstance() 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.

GenericFactory () | ### GenericFactory

KParts::Part * createPartObject ( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *className, const QStringList &args ) | ### createPartObject

[virtual]

Reimplemented from Factory.

GenericFactory () | ### GenericFactory

KParts::Part * createPartObject ( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *className, const QStringList &args ) | ### createPartObject

[virtual]

Reimplemented from Factory.

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:37:24 2003, using kdoc 2.0a54.