You already have the name of the function, QTreeWidgetItem::setFlags(), its documentation, and the Qt::ItemFlag documentation it links to. You even have the the name of the specific flag, Qt::ItemIsUserCheckable. Is it really such a difficult thing to work out?
Qt Code:
  1. // OR QTableWidgetItem *item = new QTableWidgetItem();
  2. // OR QStandardItem *item = new QStandardItem();
  3. item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsUserCheckable);
To copy to clipboard, switch view to plain text mode