Allow changing the icons in yes/no columns via column icon rules. Fixes #1721374 [[enhancement] allow icon substitutions for yes/no](https://bugs.launchpad.net/calibre/+bug/1721374)

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2017-10-05 15:42:35 +05:30
commit 64659a6af3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -934,11 +934,9 @@ class BooksModel(QAbstractTableModel): # {{{
self.column_color.mi = None
return None
elif role == Qt.DecorationRole:
default_icon = None
if self.column_to_dc_decorator_map[col] is not None:
ccicon = self.column_to_dc_decorator_map[index.column()](index.row())
if ccicon is not None:
return ccicon
default_icon = self.column_to_dc_decorator_map[index.column()](index.row())
rules = self.db.prefs['column_icon_rules']
if rules:
key = self.column_map[col]
@ -960,10 +958,11 @@ class BooksModel(QAbstractTableModel): # {{{
self.icon_template_cache)
if ccicon is not None:
return ccicon
if need_icon_with_text:
if need_icon_with_text and default_icon is None:
self.icon_cache[id_][cache_index] = self.bool_blank_icon
return self.bool_blank_icon
self.icon_cache[id_][cache_index] = None
return default_icon
elif role == Qt.TextAlignmentRole:
cname = self.column_map[index.column()]
ans = Qt.AlignVCenter | ALIGNMENT_MAP[self.alignment_map.get(cname,