I'm using TreeView to display some tree data with multiple columns, and I wish to make some of them editable. And I stumbled upon two problems:
- there doesn't seem to be a way to select different delegates for different columns
- even if I set e.g. TextField as the delegate, any edits do not seem to propagate back to the model
Is this even doable?
You can set different delegates to different columns with the function
setItemDelegateForColumn. You will use this function only for delegates you implement yourself, though. The standard delegates should work on their own. You should verify (set a breakpoint and check) that the setData virtual function of your model actually changes the data of your model after editing (parameter role = Qt::EditRole).
@m.sue thanks, I'll try that.
Coming back, it seems the typical qml edit items do not call setData() or I'm doing something wrong. Also, there is no setItemDelegateForColumn method for TreeView.