def addWidget(self, widget, group_name): if self._item_count > 0: self.addSeparator() container = LinkWidget(self.parent(), widget) layout = QVBoxLayout(container) layout.setDirection(self._panel_direction) layout.setContentsMargins(self._spacing, self._spacing, self._spacing, self._spacing) self.addLabel(layout, group_name) layout.addWidget(widget) container.setLayout(layout) group_alignment = self._group_alignment if self._group_alignment is not None else Qt.Alignment( 0) self._inner.addWidget(container, alignment=group_alignment) self._item_count += 1