PDA

View Full Version : Best Practices: QAbstractItemModel font metrics computations



philw
22nd September 2008, 23:51
Question about Best Practices in relation to QAbstractItemModel font metrics-based computations:

I was surprised to see that Item View MODEL implementations are supposed to generate presentation-oriented data, e.g. SizeHint (-Role) from the data() method. We also need to use font metrics to generate QPixmaps for the DisplayRole.

I'm now registering a sample QWidget with one of our QAbstractItemModel implementations to make font and font metrics available to that implementation's geometry computations. This doesn't feel like the right direction.

jacek
28th September 2008, 21:00
These presentation-oriented roles are for the default item delegate. You are free to implement your own delegate that controls all aspects of the presentation without accessing the model.