mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-16 12:48:42 -04:00
Improvements to models and delegates
Trying to find the sweet spot for completeness, usefulness, safety and, performance from the various custom item models and item delegates. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5474 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
+4
-4
@@ -203,12 +203,12 @@ auto StationList::impl::offset (Frequency f) const -> FrequencyDelta
|
||||
{
|
||||
// Lookup band for frequency
|
||||
auto const& band = bands_->find (f);
|
||||
if (band != bands_->out_of_band ())
|
||||
if (!band.isEmpty ())
|
||||
{
|
||||
// Lookup station for band
|
||||
for (int i = 0; i < stations_.size (); ++i)
|
||||
{
|
||||
if (stations_[i].band_name_ == band->name_)
|
||||
if (stations_[i].band_name_ == band)
|
||||
{
|
||||
return stations_[i].offset_;
|
||||
}
|
||||
@@ -514,10 +514,10 @@ bool StationList::impl::dropMimeData (QMimeData const * data, Qt::DropAction act
|
||||
auto const& band = bands_->find (frequency);
|
||||
if (stations_.cend () == std::find_if (stations_.cbegin ()
|
||||
, stations_.cend ()
|
||||
, [&band] (Station const& s) {return s.band_name_ == band->name_;}))
|
||||
, [&band] (Station const& s) {return s.band_name_ == band;}))
|
||||
{
|
||||
// not found so add it
|
||||
add (Station {band->name_, 0, QString {}});
|
||||
add (Station {band, 0, QString {}});
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user