class CustomDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
CustomDelegate
(QObject *parent
= 0);
void paint
(QPainter *painter,
const QStyleOptionViewItem
& option,
const QModelIndex
& index
) const;
};
void CustomDelegate
::paint(QPainter *painter,
const QStyleOptionViewItem
& option,
const QModelIndex
& index
) const {
// Paint the line
painter->save();
painter
->setPen
(QColor(0,
0,
0,
220));
painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
painter->restore();
// Now paint the normal cell contents
this->QStyledItemDelegate::paint(painter, option, index);
}
class CustomDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
CustomDelegate(QObject *parent = 0);
void paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
};
void CustomDelegate::paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
// Paint the line
painter->save();
painter->setPen(QColor(0, 0, 0, 220));
painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
painter->restore();
// Now paint the normal cell contents
this->QStyledItemDelegate::paint(painter, option, index);
}
To copy to clipboard, switch view to plain text mode
Bookmarks