]> git.siccegge.de Git - frida/frida.git/commitdiff
Always keep log scrolled to the bottom
authorChristoph Egger <christoph@christoph-egger.org>
Tue, 26 May 2015 19:23:00 +0000 (21:23 +0200)
committerChristoph Egger <christoph@christoph-egger.org>
Tue, 26 May 2015 19:23:00 +0000 (21:23 +0200)
src/gui/widgets/LogDockAppender.cxx

index 5003139d1f3c269b4fc5426f6f8838252ac7ab96..321860afb3313126060f68399d8b41987eb1bf5f 100644 (file)
@@ -2,6 +2,7 @@
 #include "LogDock.hxx"
 
 #include <log4cxx/patternlayout.h>
+#include <QTimer>
 
 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) {