DiffEditor: Use settings' foreground color for highlights

Simplify drawing highlights by passing selections
into a drawing function.
Reduce selections which are covered completely by
other selections.

Task-number: QTCREATORBUG-12844
Change-Id: If282d5c881d25cac1b8db4ac8dfc45d47b0b8580
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
jkobus
2014-09-25 15:48:21 +02:00
committed by Orgad Shaneh
parent cb4f04f416
commit 5c6b1373c4
4 changed files with 116 additions and 66 deletions

View File

@@ -3454,7 +3454,6 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
ifdefedOutFormat.background());
}
innerPaintEvent(e);
/*
Here comes an almost verbatim copy of
QPlainTextEdit::paintEvent() so we can adjust the extra
@@ -3902,8 +3901,7 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
}
layout->draw(&painter, offset, selections, er);
paintBlock(&painter, block, offset, selections, er);
if ((drawCursor && !drawCursorAsBlock)
|| (editable && context.cursorPosition < -1 && !layout->preeditAreaText().isEmpty())) {
@@ -4113,6 +4111,15 @@ void BaseTextEditorWidget::paintEvent(QPaintEvent *e)
}
}
void BaseTextEditorWidget::paintBlock(QPainter *painter,
const QTextBlock &block,
const QPointF &offset,
const QVector<QTextLayout::FormatRange> &selections,
const QRect &clipRect) const
{
block.layout()->draw(painter, offset, selections, clipRect);
}
int BaseTextEditorWidget::visibleFoldedBlockNumber() const
{
return d->visibleFoldedBlockNumber;