30 QItemDelegate(parent) {
41 QStyleOptionViewItem& option,
const QModelIndex& index)
const {
42 QVariant data = index.model()->data(index, Qt::UserRole);
44 if (option.state & QStyle::State_Selected)
45 painter->fillRect(option.rect, option.palette.highlight());
50 QPen pen = painter->pen();
52 if (option.state & QStyle::State_Selected)
53 pen.setColor(option.palette.color(QPalette::HighlightedText));
55 pen.setColor(option.palette.color(QPalette::Text));
58 pen.setStyle(static_cast<Qt::PenStyle>(data.toInt()));
61 painter->drawLine(option.rect.left(), option.rect.center().y(),
62 option.rect.right(), option.rect.center().y());
67 QItemDelegate::paint(painter, option, index);
virtual ~PenStyleItemDelegate()
PenStyleItemDelegate(QWidget *parent=0)
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const