diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-12-12 01:00:07 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-12-12 10:06:06 +0100 |
commit | 1196b1ef6c5d2cb05ceba5d6f178dc7e2432ed61 (patch) | |
tree | 2a99ee28d15d8ee51fc28096e5559bfc2d453e3f /src/imports/layouts/qquicklinearlayout.cpp | |
parent | fb54af6638dcbeae8ad21249fe234ef4d82c005b (diff) | |
parent | ca206bceaff3667469986402e6143bf4c666b228 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
src/qml/types/qqmlbind.cpp
Change-Id: Ib992d1a7ac6c1a96d39819be6f23955dc31b44b2
Diffstat (limited to 'src/imports/layouts/qquicklinearlayout.cpp')
-rw-r--r-- | src/imports/layouts/qquicklinearlayout.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp index c6c9685ae2..344ea7237c 100644 --- a/src/imports/layouts/qquicklinearlayout.cpp +++ b/src/imports/layouts/qquicklinearlayout.cpp @@ -645,6 +645,7 @@ void QQuickGridLayout::insertLayoutItems() int &nextColumn = nextCellPos[0]; int &nextRow = nextCellPos[1]; + const QSize gridSize(columns(), rows()); const int flowOrientation = flow(); int &flowColumn = nextCellPos[flowOrientation]; int &flowRow = nextCellPos[1 - flowOrientation]; @@ -664,7 +665,7 @@ void QQuickGridLayout::insertLayoutItems() if (shouldIgnoreItem(child, info, sizeHints)) continue; - Qt::Alignment alignment = nullptr; + Qt::Alignment alignment; int row = -1; int column = -1; int span[2] = {1,1}; @@ -677,8 +678,21 @@ void QQuickGridLayout::insertLayoutItems() // the unspecified component of the cell position should default to 0 // The getters do this for us, as they will return 0 for an // unset (or negative) value. - row = info->row(); - column = info->column(); + // In addition, if \a rows is less than Layout.row, treat Layout.row as if it was not set + // This will basically make it find the next available cell (potentially wrapping to + // the next line). Likewise for an invalid Layout.column + + if (gridSize.height() >= 0 && row >= gridSize.height()) { + qmlWarning(child) << QString::fromLatin1("Layout: row (%1) should be less than the number of rows (%2)").arg(info->row()).arg(rows()); + } else { + row = info->row(); + } + + if (gridSize.width() >= 0 && info->column() >= gridSize.width()) { + qmlWarning(child) << QString::fromLatin1("Layout: column (%1) should be less than the number of columns (%2)").arg(info->column()).arg(columns()); + } else { + column = info->column(); + } } rowSpan = info->rowSpan(); columnSpan = info->columnSpan(); @@ -840,7 +854,7 @@ void QQuickLinearLayout::insertLayoutItems() if (shouldIgnoreItem(child, info, sizeHints)) continue; - Qt::Alignment alignment = nullptr; + Qt::Alignment alignment; if (info) alignment = info->alignment(); |