mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
fix(toolbar): widget action added
This commit is contained in:
@ -142,6 +142,31 @@ class DeviceSelectionAction(ToolBarAction):
|
|||||||
self.device_combobox.setStyleSheet(f"QComboBox {{ background-color: {color}; }}")
|
self.device_combobox.setStyleSheet(f"QComboBox {{ background-color: {color}; }}")
|
||||||
|
|
||||||
|
|
||||||
|
class WidgetAction(ToolBarAction):
|
||||||
|
"""
|
||||||
|
Action for adding any widget to the toolbar.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
label (str|None): The label for the widget.
|
||||||
|
widget (QWidget): The widget to be added to the toolbar.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, label: str | None = None, widget: QWidget = None):
|
||||||
|
super().__init__()
|
||||||
|
self.label = label
|
||||||
|
self.widget = widget
|
||||||
|
|
||||||
|
def add_to_toolbar(self, toolbar, target):
|
||||||
|
widget = QWidget()
|
||||||
|
layout = QHBoxLayout(widget)
|
||||||
|
if self.label is not None:
|
||||||
|
label = QLabel(f"{self.label}")
|
||||||
|
layout.addWidget(label)
|
||||||
|
layout.addWidget(self.widget)
|
||||||
|
toolbar.addWidget(widget)
|
||||||
|
|
||||||
|
|
||||||
class ExpandableMenuAction(ToolBarAction):
|
class ExpandableMenuAction(ToolBarAction):
|
||||||
"""
|
"""
|
||||||
Action for an expandable menu in the toolbar.
|
Action for an expandable menu in the toolbar.
|
||||||
|
Reference in New Issue
Block a user