56 QRectF finalGeom = geom.intersected(QRectF(0, 0, 1, 1));
57 finalGeom.setWidth(std::max(finalGeom.width(),
minimumSize().width()));
58 finalGeom.setHeight(std::max(finalGeom.height(),
minimumSize().height()));
60 if (finalGeom.right() > 1 || finalGeom.bottom() > 1) {
67 m_geometryLock =
true;
72 tileGeom.setRight(finalGeom.left());
84 auto tileGeom = tile->relativeGeometry();
85 tileGeom.setBottom(finalGeom.top());
86 tile->setRelativeGeometry(tileGeom);
87 finalGeom.setTop(tile->relativeGeometry().bottom());
96 auto tileGeom = tile->relativeGeometry();
97 tileGeom.setLeft(finalGeom.right());
98 tile->setRelativeGeometry(tileGeom);
99 finalGeom.setRight(tile->relativeGeometry().left());
102 finalGeom.setRight(1);
108 auto tileGeom = tile->relativeGeometry();
109 tileGeom.setTop(finalGeom.bottom());
110 tile->setRelativeGeometry(tileGeom);
111 finalGeom.setBottom(tile->relativeGeometry().top());
114 finalGeom.setBottom(1);
117 m_geometryLock =
false;
119 finalGeom = geom.intersected(parentT->relativeGeometry());
125 for (
auto t : childrenT) {
126 auto childGeom = t->relativeGeometry();
127 childGeom = childGeom.intersected(finalGeom);
129 childGeom.setTop(finalGeom.top());
130 childGeom.setBottom(finalGeom.bottom());
132 childGeom.setLeft(finalGeom.left());
133 childGeom.setRight(finalGeom.right());
136 t->setRelativeGeometry(childGeom);
139 if (!childrenT.isEmpty()) {
140 auto childGeom = childrenT.first()->relativeGeometry();
142 childGeom.setLeft(finalGeom.left());
144 childGeom.setTop(finalGeom.top());
146 childrenT.first()->setRelativeGeometry(childGeom);
152 auto childGeom = childrenT.last()->relativeGeometry();
153 childGeom.setRight(finalGeom.right());
154 childGeom.setBottom(finalGeom.bottom());
155 childrenT.last()->setRelativeGeometry(childGeom);
160 Q_EMIT parentT->layoutModified();
162 m_geometryLock =
false;
179 if (parentT && (parentT->childCount() < 2 || parentT->layoutDirection() == newDirection)) {
185 newGeo.setLeft(std::max(newGeo.left(), parentT->relativeGeometry().left()));
186 newGeo.setTop(std::max(newGeo.top(), parentT->relativeGeometry().top()));
187 newGeo.setRight(std::min(newGeo.right(), parentT->relativeGeometry().right()));
188 newGeo.setBottom(std::min(newGeo.bottom(), parentT->relativeGeometry().bottom()));
193 newGeo.moveLeft(newGeo.x() + newGeo.width());
198 newGeo.moveTop(newGeo.y() + newGeo.height());
210 startGeom =
childTiles().last()->relativeGeometry();
212 newGeo = QRectF(startGeom.left() + 0.05, startGeom.top() + 0.05, 0.3, 0.25);
222 newGeo.moveLeft(newGeo.x() + newGeo.width());
228 newGeo.moveTop(newGeo.y() + newGeo.height());
259 parentT->removeChild(
this);
265 auto geom = prev->relativeGeometry();
267 prev->setRelativeGeometry(geom);
268 geom = next->relativeGeometry();
270 next->setRelativeGeometry(geom);
272 auto geom = prev->relativeGeometry();
274 prev->setRelativeGeometry(geom);
276 auto geom = next->relativeGeometry();
278 next->setRelativeGeometry(geom);
282 auto geom = prev->relativeGeometry();
284 prev->setRelativeGeometry(geom);
285 geom = next->relativeGeometry();
287 next->setRelativeGeometry(geom);
289 auto geom = prev->relativeGeometry();
291 prev->setRelativeGeometry(geom);
293 auto geom = next->relativeGeometry();
295 next->setRelativeGeometry(geom);
301 auto *lastTile =
static_cast<CustomTile *
>(parentT->childTile(0));
302 if (lastTile->childCount() == 0) {
319 Tile *sibling =
nullptr;
321 const int index =
row();
324 switch (parentT->layoutDirection()) {
326 layoutRows = std::max(1, parentT->childCount());
331 layoutColumns = std::max(1, parentT->childCount());
335 int row = index / layoutColumns;
336 int column = index % layoutColumns;
346 sibling = parentT->
childTiles()[layoutColumns * (
row - 1) + column];
350 if (column < layoutColumns - 1) {
355 if (
row < layoutRows - 1) {
356 const int newIndex = layoutColumns * (
row + 1) + column;