From 5dd2713c8ba98e06ae5c4f3da44b2ed73121d247 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 5 Sep 2013 22:17:34 -0700 Subject: Fix constant false comparison of out-of-range enums QGraphicsItem::GraphicsItemFlag is unsigned, so a comparison to -1 is always false. qgraphicsitem.cpp:847:39: error: comparison of constant -1 with expression of type 'QGraphicsItem::GraphicsItemFlag' is always false [-Werror,-Wtautological-constant-out-of-range-compare] Change-Id: I3fc59b777d09060dd34e81f51ed8bdf41354a0f1 Reviewed-by: Andreas Aardal Hanssen --- src/widgets/graphicsview/qgraphicsitem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index bb6033ba6c..47c05d4a46 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -844,8 +844,8 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch // Inherit the enabled-state from our parents. if ((parent->d_ptr->ancestorFlags & flag) || (int(parent->d_ptr->flags & childFlag) == childFlag) - || (childFlag == -1 && parent->d_ptr->handlesChildEvents) - || (childFlag == -2 && parent->d_ptr->filtersDescendantEvents)) { + || (int(childFlag) == -1 && parent->d_ptr->handlesChildEvents) + || (int(childFlag) == -2 && parent->d_ptr->filtersDescendantEvents)) { enabled = true; ancestorFlags |= flag; } else { @@ -868,7 +868,7 @@ void QGraphicsItemPrivate::updateAncestorFlag(QGraphicsItem::GraphicsItemFlag ch ancestorFlags &= ~flag; // Don't process children if the item has the main flag set on itself. - if ((childFlag != -1 && int(flags & childFlag) == childFlag) + if ((int(childFlag) != -1 && int(flags & childFlag) == childFlag) || (int(childFlag) == -1 && handlesChildEvents) || (int(childFlag) == -2 && filtersDescendantEvents)) return; -- cgit v1.2.3