##// END OF EJS Templates
Adds plugin column to variable widget...
Adds plugin column to variable widget To retrieve the "plugin" field, we add to the metadata of the variable the name of the data source root item

File last commit:

r257:40b3607afb8e
r551:b0a7e1650d9f
Show More
DataSourceItemAction.cpp
44 lines | 1.3 KiB | text/x-c | CppLexer
/ core / src / DataSource / DataSourceItemAction.cpp
#include <DataSource/DataSourceItemAction.h>
#include <functional>
Q_LOGGING_CATEGORY(LOG_DataSourceItemAction, "DataSourceItemAction")
struct DataSourceItemAction::DataSourceItemActionPrivate {
explicit DataSourceItemActionPrivate(const QString &name,
DataSourceItemAction::ExecuteFunction fun)
: m_Name{name}, m_Fun{std::move(fun)}, m_DataSourceItem{nullptr}
{
}
QString m_Name;
DataSourceItemAction::ExecuteFunction m_Fun;
/// Item associated to the action (can be null, in which case the action will not be executed)
DataSourceItem *m_DataSourceItem;
};
DataSourceItemAction::DataSourceItemAction(const QString &name, ExecuteFunction fun)
: impl{spimpl::make_unique_impl<DataSourceItemActionPrivate>(name, std::move(fun))}
{
}
QString DataSourceItemAction::name() const noexcept
{
return impl->m_Name;
}
void DataSourceItemAction::setDataSourceItem(DataSourceItem *dataSourceItem) noexcept
{
impl->m_DataSourceItem = dataSourceItem;
}
void DataSourceItemAction::execute()
{
if (impl->m_DataSourceItem) {
impl->m_Fun(*impl->m_DataSourceItem);
}
else {
qCDebug(LOG_DataSourceItemAction())
<< tr("Can't execute action : no item has been associated");
}
}