summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp36
-rw-r--r--core/pim/addressbook/abtable.h1
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
@@ -586,8 +586,6 @@ void AbTable::updateVisible()
586 setCurrentCell( -1, 0 ); 586 setCurrentCell( -1, 0 );
587 587
588 setPaintingEnabled( TRUE ); 588 setPaintingEnabled( TRUE );
589
590
591} 589}
592 590
593 591
@@ -618,7 +616,41 @@ void AbTable::viewportPaintEvent( QPaintEvent* e ) {
618 QTable::viewportPaintEvent( e ); 616 QTable::viewportPaintEvent( e );
619} 617}
620 618
619void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) {
620 const QColorGroup &cg = colorGroup();
621
622 p->save();
623
624 // Paint alternating background bars
625 if ( (row % 2 ) == 0 ) {
626 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) );
627 p->setPen( QPen( cg.text() ) );
628 }
629 else {
630 p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) );
631 p->setPen( QPen( cg.buttonText() ) );
632 }
621 633
634 QFont f = p->font();
635 QFontMetrics fm(f);
636
637 int marg = 2;
638 int x = 0;
639 int y = ( cr.height() - 14 ) / 2;
640
641 QPixmap pic = pixmap( row, col );
642 if ( !pic.isNull() )
643 {
644 p->drawPixmap( x + marg, y, pixmap( row, col ) );
645 p->drawText( x + marg + pixmap( row, col ).width() + 4,2 + fm.ascent(), text( row, col ) );
646 }
647 else
648 {
649 p->drawText( x + marg,2 + fm.ascent(), text( row, col ) );
650 }
651
652 p->restore();
653}
622 654
623void AbTable::rowHeightChanged( int row ) 655void AbTable::rowHeightChanged( int row )
624{ 656{
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
@@ -96,6 +96,7 @@ public:
96 void show(); 96 void show();
97 void setPaintingEnabled( bool e ); 97 void setPaintingEnabled( bool e );
98 void viewportPaintEvent( QPaintEvent* e); 98 void viewportPaintEvent( QPaintEvent* e);
99 void paintCell(QPainter* p, int row, int col, const QRect&, bool );
99 100
100 // addresspicker mode (What's that ? se) 101 // addresspicker mode (What's that ? se)
101 void setChoiceNames( const QStringList& list); 102 void setChoiceNames( const QStringList& list);