From 0209382df4373bbb8bf9335f51d9efee9e3fb7e1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 15 Oct 2014 21:30:04 +0200 Subject: [PATCH] Fix redrawing of downloadview if there are downloads added. --- qutebrowser/widgets/downloads.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/qutebrowser/widgets/downloads.py b/qutebrowser/widgets/downloads.py index ad1c6215f..d0e1541f8 100644 --- a/qutebrowser/widgets/downloads.py +++ b/qutebrowser/widgets/downloads.py @@ -22,7 +22,7 @@ import functools import sip -from PyQt5.QtCore import pyqtSlot, QSize, Qt +from PyQt5.QtCore import pyqtSlot, QSize, Qt, QTimer from PyQt5.QtWidgets import QListView, QSizePolicy, QMenu from qutebrowser.browser import downloads @@ -44,9 +44,16 @@ def update_geometry(obj): Original bug: https://github.com/The-Compiler/qutebrowser/issues/167 Workaround bug: https://github.com/The-Compiler/qutebrowser/issues/171 """ - if sip.isdeleted(obj): - return - obj.updateGeometry() + + def _update_geometry(): + """Actually update the geometry if the object still exists.""" + if sip.isdeleted(obj): + return + obj.updateGeometry() + + # If we don't use a singleShot QTimer, the geometry isn't updated correctly + # and won't include the new item. + QTimer.singleShot(0, _update_geometry) class DownloadView(QListView):