36 lines
598 B
C++
36 lines
598 B
C++
#include "animationmodel.h"
|
|
|
|
AnimationModel::AnimationModel(QList <tbAnimation> manims, QObject *parent) :
|
|
QAbstractListModel(parent)
|
|
{
|
|
anims = manims;
|
|
}
|
|
|
|
|
|
void AnimationModel::refresh(QList<tbAnimation>manims)
|
|
{
|
|
anims = manims;
|
|
}
|
|
|
|
|
|
int AnimationModel::rowCount(const QModelIndex &) const
|
|
{
|
|
return anims.count();
|
|
}
|
|
|
|
|
|
QVariant AnimationModel::data(const QModelIndex &index, int role) const
|
|
{
|
|
if (!index.isValid())
|
|
return QVariant();
|
|
|
|
if (index.row() >= anims.size())
|
|
return QVariant();
|
|
|
|
if (role == Qt::DisplayRole)
|
|
{
|
|
return anims.at(index.row()).id;
|
|
}
|
|
return QVariant();
|
|
}
|