I'm trying to get checkboxes into my treeview and can't quite get it to work. I've looked around and can't find anything to solve my problem. I've attached the code that I have so far, but doesn't work:

Qt Code:
  1. QTreeWidgetItem *cities = new QTreeWidgetItem(treeWidget);
  2. cities->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
  3. cities->setText(0, tr("Places"));
  4.  
  5. (new QTreeWidgetItem(cities))->setText(0, tr("USA Cities"));
To copy to clipboard, switch view to plain text mode 

Thank you in advance for your help