Thanks. I think I basically understand this now. I was hoping I might be able to use user roles as an automatic part of the framework but apparently I can't.
My implementation problem is this: I have implemented a custom QTableView that contains QwtPlot instances in the cells of two columns. The solution I implemented was to implement a slot for the model's modelReset() signal. In this slot, I create the QwtPlot and use setIndexWidget() to put them into the view. This seems to me to be a kludgy way to do this, but it works.
I had tried using a custom delegate to wrap the QwtPlot instance, but I couldn't find an appropriate place to create the QwtPlot instance. The createEditor() method isn't it, because the cell isn't editable, and my understanding is that the same delegate instance could be used for the entire view (if calling QAbstractitemView::setItemDelegate()), so I can't create the widget in the delegate constructor.
So, is there a better (i.e. more elegant) way to accomplish what I'd like to do using user roles and/or delegates that doesn't involve this out-of-band kludge?
I've attached a screenshot of this table.
QwtPlotTable.jpg
Bookmarks