Commit 51cc41c9 authored by Tobias Koenig's avatar Tobias Koenig
Browse files

Merged revisions 1157288 via svnmerge from

svn+ssh://tokoe@svn.kde.org/home/kde/branches/KDE/4.5/kdepimlibs

........
  r1157288 | tokoe | 2010-07-30 18:08:00 +0200 (Fri, 30 Jul 2010) | 3 lines
  
  Don't create KColorScheme inside the paint method, because it
  is expensive. We can cache the two colors without problem.
........

svn path=/trunk/KDE/kdepimlibs/; revision=1158672
parent 046448f8
......@@ -50,12 +50,18 @@ class CollectionStatisticsDelegatePrivate
QTreeView *parent;
bool drawUnreadAfterFolder;
DelegateAnimator *animator;
QColor mSelectedUnreadColor;
QColor mDeselectedUnreadColor;
CollectionStatisticsDelegatePrivate( QTreeView *treeView )
: parent( treeView ),
drawUnreadAfterFolder( false ),
animator( 0 )
{
mSelectedUnreadColor = KColorScheme( QPalette::Active, KColorScheme::Selection )
.foreground( KColorScheme::LinkText ).color();
mDeselectedUnreadColor = KColorScheme( QPalette::Active, KColorScheme::View )
.foreground( KColorScheme::LinkText ).color();
}
template<CountType countType>
......@@ -257,10 +263,8 @@ void CollectionStatisticsDelegate::paint( QPainter *painter,
// Draw folder name and unread count
painter->drawText( folderRect, Qt::AlignLeft, folderName );
KColorScheme::ColorSet cs = ( option.state & QStyle::State_Selected ) ?
KColorScheme::Selection : KColorScheme::View;
QColor unreadColor = KColorScheme( QPalette::Active, cs ).
foreground( KColorScheme::LinkText ).color();
const QColor unreadColor = (option.state & QStyle::State_Selected) ? d->mSelectedUnreadColor : d->mDeselectedUnreadColor;
painter->setPen( unreadColor );
painter->drawText( unreadRect, Qt::AlignLeft, unread );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment