Workaround for a bug in Qt 5 that caused a ghost of the ondevice column to become visible sometimes when switching libraries.

This commit is contained in:
Kovid Goyal 2014-08-15 10:43:08 +05:30
parent f4c0d0933e
commit 4937ecf44d

View File

@ -456,9 +456,12 @@ class BooksView(QTableView): # {{{
# Ondevice column {{{ # Ondevice column {{{
def set_ondevice_column_visibility(self): def set_ondevice_column_visibility(self):
m = self._model col, h = self._model.column_map.index('ondevice'), self.column_header
self.column_header.setSectionHidden(m.column_map.index('ondevice'), # Because of a bug in Qt 5 we have to ensure that the header is actually
not m.device_connected) # 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): def set_device_connected(self, is_connected):
self._model.set_device_connected(is_connected) self._model.set_device_connected(is_connected)