added animation
but not full in ADeditor
This commit is contained in:
35
ADeditor/animationmodel.cpp
Normal file
35
ADeditor/animationmodel.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#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();
|
||||
}
|
||||
Reference in New Issue
Block a user