From 3114d3b23d2cdf533b898b149aaaf278555e0441 Mon Sep 17 00:00:00 2001 From: momen Date: Sat, 20 Sep 2025 23:14:47 +0800 Subject: [PATCH] =?UTF-8?q?upadte:=E5=AE=8C=E6=88=90=E5=8B=BE=E9=80=89?= =?UTF-8?q?=E6=B2=99=E7=AE=B1=E5=BC=80=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/settingspage.cpp | 14 ++++++++++++++ src/pages/settingspage.h | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/pages/settingspage.cpp b/src/pages/settingspage.cpp index c380ea6..467cab5 100644 --- a/src/pages/settingspage.cpp +++ b/src/pages/settingspage.cpp @@ -98,8 +98,14 @@ void SettingsPage::initConfig() } configCanSave = true; //  防止触发保存配置信号 + // 在现有代码后添加初始化checkBox_disableSandbox的状态 needUncompatibleNotification = config.value("other/uncompatibleNotification", needUncompatibleNotification).toBool(); ui->checkBox->setChecked(needUncompatibleNotification); + + // 新增:从config.ini读取webengine/noSandbox配置并设置复选框状态 + bool disableSandbox = config.value("webengine/noSandbox", false).toBool(); + ui->checkBox_disableSandbox->setChecked(disableSandbox); + } SettingsPage::~SettingsPage() @@ -261,3 +267,11 @@ void SettingsPage::on_checkBox_clicked(bool checked) config.setValue("other/uncompatibleNotification", needUncompatibleNotification); config.sync(); } + +// 添加checkBox_disableSandbox的点击事件处理函数 +void SettingsPage::on_checkBox_disableSandbox_clicked(bool checked) +{ + QSettings config(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/config.ini", QSettings::IniFormat); + config.setValue("webengine/noSandbox", checked); + config.sync(); +} \ No newline at end of file diff --git a/src/pages/settingspage.h b/src/pages/settingspage.h index 6a82a65..7778d16 100644 --- a/src/pages/settingspage.h +++ b/src/pages/settingspage.h @@ -32,6 +32,8 @@ private slots: void on_checkBox_clicked(bool checked); + void on_checkBox_disableSandbox_clicked(bool checked); + public: static bool needUncompatibleNotification; @@ -47,4 +49,4 @@ signals: void openUrl(QUrl spk); }; -#endif // SETTINGSPAGE_H +#endif // SETTINGSPAGE_H \ No newline at end of file