From 23899aac5cbbeb47ce5edb4de74b5a208d044814 Mon Sep 17 00:00:00 2001 From: sergiodmn Date: Wed, 29 Mar 2017 18:04:58 +0200 Subject: [PATCH] Auto scroll in console output Add auto scroll in console output textedit, the scroll will jump to end after appending data --- src/mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9d603843..7c31ef23 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -723,6 +723,7 @@ void MainWindow::on_consoleInputLineEdit_returnPressed() if (this->core) { QString input = ui->consoleInputLineEdit->text(); ui->consoleOutputTextEdit->appendPlainText(this->core->cmd(input)); + ui->consoleOutputTextEdit->verticalScrollBar()->setValue(ui->consoleOutputTextEdit->verticalScrollBar()->maximum()); // Add new command to history QCompleter *completer = ui->consoleInputLineEdit->completer(); /* @@ -947,11 +948,13 @@ void MainWindow::get_refs(const QString& offset) void MainWindow::add_output(QString msg) { ui->consoleOutputTextEdit->appendPlainText(msg); + ui->consoleOutputTextEdit->verticalScrollBar()->setValue(ui->consoleOutputTextEdit->verticalScrollBar()->maximum()); } void MainWindow::add_debug_output(QString msg) { ui->consoleOutputTextEdit->appendHtml(" [DEBUG]:\t" + msg + ""); + ui->consoleOutputTextEdit->verticalScrollBar()->setValue(ui->consoleOutputTextEdit->verticalScrollBar()->maximum()); } void MainWindow::on_actionNew_triggered()