view FeedEntryItemDelegate.py @ 227:6ce0e081094a

fix the column title display
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 28 May 2014 02:47:40 +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)