view FeedEntryItemDelegate.py @ 218:699d8f1cebd4

unify imports, especially Qt imports. Use consistent super syntax
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 27 Apr 2014 06:04:57 +0200
parents bb3c851b18b1
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)