Skip to content

Commit 5cb1d93

Browse files
committed
Merge #15756: gui: Add shortcuts for tab tools
091747b gui: Add shortcuts for tab tools (João Barbosa) Pull request description: This makes accessing the RPC console very fast/easy. It also improves accessibility. <img width="234" alt="Screenshot 2019-10-02 at 01 30 53" src="https://user-images.githubusercontent.com/3534524/66009867-50104300-e4b4-11e9-90b5-6b8dc961a8a1.png"> ACKs for top commit: jonasschnelli: Tested ACK 091747b - this is an improvment. Further solutions to solve the interference between the console and the shortcuts (if possible) can be done upstream (Qt) or with another PR. Tree-SHA512: 6b8bc07e8a3a75e53c05f0fdb73458d75ef025f950569e885e655de53fdac8b91dcabfb1c6e643b1d23065420fa2701847c00cc1718bc188778640aefb5bcbd8
2 parents b265ffe + 091747b commit 5cb1d93

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/qt/bitcoingui.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ void BitcoinGUI::createMenuBar()
493493
window_menu->addSeparator();
494494
for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) {
495495
QAction* tab_action = window_menu->addAction(rpcConsole->tabTitle(tab_type));
496+
tab_action->setShortcut(rpcConsole->tabShortcut(tab_type));
496497
connect(tab_action, &QAction::triggered, [this, tab_type] {
497498
rpcConsole->setTabFocus(tab_type);
498499
showDebugWindow();

src/qt/rpcconsole.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,16 @@ QString RPCConsole::tabTitle(TabTypes tab_type) const
12761276
return ui->tabWidget->tabText(tab_type);
12771277
}
12781278

1279+
QKeySequence RPCConsole::tabShortcut(TabTypes tab_type) const
1280+
{
1281+
switch (tab_type) {
1282+
case TAB_INFO: return QKeySequence(Qt::CTRL + Qt::Key_I);
1283+
case TAB_CONSOLE: return QKeySequence(Qt::CTRL + Qt::Key_T);
1284+
case TAB_GRAPH: return QKeySequence(Qt::CTRL + Qt::Key_N);
1285+
case TAB_PEERS: return QKeySequence(Qt::CTRL + Qt::Key_P);
1286+
}
1287+
}
1288+
12791289
void RPCConsole::updateAlerts(const QString& warnings)
12801290
{
12811291
this->ui->label_alerts->setVisible(!warnings.isEmpty());

src/qt/rpcconsole.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class RPCConsole: public QWidget
6868
std::vector<TabTypes> tabs() const { return {TAB_INFO, TAB_CONSOLE, TAB_GRAPH, TAB_PEERS}; }
6969

7070
QString tabTitle(TabTypes tab_type) const;
71+
QKeySequence tabShortcut(TabTypes tab_type) const;
7172

7273
protected:
7374
virtual bool eventFilter(QObject* obj, QEvent *event);

0 commit comments

Comments
 (0)