From: Peter Penz Date: Thu, 13 Nov 2008 21:31:03 +0000 (+0000) Subject: improved look of tooltips X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/aece194dbb9ab0d3dc54a66999bb2d36993c1fe9 improved look of tooltips svn path=/trunk/KDE/kdebase/apps/; revision=883932 --- 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 +#include #include +#include #include 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();