app.dark_mode => app.property('darkMode')
This commit is contained in:
parent
1a2728a671
commit
ae54e27ff6
@ -189,7 +189,7 @@ class PythonHighlighter(QSyntaxHighlighter):
|
||||
@property
|
||||
def styles(self):
|
||||
app = QtGui.QApplication.instance()
|
||||
return DARK_STYLES if app.dark_mode else LIGHT_STYLES
|
||||
return DARK_STYLES if app.property('darkMode') else LIGHT_STYLES
|
||||
|
||||
def highlightBlock(self, text):
|
||||
"""Apply syntax highlighting to the given block of text.
|
||||
@ -310,7 +310,7 @@ class ExampleLoader(QtGui.QMainWindow):
|
||||
self.ui.codeView.setCurrentCharFormat(f)
|
||||
# finally, override application automatic detection
|
||||
app = QtGui.QApplication.instance()
|
||||
app.dark_mode = True
|
||||
app.setProperty('darkMode', True)
|
||||
|
||||
def updateTheme(self):
|
||||
self.hl = PythonHighlighter(self.ui.codeView.document())
|
||||
|
@ -186,7 +186,7 @@ class PythonHighlighter(QSyntaxHighlighter):
|
||||
@property
|
||||
def styles(self):
|
||||
app = QtGui.QApplication.instance()
|
||||
return DARK_STYLES if app.dark_mode else LIGHT_STYLES
|
||||
return DARK_STYLES if app.property('darkMode') else LIGHT_STYLES
|
||||
|
||||
def highlightBlock(self, text):
|
||||
"""Apply syntax highlighting to the given block of text.
|
||||
|
@ -480,7 +480,7 @@ class App(QtGui.QApplication):
|
||||
else:
|
||||
# Qt5 has this as a str
|
||||
color = palette.base().color().name()
|
||||
self.dark_mode = color.lower() != "#ffffff"
|
||||
self.setProperty('darkMode', color.lower() != "#ffffff")
|
||||
|
||||
QAPP = None
|
||||
def mkQApp(name=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user