42 #ifndef QGRAPHICSSCENE_H 43 #define QGRAPHICSSCENE_H 45 #include <QtCore/qobject.h> 46 #include <QtCore/qpoint.h> 47 #include <QtCore/qrect.h> 48 #include <QtGui/qbrush.h> 49 #include <QtGui/qfont.h> 50 #include <QtGui/qtransform.h> 51 #include <QtGui/qmatrix.h> 52 #include <QtGui/qpen.h> 60 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW 62 template<
typename T>
class QList;
122 BackgroundLayer = 0x2,
123 ForegroundLayer = 0x4,
136 void setSceneRect(
const QRectF &rect);
138 { setSceneRect(
QRectF(x, y, w, h)); }
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);
233 { update(
QRectF(x, y, w, h)); }
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();
316 #ifndef QT_NO_GESTURES 323 #endif // QT_NO_GRAPHICSVIEW The QVariant class acts like a union for the most common Qt data types.
The QPainter class performs low-level painting on widgets and other paint devices.
qreal height() const
This convenience function is equivalent to calling sceneRect().
bool sortCacheEnabled
whether sort caching is enabled
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items...
The QKeyEvent class describes a key event.
The QFontMetrics class provides font metrics information.
#define QT_END_NAMESPACE
This macro expands to.
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
QPointer< QWidget > widget
QGraphicsItem * itemAt(qreal x, qreal y) const
Returns the topmost item at the position specified by (x, y), or 0 if there are no items at this posi...
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
int bspTreeDepth
the depth of QGraphicsScene's BSP index tree
QGraphicsEllipseItem * addEllipse(qreal x, qreal y, qreal w, qreal h, const QPen &pen=QPen(), const QBrush &brush=QBrush())
SceneLayer
This enum describes the rendering layers in a QGraphicsScene.
The QPointF class defines a point in the plane using floating point precision.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
void invalidate(qreal x, qreal y, qreal w, qreal h, SceneLayers layers=AllLayers)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QPalette palette
the scene's default palette
static void clear(QVariant::Private *d)
The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene.
The QGraphicsSceneBspTreeIndex class provides an implementation of a BSP indexing algorithm for disco...
bool stickyFocus
whether clicking into the scene background will clear focus
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
#define Q_PRIVATE_SLOT(d, signature)
The QString class provides a Unicode character string.
The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display form...
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
The QLineF class provides a two-dimensional vector using floating point precision.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
QList< QGraphicsItem * > items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
qreal height() const
Returns the height of the rectangle.
The QPolygonF class provides a vector of points using floating point precision.
qreal width() const
Returns the width of the rectangle.
QRectF sceneRect
the scene rectangle; the bounding rectangle of the scene
The QGraphicsSceneEvent class provides a base class for all graphics view related events...
The QGraphicsSceneIndex class provides a base class to implement a custom indexing algorithm for disc...
QList< QGraphicsItem * > items(qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform=QTransform()) const
Returns all visible items that, depending on mode, are either inside or intersect with the rectangle ...
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
void update(qreal x, qreal y, qreal w, qreal h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QBrush class defines the fill pattern of shapes drawn by QPainter.
The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsSce...
The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene.
The QGraphicsSceneHelpEvent class provides events when a tooltip is requested.
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framewor...
QBrush foregroundBrush
the foreground brush of the scene.
The QFont class specifies a font used for drawing text.
The QGesture class represents a gesture, containing properties that describe the corresponding user i...
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
ItemIndexMethod itemIndexMethod
the item indexing method.
ItemIndexMethod
This enum describes the indexing algorithms QGraphicsScene provides for managing positional informati...
The QGraphicsItemGroup class provides a container that treats a group of items as a single item...
The QPixmap class is an off-screen image representation that can be used as a paint device...
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
void setSceneRect(qreal x, qreal y, qreal w, qreal h)
#define Q_DECLARE_PRIVATE(Class)
QGraphicsItem * itemAt(qreal x, qreal y, const QTransform &deviceTransform) const
Returns the topmost item at the position specified by (x, y), or 0 if there are no items at this posi...
The QGraphicsSceneWheelEvent class provides wheel events in the graphics view framework.
QFont font
the scene's default font
QBrush backgroundBrush
the background brush of the scene.
QGraphicsLineItem * addLine(qreal x1, qreal y1, qreal x2, qreal y2, const QPen &pen=QPen())
The QGraphicsObject class provides a base class for all graphics items that require signals...
The QEvent class is the base class of all event classes.
The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene.
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem...
qreal width() const
This convenience function is equivalent to calling sceneRect().
The QFocusEvent class contains event parameters for widget focus events.
The QGraphicsEffect class is the base class for all graphics effects.
The QList class is a template class that provides lists.
The QGraphicsPathItem class provides a path item that you can add to a QGraphicsScene.
The QGraphicsSceneHoverEvent class provides hover events in the graphics view framework.
QGraphicsRectItem * addRect(qreal x, qreal y, qreal w, qreal h, const QPen &pen=QPen(), const QBrush &brush=QBrush())
The QHelpEvent class provides an event that is used to request helpful information about a particular...
The QPalette class contains color groups for each widget state.