57 lines
1.4 KiB
C++
Executable File
57 lines
1.4 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* AreaEffectManangement - Functional Area Overview Dialog Model
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Malte Diers, SLSE, 2017-04-06
|
|
*/
|
|
|
|
#include "aes_functional_areas_model.h"
|
|
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
|
#include <QLocale>
|
|
#include <QSet>
|
|
#include <AreaEffectSimulation/aes_translation.h>
|
|
|
|
namespace AreaEffectSimulation
|
|
{
|
|
bool FunctionalAreasModel::initModel(LtsSession::LtsSession *session)
|
|
{
|
|
if (!AesGuiBaseModel::initModel(session))
|
|
return false;
|
|
|
|
connect(m_aesDtc.get(), &Interface::Dtc::functionalAreaChanged,
|
|
this, &FunctionalAreasModel::onDataChanged);
|
|
m_aesDtc->functionalAreas([this](const FunctionalArea &item) { insertRow(item); });
|
|
return true;
|
|
}
|
|
|
|
QVariant FunctionalAreasModel::data(const QModelIndex &index, int role) const
|
|
{
|
|
if (!indexIsValid(index))
|
|
return QVariant();
|
|
|
|
const FunctionalArea &functionalArea = getRowData(index.row());
|
|
|
|
if (index.column() < cntBaseColumns())
|
|
return AesGuiBaseModel::data(functionalArea, index.column(), role);
|
|
|
|
if (role != Qt::DisplayRole)
|
|
return QVariant();
|
|
|
|
switch (index.column())
|
|
{
|
|
case ColType:
|
|
{
|
|
auto fat = m_aesDtc->functionalAreaType(functionalArea.functionalAreaTypeId());
|
|
return trFunctionalAreaTypeName(fat.name());
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
return QVariant();
|
|
}
|
|
|
|
} // namespace AreaEffectSimulation
|