From f4f586a211aaf8c5f81aee8619ec12b96c502b3a Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Thu, 5 Oct 2017 08:44:57 +0200 Subject: [PATCH] Allow column icon rules on decorated columns such as yes/no. Enhancement #1721374 --- src/calibre/gui2/library/models.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 0ef6f9aae4..552d5e8270 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -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,