diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2010-01-25 14:25:00 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2010-01-25 14:25:00 +0100 |
commit | ab3d3cf413955afabe845bd80676cd468ebbaa80 (patch) | |
tree | cb20065a4909b6747b71fdb2c9fc5383b7962454 | |
parent | 0ddfcdff434f808b10d414e6a1c1df7d3642f40b (diff) | |
download | qt-creator-ab3d3cf413955afabe845bd80676cd468ebbaa80.tar.gz |
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.
-rw-r--r-- | src/plugins/texteditor/basetexteditor.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 7825941ea5..dad53a0c59 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -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 |