-rw-r--r-- | core/pim/addressbook/abtable.cpp | 36 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.h | 1 |
2 files changed, 35 insertions, 2 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 55b1ba1..a829dc2 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp @@ -583,14 +583,12 @@ void AbTable::updateVisible() setCurrentCell( selectedRow, 0 ); if ( !visible ) setCurrentCell( -1, 0 ); setPaintingEnabled( TRUE ); - - } void AbTable::setPaintingEnabled( bool e ) { // qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); @@ -615,13 +613,47 @@ void AbTable::setPaintingEnabled( bool e ) void AbTable::viewportPaintEvent( QPaintEvent* e ) { // qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); if ( enablePainting ) QTable::viewportPaintEvent( e ); } +void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { + const QColorGroup &cg = colorGroup(); + + p->save(); + + // Paint alternating background bars + if ( (row % 2 ) == 0 ) { + p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); + p->setPen( QPen( cg.text() ) ); + } + else { + p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); + p->setPen( QPen( cg.buttonText() ) ); + } + QFont f = p->font(); + QFontMetrics fm(f); + + int marg = 2; + int x = 0; + int y = ( cr.height() - 14 ) / 2; + + QPixmap pic = pixmap( row, col ); + if ( !pic.isNull() ) + { + p->drawPixmap( x + marg, y, pixmap( row, col ) ); + p->drawText( x + marg + pixmap( row, col ).width() + 4,2 + fm.ascent(), text( row, col ) ); + } + else + { + p->drawText( x + marg,2 + fm.ascent(), text( row, col ) ); + } + + p->restore(); +} void AbTable::rowHeightChanged( int row ) { if ( enablePainting ) QTable::rowHeightChanged( row ); } diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h index 092e86f..4e6b294 100644 --- a/core/pim/addressbook/abtable.h +++ b/core/pim/addressbook/abtable.h @@ -93,12 +93,13 @@ public: void clear(); void refresh(); void show(); void setPaintingEnabled( bool e ); void viewportPaintEvent( QPaintEvent* e); + void paintCell(QPainter* p, int row, int col, const QRect&, bool ); // addresspicker mode (What's that ? se) void setChoiceNames( const QStringList& list); QStringList choiceNames() const; void setChoiceSelection( const QValueList<int>& list ); QStringList choiceSelection(int index) const; |