
正文
qt tableview里面添加控件
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
在QStyledItemDelegate的paint方法里面
void MyItemModelDeletage::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
HtItemModelDeletage::paint(painter,option,index);
if(index.column() == 0)
{
painter->save();
QPushButton *button = new QPushButton(this);
button->resize(option.rect.size() );
painter->translate(option.rect.topLeft());
button->render(painter, QPoint(), QRegion(), QWidget::DrawChildren );
painter->restore();
}
}







