42 #ifndef QGRAPHICSSCENE_H
43 #define QGRAPHICSSCENE_H
60 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
62 template<
typename T>
class QList;
86 class QGraphicsSceneIndex;
100 class QGraphicsScenePrivate;
108 Q_PROPERTY(
int bspTreeDepth READ bspTreeDepth WRITE setBspTreeDepth)
111 Q_PROPERTY(
bool sortCacheEnabled READ isSortCacheEnabled WRITE setSortCacheEnabled)
112 Q_PROPERTY(
bool stickyFocus READ stickyFocus WRITE setStickyFocus)
122 BackgroundLayer = 0x2,
123 ForegroundLayer = 0x4,
126 Q_DECLARE_FLAGS(SceneLayers, SceneLayer)
134 inline qreal width()
const {
return sceneRect().width(); }
135 inline qreal
height()
const {
return sceneRect().height(); }
136 void setSceneRect(
const QRectF &rect);
138 { setSceneRect(
QRectF(x, y, w, h)); }
144 ItemIndexMethod itemIndexMethod()
const;
145 void setItemIndexMethod(ItemIndexMethod method);
147 bool isSortCacheEnabled()
const;
148 void setSortCacheEnabled(
bool enabled);
150 int bspTreeDepth()
const;
151 void setBspTreeDepth(
int depth);
153 QRectF itemsBoundingRect()
const;
174 {
return items(
QRectF(x, y, w, h), mode); }
177 {
return items(
QRectF(x, y, w, h), mode, order, deviceTransform); }
179 {
return itemAt(
QPointF(x, y)); }
181 {
return itemAt(
QPointF(x, y), deviceTransform); }
204 {
return addEllipse(
QRectF(x, y, w, h), pen, brush); }
206 {
return addLine(
QLineF(x1, y1, x2, y2), pen); }
208 {
return addRect(
QRectF(x, y, w, h), pen, brush); }
213 bool hasFocus()
const;
217 void setStickyFocus(
bool enabled);
218 bool stickyFocus()
const;
222 QBrush backgroundBrush()
const;
223 void setBackgroundBrush(
const QBrush &brush);
225 QBrush foregroundBrush()
const;
226 void setForegroundBrush(
const QBrush &brush);
232 inline void update(qreal x, qreal y, qreal w, qreal h)
233 { update(
QRectF(x, y, w, h)); }
234 inline void invalidate(qreal x, qreal y, qreal w, qreal h, SceneLayers layers = AllLayers)
235 { invalidate(
QRectF(x, y, w, h), layers); }
238 void setStyle(
QStyle *style);
241 void setFont(
const QFont &font);
244 void setPalette(
const QPalette &palette);
246 bool isActive()
const;
256 void invalidate(
const QRectF &rect =
QRectF(), SceneLayers layers = AllLayers);
258 void clearSelection();
272 virtual void keyPressEvent(
QKeyEvent *event);
273 virtual void keyReleaseEvent(
QKeyEvent *event);
281 virtual void drawBackground(
QPainter *painter,
const QRectF &rect);
282 virtual void drawForeground(
QPainter *painter,
const QRectF &rect);
283 virtual void drawItems(
QPainter *painter,
int numItems,
289 bool focusNextPrevChild(
bool next);
293 void sceneRectChanged(
const QRectF &rect);
294 void selectionChanged();
304 friend class QGraphicsItemPrivate;
307 friend class QGraphicsViewPrivate;
309 friend class QGraphicsWidgetPrivate;
311 friend class QGraphicsSceneIndex;
312 friend class QGraphicsSceneIndexPrivate;
313 friend class QGraphicsSceneBspTreeIndex;
314 friend class QGraphicsSceneBspTreeIndexPrivate;
315 friend class QGraphicsItemEffectSourcePrivate;
316 #ifndef QT_NO_GESTURES
321 Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsScene::SceneLayers)
323 #endif // QT_NO_GRAPHICSVIEW
void setSceneRect(qreal x, qreal y, qreal w, qreal h)
GLsizei GLsizei GLchar * source
virtual bool eventFilter(QObject *, QEvent *)
QList< QGraphicsItem * > items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
GLXFBConfig Pixmap pixmap
#define Q_PRIVATE_SLOT(d, signature)
QGraphicsItem * itemAt(qreal x, qreal y, const QTransform &deviceTransform) const
#define QT_BEGIN_NAMESPACE
GLenum GLsizei GLsizei height
QGraphicsLineItem * addLine(qreal x1, qreal y1, qreal x2, qreal y2, const QPen &pen=QPen())
QGraphicsRectItem * addRect(qreal x, qreal y, qreal w, qreal h, const QPen &pen=QPen(), const QBrush &brush=QBrush())
QGraphicsItem * itemAt(qreal x, qreal y) const
GLint GLint GLsizei GLsizei GLsizei depth
virtual bool event(QEvent *)
int int int int int int h
void update(qreal x, qreal y, qreal w, qreal h)
GLubyte GLubyte GLubyte GLubyte w
QGraphicsEllipseItem * addEllipse(qreal x, qreal y, qreal w, qreal h, const QPen &pen=QPen(), const QBrush &brush=QBrush())
QList< QGraphicsItem * > items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform=QTransform()) const
void invalidate(qreal x, qreal y, qreal w, qreal h, SceneLayers layers=AllLayers)