diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 627b59f3fe..d5815ac7e2 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -489,7 +489,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags ui->lineEdit->setMaxLength(16 * 1024 * 1024); ui->messagesWidget->installEventFilter(this); - connect(ui->clearButton, &QPushButton::clicked, this, &RPCConsole::clear); + connect(ui->clearButton, &QPushButton::clicked, [this] { clear(); }); connect(ui->fontBiggerButton, &QPushButton::clicked, this, &RPCConsole::fontBigger); connect(ui->fontSmallerButton, &QPushButton::clicked, this, &RPCConsole::fontSmaller); connect(ui->btnClearTrafficGraph, &QPushButton::clicked, ui->trafficGraph, &TrafficGraphWidget::clear); @@ -822,7 +822,7 @@ void RPCConsole::setFontSize(int newSize) // clear console (reset icon sizes, default stylesheet) and re-add the content float oldPosFactor = 1.0 / ui->messagesWidget->verticalScrollBar()->maximum() * ui->messagesWidget->verticalScrollBar()->value(); - clear(false); + clear(/* keep_prompt */ true); ui->messagesWidget->setHtml(str); ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor * ui->messagesWidget->verticalScrollBar()->maximum()); } @@ -873,15 +873,10 @@ void RPCConsole::buildParameterlist(QString arg) Q_EMIT handleRestart(args); } -void RPCConsole::clear(bool clearHistory) +void RPCConsole::clear(bool keep_prompt) { ui->messagesWidget->clear(); - if(clearHistory) - { - history.clear(); - historyPtr = 0; - } - ui->lineEdit->clear(); + if (!keep_prompt) ui->lineEdit->clear(); ui->lineEdit->setFocus(); // Set default style sheet diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index b3d753e202..5549d30b70 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -103,7 +103,7 @@ private Q_SLOTS: void updateDetailWidget(); public Q_SLOTS: - void clear(bool clearHistory = true); + void clear(bool keep_prompt = false); void fontBigger(); void fontSmaller(); void setFontSize(int newSize);