pqAnimationKeyFrame.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqAnimationKeyFrame.h
5 
6  Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 =========================================================================*/
32 
33 #ifndef pqAnimationKeyFrame_h
34 #define pqAnimationKeyFrame_h
35 
36 #include "pqWidgetsModule.h"
37 
38 #include <QGraphicsItem>
39 #include <QIcon>
40 #include <QObject>
41 class pqAnimationTrack;
42 
43 // represents a key frame
45  : public QObject
46  , public QGraphicsItem
47 {
48  Q_OBJECT
52  Q_PROPERTY(double normalizedStartTime READ normalizedStartTime WRITE setNormalizedStartTime)
56  Q_PROPERTY(double normalizedEndTime READ normalizedEndTime WRITE setNormalizedEndTime)
60  Q_PROPERTY(QVariant startValue READ startValue WRITE setStartValue)
64  Q_PROPERTY(QVariant endValue READ endValue WRITE setEndValue)
68  Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
69  Q_INTERFACES(QGraphicsItem)
70 public:
72  ~pqAnimationKeyFrame() override = default;
73 
74  double normalizedStartTime() const;
75  double normalizedEndTime() const;
76  QVariant startValue() const;
77  QVariant endValue() const;
78  QIcon icon() const;
79 
80  QRectF boundingRect() const override;
81 
82 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
83  void setNormalizedStartTime(double t);
84  void setNormalizedEndTime(double t);
85  void setStartValue(const QVariant&);
86  void setEndValue(const QVariant&);
87  void setIcon(const QIcon& icon);
88  void setBoundingRect(const QRectF& r);
89  void adjustRect(double startPos, double endPos);
90 
91 Q_SIGNALS:
92  void startValueChanged();
93  void endValueChanged();
94  void iconChanged();
95 
96 protected:
100  pqAnimationTrack* parentTrack() const;
101 
102  void paint(QPainter* p, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
103 
104 private:
105  double NormalizedStartTime = 0;
106  double NormalizedEndTime = 1;
107  QVariant StartValue;
108  QVariant EndValue;
109  QIcon Icon;
110 
111  QRectF Rect;
112 };
113 
114 #endif // pqAnimationKeyFrame_h
#define PQWIDGETS_EXPORT
#define const
Definition: zconf.h:238