MCPcopy Create free account
hub / github.com/PyQt5/PyQtClient / doLayout

Method doLayout

Widgets/Layouts/FlowLayout.py:127–151  ·  view source on GitHub ↗
(self, rect, testOnly)

Source from the content-addressed store, hash-verified

125 return size
126
127 def doLayout(self, rect, testOnly):
128 x = rect.x()
129 y = rect.y()
130 lineHeight = 0
131
132 for item in self.itemList:
133 wid = item.widget()
134 spaceX = self.spacing() + wid.style().layoutSpacing(
135 QSizePolicy.PushButton, QSizePolicy.PushButton, Qt.Horizontal)
136 spaceY = self.spacing() + wid.style().layoutSpacing(
137 QSizePolicy.PushButton, QSizePolicy.PushButton, Qt.Vertical)
138 nextX = x + item.sizeHint().width() + spaceX
139 if nextX - spaceX > rect.right() and lineHeight > 0:
140 x = rect.x()
141 y = y + lineHeight + spaceY
142 nextX = x + item.sizeHint().width() + spaceX
143 lineHeight = 0
144
145 if not testOnly:
146 item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))
147
148 x = nextX
149 lineHeight = max(lineHeight, item.sizeHint().height())
150
151 return y + lineHeight - rect.y()
152
153
154if __name__ == '__main__':

Callers 2

heightForWidthMethod · 0.95
setGeometryMethod · 0.95

Calls 3

setGeometryMethod · 0.80
xMethod · 0.45
sizeHintMethod · 0.45

Tested by

no test coverage detected