Ensure band/frequency combo box edit styling tracks current frequency

This commit is contained in:
Bill Somerville 2020-09-08 15:24:55 +01:00
parent 1d52daf7ee
commit db6a432a33
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
2 changed files with 9 additions and 5 deletions

View File

@ -2197,7 +2197,7 @@ void MainWindow::displayDialFrequency ()
{
// only change this when necessary as we get called a lot and it
// would trash any user input to the band combo box line edit
ui->bandComboBox->setCurrentText (band_name);
ui->bandComboBox->setCurrentText (band_name.size () ? band_name : m_config.bands ()->oob ());
m_wideGraph->setRxBand (band_name);
m_lastBand = band_name;
band_changed(dial_frequency);
@ -6696,17 +6696,20 @@ void MainWindow::on_bandComboBox_currentIndexChanged (int index)
// Lookup band
auto const& band = m_config.bands ()->find (frequency);
if (!band.isEmpty ())
ui->bandComboBox->setCurrentText (band.size () ? band : m_config.bands ()->oob ());
displayDialFrequency ();
}
void MainWindow::on_bandComboBox_editTextChanged (QString const& text)
{
if (text.size () && m_config.bands ()->oob () != text)
{
ui->bandComboBox->lineEdit ()->setStyleSheet ({});
ui->bandComboBox->setCurrentText (band);
}
else
{
ui->bandComboBox->lineEdit ()->setStyleSheet ("QLineEdit {color: yellow; background-color : red;}");
ui->bandComboBox->setCurrentText (m_config.bands ()->oob ());
}
displayDialFrequency ();
}
void MainWindow::on_bandComboBox_activated (int index)

View File

@ -236,6 +236,7 @@ private slots:
, QString const& exchange_sent, QString const& exchange_rcvd
, QString const& propmode, QByteArray const& ADIF);
void on_bandComboBox_currentIndexChanged (int index);
void on_bandComboBox_editTextChanged (QString const& text);
void on_bandComboBox_activated (int index);
void on_readFreq_clicked();
void on_pbTxMode_clicked();