QGraphicsMultiSlider.hpp
1 #pragma once
2 #include <score/graphics/widgets/Constants.hpp>
3 
4 #include <ossia-qt/value_metatypes.hpp>
5 
6 #include <QGraphicsItem>
7 #include <QObject>
8 
9 #include <score_lib_base_export.h>
10 
11 #include <verdigris>
12 namespace ossia
13 {
14 struct domain;
15 }
16 namespace score
17 {
18 template <typename T>
19 struct SliderWrapper;
20 struct RightClickImpl;
21 class SCORE_LIB_BASE_EXPORT QGraphicsMultiSlider final
22  : public QObject
23  , public QGraphicsItem
24 {
25  W_OBJECT(QGraphicsMultiSlider)
26  SCORE_GRAPHICS_ITEM_TYPE(110)
27 public:
28  template <typename T>
29  friend struct SliderWrapper;
30  double min{0.}, max{1.};
31  int m_grab{-1};
32  ossia::value m_value{};
33  ossia::value m_execValue{};
34  bool m_hasExec{};
35  bool moving = false;
36  RightClickImpl* impl{};
37 
38  QGraphicsMultiSlider(QGraphicsItem* parent);
39 
40  void setPoint(const QPointF& r);
41  void setValue(ossia::value v);
42  ossia::value value() const;
43  void setExecutionValue(double v);
44  void resetExecution();
45 
46  void setRange(const ossia::value& min, const ossia::value& max);
47  void setRange(const ossia::domain& dom);
48 
49 public:
50  void sliderMoved() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderMoved)
51  void sliderReleased() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderReleased)
52 
53 private:
54  void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
55  void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
56  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
57  QRectF boundingRect() const override;
58  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
59  override;
60 };
61 }
Definition: QGraphicsMultiSlider.hpp:24
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: DefaultGraphicsSliderImpl.hpp:25
Definition: QGraphicsMultiSlider.cpp:51