Delegate for a cell
I have my own delegate and want to use it for a specific cell in a table view. I've already found methods setItemDelegate, setItemDelegateForRow/Column.
Any thoughts how to set it for a specific cell? (e.g. (i,j) )
subclass QStyledItemDelegate and check the index for your specific (i,j).
If the index is your (i,j) do what you want to do for this cell else call the base classes implementation.
I've used setIndexWidget, but setData is not called in my model. Does anyone know why?
such questions are impossible to answer without showing code at all
setIndexWidget method has nothing todo with the model. since it is only suposed to show static content
OK, more informative:
I have a Model : AbstractItemModel, I have a table view, and I want to use my method for showing for example numbers. I dont want to use the default widget to show them, I do not want to use default delegate.
I've create my own delegate to operate on them.
The quiestion is:
- how to set a delegate for a specific cell cause I've found only for a row and for a column or for all table.
- do I need to use indexWidget to specify my widget to show numbers or editor in the delegate class is all that I need?
- what the point in indexWidget if it doesn't change the model? Why is it created? If I write "setIndexWidget(..., new QLineEdit)" like in Manual and it doesnt change the real data why I need it? only like a toy?