2 #include <score/graphics/widgets/Constants.hpp>
4 #include <QGraphicsItem>
7 #include <score_lib_base_export.h>
14 ,
public QGraphicsItem
17 SCORE_GRAPHICS_ITEM_TYPE(200)
22 QRectF m_rect{0., 0., 40., 20.};
25 double m_value{}, m_execValue{};
28 bool m_noValueChangeOnMove{};
31 float min{}, max{}, init{};
35 void setValue(
double r);
36 void setExecutionValue(
double r);
37 void resetExecution();
38 void setRange(
double min,
double max,
double init);
39 void setNoValueChangeOnMove(
bool);
44 double unmap(
double v)
const noexcept {
return (v - min) / (max - min); }
45 double map(
double v)
const noexcept {
return (v * (max - min)) + min; }
48 void sliderMoved() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderMoved)
49 void sliderReleased() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderReleased)
52 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
override;
53 void mousePressEvent(QGraphicsSceneMouseEvent* event)
override;
54 void mouseMoveEvent(QGraphicsSceneMouseEvent* event)
override;
55 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
override;
56 QRectF boundingRect()
const override;
57 void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option, QWidget* widget)
63 ,
public QGraphicsItem
66 SCORE_GRAPHICS_ITEM_TYPE(210)
71 QRectF m_rect{0., 0., 40., 20.};
74 double m_value{}, m_execValue{};
77 bool m_noValueChangeOnMove{};
80 double min{}, max{}, init{};
84 void setValue(
double r);
85 void setExecutionValue(
double r);
86 void resetExecution();
87 void setRange(
double min,
double max,
double init);
88 void setNoValueChangeOnMove(
bool);
93 double unmap(
double v)
const noexcept
95 return (
double(v) -
double(min)) / (double(max) - double(min));
97 double map(
double v)
const noexcept
99 return (
double(v) * (
double(max) -
double(min))) + double(min);
103 void sliderMoved() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderMoved)
104 void sliderReleased() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderReleased)
107 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
override;
108 void mousePressEvent(QGraphicsSceneMouseEvent* event)
override;
109 void mouseMoveEvent(QGraphicsSceneMouseEvent* event)
override;
110 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
override;
111 QRectF boundingRect()
const override;
112 void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option, QWidget* widget)
Definition: QGraphicsSpinbox.hpp:64
Definition: QGraphicsSpinbox.hpp:15
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: DefaultControlImpl.hpp:10
Definition: DefaultGraphicsSpinboxImpl.hpp:24