mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ensure showing a column never results in a size zero column
This commit is contained in:
parent
7881a8da66
commit
cc9457da00
@ -75,6 +75,9 @@ class BooksView(QTableView): # {{{
|
||||
h.setSectionHidden(idx, True)
|
||||
elif action == 'show':
|
||||
h.setSectionHidden(idx, False)
|
||||
if h.sectionSize(idx) < 3:
|
||||
sz = h.sectionSizeHint(idx)
|
||||
h.resizeSection(idx, sz)
|
||||
elif action == 'ascending':
|
||||
self.sortByColumn(idx, Qt.AscendingOrder)
|
||||
elif action == 'descending':
|
||||
@ -257,6 +260,11 @@ class BooksView(QTableView): # {{{
|
||||
for col, alignment in state.get('column_alignment', {}).items():
|
||||
self._model.change_alignment(col, alignment)
|
||||
|
||||
for i in range(h.count()):
|
||||
if not h.isSectionHidden(i) and h.sectionSize(i) < 3:
|
||||
sz = h.sectionSizeHint(i)
|
||||
h.resizeSection(i, sz)
|
||||
|
||||
def get_default_state(self):
|
||||
old_state = {
|
||||
'hidden_columns': [],
|
||||
|
Loading…
x
Reference in New Issue
Block a user