Allow fallback values for appearance preferences

This commit is contained in:
Veronica Berglyd Olsen
2024-03-12 22:02:23 +01:00
parent 7d9040005e
commit 6e2c5be14e
2 changed files with 9 additions and 6 deletions
+6
View File
@@ -44,6 +44,12 @@ class NComboBox(QComboBox):
event.ignore()
return
def setCurrentData(self, data: str, default: str) -> None:
"""Set the current index from data, with a fallback."""
idx = self.findData(data)
self.setCurrentIndex(self.findData(default) if idx < 0 else idx)
return
# END Class NComboBox