1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(settings): block signals during initialization

Prevents unexpected writes to settings during object creation, which can potentially mess up various settings values.
This commit is contained in:
Nils Fenner 2016-07-14 11:27:14 +02:00
parent c9dbfa5eac
commit de438f1c23
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C

View File

@ -34,6 +34,9 @@
SettingsWidget::SettingsWidget(QWidget* parent) SettingsWidget::SettingsWidget(QWidget* parent)
: QWidget(parent, Qt::Window) : QWidget(parent, Qt::Window)
{ {
// block all signals during initialization, including child widgets
blockSignals(true);
body = new QWidget(); body = new QWidget();
QVBoxLayout* bodyLayout = new QVBoxLayout(); QVBoxLayout* bodyLayout = new QVBoxLayout();
body->setLayout(bodyLayout); body->setLayout(bodyLayout);
@ -70,6 +73,8 @@ SettingsWidget::SettingsWidget(QWidget* parent)
connect(settingsWidgets, &QTabWidget::currentChanged, this, &SettingsWidget::onTabChanged); connect(settingsWidgets, &QTabWidget::currentChanged, this, &SettingsWidget::onTabChanged);
Translator::registerHandler(std::bind(&SettingsWidget::retranslateUi, this), this); Translator::registerHandler(std::bind(&SettingsWidget::retranslateUi, this), this);
blockSignals(false);
} }
SettingsWidget::~SettingsWidget() SettingsWidget::~SettingsWidget()