I try to do something like this (original code was written in Python, so may be it has some syntax errors):
Qt Code:
  1. QTreeView *tvGroups = new QTreeView()
  2. MyModel *groupModel = new MyModel()
  3. cb->setView(&tvGroups)
  4. cb->setModel(&groupModel)
  5. cb->setModelColumn(0)
To copy to clipboard, switch view to plain text mode 
cb is QComboBox.
After it usual integer combobox indexes become very strange.
In function which is connected to signal setCurrentIndex(int index) I print index and see that it has value -1 for items group2 and something_else, and 0 for others in the tree example below.
tree has such items:
Qt Code:
  1. All
  2. group1
  3. group1.1
  4. group1.2
  5. group2
  6. something_else
To copy to clipboard, switch view to plain text mode 
What is wrong?