PDA

View Full Version : how to make the editor wiget always visible in QTableView



babu198649
17th September 2009, 11:14
Hi
I want to create a QTableView which has custom widgets always visible on the grid.
I have tried setting custom delegate and reimplementing the createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const function.But the widgets becomes invisible as soon as the grid loses the focus, how to make it visible permanently.

Thanks in advance.

jgver
18th September 2009, 20:18
One approach I've been using lately is to just create a widget manually, and insert it into a cell with setCellWidget. This is probably the simplest way to create editors within cells, though at the expense of some flexibility. You lose the ability to take that cell into account when sorting, for example. However, widgets thus created will maintain their appearance (editing buttons and such will remain visible), which is a requirement for the work that I'm doing.

If there is a way to do this using delegates, I would be very interested in hearing about it! :)

Hope this helps.