How to populate delegate with model data.
Hi,
I have a class ComboBoxDelegate derived from QItemDelegate
I have a model class 'FrequencyRangeModel' derived from QAbstractProxyModel
I have a BandPlanning for UI which contains both ComboBoxDelegate and FrequencyRangeModel as members.
BandPlanning has a QTableView which is using ComboBoxDelegate to show combobox in each table cell.
My requirement is that i need to populate each combo cell with the data from the model FrequencyRangeModel.
How can i do it.
Re: How to populate delegate with model data.
Re: How to populate delegate with model data.
As far as I understand, you are showing a list of items for a particular cell/index/row-col . Am I right ?
In that case you will need to store the list in model. You can use QModelIndex::internalPointer to store whatever data u want and populate the combo box from the pointer returned by internalPointer. In the delegate function, you are passed a QModelIndex.
You may refer Simple Tree Model or Simple DOM Model example in Qt Demo on how they use internalPointer .
Hope this helps :)