Cleanup code

This commit is contained in:
Kovid Goyal 2023-05-07 15:51:53 +05:30
parent b2d0fb5cf7
commit cd085fc844
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1339,18 +1339,15 @@ class BooksView(QTableView): # {{{
h = (viewport_height // 2) if pos == 'center' else viewport_height h = (viewport_height // 2) if pos == 'center' else viewport_height
y = cell_height y = cell_height
while vertical_index > 0: while vertical_index > 0:
r = vh.logicalIndex(vertical_index - 1) y += vh.sectionSize(vh.logicalIndex(vertical_index -1))
y += vh.sectionSize(r)
if y > h: if y > h:
break break
vertical_index -= 1 vertical_index -= 1
hidden_sections = 0
if vh.sectionsHidden(): if vh.sectionsHidden():
for s in range(vertical_index - 1, -1, -1): for s in range(vertical_index - 1, -1, -1):
r = vh.logicalIndex(s) if vh.isSectionHidden(vh.logicalIndex(s)):
if vh.isSectionHidden(r): vertical_index -= 1
hidden_sections += 1 vsb.setValue(vertical_index)
vsb.setValue(vertical_index - hidden_sections)
@property @property
def current_book(self): def current_book(self):