forked from qt-creator/qt-creator
LanguageClient: Add "Clear" button to LSP inspector
It's helpful to be able to watch new messages from a certain point onwards, and not be distracted by older ones. Change-Id: I0506dad24d4b970652117d7e704ebfb4b49cad74 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <QLabel>
|
||||
#include <QListWidget>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QPushButton>
|
||||
#include <QSplitter>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTextCodec>
|
||||
@@ -427,6 +428,11 @@ LspInspectorWidget::LspInspectorWidget(LspInspector *inspector)
|
||||
|
||||
auto buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Close);
|
||||
const auto clearButton = buttonBox->addButton(tr("Clear"), QDialogButtonBox::ResetRole);
|
||||
connect(clearButton, &QPushButton::clicked, this, [this] {
|
||||
m_inspector->clear();
|
||||
currentClientChanged(m_clients->currentItem()->text());
|
||||
});
|
||||
mainLayout->addWidget(buttonBox);
|
||||
setLayout(mainLayout);
|
||||
|
||||
|
@@ -85,6 +85,7 @@ public:
|
||||
std::list<LspLogMessage> messages(const QString &clientName) const;
|
||||
Capabilities capabilities(const QString &clientName) const;
|
||||
QList<QString> clients() const;
|
||||
void clear() { m_logs.clear(); }
|
||||
|
||||
signals:
|
||||
void newMessage(const QString &clientName, const LspLogMessage &message);
|
||||
|
Reference in New Issue
Block a user