Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAnimCurvesModel.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Jouni Pentikäinen <joupent@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef _KIS_ANIMATION_CURVES_MODEL_H
8#define _KIS_ANIMATION_CURVES_MODEL_H
9
10#include <QScopedPointer>
11#include <QAbstractItemModel>
12
14#include "kis_types.h"
15#include "kundo2command.h"
16
18
20public:
23 QColor color() const;
24
25 void setVisible(bool visible);
26 bool visible() const;
27
28private:
29 struct Private;
30 const QScopedPointer<Private> m_d;
31};
32
34{
35 Q_OBJECT
36public:
37 KisAnimCurvesModel(QObject *parent);
38 ~KisAnimCurvesModel() override;
39
41
43 void removeCurve(KisAnimationCurve *curve);
44 void setCurveVisible(KisAnimationCurve *curve, bool visible);
45
46 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
47 QVariant data(const QModelIndex &index, int role) const override;
48 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
49 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
50 bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override;
51
56 void beginCommand(const KUndo2MagicString &text);
57 void endCommand();
58
59 bool adjustKeyframes(const QModelIndexList &indexes, int timeOffset, qreal valueOffset);
60
75
76Q_SIGNALS:
77 void dataAdded(const QModelIndex& index);
78
79protected:
80 KisNodeSP nodeAt(QModelIndex index) const override;
81 QMap<QString, KisKeyframeChannel *> channelsAt(QModelIndex index) const override;
82 KisKeyframeChannel* channelByID(QModelIndex index, const QString &id) const override;
83
84private Q_SLOTS:
85 void slotKeyframeChanged(const KisKeyframeChannel *channel, int time);
86 void slotKeyframeAdded(const KisKeyframeChannel *channel, int time);
87
88private:
89 struct Private;
90 const QScopedPointer<Private> m_d;
91};
92
93// Used to return a range as a QVariant (see KisAnimationCurvesModel::data)
94typedef QPair<qreal,qreal> ChannelLimitsMetatype;
96
97#endif
float value(const T *src, size_t ch)
QPair< qreal, qreal > ChannelLimitsMetatype
Q_DECLARE_METATYPE(ChannelLimitsMetatype)
KisKeyframeChannel * channelByID(QModelIndex index, const QString &id) const override
KisAnimationCurve * addCurve(KisScalarKeyframeChannel *channel)
bool hasConnectionToCanvas() const
const QScopedPointer< Private > m_d
QMap< QString, KisKeyframeChannel * > channelsAt(QModelIndex index) const override
void beginCommand(const KUndo2MagicString &text)
void slotKeyframeAdded(const KisKeyframeChannel *channel, int time)
QVariant data(const QModelIndex &index, int role) const override
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void setCurveVisible(KisAnimationCurve *curve, bool visible)
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override
bool setData(const QModelIndex &index, const QVariant &value, int role) override
void removeCurve(KisAnimationCurve *curve)
KisNodeSP nodeAt(QModelIndex index) const override
bool adjustKeyframes(const QModelIndexList &indexes, int timeOffset, qreal valueOffset)
KisAnimCurvesModel(QObject *parent)
void dataAdded(const QModelIndex &index)
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
void slotKeyframeChanged(const KisKeyframeChannel *channel, int time)
void setVisible(bool visible)
const QScopedPointer< Private > m_d
KisAnimationCurve(KisScalarKeyframeChannel *channel, QColor color)
KisScalarKeyframeChannel * channel() const
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values....
The KisScalarKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisSca...