SceneListModel is a QAbstractItemModel.
All is working perfectly.
When i change my data on my UI, all data are updated.
But now i have 2 problems :
If the user add a new renderLayer in Maya, obviously, i have to create a new RenderLayersClass().
But, how can i know that there is a new renderLayer ? Scriptjob (no no…) ? Enter event in my DeadlineSubmitter ?
RenderLayersClass have some attributes like : RenderLayersClass.camera
I change the data of my RenderLayersClass manually (not by the view) like : RenderLayersClass.camera = ‘perpShape’
How can i update the UI ?
I know that i have to use self._model.setData(), because i emit “dataChange()” in this function. But setData(index, value, role=QtCore.Qt.EditRole), as you can see, need an index and value.
With the example you gave, you are replacing the word list. ([‘totot’, ‘pooppo’, ‘ddddd’] is replaced with [‘hello1’,‘hello2’].) If you want to keep your selection, then I am assuming you actually want to append to the word list?
If this is the case, you could make your own function in the ListModelClass to add items to your model. It is important to call beginInsertRows() before adding the new data, and call endInsertRows() when you are done. Something along the lines of: