diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index a56af5dd4ea521fc09b7b1d6ef264483cb9b84d3..ea682127e589370e6281cd3a781cf4a74960c13a 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<QTextEdit::ExtraSelection> 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 6f1c74af94e8b64c51bb2c65db278b6075c19045..b13ac2a6366740a06ae5045dbb6902f887c9beac 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<QTextEdit::ExtraSelection> m_renameSelections; int m_currentRenameSelection; diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index e816f1af93311f84494e253dd8b7ba70521204a0..18c4e723e51614b3ef5895c5c086ed1eeffc0dad 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 70372541be48ac4e8a78485a204636e2918cb262..18d194929876ce02370f0df44e79288598dd85c6 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 7d0942b49769e6aa068737d0fc7f4cd46e54e4ef..65ae67bbd40ee278e582232228cc11da173b31b0 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));