MCPcopy Create free account
hub / github.com/YACReader/yacreader / populateCombo

Method populateCombo

common/themes/appearance_tab_widget.cpp:221–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221void 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
247void AppearanceTabWidget::repopulateCombos()
248{

Callers

nothing calls this directly

Calls 5

availableThemesMethod · 0.80
addItemMethod · 0.80
toStringMethod · 0.80
clearMethod · 0.45
setCurrentIndexMethod · 0.45

Tested by

no test coverage detected