#include <klibloader.h>
Inheritance diagram for KLibFactory:

Signals | |
| void | objectCreated (QObject *obj) |
Public Methods | |
| KLibFactory (QObject *parent=0, const char *name=0) | |
| QObject * | create (QObject *parent=0, const char *name=0, const char *classname="QObject", const QStringList &args=QStringList()) |
Protected Methods | |
| virtual QObject * | createObject (QObject *parent=0, const char *name=0, const char *classname="QObject", const QStringList &args=QStringList())=0 |
K_EXPORT_COMPONENT_FACTORY( libkspread, KSpreadFactory )
The first macro argument is the name of your library, the second specifies the name of your factory.
In the constructor of your factory you should create an instance of KInstance like this:
s_global = new KInstance( "kspread" );
This KInstance is comparable to KGlobal used by normal applications. It allows you to find resource files (images, XML, sound etc.) belonging to the library.
If you want to load a library, use KLibLoader. You can query KLibLoader directly for a pointer to the libraries factory by using the KLibLoader::factory() function.
The KLibFactory is used to create the components, the library has to offer. The factory of KSpread for example will create instances of KSpreadDoc, while the Konqueror factory will create KonqView widgets. All objects created by the factory must be derived from QObject, since QObject offers type safe casting.
KLibFactory is an abstract class. Reimplement the createObject() method to give it functionality.
Definition at line 328 of file klibloader.h.
|
||||||||||||
|
Create a new factory.
|
|
||||||||||||||||||||
|
Creates a new object. The returned object has to be derived from the requested classname.
It is valid behavior to create different kinds of objects depending on the requested create() automatically emits a signal objectCreated to tell the library about its newly created object. This is very important for reference counting, and allows unloading the library automatically once all its objects have been destroyed.
|
|
||||||||||||||||||||
|
Creates a new object. The returned object has to be derived from the requested classname.
It is valid behavior to create different kinds of objects depending on the requested This function is called by create()
Implemented in KGenericFactory< Product, ParentType >, KGenericFactory< KTypeList< Product, ProductListTail >, QObject >, KGenericFactory< KTypeList< Product, ProductListTail >, KTypeList< ParentType, ParentTypeListTail > >, KScanDialogFactory, and KParts::Factory. |
|
|
Emitted in create
|
1.2.18