Try these questions to test your knowledge from this chapter:
- The following code is giving you an attribute error; what's wrong?
from PyQt5 import QtWebEngine as qtwe
w = qtwe.QWebEngineView()
- The following code should connect this UrlBar class with a QWebEngineView so that the entered URL is loaded when the return/Enter key is pressed. It doesn't work, though; what is wrong?
class UrlBar(qtw.QLineEdit):
url_request = qtc.pyqtSignal(str)
def __init__(self):
super().__init__()
self.returnPressed.connect(self.request)
def request(self):
self.url_request.emit(self.text())
mywebview = qtwe.QWebEngineView()
myurlbar = UrlBar()
myurlbar.url_request(mywebview.load)
- What is the result of the following code?
class WebView(qtwe.QWebEngineView):
def createWindow(self, _):
return self...