[Qt-interest] QGraphicsItem::isObscured() bug?
Malyushytsky, Alex
alex at wai.com
Wed Sep 8 23:47:38 CEST 2010
It seems that QGraphicsItem::isObscured() (at least in Qt 4.6.3) does not behave the way it described in documentation. It never calls isObscuredBy().
Proof is below:
/*!
.............
Its implementation is based on calling isObscuredBy(), which you can
reimplement to provide a custom obscurity algorithm.
.........
*/
bool QGraphicsItem::isObscured() const
{
return isObscured(QRectF());
}
/*!
\overload
\since 4.3
...........
Unlike the default isObscured() function, this function does not call
isObscuredBy().
.........
*/
bool QGraphicsItem::isObscured(const QRectF &rect) const
{
Q_D(const QGraphicsItem);
if (!d->scene)
return false;
QRectF br = boundingRect();
QRectF testRect = rect.isNull() ? br : rect;
foreach (QGraphicsItem *item, d->scene->items(mapToScene(br), Qt::IntersectsItemBoundingRect)) {
if (item == this)
break;
if (qt_QGraphicsItem_isObscured(this, item, testRect))
return true;
}
return false;
}
Should this be reported as a bug in code or documentation?
I hope this would be considered bug in the code, cause as for now I can't provide my own implementation. So either isObscured should be made virtual or it should be changed to call
isObscuredBy() as described in documentation.
Regards,
Alex Malyushytsky
Research Engineer - Weidlinger Associates Inc.
office: 650 230 0210,
direct: 650 230 0349
web: http://www.wai.com
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
“Please consider our environment before printing this email.”
More information about the Qt-interest-old
mailing list