PDA

View Full Version : QTreeWidget Custom Item Delegate



photo_tom
20th May 2010, 18:50
I have a situation where the default editor for the class works fine for most of the items. My problem is that I have a number of items that I want to edit that based off of enumerated types instead of numbers or strings.

What I would like to do, is for just the enumerated values, Have an itemdelegate editor that displays a dropdown combox with the users options. I can get this to work.

My problem is that if I assign my editor delegate to the QTreeWidget, then that has to apply for all cells in the tree. My question is, is it possible to selectively apply an item delegate edtor to individual table cells, while leaving the default editor for the rest of the cells?

tbscope
20th May 2010, 18:59
One way is to set a userrole on each item. For example a role called editortype. Then based on that data, display a different editor.