Module can register action Window adds this action to its menu Clicking the menu item for the action has the expected result But menu structure still needs work (everything is now put into one dropdown menu)
62 lines
1,007 B
C++
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);
|
|
}
|