1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-09 12:22:34 +01:00
openrw/rwviewer/AnimationListModel.cpp

36 lines
787 B
C++
Raw Normal View History

2014-03-01 12:19:33 +01:00
#include "AnimationListModel.hpp"
QVariant AnimationListModel::data(const QModelIndex& index, int role) const
{
if(role == Qt::DisplayRole) {
2014-06-10 18:51:55 +02:00
if(index.row() >= 0 && (unsigned) index.row() < animations.size()) {
2014-03-01 12:19:33 +01:00
auto& f = animations.at(index.row());
if(index.column() == 0) {
return QString(f.first.c_str());
}
}
}
return QVariant::Invalid;
}
QVariant AnimationListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if(role == Qt::DisplayRole && orientation == Qt::Horizontal) {
if(section == 0) {
return "Name";
}
}
return QVariant::Invalid;
}
int AnimationListModel::rowCount(const QModelIndex& parent) const
{
return animations.size();
}
int AnimationListModel::columnCount(const QModelIndex& parent) const
{
return 1;
}