From 4937ecf44d8f3c9f03cba7d2efa50eefc95ffe42 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 Aug 2014 10:43:08 +0530 Subject: [PATCH] Workaround for a bug in Qt 5 that caused a ghost of the ondevice column to become visible sometimes when switching libraries. --- src/calibre/gui2/library/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py index 4bbe4da691..885f563c06 100644 --- a/src/calibre/gui2/library/views.py +++ b/src/calibre/gui2/library/views.py @@ -456,9 +456,12 @@ class BooksView(QTableView): # {{{ # Ondevice column {{{ def set_ondevice_column_visibility(self): - m = self._model - self.column_header.setSectionHidden(m.column_map.index('ondevice'), - not m.device_connected) + col, h = self._model.column_map.index('ondevice'), self.column_header + # 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 + h.setSectionHidden(col, not h.isSectionHidden(col)) + h.setSectionHidden(col, not self._model.device_connected) def set_device_connected(self, is_connected): self._model.set_device_connected(is_connected)