QGraphicsXYZSpinbox.hpp
1 #pragma once
2 #include <score/graphics/widgets/Constants.hpp>
3 #include <score/graphics/widgets/QGraphicsSpinbox.hpp>
4 
5 #include <ossia-qt/value_metatypes.hpp>
6 
7 #include <QGraphicsItem>
8 #include <QObject>
9 
10 #include <score_lib_base_export.h>
11 
12 #include <verdigris>
13 
14 namespace score
15 {
16 class SCORE_LIB_BASE_EXPORT QGraphicsXYZSpinboxChooser final
17  : public QObject
18  , public QGraphicsItem
19 {
21  SCORE_GRAPHICS_ITEM_TYPE(290)
22  QRectF m_rect{0., 0., 150., 24.};
23  QGraphicsSpinbox m_x, m_y, m_z;
24 
25 public:
26  explicit QGraphicsXYZSpinboxChooser(QGraphicsItem* parent);
28 
29  void setPoint(const QPointF& r);
30  void setValue(std::array<float, 3> v);
31  void setValue(std::array<double, 3> v);
32  void setRange(
33  ossia::vec3f min = {0.f, 0.f, 0.f}, ossia::vec3f max = {1.f, 1.f, 1.f},
34  ossia::vec3f init = {0.f, 0.f, 0.f});
35  std::array<double, 3> value() const noexcept;
36  std::array<double, 3> getMin() const noexcept;
37  std::array<double, 3> getMax() const noexcept;
38 
39  bool moving = false;
40 
41 public:
42  void sliderMoved() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderMoved)
43  void sliderReleased() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderReleased)
44 
45 private:
46  std::array<double, 3> scaledValue(double x, double y, double z) const noexcept;
47  QRectF boundingRect() const override;
48  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
49  override;
50 };
51 }
Definition: QGraphicsSpinbox.hpp:15
Definition: QGraphicsXYZSpinbox.hpp:19
Base toolkit upon which the software is built.
Definition: Application.cpp:90