added morphs, fix some bugs, new images

added onAlienInRadius trigger
but it not work right((
This commit is contained in:
2011-08-21 22:22:02 +04:00
parent fa68b5a120
commit 894e55bb41
186 changed files with 4040 additions and 3022 deletions

View File

@@ -1,35 +1,42 @@
#include "animationmodel.h"
AnimationModel::AnimationModel(QList <tbAnimation> manims, QObject *parent) :
QAbstractListModel(parent)
AnimationModel::AnimationModel(QHash <int,tbAnimation> &manims, QObject *parent) :
QAbstractListModel(parent), anims(manims)
{
anims = manims;
// anims = manims;
}
void AnimationModel::refresh(QList<tbAnimation>manims)
{
anims = manims;
}
//void AnimationModel::refresh(QList<tbAnimation>manims)
//{
// anims = manims;
//}
int AnimationModel::rowCount(const QModelIndex &) const
{
return anims.count();
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();
if (!index.isValid()) return QVariant();
if (index.row() >= anims.size()) return QVariant();
if (role == Qt::DisplayRole)
return tr("(%1) ").arg(anims.values().at(index.row()).id) + anims[anims.values().at(index.row()).id].name;
if (role == Qt::EditRole)
return anims[anims.values().at(index.row()).id].name;
return QVariant();
}
bool AnimationModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (role != Qt::EditRole) return false;
if (!index.isValid()) return false;
if (index.row() >= anims.size()) return false;
anims[anims.values().at(index.row()).id].name = value.toString();
emit dataChanged(index, index);
return true;
}