|
1Qter豆
//头像列,只是在单元格中央放一张小图而已class IconDelegate : public QItemDelegate{ Q_OBJECTpublic : IconDelegate(QObject *parent = 0): QItemDelegate(parent) { } void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex & index ) const { QPixmap pixmap = QPixmap( "/home/xiaofu/workfiles/9.jpg" ).scaled(24, 24); qApp->style()->drawItemPixmap(painter, option.rect, Qt::AlignCenter, QPixmap(pixmap)); }};
如何把pixmap每次都赋不同的值?
|
|