MuseScore  3.4
Music composition and notation
knob.h
Go to the documentation of this file.
1 //=============================================================================
2 // Awl
3 // Audio Widget Library
4 //
5 // Copyright (C) 2002-2006 by Werner Schweer and others
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __AWLKNOB_H__
21 #define __AWLKNOB_H__
22 
23 #include "aslider.h"
24 // #include <QtDesigner/QDesignerExportWidget>
25 #include <QIcon>
26 
27 namespace Awl {
28 
29 //---------------------------------------------------------
30 // Knob
31 //
33 //
36 //---------------------------------------------------------
37 
38 class Q_DECL_EXPORT Knob : public AbstractSlider {
39  Q_OBJECT
40  Q_PROPERTY(int spanDegrees READ spanDegrees WRITE setSpanDegrees)
41  Q_PROPERTY(int markSize READ markSize WRITE setMarkSize)
42  Q_PROPERTY(int border READ border WRITE setBorder)
43  Q_PROPERTY(QString text READ text WRITE setText)
44 
45  double _spanDegrees;
46 
47  int _markSize;
48  int _border;
49  QIcon _knobIcon;
50  QPainterPath* points;
51 
52  virtual void paintEvent(QPaintEvent*);
53  virtual void mousePressEvent(QMouseEvent*);
54  virtual void mouseReleaseEvent(QMouseEvent*);
55  virtual void mouseMoveEvent(QMouseEvent*);
56 
57  protected:
58  int startY;
59  QString _text;
60 
61  signals:
62  void sliderPressed(int);
63  void sliderReleased(int);
64 
65  public:
66  Knob(QWidget* parent = 0);
67  ~Knob();
68  virtual QSize sizeHint() const { return QSize(50, 50); }
69  virtual int heightForWidth(int w) const { return w; }
70 
72  QString text() const { return _text; }
73  void setText(const QString& s);
74  QIcon knobIcon() const { return _knobIcon; }
75  void setKnobIcon(const QIcon& icon);
76 
78  double spanDegrees() const { return _spanDegrees; }
79  void setSpanDegrees(double val);
80  int markSize() const { return _markSize; }
81  void setMarkSize(int val);
82  int border() const { return _border; }
83  void setBorder(int val);
84  };
85 
86 }
87 
88 #endif
89 
virtual int heightForWidth(int w) const
Definition: knob.h:69
QIcon knobIcon() const
Definition: knob.h:74
QString text() const
return text decoration
Definition: knob.h:72
int border() const
Definition: knob.h:82
The AwlAbstractSlider class provides an double value within a range.
Definition: aslider.h:39
int markSize() const
Definition: knob.h:80
Base class of all dialer type input widgets.
Definition: knob.h:38
Definition: aslider.cpp:23
double spanDegrees() const
return scale size in degrees
Definition: knob.h:78