Anatomy of a Scribus Plugin: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
(started)
 
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
== Creating a plugin for Scribus ==
== Creating a plugin for Scribus ==


=== Requirements ==
=== Requirements ===
* Knowledge of c++
* Knowledge of c++
== Calling plugin A within plugin B ==
below is an example how to call the "subdivide" plugin from the "tools" plugins :
<pre class='C'>
// 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);
}
</pre>

Latest revision as of 20:15, 3 March 2015


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);
}