mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Implement find wrapping in LogView
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
7e8cf628e8
commit
17c4ad0f01
1 changed files with 26 additions and 1 deletions
|
|
@ -180,5 +180,30 @@ void LogView::scrollToBottom()
|
|||
|
||||
void LogView::findNext(const QString& what, bool reverse)
|
||||
{
|
||||
find(what, reverse ? QTextDocument::FindFlag::FindBackward : QTextDocument::FindFlag(0));
|
||||
if (what.isEmpty())
|
||||
return;
|
||||
|
||||
const QTextDocument::FindFlags flags(reverse ? QTextDocument::FindBackward : 0);
|
||||
|
||||
if (find(what, flags))
|
||||
return;
|
||||
|
||||
QTextCursor cursor = textCursor();
|
||||
|
||||
if (reverse) {
|
||||
if (cursor.atEnd())
|
||||
return;
|
||||
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
} else {
|
||||
if (cursor.atStart())
|
||||
return;
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
}
|
||||
|
||||
cursor = document()->find(what, cursor, flags);
|
||||
|
||||
if (!cursor.isNull())
|
||||
setTextCursor(cursor);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue