Fix #1011030 (Search result not highlighted in tag browser)

This commit is contained in:
Kovid Goyal 2012-06-10 09:56:09 +05:30
parent 461f965386
commit e378c4d599

View File

@ -25,13 +25,19 @@ class TagDelegate(QStyledItemDelegate): # {{{
def paint(self, painter, option, index):
item = index.data(Qt.UserRole).toPyObject()
QStyledItemDelegate.paint(self, painter, option, index)
widget = self.parent()
style = QApplication.style() if widget is None else widget.style()
self.initStyleOption(option, index)
if item.boxed:
r = style.subElementRect(style.SE_ItemViewItemFocusRect, option,
widget)
painter.save()
painter.drawLine(r.bottomLeft(), r.bottomRight())
painter.restore()
if item.type != TagTreeItem.TAG:
return
if (item.tag.state == 0 and config['show_avg_rating'] and
item.tag.avg_rating is not None):
self.initStyleOption(option, index)
widget = self.parent()
style = QApplication.style() if widget is None else widget.style()
r = style.subElementRect(style.SE_ItemViewItemDecoration,
option, widget)
icon = option.icon
@ -48,6 +54,7 @@ class TagDelegate(QStyledItemDelegate): # {{{
icon.On)
painter.restore()
# }}}
class TagsView(QTreeView): # {{{