0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

fix(theme): fixed segfault for webengineview for auto updates

This commit is contained in:
2024-09-02 17:59:55 +02:00
parent 158c19eda7
commit 9866075100

View File

@ -1,5 +1,6 @@
from __future__ import annotations
import darkdetect
from qtpy.QtCore import Slot
from qtpy.QtWidgets import QApplication, QWidget
@ -45,7 +46,12 @@ class BECWidget(BECConnector):
# Set the theme to auto if it is not set yet
app = QApplication.instance()
if not hasattr(app, "theme"):
set_theme("auto")
# DO NOT SET THE THEME TO AUTO! Otherwise, the qwebengineview will segfault
# Instead, we will set the theme to the system setting on startup
if darkdetect.isDark():
set_theme("dark")
else:
set_theme("light")
if theme_update:
self._connect_to_theme_change()