summaryrefslogtreecommitdiff
authoreilers <eilers>2003-03-06 08:15:23 (UTC)
committer eilers <eilers>2003-03-06 08:15:23 (UTC)
commitde5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a (patch) (side-by-side diff)
treea1be481f2d4281f7221f538f95bfe996ff5e2dfc
parentcaecd32d28df2c0de6982bf84c599c5b25880661 (diff)
downloadopie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.zip
opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.tar.gz
opie-de5ee3b655897d8d6b8b78fee3cb2b63f9a9bf8a.tar.bz2
New table appearance by Dan Williams ! It looks like todolist, now ! Thanks
a lot !
Diffstat (more/less context) (show 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
@@ -585,10 +585,8 @@ void AbTable::updateVisible()
if ( !visible )
setCurrentCell( -1, 0 );
setPaintingEnabled( TRUE );
-
-
}
void AbTable::setPaintingEnabled( bool e )
@@ -617,9 +615,43 @@ void AbTable::viewportPaintEvent( QPaintEvent* e ) {
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 )
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
@@ -95,8 +95,9 @@ public:
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;