Fix theme update for search widget
This commit is contained in:
@@ -35,12 +35,12 @@ from PyQt6.QtWidgets import (
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import checkInt, cssCol, qtAddAction
|
||||
from novelwriter.common import checkInt, qtAddAction
|
||||
from novelwriter.core.coretools import DocSearch
|
||||
from novelwriter.core.item import NWItem
|
||||
from novelwriter.types import (
|
||||
QtAlignMiddle, QtAlignRight, QtHeaderStretch, QtHeaderToContents,
|
||||
QtUserRole
|
||||
QtHexArgb, QtUserRole
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -71,6 +71,9 @@ class GuiProjectSearch(QWidget):
|
||||
self._blocked = False
|
||||
self._map: dict[str, tuple[int, float]] = {}
|
||||
|
||||
self.setBackgroundRole(QPalette.ColorRole.Base)
|
||||
self.setAutoFillBackground(True)
|
||||
|
||||
# Header
|
||||
self.viewLabel = QLabel(self.tr("Project Search"), self)
|
||||
self.viewLabel.setFont(SHARED.theme.guiFontB)
|
||||
@@ -138,7 +141,6 @@ class GuiProjectSearch(QWidget):
|
||||
self.outerBox.setContentsMargins(0, 0, 0, 0)
|
||||
self.outerBox.setSpacing(2)
|
||||
|
||||
self.setAutoFillBackground(True)
|
||||
self.setLayout(self.outerBox)
|
||||
self.updateTheme()
|
||||
|
||||
@@ -152,12 +154,9 @@ class GuiProjectSearch(QWidget):
|
||||
|
||||
def updateTheme(self) -> None:
|
||||
"""Update theme elements."""
|
||||
|
||||
qPalette = self.palette()
|
||||
colBase = cssCol(qPalette.base().color())
|
||||
colFocus = cssCol(qPalette.highlight().color())
|
||||
qPalette.setBrush(QPalette.ColorRole.Window, qPalette.base())
|
||||
self.setPalette(qPalette)
|
||||
palette = QApplication.palette()
|
||||
colBase = palette.base().color().name(QtHexArgb)
|
||||
colFocus = palette.highlight().color().name(QtHexArgb)
|
||||
|
||||
self.setStyleSheet(
|
||||
"QToolBar {padding: 0; background: none;} "
|
||||
|
||||
@@ -70,6 +70,7 @@ QtSelected = QStyle.StateFlag.State_Selected
|
||||
# Qt Colour Types
|
||||
|
||||
QtHexRgb = QColor.NameFormat.HexRgb
|
||||
QtHexArgb = QColor.NameFormat.HexArgb
|
||||
|
||||
# Qt Tree and Table Types
|
||||
|
||||
|
||||
Reference in New Issue
Block a user