RoboDK Plug-In Interface
PluginExample Class Reference

The PluginExample class shows the structure of a RoboDK plugin. A RoboDK plugin must implement the IAppRoboDK and the QObject class. More...

#include <pluginexample.h>

Inheritance diagram for PluginExample:
IAppRoboDK

Public Slots

void callback_information ()
 Called when the information button/action is selected. More...
 
void callback_robotpilot ()
 Called when the robot pilot button/action is selected. More...
 
void callback_robotpilot_closed ()
 Called when the robot pilot window is closed (event triggered by the dock window) More...
 
void callback_help ()
 Called when the user select the button/action for help. More...
 

Public Attributes

QMainWindow * MainWindow
 RoboDK's main window pointer. More...
 
QStatusBar * StatusBar
 RoboDK's main status bar pointer. More...
 
RoboDKRDK
 Pointer to the RoboDK API interface. More...
 

Private Member Functions

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 with the plugin). More...
 
virtual void PluginUnload () override
 This function is called once only when the plugin is being unloaded. More...
 
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 after PluginLoad and it can be called when the user changes the view settings (such as changing from cinema to normal mode) or changes the default toolbar layout (in Tools-Toolbar Layout) More...
 
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. More...
 
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 plugin for certain operations (for example, to create native windows within RoboDK application or take advantage of the RoboDK API speed within the plugin). Use the RoboDK API (PluginCommand(plugin_name, command, value) to send specific commands to your plugin from an external application. More...
 
virtual void PluginEvent (TypeEvent event_type) override
 This function is called every time there is a new RoboDK event such as rendering the screen, adding/removing items or changing the active station. If event_type is EventRender you can render your own graphics here using IRoboDK::DrawGeometry. More...
 
- Private Member Functions inherited from IAppRoboDK
virtual QString PluginName ()=0
 Return the plugin name. Try to be creative and make sure the name is unique.
 
virtual bool PluginItemClickMulti (QList< Item > &item_list, QMenu *menu, TypeClick click_type)
 This function is called every time a new context menu is created for a list of items. More...
 

Private Attributes

QToolBar * toolbar1
 Pointer to the customized toolbar. More...
 
QMenu * menu1
 Pointer to the customized menu. More...
 
QAction * action_information
 Information action. callback_information is triggered with this action. Actions are required to populate toolbars and menus and allows getting callbacks. More...
 
QAction * action_robotpilot
 Open robot pilot form action. callback_robotpilot is triggered with this action. Actions are required to populate toolbars and menus and allows getting callbacks. More...
 
QAction * action_help
 Open help action. callback_help is triggered with this action. Actions are required to populate toolbars and menus and allows getting callbacks. More...
 
QDockWidget * dock_robotpilot
 Pointer to the docked window. More...
 
FormRobotPilotform_robotpilot
 Pointer to the robot pilot form. More...
 

Additional Inherited Members

- Private Types inherited from IAppRoboDK
enum  TypeClick {
  ClickNone =-1 , ClickLeft =0 , ClickCtrlLeft =1 , ClickRight =2 ,
  ClickDouble =3
}
 Types of clicks for PluginItemClick function. More...
 
enum  TypeEvent {
  EventRender =1 , EventMoved =2 , EventChanged =3 , EventChangedStation =4 ,
  EventAbout2Save =5 , EventAbout2ChangeStation =6 , EventAbout2CloseStation =7 , EventTrajectoryStep =8
}
 Event types for PluginEvent function. More...
 

Detailed Description

The PluginExample class shows the structure of a RoboDK plugin. A RoboDK plugin must implement the IAppRoboDK and the QObject class.

Definition at line 26 of file pluginexample.h.

Member Function Documentation

◆ callback_help

void callback_help ( )
slot

Called when the user select the button/action for help.

Definition at line 283 of file pluginexample.cpp.

◆ callback_information

void callback_information ( )
slot

Called when the information button/action is selected.

Definition at line 186 of file pluginexample.cpp.

◆ callback_robotpilot

void callback_robotpilot ( )
slot

Called when the robot pilot button/action is selected.

Definition at line 266 of file pluginexample.cpp.

◆ callback_robotpilot_closed

void callback_robotpilot_closed ( )
slot

Called when the robot pilot window is closed (event triggered by the dock window)

Definition at line 277 of file pluginexample.cpp.

◆ PluginCommand()

QString PluginCommand ( const QString &  command,
const QString &  value 
)
overrideprivatevirtual

Specific commands can be passed from the RoboDK API. For example, a parent application can rely on a plugin for certain operations (for example, to create native windows within RoboDK application or take advantage of the RoboDK API speed within the plugin). Use the RoboDK API (PluginCommand(plugin_name, command, value) to send specific commands to your plugin from an external application.

Parameters
command
value
Returns

Reimplemented from IAppRoboDK.

Definition at line 119 of file pluginexample.cpp.

◆ PluginEvent()

void PluginEvent ( TypeEvent  event_type)
overrideprivatevirtual

This function is called every time there is a new RoboDK event such as rendering the screen, adding/removing items or changing the active station. If event_type is EventRender you can render your own graphics here using IRoboDK::DrawGeometry.

Parameters
event_typetype of event (EventRender, EventMoved, EventChanged)

Display/Render the 3D scene. At this moment we can call RDK->DrawGeometry to customize the displayed scene

qDebug() << "Something has moved, such as a robot, reference frame, object or tool. It is very likely that an EventRender will be triggered immediately after this event qDebug() << "==== EventMoved ===="; qDebug() << "An item has been added or deleted. Current station: " << RDK->getActiveStation()->Name(); If we added a new item (for example, a reference frame) it is very likely that an EventMoved will follow with the updated position of the newly added item(s) This event is also triggered when we change the active station and a new station gains focus. Example to check if the station changed and to load settings The user requested to save the project and the RDK file will be saved to disk. It is recommended to save all station-specific settings at this moment. For example, you can use RDK.setParam("ParameterName", "ParameterValue") or RDK.setData("ParameterName", bytearray)

The user requested to open a new RoboDK station (RDK file) or the user is navigating among different stations. This event is triggered before the current station looses focus.

The user requested to close the currently open RoboDK station (RDK file). The RDK file may be saved if the user and the corresponding event will be triggered.

Reimplemented from IAppRoboDK.

Definition at line 132 of file pluginexample.cpp.

◆ PluginItemClick()

bool PluginItemClick ( Item  item,
QMenu *  menu,
TypeClick  click_type 
)
overrideprivatevirtual

This function is called every time a new context menu is created for an item.

Parameters
itemThe Item (IItem) clicked
menuPointer to the context menu
click_typeClick type (usually left click)
Returns

Reimplemented from IAppRoboDK.

Definition at line 102 of file pluginexample.cpp.

◆ PluginLoad()

QString PluginLoad ( QMainWindow *  mw,
QMenuBar *  menubar,
QStatusBar *  statusbar,
RoboDK rdk,
const QString &  settings = "" 
)
overrideprivatevirtual

Load the plugin. This function is called only once when the plugin is loaded (or RoboDK is started with the plugin).

Parameters
mwRoboDK's QMainwindow. Use this object to add menus in the main window.
menubarPointer to RoboDK's main menu bar
statusbarPointer to RoboDK's main status bar
statusbarPointer RoboDK's interface (implementation of the RoboDK API): IRoboDK and IItem
settingsAdditional settings (reserved for future compatibility)

Reimplemented from IAppRoboDK.

Definition at line 27 of file pluginexample.cpp.

◆ PluginLoadToolbar()

void PluginLoadToolbar ( QMainWindow *  mw,
int  iconsize 
)
overrideprivatevirtual

This function is called every time the toolbar is set up. This function is called at least once right after PluginLoad and it can be called when the user changes the view settings (such as changing from cinema to normal mode) or changes the default toolbar layout (in Tools-Toolbar Layout)

Parameters
mwPointer to RoboDK's main window.
iconsizeSize of the toolbar icons. The size may differ depending on the screen's DPI. It can also be set in Tools-Options-Display menu.

Reimplemented from IAppRoboDK.

Definition at line 87 of file pluginexample.cpp.

◆ PluginUnload()

void PluginUnload ( )
overrideprivatevirtual

This function is called once only when the plugin is being unloaded.

Reimplemented from IAppRoboDK.

Definition at line 66 of file pluginexample.cpp.

Member Data Documentation

◆ action_help

QAction* action_help
private

Open help action. callback_help is triggered with this action. Actions are required to populate toolbars and menus and allows getting callbacks.

Definition at line 86 of file pluginexample.h.

◆ action_information

QAction* action_information
private

Information action. callback_information is triggered with this action. Actions are required to populate toolbars and menus and allows getting callbacks.

Definition at line 80 of file pluginexample.h.

◆ action_robotpilot

QAction* action_robotpilot
private

Open robot pilot form action. callback_robotpilot is triggered with this action. Actions are required to populate toolbars and menus and allows getting callbacks.

Definition at line 83 of file pluginexample.h.

◆ dock_robotpilot

QDockWidget* dock_robotpilot
private

Pointer to the docked window.

Definition at line 89 of file pluginexample.h.

◆ form_robotpilot

FormRobotPilot* form_robotpilot
private

Pointer to the robot pilot form.

Definition at line 92 of file pluginexample.h.

◆ MainWindow

QMainWindow* MainWindow

RoboDK's main window pointer.

Definition at line 48 of file pluginexample.h.

◆ menu1

QMenu* menu1
private

Pointer to the customized menu.

Definition at line 77 of file pluginexample.h.

◆ RDK

RoboDK* RDK

Pointer to the RoboDK API interface.

Definition at line 54 of file pluginexample.h.

◆ StatusBar

QStatusBar* StatusBar

RoboDK's main status bar pointer.

Definition at line 51 of file pluginexample.h.

◆ toolbar1

QToolBar* toolbar1
private

Pointer to the customized toolbar.

Definition at line 74 of file pluginexample.h.


The documentation for this class was generated from the following files: