Possible fix for incorrect size calculation with marked icon. Fixes #1486398 [Wrong column width for book row number in marked books after deletion of a marked book](https://bugs.launchpad.net/calibre/+bug/1486398)

This commit is contained in:
Kovid Goyal 2015-08-19 15:58:15 +05:30
parent fee64691ea
commit 3ccbb75c06
2 changed files with 5 additions and 2 deletions

View File

@ -211,6 +211,7 @@ class BooksModel(QAbstractTableModel): # {{{
# remember that the cover grid view needs a larger version of the icon, # remember that the cover grid view needs a larger version of the icon,
# anyway) # anyway)
self.marked_icon = QIcon(I('marked.png')) self.marked_icon = QIcon(I('marked.png'))
self.bool_blank_icon_as_icon = QIcon(self.bool_blank_icon)
self.row_decoration = None self.row_decoration = None
self.device_connected = False self.device_connected = False
self.ids_to_highlight = [] self.ids_to_highlight = []
@ -235,7 +236,7 @@ class BooksModel(QAbstractTableModel): # {{{
self.row_height = height self.row_height = height
def set_row_decoration(self, current_marked): def set_row_decoration(self, current_marked):
self.row_decoration = self.bool_blank_icon if current_marked else None self.row_decoration = self.bool_blank_icon_as_icon if current_marked else None
def change_alignment(self, colname, alignment): def change_alignment(self, colname, alignment):
if colname in self.column_map and alignment in ('left', 'right', 'center'): if colname in self.column_map and alignment in ('left', 'right', 'center'):

View File

@ -55,7 +55,9 @@ class HeaderView(QHeaderView): # {{{
opt.text = unicode(model.headerData(logical_index, opt.orientation, Qt.DisplayRole) or '') opt.text = unicode(model.headerData(logical_index, opt.orientation, Qt.DisplayRole) or '')
if opt.orientation == Qt.Vertical: if opt.orientation == Qt.Vertical:
try: try:
opt.icon = model.headerData(logical_index, opt.orientation, Qt.DecorationRole) val = model.headerData(logical_index, opt.orientation, Qt.DecorationRole)
if val is not None:
opt.icon = val
opt.iconAlignment = Qt.AlignVCenter opt.iconAlignment = Qt.AlignVCenter
except (IndexError, ValueError, TypeError): except (IndexError, ValueError, TypeError):
pass pass