diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-05-09 17:12:05 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2012-05-09 17:15:09 +0200 |
commit | b84172434d32ee26268817daf865897570e9ac32 (patch) | |
tree | fa50401356fe4ea45b38c7b26d421e38bcf2994f /src/qt/rpcconsole.cpp | |
parent | 2e767410b83a4468bf83be9c39f99cf0325c7739 (diff) |
Automatically focus entry widget when console tab comes into focus
Fixes #1241
Diffstat (limited to 'src/qt/rpcconsole.cpp')
-rw-r--r-- | src/qt/rpcconsole.cpp | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index d59f5c6a38..6d983989e9 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(); + } +} |