def setGeometry(self, rect): QLayout.setGeometry(self, rect) if self.isEmpty(): return self.__data.numColumns = self.columnsForWidth(rect.width()) self.__data.numRows = self.itemCount() / self.__data.numColumns if self.itemCount() % self.__data.numColumns: self.__data.numRows += 1 itemGeometries = self.layoutItems(rect, self.__data.numColumns) for it, geo in zip(self.__data.itemList, itemGeometries): it.setGeometry(geo)
def setGeometry(self, rect): QLayout.setGeometry(self, rect) if self.isEmpty(): return self.__data.numColumns = self.columnsForWidth(rect.width()) self.__data.numRows = self.itemCount()/self.__data.numColumns if self.itemCount() % self.__data.numColumns: self.__data.numRows += 1 itemGeometries = self.layoutItems(rect, self.__data.numColumns) for it, geo in zip(self.__data.itemList, itemGeometries): it.setGeometry(geo)
def setGeometry(self, rect): """ Reorganizes columns and rows and resizes managed items within a rectangle. """ QLayout.setGeometry(self, rect) if self.isEmpty(): return self.__data.numColumns = self.columnsForWidth(rect.width()) self.__data.numRows = self.itemCount()/self.__data.numColumns if self.itemCount() % self.__data.numColumns: self.__data.numRows += 1 itemGeometries = self.layoutItems(rect, self.__data.numColumns) for it, geo in zip(self.__data.itemList, itemGeometries): it.setGeometry(geo)
def __init__(self, *args): self.__data = None parent = None margin = 0 spacing = -1 if len(args) in (2, 3): parent, margin = args[:2] if len(args) == 3: spacing = args[-1] elif len(args) == 1: if isinstance(args[0], int): spacing, = args else: parent, = args elif len(args) != 0: raise TypeError("%s() takes 0, 1, 2 or 3 argument(s) (%s given)"\ % (self.__class__.__name__, len(args))) QLayout.__init__(self, parent) self.__data = QwtDynGridLayout_PrivateData() self.setSpacing(spacing) self.setContentsMargins(margin, margin, margin, margin)
def invalidate(self): """Invalidate all internal caches""" self.__data.isDirty = True QLayout.invalidate(self)
def invalidate(self): self.__data.isDirty = True QLayout.invalidate(self)