Output windows: Skip filter function if no filter is set

Running the filter function is (too?) expensive, so make sure that's
only done when there actually is a filter.

Task-number: QTCREATORBUG-22914
Change-Id: Ie96a4e20ebb10c08d83e75641e70b42b13377b22
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2019-09-30 09:57:40 +02:00
parent 24dd7be6db
commit 9c8400d961

View File

@@ -117,7 +117,10 @@ OutputWindow::OutputWindow(Context context, const QString &settingsKey, QWidget
connect(copyAction, &QAction::triggered, this, &QPlainTextEdit::copy); connect(copyAction, &QAction::triggered, this, &QPlainTextEdit::copy);
connect(pasteAction, &QAction::triggered, this, &QPlainTextEdit::paste); connect(pasteAction, &QAction::triggered, this, &QPlainTextEdit::paste);
connect(selectAllAction, &QAction::triggered, this, &QPlainTextEdit::selectAll); connect(selectAllAction, &QAction::triggered, this, &QPlainTextEdit::selectAll);
connect(this, &QPlainTextEdit::blockCountChanged, this, &OutputWindow::filterNewContent); connect(this, &QPlainTextEdit::blockCountChanged, this, [this] {
if (!d->filterText.isEmpty())
filterNewContent();
});
connect(this, &QPlainTextEdit::undoAvailable, undoAction, &QAction::setEnabled); connect(this, &QPlainTextEdit::undoAvailable, undoAction, &QAction::setEnabled);
connect(this, &QPlainTextEdit::redoAvailable, redoAction, &QAction::setEnabled); connect(this, &QPlainTextEdit::redoAvailable, redoAction, &QAction::setEnabled);