Reputation: 1739
I have got color data in a cell. It is possible that when i double click on this cell I can edit it only by selecting value from Combo Box ?
But this combobox is not visible all the time - only when i click double time.
Questions:
Upvotes: 1
Views: 1082
Reputation: 4237
You can do this, using custom itemDelegates.
The way to success will be:
QAbstractItemDelegate
, reimplement createEditor
and make sure it creates combobox You love.setItemDelegateForColumn
and specify a column with your color content.Hint: you can even customize display of your color data, not only editing!
Now, let speak about setting only one column editable. You have a choice.
Way 1. Do it at model level. Let Your model returns proper flags in flags(QModelIndex)
and make only Your column editable.
Way 2. View level. In this case You should create a "dumb" itemDelegate which does not create editor at all and assign it to all other columns.
Personally, I like way 1. But this is for You to choose.
Upvotes: 1