Skip to content

Commit 091747b

Browse files
committed
gui: Add shortcuts for tab tools
1 parent 4b51ed8 commit 091747b

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)