Different delegates to different Columns of QTableView.
Hi,
How can i apply different delegates to different columns of QTableView.
I have a QTableView of two Columns (say col_1 and col_2)
Now i have to put comboBox in each cell of col_1 and col_2 but the data of comboBox in col_1 differ from data in comboBox of col_2.
The data is to be read from the Modal.
Please help
Re: Different delegates to different Columns of QTableView.
Hi,
I beleave this can help you. Just create different delegate classes and then use QTableView::setItemDelegateForColumn.
Re: Different delegates to different Columns of QTableView.
I dont think u will need to use different delegates. You can use internalPointer for a given index to retrieve the data for populating the combobox
Re: Different delegates to different Columns of QTableView.
if i use QTableView::setItemDelegateForColumn then inside CreateEditor function i can not find for which row i need to populate the combo....
aamer4yu - How can i use internal pointer?
When would in put data inside the internal pointer?
Some example!
Re: Different delegates to different Columns of QTableView.
You may refer to Simple DOM Model or Simple Tree Model in the Qt Demos.
You will get some idea how to store data of ur own type via internalPointer :)