From 42962c662a205365be08841dd9882b32aa0b8bd4 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 1 Jan 2010 19:17:17 +0000 Subject: [PATCH] use halo painter behind the text svn path=/trunk/KDE/kdelibs/; revision=1068654 --- private/tooltip.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/private/tooltip.cpp b/private/tooltip.cpp index dd9a1bf04..2b52a4721 100644 --- a/private/tooltip.cpp +++ b/private/tooltip.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef Q_WS_X11 #include #include @@ -40,6 +41,7 @@ #include #include +#include #include #include #include @@ -82,6 +84,16 @@ public: data.registerResources(m_document); m_document->setHtml("

" + html + "

"); m_document->adjustSize(); + + m_haloRects.clear(); + QTextLayout *layout = m_document->begin().layout(); + //layout->setPosition(QPointF(textRect.x(), textBoundingRect->y())); + QTextLine line; + for (int i = 0; i < layout->lineCount(); ++i) { + line = layout->lineAt(i); + m_haloRects.append(line.naturalTextRect().translated(layout->position().toPoint()).toRect()); + } + update(); } @@ -98,6 +110,11 @@ public: void paintEvent(QPaintEvent *event) { QPainter p(this); + + foreach (const QRectF &rect, m_haloRects) { + Plasma::PaintUtils::drawHalo(&p, rect); + } + m_document->drawContents(&p, event->rect()); } @@ -122,10 +139,12 @@ public: } } + private: ToolTip *m_toolTip; QTextDocument *m_document; QString m_anchor; + QList m_haloRects; }; class ToolTipPrivate