##// END OF EJS Templates
Some WIP refactoring, trying to remove TimeController object...
Some WIP refactoring, trying to remove TimeController object SciQLOP core should be usable OOTB without creating controllers objects. Time range should be given on variable creation not taken from a global object. Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r1328:eb278710ae3b
r1345:ce477e992869
Show More
SelectionZoneAction.cpp
77 lines | 2.3 KiB | text/x-c | CppLexer
/ gui / src / Actions / SelectionZoneAction.cpp
#include <Actions/SelectionZoneAction.h>
#include <Visualization/VisualizationSelectionZoneItem.h>
Q_LOGGING_CATEGORY(LOG_SelectionZoneAction, "SelectionZoneAction")
struct SelectionZoneAction::SelectionZoneActionPrivate {
explicit SelectionZoneActionPrivate(const QString &name, const QStringList &subMenuList,
SelectionZoneAction::ExecuteFunction fun)
: m_Name{name}, m_SubMenuList{subMenuList}, m_Fun{std::move(fun)}
{
}
QString m_Name;
QStringList m_SubMenuList;
QKeySequence m_DisplayedShortcut;
SelectionZoneAction::ExecuteFunction m_Fun;
SelectionZoneAction::EnableFunction m_EnableFun = [](auto zones) { return true; };
bool m_FilteringAllowed = true;
};
SelectionZoneAction::SelectionZoneAction(const QString &name, ExecuteFunction fun)
: impl{spimpl::make_unique_impl<SelectionZoneActionPrivate>(name, QStringList{},
std::move(fun))}
{
}
SelectionZoneAction::SelectionZoneAction(const QStringList &subMenuList, const QString &name,
SelectionZoneAction::ExecuteFunction fun)
: impl{spimpl::make_unique_impl<SelectionZoneActionPrivate>(name, subMenuList,
std::move(fun))}
{
}
void SelectionZoneAction::setEnableFunction(EnableFunction fun)
{
impl->m_EnableFun = std::move(fun);
}
void SelectionZoneAction::setDisplayedShortcut(const QKeySequence &shortcut)
{
impl->m_DisplayedShortcut = shortcut;
}
QKeySequence SelectionZoneAction::displayedShortcut() const
{
return impl->m_DisplayedShortcut;
}
QString SelectionZoneAction::name() const noexcept
{
return impl->m_Name;
}
QStringList SelectionZoneAction::subMenuList() const noexcept
{
return impl->m_SubMenuList;
}
void SelectionZoneAction::setAllowedFiltering(bool value)
{
impl->m_FilteringAllowed = value;
}
bool SelectionZoneAction::isFilteringAllowed() const
{
return impl->m_FilteringAllowed;
}
void SelectionZoneAction::execute(const QVector<VisualizationSelectionZoneItem *> &item)
{
impl->m_Fun(item);
}
bool SelectionZoneAction::isEnabled(const QVector<VisualizationSelectionZoneItem *> &item)
{
return impl->m_EnableFun(item);
}