Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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// Qt-Security score:significant reason:default
4
5#ifndef QGRAPHICSSCENEBSPTREE_P_H
6#define QGRAPHICSSCENEBSPTREE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists for the convenience
13// of other Qt classes. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtWidgets/private/qtwidgetsglobal_p.h>
20#include <QtCore/qlist.h>
21#include <QtCore/qrect.h>
22#include <QtCore/qset.h>
23
25
26QT_BEGIN_NAMESPACE
27
28class QGraphicsItem;
29
31{
32public:
33 struct Node
34 {
36 union {
39 };
41 };
42
45
46 void initialize(const QRectF &rect, int depth);
47 void clear();
48
49 void insertItem(QGraphicsItem *item, const QRectF &rect);
50 void removeItem(QGraphicsItem *item, const QRectF &rect);
51 void removeItems(const QSet<QGraphicsItem *> &items);
52
53 QList<QGraphicsItem *> items(const QRectF &rect, bool onlyTopLevelItems = false) const;
54 int leafCount() const;
55
56 inline int firstChildIndex(int index) const
57 { return index * 2 + 1; }
58
59 inline int parentIndex(int index) const
60 { return index > 0 ? ((index & 1) ? ((index - 1) / 2) : ((index - 2) / 2)) : -1; }
61
62 QString debug(int index) const;
63
64private:
65 void initialize(const QRectF &rect, int depth, int index);
66 template<typename Visitor>
67 void climbTree(Visitor &&visitor, const QRectF &rect, int index = 0) const;
68 QRectF rectForIndex(int index) const;
69
70 QList<Node> nodes;
71 QList<QList<QGraphicsItem *>> leaves;
72 int leafCnt;
73 QRectF rect;
74};
75
76QT_END_NAMESPACE
77
78#endif // QGRAPHICSSCENEBSPTREE_P_H
The QAbstractGraphicsShapeItem class provides a common base for all path items.
The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene.
QList< QRectF > exposed
QHash< QPaintDevice *, DeviceData > deviceData
QHash< const QGraphicsItem *, QMap< int, QVariant > > data
The QGraphicsItemGroup class provides a container that treats a group of items as a single item.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene.
The QGraphicsObject class provides a base class for all graphics items that require signals,...
QGraphicsPixmapItem::ShapeMode shapeMode
Qt::TransformationMode transformationMode
The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene.
The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene.
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene.
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
The QGraphicsRotation class provides a rotation transformation around a given axis.
The QGraphicsScale class provides a scale transformation.
void removeItem(QGraphicsItem *item, bool recursive=false, bool moveToUnindexedItems=false)
void addItem(QGraphicsItem *item, bool recursive=false)
void startIndexTimer(int interval=QGRAPHICSSCENE_INDEXTIMER_TIMEOUT)
QList< QGraphicsItem * > estimateItems(const QRectF &, Qt::SortOrder, bool b=false)
void _q_updateIndex()
This method will update the BSP index by removing the items from the temporary unindexed list and add...
static void sortItems(QList< QGraphicsItem * > *itemList, Qt::SortOrder order, bool cached, bool onlyTopLevelItems=false)
Sort a list of itemList in a specific order and use the cache if requested.
static bool closestItemFirst_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
static bool closestItemLast_withCache(const QGraphicsItem *item1, const QGraphicsItem *item2)
static void climbTree(QGraphicsItem *item, int *stackingOrder)
The QGraphicsSceneBspTreeIndex class provides an implementation of a BSP indexing algorithm for disco...
int firstChildIndex(int index) const
int parentIndex(int index) const
QString debug(int index) const
The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework.
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framewor...
The QGraphicsSceneEvent class provides a base class for all graphics view related events.
The QGraphicsSceneHelpEvent class provides events when a tooltip is requested.
The QGraphicsSceneHoverEvent class provides hover events in the graphics view framework.
static bool itemCollidesWithPath(const QGraphicsItem *item, const QPainterPath &path, Qt::ItemSelectionMode mode)
void items_helper(const QRectF &rect, QGraphicsSceneIndexIntersector intersect, QList< QGraphicsItem * > *items, const QTransform &viewTransform, Qt::ItemSelectionMode mode, Qt::SortOrder order, const void *intersectData) const
void recursive_items_helper(QGraphicsItem *item, QRectF exposeRect, QGraphicsSceneIndexIntersector intersect, QList< QGraphicsItem * > *items, const QTransform &viewTransform, Qt::ItemSelectionMode mode, qreal parentOpacity, const void *intersectData) const
~QGraphicsSceneIndexPrivate()
Destructor of private scene index.
The QGraphicsSceneIndex class provides a base class to implement a custom indexing algorithm for disc...
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
The QGraphicsSceneMoveEvent class provides events for widget moving in the graphics view framework.
The QGraphicsSceneResizeEvent class provides events for widget resizing in the graphics view framewor...
The QGraphicsSceneWheelEvent class provides wheel events in the graphics view framework.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
The QGraphicsSimpleTextItem class provides a simple text item that you can add to a QGraphicsScene.
void _q_updateBoundingRect(const QSizeF &)
bool _q_mouseOnEdge(QGraphicsSceneMouseEvent *)
QWidgetTextControl * control
QWidgetTextControl * textControl() const
void sendControlEvent(QEvent *e)
The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display form...
The QGraphicsTransform class is an abstract base class for building advanced transformations on QGrap...
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
friend class QPainter
\inmodule QtGui
friend class QWidget
Definition qpainter.h:431
\inmodule QtCore\reentrant
Definition qpoint.h:231
The QPolygonF class provides a list of points using floating point precision.
Definition qpolygon.h:96
QT_REQUIRE_CONFIG(animation)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
static void formatGraphicsItemHelper(QDebug debug, const QGraphicsItem *item)
bool _qt_movableAncestorIsSelected(const QGraphicsItem *item)
static QRectF setupTextLayout(QTextLayout *layout)
QDebug operator<<(QDebug debug, const QGraphicsObject *item)
static QPainterPath qt_graphicsItem_shapeFromPath(const QPainterPath &path, const QPen &pen)
QDebug operator<<(QDebug debug, const QGraphicsItem *item)
static bool qt_QGraphicsItem_isObscured(const QGraphicsItem *item, const QGraphicsItem *other, const QRectF &rect)
bool qt_closestItemLast(const QGraphicsItem *item1, const QGraphicsItem *item2)
Returns true if item2 is on top of item1.
bool qt_closestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
bool qt_notclosestLeaf(const QGraphicsItem *item1, const QGraphicsItem *item2)
bool qt_closestItemFirst(const QGraphicsItem *item1, const QGraphicsItem *item2)
Returns true if item1 is on top of item2.
QT_REQUIRE_CONFIG(graphicsview)
static QRectF adjustedItemBoundingRect(const QGraphicsItem *item)
static QRectF adjustedItemEffectiveBoundingRect(const QGraphicsItem *item)
static void _q_adjustRect(QRectF *rect)
static bool QRectF_intersects(const QRectF &s, const QRectF &r)
static QT_BEGIN_NAMESPACE const int QGRAPHICSSCENE_INDEXTIMER_TIMEOUT
bool(* QGraphicsSceneIndexIntersector)(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode, const QTransform &deviceTransform, const void *data)
QDebug operator<<(QDebug debug, QIODevice::OpenMode modes)
Q_DECLARE_TYPEINFO(QObjectPrivate::ConnectionList, Q_RELOCATABLE_TYPE)
const QTransform * transformPtr
const QTransform * effectTransform
QStyleOptionGraphicsItem * option
const QTransform * viewTransform