新增配置索引默认新增到最后一个

This commit is contained in:
yangjiaxuan 2023-07-04 16:37:06 +08:00
parent 497f248c43
commit 6cee54f1b0
1 changed files with 3 additions and 2 deletions

View File

@ -2896,6 +2896,7 @@ void hg_settingdialog::slot_pushButton_scheme_management(void)
{
int id = 0;
QString text(find_current_scheme_menu(&id));
int index = comb_->count();
if(!text.isEmpty() && id >= 0)
{
Dialog_Input dlg(this);
@ -2915,7 +2916,7 @@ void hg_settingdialog::slot_pushButton_scheme_management(void)
}
disconnect(comb_, SIGNAL(currentTextChanged(const QString)), this, SLOT(on_current_scheme_changed()));
comb_->insertItem(id + 1, newCfgName);
comb_->insertItem(index, newCfgName);
connect(comb_, SIGNAL(currentTextChanged(const QString)), this, SLOT(on_current_scheme_changed()));
gb::sane_config_schm *scheme = cur_scheme_->copy();
@ -2929,7 +2930,7 @@ void hg_settingdialog::slot_pushButton_scheme_management(void)
cur_cfg_->select_scheme(cur_scheme_->get_scheme_name().c_str());
cur_cfg_->save();
disconnect(comb_, SIGNAL(currentTextChanged(const QString)), this, SLOT(on_current_scheme_changed()));
comb_->setCurrentIndex(id + 1);
comb_->setCurrentIndex(index);
connect(comb_, SIGNAL(currentTextChanged(const QString)), this, SLOT(on_current_scheme_changed()));
changed_count_++;