69 int column,
int width,
int align)
71 if(column < 0 || column >=
int(m_items.size()) || m_items[column].items().isEmpty()) {
72 TQListViewItem::paintCell(painter, cg, column, width, align);
79 int styleNum = m_items[column].items()[0].style;
80 TextPaintStyleStore::Item& style = m_styles.getStyle( styleNum );
82 if( style.bgValid() ) {
83 grp.setColor( TQColorGroup::Base, style.background );
85 if(backgroundColor(column).isValid())
86 grp.setColor( TQColorGroup::Base, backgroundColor(column) );
89 TQListView *lv = listView();
92 TQPainter* p = painter;
93 TQFontMetrics fm( p->fontMetrics() );
95 TQString t = text( column );
97 int marg = lv->itemMargin();
99 const TQPixmap * icon = pixmap( column );
101 const BackgroundMode bgmode = lv->viewport()->backgroundMode();
102 const TQColorGroup::ColorRole crole = TQPalette::backgroundRoleFromMode( bgmode );
103 p->fillRect( 0, 0, width, height(), grp.brush( crole ) );
105 if ( isSelected() && (column == 0 || lv->allColumnsShowFocus()) ) {
106 p->fillRect( r - marg, 0, width - r + marg, height(), cg.brush( TQColorGroup::Highlight ) );
108 if ( isEnabled() || !lv )
109 p->setPen( cg.highlightedText() );
110 else if ( !isEnabled() && lv)
111 p->setPen( lv->palette().disabled().highlightedText() );
114 if ( isEnabled() || !lv )
115 p->setPen( cg.text() );
116 else if ( !isEnabled() && lv)
117 p->setPen( lv->palette().disabled().text() );
123 iconWidth = icon->width() + lv->itemMargin();
125 int yo = ( height() - icon->height() ) / 2;
127 if ( align & AlignBottom )
128 yo = height() - icon->height();
129 else if ( align & AlignTop )
134 if ( align & AlignRight )
135 xo = width - 2 * marg - iconWidth;
136 else if ( align & AlignHCenter )
137 xo = ( width - iconWidth ) / 2;
139 p->drawPixmap( xo, yo, *icon );
143 if ( !t.isEmpty() ) {
144 if ( !(align & AlignTop || align & AlignBottom) )
145 align |= AlignVCenter;
149 TextPaintItem::Chain::iterator it = m_items[column].items().begin();
150 while(it != m_items[column].items().end())
152 int styleNum = (*it).style;
153 TextPaintStyleStore::Item& style = m_styles.getStyle( styleNum );
155 painter->setFont(style.font);
156 p->drawText( r, 0, width-marg-r, height(), align, (*it).text );
157 r += textWidth( style.font, (*it).text );
virtual void paintCell(TQPainter *painter, const TQColorGroup &cg, int column, int width, int align)
this is a modified version of the original TQListViewItem::paintCell from the qt source multiline is ...