Files
aliendefender/ADeditor/mapmodel.cpp
buull c898f978da added triggers onTimer
added map view in ADeditor
2010-09-02 23:34:39 +04:00

36 lines
552 B
C++

#include "mapmodel.h"
MapModel::MapModel(QList <tbMap> mmaps, QObject *parent) :
QAbstractListModel(parent)
{
maps = mmaps;
}
void MapModel::refresh(QList <tbMap> mmaps)
{
maps = mmaps;
}
int MapModel::rowCount(const QModelIndex &) const
{
return maps.count();
}
QVariant MapModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (index.row() >= maps.size())
return QVariant();
if (role == Qt::DisplayRole)
{
return maps.at(index.row()).name;
}
return QVariant();
}