36 lines
603 B
C++
36 lines
603 B
C++
#include "triggermodel.h"
|
|
|
|
TriggerModel::TriggerModel(QList<tbTrigger> mtriggers, QObject *parent) :
|
|
QAbstractListModel(parent)
|
|
{
|
|
triggers = mtriggers;
|
|
}
|
|
|
|
|
|
void TriggerModel::refresh(QList<tbTrigger> mtriggers)
|
|
{
|
|
triggers = mtriggers;
|
|
}
|
|
|
|
|
|
int TriggerModel::rowCount(const QModelIndex &) const
|
|
{
|
|
return triggers.count();
|
|
}
|
|
|
|
|
|
QVariant TriggerModel::data(const QModelIndex &index, int role) const
|
|
{
|
|
if (!index.isValid())
|
|
return QVariant();
|
|
|
|
if (index.row() >= triggers.size())
|
|
return QVariant();
|
|
|
|
if (role == Qt::DisplayRole)
|
|
{
|
|
return triggers.at(index.row()).name;
|
|
}
|
|
return QVariant();
|
|
}
|