| 219 | } |
| 220 | |
| 221 | void AppearanceTabWidget::populateCombo(QComboBox *combo, |
| 222 | std::optional<ThemeVariant> variantFilter, |
| 223 | const QString &selectedId) |
| 224 | { |
| 225 | QSignalBlocker blocker(combo); |
| 226 | combo->clear(); |
| 227 | if (!repository) |
| 228 | return; |
| 229 | |
| 230 | for (const auto &entry : repository->availableThemes()) { |
| 231 | if (variantFilter && entry.variant != *variantFilter) |
| 232 | continue; |
| 233 | combo->addItem(entry.displayName, entry.id); |
| 234 | } |
| 235 | |
| 236 | // Restore selection; fall back to first item if the saved ID is no longer present |
| 237 | for (int i = 0; i < combo->count(); ++i) { |
| 238 | if (combo->itemData(i).toString() == selectedId) { |
| 239 | combo->setCurrentIndex(i); |
| 240 | return; |
| 241 | } |
| 242 | } |
| 243 | if (combo->count() > 0) |
| 244 | combo->setCurrentIndex(0); |
| 245 | } |
| 246 | |
| 247 | void AppearanceTabWidget::repopulateCombos() |
| 248 | { |
nothing calls this directly
no test coverage detected