QGraphicsIntSlider.hpp
1 #pragma once
2 #include <score/graphics/widgets/Constants.hpp>
3 #include <score/graphics/widgets/QGraphicsSliderBase.hpp>
4 
5 #include <QGraphicsItem>
6 #include <QObject>
7 
8 #include <score_lib_base_export.h>
9 
10 #include <verdigris>
11 
12 namespace score
13 {
14 class SCORE_LIB_BASE_EXPORT QGraphicsIntSlider final
15  : public QObject
16  , public QGraphicsSliderBase<QGraphicsIntSlider>
17 {
18  W_OBJECT(QGraphicsIntSlider)
19  Q_INTERFACES(QGraphicsItem)
20  friend struct DefaultGraphicsSliderImpl;
22  int m_value{}, m_execValue{};
23  bool m_grab{};
24  bool m_hasExec{};
25 
26 public:
27  int min{}, max{};
28 
29  explicit QGraphicsIntSlider(QGraphicsItem* parent);
30 
31  double from01(double v) const noexcept;
32  double unmap(double v) const noexcept;
33  double map(double v) const noexcept;
34 
35  void setValue(int v);
36  void setExecutionValue(int v);
37  void resetExecution();
38  void setRange(int min, int max);
39  int value() const;
40 
41  bool moving = false;
42 
43 public:
44  void sliderMoved() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderMoved)
45  void sliderReleased() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderReleased)
46 
47 private:
48  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
49  void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
50  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
51  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
52  override;
53  double getHandleX() const;
54  double getExecHandleX() const;
55 };
56 }
Definition: QGraphicsIntSlider.hpp:17
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: DefaultGraphicsSliderImpl.hpp:29
Definition: QGraphicsSliderBase.hpp:17