Commit 93802107 authored by Stefano Crocco's avatar Stefano Crocco
Browse files

Emit the openUrlRequest from a QTimer::singleShot

Middle-clicking on a link in a WebEnginePage correctly opens the link in
a new tab, but, incorrectly, leaves the focus in the location bar
instead of giving it to the new widget. Using a QTimer::singleShot to
ensure that the request to open the URL is made after all events have
been processed prevents this issue.

Note that this is only a workaround: it doesn't fix the true cause of
the problem.

1f014821


(cherry picked from commit 78f47b4d)
parent 3b0cd152
Pipeline #262428 passed with stage
in 5 minutes and 46 seconds
......@@ -894,6 +894,10 @@ bool NewWindowPage::acceptNavigationRequest(const QUrl &url, NavigationType type
webenginePart->setPage(this);
//Set the create new window flag to false...
m_createNewWindow = false;
if (webenginePart) {
QTimer::singleShot(0, [webenginePart, url](){emit webenginePart->browserExtension()->openUrlRequest(url);});
return false;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment