from PySide6.QtWidgets import QWidget, QHBoxLayout class HBox(QWidget): def __init__(self, *widgets: QWidget): super(HBox, self).__init__() self.layout = QHBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) for widget in widgets: self.layout.addWidget(widget) def addWidget(self, widget: QWidget): self.layout.addWidget(widget)