我用QCheckBox
在QTableWidgetCell
设置控件的背景色
QWidget *widget = new QWidget();
QCheckBox *checkBox = new QCheckBox();
QHBoxLayout *layout = new QHBoxLayout(widget);
layout->addWidget(checkBox);
layout->setAlignment(Qt::AlignCenter);
layout->setContentsMargins(0, 0, 0, 0);
widget->setLayout(layout);
table->setCellWidget(0, 0, widget);
如何更改单元格的背景?
它的工作原理。但只有最后一个背景改变了细胞已经设置了背景先前的细胞背景已恢复 – Ufx 2014-10-10 03:13:51
@Ufx查看我的编辑 – 2014-10-10 07:48:02