view FeedEntryItemDelegate.py @ 224:218c2b376169

ignore eric5 project files
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 22 May 2014 05:49:14 +0200
parents 699d8f1cebd4
children 94a902de5266
line wrap: on
line source

# -*- coding: utf-8 -*-
from PyQt4.QtGui import QFont, QStyledItemDelegate

class FeedEntryItemDelegate(QStyledItemDelegate):
    def __init__(self):
        super(FeedEntryItemDelegate, self).__init__(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)
        super(FeedEntryItemDelegate, self).paint(painter, style, index)