1398 qreal innerSpacing = 0.0;
1402 &option, styleInfo.
widget());
1403 if (innerSpacing >= 0.0)
1406 for (
int row = 0; row < rowInfo.
count; ++row) {
1407 bool rowIsEmpty =
true;
1408 bool rowIsIdenticalToPrevious = (row > 0);
1410 for (
int column = 0; column < columnInfo.
count; ++column) {
1413 if (rowIsIdenticalToPrevious && item !=
itemAt(row - 1, column, orientation))
1414 rowIsIdenticalToPrevious =
false;
1420 if ((rowIsEmpty || rowIsIdenticalToPrevious)
1428 }
else if (!defaultSpacing.
isDefault()) {
1435 struct RowAdHocData {
1437 unsigned int q_hasButtons : 8;
1438 unsigned int q_hasNonButtons : 8;
1440 inline RowAdHocData() : q_row(-1), q_hasButtons(false), q_hasNonButtons(false) {}
1441 inline void init(
int row) {
1443 q_hasButtons =
false;
1444 q_hasNonButtons =
false;
1446 inline bool hasOnlyButtons()
const {
return q_hasButtons && !q_hasNonButtons; }
1447 inline bool hasOnlyNonButtons()
const {
return q_hasNonButtons && !q_hasButtons; }
1449 RowAdHocData lastRowAdHocData;
1450 RowAdHocData nextToLastRowAdHocData;
1451 RowAdHocData nextToNextToLastRowAdHocData;
1454 for (
int row = 0; row < rowInfo.
count; ++row) {
1460 nextToNextToLastRowAdHocData = nextToLastRowAdHocData;
1461 nextToLastRowAdHocData = lastRowAdHocData;
1462 lastRowAdHocData.init(row);
1466 int &rowStretch = rowData->
stretches[row];
1468 bool hasIgnoreFlag =
true;
1469 for (
int column = 0; column < columnInfo.
count; ++column) {
1472 int itemRow = item->
firstRow(orientation);
1475 if (itemRow == row && itemColumn == column) {
1478 hasIgnoreFlag =
false;
1479 int itemRowSpan = item->
rowSpan(orientation);
1481 int effectiveRowSpan = 1;
1482 for (
int i = 1; i < itemRowSpan; ++i) {
1488 if (effectiveRowSpan == 1) {
1490 if (!userRowStretch && itemStretch != 0)
1491 rowStretch =
qMax(rowStretch, itemStretch);
1495 box = &multiCell.
q_box;
1508 length += colPositions[item->
lastColumn(orientation)] - colPositions[item->
firstColumn(orientation)];
1509 box->
combine(item->
box(orientation, length));
1514 if (effectiveRowSpan == 1) {
1515 QSizePolicy::ControlTypes controls = item->
controlTypes(top);
1516 if (controls & ButtonMask)
1517 lastRowAdHocData.q_hasButtons =
true;
1518 if (controls & ~ButtonMask)
1519 lastRowAdHocData.q_hasNonButtons =
true;
1543 bool lastRowIsButtonBox = (lastRowAdHocData.hasOnlyButtons()
1544 && nextToLastRowAdHocData.hasOnlyNonButtons());
1545 bool lastTwoRowsIsButtonBox = (lastRowAdHocData.hasOnlyButtons()
1546 && nextToLastRowAdHocData.hasOnlyButtons()
1547 && nextToNextToLastRowAdHocData.hasOnlyNonButtons()
1552 for (
int row = 0; row < rowInfo.
count; ++row) {
1558 for (
int column = 0; column < columnInfo.
count; ++column) {
1562 if (item1 && item2 && item1 != item2) {
1563 QSizePolicy::ControlTypes controls1 = item1->
controlTypes(bottom);
1564 QSizePolicy::ControlTypes controls2 = item2->
controlTypes(top);
1567 if ((row == nextToLastRowAdHocData.q_row && lastTwoRowsIsButtonBox)
1568 || (row == lastRowAdHocData.q_row && lastRowIsButtonBox)) {
1575 orientation, &option,
1582 spacing -= (width1 - (rect1.
x() + rect1.
width())) + rect2.
x();
1596 spacing -= (height1 - (rect1.
y() + rect1.
height())) + rect2.
y();
1598 rowSpacing =
qMax(spacing, rowSpacing);
1604 }
else if (lastRowIsButtonBox || lastTwoRowsIsButtonBox) {
1610 int prevRow = lastRowIsButtonBox ? nextToLastRowAdHocData.q_row
1611 : nextToNextToLastRowAdHocData.q_row;
1616 &option, styleInfo.
widget());
1619 rowSpacing =
qMax(windowMargin, rowSpacing);
void setCachedValue(T value) const
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
void setBit(int i)
Sets the bit at index position i to 1.
Qt::Orientation dynamicConstraintOrientation() const
QStyle::State state
the style flags that are used when drawing the control
int count(const T &t) const
Returns the number of occurrences of value in the vector.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
bool hasDynamicConstraint() const
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
QRectF geometryWithin(qreal x, qreal y, qreal width, qreal height, qreal rowDescent) const
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
The QRectF class defines a rectangle in the plane using floating point precision. ...
QSizePolicy::Policy sizePolicy(Qt::Orientation orientation) const
QVector< QGridLayoutBox > boxes
QVector< QStretchParameter > stretches
The QStyleOption class stores the parameters used by QStyle functions.
QGridLayoutRowInfo q_infos[NOrientations]
T value(int i) const
Returns the value at index position i in the vector.
void initFrom(const QWidget *w)
qreal height() const
Returns the height of the rectangle.
qreal spacing(const QLayoutStyleInfo &styleInfo, Qt::Orientation orientation) const
qreal width() const
Returns the width of the rectangle.
QVector< QLayoutParameter< qreal > > spacings
MultiCellMap multiCellMap
const T & at(int i) const
Returns the item at index position i in the vector.
QVector< qreal > spacings
static qreal fixedDescent(qreal descent, qreal ascent, qreal targetSize)
QGridLayoutItem * itemAt(int index) const
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
QGridLayoutBox box(Qt::Orientation orientation, qreal constraint=-1.0) const
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
void combine(const QGridLayoutBox &other)
QSizePolicy::ControlTypes controlTypes(LayoutSide side) const
QVector< QGridLayoutBox > boxes
qreal rowSpacing(int row, Qt::Orientation orientation=Qt::Vertical) const
int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, QStyleOption *option=0, QWidget *widget=0) const
Returns the spacing that should be used between controls1 and controls2 in a layout.
QLayoutParameter< qreal > q_defaultSpacings[NOrientations]
int stretchFactor(Qt::Orientation orientation) const