Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+70
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AreaEffectSimulation - Booby Trap Overview Dialog Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, 20-23-07-14
|
||||
*/
|
||||
|
||||
#include "aes_booby_trap_model.h"
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
bool BoobyTrapModel::initModel(LtsSession::LtsSession *session)
|
||||
{
|
||||
if (!AesGuiBaseModel::initModel(session))
|
||||
return false;
|
||||
|
||||
connect(m_aesDtc.get(), &Interface::Dtc::boobyTrapChanged,
|
||||
this, &BoobyTrapModel::onDataChanged);
|
||||
|
||||
fillAvailableChargeIds(ProjectDataManagement::GearClass::BoobyTrap);
|
||||
|
||||
m_aesDtc->boobyTraps([this](const BoobyTrap &item) { insertRow(item); });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant BoobyTrapModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const BoobyTrap &bt = getRowData(index.row());
|
||||
|
||||
if (index.column() < cntBaseColumns())
|
||||
return AesGuiBaseModel::data(bt, index.column(), role);
|
||||
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case ColTriggerRadius:
|
||||
return QLocale().toString(bt.triggerRadius(), 'f', 2);
|
||||
case ColImpactRadius:
|
||||
return QLocale().toString(bt.impactRadius(), 'f', 2);
|
||||
case ColRotationAngle:
|
||||
{
|
||||
if (bt.rotationAngle().is_set())
|
||||
return QLocale().toString(bt.rotationAngle().get(), 'f', 2);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
case ColCentralAngle:
|
||||
{
|
||||
if (bt.centralAngle().is_set())
|
||||
return QLocale().toString(bt.centralAngle().get(), 'f', 2);
|
||||
else
|
||||
return {};
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
Reference in new issue
Block a user