From 1a1473a18e2f1f56f02b16340035271039e25559 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 16 Jul 2014 14:10:46 +0200 Subject: [PATCH] Handle dirty tabbar layout correctly --- qutebrowser/widgets/mainwindow.py | 2 +- qutebrowser/widgets/tabwidget.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/qutebrowser/widgets/mainwindow.py b/qutebrowser/widgets/mainwindow.py index ac9b23cd7..fd79fa0ab 100644 --- a/qutebrowser/widgets/mainwindow.py +++ b/qutebrowser/widgets/mainwindow.py @@ -165,7 +165,7 @@ class MainWindow(QWidget): super().resizeEvent(e) self.resize_completion() self.downloadview.updateGeometry() - self.tabs.tabBar().updateGeometry() + self.tabs.tabBar().refresh() def closeEvent(self, e): """Override closeEvent to display a confirmation if needed.""" diff --git a/qutebrowser/widgets/tabwidget.py b/qutebrowser/widgets/tabwidget.py index ab65e7f68..f398e9ee2 100644 --- a/qutebrowser/widgets/tabwidget.py +++ b/qutebrowser/widgets/tabwidget.py @@ -95,7 +95,7 @@ class TabWidget(QTabWidget): self.setTabPosition(position) tabbar.vertical = position in (QTabWidget.West, QTabWidget.East) tabbar.setSelectionBehaviorOnRemove(select_conv[selstr]) - tabbar.updateGeometry() + tabbar.refresh() @pyqtSlot(str, str) def on_config_changed(self, section, _option): @@ -125,6 +125,13 @@ class TabBar(QTabBar): return '<{} with {} tabs>'.format(self.__class__.__name__, self.count()) + def refresh(self): + """Properly repaint the tab bar and relayout tabs.""" + # This is a horrible hack, but we need to do this so the underlaying Qt + # code sets layoutDirty so it actually relayouts the tabs. + self.setIconSize(self.iconSize()) + self.updateGeometry() + def set_tab_indicator_color(self, idx, color): """Set the tab indicator color.