Class PluginContext

Inheritance Relationships

Base Type

  • public QObject

Class Documentation

class PluginContext : public QObject

PluginContext providing information to the plugin and exposing methods for the plugin to interact with the framework. It relays all methods to the corresponding plugin handler.

Public Functions

PluginContext(QObject *obj, int serial_number, const QStringList &argv)
PluginContext(const PluginContext &other)
int serialNumber() const

Return the serial number of the plugin. For a specific type of plugin each instance gets a serial number (which is the first currently not used positive integer at construction time).

Returns:

The serial number

const QStringList &argv() const

Return the command line arguments of the plugin.

Returns:

The arguments without a program name at the beginning

void addWidget(QWidget *widget)

Add a widget to the UI. The widget is embedded into a new QDockWidget which itself is added to the QMainWindow. This method can be called once for each widget a plugin would like to add and at any point in time (until the calling plugin has been shutdown).

Note

The ownership of the widget pointer is transferred to the callee which will delete it when the plugin is shut down.

Parameters:

widget – The widget to add

void removeWidget(QWidget *widget)

Remove a previously added widget from the UI.

Note

The ownership of the widget pointer is transferred back to the caller which is responsible of deleting it.

Parameters:

widget – The widget to remove

void closePlugin()

Close the plugin. The framework will call Plugin.shutdown_plugin() and unload it afterwards.

void reloadPlugin()

Reload the plugin.

Protected Attributes

GenericProxy proxy_
int serial_number_
QStringList argv_