LogWidget: Stop update timer when log window is invisible so it doesn't continuously update in the background

This commit is contained in:
Silent 2019-08-31 00:09:47 +02:00
parent 7cec8601f1
commit e746d95d01
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1

View File

@ -46,7 +46,12 @@ LogWidget::LogWidget(QWidget* parent) : QDockWidget(parent), m_timer(new QTimer(
ConnectWidgets();
connect(m_timer, &QTimer::timeout, this, &LogWidget::UpdateLog);
m_timer->start(UPDATE_LOG_DELAY);
connect(this, &QDockWidget::visibilityChanged, [this](bool visible) {
if (visible)
m_timer->start(UPDATE_LOG_DELAY);
else
m_timer->stop();
});
connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &LogWidget::UpdateFont);