10#include <QtCore/qmath.h>
16#define LAYOUTITEMSIZE_MAX (1 << 24)
25 }
else if (delta < 0) {
34 return desired *
qPow(sumAvailable / sumDesired, desired / sumDesired);
44 Q_ASSERT(targetSize >= ascent + descent);
46 qreal extra = targetSize - (ascent + descent);
47 return descent + (extra / 2.0);
52 qreal size1 = box1.q_sizes(which);
53 qreal size2 = box2.q_sizes(which);
80 maxMax =
other.q_maximumSize;
101#ifdef QGRIDLAYOUTENGINE_DEBUG
102void QGridLayoutBox::dump(
int indent)
const
112 if (box1.q_sizes(
i) != box2.q_sizes(
i))
115 return box1.q_minimumDescent == box2.q_minimumDescent
116 && box1.q_minimumAscent == box2.q_minimumAscent;
133 int start =
i.key().first;
134 int span =
i.key().second;
137 int stretch =
i.value().q_stretch;
140 QVarLengthArray<QGridLayoutBox> extras(
span);
141 QVarLengthArray<qreal> dummy(
span);
142 QVarLengthArray<qreal> newSizes(
span);
148 nullptr,
totalBox, rowInfo, snapToPixelGrid);
150 for (
int k = 0; k <
span; ++k)
151 extras[k].q_sizes(
j) = newSizes[k];
155 for (
int k = 0; k <
span; ++k) {
168 return std::floor(
f +
qreal(0.5));
182 QVarLengthArray<qreal> newSizes(
n);
183 QVarLengthArray<qreal> factors(
n);
184 qreal sumFactors = 0.0;
185 int sumStretches = 0;
188 for (
int i = 0;
i <
n; ++
i) {
191 sumStretches += stretch;
198 if (sumAvailable > 0.0) {
202 for (
int i = 0;
i <
n; ++
i) {
210 qreal desired = box_preferredSize -
box.q_minimumSize;
212 sumFactors += factors[
i];
215 for (
int i = 0;
i <
n; ++
i) {
217 qreal delta = sumAvailable * factors[
i] / sumFactors;
218 newSizes[
i] =
sizes[
i] + delta;
223 if (isLargerThanMaximum) {
231 if (sumAvailable > 0.0) {
232 qreal sumCurrentAvailable = sumAvailable;
233 bool somethingHasAMaximumSize =
false;
235 qreal sumSizes = 0.0;
236 for (
int i = 0;
i <
n; ++
i)
239 for (
int i = 0;
i <
n; ++
i) {
250 if (isLargerThanMaximum) {
252 desired = rowInfo.boxes.value(
start +
i).q_maximumSize - boxSize;
254 boxSize =
box.q_preferredSize;
255 desired =
box.q_maximumSize - boxSize;
257 if (desired == 0.0) {
264 if (sumStretches == 0) {
266 factors[
i] = (stretch < 0) ? 1.0 : 0.0;
268 factors[
i] = (stretch < 0) ?
sizes[
i] : 0.0;
270 }
else if (stretch == sumStretches) {
272 }
else if (stretch <= 0) {
276 qreal ultimateSumSizes;
277 qreal x = ((stretch * sumSizes)
278 - (sumStretches * boxSize))
279 / (sumStretches - stretch);
281 ultimateSize = boxSize +
x;
282 ultimateSumSizes = sumSizes +
x;
284 ultimateSize = boxSize;
285 ultimateSumSizes = (sumStretches * boxSize)
294 ultimateSize = ultimateSize * 3 / 2;
295 ultimateSumSizes = ultimateSumSizes * 3 / 2;
297 qreal beta = ultimateSumSizes - sumSizes;
302 qreal ultimateFactor = (stretch * ultimateSumSizes / sumStretches)
304 qreal transitionalFactor = sumCurrentAvailable * (ultimateSize - boxSize) / beta;
306 factors[
i] = ((
alpha * ultimateFactor)
307 + ((beta -
alpha) * transitionalFactor)) / beta;
311 sumFactors += factors[
i];
312 if (desired < sumCurrentAvailable)
313 somethingHasAMaximumSize =
true;
319 bool keepGoing = somethingHasAMaximumSize;
324 for (
int i = 0;
i <
n; ++
i) {
325 if (newSizes[
i] >= 0.0)
328 const QList<QGridLayoutBox> &rBoxes = isLargerThanMaximum ? rowInfo.boxes :
boxes;
333 maxBoxSize =
qMax(
box.q_minimumSize, std::floor(maxBoxSize));
335 qreal avail = sumCurrentAvailable * factors[
i] / sumFactors;
336 if (
sizes[
i] + avail >= maxBoxSize) {
337 newSizes[
i] = maxBoxSize;
338 sumCurrentAvailable -= maxBoxSize -
sizes[
i];
339 sumFactors -= factors[
i];
340 keepGoing = (sumCurrentAvailable > 0.0);
346 for (
int i = 0;
i <
n; ++
i) {
347 if (newSizes[
i] < 0.0) {
348 qreal delta = (sumFactors == 0.0) ? 0.0
349 : sumCurrentAvailable * factors[
i] / sumFactors;
350 newSizes[
i] =
sizes[
i] + delta;
356 if (sumAvailable > 0) {
358 for (
int i = 0;
i <
n; ++
i) {
369 int prevSurplus = -1;
370 while (surplus > 0 && surplus != prevSurplus) {
371 prevSurplus = surplus;
374 for (
int i = 0;
i <
n; ++
i) {
377 && factors[
i] > 0 &&
sizes[
i] <
box.q_maximumSize)
389 if (snapToPixelGrid) {
390 for (
int i = 0;
i <
n; ++
i) {
403 for (
int i = 0;
i <
n; ++
i) {
410 for (
int i = 0;
i <
n; ++
i) {
423 result.q_maximumSize = 0.0;
424 qreal nextSpacing = 0.0;
438 qreal nextSpacing = 0.0;
456#ifdef QGRIDLAYOUTENGINE_DEBUG
457void QGridLayoutRowData::dump(
int indent)
const
459 qDebug(
"%*sData", indent,
"");
465 qDebug(
"%*s Ignored", indent,
"");
471 qDebug(
"%*s Multi-cell entry <%d, %d> (stretch %d)", indent,
"",
it.key().first,
472 it.key().second,
it.value().q_stretch);
473 it.value().q_box.dump(indent + 2);
481 q_rowSpans{columnSpan, rowSpan},
489 return q_firstRows[orientation];
509 return q_rowSpans[orientation];
519 q_firstRows[orientation] =
row;
524 q_rowSpans[orientation] =
rowSpan;
529 int stretch = q_stretches[orientation];
547 q_stretches[orientation] = stretch;
561 QSizeF constraintSize(-1.0, constraint);
579 QSizeF constraintSize(constraint, -1.0);
599 if (
result.q_minimumDescent != -1.0) {
601 result.q_minimumDescent -= (minSizeHint -
result.q_minimumSize);
613 qreal rowDescent, Qt::Alignment align,
bool snapToPixelGrid)
const
621 if (
size.width() > cellWidth)
623 }
else if (
size.height() > cellHeight) {
633 x += (cellWidth -
width)/2;
652 const qreal descent = vBox.q_minimumDescent;
653 const qreal ascent = vBox.q_minimumSize - descent;
654 y += (cellHeight - rowDescent - ascent);
655 height = ascent + descent;
672 int oldFirstRow =
firstRow(orientation);
673 if (oldFirstRow >=
row) {
692 if (!vGrow || !hGrow) {
700 if (!
size.isValid()) {
702 if (
size.width() == -1)
704 if (
size.height() == -1)
710#ifdef QGRIDLAYOUTENGINE_DEBUG
711void QGridLayoutItem::dump(
int indent)
const
720 if (q_alignment != 0)
721 qDebug(
"%*s Alignment: %x", indent,
"",
uint(q_alignment));
722 qDebug(
"%*s Horizontal size policy: %x Vertical size policy: %x",
737#ifdef QGRIDLAYOUTENGINE_DEBUG
738void QGridLayoutRowInfo::dump(
int indent)
const
763 m_defaultAlignment = defaultAlignment;
764 m_snapToPixelGrid = snapToPixelGrid;
765 m_uniformCellWidths =
false;
766 m_uniformCellHeights =
false;
772 return q_infos[orientation].count;
777 return q_infos.
transposed()[orientation].count;
793 ensureEffectiveFirstAndLastRows();
794 return q_cachedEffectiveFirstRows[orientation];
799 ensureEffectiveFirstAndLastRows();
800 return q_cachedEffectiveLastRows[orientation];
815 if (!q_defaultSpacings[orientation].isUser()) {
817 q_defaultSpacings[orientation].setCachedValue(defaultSpacing);
819 return q_defaultSpacings[orientation].value();
827 if (
row >= rowInfo.spacings.size())
828 rowInfo.spacings.resize(
row + 1);
832 rowInfo.spacings[
row] = QLayoutParameter<qreal>();
838 QLayoutParameter<qreal>
spacing = q_infos[orientation].spacings.value(
row);
841 return q_defaultSpacings[orientation].value();
849 maybeExpandGrid(
row, -1, orientation);
852 if (
row >= rowInfo.stretches.size())
853 rowInfo.stretches.resize(
row + 1);
854 rowInfo.stretches[
row].setUserValue(stretch);
861 return stretch.
value();
871 maybeExpandGrid(
row, -1, orientation);
874 if (
row >= rowInfo.boxes.size())
875 rowInfo.boxes.resize(
row + 1);
876 rowInfo.boxes[
row].q_sizes(which) =
size;
881 return q_infos[orientation].boxes.value(
row).q_sizes(which);
886 return m_uniformCellWidths;
900 return m_uniformCellHeights;
917 maybeExpandGrid(
row, -1, orientation);
920 if (
row >= rowInfo.alignments.size())
921 rowInfo.alignments.resize(
row + 1);
928 return q_infos[orientation].alignments.value(
row);
933 Qt::Alignment align =
layoutItem->alignment();
958 maybeExpandGrid(
item->lastRow(),
item->lastColumn());
965 for (
int i =
item->firstRow();
i <=
item->lastRow(); ++
i) {
966 for (
int j =
item->firstColumn();
j <=
item->lastColumn(); ++
j) {
967 const auto existingItem =
itemAt(
i,
j);
969 qWarning(
"QGridLayoutEngine::addItem: Can't add %s at cell (%d, %d) because it's already taken by %s",
988 for (
int i =
item->firstRow();
i <=
item->lastRow(); ++
i) {
989 for (
int j =
item->firstColumn();
j <=
item->lastColumn(); ++
j) {
991 setItemAt(
i,
j,
nullptr);
1005 return q_grid.
at((
row * internalGridColumnCount()) +
column);
1010 q_cachedEffectiveFirstRows = {-1, -1};
1011 q_cachedEffectiveLastRows = {-1, -1};
1013 q_totalBoxCachedConstraints = {NotCached, NotCached};
1030 ensureGeometries(contentsGeometry.size(), styleInfo);
1040 if (
item->columnSpan() != 1)
1042 if (
item->rowSpan() != 1)
1046 QRectF geom =
item->geometryWithin(contentsGeometry.x() +
x, contentsGeometry.y() +
y,
1048 if (m_snapToPixelGrid) {
1059 item->setGeometry(geom);
1068 || rowSpan < 1 || columnSpan < 1)
1071 ensureGeometries(contentsGeometry.size(), styleInfo);
1081 if (columnSpan != 1)
1082 width += q_xx[lastColumn] -
x;
1095 QHVContainer<QGridLayoutBox> sizehint_totalBoxes;
1096 bool sizeHintCalculated =
false;
1099 if (constraint.
width() >= 0) {
1101 QList<qreal> sizehint_xx;
1102 QList<qreal> sizehint_widths;
1111 ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[
Qt::Vertical], sizehint_xx.data(), sizehint_widths.data(),
Qt::Vertical, styleInfo);
1112 sizeHintCalculated =
true;
1115 if (constraint.
height() >= 0) {
1118 QList<qreal> sizehint_yy;
1119 QList<qreal> sizehint_heights;
1122 sizehint_heights.resize(
rowCount());
1128 ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[
Qt::Horizontal], sizehint_yy.data(), sizehint_heights.data(),
Qt::Horizontal, styleInfo);
1129 sizeHintCalculated =
true;
1132 if (sizeHintCalculated)
1148 QLayoutPolicy::ControlTypes
result;
1177 return m_visualDirection;
1180#ifdef QGRIDLAYOUTENGINE_DEBUG
1181void QGridLayoutEngine::dump(
int indent)
const
1183 qDebug(
"%*sEngine", indent,
"");
1190 qDebug(
"%*s Grid (%d x %d)", indent,
"", internalGridRowCount(),
1191 internalGridColumnCount());
1192 for (
int row = 0;
row < internalGridRowCount(); ++
row) {
1203 qDebug(
"%*s Default spacings: %g %g", indent,
"",
1207 qDebug(
"%*s Column and row info", indent,
"");
1211 qDebug(
"%*s Column and row data", indent,
"");
1212 q_columnData.dump(indent + 2);
1213 q_rowData.dump(indent + 2);
1215 qDebug(
"%*s Geometries output", indent,
"");
1216 QList<qreal> *cellPos = &q_yy;
1217 for (
int pass = 0; pass < 2; ++pass) {
1219 for (
i = 0;
i < cellPos->count(); ++
i) {
1240 int oldGridRowCount = internalGridRowCount();
1241 int oldGridColumnCount = internalGridColumnCount();
1246 int newGridRowCount = internalGridRowCount();
1247 int newGridColumnCount = internalGridColumnCount();
1249 int newGridSize = newGridRowCount * newGridColumnCount;
1250 if (newGridSize != q_grid.
size()) {
1251 q_grid.
resize(newGridSize);
1253 if (newGridColumnCount != oldGridColumnCount) {
1254 for (
int i = oldGridRowCount - 1;
i >= 1; --
i) {
1255 for (
int j = oldGridColumnCount - 1;
j >= 0; --
j) {
1256 int oldIndex = (
i * oldGridColumnCount) +
j;
1257 int newIndex = (
i * newGridColumnCount) +
j;
1260 q_grid[newIndex] = q_grid[oldIndex];
1261 q_grid[oldIndex] =
nullptr;
1268void QGridLayoutEngine::regenerateGrid()
1270 q_grid.
fill(
nullptr);
1275 for (
int j =
item->firstRow();
j <=
item->lastRow(); ++
j) {
1276 for (
int k =
item->firstColumn(); k <=
item->lastColumn(); ++k) {
1277 setItemAt(
j, k,
item);
1290void QGridLayoutEngine::insertOrRemoveRows(
int row,
int delta,
Qt::Orientation orientation)
1292 int oldRowCount =
rowCount(orientation);
1298 if (
row == oldRowCount && delta > 0) {
1299 maybeExpandGrid(oldRowCount + delta - 1, -1, orientation);
1303 q_infos[orientation].insertOrRemoveRows(
row, delta);
1308 q_grid.
resize(internalGridRowCount() * internalGridColumnCount());
1313 const qreal *colPositions,
const qreal *colSizes,
1323 const QLayoutParameter<qreal> &defaultSpacing = q_defaultSpacings[orientation];
1325 if (innerSpacing >= 0.0)
1326 defaultSpacing.setCachedValue(innerSpacing);
1328 for (
int row = 0;
row < rowInfo.count; ++
row) {
1329 bool rowIsEmpty =
true;
1330 bool rowIsIdenticalToPrevious = (
row > 0);
1336 rowIsIdenticalToPrevious =
false;
1342 if ((rowIsEmpty || rowIsIdenticalToPrevious)
1343 && rowInfo.spacings.value(
row).isDefault()
1344 && rowInfo.stretches.value(
row).isDefault()
1348 if (rowInfo.spacings.value(
row).isUser()) {
1350 }
else if (!defaultSpacing.isDefault()) {
1357 struct RowAdHocData {
1359 unsigned int q_hasButtons : 8;
1360 unsigned int q_hasNonButtons : 8;
1362 inline RowAdHocData() : q_row(-1), q_hasButtons(
false), q_hasNonButtons(
false) {}
1365 q_hasButtons =
false;
1366 q_hasNonButtons =
false;
1368 inline bool hasOnlyButtons()
const {
return q_hasButtons && !q_hasNonButtons; }
1369 inline bool hasOnlyNonButtons()
const {
return q_hasNonButtons && !q_hasButtons; }
1371 RowAdHocData lastRowAdHocData;
1372 RowAdHocData nextToLastRowAdHocData;
1373 RowAdHocData nextToNextToLastRowAdHocData;
1376 for (
int row = 0;
row < rowInfo.count; ++
row) {
1382 nextToNextToLastRowAdHocData = nextToLastRowAdHocData;
1383 nextToLastRowAdHocData = lastRowAdHocData;
1384 lastRowAdHocData.init(
row);
1387 bool userRowStretch = rowInfo.stretches.
value(
row).isUser();
1390 bool hasIgnoreFlag =
true;
1394 int itemRow =
item->firstRow(orientation);
1395 int itemColumn =
item->firstColumn(orientation);
1397 if (itemRow ==
row && itemColumn ==
column) {
1398 int itemStretch =
item->stretchFactor(orientation);
1400 hasIgnoreFlag =
false;
1401 int itemRowSpan =
item->rowSpan(orientation);
1403 int effectiveRowSpan = 1;
1404 for (
int i = 1;
i < itemRowSpan; ++
i) {
1410 if (effectiveRowSpan == 1) {
1412 if (!userRowStretch && itemStretch != 0)
1413 rowStretch =
qMax(rowStretch, itemStretch);
1417 box = &multiCell.q_box;
1418 multiCell.q_stretch = itemStretch;
1421 if (colSizes && colPositions &&
item->hasDynamicConstraint() && orientation ==
item->dynamicConstraintOrientation()) {
1429 if (
item->columnSpan(orientation) != 1)
1430 length += colPositions[
item->lastColumn(orientation)] - colPositions[
item->firstColumn(orientation)];
1431 box->combine(
item->box(orientation, m_snapToPixelGrid,
length));
1433 box->combine(
item->box(orientation, m_snapToPixelGrid));
1436 if (effectiveRowSpan == 1) {
1437 QLayoutPolicy::ControlTypes controls =
item->controlTypes(
top);
1439 lastRowAdHocData.q_hasButtons =
true;
1441 lastRowAdHocData.q_hasNonButtons =
true;
1446 if (
row < rowInfo.boxes.size()) {
1449 rowBox.q_minimumSize =
qMax(rowBox.q_minimumSize, rowBoxInfo.q_minimumSize);
1450 rowBox.q_maximumSize =
qMax(rowBox.q_minimumSize,
1451 (rowBoxInfo.q_maximumSize != FLT_MAX ?
1452 rowBoxInfo.q_maximumSize : rowBox.q_maximumSize));
1453 rowBox.q_preferredSize =
qBound(rowBox.q_minimumSize,
1454 qMax(rowBox.q_preferredSize, rowBoxInfo.q_preferredSize),
1455 rowBox.q_maximumSize);
1465 bool lastRowIsButtonBox = (lastRowAdHocData.hasOnlyButtons()
1466 && nextToLastRowAdHocData.hasOnlyNonButtons());
1467 bool lastTwoRowsIsButtonBox = (lastRowAdHocData.hasOnlyButtons()
1468 && nextToLastRowAdHocData.hasOnlyButtons()
1469 && nextToNextToLastRowAdHocData.hasOnlyNonButtons()
1472 if (defaultSpacing.isDefault()) {
1474 for (
int row = 0;
row < rowInfo.count; ++
row) {
1478 if (prevRow != -1 && !rowInfo.spacings.value(prevRow).isUser()) {
1484 if (item1 && item2 && item1 != item2) {
1485 QLayoutPolicy::ControlTypes controls1 = item1->controlTypes(
bottom);
1486 QLayoutPolicy::ControlTypes controls2 = item2->controlTypes(
top);
1489 if ((
row == nextToLastRowAdHocData.q_row && lastTwoRowsIsButtonBox)
1490 || (
row == lastRowAdHocData.q_row && lastRowIsButtonBox)) {
1501 QRectF rect1 = item1->geometryWithin(0.0, 0.0, width1, FLT_MAX, -1.0,
effectiveAlignment(item1), m_snapToPixelGrid);
1502 QRectF rect2 = item2->geometryWithin(0.0, 0.0, width2, FLT_MAX, -1.0,
effectiveAlignment(item2), m_snapToPixelGrid);
1503 spacing -= (width1 - (rect1.x() + rect1.width())) + rect2.
x();
1508 qreal height2 = box2.q_minimumSize;
1510 box1.q_minimumAscent, height1);
1512 box2.q_minimumAscent, height2);
1513 QRectF rect1 = item1->geometryWithin(0.0, 0.0, FLT_MAX, height1,
1515 QRectF rect2 = item2->geometryWithin(0.0, 0.0, FLT_MAX, height2,
1517 spacing -= (height1 - (rect1.y() + rect1.height())) + rect2.
y();
1525 }
else if (lastRowIsButtonBox || lastTwoRowsIsButtonBox) {
1531 int prevRow = lastRowIsButtonBox ? nextToLastRowAdHocData.q_row
1532 : nextToNextToLastRowAdHocData.q_row;
1533 if (!defaultSpacing.isUser() && !rowInfo.spacings.value(prevRow).isUser()) {
1542 (orientation ==
Qt::Vertical && m_uniformCellHeights))) {
1543 qreal averagePreferredSize = 0.;
1544 qreal minimumMaximumSize = std::numeric_limits<qreal>::max();
1545 qreal maximumMinimumSize = 0.;
1546 for (
const auto &
box : rowData->boxes) {
1547 averagePreferredSize +=
box.q_preferredSize;
1548 minimumMaximumSize =
qMin(minimumMaximumSize,
box.q_maximumSize);
1549 maximumMinimumSize =
qMax(maximumMinimumSize,
box.q_minimumSize);
1551 averagePreferredSize /= rowData->
boxes.
size();
1552 minimumMaximumSize =
qMax(minimumMaximumSize, maximumMinimumSize);
1553 averagePreferredSize =
qBound(maximumMinimumSize, averagePreferredSize, minimumMaximumSize);
1554 for (
auto &
box : rowData->boxes) {
1555 box.q_preferredSize = averagePreferredSize;
1556 box.q_minimumSize = maximumMinimumSize;
1557 box.q_maximumSize = minimumMaximumSize;
1562void QGridLayoutEngine::ensureEffectiveFirstAndLastRows()
const
1569 q_cachedEffectiveLastRows = {-1, -1};
1575 if (
item->firstRow(
o) < q_cachedEffectiveFirstRows[
o])
1576 q_cachedEffectiveFirstRows[
o] =
item->firstRow(
o);
1577 if (
item->lastRow(
o) > q_cachedEffectiveLastRows[
o])
1578 q_cachedEffectiveLastRows[
o] =
item->lastRow(
o);
1585 const qreal *colPositions,
const qreal *colSizes,
1591 const qreal constraint = (colPositions && colSizes &&
hasDynamicConstraint()) ? (colPositions[cc - 1] + colSizes[cc - 1]) :
qreal(CachedWithNoConstraint);
1592 qreal &cachedConstraint = q_totalBoxCachedConstraints[orientation];
1593 if (cachedConstraint == constraint) {
1594 if (totalBox != &q_totalBoxes[orientation])
1595 *totalBox = q_totalBoxes[orientation];
1599 fillRowData(rowData, colPositions, colSizes, orientation, styleInfo);
1604 if (totalBox != &q_totalBoxes[orientation])
1605 q_totalBoxes[orientation] = *totalBox;
1607 cachedConstraint = constraint;
1619 if (
item->hasDynamicConstraint()) {
1622 q_cachedConstraintOrientation = itemConstraintOrientation;
1623 }
else if (q_cachedConstraintOrientation != itemConstraintOrientation) {
1625 qWarning(
"QGridLayoutEngine: Unfeasible, cannot mix horizontal and"
1626 " vertical constraint in the same layout");
1653void QGridLayoutEngine::ensureGeometries(
const QSizeF &
size,
1656 if (q_cachedSize ==
size)
1659 q_cachedSize =
size;
virtual qreal windowMargin(Qt::Orientation orientation) const =0
virtual qreal spacing(Qt::Orientation orientation) const =0
virtual qreal combinedLayoutSpacing(QLayoutPolicy::ControlTypes, QLayoutPolicy::ControlTypes, Qt::Orientation) const
bool testBit(qsizetype i) const
Returns true if the bit at index position i is 1; otherwise returns false.
bool fill(bool aval, qsizetype asize=-1)
Sets every bit in the bit array to value, returning true if successful; otherwise returns false.
qsizetype count() const
Same as size().
void setBit(qsizetype i)
Sets the bit at index position i to 1.
void combine(const QGridLayoutBox &other)
void add(const QGridLayoutBox &other, int stretch, qreal spacing)
qreal & q_sizes(int which)
void setRowStretchFactor(int row, int stretch, Qt::Orientation orientation=Qt::Vertical)
void setVisualDirection(Qt::LayoutDirection direction)
void removeItem(QGridLayoutItem *item)
QGridLayoutItem * itemAt(int index) const
void setRowAlignment(int row, Qt::Alignment alignment, Qt::Orientation orientation)
Qt::Alignment effectiveAlignment(const QGridLayoutItem *layoutItem) const
int effectiveFirstRow(Qt::Orientation orientation=Qt::Vertical) const
void setUniformCellHeights(bool uniformCellHeights)
Qt::Orientation constraintOrientation() const
bool uniformCellWidths() const
void setRowSizeHint(Qt::SizeHint which, int row, qreal size, Qt::Orientation orientation=Qt::Vertical)
QList< QGridLayoutItem * > q_items
bool ensureDynamicConstraint() const
int rowStretchFactor(int row, Qt::Orientation orientation=Qt::Vertical) const
QRectF cellRect(const QRectF &contentsGeometry, int row, int column, int rowSpan, int columnSpan, const QAbstractLayoutStyleInfo *styleInfo) const
int effectiveLastRow(Qt::Orientation orientation=Qt::Vertical) const
void setSpacing(qreal spacing, Qt::Orientations orientations)
void insertItem(QGridLayoutItem *item, int index)
void setRowSpacing(int row, qreal spacing, Qt::Orientation orientation=Qt::Vertical)
bool uniformCellHeights() const
QLayoutPolicy::ControlTypes controlTypes(LayoutSide side) const
void setUniformCellWidths(bool uniformCellWidths)
qreal spacing(Qt::Orientation orientation, const QAbstractLayoutStyleInfo *styleInfo) const
QGridLayoutEngine(Qt::Alignment defaultAlignment={ }, bool snapToPixelGrid=false)
Qt::LayoutDirection visualDirection() const
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint, const QAbstractLayoutStyleInfo *styleInfo) const
qreal rowSpacing(int row, Qt::Orientation orientation=Qt::Vertical) const
void addItem(QGridLayoutItem *item)
bool hasDynamicConstraint() const
void setGeometries(const QRectF &contentsGeometry, const QAbstractLayoutStyleInfo *styleInfo)
qreal rowSizeHint(Qt::SizeHint which, int row, Qt::Orientation orientation=Qt::Vertical) const
Qt::Alignment rowAlignment(int row, Qt::Orientation orientation) const
QRectF geometryWithin(qreal x, qreal y, qreal width, qreal height, qreal rowDescent, Qt::Alignment align, bool snapToPixelGrid) const
void setFirstRow(int row, Qt::Orientation orientation=Qt::Vertical)
void setRowSpan(int rowSpan, Qt::Orientation orientation=Qt::Vertical)
Qt::Alignment alignment() const
void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation=Qt::Vertical)
virtual bool hasDynamicConstraint() const
void setStretchFactor(int stretch, Qt::Orientation orientation)
virtual QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const =0
int stretchFactor(Qt::Orientation orientation) const
QGridLayoutBox box(Qt::Orientation orientation, bool snapToPixelGrid, qreal constraint=-1.0) const
virtual Qt::Orientation dynamicConstraintOrientation() const
QSizeF effectiveMaxSize(const QSizeF &constraint) const
QGridLayoutItem(int row, int column, int rowSpan=1, int columnSpan=1, Qt::Alignment alignment={ })
virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const =0
virtual QLayoutPolicy::ControlTypes controlTypes(LayoutSide side) const
QList< QGridLayoutBox > boxes
QGridLayoutBox totalBox(int start, int end) const
void stealBox(int start, int end, int which, qreal *positions, qreal *sizes)
void calculateGeometries(int start, int end, qreal targetSize, qreal *positions, qreal *sizes, qreal *descents, const QGridLayoutBox &totalBox, const QGridLayoutRowInfo &rowInfo, bool snapToPixelGrid)
MultiCellMap multiCellMap
void distributeMultiCells(const QGridLayoutRowInfo &rowInfo, bool snapToPixelGrid)
QList< QLayoutParameter< qreal > > spacings
QList< QGridLayoutBox > boxes
QList< Qt::Alignment > alignments
QList< QStretchParameter > stretches
void insertOrRemoveRows(int row, int delta)
constexpr T & other(Qt::Orientation o) noexcept
constexpr void transpose() noexcept
constexpr QHVContainer transposed() const noexcept(std::is_nothrow_copy_constructible_v< T >)
qsizetype size() const noexcept
QList< T > & fill(parameter_type t, qsizetype size=-1)
bool isEmpty() const noexcept
iterator insert(qsizetype i, parameter_type t)
const_reference at(qsizetype i) const noexcept
T value(qsizetype i) const
void remove(qsizetype i, qsizetype n=1)
qsizetype removeAll(const AT &t)
qsizetype count() const noexcept
void resize(qsizetype size)
void append(parameter_type t)
const_iterator constBegin() const
const_iterator constEnd() const
\inmodule QtCore\reentrant
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void moveRight(qreal pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's right edge at the given finite x coordinate...
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void moveLeft(qreal pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's left edge at the given finite x coordinate.
constexpr void moveTop(qreal pos) noexcept
Moves the rectangle vertically, leaving the rectangle's top line at the given finite y coordinate.
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QSet< QString >::iterator it
Combined button and popup list for selecting options.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static void insertOrRemoveItems(QList< T > &items, int index, int delta)
static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired)
static void visualRect(QRectF *geom, Qt::LayoutDirection dir, const QRectF &contentsRect)
static qreal fixedDescent(qreal descent, qreal ascent, qreal targetSize)
#define LAYOUTITEMSIZE_MAX
bool operator==(const QGridLayoutBox &box1, const QGridLayoutBox &box2)
static qreal compare(const QGridLayoutBox &box1, const QGridLayoutBox &box2, int which)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
GLuint GLsizei const GLchar * message
GLenum GLuint GLintptr offset
GLsizei const GLint * box
GLenum GLenum GLsizei void GLsizei void * column
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void GLsizei void void * span
GLfloat GLfloat GLfloat alpha
QT_BEGIN_NAMESPACE constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
static void layoutItem(QQuickItem *item, qreal y, qreal width)
#define qPrintable(string)
QT_BEGIN_NAMESPACE constexpr void qSwap(T &value1, T &value2) noexcept(std::is_nothrow_swappable_v< T >)
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
static int compare(quint64 a, quint64 b)
qsizetype indexOf(const AT &t, qsizetype from=0) const noexcept
bool contains(const AT &t) const noexcept