From c41e9bb976f3f4c3bda4f0d0a2ba646492ff700a Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Fri, 29 May 2015 09:29:54 +0000 Subject: [PATCH] Fix access to underlying data of the frequency list A better approach to this area will follow. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5455 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 0c0f3de30..4bac854d9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4344,9 +4344,16 @@ void MainWindow::bandHopping() m_band00=iband; auto frequencies = m_config.frequencies (); + // iterate the filtered by mode FrequencyList model for (int row = 0; row < frequencies->rowCount (); ++row) { - auto frequency=frequencies->data (frequencies->index (row, FrequencyList::frequency_column)); - auto f = frequency.value(); + // lookup the underlying source model index from the filtered + // model index + auto const& source_index = frequencies->mapToSource (frequencies->index (row, FrequencyList::frequency_column)); + // and use it to directly access the list of frequencies that the + // FrequencyList model wraps (we could also use the model data() + // member using the EditRole of the frequency_column but this way + // avoids going via a QVariant item) + auto const& f = frequencies->frequency_list ()[source_index.row ()].frequency_; if(f==f0) { on_bandComboBox_activated(i); //Set new band // qDebug() << nhr << nmin << int(sec) << "Band selected" << i << 0.000001*f0 << 0.000001*f;