Basic concept of MenuAction is working

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)
This commit is contained in:
eelke 2019-01-01 11:15:16 +01:00
parent f130c426a1
commit dc8a052544
12 changed files with 220 additions and 28 deletions

View file

@ -1,6 +1,62 @@
#include "MenuAction.h"
#include "MenuAction.h"
MenuAction::MenuAction()
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);
}