summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-06-04 16:34:00 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2019-06-12 12:20:31 +0000
commit2391ef6088c14e41a6b6183fab43ca365eb5be42 (patch)
treeb990e1f7a3ffffb315ff140e78208e742d4fb38e
parentb94c725f0f3e3ec63424c8a9feb09837b6e5285e (diff)
downloadqt-creator-2391ef6088c14e41a6b6183fab43ca365eb5be42.tar.gz
Output panes: Improve the way to signal that filtering is active
At the moment, background and foreground colors of an output pane are changed (via the widget's palette) when filtering is active, in order to make it clear to the user that the output is being tampered with. There are several problems there: - The chosen background color is quite garish. - More importantly, the palette change has no effect in the compile and app output panes, because their output is explicitly formatted and thus not affected by the general text color change. As a result, the output may no longer be readable. We fix this by choosing a less intrusive approach that simply darkens (or lightens) the pane's background color a bit when filtering is active. This is still clearly visible to the user. Change-Id: I41e053b4b218be57fe7655e314d4ebf93f59f505 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r--src/plugins/coreplugin/messageoutputwindow.cpp2
-rw-r--r--src/plugins/coreplugin/outputwindow.cpp37
-rw-r--r--src/plugins/coreplugin/outputwindow.h2
-rw-r--r--src/plugins/projectexplorer/appoutputpane.cpp5
-rw-r--r--src/plugins/projectexplorer/compileoutputwindow.cpp5
5 files changed, 13 insertions, 38 deletions
diff --git a/src/plugins/coreplugin/messageoutputwindow.cpp b/src/plugins/coreplugin/messageoutputwindow.cpp
index 6009282953..7aabaefbbc 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 0ed7542ee1..9e20482113 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 f89ad521f7..88692d5ab7 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 948780aabc..7631f26cac 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 3d19bd9514..91cc2fb22c 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);