From 5467515ffce8dc8ea222f38303c2faf00dc34812 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 21:01:48 +0000 Subject: [PATCH] Fix slow startup in qt_editor caused by QFontDatabase in background thread Removed the Qt Font Database enrichment loop from AsyncFontLoader. Calling QFontDatabase().styles(family) for every installed font caused a massive performance bottleneck on startup, and executing GUI-related calls from a background QThread can cause lock contention and hanging issues in Qt. Co-authored-by: rayvy <29858688+rayvy@users.noreply.github.com> --- qt_editor/widgets/configurator.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/qt_editor/widgets/configurator.py b/qt_editor/widgets/configurator.py index cc9a6db..b36ae10 100644 --- a/qt_editor/widgets/configurator.py +++ b/qt_editor/widgets/configurator.py @@ -32,25 +32,6 @@ def run(self): reset_registry() # Ensure fresh scan (handles addon reloads) registry = build_font_registry() - # --- Variable Font Support (Qt Enrichment) --- - # For each family, ask Qt if there are styles we missed (e.g. named instances in variable fonts) - try: - db = QtGui.QFontDatabase() - for family in list(registry.keys()): - styles = registry[family] - if "Regular" not in styles: - continue - - path, index = styles["Regular"] - # Ask Qt for styles of this specific family - available_styles = db.styles(family) - for s in available_styles: - if s not in styles: - # Map the new style to the same file (Variable Font behavior) - styles[s] = (path, index) - except Exception as e: - print(f"[FontsDebug] Qt Enrichment failed: {e}") - AsyncFontLoader._cache = registry self.fonts_loaded.emit(registry) except Exception as e: