before ADeditor correct

This commit is contained in:
unknown
2010-08-25 21:55:42 +04:00
parent 02acdc4d2b
commit 8d6a589224
14 changed files with 868 additions and 702 deletions

34
ADeditor/towermodel.cpp Normal file
View File

@@ -0,0 +1,34 @@
#include "towermodel.h"
TowerModel::TowerModel(QList<tbTower> mtowers, QObject *parent) :
QAbstractListModel(parent)
{
towers = mtowers;
}
void TowerModel::refresh(QList<tbTower> mtowers)
{
towers = mtowers;
}
int TowerModel::rowCount(const QModelIndex &) const
{
return towers.count();
}
QVariant TowerModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (index.row() >= towers.size())
return QVariant();
if (role == Qt::DisplayRole)
{
return towers.at(index.row()).name;
}
return QVariant();
}