changeset 2558:c79596cd5589 draft

RPC console: scroll to the end when user enters a command - Ensures that the command and reply is visible
author Wladimir J. van der Laan <laanwj@gmail.com>
date Mon, 14 May 2012 18:17:12 +0200
parents 60812cf1d024
children 3d8b3d257e38
files src/qt/rpcconsole.cpp src/qt/rpcconsole.h
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -11,6 +11,7 @@
 #include <QTextEdit>
 #include <QKeyEvent>
 #include <QUrl>
+#include <QScrollBar>
 
 #include <boost/tokenizer.hpp>
 
@@ -262,6 +263,8 @@
             history.removeFirst();
         // Set pointer to end of history
         historyPtr = history.size();
+        // Scroll console view to end
+        scrollToEnd();
     }
 }
 
@@ -315,3 +318,9 @@
 {
     GUIUtil::openDebugLogfile();
 }
+
+void RPCConsole::scrollToEnd()
+{
+    QScrollBar *scrollbar = ui->messagesWidget->verticalScrollBar();
+    scrollbar->setValue(scrollbar->maximum());
+}
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -44,7 +44,8 @@
     void setNumBlocks(int count);
     /** Go forward or back in history */
     void browseHistory(int offset);
-
+    /** Scroll console view to end */
+    void scrollToEnd();
 signals:
     // For RPC command executor
     void stopExecutor();