mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-12-25 20:33:08 -05:00
8479b6c2b6
Frequency display in the band combo box line edit was suffering floating point precision issues. Input of frequencies was not honoring current locale rules. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5881 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#include "FrequencyLineEdit.hpp"
|
|
|
|
#include <QRegExpValidator>
|
|
#include <QRegExp>
|
|
#include <QString>
|
|
#include <QLocale>
|
|
|
|
#include "moc_FrequencyLineEdit.cpp"
|
|
|
|
FrequencyLineEdit::FrequencyLineEdit (QWidget * parent)
|
|
: QLineEdit (parent)
|
|
{
|
|
setValidator (new QRegExpValidator {QRegExp {QString {R"(\d{0,6}(\)"} + QLocale {}.decimalPoint () + R"(\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 {QString {R"(-?\d{0,6}(\)"} + QLocale {}.decimalPoint () + R"(\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));
|
|
}
|