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:
@ -1,5 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import darkdetect
|
||||||
from qtpy.QtCore import Slot
|
from qtpy.QtCore import Slot
|
||||||
from qtpy.QtWidgets import QApplication, QWidget
|
from qtpy.QtWidgets import QApplication, QWidget
|
||||||
|
|
||||||
@ -45,7 +46,12 @@ class BECWidget(BECConnector):
|
|||||||
# Set the theme to auto if it is not set yet
|
# Set the theme to auto if it is not set yet
|
||||||
app = QApplication.instance()
|
app = QApplication.instance()
|
||||||
if not hasattr(app, "theme"):
|
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:
|
if theme_update:
|
||||||
self._connect_to_theme_change()
|
self._connect_to_theme_change()
|
||||||
|
Reference in New Issue
Block a user