Update icons in the GUI
This commit is contained in:
@@ -164,18 +164,21 @@ class NDoubleSpinBox(QDoubleSpinBox):
|
||||
|
||||
class NIconToolButton(QToolButton):
|
||||
|
||||
def __init__(self, parent: QWidget, iconSize: QSize, icon: str | None = None) -> None:
|
||||
def __init__(
|
||||
self, parent: QWidget, iconSize: QSize,
|
||||
icon: str | None = None, color: str | None = None
|
||||
) -> None:
|
||||
super().__init__(parent=parent)
|
||||
self.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly)
|
||||
self.setIconSize(iconSize)
|
||||
self.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
|
||||
if icon:
|
||||
self.setThemeIcon(icon)
|
||||
self.setThemeIcon(icon, color)
|
||||
return
|
||||
|
||||
def setThemeIcon(self, iconKey: str) -> None:
|
||||
def setThemeIcon(self, iconKey: str, color: str | None = None) -> None:
|
||||
"""Set an icon from the current theme."""
|
||||
self.setIcon(SHARED.theme.getIcon(iconKey))
|
||||
self.setIcon(SHARED.theme.getIcon(iconKey, color))
|
||||
return
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user