Return (or create) a headless QApplication. Only sets QT_QPA_PLATFORM=offscreen when there is no existing app — never when called from inside a running GUI, because that would corrupt the parent's environment and cause all subsequent subprocesses to be invisible.
()
| 23 | # ── Qt bootstrap ───────────────────────────────────────────────────────────── |
| 24 | |
| 25 | def _qt_app(): |
| 26 | """Return (or create) a headless QApplication. |
| 27 | |
| 28 | Only sets QT_QPA_PLATFORM=offscreen when there is no existing app — never |
| 29 | when called from inside a running GUI, because that would corrupt the |
| 30 | parent's environment and cause all subsequent subprocesses to be invisible. |
| 31 | """ |
| 32 | from PySide6.QtWidgets import QApplication |
| 33 | if QApplication.instance() is None: |
| 34 | os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") |
| 35 | return QApplication.instance() or QApplication(sys.argv[:1]) |
| 36 | |
| 37 | |
| 38 | # ── shared scene loader ─────────────────────────────────────────────────────── |
no outgoing calls
no test coverage detected