QtBase
v6.3.1
|
The QGraphicsSceneBspTreeIndex class provides an implementation of a BSP indexing algorithm for discovering items in QGraphicsScene. More...
#include <qgraphicsscenebsptreeindex_p.h>
Protected Slots | |
void | updateSceneRect (const QRectF &rect) override |
Protected Slots inherited from QGraphicsSceneIndex | |
virtual void | updateSceneRect (const QRectF &rect) |
Properties | |
int | bspTreeDepth |
the depth of the BSP index tree More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
Friends | |
class | QGraphicsScenePrivate |
The QGraphicsSceneBspTreeIndex class provides an implementation of a BSP indexing algorithm for discovering items in QGraphicsScene.
Definition at line 72 of file qgraphicsscenebsptreeindex_p.h.
QGraphicsSceneBspTreeIndex::QGraphicsSceneBspTreeIndex | ( | QGraphicsScene * | scene = nullptr | ) |
Constructs a BSP scene index for the given scene.
Definition at line 444 of file qgraphicsscenebsptreeindex.cpp.
QGraphicsSceneBspTreeIndex::~QGraphicsSceneBspTreeIndex | ( | ) |
Definition at line 450 of file qgraphicsscenebsptreeindex.cpp.
|
overrideprotectedvirtual |
Add the item into the BSP index.
Implements QGraphicsSceneIndex.
Definition at line 488 of file qgraphicsscenebsptreeindex.cpp.
int QGraphicsSceneBspTreeIndex::bspTreeDepth | ( | ) | const |
Definition at line 597 of file qgraphicsscenebsptreeindex.cpp.
|
overrideprotectedvirtual |
This virtual function removes all items in the scene index.
Reimplemented from QGraphicsSceneIndex.
Definition at line 466 of file qgraphicsscenebsptreeindex.cpp.
|
overridevirtual |
Returns an estimation visible items that are either inside or intersect with the specified rect and return a list sorted using order.
deviceTransform is the transformation apply to the view.
Implements QGraphicsSceneIndex.
Definition at line 532 of file qgraphicsscenebsptreeindex.cpp.
|
overridevirtual |
Reimplemented from QGraphicsSceneIndex.
Definition at line 538 of file qgraphicsscenebsptreeindex.cpp.
|
overrideprotectedvirtual |
\reimp
Used to catch the timer event.
Reimplemented from QObject.
Definition at line 692 of file qgraphicsscenebsptreeindex.cpp.
|
overrideprotectedvirtual |
This virtual function is called by QGraphicsItem to notify the index that some part of the item 's state changes. By reimplementing this function, your can react to a change, and in some cases, (depending on change,) adjustments in the index can be made.
change is the parameter of the item that is changing. value is the value that changed; the type of the value depends on change.
The default implementation does nothing.
Reimplemented from QGraphicsSceneIndex.
Definition at line 631 of file qgraphicsscenebsptreeindex.cpp.
|
overridevirtual |
Return all items in the BSP index and sort them using order.
Implements QGraphicsSceneIndex.
Definition at line 549 of file qgraphicsscenebsptreeindex.cpp.
|
overrideprotectedvirtual |
Notify the index for a geometry change of an item.
Reimplemented from QGraphicsSceneIndex.
Definition at line 507 of file qgraphicsscenebsptreeindex.cpp.
|
overrideprotectedvirtual |
Remove the item from the BSP index.
Implements QGraphicsSceneIndex.
Definition at line 497 of file qgraphicsscenebsptreeindex.cpp.
void QGraphicsSceneBspTreeIndex::setBspTreeDepth | ( | int | depth | ) |
Definition at line 603 of file qgraphicsscenebsptreeindex.cpp.
Definition at line 618 of file qgraphicsscenebsptreeindex.cpp.
|
friend |
Definition at line 107 of file qgraphicsscenebsptreeindex_p.h.
|
readwrite |
the depth of the BSP index tree
This value determines the depth of BSP tree. The depth directly affects performance and memory usage; the latter growing exponentially with the depth of the tree. With an optimal tree depth, the index can instantly determine the locality of items, even for scenes with thousands or millions of items. This also greatly improves rendering performance.
By default, the value is 0, in which case Qt will guess a reasonable default depth based on the size, location and number of items in the scene. If these parameters change frequently, however, you may experience slowdowns as the index retunes the depth internally. You can avoid potential slowdowns by fixating the tree depth through setting this property.
The depth of the tree and the size of the scene rectangle decide the granularity of the scene's partitioning. The size of each scene segment is determined by the following algorithm:
The BSP tree has an optimal size when each segment contains between 0 and 10 items.
Definition at line 200 of file qgraphicsscenebsptreeindex_p.h.