MCPcopy Index your code
hub / github.com/PyQt5/PyQt / doLayout

Method doLayout

QFlowLayout/Lib/flowlayout.py:131–155  ·  view source on GitHub ↗
(self, rect, testOnly)

Source from the content-addressed store, hash-verified

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

Callers 2

heightForWidthMethod · 0.95
setGeometryMethod · 0.95

Calls 6

yMethod · 0.80
setGeometryMethod · 0.80
xMethod · 0.45
widthMethod · 0.45
sizeHintMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected