2

Does anyone know how to make an uneditable checkbox ina QTreeWidgetItem but keep the QTreeWidgetItem selectable?

Jay
  • 3,373
  • 6
  • 38
  • 55
  • For anyone interested this is done with **QTreeWidgetItem.setFlags( Qt.ItemIsSelectable | Qt.ItemIsEnabled )** – Jay Nov 07 '11 at 08:00

2 Answers2

4

Don't set the flag Qt.ItemIsUserCheckable of the item, but set the checkState to Qt.Checked or Qt.Unchecked.

The presence of a checkbox and the user checkability are independent.

alexisdm
  • 29,448
  • 6
  • 64
  • 99
1

Try this:

setCheckState(0,Qt::Checked);
Anthony
  • 12,177
  • 9
  • 69
  • 105
Nick
  • 31
  • 5