Files
aliendefender/ADeditor/splashmodel.cpp
2010-08-25 23:49:21 +04:00

36 lines
694 B
C++

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