From 587c2c00678f8b3fe9e3249875630112cfb27de7 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether <jan-arve.saether@digia.com> Date: Thu, 23 May 2013 13:22:04 +0200 Subject: [PATCH] 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> --- src/layouts/qquicklinearlayout.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/layouts/qquicklinearlayout.cpp b/src/layouts/qquicklinearlayout.cpp index fdc87d37c..541e4aca1 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(); -- GitLab