diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
| commit | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (patch) | |
| tree | fbfdfe6bcb0a8a114be2480dac53d88c977e4869 /widgets/FrequencyLineEdit.cpp | |
| parent | 4320ce238aae1fe87fc9f379cdd816e9317885fa (diff) | |
New upstream version 2.7.0~rc8+repackupstream/2.7.0_rc8+repack
Diffstat (limited to 'widgets/FrequencyLineEdit.cpp')
| -rwxr-xr-x | widgets/FrequencyLineEdit.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/widgets/FrequencyLineEdit.cpp b/widgets/FrequencyLineEdit.cpp index 4826b2c6..8e74c7db 100755 --- a/widgets/FrequencyLineEdit.cpp +++ b/widgets/FrequencyLineEdit.cpp @@ -1,53 +1,53 @@ -#include "FrequencyLineEdit.hpp"
-
-#include <limits>
-
-#include <QDoubleValidator>
-#include <QString>
-#include <QLocale>
-
-#include "moc_FrequencyLineEdit.cpp"
-
-namespace
-{
- class MHzValidator
- : public QDoubleValidator
- {
- public:
- MHzValidator (double bottom, double top, QObject * parent = nullptr)
- : QDoubleValidator {bottom, top, 6, parent}
- {
- }
-
- State validate (QString& input, int& pos) const override
- {
- State result = QDoubleValidator::validate (input, pos);
- if (Acceptable == result)
- {
- bool ok;
- (void)QLocale {}.toDouble (input, &ok);
- if (!ok)
- {
- result = Intermediate;
- }
- }
- return result;
- }
- };
-}
-
-FrequencyLineEdit::FrequencyLineEdit (QWidget * parent)
- : QLineEdit (parent)
-{
- setValidator (new MHzValidator {0., static_cast<double>(std::numeric_limits<Radio::Frequency>::max ()) / 10.e6, this});
-}
-
-auto FrequencyLineEdit::frequency () const -> Frequency
-{
- return Radio::frequency (text (), 6);
-}
-
-void FrequencyLineEdit::frequency (Frequency f)
-{
- setText (Radio::frequency_MHz_string (f));
-}
+#include "FrequencyLineEdit.hpp" + +#include <limits> + +#include <QDoubleValidator> +#include <QString> +#include <QLocale> + +#include "moc_FrequencyLineEdit.cpp" + +namespace +{ + class MHzValidator + : public QDoubleValidator + { + public: + MHzValidator (double bottom, double top, QObject * parent = nullptr) + : QDoubleValidator {bottom, top, 6, parent} + { + } + + State validate (QString& input, int& pos) const override + { + State result = QDoubleValidator::validate (input, pos); + if (Acceptable == result) + { + bool ok; + (void)QLocale {}.toDouble (input, &ok); + if (!ok) + { + result = Intermediate; + } + } + return result; + } + }; +} + +FrequencyLineEdit::FrequencyLineEdit (QWidget * parent) + : QLineEdit (parent) +{ + setValidator (new MHzValidator {0., static_cast<double>(std::numeric_limits<Radio::Frequency>::max ()) / 10.e6, this}); +} + +auto FrequencyLineEdit::frequency () const -> Frequency +{ + return Radio::frequency (text (), 6); +} + +void FrequencyLineEdit::frequency (Frequency f) +{ + setText (Radio::frequency_MHz_string (f)); +} |
