Qt 4.8
Classes | Functions | Variables
qgraphicsscenebsptreeindex_p.h File Reference
#include <QtCore/qglobal.h>
#include "qgraphicssceneindex_p.h"
#include "qgraphicsitem_p.h"
#include "qgraphicsscene_bsp_p.h"
#include <QtCore/qrect.h>
#include <QtCore/qlist.h>

Go to the source code of this file.

Classes

class  QGraphicsSceneBspTreeIndex
 The QGraphicsSceneBspTreeIndex class provides an implementation of a BSP indexing algorithm for discovering items in QGraphicsScene. More...
 
class  QGraphicsSceneBspTreeIndexPrivate
 

Functions

static bool QRectF_intersects (const QRectF &s, const QRectF &r)
 

Variables

static const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000
 

Function Documentation

◆ QRectF_intersects()

static bool QRectF_intersects ( const QRectF s,
const QRectF r 
)
inlinestatic

Definition at line 162 of file qgraphicsscenebsptreeindex_p.h.

163 {
164  qreal xp = s.left();
165  qreal yp = s.top();
166  qreal w = s.width();
167  qreal h = s.height();
168  qreal l1 = xp;
169  qreal r1 = xp;
170  if (w < 0)
171  l1 += w;
172  else
173  r1 += w;
174 
175  qreal l2 = r.left();
176  qreal r2 = r.left();
177  if (w < 0)
178  l2 += r.width();
179  else
180  r2 += r.width();
181 
182  if (l1 >= r2 || l2 >= r1)
183  return false;
184 
185  qreal t1 = yp;
186  qreal b1 = yp;
187  if (h < 0)
188  t1 += h;
189  else
190  b1 += h;
191 
192  qreal t2 = r.top();
193  qreal b2 = r.top();
194  if (r.height() < 0)
195  t2 += r.height();
196  else
197  b2 += r.height();
198 
199  return !(t1 >= b2 || t2 >= b1);
200 }
double qreal
Definition: qglobal.h:1193
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526

Variable Documentation

◆ QGRAPHICSSCENE_INDEXTIMER_TIMEOUT

const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT = 2000
static

Definition at line 69 of file qgraphicsscenebsptreeindex_p.h.