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)

This commit is contained in:
Kovid Goyal 2014-08-31 00:49:28 +05:30
parent 3d265ffdea
commit 3c5acb5ed6

View File

@ -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 = {