From a4fc8c165c90abdb5e4bf023ac264655cd8071e7 Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Mon, 2 Sep 2024 17:52:44 -0400 Subject: [PATCH] feat(ui): add shortcut (Ctrl+B) to toggle sidebar visibility Fixes #1652. --- src/libs/ui/mainwindow.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libs/ui/mainwindow.cpp b/src/libs/ui/mainwindow.cpp index 56da8c5a..440aaf67 100644 --- a/src/libs/ui/mainwindow.cpp +++ b/src/libs/ui/mainwindow.cpp @@ -80,6 +80,19 @@ MainWindow::MainWindow(Core::Application *app, QWidget *parent) shortcut = new QShortcut(QStringLiteral("Ctrl+Alt+T"), this); connect(shortcut, &QShortcut::activated, this, [this]() { duplicateTab(m_tabBar->currentIndex()); }); + // Hide/show sidebar. + // TODO: Move to the View menu. + shortcut = new QShortcut(QStringLiteral("Ctrl+B"), this); + connect(shortcut, &QShortcut::activated, this, [this]() { + auto sb = ui->splitter->widget(0); + if (sb == nullptr) { + // This should not really happen. + return; + } + + sb->setVisible(!sb->isVisible()); + }); + restoreGeometry(m_settings->windowGeometry); // Menu