refresh QSO # when the underlying data changes

This commit is contained in:
Brian Moran 2022-07-15 11:24:57 -07:00
parent e5bf51abf6
commit af3e06144c
4 changed files with 17 additions and 10 deletions

View File

@ -72,7 +72,7 @@ void AbstractLogWindow::impl::delete_QSOs ()
{
// We must work with source model indexes because we don't want row
// removes to invalidate model indexes we haven't yet processed. We
// achieve that by processing them in decending row order.
// achieve that by processing them in descending row order.
for (auto& row_index : row_indexes)
{
row_index = model_.mapToSource (row_index);
@ -80,11 +80,12 @@ void AbstractLogWindow::impl::delete_QSOs ()
// reverse sort by row
std::sort (row_indexes.begin (), row_indexes.end (), row_is_higher);
for (auto index : row_indexes)
{
auto row = model_.mapFromSource (index).row ();
model_.removeRow (row);
self_->log_model_changed ();
auto row = model_.mapFromSource(index).row();
model_.removeRow(row);
self_->log_model_changed();
}
}
}

View File

@ -88,6 +88,7 @@ void CabrilloLogWindow::log_model_changed (int row)
{
m_->log_model_->select ();
}
this->set_nQSO(m_->log_model_->rowCount());
}
void CabrilloLogWindow::set_nQSO(int n)

View File

@ -28,13 +28,20 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="nQSO_lineEdit">
<widget class="QLabel" name="nQSO_lineEdit">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">* {
font-family: Courier;
font-size: 10pt;
font-weight: bold;
}</string>
</property>
<property name="text">
<string>0 QSOs</string>
</property>

View File

@ -2779,7 +2779,7 @@ void MainWindow::on_contest_log_action_triggered()
m_contestLogWindow->showNormal ();
m_contestLogWindow->raise ();
m_contestLogWindow->activateWindow ();
m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso());
//m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso());
}
void MainWindow::on_actionColors_triggered()
@ -4678,7 +4678,7 @@ void MainWindow::guiUpdate()
//Once per second (onesec)
if(nsec != m_sec0) {
// qDebug() << "AAA" << nsec;
if(m_contestLogWindow) m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso());
//if(m_contestLogWindow) m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso());
if(m_mode=="FST4") chk_FST4_freq_range();
m_currentBand=m_config.bands()->find(m_freqNominal);
@ -6377,9 +6377,7 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call,
m_xSent.clear ();
m_xRcvd.clear ();
if(m_contestLogWindow) {
m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso());
}
}
void MainWindow::updateRate()