Editor: Make parenthese mismatch color configurable.

Task-number: QTCREATORBUG-14357
Change-Id: I92a0d50fb8f3448195f3d38f7544a31eb695733b
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
David Schulz
2015-04-28 11:04:07 +02:00
parent ef56bc6be0
commit f34b32abd5
10 changed files with 17 additions and 6 deletions

View File

@@ -341,7 +341,6 @@ public:
// parentheses matcher
bool m_formatRange;
QTextCharFormat m_mismatchFormat;
QTimer m_parenthesesMatchingTimer;
// end parentheses matcher
@@ -660,8 +659,6 @@ void TextEditorWidgetPrivate::ctor(const QSharedPointer<TextDocument> &doc)
// parentheses matcher
m_formatRange = true;
m_mismatchFormat.setBackground(q->palette().color(QPalette::Base).value() < 128
? Qt::darkMagenta : Qt::magenta);
m_parenthesesMatchingTimer.setSingleShot(true);
QObject::connect(&m_parenthesesMatchingTimer, &QTimer::timeout,
this, &TextEditorWidgetPrivate::_q_matchParentheses);
@@ -5605,12 +5602,14 @@ void TextEditorWidgetPrivate::_q_matchParentheses()
const QTextCharFormat &matchFormat
= q->textDocument()->fontSettings().toTextCharFormat(C_PARENTHESES);
const QTextCharFormat &mismatchFormat
= q->textDocument()->fontSettings().toTextCharFormat(C_PARENTHESES_MISMATCH);
int animatePosition = -1;
if (backwardMatch.hasSelection()) {
QTextEdit::ExtraSelection sel;
if (backwardMatchType == TextBlockUserData::Mismatch) {
sel.cursor = backwardMatch;
sel.format = m_mismatchFormat;
sel.format = mismatchFormat;
extraSelections.append(sel);
} else {
@@ -5634,7 +5633,7 @@ void TextEditorWidgetPrivate::_q_matchParentheses()
QTextEdit::ExtraSelection sel;
if (forwardMatchType == TextBlockUserData::Mismatch) {
sel.cursor = forwardMatch;
sel.format = m_mismatchFormat;
sel.format = mismatchFormat;
extraSelections.append(sel);
} else {