68 int column,
int width,
int align)
70 if(column < 0 || column >=
int(m_items.size()) || m_items[column].items().isEmpty()) {
71 TQListViewItem::paintCell(painter, cg, column, width, align);
78 int styleNum = m_items[column].items()[0].style;
79 TextPaintStyleStore::Item& style = m_styles.getStyle( styleNum );
81 if( style.bgValid() ) {
82 grp.setColor( TQColorGroup::Base, style.background );
84 if(backgroundColor(column).isValid())
85 grp.setColor( TQColorGroup::Base, backgroundColor(column) );
88 TQListView *lv = listView();
91 TQPainter* p = painter;
92 TQFontMetrics fm( p->fontMetrics() );
94 TQString t = text( column );
96 int marg = lv->itemMargin();
98 const TQPixmap * icon = pixmap( column );
100 const BackgroundMode bgmode = lv->viewport()->backgroundMode();
101 const TQColorGroup::ColorRole crole = TQPalette::backgroundRoleFromMode( bgmode );
102 p->fillRect( 0, 0, width, height(), grp.brush( crole ) );
104 if ( isSelected() && (column == 0 || lv->allColumnsShowFocus()) ) {
105 p->fillRect( r - marg, 0, width - r + marg, height(), cg.brush( TQColorGroup::Highlight ) );
107 if ( isEnabled() || !lv )
108 p->setPen( cg.highlightedText() );
109 else if ( !isEnabled() && lv)
110 p->setPen( lv->palette().disabled().highlightedText() );
113 if ( isEnabled() || !lv )
114 p->setPen( cg.text() );
115 else if ( !isEnabled() && lv)
116 p->setPen( lv->palette().disabled().text() );
122 iconWidth = icon->width() + lv->itemMargin();
124 int yo = ( height() - icon->height() ) / 2;
126 if ( align & AlignBottom )
127 yo = height() - icon->height();
128 else if ( align & AlignTop )
133 if ( align & AlignRight )
134 xo = width - 2 * marg - iconWidth;
135 else if ( align & AlignHCenter )
136 xo = ( width - iconWidth ) / 2;
138 p->drawPixmap( xo, yo, *icon );
142 if ( !t.isEmpty() ) {
143 if ( !(align & AlignTop || align & AlignBottom) )
144 align |= AlignVCenter;
148 TextPaintItem::Chain::iterator it = m_items[column].items().begin();
149 while(it != m_items[column].items().end())
151 int styleNum = (*it).style;
152 TextPaintStyleStore::Item& style = m_styles.getStyle( styleNum );
154 painter->setFont(style.font);
155 p->drawText( r, 0, width-marg-r, height(), align, (*it).text );
156 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 ...