diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 65266b5eac..5baee4f5d0 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -561,16 +561,12 @@ class BooksView(QTableView): # {{{ 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 the ghost - # of the ondevice column remains visible when changing libraries - try: - col = self._model.column_map.index('ondevice') - except ValueError: - pass # DeviceBooksView - else: - val = h.isSectionHidden(col) - h.setSectionHidden(col, not val) - h.setSectionHidden(col, val) + # 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 = {