[Development] Multicolored text in a QTableView cell?
Carl Schumann
schumann at fnal.gov
Wed Jun 13 17:27:20 CEST 2012
Qt community,
I would like to have multicolored text in a single QTableView cell.
Since labels can support multicolored text with a rich text string I
tried the following:
> QVariant MccModel::data(const QModelIndex &index, int role) const
> {
> if( role == Qt::DisplayRole ){
> return( "<font color=\"red\">red</font> and <font
> color=\"blue\">blue</font>" );
> }
> return QVariant();
> }
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?
Sincerely,
Carl Schumann
More information about the Development
mailing list