mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 15:06:32 +00:00
When rendering richtext documents, override document color for selection
This commit is contained in:
@@ -796,10 +796,19 @@ void RichResourceTextPaint(const QWidget *owner, QPainter *painter, QRect rect,
|
||||
|
||||
QAbstractTextDocumentLayout::PaintContext docCtx;
|
||||
docCtx.palette = palette;
|
||||
docCtx.palette.setColor(QPalette::Text, foreBrush.color());
|
||||
|
||||
docCtx.clip = QRectF(0, 0, rect.width() - 1, rect.height());
|
||||
|
||||
if(state & QStyle::State_Selected)
|
||||
{
|
||||
QAbstractTextDocumentLayout::Selection sel;
|
||||
sel.format.setForeground(foreBrush.color());
|
||||
sel.cursor = QTextCursor(&linkedText->doc);
|
||||
sel.cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
|
||||
sel.cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
|
||||
docCtx.selections.push_back(sel);
|
||||
}
|
||||
|
||||
painter->setClipRect(docCtx.clip);
|
||||
|
||||
linkedText->doc.documentLayout()->draw(painter, docCtx);
|
||||
|
||||
Reference in New Issue
Block a user