Add keybindings to tab context menu items (#3265)

Co-authored-by: Paweł <zneix@zneix.eu>
This commit is contained in:
Tal Neoran 2021-10-09 19:09:11 +03:00 committed by GitHub
parent fa5a9fe831
commit d8aa232df9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View file

@ -36,9 +36,12 @@ Notebook::Notebook(QWidget *parent)
this->addButton_->setHidden(true); this->addButton_->setHidden(true);
this->menu_.addAction("Toggle visibility of tabs", [this]() { this->menu_.addAction(
this->setShowTabs(!this->getShowTabs()); "Toggle visibility of tabs",
}); [this]() {
this->setShowTabs(!this->getShowTabs());
},
QKeySequence("Ctrl+U"));
} }
NotebookTab *Notebook::addPage(QWidget *page, QString title, bool select) NotebookTab *Notebook::addPage(QWidget *page, QString title, bool select)

View file

@ -60,9 +60,12 @@ NotebookTab::NotebookTab(Notebook *notebook)
this->showRenameDialog(); this->showRenameDialog();
}); });
this->menu_.addAction("Close Tab", [=]() { this->menu_.addAction(
this->notebook_->removePage(this->page); "Close Tab",
}); [=]() {
this->notebook_->removePage(this->page);
},
QKeySequence("Ctrl+Shift+W"));
this->menu_.addAction( this->menu_.addAction(
"Popup Tab", "Popup Tab",
@ -86,9 +89,12 @@ NotebookTab::NotebookTab(Notebook *notebook)
this->menu_.addSeparator(); this->menu_.addSeparator();
this->menu_.addAction("Toggle visibility of tabs", [this]() { this->menu_.addAction(
this->notebook_->setShowTabs(!this->notebook_->getShowTabs()); "Toggle visibility of tabs",
}); [this]() {
this->notebook_->setShowTabs(!this->notebook_->getShowTabs());
},
QKeySequence("Ctrl+U"));
} }
void NotebookTab::showRenameDialog() void NotebookTab::showRenameDialog()