57 lines
1.2 KiB
C++
Executable File
57 lines
1.2 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* AreaEffectManangement - MineArea Overview Dialog Model
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Mike Wille, SLSE, 2016-09-26
|
|
*/
|
|
|
|
#include "aes_mine_areas_model.h"
|
|
#include <QLocale>
|
|
|
|
namespace AreaEffectSimulation
|
|
{
|
|
|
|
|
|
MineAreasModel::MineAreasModel(QObject *parent)
|
|
: AesGuiBaseModel<MineArea>(parent, {tr("Depth")})
|
|
{}
|
|
|
|
bool MineAreasModel::initModel(LtsSession::LtsSession *session)
|
|
{
|
|
if (!AesGuiBaseModel::initModel(session))
|
|
return false;
|
|
|
|
connect(m_aesDtc.get(), &Interface::Dtc::mineAreaChanged,
|
|
this, &MineAreasModel::onDataChanged);
|
|
m_aesDtc->mineAreas([this](const MineArea &item) { insertRow(item);});
|
|
return true;
|
|
}
|
|
|
|
|
|
QVariant MineAreasModel::data(const QModelIndex &index, int role) const
|
|
{
|
|
if (!indexIsValid(index))
|
|
return QVariant();
|
|
|
|
const MineArea &mine = getRowData(index.row());
|
|
|
|
if (index.column() < cntBaseColumns())
|
|
return AesGuiBaseModel::data(mine, index.column(), role);
|
|
|
|
if (role != Qt::DisplayRole)
|
|
return QVariant();
|
|
|
|
switch (index.column())
|
|
{
|
|
case ColWidth:
|
|
return QLocale().toString(mine.width(), 'f', 2);
|
|
default:
|
|
break;
|
|
}
|
|
return QVariant();
|
|
}
|
|
} // namespace AreaEffectSimulation
|