summaryrefslogtreecommitdiff
path: root/src/layouts
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-05-23 13:22:04 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-23 14:36:02 +0200
commit587c2c00678f8b3fe9e3249875630112cfb27de7 (patch)
tree2f472f77773b1959a52848b9496a8257f3ed95bc /src/layouts
parenta6b01ff80139247ee2c4b41e9ebcf3694d83514b (diff)
downloadqtquickcontrols-587c2c00678f8b3fe9e3249875630112cfb27de7.tar.gz
Don't implicit cast the enum to a bool
Casting a QLayoutPolicy::Fixed to bool was fine since that would return false. However, casting a QLayoutPolicy::Shrink to bool would return true, which would give wrong results. (The conditions only want to check if the item can grow). There were no bugs because of this, simply because the Qt Quick Layouts API does not allow setting *only* the shrink flag. However, it would become a bug if we ever added such a feature. Change-Id: I781aec85117f45e12e49ba27f7ed8f5724f71bd9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/layouts')
-rw-r--r--src/layouts/qquicklinearlayout.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/layouts/qquicklinearlayout.cpp b/src/layouts/qquicklinearlayout.cpp
index fdc87d37..541e4aca 100644
--- a/src/layouts/qquicklinearlayout.cpp
+++ b/src/layouts/qquicklinearlayout.cpp
@@ -389,13 +389,10 @@ bool QQuickGridLayoutBase::shouldIgnoreItem(QQuickItem *child, QQuickLayoutAttac
QQuickGridLayoutItem::effectiveSizeHints_helper(child, sizeHints, &info, true);
QSizeF effectiveMaxSize = sizeHints[Qt::MaximumSize];
if (!effectiveMaxSize.isNull()) {
- bool effectiveFillWidth = QQuickGridLayoutItem::effectiveSizePolicy_helper(child, Qt::Horizontal, info);
- bool effectiveFillHeight = QQuickGridLayoutItem::effectiveSizePolicy_helper(child, Qt::Vertical, info);
-
QSizeF &prefS = sizeHints[Qt::PreferredSize];
- if (!effectiveFillWidth)
+ if (QQuickGridLayoutItem::effectiveSizePolicy_helper(child, Qt::Horizontal, info) == QLayoutPolicy::Fixed)
effectiveMaxSize.setWidth(prefS.width());
- if (!effectiveFillHeight)
+ if (QQuickGridLayoutItem::effectiveSizePolicy_helper(child, Qt::Vertical, info) == QLayoutPolicy::Fixed)
effectiveMaxSize.setHeight(prefS.height());
}
ignoreItem = effectiveMaxSize.isNull();