diff --git a/src/plugins/coreplugin/messageoutputwindow.cpp b/src/plugins/coreplugin/messageoutputwindow.cpp index 60092829537..7aabaefbbc9 100644 --- a/src/plugins/coreplugin/messageoutputwindow.cpp +++ b/src/plugins/coreplugin/messageoutputwindow.cpp @@ -53,8 +53,6 @@ MessageOutputWindow::MessageOutputWindow() QColor activeHighlightedText = p.color(QPalette::Active, QPalette::HighlightedText); p.setColor(QPalette::HighlightedText, activeHighlightedText); m_widget->setPalette(p); - m_widget->setHighlightBgColor(p.color(QPalette::Highlight)); - m_widget->setHighlightTextColor(p.color(QPalette::HighlightedText)); connect(this, &IOutputPane::zoomIn, m_widget, &Core::OutputWindow::zoomIn); connect(this, &IOutputPane::zoomOut, m_widget, &Core::OutputWindow::zoomOut); diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index 0ed7542ee16..9e204821137 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -59,8 +59,6 @@ public: IContext *outputWindowContext = nullptr; Utils::OutputFormatter *formatter = nullptr; - QColor highlightBgColor; - QColor highlightTextColor; QString settingsKey; bool enforceNewline = false; @@ -273,16 +271,6 @@ void OutputWindow::setWheelZoomEnabled(bool enabled) d->zoomEnabled = enabled; } -void OutputWindow::setHighlightBgColor(const QColor &bgColor) -{ - d->highlightBgColor = bgColor; -} - -void OutputWindow::setHighlightTextColor(const QColor &textColor) -{ - d->highlightTextColor = textColor; -} - void OutputWindow::updateFilterProperties(const QString &filterText, Qt::CaseSensitivity caseSensitivity, bool isRegexp) { @@ -297,21 +285,22 @@ void OutputWindow::updateFilterProperties(const QString &filterText, d->filterText = filterText; // Update textedit's background color - if (filterText.isEmpty()) { + if (filterText.isEmpty() && !filterTextWasEmpty) { setPalette(d->originalPalette); setReadOnly(d->originalReadOnly); - } else { - if (filterTextWasEmpty) { - d->originalReadOnly = isReadOnly(); - d->originalPalette = palette(); - } - QPalette pal; - pal.setColor(QPalette::Active, QPalette::Base, d->highlightBgColor); - pal.setColor(QPalette::Inactive, QPalette::Base, d->highlightBgColor.darker(120)); - pal.setColor(QPalette::Active, QPalette::Text, d->highlightTextColor); - pal.setColor(QPalette::Inactive, QPalette::Text, d->highlightTextColor.darker(120)); - setPalette(pal); + } + if (!filterText.isEmpty() && filterTextWasEmpty) { + d->originalReadOnly = isReadOnly(); setReadOnly(true); + const auto newBgColor = [this] { + const QColor currentColor = palette().color(QPalette::Base); + const int factor = 120; + return currentColor.value() < 128 ? currentColor.lighter(factor) + : currentColor.darker(factor); + }; + QPalette p = palette(); + p.setColor(QPalette::Base, newBgColor()); + setPalette(p); } } d->filterMode = flags; diff --git a/src/plugins/coreplugin/outputwindow.h b/src/plugins/coreplugin/outputwindow.h index f89ad521f7b..88692d5ab74 100644 --- a/src/plugins/coreplugin/outputwindow.h +++ b/src/plugins/coreplugin/outputwindow.h @@ -76,8 +76,6 @@ public: float fontZoom() const; void setFontZoom(float zoom); void setWheelZoomEnabled(bool enabled); - void setHighlightBgColor(const QColor &bgColor); - void setHighlightTextColor(const QColor &textColor); void updateFilterProperties(const QString &filterText, Qt::CaseSensitivity caseSensitivity, bool regexp); diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 948780aabcb..7631f26cac6 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -426,7 +426,6 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) } // Create new static int counter = 0; - const TextEditor::FontSettings &fs = TextEditor::TextEditorSettings::fontSettings(); Core::Id contextId = Core::Id(C_APP_OUTPUT).withSuffix(counter++); Core::Context context(contextId); Core::OutputWindow *ow = new Core::OutputWindow(context, SETTINGS_KEY, m_tabWidget); @@ -434,10 +433,6 @@ void AppOutputPane::createNewOutputWindow(RunControl *rc) ow->setWindowIcon(Icons::WINDOW.icon()); ow->setWordWrapEnabled(m_settings.wrapOutput); ow->setMaxCharCount(m_settings.maxCharCount); - ow->setHighlightBgColor(fs.toTextCharFormat(TextEditor::C_SEARCH_RESULT) - .background().color()); - ow->setHighlightTextColor(fs.toTextCharFormat(TextEditor::C_SEARCH_RESULT) - .foreground().color()); auto updateFontSettings = [ow] { ow->setBaseFont(TextEditor::TextEditorSettings::fontSettings().font()); diff --git a/src/plugins/projectexplorer/compileoutputwindow.cpp b/src/plugins/projectexplorer/compileoutputwindow.cpp index 3d19bd9514a..91cc2fb22cc 100644 --- a/src/plugins/projectexplorer/compileoutputwindow.cpp +++ b/src/plugins/projectexplorer/compileoutputwindow.cpp @@ -172,11 +172,6 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) : updateFontSettings(); updateZoomEnabled(); - const TextEditor::FontSettings &fs = TextEditor::TextEditorSettings::fontSettings(); - m_outputWindow->setHighlightBgColor(fs.toTextCharFormat(TextEditor::C_SEARCH_RESULT) - .background().color()); - m_outputWindow->setHighlightTextColor(fs.toTextCharFormat(TextEditor::C_SEARCH_RESULT) - .foreground().color()); setupFilterUi("CompileOutputPane.Filter"); setFilteringEnabled(true);