diff --git a/jlauncher/ui/main_window.py b/jlauncher/ui/main_window.py index f90049f..a39a4d1 100644 --- a/jlauncher/ui/main_window.py +++ b/jlauncher/ui/main_window.py @@ -175,6 +175,10 @@ class MainWindow(QMainWindow): app = QApplication.instance() if app is not None: theme.apply_theme(app, mode) + # Reconstruir las filas: los pills usan `palette(...)` en su stylesheet, que + # Qt cachea; recrearlos los re-resuelve contra la paleta ya aplicada. + for row in self.rows.values(): + row.refresh() def _configure_token(self) -> None: token, ok = QInputDialog.getText( diff --git a/jlauncher/ui/theme.py b/jlauncher/ui/theme.py index dc287fa..742fafb 100644 --- a/jlauncher/ui/theme.py +++ b/jlauncher/ui/theme.py @@ -120,6 +120,20 @@ def resolve_is_dark(app: QApplication, mode: str) -> bool: return system_is_dark(app) # THEME_SYSTEM (o valor desconocido) +def _repolish_all(app: QApplication) -> None: + """Re-poliza todos los widgets para que adopten la nueva paleta en caliente. + + ``setPalette`` por sí solo no repinta los widgets ya creados: los que tienen + stylesheet (pills) no re-resuelven ``palette(...)`` y algunos fondos base (la + consola de log) no se redibujan. unpolish→polish→update fuerza ese refresco. + """ + for widget in app.allWidgets(): + style = widget.style() + style.unpolish(widget) + style.polish(widget) + widget.update() + + def apply_theme(app: QApplication, mode: str = THEME_SYSTEM) -> None: """Aplica estilo Fusion + paleta clara/oscura según el modo elegido.""" app.setStyle("Fusion") @@ -127,6 +141,7 @@ def apply_theme(app: QApplication, mode: str = THEME_SYSTEM) -> None: app.setPalette(_dark_palette()) else: app.setPalette(app.style().standardPalette()) + _repolish_all(app) def watch_system_theme(app: QApplication, should_follow: Callable[[], bool]) -> None: