Loading...
Searching...
No Matches
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
12namespace score
13{
14class SCORE_LIB_BASE_EXPORT QGraphicsIntSlider final
15 : public QObject
16 , public QGraphicsSliderBase<QGraphicsIntSlider>
17{
18 W_OBJECT(QGraphicsIntSlider)
19 SCORE_GRAPHICS_ITEM_TYPE(60)
20 friend struct DefaultControlImpl;
21 friend struct DefaultGraphicsSliderImpl;
23 int m_value{}, m_execValue{};
24 bool m_grab{};
25 bool m_hasExec{};
26
27public:
28 int min{}, max{}, init{};
29
30 explicit QGraphicsIntSlider(QGraphicsItem* parent);
32
33 double from01(double v) const noexcept;
34 double unmap(double v) const noexcept;
35 double map(double v) const noexcept;
36
37 void setValue(int v);
38 void setExecutionValue(int v);
39 void resetExecution();
40 void setRange(int min, int max, int init);
41 int value() const;
42
43 bool moving = false;
44
45public:
46 void sliderMoved() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderMoved)
47 void sliderReleased() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderReleased)
48
49private:
50 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
51 void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
52 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
53 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
54 override;
55 double getHandleX() const;
56 double getExecHandleX() const;
57};
58}
Definition QGraphicsIntSlider.hpp:17
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition DefaultControlImpl.hpp:10
Definition DefaultGraphicsSliderImpl.hpp:31
Definition QGraphicsSliderBase.hpp:17