#include <genericfactory.h>

Public Member Functions | |
| GenericFactory () | |
| virtual KParts::Part * | createPartObject (QWidget *parentWidget, QObject *parent, 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 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.
Constructor & Destructor Documentation
| KParts::GenericFactory::GenericFactory | ( | ) | [inline] |
Definition at line 113 of file genericfactory.h.
Member Function Documentation
| virtual KParts::Part* KParts::GenericFactory::createPartObject | ( | QWidget * | parentWidget, |
| QObject * | parent, | ||
| const char * | className, | ||
| const QStringList & | args | ||
| ) | [inline, virtual] |
Definition at line 115 of file genericfactory.h.
The documentation for this class was generated from the following file:
KDE 4.7 API Reference