Radium Engine  1.5.0
TimelineScrollArea.hpp
1 #pragma once
2 #include <QScrollArea>
3 
4 #include <Core/CoreMacros.hpp>
5 
6 namespace Ra::Gui {
7 
15 class TimelineScrollArea : public QScrollArea
16 {
17  Q_OBJECT
18  public:
19  explicit TimelineScrollArea( QWidget* parent = nullptr );
20 
22  Scalar getMaxDuration();
23 
25  void setMaxDuration( Scalar duration );
26 
28  Scalar getStep();
29 
31  int getNbInterval();
32 
34  Scalar getPixPerSec();
35 
37  int getZero();
38 
39  signals:
42  void stepChanged( Scalar step );
43 
45  void addKeyFrame();
46 
49 
52 
54  void nextKeyFrame();
55 
58 
61 
64 
66  void undo();
67 
69  void redo();
70 
71  public slots:
73  void onDrawRuler( int width );
74 
75  protected:
76  void keyPressEvent( QKeyEvent* event ) override;
77 
78  void wheelEvent( QWheelEvent* event ) override;
79 
80  void mousePressEvent( QMouseEvent* event ) override;
81  void mouseReleaseEvent( QMouseEvent* event ) override;
82  void mouseMoveEvent( QMouseEvent* event ) override;
83 
84  private:
85  int m_mousePosX { 0 };
86  int m_sliderPos { 0 };
87 
88  Scalar m_maxDuration { 20_ra };
89  int m_nbInterval { 0 };
90  Scalar m_step { 1 };
91  Scalar m_pixPerSec { 10 };
92  int m_zero { 20 };
93 
95  static constexpr int s_nbSteps = 13;
96 
98  static constexpr Scalar s_steps[s_nbSteps] = { 0.01_ra,
99  0.02_ra,
100  0.05_ra,
101  0.1_ra,
102  0.2_ra,
103  0.5_ra,
104  1.0_ra,
105  2.0_ra,
106  5.0_ra,
107  10.0_ra,
108  20.0_ra,
109  50.0_ra,
110  100.0_ra };
111 };
112 
113 } // namespace Ra::Gui
void togglePlayPause()
Emitted when [space] is pressed.
void setMaxDuration(Scalar duration)
Set the end of the Timeline's playzone.
void redo()
Emitted when [crtl] + [shift] + [z] / [r] key is pressed.
void previousKeyFrame()
Emitted when [left_arrow] is pressed or [shift] + [wheel-up].
void addKeyFrame()
Emitted when [i] is pressed.
void stepChanged(Scalar step)
void onDrawRuler(int width)
Force redraw with the given width.
void durationIncrement()
Emitted when [up_arrow] is pressed.
void undo()
Emitted when [crtl] + [z] / [u] key is pressed.
void removeKeyFrame()
Emitted when [del] / [shift]+[i] is pressed.
void nextKeyFrame()
Emitted when [right_arrow] is pressed or [shift] + [wheel-down].
void durationDecrement()
Emitted when [down_arrow] is pressed.