Fix clear focus on confgi

This commit is contained in:
dazedanon 2026-03-15 20:09:44 -05:00
parent 2e5420132c
commit b62ff73a13

View file

@ -639,6 +639,14 @@ class ConfigTab(QWidget):
f"Could not fetch models from the API:\n{error}"
)
def mousePressEvent(self, event):
"""Clear focus from any text/spin box when clicking on empty space,
which triggers editingFinished and therefore auto-save."""
focused = QApplication.focusWidget()
if focused and isinstance(focused, (QLineEdit, QSpinBox, QDoubleSpinBox)):
focused.clearFocus()
super().mousePressEvent(event)
def showEvent(self, event):
"""Reload values from .env every time this tab becomes visible."""
super().showEvent(event)