[Gui] Preferences - Selection Fix Bug for new...

... users who save an unrelated Preference such as Stylesheet from loosing the default selection settings.
See discussion : https://forum.freecadweb.org/viewtopic.php?f=3&t=58215
This commit is contained in:
Syres916
2021-05-01 11:58:46 +01:00
committed by GitHub
parent ccc4151b30
commit 1d288980ae

View File

@@ -58,6 +58,29 @@ void DlgSettingsSelection::saveSettings()
void DlgSettingsSelection::loadSettings()
{
auto handle = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/TreeView");
// Stop new users loosing a number of default settings when changing an unrelated Preference Setting
bool treePreSelectionFalse = handle->GetBool("PreSelection", false);
bool treePreSelectionTrue = handle->GetBool("PreSelection", true);
bool treeRecordSelectionFalse = handle->GetBool("RecordSelection", false);
bool treeRecordSelectionTrue = handle->GetBool("RecordSelection", true);
bool treeSyncSelectionFalse = handle->GetBool("SyncSelection", false);
bool treeSyncSelectionTrue = handle->GetBool("SyncSelection", true);
bool treeSyncViewFalse = handle->GetBool("SyncView", false);
bool treeSyncViewTrue = handle->GetBool("SyncView", true);
if (treePreSelectionFalse != treePreSelectionTrue) {
handle->SetBool("PreSelection", true);
}
if (treeRecordSelectionFalse != treeRecordSelectionTrue) {
handle->SetBool("RecordSelection", true);
}
if (treeSyncSelectionFalse != treeSyncSelectionTrue) {
handle->SetBool("SyncSelection", true);
}
if (treeSyncViewFalse != treeSyncViewTrue) {
handle->SetBool("SyncView", true);
}
ui->checkBoxAutoSwitch->setChecked(handle->GetBool("SyncView"));
ui->checkBoxAutoExpand->setChecked(handle->GetBool("SyncSelection"));
ui->checkBoxPreselect->setChecked(handle->GetBool("PreSelection"));