Loading...
Searching...
No Matches
QGraphicsLogKnob.hpp
1#pragma once
2#include <score/graphics/widgets/Constants.hpp>
3
4#include <QGraphicsItem>
5#include <QObject>
6
7#include <score_lib_base_export.h>
8
9#include <verdigris>
10
11namespace score
12{
13class SCORE_LIB_BASE_EXPORT QGraphicsLogKnob final
14 : public QObject
15 , public QGraphicsItem
16{
17 W_OBJECT(QGraphicsLogKnob)
18 SCORE_GRAPHICS_ITEM_TYPE(90)
19 friend struct DefaultControlImpl;
20 friend struct DefaultGraphicsKnobImpl;
21
22 double m_value{};
23 double m_execValue{};
24 QRectF m_rect{defaultKnobSize};
25
26public:
27 double min{}, max{}, init{};
28
29private:
30 bool m_grab{};
31 bool m_hasExec{};
32
33public:
34 explicit QGraphicsLogKnob(QGraphicsItem* parent);
36
37 double map(double v) const noexcept;
38 double unmap(double v) const noexcept;
39
40 void setRect(const QRectF& r);
41 void setRange(double min, double max, double init);
42 void setValue(double v);
43 double value() const;
44 void setExecutionValue(double v);
45 void resetExecution();
46
47 QRectF boundingRect() const override;
48
49 bool moving = false;
50
51public:
52 void sliderMoved() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderMoved)
53 void sliderReleased() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderReleased)
54
55private:
56 void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
57 void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
58 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) override;
59 void contextMenuEvent(QGraphicsSceneContextMenuEvent* event) override;
60 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
61
62 void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
63 override;
64};
65}
Definition QGraphicsLogKnob.hpp:16
Base toolkit upon which the software is built.
Definition Application.cpp:90
Definition DefaultControlImpl.hpp:10
Definition DefaultGraphicsKnobImpl.hpp:24