From: Christoph Egger Date: Tue, 26 May 2015 19:23:00 +0000 (+0200) Subject: Always keep log scrolled to the bottom X-Git-Tag: v0.2~2 X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;ds=inline;h=1975fc2d8d5f1a2a7bf71717c0ca7cef6dd57566;hp=01cbeaf636962d976c85028f8f9e0b2afa4a5c69;p=frida%2Ffrida.git Always keep log scrolled to the bottom --- diff --git a/src/gui/widgets/LogDockAppender.cxx b/src/gui/widgets/LogDockAppender.cxx index 5003139..321860a 100644 --- a/src/gui/widgets/LogDockAppender.cxx +++ b/src/gui/widgets/LogDockAppender.cxx @@ -2,6 +2,7 @@ #include "LogDock.hxx" #include +#include using namespace log4cxx::helpers; @@ -51,6 +52,14 @@ void LogDockAppender::append(const spi::LoggingEventPtr& event, Pool& p) { target->item(rowcount, 1)->setBackground(rowcolor); target->item(rowcount, 2)->setBackground(rowcolor); target->resizeColumnsToContents(); + + QTimer *timer = new QTimer(target); + timer->setSingleShot(true); + + QObject::connect(timer, &QTimer::timeout, [=]() { + target->scrollToItem(target->item(rowcount, 2), QAbstractItemView::PositionAtTop); + }); + timer->start(10); } void LogDockAppender::setTarget(LogDock *target) {