Added ability to open last tab with Ctrl+9. (Chromium behaviour.)

- Fixed #1106.
This commit is contained in:
23rd 2019-08-04 17:22:48 +03:00
parent c578cd47e1
commit 838fd6bab6
3 changed files with 13 additions and 1 deletions

View file

@ -256,6 +256,17 @@ void Notebook::selectPreviousTab()
this->select(this->items_[index].page); this->select(this->items_[index].page);
} }
void Notebook::selectLastTab()
{
const auto size = this->items_.size();
if (size <= 1)
{
return;
}
this->select(this->items_[size - 1].page);
}
int Notebook::getPageCount() const int Notebook::getPageCount() const
{ {
return this->items_.count(); return this->items_.count();

View file

@ -34,6 +34,7 @@ public:
void selectIndex(int index); void selectIndex(int index);
void selectNextTab(); void selectNextTab();
void selectPreviousTab(); void selectPreviousTab();
void selectLastTab();
int getPageCount() const; int getPageCount() const;
QWidget *getPageAt(int index) const; QWidget *getPageAt(int index) const;

View file

@ -287,7 +287,7 @@ void Window::addShortcuts()
createWindowShortcut(this, "CTRL+8", createWindowShortcut(this, "CTRL+8",
[this] { this->notebook_->selectIndex(7); }); [this] { this->notebook_->selectIndex(7); });
createWindowShortcut(this, "CTRL+9", createWindowShortcut(this, "CTRL+9",
[this] { this->notebook_->selectIndex(8); }); [this] { this->notebook_->selectLastTab(); });
// Zoom in // Zoom in
{ {