feat(LogWidget): new scrollToBottom method to scroll the log to to the bottom

This commit is contained in:
sithlord48 2026-04-01 20:20:05 -04:00 committed by Nick Bolton
parent 4f377d97ff
commit b17883618c
2 changed files with 8 additions and 0 deletions

View file

@ -10,6 +10,7 @@
#include <gui/Logger.h>
#include <QPlainTextEdit>
#include <QScrollBar>
#include <QVBoxLayout>
LogWidget::LogWidget(QWidget *parent) : QWidget{parent}, m_textLog{new QPlainTextEdit(this)}
@ -63,3 +64,9 @@ void LogWidget::findPrevious(const QString &text)
m_textLog->find(text, QTextDocument::FindBackward);
}
}
void LogWidget::scrollToBottom() const
{
auto sb = m_textLog->verticalScrollBar();
sb->setValue(sb->maximum());
}

View file

@ -20,6 +20,7 @@ public:
void appendLine(const QString &msg);
void findNext(const QString &text);
void findPrevious(const QString &text);
void scrollToBottom() const;
private:
QPlainTextEdit *m_textLog = nullptr;