Editable TreeView
-
Hi,
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?
-
Hi,
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?
Hi @krojew
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).-Michael.
-
Hi @krojew
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).-Michael.
-
Maybe this can help:
https://forum.qt.io/topic/89143/help-with-qml-tableview/5