From b84172434d32ee26268817daf865897570e9ac32 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 9 May 2012 17:12:05 +0200 Subject: [PATCH 1/2] Automatically focus entry widget when console tab comes into focus Fixes #1241 --- src/qt/forms/rpcconsole.ui | 4 ++-- src/qt/rpcconsole.cpp | 38 +++++++++++++++++--------------------- src/qt/rpcconsole.h | 3 ++- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index bde607c5279..d973e3a9f99 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -19,7 +19,7 @@ 0 - + Information @@ -232,7 +232,7 @@ - + Console diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index d59f5c6a386..6d983989e94 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -113,27 +113,6 @@ RPCConsole::~RPCConsole() delete ui; } -bool RPCConsole::event(QEvent *event) -{ - int returnValue = QWidget::event(event); - - if (event->type() == QEvent::LayoutRequest && firstLayout) - { - // Work around QTableWidget issue: - // Call resizeRowsToContents on first Layout request with widget visible, - // to make sure multiline messages that were added before the console was shown - // have the right height. - if(ui->messagesWidget->isVisible()) - { - firstLayout = false; - ui->messagesWidget->resizeRowsToContents(); - } - return true; - } - - return returnValue; -} - bool RPCConsole::eventFilter(QObject* obj, QEvent *event) { if(obj == ui->lineEdit) @@ -314,3 +293,20 @@ void RPCConsole::copyMessage() { GUIUtil::copyEntryData(ui->messagesWidget, 1, Qt::EditRole); } + +void RPCConsole::on_tabWidget_currentChanged(int index) +{ + if(ui->tabWidget->widget(index) == ui->tab_console) + { + if(firstLayout) + { + // Work around QTableWidget issue: + // Call resizeRowsToContents on first Layout request with widget visible, + // to make sure multiline messages that were added before the console was shown + // have the right height. + firstLayout = false; + ui->messagesWidget->resizeRowsToContents(); + } + ui->lineEdit->setFocus(); + } +} diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index a0a73bedd35..2ec47b0cf84 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -28,12 +28,13 @@ public: }; protected: - virtual bool event(QEvent *event); virtual bool eventFilter(QObject* obj, QEvent *event); private slots: void on_lineEdit_returnPressed(); + void on_tabWidget_currentChanged(int index); + public slots: void clear(); void message(int category, const QString &message); From bfbfb53ed468734376039f74a8ca2ddf2047c6f4 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 9 May 2012 17:31:59 +0200 Subject: [PATCH 2/2] Add key shortcuts for RPC console tabs - Alt-I for Information, Alt-C for Console --- src/qt/forms/rpcconsole.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui index d973e3a9f99..7e496a5ce7b 100644 --- a/src/qt/forms/rpcconsole.ui +++ b/src/qt/forms/rpcconsole.ui @@ -21,7 +21,7 @@ - Information + &Information @@ -234,7 +234,7 @@ - Console + &Console