I've tried to set some style for check box in Qt. I know that QTableWidget
has QCheckbox
, but the problem is that I have no idea how to set style for it.
QTableWidgetItem *checkBoxItem = new QTableWidgetItem();
checkBoxItem->setCheckState(Qt::Unchecked);
table->setItem(row, column, checkBoxItem);
When I use setStyleSheet()
for checkBox
:
checkBoxItem->setStyleSheet("...");
I get an error:
'class QTableWidgetItem' has no member named 'setStyleSheet'`
I want to do some operations with checkBox
.
Here is the complete code for the first QTableWidgetItem
:
for (int i = 0; i < 4; ++i)
m_tableWidget->setRowHeight(i, 3 * em);
QTableWidgetItem *item1 = new QTableWidgetItem(tr("Show Message Preview"));
if (CGlobalZone::m_showMsgPreview)
item1->setCheckState(Qt::Checked);
else
item1->setCheckState(Qt::Unchecked);
item1->setFlags(Qt::ItemIsEnabled);
m_tableWidget->setItem(0, 0, item1);