]> cloud.milkyroute.net Git - dolphin.git/commitdiff
added subtle transparency for tooltips
authorPeter Penz <peter.penz19@gmail.com>
Wed, 11 Mar 2009 07:34:17 +0000 (07:34 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 11 Mar 2009 07:34:17 +0000 (07:34 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=938051

src/tooltips/kformattedballoontipdelegate.cpp
src/tooltips/ktooltip.cpp

index 140c90ef40e15f593dfbccf9e7bfefcb8cc7518d..a897d83121d85f423648ebaa2007e4879f1bca28 100644 (file)
@@ -51,14 +51,17 @@ void KFormattedBalloonTipDelegate::paint(QPainter *painter,
                                          const KStyleOptionToolTip *option,
                                          const KToolTipItem *item) const
 {
+    QColor toColor = option->palette.brush(QPalette::ToolTipBase).color();
+    QColor fromColor = KColorScheme::shade(toColor, KColorScheme::LightShade, 0.2);
+
     QPainterPath path = createPath(*option);
     if (haveAlphaChannel()) {
         painter->setRenderHint(QPainter::Antialiasing);
         painter->translate(.5, .5);
+        toColor.setAlpha(220);
+        fromColor.setAlpha(220);
     }
 
-    const QColor toColor = option->palette.brush(QPalette::ToolTipBase).color();
-    const QColor fromColor = KColorScheme::shade(toColor, KColorScheme::LightShade, 0.2);
 
     QLinearGradient gradient(option->rect.topLeft(), option->rect.bottomLeft());
     gradient.setColorAt(0.0, fromColor);
index a0126fbffecdcc976660dd64b266aebcd3ab14ef..d5aa0f7b77202ddece8ed16944197a1eb65375a8 100644 (file)
@@ -242,7 +242,7 @@ KToolTipDelegate *KAbstractToolTipLabel::delegate() const
 class QWidgetLabel : public QWidget, public KAbstractToolTipLabel
 {
 public:
-    QWidgetLabel() : QWidget(0, Qt::ToolTip) {}
+    QWidgetLabel();
     void showTip(const QPoint &pos, const KToolTipItem *item);
     void moveTip(const QPoint &pos);
     void hideTip();
@@ -255,6 +255,13 @@ private:
     const KToolTipItem *currentItem;
 };
 
+QWidgetLabel::QWidgetLabel() : QWidget(0, Qt::ToolTip)
+{
+    if (KToolTipManager::instance()->haveAlphaChannel()) {
+        setAttribute(Qt::WA_TranslucentBackground);
+    }
+}
+
 void QWidgetLabel::showTip(const QPoint &pos, const KToolTipItem *item)
 {
     currentItem = item;