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.
valuedialz.h
Go to the documentation of this file.
1 // Copyright (C) 2017 F4EXB //
3 // written by Edouard Griffiths //
4 // //
5 // Same as ValueDial but handles optionally positive and negative numbers with //
6 // sign display. //
7 // //
8 // This program is free software; you can redistribute it and/or modify //
9 // it under the terms of the GNU General Public License as published by //
10 // the Free Software Foundation as version 3 of the License, or //
11 // (at your option) any later version. //
12 // //
13 // This program is distributed in the hope that it will be useful, //
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
16 // GNU General Public License V3 for more details. //
17 // //
18 // You should have received a copy of the GNU General Public License //
19 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
21 
22 #include <QWidget>
23 #include <QTimer>
24 #include "gui/colormapper.h"
25 #include "export.h"
26 
27 class SDRGUI_API ValueDialZ : public QWidget {
28  Q_OBJECT
29 
30 public:
31  ValueDialZ(bool positiveOnly = true, QWidget* parent = NULL, ColorMapper colorMapper = ColorMapper(ColorMapper::Normal));
32 
33  void setValue(qint64 value);
34  void setValueRange(bool positiveOnly, uint numDigits, qint64 min, qint64 max);
35  void setFont(const QFont& font);
36  void setBold(bool bold);
37  void setColorMapper(ColorMapper colorMapper);
38  qint64 getValue() const { return m_value; }
39  qint64 getValueNew() const { return m_valueNew; }
40 
41 signals:
42  void changed(qint64 value);
43 
44 private:
45  QLinearGradient m_background;
51  int m_cursor;
53  qint64 m_value;
54  qint64 m_valueMax;
55  qint64 m_valueMin;
57  QString m_text;
58 
59  qint64 m_valueNew;
60  QString m_textNew;
63  QTimer m_blinkTimer;
65 
67 
68  quint64 findExponent(int digit);
69  QChar digitNeigh(QChar c, bool dir);
70  QString formatText(qint64 value);
71 
72  void paintEvent(QPaintEvent*);
73 
74  void mousePressEvent(QMouseEvent*);
75  void mouseMoveEvent(QMouseEvent*);
76  void wheelEvent(QWheelEvent*);
77  void leaveEvent(QEvent*);
78  void keyPressEvent(QKeyEvent*);
79  void focusInEvent(QFocusEvent*);
80  void focusOutEvent(QFocusEvent*);
81 
82 private slots:
83  void animate();
84  void blink();
85 };
qint64 getValue() const
Definition: valuedialz.h:38
QChar m_groupSeparator
Definition: valuedialz.h:64
int m_cursor
Definition: valuedialz.h:51
QLinearGradient m_background
Definition: valuedialz.h:45
QString m_text
Definition: valuedialz.h:57
bool m_cursorState
Definition: valuedialz.h:52
int m_digitWidth
Definition: valuedialz.h:48
qint64 getValueNew() const
Definition: valuedialz.h:39
QString m_textNew
Definition: valuedialz.h:60
qint64 m_valueNew
Definition: valuedialz.h:59
qint64 m_value
Definition: valuedialz.h:53
#define SDRGUI_API
Definition: export.h:52
QTimer m_animationTimer
Definition: valuedialz.h:62
ColorMapper m_colorMapper
Definition: valuedialz.h:66
int m_numDigits
Definition: valuedialz.h:46
bool m_positiveOnly
Definition: valuedialz.h:56
qint64 m_valueMax
Definition: valuedialz.h:54
void setValue(void *value, QJsonValue obj, QString type, QString complexType)
Definition: SWGHelpers.cpp:25
int m_hightlightedDigit
Definition: valuedialz.h:50
qint64 m_valueMin
Definition: valuedialz.h:55
int m_digitHeight
Definition: valuedialz.h:49
QTimer m_blinkTimer
Definition: valuedialz.h:63
int m_numDecimalPoints
Definition: valuedialz.h:47
int m_animationState
Definition: valuedialz.h:61
T max(const T &x, const T &y)
Definition: framework.h:446
T min(const T &x, const T &y)
Definition: framework.h:440