1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Vertical Tabs: Add child tab with middle click on "New Tab" button

Summary:
BUG: 393656

Reviewers: #falkon, drosca

Reviewed By: #falkon, drosca

Subscribers: drosca, falkon

Tags: #falkon

Differential Revision: https://phabricator.kde.org/D21664
This commit is contained in:
Juraj Oravec 2019-06-10 12:06:13 +02:00 committed by David Rosca
parent 493421dd84
commit dfb3d2357d
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 10 additions and 0 deletions

View File

@ -59,6 +59,7 @@ VerticalTabsWidget::VerticalTabsWidget(BrowserWindow *window)
buttonAddTab->setIcon(QIcon::fromTheme(QSL("list-add"))); buttonAddTab->setIcon(QIcon::fromTheme(QSL("list-add")));
buttonAddTab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); buttonAddTab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
connect(buttonAddTab, &QAbstractButton::clicked, m_window, &BrowserWindow::addTab); connect(buttonAddTab, &QAbstractButton::clicked, m_window, &BrowserWindow::addTab);
connect(buttonAddTab, &ToolButton::middleMouseClicked, this, &VerticalTabsWidget::addChildTab);
m_groupMenu = new QMenu(this); m_groupMenu = new QMenu(this);
buttonAddTab->setMenu(m_groupMenu); buttonAddTab->setMenu(m_groupMenu);
@ -201,3 +202,10 @@ void VerticalTabsWidget::updateGroupMenu()
m_window->tabWidget()->addView(QUrl(QSL("extension://verticaltabs/group")), Qz::NT_SelectedTab); m_window->tabWidget()->addView(QUrl(QSL("extension://verticaltabs/group")), Qz::NT_SelectedTab);
}); });
} }
void VerticalTabsWidget::addChildTab()
{
WebTab *tab = m_window->tabWidget()->webTab();
m_window->addTab();
m_window->tabWidget()->webTab()->setParentTab(tab);
}

View File

@ -43,6 +43,8 @@ public:
void switchToNextTab(); void switchToNextTab();
void switchToPreviousTab(); void switchToPreviousTab();
void addChildTab();
private: private:
WebTab *nextTab() const; WebTab *nextTab() const;
WebTab *previousTab() const; WebTab *previousTab() const;