KParts::ComponentFactory Namespace Reference
Detailed Description
Namespace for KParts components.
Enumerations | |
enum | ComponentLoadingError { ErrNoServiceFound = 1, ErrServiceProvidesNoLibrary, ErrNoLibrary, ErrNoFactory, ErrNoComponent } |
Functions | |
template<class T> | |
static T * | createInstanceFromFactory (KLibFactory *factory, QObject *parent=0, const char *name=0, const QStringList &args=QStringList()) |
template<class T> | |
static T * | createPartInstanceFromFactory (KParts::Factory *factory, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList()) |
template<class T> | |
static T * | createInstanceFromLibrary (const char *libraryName, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0) |
template<class T> | |
static T * | createPartInstanceFromLibrary (const char *libraryName, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0) |
template<class T> | |
static T * | createInstanceFromService (const KService::Ptr &service, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0) |
template<class T> | |
static T * | createPartInstanceFromService (const KService::Ptr &service, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0) |
template<class T, class ServiceIterator> | |
static T * | createInstanceFromServices (ServiceIterator begin, ServiceIterator end, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0) |
template<class T, class ServiceIterator> | |
static T * | createPartInstanceFromServices (ServiceIterator begin, ServiceIterator end, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0) |
template<class T> | |
static T * | createInstanceFromQuery (const QString &serviceType, const QString &constraint=QString::null, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0) |
template<class T> | |
static T * | createPartInstanceFromQuery (const QString &serviceType, const QString &constraint, QWidget *parentWidget=0, const char *widgetName=0, QObject *parent=0, const char *name=0, const QStringList &args=QStringList(), int *error=0) |
Enumeration Type Documentation
|
This enum type defines the possible error cases that can happen when loading a component.
Definition at line 37 of file componentfactory.h. |
Function Documentation
|
This template function allows to ask the given factory to create an instance of the given template type. Example of usage: MyPlugin *plugin = KParts::ComponentFactory::createInstanceFromFactory<MyPlugin>( factory, parent );
Definition at line 61 of file componentfactory.h. |
|
This template allows to load the specified library and ask the factory to create an instance of the given template type.
Definition at line 127 of file componentfactory.h. |
|
This method creates and returns a plugin, from the trader query for a given serviceType. Example: KMyAppPlugin* plugin = KParts::ComponentFactory::createInstanceFromQuery<KMyAppPlugin>( serviceType, QString::null, parentObject );
if ( plugin ) {
....
}
Definition at line 321 of file componentfactory.h. |
|
This template function allows to ask the given kparts factory to create an instance of the given template type. Example of usage: KViewPart *doc = KParts::ComponentFactory::createPartInstanceFromFactory<KViewPart>( factory, parent );
Definition at line 95 of file componentfactory.h. |
|
This method creates and returns a KParts part from a serviceType (e.g. a mimetype). You can use this method to create a generic viewer - that can display any kind of file, provided that there is a ReadOnlyPart installed for it - in 5 lines: // Given the following: KURL url, QWidget* parentWidget and QObject* parentObject. QString mimetype = KMimeType::findByURL( url )->name(); KParts::ReadOnlyPart* part = KParts::ComponentFactory::createPartInstanceFromQuery<KParts::ReadOnlyPart>( mimetype, QString::null, parentWidget, 0, parentObject, 0 ); if ( part ) { part->openURL( url ); part->widget()->show(); // also insert the widget into a layout, or simply use a QVBox as parentWidget }
Definition at line 370 of file componentfactory.h. |