2014-03-01 12:19:33 +01:00
|
|
|
#include "AnimationListModel.hpp"
|
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
QVariant AnimationListModel::data(const QModelIndex& index, int role) const {
|
|
|
|
if (role == Qt::DisplayRole) {
|
2018-07-27 22:53:35 +02:00
|
|
|
if (index.row() >= 0 &&
|
|
|
|
static_cast<unsigned>(index.row()) < animations.size()) {
|
2016-09-09 22:13:21 +02:00
|
|
|
auto& f = animations.at(index.row());
|
|
|
|
if (index.column() == 0) {
|
|
|
|
return QString(f.first.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return QVariant::Invalid;
|
2014-03-01 12:19:33 +01:00
|
|
|
}
|
|
|
|
|
2016-09-09 22:13:21 +02:00
|
|
|
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;
|
2014-03-01 12:19:33 +01:00
|
|
|
}
|
|
|
|
|
2017-10-27 17:38:36 +02:00
|
|
|
int AnimationListModel::rowCount(const QModelIndex&) const {
|
2018-08-30 02:19:38 +02:00
|
|
|
return static_cast<int>(animations.size());
|
2014-03-01 12:19:33 +01:00
|
|
|
}
|
|
|
|
|
2017-10-27 17:38:36 +02:00
|
|
|
int AnimationListModel::columnCount(const QModelIndex&) const {
|
2016-09-09 22:13:21 +02:00
|
|
|
return 1;
|
2014-03-01 12:19:33 +01:00
|
|
|
}
|