cut  1.2.2-pre1
QeHmsLabel.hpp
Go to the documentation of this file.
1 #ifndef QEHMSLABEL_HPP
2 #define QEHMSLABEL_HPP
3 
4 #include <QObject>
5 #include <QString>
6 #include <QVariant>
7 #include <QWidget>
8 #include <QLabel>
9 
19 class QeHmsLabel : public QLabel {
20  Q_OBJECT
21 
26  Q_PROPERTY(double radians MEMBER m_radians READ getRadians WRITE setRadians NOTIFY radiansChanged )
27 
28 
34  Q_PROPERTY(int precision MEMBER m_precision READ getPrecision WRITE setPrecision NOTIFY precisionChanged )
35  //TODO: Add max/min value, and clipping. TBD how, but for example, 7.0 or -7.0 shows
36  // +401:04:13.644 and -401:04:13.644. Developer should be able to determine if he wants
37  // the value to restart counting from 0 after it reachers 360 degrees.
38 
39 signals:
43  void radiansChanged(double newValue);
47  void precisionChanged(int newValue);
48 
49 public:
55  explicit QeHmsLabel(QWidget *parent = Q_NULLPTR);
56  ~QeHmsLabel();
57  double getRadians(){ return m_radians; };
58  double getPrecision(){ return m_precision; };
59 
60 public slots:
61  void setRadians(double newValue){this->m_radians = newValue; emit radiansChanged(newValue); this->update();};
62  void setPrecision(int newValue){this->m_precision = newValue; emit precisionChanged(newValue); this->update();};
63  void update();
64 
65 private:
66  double m_radians = 0.0;
67  int m_precision = 3;
68 };
69 
70 #endif // QEHMSLABEL_HPP
QeHmsLabel::radians
double radians
Value to represent in radians @accessors getRadians(), setRadians(double)
Definition: QeHmsLabel.hpp:26
QeHmsLabel
A text label that prints from a radian, it representation in Hours/Minute/Seconds notation.
Definition: QeHmsLabel.hpp:19
QeHmsLabel::getPrecision
double getPrecision()
Definition: QeHmsLabel.hpp:58
QeHmsLabel::QeHmsLabel
QeHmsLabel(QWidget *parent=Q_NULLPTR)
Constructor for QeHmsLabel.
Definition: QeHmsLabel.cpp:13
QeHmsLabel::setPrecision
void setPrecision(int newValue)
Definition: QeHmsLabel.hpp:62
QeHmsLabel::~QeHmsLabel
~QeHmsLabel()
Definition: QeHmsLabel.cpp:19
QeHmsLabel::precision
int precision
Precision used in the subsecond section of the label.
Definition: QeHmsLabel.hpp:34
QeHmsLabel::precisionChanged
void precisionChanged(int newValue)
Signal emitted when the precision of the widget has changed.
QeHmsLabel::update
void update()
Definition: QeHmsLabel.cpp:23
QeHmsLabel::getRadians
double getRadians()
Definition: QeHmsLabel.hpp:57
QeHmsLabel::radiansChanged
void radiansChanged(double newValue)
Signal emitted when the value represented by the widget has changed.
QeHmsLabel::setRadians
void setRadians(double newValue)
Definition: QeHmsLabel.hpp:61