diff options
| author | Peter Penz <[email protected]> | 2008-11-13 21:31:03 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2008-11-13 21:31:03 +0000 |
| commit | aece194dbb9ab0d3dc54a66999bb2d36993c1fe9 (patch) | |
| tree | 4bc563900275eab6979a72ac09ebebb9c34d3781 /src | |
| parent | f5dafdc48add734a3d3399d987556de2164d0a96 (diff) | |
improved look of tooltips
svn path=/trunk/KDE/kdebase/apps/; revision=883932
Diffstat (limited to 'src')
| -rw-r--r-- | src/kformattedballoontipdelegate.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/kformattedballoontipdelegate.cpp b/src/kformattedballoontipdelegate.cpp index 141cc27f7..a37664b82 100644 --- a/src/kformattedballoontipdelegate.cpp +++ b/src/kformattedballoontipdelegate.cpp @@ -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 @@ void KFormattedBalloonTipDelegate::paint(QPainter *painter, const KStyleOptionTo { 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(); |
