Skip to content

Writting_plugins

Paweł Salawa edited this page Jan 16, 2018 · 1 revision

Writting new plugins

The easiest way to create your own plugin is to pick up a simplest existing plugin, that is similar to one you want to create, copy it and modify. For example to create new export plugin, it's probably the best to get CsvExport plugin. For import plugin, the CsvImport, and so on, and so on...

Essentials for every plugin

  • Every plugin is a separate Qt project of shared library.
  • Every plugin can be either integrated into Plugins project (official set of plugins) as a subproject, or it can be a independent project. The former one is easier to set up.
  • Plugin's *.pro file has to include plugins.pri from SQLiteStudio3 source code directory. If The plugin is set up as Plugins subproject, the line in plugin's pro file will look like: include($$PWD/../../SQLiteStudio3/plugins.pri)
  • Every plugin requires the plugin class to inherit from specific SQLiteStudio plugin class (see tutorials for specific plugin types to learn which class to inherit)
  • Every plugin requires the SQLITESTUDIO_PLUGIN("mypluginname.json") macro, just after the Q_OBJECT macro in the plugin's class
  • Every plugin requires the mypluginname.json JSON file (click to learn what to put in that file) in the plugins directory, as it is referrenced by above macro.
  • If plugin provides icons or UI form files, they should be included in Qt resources file - just add a mypluginname.qrc file in plugin's project and add UI forms and/or icon files to that resource file.
    • UI form files should be added with /forms resource prefix, so they are available to FormManager
    • Icons should be added with any prefix, it's up to plugin implementation to provide that prefix and file name later for SQLiteStudio (certain plugin types have special method to implement for that)
    • Every plugin that provides any resources in qrc file needs to call Q_INIT_RESOURCE(mypluginname) macro in the Plugin::init() method implementation and Q_CLEANUP_RESOURCE(mypluginname) in the Plugin::deinit() method implementation.

Tutorials by categories

Each subpage from the list below starts with the name of the official plugin that is the best candidate to be copied and modified.

Additional aspects of plugins development

You can’t perform that action at this time.