Make any link (even _blank) open in same window using QWebEngine

徘徊边缘 提交于 2019-12-06 08:43:57

If you want links to always open in the same window, you can reimplement the createWindow method, so that it returns the same view:

class HtmlView(QWebEngineView):
    def createWindow(self, wintype):
        return self

The wintype argument provides information about which type of window is being requested. You may want to treat dialog windows differently.

Note that the WebEnginePage subclass in your example is not needed for this to work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!