Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QTreeView, QAbstractItemModel and refreshing view
I am trying to find a way to refresh a QTreeView when the flags of the items in the QAbstractItemModel change (the model doe not change), but i cannot figure it out. I notice that when i enter the QTreeView with the mouse the refresh takes place, but i don't know what happens in the background. Calling repaint() does not seem to work.
Can anyone help?
I would try with the "dataChanged":http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#dataChanged
Hope it helps
I tried that, but couldnt figure it out,e.g. where do i get the index parameters, especially in a tree model?
Don't you have these indexes when changing the flags ?
As far as i know, the view the view gets the flags from the model per index. However my flags(index) method calculates the flags based on what is shown somewhere else (the user drags items from the treeview to a canvas, but depending on what is shown on the canvas not all items in the tree make sense to be dragged). So i want a number of items in the tree to be disabled (but visible) when the content of the canvas changes. i have a signal for that, which should (also) result in refreshing the treeview so all flags are recalculated.
Then maybe layoutChanged would be more appropriated