Item view (delegate and editor)
-
I have to have my own set editors ( custome combo Box) in several cells of QTableView so I have called openPersistentEditor() to keep these editors always open.
Now again some button hit I need to select some other item of this comboBox and also change the text color. Obviously I need the pointer of the comboBox shown in each cell. I have the index of the cell whose pointer i want but i just dont know how to get this pointer?
Can any one please help using the index of the cell how do i get the pointer of the editor (editor is opened not closed)Thanx
-
Can not answer your question. But I can not imagine why would you need several persistent editors. You just need to set item delegate, and it will call needed editor every time you edit exact cell.
-
Huh,
bq. Obviously I need the pointer of the comboBox shown in each cell.
The view keeps track of the pointers for you. You get the index you are, that's it and that's enough. For every instance the view keeps the pointer. In you delegate class reimplement the createEditor and setEditordata function to comply with it. In the createEditor set the elements of the combobox. the setEditorData function is called when the item is changed, so your able to set a different colour.
Using the index.model()->data(index....) function you can analyse the data in the model for the corresponding index. So if the colour is dependent of the model data, do it like that. Otherwise, overwrite the paint event.
Hope this gets you started