Jay
Jay

Reputation: 3489

Disabled checkbox for QTreeWidget

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

Upvotes: 2

Views: 3794

Answers (2)

Nick
Nick

Reputation: 31

Try this:

setCheckState(0,Qt::Checked);

Upvotes: 1

alexisdm
alexisdm

Reputation: 29896

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.

Upvotes: 4

Related Questions