VcsBaseEditor: Make link colors theme-aware

Change-Id: I5323e0cd236276a5a74e7c55f81d9d9c9795d295
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2020-05-12 11:11:54 +02:00
committed by André Hartmann
parent f480cf2c44
commit 9c1e8a99d8

View File

@@ -443,14 +443,15 @@ bool UrlTextCursorHandler::findContentsUnderCursor(const QTextCursor &cursor)
void UrlTextCursorHandler::highlightCurrentContents()
{
const QColor linkColor = creatorTheme()->color(Theme::TextColorLink);
QTextEdit::ExtraSelection sel;
sel.cursor = currentCursor();
sel.cursor.setPosition(currentCursor().position()
- (currentCursor().columnNumber() - m_urlData.startColumn));
sel.cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, m_urlData.url.length());
sel.format.setFontUnderline(true);
sel.format.setForeground(Qt::blue);
sel.format.setUnderlineColor(Qt::blue);
sel.format.setForeground(linkColor);
sel.format.setUnderlineColor(linkColor);
sel.format.setProperty(QTextFormat::UserProperty, m_urlData.url);
editorWidget()->setExtraSelections(VcsBaseEditorWidget::OtherSelection,
QList<QTextEdit::ExtraSelection>() << sel);