1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
class intDelegate : public QItemDelegate
{
Q_OBJECT
public:
intDelegate(QObject *parent) :QItemDelegate(parent)
{}
void paint(QPainter *painter,const QStyleOptionViewItem &option,const QModelIndex &index) const
{
QString text = index.model()->data(index, Qt::DisplayRole).toString();
QStyleOptionViewItem myOption = option;
myOption.displayAlignment = Qt::AlignCenter | Qt::AlignHCenter | Qt::AlignVCenter;
drawDisplay(painter, myOption, myOption.rect,text);
drawFocus(painter, myOption, myOption.rect);
}
}; |
Partager