Another place that should react to palette changes

This commit is contained in:
Kovid Goyal 2019-10-22 23:34:06 +05:30
parent a5493fd287
commit 4509900b32
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -46,6 +46,12 @@ class TOCView(QTreeView):
self.setMinimumWidth(80)
self.header().close()
self.setMouseTracking(True)
self.set_style_sheet()
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.context_menu)
QApplication.instance().palette_changed.connect(self.set_style_sheet, type=Qt.QueuedConnection)
def set_style_sheet(self):
self.setStyleSheet('''
QTreeView {
background-color: palette(window);
@ -66,8 +72,6 @@ class TOCView(QTreeView):
border-radius: 6px;
}
''')
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.context_menu)
def mouseMoveEvent(self, ev):
if self.indexAt(ev.pos()).isValid():