Proof of concept for having the context actions statically defined in the module.
Needs work for correctly placing the items in menu and on toolbar. Old system still needs to be removed left in place to keep app useable.
This commit is contained in:
parent
7f09d5fe07
commit
601d071d0f
21 changed files with 303 additions and 70 deletions
|
|
@ -1,67 +1,75 @@
|
|||
#include "StaticAction.h"
|
||||
|
||||
StaticAction::StaticAction(QString text, Func func)
|
||||
: m_text(std::move(text))
|
||||
, m_func(std::move(func))
|
||||
BaseAction::BaseAction(const QString &text)
|
||||
: m_text(text)
|
||||
{}
|
||||
|
||||
const QIcon& StaticAction::icon() const
|
||||
const QIcon& BaseAction::icon() const
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
const MenuLocation& StaticAction::menuLocation() const
|
||||
const MenuLocation& BaseAction::menuLocation() const
|
||||
{
|
||||
return m_menuLocation;
|
||||
}
|
||||
|
||||
void StaticAction::setIcon(QIcon icon)
|
||||
void BaseAction::setIcon(QIcon icon)
|
||||
{
|
||||
m_icon = std::move(icon);
|
||||
}
|
||||
|
||||
void StaticAction::setMenuLocation(MenuLocation menu_location)
|
||||
void BaseAction::setMenuLocation(MenuLocation menu_location)
|
||||
{
|
||||
m_menuLocation = std::move(menu_location);
|
||||
}
|
||||
|
||||
void StaticAction::setToolbarLocation(ToolbarLocation toolbar_location)
|
||||
void BaseAction::setToolbarLocation(ToolbarLocation toolbar_location)
|
||||
{
|
||||
m_toolbarLocation = toolbar_location;
|
||||
}
|
||||
|
||||
void StaticAction::setShortcut(QKeySequence shortcut)
|
||||
void BaseAction::setShortcut(QKeySequence shortcut)
|
||||
{
|
||||
m_shortcut = std::move(shortcut);
|
||||
}
|
||||
|
||||
void StaticAction::setText(QString text)
|
||||
void BaseAction::setText(QString text)
|
||||
{
|
||||
m_text = std::move(text);
|
||||
}
|
||||
|
||||
void StaticAction::setToolTip(QString tooltip)
|
||||
void BaseAction::setToolTip(QString tooltip)
|
||||
{
|
||||
m_toolTip = std::move(tooltip);
|
||||
}
|
||||
|
||||
const QKeySequence& StaticAction::shortcut() const
|
||||
const QKeySequence& BaseAction::shortcut() const
|
||||
{
|
||||
return m_shortcut;
|
||||
}
|
||||
|
||||
const QString& StaticAction::text() const
|
||||
const QString& BaseAction::text() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
const QString& StaticAction::toolTip() const
|
||||
const QString& BaseAction::toolTip() const
|
||||
{
|
||||
return m_toolTip;
|
||||
}
|
||||
|
||||
StaticAction::StaticAction(QString text, Func func)
|
||||
: BaseAction(std::move(text))
|
||||
, m_func(std::move(func))
|
||||
{}
|
||||
|
||||
void StaticAction::perform(IPluginContentWidgetContext *context) const
|
||||
{
|
||||
if (m_func)
|
||||
m_func(context);
|
||||
}
|
||||
|
||||
|
||||
ContextBaseAction::~ContextBaseAction()
|
||||
{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue