18 #ifndef KEYFRAMESMODEL_H 19 #define KEYFRAMESMODEL_H 21 #include <QAbstractItemModel> 23 #include <MltProperties.h> 24 #include <MltAnimation.h> 29 class KeyframesModel :
public QAbstractItemModel
34 enum InterpolationType {
35 DiscreteInterpolation,
39 Q_ENUM(InterpolationType)
43 NameRole = Qt::UserRole + 1,
55 explicit KeyframesModel(QObject* parent = 0);
56 virtual ~KeyframesModel();
58 int rowCount(
const QModelIndex& parent)
const;
59 int columnCount(
const QModelIndex& parent)
const;
60 QVariant data(
const QModelIndex& index,
int role)
const;
61 QModelIndex index(
int row,
int column = 0,
62 const QModelIndex& parent = QModelIndex())
const;
63 QModelIndex parent(
const QModelIndex& index)
const;
64 QHash<int, QByteArray> roleNames()
const;
65 void load(QmlFilter*, QmlMetadata*);
66 Q_INVOKABLE
bool remove(
int parameterIndex,
int keyframeIndex);
67 int previousKeyframePosition(
int parameterIndex,
int currentPosition);
68 int nextKeyframePosition(
int parameterIndex,
int currentPosition);
69 Q_INVOKABLE
int keyframeIndex(
int parameterIndex,
int currentPosition);
70 Q_INVOKABLE
int parameterIndex(
const QString& propertyName)
const;
71 Q_INVOKABLE
bool setInterpolation(
int parameterIndex,
int keyframeIndex, InterpolationType type);
72 Q_INVOKABLE
bool setPosition(
int parameterIndex,
int keyframeIndex,
int position);
73 Q_INVOKABLE
void addKeyframe(
int parameterIndex,
double value,
int position, InterpolationType type);
74 Q_INVOKABLE
void setKeyframe(
int parameterIndex,
double value,
int position, InterpolationType type);
81 void onFilterChanged(
const QString& property);
82 void onFilterInChanged(
int delta);
83 void onFilterOutChanged(
int delta);
86 QList<QString> m_propertyNames;
87 QmlMetadata* m_metadata;
89 QList<int> m_keyframeCounts;
90 QList<int> m_metadataIndex;
92 int keyframeCount(
int index)
const;
93 void updateNeighborsMinMax(
int parameterIndex,
int keyframeIndex);
96 #endif // KEYFRAMESMODEL_H