diff options
| author | Peter Penz <[email protected]> | 2009-03-11 07:34:17 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2009-03-11 07:34:17 +0000 |
| commit | e3a83e67a27db0fdf40bc4a96d4613fcbe5cb3d9 (patch) | |
| tree | f845a94eeaecd85854c61fbb9fc3a35a32f7374a /src | |
| parent | b6f4b459eb04b96bcf7ba7d6be9467a1e76cba53 (diff) | |
added subtle transparency for tooltips
svn path=/trunk/KDE/kdebase/apps/; revision=938051
Diffstat (limited to 'src')
| -rw-r--r-- | src/tooltips/kformattedballoontipdelegate.cpp | 7 | ||||
| -rw-r--r-- | src/tooltips/ktooltip.cpp | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/tooltips/kformattedballoontipdelegate.cpp b/src/tooltips/kformattedballoontipdelegate.cpp index 140c90ef4..a897d8312 100644 --- a/src/tooltips/kformattedballoontipdelegate.cpp +++ b/src/tooltips/kformattedballoontipdelegate.cpp @@ -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); diff --git a/src/tooltips/ktooltip.cpp b/src/tooltips/ktooltip.cpp index a0126fbff..d5aa0f7b7 100644 --- a/src/tooltips/ktooltip.cpp +++ b/src/tooltips/ktooltip.cpp @@ -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; |
