Don't draw the right margin border on top of the text

Better to draw it explicitly under the text, together with the
associated background color.
This commit is contained in:
Thorbjørn Lindeijer
2010-01-25 14:25:00 +01:00
parent 0ddfcdff43
commit ab3d3cf413

View File

@@ -1997,9 +1997,18 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
if (d->m_visibleWrapColumn > 0) {
lineX = fontMetrics().averageCharWidth() * d->m_visibleWrapColumn + offset.x() + 4;
if (lineX < viewportRect.width())
painter.fillRect(QRectF(lineX, 0, viewportRect.width() - lineX, viewportRect.height()),
d->m_ifdefedOutFormat.background());
if (lineX < viewportRect.width()) {
const QColor backgroundColor = d->m_ifdefedOutFormat.background().color();
painter.fillRect(QRectF(lineX, er.top(), viewportRect.width() - lineX, er.height()),
backgroundColor);
const QColor col = (palette().base().color().value() > 128) ? Qt::black : Qt::white;
const QPen pen = painter.pen();
painter.setPen(blendColors(backgroundColor, col, 32));
painter.drawLine(QPointF(lineX, er.top()), QPointF(lineX, er.bottom()));
painter.setPen(pen);
}
}
// Set a brush origin so that the WaveUnderline knows where the wave started
@@ -2379,14 +2388,6 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
cursor.setPosition(d->m_animator->position());
d->m_animator->draw(&painter, cursorRect(cursor).topLeft());
}
if (lineX > 0) {
const QColor bg = palette().base().color();
const QColor col = (bg.value() > 128) ? Qt::black : Qt::white;
painter.setPen(blendColors(d->m_ifdefedOutFormat.background().color(), col, 32));
painter.drawLine(QPointF(lineX, er.top()), QPointF(lineX, er.bottom()));
}
}
QWidget *BaseTextEditor::extraArea() const