KPluginFactory

KDE 4.2 PyKDE API Reference

- KDE's Python API

# KPluginFactory Class Reference

`from PyKDE4.kdecore import *`

Inherits: QObject

## Detailed Description

## Signals
| objectCreated (QObject object)
## Methods
| __init__ (self, QString componentName=0, QString catalogName=0, QObject parent=0)
| __init__ (self, KAboutData aboutData, QObject parent=0)
| __init__ (self, KAboutData aboutData, QObject parent=0)
| __init__ (self, QObject parent)
| __init__ (self, KPluginFactoryPrivate dd, QObject parent=0)
KComponentData | componentData (self)
QObject | create (self, QObject parent=0, QString classname="QObject", QStringList args=QStringList())
QObject | create (self, QString iface, QWidget parentWidget, QObject parent, QVariantList args, QString keyword)
QObject | createObject (self, QObject parent, QString className, QStringList args)
KParts.Part | createPartObject (self, QWidget parentWidget, QObject parent, QString classname, QStringList args)
| objectCreated (self, QObject object)
| setComponentData (self, KComponentData componentData)
| setupTranslations (self)
QVariantList | stringListToVariantList (self, QStringList list)
QStringList | variantListToStringList (self, QVariantList list)

## Method Documentation

__init__ | ( | self, |
|  | QString | componentName=0,
|  | QString | catalogName=0,
|  | QObject | parent=0
| ) |  |  |

This constructor creates a factory for a plugin with the given componentName and catalogName. Those values are used to initialize a KComponentData object for the plugin. You can later access it with componentData(). If componentName is 0, an invalid KComponentData object will be created.

Parameters:

  | componentName | the component name of the plugin

Parameters:

  | catalogName | the translation catalog to use

Parameters:

  | parent | a parent object

__init__ | ( | self, |
|  | KAboutData | aboutData,
|  | QObject | parent=0
| ) |  |  |

This constructor creates a factory for a plugin with the given KAboutData object. This object is used to initialize a KComponentData object for the plugin. You can later access it with componentData(). KPluginFactory takes ownership of the aboutData object, so don't delete it yourself!

Parameters:

  | aboutData | the KAboutData for the plugin

Parameters:

  | parent | a parent object

__init__ | ( | self, |
|  | KAboutData | aboutData,
|  | QObject | parent=0
| ) |  |  |

Deprecated:

__init__ | ( | self, |
|  | QObject | parent
| ) |  |  |

Deprecated:

__init__ | ( | self, |
|  | KPluginFactoryPrivate | dd,
|  | QObject | parent=0
| ) |  |  |

KComponentData componentData | ( |  | self ) |

You can use this method to get the component data of the plugin. It is filled with the information given to the constructor of KPluginFactory. The K_PLUGIN_FACTORY macros provide a static version of this method, this can be used from any place within the plugin.

Returns:
  The KComponentData for the plugin

QObject create | ( | self, |
|  | QObject | parent=0,
|  | QString | classname="QObject",
|  | QStringList | args=QStringList()
| ) |  |  |

Deprecated:

QObject create | ( | self, |
|  | QString | iface,
|  | QWidget | parentWidget,
|  | QObject | parent,
|  | QVariantList | args,
|  | QString | keyword
| ) |  |  |

This function is called when the factory asked to create an Object.

You may reimplement it to provide a very flexible factory. This is especially useful to provide generic factories for plugins implemeted using a scripting language.

Parameters:

  | iface | The staticMetaObject.className() string identifying the plugin interface that was requested. E.g. for KCModule plugins this string will be "KCModule".

Parameters:

  | parentWidget | Only used if the requested plugin is a KPart.

Parameters:

  | parent | The parent object for the plugin object.

Parameters:

  | args | A plugin specific list of arbitrary arguments.

Parameters:

  | keyword | A string that uniquely identifies the plugin. If a KService is used this keyword is read from the X-KDE-PluginKeyword entry in the .desktop file.

QObject createObject | ( | self, |
|  | QObject | parent,
|  | QString | className,
|  | QStringList | args
| ) |  |  |

KParts.Part createPartObject | ( | self, |
|  | QWidget | parentWidget,
|  | QObject | parent,
|  | QString | classname,
|  | QStringList | args
| ) |  |  |

Deprecated:

objectCreated | ( | self, |
|  | QObject | object
| ) |  |  |

Signal syntax:
  `QObject.connect(source, SIGNAL("objectCreated(QObject*)"), target_slot)`

setComponentData | ( | self, |
|  | KComponentData | componentData
| ) |  |  |

This method sets the component data of the plugin. You can access the component data object later with componentData(). Normally you don't have to call this, because the factory constructs a component data object from the information given to the constructor. The object is destroyed, when the module containing the plugin is unloaded. Normally this happens only on application shutdown.

Parameters:

  | componentData | the new KComponentData object

setupTranslations | ( |  | self ) |

QVariantList stringListToVariantList | ( | self, |
|  | QStringList | list
| ) |  |  |

Internal:
  Converts a QStringList to a QVariantList

QStringList variantListToStringList | ( | self, |
|  | QVariantList | list
| ) |  |  |

Internal:
  Converts a QVariantList of strings to a QStringList