(self, rect, testOnly)
| 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 | |
| 154 | if __name__ == '__main__': |
no test coverage detected