KParts
KParts::ComponentFactory Namespace Reference
Functions | |
template<class T > | |
T * | createPartInstanceFromFactory (KParts::Factory *factory, QWidget *parentWidget=0, QObject *parent=0, const QStringList &args=QStringList()) |
template<class T > | |
T * | createPartInstanceFromLibrary (const char *libraryName, QWidget *parentWidget=0, QObject *parent=0, const QStringList &args=QStringList(), int *error=0) |
template<class T > | |
T * | createPartInstanceFromQuery (const QString &mimeType, const QString &constraint, QWidget *parentWidget=0, QObject *parent=0, const QStringList &args=QStringList(), int *error=0) |
template<class T > | |
T * | createPartInstanceFromService (const KService::Ptr &service, QWidget *parentWidget=0, QObject *parent=0, const QStringList &args=QStringList(), int *error=0) |
template<class T , class ServiceIterator > | |
T * | createPartInstanceFromServices (ServiceIterator begin, ServiceIterator end, QWidget *parentWidget=0, QObject *parent=0, const QStringList &args=QStringList(), int *error=0) |
Function Documentation
template<class T >
T* KParts::ComponentFactory::createPartInstanceFromFactory | ( | KParts::Factory * | factory, |
QWidget * | parentWidget = 0 , |
||
QObject * | parent = 0 , |
||
const QStringList & | args = QStringList() |
||
) |
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 );
- Deprecated:
- use KPluginFactory::create instead
- Parameters:
-
factory The factory to ask for the creation of the component parentWidget the parent widget for the part parent The parent object (see QObject constructor) args A list of string arguments, passed to the factory and possibly to the component (see KLibFactory)
- Returns:
- A pointer to the newly created object or a null pointer if the factory was unable to create an object of the given type.
Definition at line 58 of file componentfactory.h.
template<class T >
T* KParts::ComponentFactory::createPartInstanceFromLibrary | ( | const char * | libraryName, |
QWidget * | parentWidget = 0 , |
||
QObject * | parent = 0 , |
||
const QStringList & | args = QStringList() , |
||
int * | error = 0 |
||
) |
Definition at line 80 of file componentfactory.h.
template<class T >
T* KParts::ComponentFactory::createPartInstanceFromQuery | ( | const QString & | mimeType, |
const QString & | constraint, | ||
QWidget * | parentWidget = 0 , |
||
QObject * | parent = 0 , |
||
const QStringList & | args = QStringList() , |
||
int * | error = 0 |
||
) |
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: @code // 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(), parentWidget, parentObject ); if ( part ) { part->openUrl( url ); part->widget()->show(); // also insert the widget into a layout, or simply use a KVBox as parentWidget } \endcode \xrefitem deprecated 5. @param mimeType the mimetype which this part is associated with @param constraint an optional constraint to pass to the trader (see KTrader) @param parentWidget the parent widget, will be set as the parent of the part's widget @param parent the parent object for the part itself @param args A list of string arguments, passed to the factory and possibly to the component (see KLibFactory) @param error The int passed here will receive an error code in case of errors. (See enum KLibLoader::ComponentLoadingError) @return A pointer to the newly created object or a null pointer if the factory was unable to create an object of the given type.
Definition at line 205 of file componentfactory.h.
template<class T >
T* KParts::ComponentFactory::createPartInstanceFromService | ( | const KService::Ptr & | service, |
QWidget * | parentWidget = 0 , |
||
QObject * | parent = 0 , |
||
const QStringList & | args = QStringList() , |
||
int * | error = 0 |
||
) |
- Deprecated:
- use KService::createInstance instead
Definition at line 126 of file componentfactory.h.
template<class T , class ServiceIterator >
T* KParts::ComponentFactory::createPartInstanceFromServices | ( | ServiceIterator | begin, |
ServiceIterator | end, | ||
QWidget * | parentWidget = 0 , |
||
QObject * | parent = 0 , |
||
const QStringList & | args = QStringList() , |
||
int * | error = 0 |
||
) |
Definition at line 147 of file componentfactory.h.
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Jul 23 2013 20:40:23 by doxygen 1.8.1.1 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Jul 23 2013 20:40:23 by doxygen 1.8.1.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.