Fix lint
This commit is contained in:
parent
5147fc832c
commit
7e31897dcc
@ -30,7 +30,7 @@ from PyQt5.QtCore import (pyqtSignal, pyqtSlot, Qt, QEvent, QPoint, QPointF,
|
||||
QUrl, QTimer)
|
||||
from PyQt5.QtGui import QKeyEvent, QIcon
|
||||
from PyQt5.QtNetwork import QAuthenticator
|
||||
from PyQt5.QtWidgets import QApplication, QWidget
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineScript
|
||||
|
||||
from qutebrowser.config import configdata, config
|
||||
|
@ -58,7 +58,12 @@ class WebEngineView(QWebEngineView):
|
||||
self._layout = miscwidgets.PseudoLayout(self)
|
||||
|
||||
def render_widget(self):
|
||||
"""Get the RenderWidgetHostViewQt for this view."""
|
||||
"""Get the RenderWidgetHostViewQt for this view.
|
||||
|
||||
Normally, this would always be the focusProxy().
|
||||
However, it sometimes isn't, so we use this as a WORKAROUND for
|
||||
https://bugreports.qt.io/browse/QTBUG-68727
|
||||
"""
|
||||
proxy = self.focusProxy()
|
||||
if proxy is not None:
|
||||
return proxy
|
||||
|
@ -268,6 +268,15 @@ class WrapperLayout(QLayout):
|
||||
|
||||
class PseudoLayout(QLayout):
|
||||
|
||||
"""A layout which isn't actually a real layout.
|
||||
|
||||
This is used to replace QWebEngineView's internal layout, as a WORKAROUND
|
||||
for https://bugreports.qt.io/browse/QTBUG-68224 and other related issues.
|
||||
|
||||
This is partly inspired by https://codereview.qt-project.org/#/c/230894/
|
||||
which does something similar as part of Qt.
|
||||
"""
|
||||
|
||||
def addItem(self, item):
|
||||
assert self.parent() is not None
|
||||
item.widget().setParent(self.parent())
|
||||
@ -285,11 +294,13 @@ class PseudoLayout(QLayout):
|
||||
return self.parent().render_widget()
|
||||
|
||||
def setGeometry(self, rect):
|
||||
"""Resize the render widget when the view is resized."""
|
||||
widget = self.widget()
|
||||
if widget is not None:
|
||||
widget.setGeometry(rect)
|
||||
|
||||
def sizeHint(self):
|
||||
"""Make sure the view has the sizeHint of the render widget."""
|
||||
widget = self.widget()
|
||||
if widget is not None:
|
||||
return widget.sizeHint()
|
||||
|
Loading…
Reference in New Issue
Block a user