Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/formbridge/widgets/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ class QtPlacementControl(QToolButton, metaclass=PyQtWidgetMeta):
sibling does; the family owns what the press does and how the control reads."""

def __init__(self, action: PlacementAction, layout: PlacementLayout,
identity: object, applied: Callable[[], None]) -> None:
super().__init__()
identity: object, applied: Callable[[], None],
parent: QWidget | None = None) -> None:
super().__init__(parent)
self.action = action
self._layout = layout
self._identity = identity
Expand Down Expand Up @@ -122,14 +123,15 @@ class SidebarPane(QWidget):

def __init__(self, layout: PlacementLayout, identity: object,
content: QWidget, owner: SidebarControlsOwner, *,
applied: Callable[[], None]) -> None:
super().__init__()
applied: Callable[[], None],
parent: QWidget | None = None) -> None:
super().__init__(parent)
self._layout = layout
self._identity = identity
self._owner = owner
self.content = content
self._controls = [
QtPlacementControl(action, layout, identity, applied)
QtPlacementControl(action, layout, identity, applied, parent=self)
for action in owner.placement_actions()
]
# The pane's layout is rebuilt on every present() because the edge may have changed.
Expand Down Expand Up @@ -200,8 +202,9 @@ class SidebarToggle(QWidget):

def __init__(self, layout: PlacementLayout, identity: object, *,
heading: Callable[[], str], shown: Callable[[], bool],
toggled: Callable[[], None]) -> None:
super().__init__()
toggled: Callable[[], None],
parent: QWidget | None = None) -> None:
super().__init__(parent)
self._layout = layout
self._identity = identity
self._heading = heading
Expand All @@ -211,8 +214,8 @@ def __init__(self, layout: PlacementLayout, identity: object, *,
row = QHBoxLayout(self)
row.setContentsMargins(4, 0, 4, 0)
row.setSpacing(4)
self._left = QLabel()
self._right = QLabel()
self._left = QLabel(self)
self._right = QLabel(self)
self._title = ElidedLine("")
self._title.setAlignment(Qt.AlignmentFlag.AlignCenter)
row.addWidget(self._left)
Expand Down
Loading