SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
valuedial.h
Go to the documentation of this file.
1 // Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
3 // written by Christian Daniel //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
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 V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #include <QWidget>
20 #include <QTimer>
21 #include "gui/colormapper.h"
22 #include "export.h"
23 
24 class SDRGUI_API ValueDial : public QWidget {
25  Q_OBJECT
26 
27 public:
28  ValueDial(QWidget* parent = NULL, ColorMapper colorMapper = ColorMapper(ColorMapper::Normal));
29 
30  void setValue(quint64 value);
31  void setValueRange(uint numDigits, quint64 min, quint64 max);
32  void setFont(const QFont& font);
33  void setBold(bool bold);
34  void setColorMapper(ColorMapper colorMapper);
35  quint64 getValue() const { return m_value; }
36  quint64 getValueNew() const { return m_valueNew; }
37 
38 signals:
39  void changed(quint64 value);
40 
41 private:
42  QLinearGradient m_background;
48  int m_cursor;
50  quint64 m_value;
51  quint64 m_valueMax;
52  quint64 m_valueMin;
53  QString m_text;
54 
55  quint64 m_valueNew;
56  QString m_textNew;
59  QTimer m_blinkTimer;
61 
63 
64  quint64 findExponent(int digit);
65  QChar digitNeigh(QChar c, bool dir);
66  QString formatText(quint64 value);
67 
68  void paintEvent(QPaintEvent*);
69 
70  void mousePressEvent(QMouseEvent*);
71  void mouseMoveEvent(QMouseEvent*);
72  void wheelEvent(QWheelEvent*);
73  void leaveEvent(QEvent*);
74  void keyPressEvent(QKeyEvent*);
75  void focusInEvent(QFocusEvent*);
76  void focusOutEvent(QFocusEvent*);
77 
78 private slots:
79  void animate();
80  void blink();
81 };
QChar m_groupSeparator
Definition: valuedial.h:60
int m_numDecimalPoints
Definition: valuedial.h:44
quint64 m_valueMin
Definition: valuedial.h:52
int m_digitHeight
Definition: valuedial.h:46
QTimer m_blinkTimer
Definition: valuedial.h:59
quint64 m_valueMax
Definition: valuedial.h:51
quint64 getValueNew() const
Definition: valuedial.h:36
ColorMapper m_colorMapper
Definition: valuedial.h:62
quint64 getValue() const
Definition: valuedial.h:35
int m_cursor
Definition: valuedial.h:48
#define SDRGUI_API
Definition: export.h:52
QTimer m_animationTimer
Definition: valuedial.h:58
int m_digitWidth
Definition: valuedial.h:45
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
QString m_textNew
Definition: valuedial.h:56
bool m_cursorState
Definition: valuedial.h:49
int m_numDigits
Definition: valuedial.h:43
QString m_text
Definition: valuedial.h:53
int m_hightlightedDigit
Definition: valuedial.h:47
QLinearGradient m_background
Definition: valuedial.h:42
quint64 m_value
Definition: valuedial.h:50
int m_animationState
Definition: valuedial.h:57
quint64 m_valueNew
Definition: valuedial.h:55
T max(const T &x, const T &y)
Definition: framework.h:446
T min(const T &x, const T &y)
Definition: framework.h:440