frontend-tools: Add "Clear" button to script log window
This commit is contained in:
parent
b1e6af319c
commit
00e7a84050
@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
#include <QHBoxLayout>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
@ -87,13 +89,21 @@ ScriptLogWindow::ScriptLogWindow() : QWidget(nullptr)
|
|||||||
edit->setFont(fixedFont);
|
edit->setFont(fixedFont);
|
||||||
edit->setWordWrapMode(QTextOption::NoWrap);
|
edit->setWordWrapMode(QTextOption::NoWrap);
|
||||||
|
|
||||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(
|
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
||||||
QDialogButtonBox::Close);
|
QPushButton *clearButton = new QPushButton(tr("Clear"));
|
||||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QWidget::hide);
|
connect(clearButton, &QPushButton::clicked,
|
||||||
|
this, &ScriptLogWindow::ClearWindow);
|
||||||
|
QPushButton *closeButton = new QPushButton(tr("Close"));
|
||||||
|
connect(closeButton, &QPushButton::clicked,
|
||||||
|
this, &QDialog::hide);
|
||||||
|
|
||||||
|
buttonLayout->addStretch();
|
||||||
|
buttonLayout->addWidget(clearButton);
|
||||||
|
buttonLayout->addWidget(closeButton);
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout();
|
QVBoxLayout *layout = new QVBoxLayout();
|
||||||
layout->addWidget(edit);
|
layout->addWidget(edit);
|
||||||
layout->addWidget(buttonBox);
|
layout->addLayout(buttonLayout);
|
||||||
|
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
scriptLogWidget = edit;
|
scriptLogWidget = edit;
|
||||||
@ -156,6 +166,12 @@ void ScriptLogWindow::AddLogMsg(int log_level, QString msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptLogWindow::ClearWindow()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
scriptLogWidget->setPlainText(QString());
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptLogWindow::Clear()
|
void ScriptLogWindow::Clear()
|
||||||
{
|
{
|
||||||
lines.clear();
|
lines.clear();
|
||||||
|
@ -17,6 +17,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void AddLogMsg(int log_level, QString msg);
|
void AddLogMsg(int log_level, QString msg);
|
||||||
|
void ClearWindow();
|
||||||
void Clear();
|
void Clear();
|
||||||
void ScrollChanged(int val);
|
void ScrollChanged(int val);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user