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 <andreas@hanssen.name>
This commit is contained in:
Thiago Macieira 2013-09-05 22:17:34 -07:00 committed by The Qt Project
parent 23d7f6ee5d
commit 5dd2713c8b

View File

@ -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;