Add theme update handling to manuscript build settings

This commit is contained in:
Veronica Berglyd Olsen
2025-10-26 02:04:03 +01:00
parent e492c6575d
commit 8b02c95f51
6 changed files with 114 additions and 42 deletions
+7 -5
View File
@@ -125,14 +125,16 @@ class NComboBox(QComboBox):
window of many widgets.
"""
def __init__(self, parent: QWidget | None = None, maxItems: int = 15) -> None:
def __init__(
self, parent: QWidget | None = None, maxItems: int = 15, scrollable: bool = True
) -> None:
super().__init__(parent=parent)
self.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
self.setMaxVisibleItems(maxItems)
# The style sheet disables Fusion style pop-up mode on some platforms
# and allows for scrolling of long lists of items
self.setStyleSheet("QComboBox {combobox-popup: 0;}")
if not scrollable:
# The style sheet disables Fusion style pop-up mode on some
# platforms and allows for scrolling of long lists of items
self.setStyleSheet("QComboBox {combobox-popup: 0;}")
def wheelEvent(self, event: QWheelEvent) -> None:
"""Only capture the mouse wheel if the widget has focus."""
+7
View File
@@ -72,6 +72,9 @@ class NPagedSideBar(QToolBar):
def setLabelColor(self, color: QColor) -> None:
"""Set the text color for the labels."""
self._labelCol = color
for widget in self.children():
if isinstance(widget, _NPagedToolLabel):
widget.setTextColor(color)
def addLabel(self, text: str) -> None:
"""Add a new label to the toolbar."""
@@ -188,6 +191,10 @@ class _NPagedToolLabel(QLabel):
self._textCol = textColor or self.palette().text().color()
def setTextColor(self, textColor: QColor | None = None) -> None:
"""Set a new text colour."""
self._textCol = textColor or self.palette().text().color()
def paintEvent(self, event: QPaintEvent) -> None:
"""Overload the paint event to draw a simple, left aligned text
label that matches the button style.