Commit caa56ea0 authored by Vicken Simonian's avatar Vicken Simonian

Editor: Draw column wrap line after drawing ifdef blocks

Task-number: QTCREATORBUG-12940
Change-Id: I431176c1879236bc107a2c1db11890da5d75f750
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 69015378
......@@ -3066,25 +3066,6 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
qreal lineX = 0;
if (d->m_visibleWrapColumn > 0) {
// Don't use QFontMetricsF::averageCharWidth here, due to it returning
// a fractional size even when this is not supported by the platform.
lineX = QFontMetricsF(font()).width(QLatin1Char('x')) * d->m_visibleWrapColumn + offset.x() + 4;
if (lineX < viewportRect.width()) {
const QBrush background = ifdefedOutFormat.background();
painter.fillRect(QRectF(lineX, er.top(), viewportRect.width() - lineX, er.height()),
background);
const QColor col = (palette().base().color().value() > 128) ? Qt::black : Qt::white;
const QPen pen = painter.pen();
painter.setPen(blendColors(background.isOpaque() ? background.color() : palette().base().color(),
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
painter.setBrushOrigin(offset);
......@@ -3226,6 +3207,26 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
}
}
// draw wrap column after ifdefed out blocks
if (d->m_visibleWrapColumn > 0) {
// Don't use QFontMetricsF::averageCharWidth here, due to it returning
// a fractional size even when this is not supported by the platform.
lineX = QFontMetricsF(font()).width(QLatin1Char('x')) * d->m_visibleWrapColumn + offset.x() + 4;
if (lineX < viewportRect.width()) {
const QBrush background = ifdefedOutFormat.background();
painter.fillRect(QRectF(lineX, er.top(), viewportRect.width() - lineX, er.height()),
background);
const QColor col = (palette().base().color().value() > 128) ? Qt::black : Qt::white;
const QPen pen = painter.pen();
painter.setPen(blendColors(background.isOpaque() ? background.color() : palette().base().color(),
col, 32));
painter.drawLine(QPointF(lineX, er.top()), QPointF(lineX, er.bottom()));
painter.setPen(pen);
}
}
// possible extra pass for the block selection find scope
if (!d->m_findScopeStart.isNull() && d->m_findScopeVerticalBlockSelectionFirstColumn >= 0) {
QTextBlock blockFS = block;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment