Files
aliendefender/ADeditor/animationmodel.cpp
buull 8fa6b8e2a6 added animation
but not full in ADeditor
2010-09-05 16:25:23 +04:00

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();
}