Hi there,
I'm add a QCheckBoxin my QTreeWidget like these, but, How to set the widget to be center of the column rect?
treeWidget->setItemWidget(subItem, 2, chkItem);
subItem->setTextAlignment(2, Qt::AlignHCenter);
Qt::CheckState chkState = (bNeedSync.toInt() == 1) ? Qt::Checked : Qt::Unchecked;
chkItem->setCheckState(chkState);
treeWidget->setItemWidget(subItem, 2, chkItem);
subItem->setTextAlignment(2, Qt::AlignHCenter);
Qt::CheckState chkState = (bNeedSync.toInt() == 1) ? Qt::Checked : Qt::Unchecked;
chkItem->setCheckState(chkState);
To copy to clipboard, switch view to plain text mode
I digged the code and this forum and no without any tip information. Thanks.
image.PNG
Bookmarks