Added scrollDownTextEdit() -> text edit is supposed to scroll down autmatically

in case too much info has to be displayed.
This commit is contained in:
Gerhard Hoffmann 2023-08-18 11:46:57 +02:00
parent 0559ff64e2
commit 2ac8c4cfc6
2 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include <QDateTime>
#include <QMessageBox>
#include <QDebug>
#include <QScrollBar>
MainWindow::MainWindow(Worker *worker, QWidget *parent)
: QMainWindow(parent)
@ -137,6 +138,15 @@ void MainWindow::onQuit() {
qApp->exit(m_worker->returnCode());
}
void MainWindow::scrollDownTextEdit() {
ui->updateStatus->setEnabled(true);
QTextCursor tmpCursor = ui->updateStatus->textCursor();
tmpCursor.movePosition(QTextCursor::End);
ui->updateStatus->setTextCursor(tmpCursor);
ui->updateStatus->ensureCursorVisible();
}
void MainWindow::onAppendText(QString text, QString suffix) {
QString editText = ui->updateStatus->toPlainText();
if (!suffix.isNull() && suffix.size() > 0) {

View File

@ -38,6 +38,8 @@ private slots:
void onQuit();
private:
void scrollDownTextEdit();
Ui::MainWindow *ui;
Worker *m_worker;
int m_width;