在QTableWidget中添加按钮
环境:Qt 5.14
auto button = new QPushButton(QStringLiteral("按钮"), ui->tableWidget_1);
button->setFixedSize(60, 22);
auto cellWidget = new QWidget(this);
auto layout = new QHBoxLayout(cellWidget);
layout ->addWidget(button);
cellWidget->setLayout(layout);
ui->tableWidget_1->setCellWidget(rowIndex, colIndex, cellWidget);