[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/apps/dolphin/src
From:       Peter Penz <peter.penz () gmx ! at>
Date:       2008-11-13 21:31:14
Message-ID: 1226611874.675398.11594.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 883932 by ppenz:

improved look of tooltips

 M  +13 -5     kformattedballoontipdelegate.cpp  


--- trunk/KDE/kdebase/apps/dolphin/src/kformattedballoontipdelegate.cpp \
#883931:883932 @@ -20,7 +20,9 @@
 
 #include "kformattedballoontipdelegate.h"
 #include <QBitmap>
+#include <QLinearGradient>
 #include <QTextDocument>
+#include <kcolorscheme.h>
 #include <kdebug.h>
 
 QSize KFormattedBalloonTipDelegate::sizeHint(const KStyleOptionToolTip *option, \
const KToolTipItem *item) const @@ -43,18 +45,24 @@
 {
     QRect contents;
     QPainterPath path = createPath(option, &contents);
-    bool alpha = haveAlphaChannel();
-
-    if (alpha) {
+    if (haveAlphaChannel()) {
         painter->setRenderHint(QPainter::Antialiasing);
         painter->translate(.5, .5);
     }
 
 #if QT_VERSION >= 0x040400
-    painter->setBrush(option->palette.brush(QPalette::ToolTipBase));
+    const QColor toColor = option->palette.brush(QPalette::ToolTipBase).color();
 #else
-    painter->setBrush(option->palette.brush(QPalette::Base));
+    const QColor toColor = option->palette.brush(QPalette::Base).color();
 #endif
+    const QColor fromColor = KColorScheme::shade(toColor, KColorScheme::LightShade, \
0.2); +    
+    QLinearGradient gradient(option->rect.topLeft(), option->rect.bottomLeft());
+    gradient.setColorAt(0.0, fromColor);
+    gradient.setColorAt(1.0, toColor);
+    painter->setPen(Qt::NoPen);
+    painter->setBrush(gradient);
+
     painter->drawPath(path);
 
     QIcon icon = item->icon();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic