From 605b06f7c2e1edca18dcefa35c043c521193e7c4 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Fri, 13 Nov 2015 23:44:48 +0000 Subject: [PATCH] Fix regression in frequencies to stations drag & drop Since mode dependent frequencies were added the MIME type for drag from the FrequenciesList model has been broken. This change fixes that and adapts the StationList model to accept the amended MIME data drops. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6096 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- FrequencyList.cpp | 2 +- StationList.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FrequencyList.cpp b/FrequencyList.cpp index 3d2ea482e..e05d5382b 100644 --- a/FrequencyList.cpp +++ b/FrequencyList.cpp @@ -551,7 +551,7 @@ QMimeData * FrequencyList::impl::mimeData (QModelIndexList const& items) const { if (item.isValid () && frequency_column == item.column ()) { - stream << QString {data (item, Qt::DisplayRole).toString ()}; + stream << frequency_list_.at (item.row ()); } } diff --git a/StationList.cpp b/StationList.cpp index aae2f72dc..baa6f8179 100644 --- a/StationList.cpp +++ b/StationList.cpp @@ -18,6 +18,7 @@ #include "pimpl_impl.hpp" #include "Bands.hpp" +#include "FrequencyList.hpp" #if !defined (QT_NO_DEBUG_STREAM) QDebug operator << (QDebug debug, StationList::Station const& station) @@ -508,10 +509,9 @@ bool StationList::impl::dropMimeData (QMimeData const * data, Qt::DropAction act QDataStream stream {&encoded_data, QIODevice::ReadOnly}; while (!stream.atEnd ()) { - QString frequency_string; - stream >> frequency_string; - auto frequency = Radio::frequency (frequency_string, 0); - auto const& band = bands_->find (frequency); + FrequencyList::Item item; + stream >> item; + auto const& band = bands_->find (item.frequency_); if (stations_.cend () == std::find_if (stations_.cbegin () , stations_.cend () , [&band] (Station const& s) {return s.band_name_ == band;}))