aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Maxwell <gmaxwell@gmail.com>2012-05-09 08:34:00 -0700
committerGregory Maxwell <gmaxwell@gmail.com>2012-05-09 08:34:00 -0700
commit1eb2d8e0bfd18303a9c9ffce17fe4d61824072ec (patch)
treec1a58007d3d98e09ff435f3e1c0054994dc5e0ed /src
parent0981b80c2968e44cbbfac451cd15b7fe8bc700bd (diff)
parentbfbfb53ed468734376039f74a8ca2ddf2047c6f4 (diff)
downloadbitcoin-1eb2d8e0bfd18303a9c9ffce17fe4d61824072ec.tar.xz
Merge pull request #1243 from laanwj/2012_05_uiconsole_focus
Automatically focus entry widget when console tab comes into focus
Diffstat (limited to 'src')
-rw-r--r--src/qt/forms/rpcconsole.ui8
-rw-r--r--src/qt/rpcconsole.cpp38
-rw-r--r--src/qt/rpcconsole.h3
3 files changed, 23 insertions, 26 deletions
diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui
index bde607c527..7e496a5ce7 100644
--- a/src/qt/forms/rpcconsole.ui
+++ b/src/qt/forms/rpcconsole.ui
@@ -19,9 +19,9 @@
<property name="currentIndex">
<number>0</number>
</property>
- <widget class="QWidget" name="tab">
+ <widget class="QWidget" name="tab_info">
<attribute name="title">
- <string>Information</string>
+ <string>&amp;Information</string>
</attribute>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<property name="horizontalSpacing">
@@ -232,9 +232,9 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="tab_2">
+ <widget class="QWidget" name="tab_console">
<attribute name="title">
- <string>Console</string>
+ <string>&amp;Console</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
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();
+ }
+}
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index a0a73bedd3..2ec47b0cf8 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);