Add text search functionality to output window centrally

All output windows should be searchable with Edit > Find/Replace
(Ctrl+F), no reason for every single instance setting that up
individually.

Add a find placeholder for the build system output in Projects mode, so
the search functionality is available there as well.

Change-Id: Idad6824bfb21e6ae9ab923191a7e83b43256e68b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2021-09-14 16:42:05 +02:00
parent 9815d2ee7e
commit 29df497d25
6 changed files with 23 additions and 39 deletions

View File

@@ -27,9 +27,7 @@
#include "outputwindow.h"
#include "icontext.h"
#include "coreconstants.h"
#include "find/basetextfind.h"
#include <aggregation/aggregate.h>
#include <coreplugin/icore.h>
#include <utils/utilsicons.h>
@@ -45,14 +43,6 @@ MessageOutputWindow::MessageOutputWindow()
{
m_widget = new OutputWindow(Context(Constants::C_GENERAL_OUTPUT_PANE), zoomSettingsKey);
m_widget->setReadOnly(true);
// Let selected text be colored as if the text edit was editable,
// otherwise the highlight for searching is too light
QPalette p = m_widget->palette();
QColor activeHighlight = p.color(QPalette::Active, QPalette::Highlight);
p.setColor(QPalette::Highlight, activeHighlight);
QColor activeHighlightedText = p.color(QPalette::Active, QPalette::HighlightedText);
p.setColor(QPalette::HighlightedText, activeHighlightedText);
m_widget->setPalette(p);
connect(this, &IOutputPane::zoomInRequested, m_widget, &Core::OutputWindow::zoomIn);
connect(this, &IOutputPane::zoomOutRequested, m_widget, &Core::OutputWindow::zoomOut);
@@ -60,10 +50,6 @@ MessageOutputWindow::MessageOutputWindow()
connect(this, &IOutputPane::fontChanged, m_widget, &OutputWindow::setBaseFont);
connect(this, &IOutputPane::wheelZoomEnabledChanged, m_widget, &OutputWindow::setWheelZoomEnabled);
auto agg = new Aggregation::Aggregate;
agg->add(m_widget);
agg->add(new BaseTextFind(m_widget));
setupFilterUi("MessageOutputPane.Filter");
setFilteringEnabled(true);
setupContext(Constants::C_GENERAL_OUTPUT_PANE, m_widget);