QGraphicsNoteChooser.hpp
1 #pragma once
2 #include <score/graphics/widgets/Constants.hpp>
3 
4 #include <QGraphicsItem>
5 #include <QObject>
6 
7 #include <score_lib_base_export.h>
8 
9 #include <verdigris>
10 
11 namespace score
12 {
13 
14 class SCORE_LIB_BASE_EXPORT QGraphicsNoteChooser final
15  : public QObject
16  , public QGraphicsItem
17 {
18  W_OBJECT(QGraphicsNoteChooser)
19  SCORE_GRAPHICS_ITEM_TYPE(120)
20 
21  static constexpr int m_min = 0;
22  static constexpr int m_max = 127;
23  static constexpr double m_width = 30;
24  static constexpr double m_height = 28;
25  QPointF m_startPos{};
26  double m_curValue{};
27  int m_value{};
28  bool m_grab{};
29 
30 public:
31  QGraphicsNoteChooser(QGraphicsItem* parent);
32 
33  void setValue(int v);
34  int value() const;
35 
36  bool moving = false;
37 
38 public:
39  void sliderMoved() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderMoved)
40  void sliderReleased() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderReleased)
41 
42 private:
43  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
44  void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
45  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
46  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
47  override;
48  QRectF boundingRect() const override;
49 };
50 
51 }
Definition: QGraphicsNoteChooser.hpp:17
Base toolkit upon which the software is built.
Definition: Application.cpp:90