6#include <QtCore/qstring.h>
7#include <private/qgraphicsitem_p.h>
25 nodes.resize((1 << (
depth + 1)) - 1);
56 for (
int i = 0;
i < leaves.
size(); ++
i) {
59 for (
int j = 0;
j < oldItemList.
size(); ++
j) {
64 leaves[
i] = newItemList;
77 item->d_func()->itemDiscovered = 1;
83 for (
const auto &foundItem : std::as_const(foundItems))
84 foundItem->d_ptr->itemDiscovered = 0;
124 node->offset =
rect.center().y();
130 qreal offset1, offset2;
149 child->offset = offset1;
152 child = &nodes[childIndex + 1];
153 child->offset = offset2;
160 node->leafIndex = leafCnt++;
164template<
typename Visitor>
165void QGraphicsSceneBspTree::climbTree(Visitor &&visitor,
const QRectF &
rect,
int index)
const
179 if (
rect.left() < node.offset) {
180 climbTree(visitor, rect, childIndex);
181 if (
rect.right() >= node.offset)
182 climbTree(visitor, rect, childIndex + 1);
184 climbTree(visitor, rect, childIndex + 1);
188 if (
rect.top() < node.offset) {
189 climbTree(visitor, rect, childIndex);
190 if (
rect.bottom() >= node.offset)
191 climbTree(visitor, rect, childIndex + 1);
193 climbTree(visitor, rect, childIndex + 1);
198QRectF QGraphicsSceneBspTree::rectForIndex(
int index)
const
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QScopedPointer< QGraphicsItemPrivate > d_ptr
QGraphicsItem * topLevelItem() const
Returns this item's top-level item.
void removeItem(QGraphicsItem *item, const QRectF &rect)
void removeItems(const QSet< QGraphicsItem * > &items)
int firstChildIndex(int index) const
void initialize(const QRectF &rect, int depth)
int parentIndex(int index) const
QList< QGraphicsItem * > items(const QRectF &rect, bool onlyTopLevelItems=false) const
void insertItem(QGraphicsItem *item, const QRectF &rect)
QString debug(int index) const
qsizetype size() const noexcept
QList< T > & fill(parameter_type t, qsizetype size=-1)
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
qsizetype removeAll(const AT &t)
void prepend(rvalue_ref t)
void resize(qsizetype size)
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
constexpr void setRect(qreal x, qreal y, qreal w, qreal h) noexcept
Sets the coordinates of the rectangle's top-left corner to (x, y), and its size to the given width an...
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Combined button and popup list for selecting options.
GLint GLenum GLsizei GLsizei GLsizei depth
bool contains(const AT &t) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent