From d83a420f0517d7fc47aeb288a6a0cf4891784fcc Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 22 Jun 2026 12:03:44 +0200 Subject: New upstream version 3.0.2+dfsg --- widgets/activeStations.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'widgets/activeStations.cpp') diff --git a/widgets/activeStations.cpp b/widgets/activeStations.cpp index 7353501c..067d36b5 100644 --- a/widgets/activeStations.cpp +++ b/widgets/activeStations.cpp @@ -125,31 +125,37 @@ void ActiveStations::displayRecentStations(QString mode, QString const& t) m_clickOK=false; ui->RecentStationsPlainTextEdit->setPlainText(t); -//White background for Q65-60x decodes, yellow for Q65-30x: int i0=0; int i1=0; - int npos=0; int nlines=t.count("\n"); QTextCursor cursor=ui->RecentStationsPlainTextEdit->textCursor(); QTextCharFormat fmt; + + // Use a regular expression matcher to find the text pattern within each line bounds + QRegularExpression regex(" 30[ABCD] "); + for(int i=0; i0) { - cursor.setPosition(npos); - cursor.select(QTextCursor::LineUnderCursor); + // Isolate the current line to check for the match + QString currentLine = t.mid(i0, i1 - i0); + bool hasMatch = currentLine.contains(regex); + + // Move the cursor to the current line we are processing + cursor.setPosition(i0); + cursor.select(QTextCursor::LineUnderCursor); + + if(hasMatch) { fmt.setBackground(QBrush(Qt::yellow)); fmt.setForeground(QBrush(Qt::black)); } else { - cursor.setPosition(i0+10); - cursor.select(QTextCursor::LineUnderCursor); - fmt.clearForeground(); - fmt.clearBackground(); + // Explicitly force the background back to white + fmt.setBackground(QBrush(Qt::white)); + fmt.setForeground(QBrush(Qt::black)); } + cursor.setCharFormat(fmt); i0=i1+1; } - m_clickOK=bClickOK; } -- cgit v1.2.3