| 709 | } |
| 710 | |
| 711 | void ConfigWindow::populateComboBox() |
| 712 | { |
| 713 | bool oldInitialized = initialized; |
| 714 | int oldIndex = currentIndex(); |
| 715 | QStringList items; |
| 716 | for (auto sc : configs) { |
| 717 | items << sc->name(); |
| 718 | } |
| 719 | |
| 720 | initialized = false; |
| 721 | ui->config_comboBox->clear(); |
| 722 | ui->config_comboBox->addItems(items); |
| 723 | if (oldIndex >= 0 && oldIndex < configs.length()) { |
| 724 | setCurrentIndex(oldIndex); |
| 725 | } else { |
| 726 | // Index no longer valid, just go back to default solver |
| 727 | int i = 0; |
| 728 | for (auto config : configs) { |
| 729 | if (config->solverDefinition.isDefaultSolver) { |
| 730 | setCurrentIndex(i); |
| 731 | break; |
| 732 | } |
| 733 | i++; |
| 734 | } |
| 735 | } |
| 736 | emit itemsChanged(items); |
| 737 | initialized = oldInitialized; |
| 738 | } |
| 739 | |
| 740 | void ConfigWindow::removeConfig(int i) |
| 741 | { |