[Interest] Multicolored text in a QTableView cell?
schumann at fnal.gov
Wed Jun 13 23:44:35 CEST 2012
On 6/13/2012 11:51 AM, Konrad Rosenbaum wrote:
> On Wednesday 13 June 2012 17:27:20 Carl Schumann wrote:
>> Where MccModel subclassed from QAbstractTableModel. This did not
>> work, specifically it displayed the whole long rich text string in
>> black. How should I be doing multicolored table cells please?
> Use a custom delegate instead: derive a class from QItemDelegate and override
> the paint method to do your custom drawing. If you want to use rich text you
> can for example use QTextDocument::drawContents as a helper.
The documentation for QItemDelegate,
http://qt-project.org/doc/qt-4.8/qitemdelegate.html#details, indicates I
should use QStyledItemDelegate
> Detailed Description
> The QItemDelegate class is one of the Model/View Classes and is part
> of Qt's model/view framework. Note that QStyledItemDelegate has taken
> over the job of drawing Qt's item views. We recommend the use of
> QStyledItemDelegate when creating new delegates.
So should I really be using QStyledItemDelegate please?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest