diff options
| author | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
|---|---|---|
| committer | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
| commit | d63dd8d081a6fcd0715cd13f26df59fb831769d2 (patch) | |
| tree | b9c1f6245147a310aac3762630bad389bbb57335 /FrequencyLineEdit.cpp | |
| parent | c720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (diff) | |
Imported Upstream version 1.5.0upstream/1.5.0
Diffstat (limited to 'FrequencyLineEdit.cpp')
| -rw-r--r-- | FrequencyLineEdit.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/FrequencyLineEdit.cpp b/FrequencyLineEdit.cpp new file mode 100644 index 00000000..e37800f8 --- /dev/null +++ b/FrequencyLineEdit.cpp @@ -0,0 +1,40 @@ +#include "FrequencyLineEdit.hpp"
+
+#include <QRegExpValidator>
+#include <QRegExp>
+#include <QString>
+
+#include "moc_FrequencyLineEdit.cpp"
+
+FrequencyLineEdit::FrequencyLineEdit (QWidget * parent)
+ : QLineEdit (parent)
+{
+ setValidator (new QRegExpValidator {QRegExp {R"(\d{0,6}(\.\d{0,6})?)"}, this});
+}
+
+auto FrequencyLineEdit::frequency () const -> Frequency
+{
+ return Radio::frequency (text (), 6);
+}
+
+void FrequencyLineEdit::frequency (Frequency f)
+{
+ setText (Radio::frequency_MHz_string (f));
+}
+
+
+FrequencyDeltaLineEdit::FrequencyDeltaLineEdit (QWidget * parent)
+ : QLineEdit (parent)
+{
+ setValidator (new QRegExpValidator {QRegExp {R"(-?\d{0,6}(\.\d{0,6})?)"}, this});
+}
+
+auto FrequencyDeltaLineEdit::frequency_delta () const -> FrequencyDelta
+{
+ return Radio::frequency_delta (text (), 6);
+}
+
+void FrequencyDeltaLineEdit::frequency_delta (FrequencyDelta d)
+{
+ setText (Radio::frequency_MHz_string (d));
+}
|
