]> git.sur5r.net Git - minitube/commitdiff
Performance optimization: Initialize fonts in constructor, not on every
authorFlavio Tordini <flavio.tordini@gmail.com>
Fri, 9 Oct 2009 22:20:48 +0000 (00:20 +0200)
committerFlavio Tordini <flavio.tordini@gmail.com>
Fri, 9 Oct 2009 22:20:48 +0000 (00:20 +0200)
paint

src/playlist/PrettyItemDelegate.cpp
src/playlist/PrettyItemDelegate.h

index 59843fe60c21808f35154214b234e5c39afe4991..2c6f21f44ebcf25c8601bbb5fb4045f56bd688f1 100644 (file)
@@ -9,6 +9,12 @@ const qreal PrettyItemDelegate::THUMB_WIDTH = 120.0;
 const qreal PrettyItemDelegate::PADDING = 10.0;
 
 PrettyItemDelegate::PrettyItemDelegate( QObject* parent ) : QStyledItemDelegate( parent ) {
+
+    boldFont.setBold(true);
+    smallerFont.setPointSize(smallerFont.pointSize()*.85);
+    smallerBoldFont.setBold(true);
+    smallerBoldFont.setPointSize(smallerBoldFont.pointSize()*.85);
+
     createPlayIcon();
 }
 
@@ -60,14 +66,6 @@ void PrettyItemDelegate::paintBody( QPainter* painter,
 
     QPalette palette;
 
-    QFont boldFont;
-    boldFont.setBold(true);
-    QFont smallerFont;
-    smallerFont.setPointSize(smallerFont.pointSize()*.85);
-    QFont smallerBoldFont;
-    smallerBoldFont.setBold(true);
-    smallerBoldFont.setPointSize(smallerBoldFont.pointSize()*.85);
-
     const bool isActive = index.data( ActiveTrackRole ).toBool();
     const bool isSelected = option.state & QStyle::State_Selected;
 
index 723dcaa4809a7e0106109a3da92a55270634956a..6fc547b894f8a230428dec88929ed506b2f416c8 100644 (file)
@@ -34,6 +34,9 @@ private:
     static const qreal PADDING;
 
     QPixmap playIcon;
+    QFont boldFont;
+    QFont smallerFont;
+    QFont smallerBoldFont;
 };
 
 #endif