私はで使用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);
私はこれを得ることができませんQCheckBox
QTableWidgetItem *item = ui->table->item(0, 0);
QWidget *widget = dynamic_cast<QWidget *>(item); // Widget==0
QHBoxLayout *layout = dynamic_cast<QHBoxLayout *>(widget->layout());
QCheckBox *checkBox = dynamic_cast<QCheckBox *>(layout->widget());