IntSlider.hpp
1 #pragma once
2 #include <QProxyStyle>
3 #include <QWidget>
4 
5 #include <score_lib_base_export.h>
6 
7 #include <verdigris>
8 
9 namespace score
10 {
11 class SCORE_LIB_BASE_EXPORT IntSlider : public QWidget
12 {
13  W_OBJECT(IntSlider)
14 public:
15  IntSlider(Qt::Orientation ort, QWidget* widg);
16  IntSlider(QWidget* widg);
17  ~IntSlider() override;
18 
19  void setValue(int val);
20  void setMinimum(int min) { m_min = min; }
21  void setMaximum(int max) { m_max = max; }
22  void setRange(int min, int max, int init)
23  {
24  m_min = min;
25  m_max = max;
26  m_init = init;
27  update();
28  }
29  void setOrientation(Qt::Orientation ort) { m_orientation = ort; }
30 
31  int value() const { return m_value; }
32  int minimum() const { return m_min; }
33  int maximum() const { return m_max; }
34 
35  void valueChanged(int arg_1) E_SIGNAL(SCORE_LIB_BASE_EXPORT, valueChanged, arg_1)
36  void sliderMoved(int arg_1) E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderMoved, arg_1)
37  void sliderReleased() E_SIGNAL(SCORE_LIB_BASE_EXPORT, sliderReleased)
38 
39  void mousePressEvent(QMouseEvent* event) override;
40  void mouseMoveEvent(QMouseEvent* event) override;
41  void mouseReleaseEvent(QMouseEvent* event) override;
42  virtual void createPopup(QPoint pos);
43 
44 protected:
45  void paintEvent(QPaintEvent*) override;
46  void paint(QPainter& p);
47  void paintWithText(const QString& s);
48 
49 private:
50  void updateValue(QPointF mousePos);
51 
52  int m_value{};
53  int m_min{};
54  int m_max{};
55  int m_init{};
56 
57  Qt::Orientation m_orientation{};
58  double m_borderWidth{};
59 };
60 }
Definition: IntSlider.hpp:12
Base toolkit upon which the software is built.
Definition: Application.cpp:90