Files
qt5-legatus-legacy/Lts/Plugins/AreaEffectSimulation/Gui/GasPipe/aes_gas_pipes_model.cpp
T
2026-08-13 18:33:10 +02:00

65 lines
1.7 KiB
C++
Executable File

/**
* @RDE_HEADER@
* HMI Plugin for AreaEffectSimulation - GasPipe Overview Dialog Model
* $Id$
* $HeadURL$
* $Author$
* Created by hjl, SLSE, 2017-06-19
*/
#include "aes_gas_pipes_model.h"
#include <LtsSession/lts_session_data.h>
#include <FileManagement/flm_translation.h>
namespace AreaEffectSimulation
{
GasPipesModel::GasPipesModel(QObject *parent)
: AesGuiBaseModel<GasPipe>(parent, {})
{
} // end of ctor()
//-----------------------------------------------------------------------------
bool GasPipesModel::initModel(LtsSession::LtsSession *session)
{
DEBUG_LOG(m_logger) << "--- Start GasPipesModel::initModel()";
if (!AesGuiBaseModel::initModel(session))
return false;
connect(m_aesDtc.get(), &AreaEffectSimulation::Interface::Dtc::gasPipeChanged,
this, &GasPipesModel::onDataChanged);
m_aesDtc->gasPipes([this](const GasPipe &item) { insertRow(item); });
return true;
} // end of initModel()
//-----------------------------------------------------------------------------
QVariant GasPipesModel::data(const QModelIndex &index, int role) const
{
if (!indexIsValid(index))
return QVariant();
const GasPipe &item = m_vecData.at(index.row());
if (index.column() < cntBaseColumns())
return AesGuiBaseModel::data(item, index.column(), role);
if (role != Qt::DisplayRole)
return QVariant();
return QVariant();
} // end of data()
//-----------------------------------------------------------------------------
bool GasPipesModel::isFiltered(const GasPipe &data, DataModification modType) const
{
return AesGuiBaseModel::isFiltered(data, modType);
} // end of isFiltered()
//-----------------------------------------------------------------------------
} // namespace AreaEffectSimulation