- The following code is giving you an attribute error; what's wrong?
from PyQt5 import QtWebEngine as qtwe
w = qtwe.QWebEngineView()
You want to import QtWebEngineWidgets, not QtWebEngine. The latter is for use with Qt's QML frontend.
- The following code should connect this UrlBar class with 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)
QWebEngineView.load() requires a QUrl object, not a string. The url_request signal sends the...