Esempio n. 1
0
 def setGeometry(self, r):
     QLayout.setGeometry(self, r)
     new_height = self._layoutChildren(r)
     if new_height != self._min_h:
         self._updateMinimumSize(new_height)
         i = 0
         wid = self.parentWidget()
         while wid is not None:
             wid.updateGeometry()
             wid = wid.parentWidget()
             i += 1
Esempio n. 2
0
def remove_trailing_spacer_from_layout(layout: QLayout):
    """
    If the last item in the layout is spacer, removes it.
    :param layout: target layout
    :return: bool success indicator
    """
    ni = layout.count()
    if ni < 1:
        return False
    ni -= 1
    layout_item = layout.itemAt(ni)
    if layout_item is None:
        return False
    spacer_item = layout_item.spacerItem()
    if spacer_item is not None:
        layout.removeItem(spacer_item)
        return True
    return False
Esempio n. 3
0
def fix_layout(layout: QLayout) -> None:
    layout.setContentsMargins(0, 0, 0, 0)
    layout.setSpacing(0)
Esempio n. 4
0
 def __init__(self, parent=None):
     QLayout.__init__(self, parent)
     self._items = []
     self._updateMinimumSize()
Esempio n. 5
0
 def add_buttons_to_layout(self, layout: QLayout) -> None:
     for button in self.buttons:
         layout.addWidget(button)