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:
parent
c9dbfa5eac
commit
de438f1c23
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user