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:
Bill Somerville
2015-05-31 11:51:31 +00:00
parent bbd403b123
commit f1858dbb4f
14 changed files with 143 additions and 142 deletions
+4 -4
View File
@@ -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;