fix: project options dialog not correctly inited.
This commit is contained in:
parent
3ae25776b6
commit
c17fd21b1c
|
@ -122,7 +122,9 @@ void ProjectCompilerWidget::on_cbCompilerSet_currentIndexChanged(int index)
|
|||
{
|
||||
std::shared_ptr<Project> project = pMainWindow->project();
|
||||
auto action = finally([this]{
|
||||
this->refreshOptions();
|
||||
disconnectInputs();
|
||||
refreshOptions();
|
||||
connectInputs();
|
||||
});
|
||||
if (!mInitialized || index==project->options().compilerSet) {
|
||||
return;
|
||||
|
|
|
@ -34,13 +34,6 @@ ProjectFilesWidget::~ProjectFilesWidget()
|
|||
|
||||
void ProjectFilesWidget::doLoad()
|
||||
{
|
||||
std::shared_ptr<Project> project = pMainWindow->project();
|
||||
if (!project)
|
||||
return;
|
||||
copyUnits();
|
||||
QItemSelectionModel *m=ui->treeProject->selectionModel();
|
||||
ui->treeProject->setModel(project->model());
|
||||
delete m;
|
||||
ui->treeProject->expandAll();
|
||||
ui->grpFileOptions->setEnabled(false);
|
||||
}
|
||||
|
@ -251,20 +244,25 @@ void ProjectFilesWidget::on_treeProject_clicked(const QModelIndex &index)
|
|||
|
||||
void ProjectFilesWidget::init()
|
||||
{
|
||||
std::shared_ptr<Project> project = pMainWindow->project();
|
||||
ui->spinPriority->setMinimum(0);
|
||||
ui->spinPriority->setMaximum(9999);
|
||||
ui->cbEncodingDetail->setVisible(false);
|
||||
ui->cbEncoding->clear();
|
||||
if (pMainWindow->project()->options().encoding==ENCODING_SYSTEM_DEFAULT) {
|
||||
if (project->options().encoding==ENCODING_SYSTEM_DEFAULT) {
|
||||
ui->cbEncoding->addItem(tr("Project(%1)").arg(tr("ANSI"),ENCODING_PROJECT));
|
||||
} else {
|
||||
ui->cbEncoding->addItem(tr("Project(%1)").arg(QString(pMainWindow->project()->options().encoding)),ENCODING_PROJECT);
|
||||
ui->cbEncoding->addItem(tr("Project(%1)").arg(QString(project->options().encoding)),ENCODING_PROJECT);
|
||||
}
|
||||
ui->cbEncoding->addItem(tr("ANSI"),ENCODING_SYSTEM_DEFAULT);
|
||||
ui->cbEncoding->addItem(tr("UTF-8"),ENCODING_UTF8);
|
||||
foreach (const QString& langName, pCharsetInfoManager->languageNames()) {
|
||||
ui->cbEncoding->addItem(langName,langName);
|
||||
}
|
||||
copyUnits();
|
||||
QItemSelectionModel *m=ui->treeProject->selectionModel();
|
||||
ui->treeProject->setModel(project->model());
|
||||
delete m;
|
||||
SettingsWidget::init();
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,6 @@ void SettingsWidget::connectInputs()
|
|||
for (QGroupBox* p: findChildren<QGroupBox*>()) {
|
||||
connect(p, &QGroupBox::toggled,this, &SettingsWidget::setSettingsChanged);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SettingsWidget::disconnectInputs()
|
||||
|
|
Loading…
Reference in New Issue