##// END OF EJS Templates
Add action to remove the selected zone with the "del" buttons
Add action to remove the selected zone with the "del" buttons

File last commit:

r1117:eff9e479c5d5
r1117:eff9e479c5d5
Show More
SelectionZoneAction.cpp
52 lines | 1.4 KiB | text/x-c | CppLexer
/ gui / src / Actions / SelectionZoneAction.cpp
Adds a a gui controller class to manage global actions across the application.
r1111 #include <Actions/SelectionZoneAction.h>
#include <Visualization/VisualizationSelectionZoneItem.h>
Q_LOGGING_CATEGORY(LOG_SelectionZoneAction, "SelectionZoneAction")
struct SelectionZoneAction::SelectionZoneActionPrivate {
explicit SelectionZoneActionPrivate(const QString &name,
SelectionZoneAction::ExecuteFunction fun)
: m_Name{name}, m_Fun{std::move(fun)}
{
}
QString m_Name;
Add action to remove the selected zone with the "del" buttons
r1117 QKeySequence m_DisplayedShortcut;
Adds a a gui controller class to manage global actions across the application.
r1111 SelectionZoneAction::ExecuteFunction m_Fun;
Add a lambda in SeletionZoneAction to enable or disable the action
r1115 SelectionZoneAction::EnableFunction m_EnableFun = [](auto zones) { return true; };
Adds a a gui controller class to manage global actions across the application.
r1111 };
SelectionZoneAction::SelectionZoneAction(const QString &name, ExecuteFunction fun)
: impl{spimpl::make_unique_impl<SelectionZoneActionPrivate>(name, std::move(fun))}
{
}
Add a lambda in SeletionZoneAction to enable or disable the action
r1115 void SelectionZoneAction::setEnableFunction(EnableFunction fun)
{
impl->m_EnableFun = std::move(fun);
}
Add action to remove the selected zone with the "del" buttons
r1117 void SelectionZoneAction::setDisplayedShortcut(const QKeySequence &shortcut)
{
impl->m_DisplayedShortcut = shortcut;
}
QKeySequence SelectionZoneAction::displayedShortcut() const
{
return impl->m_DisplayedShortcut;
}
Adds a a gui controller class to manage global actions across the application.
r1111 QString SelectionZoneAction::name() const noexcept
{
return impl->m_Name;
}
void SelectionZoneAction::execute(const QVector<VisualizationSelectionZoneItem *> &item)
{
impl->m_Fun(item);
}
Add a lambda in SeletionZoneAction to enable or disable the action
r1115
bool SelectionZoneAction::isEnabled(const QVector<VisualizationSelectionZoneItem *> &item)
{
return impl->m_EnableFun(item);
}