Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @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
|
||||
Reference in new issue
Block a user