1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Workaround wrong focus when opening new tab from createWindow()

This commit is contained in:
David Rosca 2017-07-19 13:57:37 +02:00
parent cbba636f61
commit 6f08f94e0f

View File

@ -591,6 +591,15 @@ QWebEnginePage* WebPage::createWindow(QWebEnginePage::WebWindowType type)
int index = window->tabWidget()->addView(QUrl(), pos);
TabbedWebView* view = window->weView(index);
view->setPage(new WebPage);
// Workaround focus issue when creating tab
if (pos.testFlag(Qz::NT_SelectedTab)) {
QPointer<TabbedWebView> pview = view;
QTimer::singleShot(0, this, [pview]() {
if (pview && pview->webTab()->isCurrentTab()) {
pview->setFocus();
}
});
}
return view->page();
};