mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-21 11:31:51 -05:00
Fix an issue with editing IARU regions in the working frequencies table
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8166 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
ac1378daa9
commit
a9a1ac1d7a
@ -237,7 +237,7 @@ public:
|
||||
{
|
||||
return {frequency_line_edit_.frequency ()
|
||||
, Modes::value (mode_combo_box_.currentText ())
|
||||
, IARURegions::value (region_combo_box_.currentIndex ())};
|
||||
, IARURegions::value (region_combo_box_.currentText ())};
|
||||
}
|
||||
|
||||
private:
|
||||
@ -1851,7 +1851,7 @@ void Configuration::impl::accept ()
|
||||
macros_.setStringList (next_macros_.stringList ());
|
||||
}
|
||||
|
||||
region_ = IARURegions::value (ui_->region_combo_box->currentIndex ());
|
||||
region_ = IARURegions::value (ui_->region_combo_box->currentText ());
|
||||
|
||||
if (frequencies_.frequency_list () != next_frequencies_.frequency_list ())
|
||||
{
|
||||
|
@ -610,29 +610,27 @@ bool FrequencyList_v2::impl::setData (QModelIndex const& model_index, QVariant c
|
||||
switch (model_index.column ())
|
||||
{
|
||||
case region_column:
|
||||
if (value.canConvert<Region> ())
|
||||
{
|
||||
auto region = static_cast<Region> (value.toUInt ());
|
||||
if (region != item.region_)
|
||||
{
|
||||
item.region_ = region;
|
||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||
changed = true;
|
||||
}
|
||||
{
|
||||
auto region = IARURegions::value (value.toString ());
|
||||
if (region != item.region_)
|
||||
{
|
||||
item.region_ = region;
|
||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case mode_column:
|
||||
if (value.canConvert<Mode> ())
|
||||
{
|
||||
auto mode = Modes::value (value.toString ());
|
||||
if (mode != item.mode_)
|
||||
{
|
||||
item.mode_ = mode;
|
||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
{
|
||||
auto mode = Modes::value (value.toString ());
|
||||
if (mode != item.mode_)
|
||||
{
|
||||
item.mode_ = mode;
|
||||
Q_EMIT dataChanged (model_index, model_index, roles);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case frequency_column:
|
||||
|
@ -34,10 +34,14 @@ char const * IARURegions::name (Region r)
|
||||
return region_names[static_cast<int> (r)];
|
||||
}
|
||||
|
||||
auto IARURegions::value (int r) -> Region
|
||||
auto IARURegions::value (QString const& s) -> Region
|
||||
{
|
||||
if (r < 0 || r + 1 >= SENTINAL) return ALL;
|
||||
return static_cast<Region> (r);
|
||||
auto end = region_names + region_names_size;
|
||||
auto p = std::find_if (region_names, end
|
||||
, [&s] (char const * const name) {
|
||||
return name == s;
|
||||
});
|
||||
return p != end ? static_cast<Region> (p - region_names) : ALL;
|
||||
}
|
||||
|
||||
QVariant IARURegions::data (QModelIndex const& index, int role) const
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
|
||||
// translate between enumeration and human readable strings
|
||||
static char const * name (Region);
|
||||
static Region value (int);
|
||||
static Region value (QString const&);
|
||||
|
||||
// Implement the QAbstractListModel interface
|
||||
int rowCount (QModelIndex const& parent = QModelIndex {}) const override
|
||||
|
Loading…
Reference in New Issue
Block a user