Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgraphicsscene_bsp_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QGRAPHICSSCENEBSPTREE_P_H
5#define QGRAPHICSSCENEBSPTREE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include <QtCore/qlist.h>
20#include <QtCore/qrect.h>
21#include <QtCore/qset.h>
22
23QT_REQUIRE_CONFIG(graphicsview);
24
26
27class QGraphicsItem;
28
30{
31public:
32 struct Node
33 {
35 union {
38 };
40 };
41
44
45 void initialize(const QRectF &rect, int depth);
46 void clear();
47
48 void insertItem(QGraphicsItem *item, const QRectF &rect);
49 void removeItem(QGraphicsItem *item, const QRectF &rect);
50 void removeItems(const QSet<QGraphicsItem *> &items);
51
52 QList<QGraphicsItem *> items(const QRectF &rect, bool onlyTopLevelItems = false) const;
53 int leafCount() const;
54
55 inline int firstChildIndex(int index) const
56 { return index * 2 + 1; }
57
58 inline int parentIndex(int index) const
59 { return index > 0 ? ((index & 1) ? ((index - 1) / 2) : ((index - 2) / 2)) : -1; }
60
61 QString debug(int index) const;
62
63private:
64 void initialize(const QRectF &rect, int depth, int index);
65 template<typename Visitor>
66 void climbTree(Visitor &&visitor, const QRectF &rect, int index = 0) const;
67 QRectF rectForIndex(int index) const;
68
69 QList<Node> nodes;
70 QList<QList<QGraphicsItem *>> leaves;
71 int leafCnt;
72 QRectF rect;
73};
74
76
77#endif // QGRAPHICSSCENEBSPTREE_P_H
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
void removeItem(QGraphicsItem *item, const QRectF &rect)
void removeItems(const QSet< QGraphicsItem * > &items)
int firstChildIndex(int index) const
int parentIndex(int index) const
void insertItem(QGraphicsItem *item, const QRectF &rect)
\inmodule QtCore\reentrant
Definition qrect.h:484
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
static bool initialize()
Definition qctf.cpp:94
GLint GLenum GLsizei GLsizei GLsizei depth
GLuint index
[2]
#define QT_REQUIRE_CONFIG(feature)
double qreal
Definition qtypes.h:187
QGraphicsItem * item
QList< QTreeWidgetItem * > items
Definition moc.h:23