Added scrollDownTextEdit() -> text edit is supposed to scroll down autmatically
in case too much info has to be displayed.
This commit is contained in:
parent
0559ff64e2
commit
2ac8c4cfc6
@ -7,6 +7,7 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QScrollBar>
|
||||||
|
|
||||||
MainWindow::MainWindow(Worker *worker, QWidget *parent)
|
MainWindow::MainWindow(Worker *worker, QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
@ -137,6 +138,15 @@ void MainWindow::onQuit() {
|
|||||||
qApp->exit(m_worker->returnCode());
|
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) {
|
void MainWindow::onAppendText(QString text, QString suffix) {
|
||||||
QString editText = ui->updateStatus->toPlainText();
|
QString editText = ui->updateStatus->toPlainText();
|
||||||
if (!suffix.isNull() && suffix.size() > 0) {
|
if (!suffix.isNull() && suffix.size() > 0) {
|
||||||
|
@ -38,6 +38,8 @@ private slots:
|
|||||||
void onQuit();
|
void onQuit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void scrollDownTextEdit();
|
||||||
|
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
Worker *m_worker;
|
Worker *m_worker;
|
||||||
int m_width;
|
int m_width;
|
||||||
|
Loading…
Reference in New Issue
Block a user