diff --git a/mainwindow.cpp b/mainwindow.cpp --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -582,12 +583,21 @@ template double MainWindow:: QTextCursor cursor(ui->ptTextView->document()); cursor.movePosition(QTextCursor::End); QByteArray ba((char*) &data, sizeof(data)); + QScrollBar* vbar = ui->ptTextView->verticalScrollBar(); + bool isEnd = (vbar->value() == vbar->maximum()); + cursor.insertText(ba.toHex() + " "); // `53` is selected for minimum width of the main window if (cursor.positionInBlock() >= 53) { cursor.insertText("\n"); } + + // scroll if we were at the end of the display + if (isEnd) + { + vbar->setValue(vbar->maximum()); + } } if (ui->rbLittleE->isChecked())