diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index a56af5dd4ea..ea682127e58 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -841,7 +841,7 @@ void CPPEditor::renameInPlace() if (c.position() >= s.cursor.anchor() && c.position() <= s.cursor.position()) { m_currentRenameSelection = i; - m_renameSelections[i].format.setBackground(QColor(255, 200, 200)); + m_renameSelections[i].format = m_occurrenceRenameFormat; setExtraSelections(CodeSemanticsSelection, m_renameSelections); break; } @@ -1566,6 +1566,8 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs) highlighter->rehighlight(); m_linkFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_LINK)); + m_occurrencesFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES)); + m_occurrenceRenameFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES_RENAME)); } void CPPEditor::setDisplaySettings(const TextEditor::DisplaySettings &ds) @@ -1632,9 +1634,6 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) int line = 0, column = 0; convertPosition(position(), &line, &column); - QTextCharFormat format; - format.setBackground(QColor(220, 220, 220)); - QList selections; SemanticInfo::LocalUseIterator it(semanticInfo.localUses); @@ -1655,7 +1654,7 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) if (! good) continue; - highlightUses(document(), format, uses, &selections); + highlightUses(document(), m_occurrencesFormat, uses, &selections); break; // done } diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index 6f1c74af94e..b13ac2a6366 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -301,6 +301,8 @@ private: QAction *m_sortAction; QTimer *m_updateMethodBoxTimer; QTimer *m_updateUsesTimer; + QTextCharFormat m_occurrencesFormat; + QTextCharFormat m_occurrenceRenameFormat; QList m_renameSelections; int m_currentRenameSelection; diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index e816f1af933..18c4e723e51 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -190,6 +190,10 @@ QColor FormatDescription::background() const } else if (m_name == QLatin1String(Constants::C_SELECTION)) { const QPalette palette = QApplication::palette(); return palette.color(QPalette::Highlight); + } else if (m_name == QLatin1String(Constants::C_OCCURRENCES)) { + return QColor(220, 220, 220); + } else if (m_name == QLatin1String(Constants::C_OCCURRENCES_RENAME)) { + return QColor(255, 200, 200); } return QColor(); // invalid color } diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h index 70372541be4..18d19492987 100644 --- a/src/plugins/texteditor/texteditorconstants.h +++ b/src/plugins/texteditor/texteditorconstants.h @@ -77,6 +77,8 @@ const char * const C_SEARCH_SCOPE = "SearchScope"; const char * const C_PARENTHESES = "Parentheses"; const char * const C_CURRENT_LINE = "CurrentLine"; const char * const C_CURRENT_LINE_NUMBER = "CurrentLineNumber"; +const char * const C_OCCURRENCES = "Occurrences"; +const char * const C_OCCURRENCES_RENAME = "Occurrences.Rename"; const char * const C_NUMBER = "Number"; const char * const C_STRING = "String"; diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 7d0942b4976..65ae67bbd40 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -77,6 +77,9 @@ TextEditorSettings::TextEditorSettings(QObject *parent) currentLineNumber.format().setBold(true); formatDescriptions.append(currentLineNumber); + formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES), tr("Occurrences"))); + formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES_RENAME), tr("Renaming Occurrence"))); + // Standard categories formatDescriptions.append(FormatDescription(QLatin1String(C_NUMBER), tr("Number"), Qt::darkBlue)); formatDescriptions.append(FormatDescription(QLatin1String(C_STRING), tr("String"), Qt::darkGreen));