diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /examples/widgets/graphicsview/flowlayout/flowlayout.cpp | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'examples/widgets/graphicsview/flowlayout/flowlayout.cpp')
-rw-r--r-- | examples/widgets/graphicsview/flowlayout/flowlayout.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/examples/widgets/graphicsview/flowlayout/flowlayout.cpp b/examples/widgets/graphicsview/flowlayout/flowlayout.cpp index 065c3e00ea..ab6bbb7aa4 100644 --- a/examples/widgets/graphicsview/flowlayout/flowlayout.cpp +++ b/examples/widgets/graphicsview/flowlayout/flowlayout.cpp @@ -154,8 +154,7 @@ QSizeF FlowLayout::minSize(const QSizeF &constraint) const } else if (constraint.height() >= 0) { // width for height? // not supported } else { - QGraphicsLayoutItem *item; - foreach (item, m_items) + for (const QGraphicsLayoutItem *item : qAsConst(m_items)) size = size.expandedTo(item->effectiveSizeHint(Qt::MinimumSize)); size += QSize(left + right, top + bottom); } @@ -167,10 +166,9 @@ QSizeF FlowLayout::prefSize() const qreal left, right; getContentsMargins(&left, 0, &right, 0); - QGraphicsLayoutItem *item; qreal maxh = 0; qreal totalWidth = 0; - foreach (item, m_items) { + for (const QGraphicsLayoutItem *item : qAsConst(m_items)) { if (totalWidth > 0) totalWidth += spacing(Qt::Horizontal); QSizeF pref = item->effectiveSizeHint(Qt::PreferredSize); @@ -187,10 +185,9 @@ QSizeF FlowLayout::prefSize() const QSizeF FlowLayout::maxSize() const { - QGraphicsLayoutItem *item; qreal totalWidth = 0; qreal totalHeight = 0; - foreach (item, m_items) { + for (const QGraphicsLayoutItem *item : qAsConst(m_items)) { if (totalWidth > 0) totalWidth += spacing(Qt::Horizontal); if (totalHeight > 0) |