From d8aa232df94a2df3fa038179cb59837113fdd391 Mon Sep 17 00:00:00 2001 From: Tal Neoran Date: Sat, 9 Oct 2021 19:09:11 +0300 Subject: [PATCH] Add keybindings to tab context menu items (#3265) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Paweł --- src/widgets/Notebook.cpp | 9 ++++++--- src/widgets/helper/NotebookTab.cpp | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 1d1bbe78..0537126e 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -36,9 +36,12 @@ Notebook::Notebook(QWidget *parent) this->addButton_->setHidden(true); - this->menu_.addAction("Toggle visibility of tabs", [this]() { - this->setShowTabs(!this->getShowTabs()); - }); + this->menu_.addAction( + "Toggle visibility of tabs", + [this]() { + this->setShowTabs(!this->getShowTabs()); + }, + QKeySequence("Ctrl+U")); } NotebookTab *Notebook::addPage(QWidget *page, QString title, bool select) diff --git a/src/widgets/helper/NotebookTab.cpp b/src/widgets/helper/NotebookTab.cpp index bb53599f..3dd18d87 100644 --- a/src/widgets/helper/NotebookTab.cpp +++ b/src/widgets/helper/NotebookTab.cpp @@ -60,9 +60,12 @@ NotebookTab::NotebookTab(Notebook *notebook) this->showRenameDialog(); }); - this->menu_.addAction("Close Tab", [=]() { - this->notebook_->removePage(this->page); - }); + this->menu_.addAction( + "Close Tab", + [=]() { + this->notebook_->removePage(this->page); + }, + QKeySequence("Ctrl+Shift+W")); this->menu_.addAction( "Popup Tab", @@ -86,9 +89,12 @@ NotebookTab::NotebookTab(Notebook *notebook) this->menu_.addSeparator(); - this->menu_.addAction("Toggle visibility of tabs", [this]() { - this->notebook_->setShowTabs(!this->notebook_->getShowTabs()); - }); + this->menu_.addAction( + "Toggle visibility of tabs", + [this]() { + this->notebook_->setShowTabs(!this->notebook_->getShowTabs()); + }, + QKeySequence("Ctrl+U")); } void NotebookTab::showRenameDialog()