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