pqAnimationTrack.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
5 #ifndef pqAnimationTrack_h
6 #define pqAnimationTrack_h
7 
8 #include "pqWidgetsModule.h"
9 
10 #include "vtkParaViewDeprecation.h" // for PARAVIEW_DEPRECATED_IN_5_12_0
11 
12 #include <QGraphicsItem>
13 #include <QList>
14 #include <QObject>
15 
17 
18 // represents a track
20  "See `pqTimeManagerWidget` for new design. See also pqTimelineItemDelegate")
22  : public QObject
23  , public QGraphicsItem
24 {
25  Q_OBJECT
26  Q_INTERFACES(QGraphicsItem)
30  Q_PROPERTY(QVariant property READ property WRITE setProperty)
31 public:
32  pqAnimationTrack(QObject* p = nullptr);
33  ~pqAnimationTrack() override;
34 
38  int count();
42  pqAnimationKeyFrame* keyFrame(int);
43 
47  pqAnimationKeyFrame* addKeyFrame();
51  void removeKeyFrame(pqAnimationKeyFrame* frame);
52 
53  bool isDeletable() const { return this->Deletable; }
54  void setDeletable(bool d) { this->Deletable = d; }
55 
56  QVariant property() const;
57 
58  QRectF boundingRect() const override;
59 
60 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
61  void setProperty(const QVariant& p);
62 
63  void setBoundingRect(const QRectF& r);
64 
65  void setEnabled(bool enable)
66  {
67  this->QGraphicsItem::setEnabled(enable);
68  Q_EMIT this->enabledChanged();
69  }
70 
71 Q_SIGNALS:
72  void propertyChanged();
73  void enabledChanged();
74 
75 protected:
76  void paint(QPainter* p, const QStyleOptionGraphicsItem* option, QWidget* widget) override;
77 
78 private:
79  bool Deletable = true;
80  QList<pqAnimationKeyFrame*> Frames;
81  QVariant Property;
82 
83  QRectF Rect;
84 };
85 
86 #endif // pqAnimationTrack_h
void setEnabled(bool enable)
#define PARAVIEW_DEPRECATED_IN_5_12_0(reason)
pqTimelineItemDelegate draws timeline in cells and add some associated widgets.
#define PQWIDGETS_EXPORT
void setDeletable(bool d)
pqTimeManagerWidget is the main widget for the Time Manager dock.