Next Previous Contents

5. Plugins

Plugins, in QScanPlot, are just objects that have a single function f(x) that can be used to get different values from the X or Y of a curve, at export time.

You can create new plugins from the shell or directly from QScanPlot.

In order to create new plugins from QScanPlot, you will have to set your "Plugins Directory", in the Options/Preferences dialog, to the correct place. Then, select the option "Create Plugin" from the Tools menu.

In the dialog shown, you can enter the definition of the actual function that does the real job, f(x), in C++. As a hint, by default is shown the body of a function that returns x+1 for a given x.

You must note several things:

  1. The mathematical library will be included, so you already can use functions like sin(x), cos(x), ... in your new function
  2. Since this function will be afterwards included in the body of a C++ class, it can be as complex as you like
  3. You must enter well formed C++ code; that is, if the code does not compile, don't expect to have your new plugin

In the case you want to create your plugin from outside QScanPlot, there exist a simple template, myplugin.cpp. Just create a copy of your template with the name of your new plugin, change MyPlugin wherever it appears with the name of your new plugin, and fill in the function f(x) with the appropriate code. Once you're done, write make-plugin.sh myplugin from the shell (where, again, myplugin must be replaced your your plugin name).


Next Previous Contents