pj_plugin.h
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5  */
6 
7 #ifndef PJ_PLUGIN_H
8 #define PJ_PLUGIN_H
9 
10 #include <QtPlugin>
11 #include <QMenu>
12 #include <QWidget>
13 #include <QDomDocument>
14 #include "PlotJuggler/plotdata.h"
15 
16 namespace PJ
17 {
18 
22 class PlotJugglerPlugin : public QObject
23 {
24 public:
25  PlotJugglerPlugin() = default;
26 
28  virtual const char* name() const = 0;
29 
32  virtual bool isDebugPlugin()
33  {
34  return false;
35  }
36 
41  virtual QWidget* optionsWidget()
42  {
43  return nullptr;
44  }
45 
47  virtual bool xmlSaveState(QDomDocument& doc, QDomElement& parent_element) const
48  {
49  return false;
50  }
51 
53  virtual bool xmlLoadState(const QDomElement& parent_element)
54  {
55  return false;
56  }
57 
58  QDomElement xmlSaveState(QDomDocument& doc) const
59  {
60  QDomElement plugin_elem = doc.createElement("plugin");
61  plugin_elem.setAttribute("ID", this->name());
62  xmlSaveState(doc, plugin_elem);
63  return plugin_elem;
64  }
65 
66  virtual const std::vector<QAction*>& availableActions()
67  {
68  static std::vector<QAction*> empty;
69  return empty;
70  }
71 };
72 
73 } // namespace PJ
74 
75 #endif // PJ_PLUGIN_H
PJ::PlotJugglerPlugin::xmlSaveState
virtual bool xmlSaveState(QDomDocument &doc, QDomElement &parent_element) const
Override this method to save the status of the plugin to XML.
Definition: pj_plugin.h:47
PJ::PlotJugglerPlugin::xmlLoadState
virtual bool xmlLoadState(const QDomElement &parent_element)
Override this method to load the status of the plugin from XML.
Definition: pj_plugin.h:53
PJ::PlotJugglerPlugin
The PlotJugglerPlugin is the base class of all the plugins.
Definition: pj_plugin.h:22
PJ::PlotJugglerPlugin::isDebugPlugin
virtual bool isDebugPlugin()
Definition: pj_plugin.h:32
PJ::PlotJugglerPlugin::optionsWidget
virtual QWidget * optionsWidget()
optionsWidget pointer to a persistent widget used to set the plugin options .
Definition: pj_plugin.h:41
PJ::PlotJugglerPlugin::availableActions
virtual const std::vector< QAction * > & availableActions()
Definition: pj_plugin.h:66
plotdata.h
PJ::PlotJugglerPlugin::PlotJugglerPlugin
PlotJugglerPlugin()=default
PJ
Definition: dataloader_base.h:16
PJ::PlotJugglerPlugin::xmlSaveState
QDomElement xmlSaveState(QDomDocument &doc) const
Definition: pj_plugin.h:58
PJ::PlotJugglerPlugin::name
virtual const char * name() const =0
Name of the plugin type, NOT the particular instance.


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45