[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: [PATCH] Fix drawing
From: Carsten Burghardt <burghardt () kde ! org>
Date: 2002-12-31 7:34:43
[Download RAW message or body]
Hi,
I just noticed that the count of the separate unread-column is not drawn bold,
the attached patch fixes this and cleans the method a bit so that it's easier
to debug.
Regards,
Carsten
["kfoldertree.diff" (text/x-diff)]
Index: kfoldertree.cpp
===================================================================
RCS file: /home/kde/kdenetwork/libkdenetwork/kfoldertree.cpp,v
retrieving revision 1.23.2.1
diff -u -3 -p -r1.23.2.1 kfoldertree.cpp
--- kfoldertree.cpp 12 Dec 2002 18:38:57 -0000 1.23.2.1
+++ kfoldertree.cpp 31 Dec 2002 07:31:42 -0000
@@ -143,6 +143,7 @@ void KFolderTreeItem::paintCell( QPainte
int column, int width, int align )
{
QListView *lv = listView();
+ KFolderTree *ft = static_cast<KFolderTree*>(listView());
QString oldText = text(0);
if (column == 0) //Handle drawing text in column 0 below
@@ -150,49 +151,43 @@ void KFolderTreeItem::paintCell( QPainte
KListViewItem::paintCell( p, cg, column, width, align );
- if (column == 0)
- {
- KFolderTree *ft = static_cast<KFolderTree*>(listView());
- int r = lv ? lv->itemMargin() : 1;
- const QPixmap *icon = pixmap( column );
- int marg = lv ? lv->itemMargin() : 1;
+ int r = lv ? lv->itemMargin() : 1;
+ const QPixmap *icon = pixmap( column );
+ int marg = lv ? lv->itemMargin() : 1;
- QString t;
- QRect br;
- setText( 0, oldText );
- if ( isSelected() )
- p->setPen( cg.highlightedText() );
- else
- p->setPen( ft->paintInfo().colFore );
+ QString t;
+ setText( 0, oldText );
+ if ( isSelected() )
+ p->setPen( cg.highlightedText() );
+ else
+ p->setPen( ft->paintInfo().colFore );
- if ( icon ) {
- r += icon->width() + lv->itemMargin();
+ if ( icon ) {
+ r += icon->width() + lv->itemMargin();
+ }
+ t = text( column );
+ if ( !t.isEmpty() )
+ {
+ // use a bold-font for the folder- and the unread-columns
+ if ( countUnreadRecursive() > 0 &&
+ (column == 0 || column == ft->unreadIndex()) )
+ {
+ QFont f = p->font();
+ f.setWeight(QFont::Bold);
+ p->setFont(f);
}
- t = text( column );
- if ( !t.isEmpty() )
+ p->drawText( r, 0, width-marg-r, height(),
+ align | AlignVCenter, t );
+ if (!isSelected())
+ p->setPen( ft->paintInfo().colUnread );
+ if (column == 0 && !ft->isUnreadActive() && mUnread > 0 )
{
- // use a bold-font for the folder- and the unread-columns
- if ( countUnreadRecursive() > 0 &&
- (column == 0 || column == ft->unreadIndex()) )
- {
- QFont f = p->font();
- f.setWeight(QFont::Bold);
- p->setFont(f);
- }
+ // draw the unread-count if the unread-column is not active
+ QString unread = " (" + QString::number(mUnread) + ")";
p->drawText( r, 0, width-marg-r, height(),
- align | AlignVCenter, t, -1, &br );
- if (!isSelected())
- p->setPen( ft->paintInfo().colUnread );
- if (column == 0) {
- // draw the unread-count if the unread-column is not active
- QString unread = QString::null;
- if ( !ft->isUnreadActive() && mUnread > 0 )
- unread = " (" + QString::number(mUnread) + ")";
- p->drawText( br.right(), 0, width-marg-br.right(), height(),
- align | AlignVCenter, unread );
- }
- } // end !t.isEmpty()
- } // end column = 0
+ align | AlignVCenter, unread );
+ }
+ } // end !t.isEmpty()
}
_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic