From c3bcb70d875c35534f44c2395cbde08cfb9a0ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Fri, 6 Nov 2020 11:43:22 +0100 Subject: [PATCH] Limit number of saved lines in devicelog --- Software/PC_Application/Device/devicelog.cpp | 12 +++++ Software/PC_Application/Device/devicelog.ui | 46 ++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/Software/PC_Application/Device/devicelog.cpp b/Software/PC_Application/Device/devicelog.cpp index 297e2e2..660f494 100644 --- a/Software/PC_Application/Device/devicelog.cpp +++ b/Software/PC_Application/Device/devicelog.cpp @@ -12,6 +12,18 @@ DeviceLog::DeviceLog(QWidget *parent) : { ui->setupUi(this); connect(ui->bClear, &QPushButton::clicked, this, &DeviceLog::clear); + connect(ui->limitLines, &QCheckBox::toggled, [=](bool enabled){ + if(enabled) { + ui->text->setMaximumBlockCount(ui->numLines->value()); + ui->numLines->setEnabled(true); + } else { + ui->text->setMaximumBlockCount(0); + ui->numLines->setEnabled(false); + } + }); + connect(ui->numLines, qOverload(&QSpinBox::valueChanged), [=](int lines) { + ui->text->setMaximumBlockCount(lines); + }); } DeviceLog::~DeviceLog() diff --git a/Software/PC_Application/Device/devicelog.ui b/Software/PC_Application/Device/devicelog.ui index 7737120..567bb6d 100644 --- a/Software/PC_Application/Device/devicelog.ui +++ b/Software/PC_Application/Device/devicelog.ui @@ -6,14 +6,14 @@ 0 0 - 810 - 211 + 929 + 253 Form - + @@ -55,6 +55,46 @@ + + + + 2 + + + + + Only keep + + + true + + + + + + + 1 + + + 1000 + + + 100 + + + 200 + + + + + + + lines + + + + +