Developer Documentation

Toolbox Interface

The ToolboxInterface can be used by plugins to add widgets to the list of toolboxes in OpenFlippers UI. The toolboxes are located left or right of the GL viewer (See image).

The list can be hidden by pressing Ctrl + t.

To use the ToolboxInterface:

- include ToolboxInterface.hh in your plugins header file
- derive your plugin from the class ToolboxInterface
- add Q_INTERFACES(ToolboxInterface) to your plugin class
- And add the signals or slots you want to use to your plugin class (You don't need to implement all of them)

Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup your toolbox ( some kind of QWidget, can also be any widget created with QT-designer). Optionally you can also add an icon to the toolbox.

The following code shows a simple example to create an empty toolbox.

void ExamplePlugin::pluginsInitialized()
{
// Create the Toolbox Widget
QWidget* toolBox = new QWidget();
// Create an icon which is shown along with the toolbox
QIcon* toolIcon = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"exampleIcon.png");
// Tell the core to include the new toolbox widget with the name Simple Smoother, a pointer to the widget and a pointer to the icon
emit addToolbox( tr("Example Plugin Toolbox") , toolBox, toolIcon );
}

Signals and slots of your toolbox (e.g. from a QPushButton inside it) can be directly connected to signals and slots in your plugin. Therefore the embedding of the widget into the toolbox list is fully transparent.