本文整理汇总了Python中PyQt5.QtWebEngineWidgets.QWebEnginePage方法的典型用法代码示例。如果您正苦于以下问题:Python QtWebEngineWidgets.QWebEnginePage方法的具体用法?Python QtWebEngineWidgets.QWebEnginePage怎么用?Python QtWebEngineWidgets.QWebEnginePage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWebEngineWidgets
的用法示例。
在下文中一共展示了QtWebEngineWidgets.QWebEnginePage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEnginePage [as 别名]
def __init__(self, parent=None):
super(DocView, self).__init__(parent)
class DocPage(QWebPage):
def __init__(self, parent=None):
super(DocPage, self).__init__(parent)
def acceptNavigationRequest(self, url, navtype, ismainframe):
if navtype == self.NavigationTypeLinkClicked:
if url.url()[:6].lower() == 'stack:':
DocWindow.app.stack(url.url()[6:].lower())
return False
return True
self.page = DocPage()
self.setPage(self.page)
示例2: add_tab
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEnginePage [as 别名]
def add_tab(self, *args):
webview = qtwe.QWebEngineView()
tab_index = self.tabs.addTab(webview, 'New Tab')
webview.urlChanged.connect(
lambda x: self.tabs.setTabText(tab_index, x.toString()))
webview.urlChanged.connect(
lambda x: self.urlbar.setText(x.toString()))
# make it so pop-up windows call this method
webview.createWindow = self.add_tab
# History
webview.urlChanged.connect(self.update_history)
# Profile
page = qtwe.QWebEnginePage(self.profile)
webview.setPage(page)
# Add the finder script
page.scripts().insert(self.finder_script)
# set default content
webview.setHtml(
'<h1>Blank Tab</h1><p>It is a blank tab!</p>',
qtc.QUrl('about:blank'))
return webview
示例3: __init__
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEnginePage [as 别名]
def __init__(self):
super(LoginWindow, self).__init__()
self.setupUi(self)
profile = QtWebEngineWidgets.QWebEngineProfile(self.webEngineView)
webpage = QtWebEngineWidgets.QWebEnginePage(profile, self.webEngineView)
self.webEngineView.setPage(webpage)
self.cookie_store = profile.cookieStore()
self.cookie_store.cookieAdded.connect(self.onCookieAdded)
self.cookies = dict()
self.resetWebview()
self.webEngineView.load(QtCore.QUrl("https://www.yiban.cn/login"))