Anatomy of a Scribus Plugin

From Scribus Wiki
Jump to: navigation, search


Creating a plugin for Scribus

Requirements

  • Knowledge of c++

Calling plugin A within plugin B

below is an example how to call the "subdivide" plugin from the "tools" plugins :

// Plugin names are lowercase
QString pName = "subdivide";
// get list of installed plugins
PluginManager& pluginManager(PluginManager::instance());
QStringList pluginNames(pluginManager.pluginNames(false));
// if your plugin is in the list
if (pluginNames.contains(pName))
{
    // get the plugin
    ScActionPlugin* plugin = dynamic_cast<ScActionPlugin*>
(pluginManager.getPlugin(pName, false));
    // now you can call the plugins "run" method
    // with your doc as argument
    if (plugin)
        plugin->run(doc);
}