May 2019
Intermediate to advanced
542 pages
13h 37m
English
Currently, there is a problem with our script in that if you Ctrl + click on a hyperlink, or open a link that is configured to open a new window, nothing happens. By default, QWebEngineView is incapable of opening new tabs or windows. In order to enable this, we have to override its createWindow() method with a function that creates and returns a new QWebEngineView object.
We can do this fairly easily by updating our add_tab() method:
webview.createWindow = self.add_tab return webview
Rather than subclassing QWebEngineView to override the method, we'll just assign our MainWindow.add_tab() method to its createWindow() method. Then we just need to make sure that we return the created web view object at the end ...
Read now
Unlock full access