Solved Why does the QCheckBox not show the text
-
Hi,
I'm having a
QListWidget
to which I'm addingQCheckBoxes`` which works fine but I can't see the
text``` which I'm adding with the constructor. I'm wondering what I might be missing, the related code looks like:list = new QListWidget(this); item = new QListWidgetItem(); item->setFlags(item->flags() | Qt::ItemIsUserCheckable); item->setCheckState(Qt::Unchecked); list->setItemWidget(item,new QCheckBox("checkBox")); list->addItem(item);
-
You dont see the text, because what you see is the (checkable) QListItem, not your QCheckBox. If you set
Qt::ItemIsUserCheckable
the ListItem itself gets a little checkBox. As far as I know, you dont need the additional checkBox at all...