mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 10:23:16 +02:00
Ensure showing a column never results in a size zero column
This commit is contained in:
parent
7881a8da66
commit
cc9457da00
1 changed files with 8 additions and 0 deletions
|
|
@ -75,6 +75,9 @@ def column_header_context_handler(self, action=None, column=None):
|
|||
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 @@ def apply_state(self, state):
|
|||
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…
Reference in a new issue