From dff94f6f62c93186756261721087504a36a8f7f9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 20 Jan 2024 08:24:36 +0530 Subject: [PATCH] Better fix for delegate max width calculation Use the width of the viewport widget as that automatically excludes scrollbars. --- src/calibre/gui2/library/delegates.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index dca1b3bf10..a83465682d 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -82,11 +82,8 @@ class UpdateEditorGeometry: is_pin_view = True break p = p.parent() - if is_pin_view: - max_width = pin_view.horizontalScrollBar().geometry().width() - else: - view = self.table_widget - max_width = view.rect().width() - view.verticalHeader().width() + + max_width = (pin_view if is_pin_view else self.table_widget).viewport().rect().width() # What we have to display might not fit. If so, adjust down new_width = new_width if new_width < max_width else max_width