diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-05-14 14:33:08 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-05-29 12:57:31 +0000 |
commit | 5bbed920616bcf55caefda36765bca756767efec (patch) | |
tree | bcd64713fb0a21c22e236b45f1f3d1773a273e40 /src/plugins/coreplugin | |
parent | 51afb0467464b6f8241db136ae2c19b6a83ce0e5 (diff) |
ProjectExplorer: Allow text filtering in message pane
Change-Id: I7b70f7056c757fcb13634021b8e2dcf0b3a34097
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/coreplugin')
-rw-r--r-- | src/plugins/coreplugin/messageoutputwindow.cpp | 10 | ||||
-rw-r--r-- | src/plugins/coreplugin/messageoutputwindow.h | 2 | ||||
-rw-r--r-- | src/plugins/coreplugin/outputwindow.cpp | 15 |
3 files changed, 19 insertions, 8 deletions
diff --git a/src/plugins/coreplugin/messageoutputwindow.cpp b/src/plugins/coreplugin/messageoutputwindow.cpp index da0b2093677..70bef5dc114 100644 --- a/src/plugins/coreplugin/messageoutputwindow.cpp +++ b/src/plugins/coreplugin/messageoutputwindow.cpp @@ -53,6 +53,8 @@ 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); @@ -62,6 +64,9 @@ MessageOutputWindow::MessageOutputWindow() auto agg = new Aggregation::Aggregate; agg->add(m_widget); agg->add(new BaseTextFind(m_widget)); + + setupFilterUi("MessageOutputPane.Filter"); + setFilteringEnabled(true); } MessageOutputWindow::~MessageOutputWindow() @@ -139,5 +144,10 @@ bool MessageOutputWindow::canNavigate() const return false; } +void MessageOutputWindow::updateFilter() +{ + m_widget->setFilterText(filterText()); +} + } // namespace Internal } // namespace Core diff --git a/src/plugins/coreplugin/messageoutputwindow.h b/src/plugins/coreplugin/messageoutputwindow.h index f32bcea1767..69f940dc8ec 100644 --- a/src/plugins/coreplugin/messageoutputwindow.h +++ b/src/plugins/coreplugin/messageoutputwindow.h @@ -64,6 +64,8 @@ public: bool canNavigate() const override; private: + void updateFilter() override; + OutputWindow *m_widget; }; diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index f0acec9d6bb..2c553b59b01 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -74,6 +74,7 @@ public: QTextCursor cursor; QString filterText; QTextBlock lastFilteredBlock; + QPalette originalPalette; OutputWindow::FilterModeFlags filterMode = OutputWindow::FilterModeFlag::Default; }; @@ -297,21 +298,19 @@ void OutputWindow::setFilterText(const QString &filterText) // Update textedit's background color if (filterText.isEmpty()) { - setPalette({}); + setPalette(d->originalPalette); + setReadOnly(d->m_originalReadOnly); } else { + if (filterTextWasEmpty) { + d->m_originalReadOnly = isReadOnly(); + d->originalPalette = palette(); + } QPalette pal; pal.setColor(QPalette::Active, QPalette::Base, d->m_highlightBgColor); pal.setColor(QPalette::Inactive, QPalette::Base, d->m_highlightBgColor.darker(120)); pal.setColor(QPalette::Active, QPalette::Text, d->m_highlightTextColor); pal.setColor(QPalette::Inactive, QPalette::Text, d->m_highlightTextColor.darker(120)); setPalette(pal); - } - - if (filterText.isEmpty()) { - setReadOnly(d->m_originalReadOnly); - } else { - if (filterTextWasEmpty) - d->m_originalReadOnly = isReadOnly(); setReadOnly(true); } |