pgLab/pglab/plugin_support/MenuAction.cpp
eelke f4f2474a81 Moved definition of widget instance actions to the module so other parts of the system can no about them.
The plugin system will create the Action objects and bind them to the specified slots of the
specific widget instances.
2019-01-05 19:58:23 +01:00

62 lines
1,007 B
C++

#include "MenuAction.h"
MenuAction::MenuAction(QString text, Func func)
: m_text(std::move(text))
, m_func(std::move(func))
{}
const QIcon& MenuAction::icon() const
{
return m_icon;
}
const MenuLocation& MenuAction::menuLocation() const
{
return m_menuLocation;
}
void MenuAction::setIcon(QIcon icon)
{
m_icon = std::move(icon);
}
void MenuAction::setMenuLocation(MenuLocation menu_location)
{
m_menuLocation = std::move(menu_location);
}
void MenuAction::setShortcut(QKeySequence shortcut)
{
m_shortcut = std::move(shortcut);
}
void MenuAction::setText(QString text)
{
m_text = std::move(text);
}
void MenuAction::setToolTip(QString tooltip)
{
m_toolTip = std::move(tooltip);
}
const QKeySequence& MenuAction::shortcut() const
{
return m_shortcut;
}
const QString& MenuAction::text() const
{
return m_text;
}
const QString& MenuAction::toolTip() const
{
return m_toolTip;
}
void MenuAction::perform(IPluginContentWidgetContext *context) const
{
if (m_func)
m_func(context);
}