Handle resizing via PseudoLayout

This fixes the scenario where we just get a grey view when opening a link in a
tab from DuckDuckGo.
This commit is contained in:
Florian Bruhin 2018-06-06 17:51:00 +02:00
parent ec6c5ebb69
commit 5147fc832c
2 changed files with 14 additions and 5 deletions

View File

@ -73,11 +73,6 @@ class WebEngineView(QWebEngineView):
def shutdown(self):
self.page().shutdown()
def resizeEvent(self, _event):
widget = self.render_widget()
if widget is not None:
widget.setGeometry(self.rect())
def createWindow(self, wintype):
"""Called by Qt when a page wants to create a new window.

View File

@ -281,6 +281,20 @@ class PseudoLayout(QLayout):
def itemAt(self, _pos):
return None
def widget(self):
return self.parent().render_widget()
def setGeometry(self, rect):
widget = self.widget()
if widget is not None:
widget.setGeometry(rect)
def sizeHint(self):
widget = self.widget()
if widget is not None:
return widget.sizeHint()
return QSize()
class FullscreenNotification(QLabel):