1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Track parent tab for WebTab when opening new tabs

This commit is contained in:
David Rosca 2018-01-30 16:02:54 +01:00
parent e44877d4c7
commit 5b7653188b
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
3 changed files with 10 additions and 2 deletions

View File

@ -623,6 +623,9 @@ QWebEnginePage* WebPage::createWindow(QWebEnginePage::WebWindowType type)
int index = window->tabWidget()->addView(QUrl(), pos); int index = window->tabWidget()->addView(QUrl(), pos);
TabbedWebView* view = window->weView(index); TabbedWebView* view = window->weView(index);
view->setPage(new WebPage); view->setPage(new WebPage);
if (tView) {
view->webTab()->setParentTab(tView->webTab());
}
// Workaround focus issue when creating tab // Workaround focus issue when creating tab
if (pos.testFlag(Qz::NT_SelectedTab)) { if (pos.testFlag(Qz::NT_SelectedTab)) {
QPointer<TabbedWebView> pview = view; QPointer<TabbedWebView> pview = view;

View File

@ -165,8 +165,10 @@ void TabbedWebView::loadInNewTab(const LoadRequest &req, Qz::NewTabPositionFlags
{ {
if (m_window) { if (m_window) {
int index = m_window->tabWidget()->addView(QUrl(), position); int index = m_window->tabWidget()->addView(QUrl(), position);
m_window->weView(index)->webTab()->locationBar()->showUrl(req.url()); TabbedWebView *view = m_window->weView(index);
m_window->weView(index)->load(req); view->webTab()->setParentTab(webTab());
view->webTab()->locationBar()->showUrl(req.url());
view->load(req);
} }
} }

View File

@ -284,6 +284,9 @@ void WebTab::detach()
Q_ASSERT(m_window); Q_ASSERT(m_window);
Q_ASSERT(m_tabBar); Q_ASSERT(m_tabBar);
// Remove parent tab
setParentTab(nullptr);
// Remove icon from tab // Remove icon from tab
m_tabBar->setTabButton(tabIndex(), m_tabBar->iconButtonPosition(), nullptr); m_tabBar->setTabButton(tabIndex(), m_tabBar->iconButtonPosition(), nullptr);
m_tabIcon->setParent(this); m_tabIcon->setParent(this);