From a55e02b36d338564a5a6655842ae5e2d7e9d169b Mon Sep 17 00:00:00 2001 From: glubsy Date: Wed, 2 Sep 2020 23:45:31 +0200 Subject: [PATCH] Fix table maximum size being off by a few pixels * Sometimes, the splitter doesn't fully reach the table maximum height, and the scrollbar is still displayed on the right because a few pixels are still hidden. * It seems the splitter handle counts towards the total height of the widget (the table), so we add it to the maximum height of the table * The scrollbar disappears when we reach just above the actual table's height --- qt/pe/details_dialog.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/qt/pe/details_dialog.py b/qt/pe/details_dialog.py index c83ee754..324a1307 100644 --- a/qt/pe/details_dialog.py +++ b/qt/pe/details_dialog.py @@ -9,7 +9,6 @@ from PyQt5.QtWidgets import ( QAbstractItemView, QSizePolicy, QGridLayout, QSplitter, QFrame) from PyQt5.QtGui import QResizeEvent from hscommon.trans import trget -from hscommon.plat import ISWINDOWS from ..details_dialog import DetailsDialog as DetailsDialogBase from ..details_table import DetailsTable from .image_viewer import ( @@ -102,14 +101,14 @@ class DetailsDialog(DetailsDialogBase): self.vController.updateBothImages() def show(self): - # Compute the maximum size the table view can reach - # Assuming all rows below headers have the same height + # Give the splitter a maximum height to reach. This is assuming that + # all rows below their headers have the same height self.tableView.setMaximumHeight( self.tableView.rowHeight(1) * self.tableModel.model.row_count() + self.tableView.verticalHeader().sectionSize(0) - # Windows seems to add a few pixels more to the table somehow - + (5 if ISWINDOWS else 0)) + # looks like the handle is taken into account by the splitter + + self.splitter.handle(1).size().height()) DetailsDialogBase.show(self) self.ensure_same_sizes() self._update()