Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsvganimate_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QSVGANIMATE_P_H
7#define QSVGANIMATE_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include "qsvgnode_p.h"
21#include <QtSvg/private/qsvgabstractanimation_p.h>
22#include <QtSvg/private/qsvgeasinginterface_p.h>
23#include <QtCore/qminmax.h>
24
26
27class Q_SVG_EXPORT QSvgLinearEasing : public QSvgEasingInterface
28{
29public:
30 ~QSvgLinearEasing() override;
31
32 virtual qreal progress(qreal t) const override
33 {
34 return qBound(0., t, 1.);
35 }
36};
37
38class Q_SVG_EXPORT QSvgAnimateNode : public QSvgNode, public QSvgAbstractAnimation
39{
40public:
41 enum Additive
42 {
43 Sum,
44 Replace
45 };
46 enum Fill
47 {
48 Freeze,
49 Remove
50 };
51
52public:
53 QSvgAnimateNode() : QSvgAnimateNode(nullptr) {}
54 explicit QSvgAnimateNode(QSvgNode *parent);
55 ~QSvgAnimateNode() override;
56
57 void setLinkId(const QString &link) { m_linkId = link; }
58 const QString &linkId() const { return m_linkId; }
59
60 virtual AnimationType animationType() const override { return AnimationType::SMIL; }
61 virtual bool isActive() const override { return !finished() || m_fill == Fill::Freeze; }
62
63 void setRunningTime(int startMs, int durMs, int endMs, int by);
64 void setRepeatCount(qreal repeatCount) { setIterationCount(repeatCount); }
65
66 void setFill(Fill fill) { m_fill = fill; }
67 Fill fill() const { return m_fill; }
68
69 void setAdditiveType(Additive additive = Additive::Replace) { m_additive = additive; }
70 Additive additiveType() const { return m_additive; }
71
72 virtual void drawCommand(QPainter *p, QSvgExtraStates &states) override;
73 virtual bool shouldDrawNode(QPainter *p, QSvgExtraStates &states) const override;
74
75protected:
76 qreal m_end;
77 Fill m_fill;
78 Additive m_additive;
79 QString m_linkId;
80};
81
82class Q_SVG_EXPORT QSvgAnimateColor : public QSvgAnimateNode
83{
84public:
85 QSvgAnimateColor() : QSvgAnimateColor(nullptr) {}
86 explicit QSvgAnimateColor(QSvgNode *parent) : QSvgAnimateNode(parent) {}
87 ~QSvgAnimateColor() override;
88
89 virtual Type type() const override { return QSvgNode::AnimateColor; }
90};
91
92class Q_SVG_EXPORT QSvgAnimateTransform : public QSvgAnimateNode
93{
94public:
95 QSvgAnimateTransform() : QSvgAnimateTransform(nullptr) {}
96 explicit QSvgAnimateTransform(QSvgNode *parent) : QSvgAnimateNode(parent) {}
97 ~QSvgAnimateTransform() override;
98
99 virtual Type type() const override { return Type::AnimateTransform; }
100};
101
102QT_END_NAMESPACE
103
104#endif // QSVGANIMATE_P_H
Combined button and popup list for selecting options.