Add theme update handling to manuscript build settings
This commit is contained in:
@@ -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."""
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user