get rid of the text halos
they are (relatively) expensive and should be unnecessary now: we have blur, it works well, and when we don't blur we use different backgrounds. one more "take one thing off" while i'm futzing around in tooltips
This commit is contained in:
parent
464bab7a68
commit
ea8d0dcce2
@ -89,25 +89,13 @@ public:
|
|||||||
}
|
}
|
||||||
m_document->adjustSize();
|
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);
|
|
||||||
|
|
||||||
// Add halo rect only when a non empty line is found
|
|
||||||
if (line.naturalTextWidth()) {
|
|
||||||
m_haloRects.append(line.naturalTextRect().translated(layout->position().toPoint()).toRect().translated(m_margin, m_margin));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize minimumSizeHint() const
|
QSize minimumSizeHint() const
|
||||||
{
|
{
|
||||||
return m_document->size().toSize() + QSize(m_margin, m_margin)*2;
|
const int margin = 6;
|
||||||
|
return m_document->size().toSize() + QSize(margin, margin)*2;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize maximumSizeHint() const
|
QSize maximumSizeHint() const
|
||||||
@ -118,14 +106,6 @@ public:
|
|||||||
void paintEvent(QPaintEvent *event)
|
void paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
|
|
||||||
if (Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor).value() < 128) {
|
|
||||||
foreach (const QRectF &rect, m_haloRects) {
|
|
||||||
Plasma::PaintUtils::drawHalo(&p, rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
p.translate(m_margin, m_margin);
|
|
||||||
}
|
|
||||||
m_document->drawContents(&p, event->rect());
|
m_document->drawContents(&p, event->rect());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,8 +135,6 @@ private:
|
|||||||
ToolTip *m_toolTip;
|
ToolTip *m_toolTip;
|
||||||
QTextDocument *m_document;
|
QTextDocument *m_document;
|
||||||
QString m_anchor;
|
QString m_anchor;
|
||||||
QList<QRectF> m_haloRects;
|
|
||||||
static const int m_margin = 6;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ToolTipPrivate
|
class ToolTipPrivate
|
||||||
|
Loading…
Reference in New Issue
Block a user