view FeedEntryItemDelegate.py @ 153:65c4bb6d5add

move management of the selected feed entry into the backend - sqlachemy backend works, couchdb backend currently broken
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 27 Aug 2011 07:29:33 +0200
parents babe14449162
children bb3c851b18b1
line wrap: on
line source


from PyQt4 import QtGui
from PyQt4.QtGui import QFont

class FeedEntryItemDelegate(QtGui.QStyledItemDelegate):
    def __init__(self):
        QtGui.QStyledItemDelegate.__init__(self, None)

    def paint(self, painter, style, index):
        feedEntryTableModel = index.model()
        row = index.row()
        # this makes assumptions about the type and the properties of the model but there's no
        # way to get to the feedEntry using proper Qt API
        entry = feedEntryTableModel.feedEntries[row]
        if entry.read:
            style.font.setWeight(QFont.Normal)
        else:
            style.font.setWeight(QFont.Bold)
        QtGui.QStyledItemDelegate.paint(self, painter, style, index)