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 // We must work with source model indexes because we don't want row
// removes to invalidate model indexes we haven't yet processed. We // 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) for (auto& row_index : row_indexes)
{ {
row_index = model_.mapToSource (row_index); row_index = model_.mapToSource (row_index);
@ -80,6 +80,7 @@ void AbstractLogWindow::impl::delete_QSOs ()
// reverse sort by row // reverse sort by row
std::sort (row_indexes.begin (), row_indexes.end (), row_is_higher); std::sort (row_indexes.begin (), row_indexes.end (), row_is_higher);
for (auto index : row_indexes) for (auto index : row_indexes)
{ {
auto row = model_.mapFromSource(index).row(); auto row = model_.mapFromSource(index).row();

View File

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

View File

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

View File

@ -2779,7 +2779,7 @@ void MainWindow::on_contest_log_action_triggered()
m_contestLogWindow->showNormal (); m_contestLogWindow->showNormal ();
m_contestLogWindow->raise (); m_contestLogWindow->raise ();
m_contestLogWindow->activateWindow (); 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() void MainWindow::on_actionColors_triggered()
@ -4678,7 +4678,7 @@ void MainWindow::guiUpdate()
//Once per second (onesec) //Once per second (onesec)
if(nsec != m_sec0) { if(nsec != m_sec0) {
// qDebug() << "AAA" << nsec; // 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(); if(m_mode=="FST4") chk_FST4_freq_range();
m_currentBand=m_config.bands()->find(m_freqNominal); 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_xSent.clear ();
m_xRcvd.clear (); m_xRcvd.clear ();
if(m_contestLogWindow) {
m_contestLogWindow->set_nQSO(m_logBook.contest_log()->n_qso());
}
} }
void MainWindow::updateRate() void MainWindow::updateRate()