diff options
author | Vicken Simonian <vsimon@gmail.com> | 2014-09-01 03:10:07 -0700 |
---|---|---|
committer | Vicken Simonian <vsimon@gmail.com> | 2014-09-04 17:25:43 +0200 |
commit | caa56ea0fad3d277c69ac223952e7b4d8cb8d632 (patch) | |
tree | c3406874063bbf81c5fe2fbed31f9a9fd07adc36 /src/plugins/texteditor/basetexteditor.cpp | |
parent | 690153786e0585652987a924bdfe579a487ca67d (diff) | |
download | qt-creator-caa56ea0fad3d277c69ac223952e7b4d8cb8d632.tar.gz |
Editor: Draw column wrap line after drawing ifdef blocks
Task-number: QTCREATORBUG-12940
Change-Id: I431176c1879236bc107a2c1db11890da5d75f750
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/plugins/texteditor/basetexteditor.cpp')
-rw-r--r-- | src/plugins/texteditor/basetexteditor.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index f957b23c4c..4f18085d29 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -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; |