Improve frequency input validation

Allow group separators as well as decimal points in MHz input fields

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7462 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville
2017-01-08 23:58:00 +00:00
parent e9583a2a23
commit 3982e9e19e
5 changed files with 81 additions and 18 deletions
+11 -3
View File
@@ -18,6 +18,7 @@
#include "pimpl_impl.hpp"
#include "Radio.hpp"
#include "Bands.hpp"
#include "FrequencyList.hpp"
@@ -403,9 +404,16 @@ bool StationList::impl::setData (QModelIndex const& model_index, QVariant const&
case offset_column:
{
stations_[row].offset_ = value.value<FrequencyDelta> ();
Q_EMIT dataChanged (model_index, model_index, roles);
changed = true;
if (value.canConvert<FrequencyDelta> ())
{
FrequencyDelta offset {qvariant_cast<Radio::FrequencyDelta> (value)};
if (offset != stations_[row].offset_)
{
stations_[row].offset_ = offset;
Q_EMIT dataChanged (model_index, model_index, roles);
changed = true;
}
}
}
break;