[PySide] PySide > Pyside2: QWebVIew and QWebPage

Alexey Vihorev vihorev at gmail.com
Sun Dec 10 14:50:42 CET 2017


Hi!
I guess you’re looking for this:

http://doc.qt.io/qt-5/qwebenginepage.html#acceptNavigationRequest

От: Frank Rueter | OHUfx
Отправлено: 10 декабря 2017 г. в 7:06
Кому: pyside at qt-project.org
Тема: [PySide] PySide > Pyside2: QWebVIew and QWebPage

Hi all,

I have this bit of code in PySide that I need to translate to work in PySide2.
The goal is to embed a functional webpage in my PySide2 application but delegate all clicked links to the system browser (instead of viewing them in the widget) 
from PySide.QtWebKit import QWebView, QWebPage
class HtmlView(QWebView):
    def __init__(self, parent=None):
        super(HtmlView, self).__init__(parent)
        self.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.linkClicked.connect(self.openWebsite)

I tried this for PySide2:
from PySide2.QtWebEngineWidgets import QWebEngineView, QWebEnginePage 
class HtmlView(QWebEngineView):
    def __init__(self, parent=None):
        super(HtmlView, self).__init__(parent)
        self.page().setLinkDelegationPolicy(QWebEnginePage.DelegateAllLinks)
        self.linkClicked.connect(self.openWebsite)
However, QWebEngineView.linkClicked does not exist and neither does QWebEngineView.setLinkDelegationPolicy or 
QWebEnginePage.DelegateAllLinks.

I'm aware that PySide2 is still alpha but I have to get this working somehow regardless.
Any help would be greatly appreciated.

Cheers,
frank
-- 


vfx compositing | workflow customisation and consulting 
 
 



Your gateway to over 1,000 free tools... right inside of Nuke 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20171210/9bdab3ed/attachment.html>


More information about the PySide mailing list