From 3c5acb5ed61a8429d119350c6dd5cc9037921da9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 31 Aug 2014 00:49:28 +0530 Subject: [PATCH] Fix regression in 2.1 that prevented the saved column layout from being applied. Fixes #1363470 [calibre 2.1 won't save column layout](https://bugs.launchpad.net/calibre/+bug/1363470) --- src/calibre/gui2/library/views.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 26ee5ae0d5..1652617ffb 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -542,6 +542,14 @@ class BooksView(QTableView): # {{{ if current_pos != pos: h.moveSection(current_pos, pos) + # Because of a bug in Qt 5 we have to ensure that the header is actually + # relaid out by changing this value, without this sometimes ghost + # columns remain visible when changing libraries + for i in xrange(h.count()): + val = h.isSectionHidden(i) + h.setSectionHidden(i, not val) + h.setSectionHidden(i, val) + sizes = state.get('column_sizes', {}) for col, size in sizes.items(): if col in cmap: @@ -560,13 +568,6 @@ class BooksView(QTableView): # {{{ if not h.isSectionHidden(i) and h.sectionSize(i) < 3: sz = h.sectionSizeHint(i) h.resizeSection(i, sz) - # Because of a bug in Qt 5 we have to ensure that the header is actually - # relaid out by changing this value, without this sometimes ghost - # columns remain visible when changing libraries - for i in xrange(h.count()): - val = h.isSectionHidden(i) - h.setSectionHidden(i, not val) - h.setSectionHidden(i, val) def get_default_state(self): old_state = {