本文整理匯總了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"))