I am facing issues when I adjust QCheckbox
into QTableWidget
.
It is working as expected in Mac and Linux but creating problem in Windows.
I have googled it and tried out different solutions, but it did not solve my problem.
Code:
QWidget* cellWidget = new QWidget();
QCheckBox *box = new QCheckBox();
box->setCheckState(Qt::Unchecked);
QHBoxLayout* layout = new QHBoxLayout(cellWidget);
layout->addWidget(box);
layout->setAlignment(Qt::AlignCenter);
layout->setContentsMargins(0, 0, 0, 0);
cellWidget->setLayout(layout);
ui->twidget_header->setCellWidget(0, 0, cellWidget);
Mac OS O/P : As Expected
Win OS O/P : Problem with Checkbox size and alignment
My app is created in Qt 5.9
for Mac, Win and Linux platform.
Let me know if you required more info about the problem.