RoboDK Plug-In Interface
pluginexample.h
1#ifndef PLUGINEXAMPLE_H
2#define PLUGINEXAMPLE_H
3
4
5#include <QObject>
6#include <QtPlugin>
7#include <QDockWidget>
8#include "iapprobodk.h"
9#include "robodktypes.h"
10
11
12
13class QToolBar;
14class QMenu;
15class QAction;
16class IRoboDK;
17class IItem;
18class FormRobotPilot;
19
26class PluginExample : public QObject, IAppRoboDK
27{
28 Q_OBJECT
29 Q_PLUGIN_METADATA(IID "RoboDK.IAppRoboDK")// FILE "metadatalugin.json")
30 Q_INTERFACES(IAppRoboDK)
31
32public:
33 //------------------------------- RoboDK Plug-in Interface commands ------------------------------
34
35 QString PluginName(void) override;
36 virtual QString PluginLoad(QMainWindow *mw, QMenuBar *menubar, QStatusBar *statusbar, RoboDK *rdk, const QString &settings="") override;
37 virtual void PluginUnload() override;
38 virtual void PluginLoadToolbar(QMainWindow *mw, int icon_size) override;
39 virtual bool PluginItemClick(Item item, QMenu *menu, TypeClick click_type) override;
40 virtual QString PluginCommand(const QString &command, const QString &value) override;
41 virtual void PluginEvent(TypeEvent event_type) override;
42
43 //----------------------------------------------------------------------------------
44
45// Recommended pointers to use in your plugin:
46public:
48 QMainWindow *MainWindow;
49
51 QStatusBar *StatusBar;
52
55
56public slots:
57 // define button callbacks (or slots) here. They are triggered automatically when the button is selected.
58
61
64
67
69 void callback_help();
70
71// define your actions: usually, one action per button
72private:
74 QToolBar *toolbar1;
75
77 QMenu *menu1;
78
81
84
86 QAction *action_help;
87
89 QDockWidget *dock_robotpilot;
90
93};
95
96
97#endif // PLUGINEXAMPLE_H
Interface to RoboDK. Each plugin must implement this class to establish the interface to RoboDK....
Definition: iapprobodk.h:189
TypeEvent
Event types for PluginEvent function.
Definition: iapprobodk.h:212
virtual QString PluginName()=0
Return the plugin name. Try to be creative and make sure the name is unique.
TypeClick
Types of clicks for PluginItemClick function.
Definition: iapprobodk.h:193
The Item class represents an item in RoboDK station. An item can be a robot, a frame,...
Definition: iitem.h:14
This class is the iterface to the RoboDK API. With the RoboDK API you can automate certain tasks and ...
Definition: irobodk.h:14
The PluginExample class shows the structure of a RoboDK plugin. A RoboDK plugin must implement the IA...
Definition: pluginexample.h:27
virtual void PluginEvent(TypeEvent event_type) override
This function is called every time there is a new RoboDK event such as rendering the screen,...
void callback_information()
Called when the information button/action is selected.
QDockWidget * dock_robotpilot
Pointer to the docked window.
Definition: pluginexample.h:89
void callback_robotpilot()
Called when the robot pilot button/action is selected.
FormRobotPilot * form_robotpilot
Pointer to the robot pilot form.
Definition: pluginexample.h:92
QToolBar * toolbar1
Pointer to the customized toolbar.
Definition: pluginexample.h:74
void callback_help()
Called when the user select the button/action for help.
virtual void PluginUnload() override
This function is called once only when the plugin is being unloaded.
QMainWindow * MainWindow
RoboDK's main window pointer.
Definition: pluginexample.h:48
QStatusBar * StatusBar
RoboDK's main status bar pointer.
Definition: pluginexample.h:51
void callback_robotpilot_closed()
Called when the robot pilot window is closed (event triggered by the dock window)
QAction * action_robotpilot
Open robot pilot form action. callback_robotpilot is triggered with this action. Actions are required...
Definition: pluginexample.h:83
QMenu * menu1
Pointer to the customized menu.
Definition: pluginexample.h:77
RoboDK * RDK
Pointer to the RoboDK API interface.
Definition: pluginexample.h:54
virtual QString PluginCommand(const QString &command, const QString &value) override
Specific commands can be passed from the RoboDK API. For example, a parent application can rely on a ...
virtual bool PluginItemClick(Item item, QMenu *menu, TypeClick click_type) override
This function is called every time a new context menu is created for an item.
QAction * action_help
Open help action. callback_help is triggered with this action. Actions are required to populate toolb...
Definition: pluginexample.h:86
virtual Q_PLUGIN_METADATA(IID "RoboDK.IAppRoboDK") public QString PluginLoad(QMainWindow *mw, QMenuBar *menubar, QStatusBar *statusbar, RoboDK *rdk, const QString &settings="") override
Load the plugin. This function is called only once when the plugin is loaded (or RoboDK is started wi...
virtual void PluginLoadToolbar(QMainWindow *mw, int icon_size) override
This function is called every time the toolbar is set up. This function is called at least once right...
QAction * action_information
Information action. callback_information is triggered with this action. Actions are required to popul...
Definition: pluginexample.h:80