From 895c0e98615a4579dca1746db63b061db25ef18c Mon Sep 17 00:00:00 2001 From: AlexandraTrifan Date: Thu, 17 Mar 2022 19:39:08 +0200 Subject: [PATCH] preferences: Fix preferences initialization at startup, don't rely on showEvent() to initialize them. Signed-off-by: Alexandra Trifan --- src/preferences.cpp | 7 ++++++- src/preferences.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/preferences.cpp b/src/preferences.cpp index a648d60c92..43ef94c1b3 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -320,6 +320,7 @@ Preferences::Preferences(QWidget *parent) : requestRestart(); }); pref_ptr = this; + initializePreferences(); } void Preferences::save() { @@ -403,7 +404,7 @@ void Preferences::notifyChange() Q_EMIT notify(); } -void Preferences::showEvent(QShowEvent *event) +void Preferences::initializePreferences() { setDynamicProperty(ui->sigGenNrPeriods, "invalid", false); @@ -452,7 +453,11 @@ void Preferences::showEvent(QShowEvent *event) ui->loggingUnavailableLabel->setVisible(true); m_logging_enabled = false; #endif +} +void Preferences::showEvent(QShowEvent *event) +{ + initializePreferences(); QWidget::showEvent(event); } diff --git a/src/preferences.h b/src/preferences.h index 79f145990b..65e534ff68 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -213,6 +213,7 @@ private Q_SLOTS: Preferences_API *pref_api; ScopyColorEditor *m_colorEditor; + void initializePreferences(); }; class Preferences_API : public ApiObject