diff options
| author | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:55 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:55 +0200 |
| commit | de18fc13175a5bf0e2b48a042d2fc06e87c88d24 (patch) | |
| tree | f517074cd603d30eb7ba7e2122d38051e4c1439c /widgets/activeStations.cpp | |
| parent | b76e8361909e47f0937d4a64a5a4cb5939f51eb7 (diff) | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
Update upstream source from tag 'upstream/3.0.2+dfsg'
Update to upstream version '3.0.2+dfsg'
with Debian dir 90381fe7be9f5ea84d9b16c9cccf200a3fbe138b
Diffstat (limited to 'widgets/activeStations.cpp')
| -rw-r--r-- | widgets/activeStations.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
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; i<nlines; i++) { i1=t.indexOf("\n",i0); - npos=t.indexOf(QRegularExpression(" 30[ABCD] "), i0); - if(npos>0) { - 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; } |
