/** * @RDE_HEADER@ * HMI Plugin for ExerciseManangement - Exercise Overview Dialog Model * $Id$ * $HeadURL$ * $Author$ * Created by Christian Ehrlicher, SLSE, 2016-02-29 */ #include "dev_debug_flags_dialog_model.h" #include namespace DeveloperTools { DebugFlagsDialogModel::DebugFlagsDialogModel(QObject *parent) : LtsWidgets::LtsAbstractTableModel({tr("Name"), tr("Value")} , parent) { refresh(); } void DebugFlagsDialogModel::refresh() { m_vecData.clear(); LtsSessionData::LtsSessionData *sessionData = LtsSessionData::LtsSessionData::getInstance(); const QMap &debugFlags = sessionData->debugFlags(); for (auto i = debugFlags.constBegin(); i != debugFlags.constEnd(); ++i) m_vecData.append({ i.key(), i.value() }); emit dataChanged(QModelIndex(), QModelIndex()); } QVariant DebugFlagsDialogModel::data(const QModelIndex &index, int role) const { if (role != Qt::DisplayRole || !indexIsValid(index)) return QVariant(); const DebugFlag &df = m_vecData.at(index.row()); switch (index.column()) { case DebugFlagsDialogModel::Columns::Name: return df.name; case DebugFlagsDialogModel::Columns::Value: return df.value; } return QVariant(); } } // namespace DeveloperTools