fix: options not reset after project compiler set changed

This commit is contained in:
Roy Qu 2024-04-05 21:11:26 +08:00
parent ccfb786f74
commit c53a4ba910
1 changed files with 4 additions and 4 deletions

View File

@ -41,9 +41,6 @@ void ProjectCompilerWidget::refreshOptions()
return; return;
ui->panelAddCharset->setVisible(pSet->compilerType()!=CompilerType::Clang); ui->panelAddCharset->setVisible(pSet->compilerType()!=CompilerType::Clang);
//ui->chkAddCharset->setEnabled(pSet->compilerType()!=COMPILER_CLANG); //ui->chkAddCharset->setEnabled(pSet->compilerType()!=COMPILER_CLANG);
mOptions = pMainWindow->project()->options().compilerOptions;
if (mOptions.isEmpty())
mOptions = pSet->compileOptions();
ui->tabOptions->resetUI(pSet,mOptions); ui->tabOptions->resetUI(pSet,mOptions);
@ -75,6 +72,9 @@ void ProjectCompilerWidget::refreshOptions()
void ProjectCompilerWidget::doLoad() void ProjectCompilerWidget::doLoad()
{ {
mOptions = pMainWindow->project()->options().compilerOptions; mOptions = pMainWindow->project()->options().compilerOptions;
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
if (mOptions.isEmpty() && pSet)
mOptions = pSet->compileOptions();
ui->cbCompilerSet->blockSignals(true); ui->cbCompilerSet->blockSignals(true);
ui->cbCompilerSet->setCurrentIndex(pMainWindow->project()->options().compilerSet); ui->cbCompilerSet->setCurrentIndex(pMainWindow->project()->options().compilerSet);
ui->cbCompilerSet->blockSignals(false); ui->cbCompilerSet->blockSignals(false);
@ -168,7 +168,7 @@ void ProjectCompilerWidget::on_cbCompilerSet_currentIndexChanged(int index)
ui->cbCompilerSet->setCurrentIndex(project->options().compilerSet); ui->cbCompilerSet->setCurrentIndex(project->options().compilerSet);
return; return;
} }
project->setCompilerSet(index); mOptions = pSet->compileOptions();
setSettingsChanged(); setSettingsChanged();
//project->saveOptions(); //project->saveOptions();
} }