diff options
author | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-17 12:27:46 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-06-17 12:27:46 (GMT) |
commit | 5d682567d1acb79b2fa55ae8f005c5dcdc9aacb7 (patch) | |
tree | 10b239dc69cf29410471b48e977de382e60fedd3 /src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h | |
parent | 8a0e002ccc762ef3edbc3c9ad91b4d6017cb91bb (diff) | |
download | Qt-5d682567d1acb79b2fa55ae8f005c5dcdc9aacb7.zip Qt-5d682567d1acb79b2fa55ae8f005c5dcdc9aacb7.tar.gz Qt-5d682567d1acb79b2fa55ae8f005c5dcdc9aacb7.tar.bz2 |
API / code review for QGraphicsSceneIndex (internal API).
A few minor modifications only, marked some things as ### obsolete,
removed the public get/set for the index (it's internal anyway).
Diffstat (limited to 'src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h index 6bafbc8..b6f782d 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -142,6 +142,46 @@ static inline bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphics } +static inline bool QRectF_intersects(const QRectF &s, const QRectF &r) +{ + qreal xp = s.left(); + qreal yp = s.top(); + qreal w = s.width(); + qreal h = s.height(); + qreal l1 = xp; + qreal r1 = xp; + if (w < 0) + l1 += w; + else + r1 += w; + + qreal l2 = r.left(); + qreal r2 = r.left(); + if (w < 0) + l2 += r.width(); + else + r2 += r.width(); + + if (l1 >= r2 || l2 >= r1) + return false; + + qreal t1 = yp; + qreal b1 = yp; + if (h < 0) + t1 += h; + else + b1 += h; + + qreal t2 = r.top(); + qreal b2 = r.top(); + if (r.height() < 0) + t2 += r.height(); + else + b2 += r.height(); + + return !(t1 >= b2 || t2 >= b1); +} + QT_END_NAMESPACE #endif // QGRAPHICSSCENEBSPTREEINDEX_P_H |