1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
4 #include "CharacterAnimationsModel.h"
6 #include <CryAnimation/ICryAnimation.h>
8 int CCharacterAnimationsModel::rowCount(const QModelIndex
& parent
) const
10 if (!parent
.isValid())
12 return m_animationSet
.GetAnimationCount();
17 int CCharacterAnimationsModel::columnCount(const QModelIndex
& parent
) const
22 QVariant
CCharacterAnimationsModel::data(const QModelIndex
& index
, int role
) const
24 if (index
.isValid() && index
.row() < m_animationSet
.GetAnimationCount())
30 switch (index
.column())
33 return m_animationSet
.GetNameByAnimID(index
.row());
36 case Qt::DecorationRole
:
45 QVariant
CCharacterAnimationsModel::headerData(int section
, Qt::Orientation orientation
, int role
) const
47 if (orientation
== Qt::Horizontal
&& role
== Qt::DisplayRole
)
52 return QObject::tr("Animation Name");
60 QModelIndex
CCharacterAnimationsModel::index(int row
, int column
, const QModelIndex
& parent
) const
62 if (row
>= 0 && row
< m_animationSet
.GetAnimationCount())
64 return QAbstractItemModel::createIndex(row
, column
, reinterpret_cast<quintptr
>(m_animationSet
.GetNameByAnimID(row
)));
69 QModelIndex
CCharacterAnimationsModel::parent(const QModelIndex
& index
) const