TimeSpinBox.hpp
1 #pragma once
2 #include <score/widgets/TimeMode.hpp>
3 
4 #include <ossia-qt/time.hpp>
5 
6 #include <QWidget>
7 
8 #include <score_lib_base_export.h>
9 
10 class QStyleOptionFrame;
11 
12 namespace score
13 {
20 struct BarSpinBox;
21 struct SecondSpinBox;
22 struct FlicksSpinBox;
23 
24 class SCORE_LIB_BASE_EXPORT TimeSpinBox final : public QWidget
25 {
26  W_OBJECT(TimeSpinBox)
27 public:
28  TimeSpinBox(QWidget* parent = nullptr);
29  ~TimeSpinBox();
30 
31  void setMinimumTime(ossia::time_value t);
32  void setMaximumTime(ossia::time_value t);
33  void setTime(ossia::time_value t);
34  ossia::time_value time() const noexcept;
35  void timeChanged(ossia::time_value t) E_SIGNAL(SCORE_LIB_BASE_EXPORT, timeChanged, t)
36  void editingFinished() E_SIGNAL(SCORE_LIB_BASE_EXPORT, editingFinished)
37  void wheelEvent(QWheelEvent* event) override;
38 
39  void mousePressEvent(QMouseEvent* event) override;
40  void mouseReleaseEvent(QMouseEvent* event) override;
41  void mouseDoubleClickEvent(QMouseEvent* event) override;
42  void mouseMoveEvent(QMouseEvent* event) override;
43  void paintEvent(QPaintEvent* event) override;
44  void initStyleOption(QStyleOptionFrame* option) const noexcept;
45  QSize sizeHint() const override;
46  QSize minimumSizeHint() const override;
47 
48 private:
49  void updateTime();
50  QPoint m_startPos{};
51  int64_t m_prevY{};
52  int64_t m_travelledY{};
53 
54  int64_t m_origFlicks{};
55  int64_t m_flicks{};
56 
57  ossia::bar_time m_barTime{};
58 
59  enum GrabbedHandle
60  {
61  None,
62  Bar,
63  Quarter,
64  Semiquaver,
65  Cent
66  } m_grab{None};
67 
68  friend struct BarSpinBox;
69  friend struct SecondSpinBox;
70  friend struct FlicksSpinBox;
71 };
72 }
Definition: TimeSpinBox.hpp:25
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: SpinBoxes.cpp:40
Definition: SpinBoxes.cpp:350
Definition: SpinBoxes.cpp:211