From b2ab2bfd6a83659aaaa6f27626e93f7db46c0a6a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 11 Feb 2018 17:09:07 +0530 Subject: [PATCH] Fix some edit widget appearing in the wrong place when editing in the right hand panel of the new split book list. Fixes #1748713 [Custom Column edit popup appears in wrong place with split book list](https://bugs.launchpad.net/calibre/+bug/1748713) --- src/calibre/gui2/library/delegates.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/library/delegates.py b/src/calibre/gui2/library/delegates.py index 7511e739b4..c9251496ec 100644 --- a/src/calibre/gui2/library/delegates.py +++ b/src/calibre/gui2/library/delegates.py @@ -64,8 +64,12 @@ class UpdateEditorGeometry(object): new_width += r.width() # Compute the maximum we can show if we consume the entire viewport - max_width = (self.table_widget.horizontalScrollBar().geometry().width() - - self.table_widget.verticalHeader().width()) + pin_view = self.table_widget.pin_view + if pin_view.isVisible() and pin_view.geometry().x() <= initial_geometry.x(): + max_width = pin_view.horizontalScrollBar().geometry().width() + else: + view = self.table_widget + max_width = view.horizontalScrollBar().geometry().width() - view.verticalHeader().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 @@ -156,6 +160,7 @@ def make_clearing_spinbox(spinbox): return spinbox.keyPressEvent(self, ev) return SpinBox + ClearingSpinBox = make_clearing_spinbox(QSpinBox) ClearingDoubleSpinBox = make_clearing_spinbox(QDoubleSpinBox)