added triggers onTimer
added map view in ADeditor
This commit is contained in:
35
ADeditor/mapmodel.cpp
Normal file
35
ADeditor/mapmodel.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#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();
|
||||
}
|
||||
Reference in New Issue
Block a user