Qt 4.8
|
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene. More...
#include <qgraphicsitem.h>
Public Functions | |
bool | acceptDrops () const |
Returns true if this item can accept drag and drop events; otherwise, returns false. More... | |
Qt::MouseButtons | acceptedMouseButtons () const |
Returns the mouse buttons that this item accepts mouse events for. More... | |
bool | acceptHoverEvents () const |
Returns true if an item accepts hover events (QGraphicsSceneHoverEvent); otherwise, returns false. More... | |
bool | acceptsHoverEvents () const |
Call acceptHoverEvents() instead. More... | |
bool | acceptTouchEvents () const |
Returns true if an item accepts touch events; otherwise, returns false. More... | |
virtual void | advance (int phase) |
This virtual function is called twice for all items by the QGraphicsScene::advance() slot. More... | |
virtual QRectF | boundingRect () const =0 |
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be restricted to inside an item's bounding rect. More... | |
QRegion | boundingRegion (const QTransform &itemToDeviceTransform) const |
Returns the bounding region for this item. More... | |
qreal | boundingRegionGranularity () const |
Returns the item's bounding region granularity; a value between and including 0 and 1. More... | |
CacheMode | cacheMode () const |
Returns the cache mode for this item. More... | |
QList< QGraphicsItem * > | childItems () const |
Returns a list of this item's children. More... | |
QList< QGraphicsItem * > | children () const |
Use childItems() instead. More... | |
QRectF | childrenBoundingRect () const |
Returns the bounding rect of this item's descendants (i.e., its children, their children, etc.) in local coordinates. More... | |
void | clearFocus () |
Takes keyboard input focus from the item. More... | |
QPainterPath | clipPath () const |
Returns this item's clip path, or an empty QPainterPath if this item is not clipped. More... | |
virtual bool | collidesWithItem (const QGraphicsItem *other, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
Returns true if this item collides with other; otherwise returns false. More... | |
virtual bool | collidesWithPath (const QPainterPath &path, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
Returns true if this item collides with path. More... | |
QList< QGraphicsItem * > | collidingItems (Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
Returns a list of all items that collide with this item. More... | |
QGraphicsItem * | commonAncestorItem (const QGraphicsItem *other) const |
Returns the closest common ancestor item of this item and other, or 0 if either other is 0, or there is no common ancestor. More... | |
virtual bool | contains (const QPointF &point) const |
Returns true if this item contains point, which is in local coordinates; otherwise, false is returned. More... | |
QCursor | cursor () const |
Returns the current cursor shape for the item. More... | |
QVariant | data (int key) const |
Returns this item's custom data for the key key as a QVariant. More... | |
QTransform | deviceTransform (const QTransform &viewportTransform) const |
Returns this item's device transformation matrix, using viewportTransform to map from scene to device coordinates. More... | |
qreal | effectiveOpacity () const |
Returns this item's effective opacity, which is between 0. More... | |
void | ensureVisible (const QRectF &rect=QRectF(), int xmargin=50, int ymargin=50) |
If this item is part of a scene that is viewed by a QGraphicsView, this convenience function will attempt to scroll the view to ensure that rect is visible inside the view's viewport. More... | |
void | ensureVisible (qreal x, qreal y, qreal w, qreal h, int xmargin=50, int ymargin=50) |
This convenience function is equivalent to calling ensureVisible(QRectF(x, y, w, h), xmargin, ymargin): More... | |
bool | filtersChildEvents () const |
Returns true if this item filters child events (i. More... | |
GraphicsItemFlags | flags () const |
Returns this item's flags. More... | |
QGraphicsItem * | focusItem () const |
If this item, a child or descendant of this item currently has input focus, this function will return a pointer to that item. More... | |
QGraphicsItem * | focusProxy () const |
Returns this item's focus proxy, or 0 if this item has no focus proxy. More... | |
QGraphicsItem * | focusScopeItem () const |
Returns this item's focus scope item. More... | |
void | grabKeyboard () |
Grabs the keyboard input. More... | |
void | grabMouse () |
Grabs the mouse input. More... | |
QGraphicsEffect * | graphicsEffect () const |
Returns a pointer to this item's effect if it has one; otherwise 0. More... | |
QGraphicsItemGroup * | group () const |
Returns a pointer to this item's item group, or 0 if this item is not member of a group. More... | |
bool | handlesChildEvents () const |
Returns true if this item handles child events (i. More... | |
bool | hasCursor () const |
Returns true if this item has a cursor set; otherwise, false is returned. More... | |
bool | hasFocus () const |
Returns true if this item is active, and it or its focus proxy has keyboard input focus; otherwise, returns false. More... | |
void | hide () |
Hides the item. More... | |
Qt::InputMethodHints | inputMethodHints () const |
Returns the current input method hints of this item. More... | |
void | installSceneEventFilter (QGraphicsItem *filterItem) |
Installs an event filter for this item on filterItem, causing all events for this item to first pass through filterItem's sceneEventFilter() function. More... | |
bool | isActive () const |
Returns true if this item is active; otherwise returns false. More... | |
bool | isAncestorOf (const QGraphicsItem *child) const |
Returns true if this item is an ancestor of child (i.e., if this item is child's parent, or one of child's parent's ancestors). More... | |
bool | isBlockedByModalPanel (QGraphicsItem **blockingPanel=0) const |
Returns true if this item is blocked by a modal panel, false otherwise. More... | |
bool | isClipped () const |
Returns true if this item is clipped. More... | |
bool | isEnabled () const |
Returns true if the item is enabled; otherwise, false is returned. More... | |
bool | isObscured () const |
Returns true if this item's bounding rect is completely obscured by the opaque shape of any of colliding items above it (i.e., with a higher Z value than this item). More... | |
bool | isObscured (const QRectF &rect) const |
Returns true if rect is completely obscured by the opaque shape of any of colliding items above it (i. More... | |
bool | isObscured (qreal x, qreal y, qreal w, qreal h) const |
This convenience function is equivalent to calling isObscured(QRectF(x, y, w, h)). More... | |
virtual bool | isObscuredBy (const QGraphicsItem *item) const |
Returns true if this item's bounding rect is completely obscured by the opaque shape of item. More... | |
bool | isPanel () const |
Returns true if the item is a panel; otherwise returns false. More... | |
bool | isSelected () const |
Returns true if this item is selected; otherwise, false is returned. More... | |
bool | isUnderMouse () const |
Returns true if this item is currently under the mouse cursor in one of the views; otherwise, false is returned. More... | |
bool | isVisible () const |
Returns true if the item is visible; otherwise, false is returned. More... | |
bool | isVisibleTo (const QGraphicsItem *parent) const |
Returns true if the item is visible to parent; otherwise, false is returned. More... | |
bool | isWidget () const |
Returns true if this item is a widget (i. More... | |
bool | isWindow () const |
Returns true if the item is a QGraphicsWidget window, otherwise returns false. More... | |
QTransform | itemTransform (const QGraphicsItem *other, bool *ok=0) const |
Returns a QTransform that maps coordinates from this item to other. More... | |
QPointF | mapFromItem (const QGraphicsItem *item, const QPointF &point) const |
Maps the point point, which is in item's coordinate system, to this item's coordinate system, and returns the mapped coordinate. More... | |
QPolygonF | mapFromItem (const QGraphicsItem *item, const QRectF &rect) const |
Maps the rectangle rect, which is in item's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon. More... | |
QPolygonF | mapFromItem (const QGraphicsItem *item, const QPolygonF &polygon) const |
Maps the polygon polygon, which is in item's coordinate system, to this item's coordinate system, and returns the mapped polygon. More... | |
QPainterPath | mapFromItem (const QGraphicsItem *item, const QPainterPath &path) const |
Maps the path path, which is in item's coordinate system, to this item's coordinate system, and returns the mapped path. More... | |
QPointF | mapFromItem (const QGraphicsItem *item, qreal x, qreal y) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This convenience function is equivalent to calling mapFromItem(item, QPointF(x, y)). More... | |
QPolygonF | mapFromItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const |
QPointF | mapFromParent (const QPointF &point) const |
Maps the point point, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped coordinate. More... | |
QPolygonF | mapFromParent (const QRectF &rect) const |
Maps the rectangle rect, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon. More... | |
QPolygonF | mapFromParent (const QPolygonF &polygon) const |
Maps the polygon polygon, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped polygon. More... | |
QPainterPath | mapFromParent (const QPainterPath &path) const |
Maps the path path, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped path. More... | |
QPointF | mapFromParent (qreal x, qreal y) const |
This convenience function is equivalent to calling mapFromParent(QPointF(x, y)). More... | |
QPolygonF | mapFromParent (qreal x, qreal y, qreal w, qreal h) const |
This convenience function is equivalent to calling mapFromItem(QRectF(x, y, w, h)). More... | |
QPointF | mapFromScene (const QPointF &point) const |
Maps the point point, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped coordinate. More... | |
QPolygonF | mapFromScene (const QRectF &rect) const |
Maps the rectangle rect, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon. More... | |
QPolygonF | mapFromScene (const QPolygonF &polygon) const |
Maps the polygon polygon, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped polygon. More... | |
QPainterPath | mapFromScene (const QPainterPath &path) const |
Maps the path path, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped path. More... | |
QPointF | mapFromScene (qreal x, qreal y) const |
This convenience function is equivalent to calling mapFromScene(QPointF(x, y)). More... | |
QPolygonF | mapFromScene (qreal x, qreal y, qreal w, qreal h) const |
This convenience function is equivalent to calling mapFromScene(QRectF(x, y, w, h)). More... | |
QRectF | mapRectFromItem (const QGraphicsItem *item, const QRectF &rect) const |
Maps the rectangle rect, which is in item's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a new rectangle (i. More... | |
QRectF | mapRectFromItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const |
QRectF | mapRectFromParent (const QRectF &rect) const |
Maps the rectangle rect, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a new rectangle (i. More... | |
QRectF | mapRectFromParent (qreal x, qreal y, qreal w, qreal h) const |
This convenience function is equivalent to calling mapRectFromParent(QRectF(x, y, w, h)). More... | |
QRectF | mapRectFromScene (const QRectF &rect) const |
Maps the rectangle rect, which is in scene coordinates, to this item's coordinate system, and returns the mapped rectangle as a new rectangle (i. More... | |
QRectF | mapRectFromScene (qreal x, qreal y, qreal w, qreal h) const |
This convenience function is equivalent to calling mapRectFromScene(QRectF(x, y, w, h)). More... | |
QRectF | mapRectToItem (const QGraphicsItem *item, const QRectF &rect) const |
Maps the rectangle rect, which is in this item's coordinate system, to item's coordinate system, and returns the mapped rectangle as a new rectangle (i. More... | |
QRectF | mapRectToItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const |
QRectF | mapRectToParent (const QRectF &rect) const |
Maps the rectangle rect, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped rectangle as a new rectangle (i. More... | |
QRectF | mapRectToParent (qreal x, qreal y, qreal w, qreal h) const |
This convenience function is equivalent to calling mapRectToParent(QRectF(x, y, w, h)). More... | |
QRectF | mapRectToScene (const QRectF &rect) const |
Maps the rectangle rect, which is in this item's coordinate system, to the scene coordinate system, and returns the mapped rectangle as a new rectangle (i. More... | |
QRectF | mapRectToScene (qreal x, qreal y, qreal w, qreal h) const |
This convenience function is equivalent to calling mapRectToScene(QRectF(x, y, w, h)). More... | |
QPointF | mapToItem (const QGraphicsItem *item, const QPointF &point) const |
Maps the point point, which is in this item's coordinate system, to item's coordinate system, and returns the mapped coordinate. More... | |
QPolygonF | mapToItem (const QGraphicsItem *item, const QRectF &rect) const |
Maps the rectangle rect, which is in this item's coordinate system, to item's coordinate system, and returns the mapped rectangle as a polygon. More... | |
QPolygonF | mapToItem (const QGraphicsItem *item, const QPolygonF &polygon) const |
Maps the polygon polygon, which is in this item's coordinate system, to item's coordinate system, and returns the mapped polygon. More... | |
QPainterPath | mapToItem (const QGraphicsItem *item, const QPainterPath &path) const |
Maps the path path, which is in this item's coordinate system, to item's coordinate system, and returns the mapped path. More... | |
QPointF | mapToItem (const QGraphicsItem *item, qreal x, qreal y) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This convenience function is equivalent to calling mapToItem(item, QPointF(x, y)). More... | |
QPolygonF | mapToItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const |
QPointF | mapToParent (const QPointF &point) const |
Maps the point point, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped coordinate. More... | |
QPolygonF | mapToParent (const QRectF &rect) const |
Maps the rectangle rect, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped rectangle as a polygon. More... | |
QPolygonF | mapToParent (const QPolygonF &polygon) const |
Maps the polygon polygon, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped polygon. More... | |
QPainterPath | mapToParent (const QPainterPath &path) const |
Maps the path path, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped path. More... | |
QPointF | mapToParent (qreal x, qreal y) const |
This convenience function is equivalent to calling mapToParent(QPointF(x, y)). More... | |
QPolygonF | mapToParent (qreal x, qreal y, qreal w, qreal h) const |
This convenience function is equivalent to calling mapToParent(QRectF(x, y, w, h)). More... | |
QPointF | mapToScene (const QPointF &point) const |
Maps the point point, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped coordinate. More... | |
QPolygonF | mapToScene (const QRectF &rect) const |
Maps the rectangle rect, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped rectangle as a polygon. More... | |
QPolygonF | mapToScene (const QPolygonF &polygon) const |
Maps the polygon polygon, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped polygon. More... | |
QPainterPath | mapToScene (const QPainterPath &path) const |
Maps the path path, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped path. More... | |
QPointF | mapToScene (qreal x, qreal y) const |
This convenience function is equivalent to calling mapToScene(QPointF(x, y)). More... | |
QPolygonF | mapToScene (qreal x, qreal y, qreal w, qreal h) const |
This convenience function is equivalent to calling mapToScene(QRectF(x, y, w, h)). More... | |
QMatrix | matrix () const |
Returns the item's affine transformation matrix. More... | |
void | moveBy (qreal dx, qreal dy) |
Moves the item by dx points horizontally, and dy point vertically. More... | |
qreal | opacity () const |
Returns this item's local opacity, which is between 0. More... | |
virtual QPainterPath | opaqueArea () const |
This virtual function returns a shape representing the area where this item is opaque. More... | |
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)=0 |
This function, which is usually called by QGraphicsView, paints the contents of an item in local coordinates. More... | |
QGraphicsItem * | panel () const |
Returns the item's panel, or 0 if this item does not have a panel. More... | |
PanelModality | panelModality () const |
Returns the modality for this item. More... | |
QGraphicsItem * | parentItem () const |
Returns a pointer to this item's parent item. More... | |
QGraphicsObject * | parentObject () const |
Returns a pointer to the item's parent, cast to a QGraphicsObject. More... | |
QGraphicsWidget * | parentWidget () const |
Returns a pointer to the item's parent widget. More... | |
QPointF | pos () const |
Returns the position of the item in parent coordinates. More... | |
QGraphicsItem (QGraphicsItem *parent=0) | |
Constructs a QGraphicsItem with the given parent item. More... | |
void | removeSceneEventFilter (QGraphicsItem *filterItem) |
Removes an event filter on this item from filterItem. More... | |
void | resetMatrix () |
Use resetTransform() instead. More... | |
void | resetTransform () |
Resets this item's transformation matrix to the identity matrix or all the transformation properties to their default values. More... | |
void | rotate (qreal angle) |
Use. More... | |
qreal | rotation () const |
Returns the clockwise rotation, in degrees, around the Z axis. More... | |
void | scale (qreal sx, qreal sy) |
Use. More... | |
qreal | scale () const |
Returns the scale factor of the item. More... | |
QGraphicsScene * | scene () const |
Returns the current scene for the item, or 0 if the item is not stored in a scene. More... | |
QRectF | sceneBoundingRect () const |
Returns the bounding rect of this item in scene coordinates, by combining sceneTransform() with boundingRect(). More... | |
QMatrix | sceneMatrix () const |
Use sceneTransform() instead. More... | |
QPointF | scenePos () const |
Returns the item's position in scene coordinates. More... | |
QTransform | sceneTransform () const |
Returns this item's scene transformation matrix. More... | |
void | scroll (qreal dx, qreal dy, const QRectF &rect=QRectF()) |
Scrolls the contents of rect by dx, dy. More... | |
void | setAcceptDrops (bool on) |
If on is true, this item will accept drag and drop events; otherwise, it is transparent for drag and drop events. More... | |
void | setAcceptedMouseButtons (Qt::MouseButtons buttons) |
Sets the mouse buttons that this item accepts mouse events for. More... | |
void | setAcceptHoverEvents (bool enabled) |
If enabled is true, this item will accept hover events; otherwise, it will ignore them. More... | |
void | setAcceptsHoverEvents (bool enabled) |
Use setAcceptHoverEvents(enabled) instead. More... | |
void | setAcceptTouchEvents (bool enabled) |
If enabled is true, this item will accept touch events; otherwise, it will ignore them. More... | |
void | setActive (bool active) |
If active is true, and the scene is active, this item's panel will be activated. More... | |
void | setBoundingRegionGranularity (qreal granularity) |
Sets the bounding region granularity to granularity; a value between and including 0 and 1. More... | |
void | setCacheMode (CacheMode mode, const QSize &cacheSize=QSize()) |
Sets the item's cache mode to mode. More... | |
void | setCursor (const QCursor &cursor) |
Sets the current cursor shape for the item to cursor. More... | |
void | setData (int key, const QVariant &value) |
Sets this item's custom data for the key key to value. More... | |
void | setEnabled (bool enabled) |
If enabled is true, the item is enabled; otherwise, it is disabled. More... | |
void | setFiltersChildEvents (bool enabled) |
If enabled is true, this item is set to filter all events for all its children (i. More... | |
void | setFlag (GraphicsItemFlag flag, bool enabled=true) |
If enabled is true, the item flag flag is enabled; otherwise, it is disabled. More... | |
void | setFlags (GraphicsItemFlags flags) |
Sets the item flags to flags. More... | |
void | setFocus (Qt::FocusReason focusReason=Qt::OtherFocusReason) |
Gives keyboard input focus to this item. More... | |
void | setFocusProxy (QGraphicsItem *item) |
Sets the item's focus proxy to item. More... | |
void | setGraphicsEffect (QGraphicsEffect *effect) |
Sets effect as the item's effect. More... | |
void | setGroup (QGraphicsItemGroup *group) |
Adds this item to the item group group. More... | |
void | setHandlesChildEvents (bool enabled) |
If enabled is true, this item is set to handle all events for all its children (i. More... | |
void | setInputMethodHints (Qt::InputMethodHints hints) |
Sets the current input method hints of this item to hints. More... | |
void | setMatrix (const QMatrix &matrix, bool combine=false) |
Sets the item's affine transformation matrix. More... | |
void | setOpacity (qreal opacity) |
Sets this item's local opacity, between 0. More... | |
void | setPanelModality (PanelModality panelModality) |
Sets the modality for this item to panelModality. More... | |
void | setParentItem (QGraphicsItem *parent) |
Sets this item's parent item to newParent. More... | |
void | setPos (const QPointF &pos) |
Sets the position of the item to pos, which is in parent coordinates. More... | |
void | setPos (qreal x, qreal y) |
This convenience function is equivalent to calling setPos(QPointF(x, y)). More... | |
void | setRotation (qreal angle) |
Sets the clockwise rotation angle, in degrees, around the Z axis. More... | |
void | setScale (qreal scale) |
Sets the scale factor of the item. More... | |
void | setSelected (bool selected) |
If selected is true and this item is selectable, this item is selected; otherwise, it is unselected. More... | |
void | setToolTip (const QString &toolTip) |
Sets the item's tool tip to toolTip. More... | |
void | setTransform (const QTransform &matrix, bool combine=false) |
Sets the item's current transformation matrix to matrix. More... | |
void | setTransformations (const QList< QGraphicsTransform *> &transformations) |
Sets a list of graphics transformations (QGraphicsTransform) that currently apply to this item. More... | |
void | setTransformOriginPoint (const QPointF &origin) |
Sets the origin point for the transformation in item coordinates. More... | |
void | setTransformOriginPoint (qreal ax, qreal ay) |
Sets the origin point for the transformation in item coordinates. More... | |
void | setVisible (bool visible) |
If visible is true, the item is made visible. More... | |
void | setX (qreal x) |
Set's the x coordinate of the item's position. More... | |
void | setY (qreal y) |
Set's the y coordinate of the item's position. More... | |
void | setZValue (qreal z) |
Sets the Z-value of the item to z. More... | |
virtual QPainterPath | shape () const |
Returns the shape of this item as a QPainterPath in local coordinates. More... | |
void | shear (qreal sh, qreal sv) |
Use. More... | |
void | show () |
Shows the item. More... | |
void | stackBefore (const QGraphicsItem *sibling) |
Stacks this item before sibling, which must be a sibling item (i. More... | |
QGraphicsObject * | toGraphicsObject () |
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object, 0 otherwise. More... | |
const QGraphicsObject * | toGraphicsObject () const |
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object, 0 otherwise. More... | |
QString | toolTip () const |
Returns the item's tool tip, or an empty QString if no tool tip has been set. More... | |
QGraphicsItem * | topLevelItem () const |
Returns this item's top-level item. More... | |
QGraphicsWidget * | topLevelWidget () const |
Returns a pointer to the item's top level widget (i. More... | |
QTransform | transform () const |
Returns this item's transformation matrix. More... | |
QList< QGraphicsTransform * > | transformations () const |
Returns a list of graphics transforms that currently apply to this item. More... | |
QPointF | transformOriginPoint () const |
Returns the origin point for the transformation in item coordinates. More... | |
void | translate (qreal dx, qreal dy) |
Use setPos() or setTransformOriginPoint() instead. More... | |
virtual int | type () const |
Returns the type of an item as an int. More... | |
void | ungrabKeyboard () |
Releases the keyboard grab. More... | |
void | ungrabMouse () |
Releases the mouse grab. More... | |
void | unsetCursor () |
Clears the cursor from this item. More... | |
void | update (const QRectF &rect=QRectF()) |
Schedules a redraw of the area covered by rect in this item. More... | |
void | update (qreal x, qreal y, qreal width, qreal height) |
This convenience function is equivalent to calling update(QRectF(x, y, width, height)). More... | |
QGraphicsWidget * | window () const |
Returns the item's window, or 0 if this item does not have a window. More... | |
qreal | x () const |
This convenience function is equivalent to calling pos(). More... | |
qreal | y () const |
This convenience function is equivalent to calling pos(). More... | |
qreal | zValue () const |
Returns the Z-value of the item. More... | |
virtual | ~QGraphicsItem () |
Destroys the QGraphicsItem and all its children. More... | |
Protected Types | |
enum | Extension { UserExtension = 0x80000000 } |
Note: This is provided as a hook to avoid future problems related to adding virtual functions. More... | |
Protected Functions | |
void | addToIndex () |
Adds this item to the scene's index. More... | |
virtual void | contextMenuEvent (QGraphicsSceneContextMenuEvent *event) |
This event handler can be reimplemented in a subclass to process context menu events. More... | |
virtual void | dragEnterEvent (QGraphicsSceneDragDropEvent *event) |
This event handler, for event event, can be reimplemented to receive drag enter events for this item. More... | |
virtual void | dragLeaveEvent (QGraphicsSceneDragDropEvent *event) |
This event handler, for event event, can be reimplemented to receive drag leave events for this item. More... | |
virtual void | dragMoveEvent (QGraphicsSceneDragDropEvent *event) |
This event handler, for event event, can be reimplemented to receive drag move events for this item. More... | |
virtual void | dropEvent (QGraphicsSceneDragDropEvent *event) |
This event handler, for event event, can be reimplemented to receive drop events for this item. More... | |
virtual QVariant | extension (const QVariant &variant) const |
Note: This is provided as a hook to avoid future problems related to adding virtual functions. More... | |
virtual void | focusInEvent (QFocusEvent *event) |
This event handler, for event event, can be reimplemented to receive focus in events for this item. More... | |
virtual void | focusOutEvent (QFocusEvent *event) |
This event handler, for event event, can be reimplemented to receive focus out events for this item. More... | |
virtual void | hoverEnterEvent (QGraphicsSceneHoverEvent *event) |
This event handler, for event event, can be reimplemented to receive hover enter events for this item. More... | |
virtual void | hoverLeaveEvent (QGraphicsSceneHoverEvent *event) |
This event handler, for event event, can be reimplemented to receive hover leave events for this item. More... | |
virtual void | hoverMoveEvent (QGraphicsSceneHoverEvent *event) |
This event handler, for event event, can be reimplemented to receive hover move events for this item. More... | |
virtual void | inputMethodEvent (QInputMethodEvent *event) |
This event handler, for event event, can be reimplemented to receive input method events for this item. More... | |
virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const |
This method is only relevant for input items. More... | |
virtual QVariant | itemChange (GraphicsItemChange change, const QVariant &value) |
This virtual function is called by QGraphicsItem to notify custom items that some part of the item's state changes. More... | |
virtual void | keyPressEvent (QKeyEvent *event) |
This event handler, for event event, can be reimplemented to receive key press events for this item. More... | |
virtual void | keyReleaseEvent (QKeyEvent *event) |
This event handler, for event event, can be reimplemented to receive key release events for this item. More... | |
virtual void | mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) |
This event handler, for event event, can be reimplemented to receive mouse doubleclick events for this item. More... | |
virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) |
This event handler, for event event, can be reimplemented to receive mouse move events for this item. More... | |
virtual void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
This event handler, for event event, can be reimplemented to receive mouse press events for this item. More... | |
virtual void | mouseReleaseEvent (QGraphicsSceneMouseEvent *event) |
This event handler, for event event, can be reimplemented to receive mouse release events for this item. More... | |
void | prepareGeometryChange () |
Prepares the item for a geometry change. More... | |
QGraphicsItem (QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene) | |
void | removeFromIndex () |
Removes this item from the scene's index. More... | |
virtual bool | sceneEvent (QEvent *event) |
This virtual function receives events to this item. More... | |
virtual bool | sceneEventFilter (QGraphicsItem *watched, QEvent *event) |
Filters events for the item watched. More... | |
virtual void | setExtension (Extension extension, const QVariant &variant) |
Note: This is provided as a hook to avoid future problems related to adding virtual functions. More... | |
virtual bool | supportsExtension (Extension extension) const |
Note: This is provided as a hook to avoid future problems related to adding virtual functions. More... | |
void | updateMicroFocus () |
Updates the item's micro focus. More... | |
virtual void | wheelEvent (QGraphicsSceneWheelEvent *event) |
This event handler, for event event, can be reimplemented to receive wheel events for this item. More... | |
Protected Variables | |
QScopedPointer< QGraphicsItemPrivate > | d_ptr |
Related Functions | |
(Note that these are not member functions.) | |
T | qgraphicsitem_cast (QGraphicsItem *item) |
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
It provides a light-weight foundation for writing your own custom items. This includes defining the item's geometry, collision detection, its painting implementation and item interaction through its event handlers. QGraphicsItem is part of the Graphics View Framework
For convenience, Qt provides a set of standard graphics items for the most common shapes. These are:
All of an item's geometric information is based on its local coordinate system. The item's position, pos(), is the only function that does not operate in local coordinates, as it returns a position in parent coordinates. The Graphics View Coordinate System describes the coordinate system in detail.
You can set whether an item should be visible (i.e., drawn, and accepting events), by calling setVisible(). Hiding an item will also hide its children. Similarly, you can enable or disable an item by calling setEnabled(). If you disable an item, all its children will also be disabled. By default, items are both visible and enabled. To toggle whether an item is selected or not, first enable selection by setting the ItemIsSelectable flag, and then call setSelected(). Normally, selection is toggled by the scene, as a result of user interaction.
To write your own graphics item, you first create a subclass of QGraphicsItem, and then start by implementing its two pure virtual public functions: boundingRect(), which returns an estimate of the area painted by the item, and paint(), which implements the actual painting. For example:
The boundingRect() function has many different purposes. QGraphicsScene bases its item index on boundingRect(), and QGraphicsView uses it both for culling invisible items, and for determining the area that needs to be recomposed when drawing overlapping items. In addition, QGraphicsItem's collision detection mechanisms use boundingRect() to provide an efficient cut-off. The fine grained collision algorithm in collidesWithItem() is based on calling shape(), which returns an accurate outline of the item's shape as a QPainterPath.
QGraphicsScene expects all items boundingRect() and shape() to remain unchanged unless it is notified. If you want to change an item's geometry in any way, you must first call prepareGeometryChange() to allow QGraphicsScene to update its bookkeeping.
Collision detection can be done in two ways:
Reimplement shape() to return an accurate shape for your item, and rely on the default implementation of collidesWithItem() to do shape-shape intersection. This can be rather expensive if the shapes are complex.
Reimplement collidesWithItem() to provide your own custom item and shape collision algorithm.
The contains() function can be called to determine whether the item contains a point or not. This function can also be reimplemented by the item. The default behavior of contains() is based on calling shape().
Items can contain other items, and also be contained by other items. All items can have a parent item and a list of children. Unless the item has no parent, its position is in parent coordinates (i.e., the parent's local coordinates). Parent items propagate both their position and their transformation to all children.
QGraphicsItem supports projective transformations in addition to its base position, pos(). There are several ways to change an item's transformation. For simple transformations, you can call either of the convenience functions setRotation() or setScale(), or you can pass any transformation matrix to setTransform(). For advanced transformation control you also have the option of setting several combined transformations by calling setTransformations().
Item transformations accumulate from parent to child, so if both a parent and child item are rotated 90 degrees, the child's total transformation will be 180 degrees. Similarly, if the item's parent is scaled to 2x its original size, its children will also be twice as large. An item's transformation does not affect its own local geometry; all geometry functions (e.g., contains(), update(), and all the mapping functions) still operate in local coordinates. For convenience, QGraphicsItem provides the functions sceneTransform(), which returns the item's total transformation matrix (including its position and all parents' positions and transformations), and scenePos(), which returns its position in scene coordinates. To reset an item's matrix, call resetTransform().
Certain transformation operations produce a different outcome depending on the order in which they are applied. For example, if you scale an transform, and then rotate it, you may get a different result than if the transform was rotated first. However, the order you set the transformation properties on QGraphicsItem does not affect the resulting transformation; QGraphicsItem always applies the properties in a fixed, defined order:
The paint() function is called by QGraphicsView to paint the item's contents. The item has no background or default fill of its own; whatever is behind the item will shine through all areas that are not explicitly painted in this function. You can call update() to schedule a repaint, optionally passing the rectangle that needs a repaint. Depending on whether or not the item is visible in a view, the item may or may not be repainted; there is no equivalent to QWidget::repaint() in QGraphicsItem.
Items are painted by the view, starting with the parent items and then drawing children, in ascending stacking order. You can set an item's stacking order by calling setZValue(), and test it by calling zValue(), where items with low z-values are painted before items with high z-values. Stacking order applies to sibling items; parents are always drawn before their children.
All items are drawn in a defined, stable order, and this same order decides which items will receive mouse input first when you click on the scene. Normally you don't have to worry about sorting, as the items follow a "natural order", following the logical structure of the scene.
An item's children are stacked on top of the parent, and sibling items are stacked by insertion order (i.e., in the same order that they were either added to the scene, or added to the same parent). If you add item A, and then B, then B will be on top of A. If you then add C, the items' stacking order will be A, then B, then C.
This example shows the stacking order of all limbs of the robot from the Drag and Drop Robot example. The torso is the root item (all other items are children or descendants of the torso), so it is drawn first. Next, the head is drawn, as it is the first item in the torso's list of children. Then the upper left arm is drawn. As the lower arm is a child of the upper arm, the lower arm is then drawn, followed by the upper arm's next sibling, which is the upper right arm, and so on.
For advanced users, there are ways to alter how your items are sorted:
You can call setZValue() on an item to explicitly stack it on top of, or under, other sibling items. The default Z value for an item is 0. Items with the same Z value are stacked by insertion order.
You can call stackBefore() to reorder the list of children. This will directly modify the insertion order.
The stacking order of two sibling items also counts for each item's children and descendant items. So if one item is on top of another, then all its children will also be on top of all the other item's children as well.
QGraphicsItem receives events from QGraphicsScene through the virtual function sceneEvent(). This function distributes the most common events to a set of convenience event handlers:
You can filter events for any other item by installing event filters. This functionality is separate from Qt's regular event filters (see QObject::installEventFilter()), which only work on subclasses of QObject. After installing your item as an event filter for another item by calling installSceneEventFilter(), the filtered events will be received by the virtual function sceneEventFilter(). You can remove item event filters by calling removeSceneEventFilter().
Sometimes it's useful to register custom data with an item, be it a custom item, or a standard item. You can call setData() on any item to store data in it using a key-value pair (the key being an integer, and the value is a QVariant). To get custom data from an item, call data(). This functionality is completely untouched by Qt itself; it is provided for the user's convenience.
Definition at line 89 of file qgraphicsitem.h.
anonymous enum |
Enumerator | |
---|---|
Type | The type value returned by the virtual type() function in standard graphics item classes in Qt. All such standard graphics item classes in Qt are associated with a unique value for Type, e.g. the value returned by QGraphicsPathItem::type() is 2. |
UserType | The lowest permitted type value for custom items (subclasses of QGraphicsItem or any of the standard items). This value is used in conjunction with a reimplementation of QGraphicsItem::type() and declaring a Type enum value. Example:
|
Definition at line 419 of file qgraphicsitem.h.
This enum describes QGraphicsItem's cache modes.
Caching is used to speed up rendering by allocating and rendering to an off-screen pixel buffer, which can be reused when the item requires redrawing. For some paint devices, the cache is stored directly in graphics memory, which makes rendering very quick.
Enumerator | |
---|---|
NoCache | |
ItemCoordinateCache | |
DeviceCoordinateCache |
Definition at line 153 of file qgraphicsitem.h.
|
protected |
Note: This is provided as a hook to avoid future problems related to adding virtual functions.
See also extension(), supportsExtension() and setExtension().
Enumerator | |
---|---|
UserExtension |
Definition at line 454 of file qgraphicsitem.h.
This enum describes the state changes that are notified by QGraphicsItem::itemChange().
The notifications are sent as the state changes, and in some cases, adjustments can be made (see the documentation for each change for details).
Note: Be careful with calling functions on the QGraphicsItem itself inside itemChange(), as certain function calls can lead to unwanted recursion. For example, you cannot call setPos() in itemChange() on an ItemPositionChange notification, as the setPos() function will again call itemChange(ItemPositionChange). Instead, you can return the new, adjusted position from itemChange().
Definition at line 116 of file qgraphicsitem.h.
This enum describes different flags that you can set on an item to toggle different features in the item's behavior.
All flags are disabled by default.
Definition at line 92 of file qgraphicsitem.h.
This enum specifies the behavior of a modal panel.
A modal panel is one that blocks input to other panels. Note that items that are children of a modal panel are not blocked.
The values are:
Enumerator | |
---|---|
NonModal | |
PanelModal | |
SceneModal |
Definition at line 159 of file qgraphicsitem.h.
QGraphicsItem::QGraphicsItem | ( | QGraphicsItem * | parent = 0 | ) |
Constructs a QGraphicsItem with the given parent item.
It does not modify the parent object returned by QObject::parent().
If parent is 0, you can add the item to a scene by calling QGraphicsScene::addItem(). The item will then become a top-level item.
Definition at line 1461 of file qgraphicsitem.cpp.
|
virtual |
Destroys the QGraphicsItem and all its children.
If this item is currently associated with a scene, the item will be removed from the scene before it is deleted.
Definition at line 1510 of file qgraphicsitem.cpp.
|
protected |
Definition at line 1485 of file qgraphicsitem.cpp.
bool QGraphicsItem::acceptDrops | ( | ) | const |
Returns true if this item can accept drag and drop events; otherwise, returns false.
By default, items do not accept drag and drop events; items are transparent to drag and drop.
Definition at line 3064 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::dragMoveEvent().
Qt::MouseButtons QGraphicsItem::acceptedMouseButtons | ( | ) | const |
Returns the mouse buttons that this item accepts mouse events for.
By default, all mouse buttons are accepted.
If an item accepts a mouse button, it will become the mouse grabber item when a mouse press event is delivered for that mouse button. However, if the item does not accept the button, QGraphicsScene will forward the mouse events to the first item beneath it that does.
Definition at line 3093 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::mousePressEventHandler(), QDeclarativeMouseArea::setAcceptedButtons(), and QDeclarativeMouseArea::setHovered().
bool QGraphicsItem::acceptHoverEvents | ( | ) | const |
Returns true if an item accepts hover events (QGraphicsSceneHoverEvent); otherwise, returns false.
By default, items do not accept hover events.
Definition at line 3135 of file qgraphicsitem.cpp.
Referenced by QDeclarativeMouseArea::itemChange(), QDeclarativeMouseArea::mouseReleaseEvent(), and QDeclarativeMouseArea::setHoverEnabled().
bool QGraphicsItem::acceptsHoverEvents | ( | ) | const |
Call acceptHoverEvents() instead.
Definition at line 3148 of file qgraphicsitem.cpp.
Referenced by QGraphicsWidget::event().
bool QGraphicsItem::acceptTouchEvents | ( | ) | const |
Returns true if an item accepts touch events; otherwise, returns false.
By default, items do not accept touch events.
Definition at line 3221 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::sendTouchBeginEvent().
|
protected |
Adds this item to the scene's index.
Called in conjunction with removeFromIndex() to ensure the index bookkeeping is correct when the item's position, transformation or shape changes.
Definition at line 7936 of file qgraphicsitem.cpp.
|
virtual |
This virtual function is called twice for all items by the QGraphicsScene::advance() slot.
In the first phase, all items are called with phase == 0, indicating that items on the scene are about to advance, and then all items are called with phase == 1. Reimplement this function to update your item if you need simple scene-controlled animation.
The default implementation does nothing.
For individual item animation, an alternative to this function is to either use QGraphicsItemAnimation, or to multiple-inherit from QObject and QGraphicsItem, and animate your item using QObject::startTimer() and QObject::timerEvent().
Definition at line 4882 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::advance().
|
pure virtual |
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be restricted to inside an item's bounding rect.
QGraphicsView uses this to determine whether the item requires redrawing.
Although the item's shape can be arbitrary, the bounding rect is always rectangular, and it is unaffected by the items' transformation.
If you want to change the item's bounding rectangle, you must first call prepareGeometryChange(). This notifies the scene of the imminent change, so that its can update its item geometry index; otherwise, the scene will be unaware of the item's new geometry, and the results are undefined (typically, rendering artifacts are left around in the view).
Reimplement this function to let QGraphicsView determine what parts of the widget, if any, need to be redrawn.
Note: For shapes that paint an outline / stroke, it is important to include half the pen width in the bounding rect. It is not necessary to compensate for antialiasing, though.
Example:
Implemented in QGraphicsItemGroup, QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, QGraphicsPathItem, QDeclarativeTextEdit, QDeclarativeTextInput, QDeclarativeText, QGraphicsWidget, QDeclarativeRectangle, QDeclarativeItem, QDeclarativePaintedItem, QGraphicsSvgItem, QDeclarativeImage, and QmlJSDebugger::LiveLayerItem.
Referenced by QGraphicsItemGroup::addToGroup(), adjustedItemBoundingRect(), boundingRegion(), clipPath(), collidesWithPath(), QGraphicsScenePrivate::drawItemHelper(), QmlJSDebugger::BoundingRectHighlighter::highlightAll(), QGraphicsSceneIndexRectIntersector::intersect(), QGraphicsSceneIndexPointIntersector::intersect(), QGraphicsSceneIndexPathIntersector::intersect(), isObscured(), isObscuredBy(), prepareGeometryChange(), QGraphicsScenePrivate::processDirtyItemsRecursive(), qt_graphicsItem_highlightSelected(), sceneBoundingRect(), scroll(), QmlJSDebugger::SubcomponentMaskLayerItem::setCurrentItem(), QmlJSDebugger::LiveSelectionIndicator::setItems(), QGraphicsLineItem::setLine(), QGraphicsViewPrivate::setUpdateClip(), and shape().
QRegion QGraphicsItem::boundingRegion | ( | const QTransform & | itemToDeviceTransform | ) | const |
Returns the bounding region for this item.
The coordinate space of the returned region depends on itemToDeviceTransform. If you pass an identity QTransform as a parameter, this function will return a local coordinate region.
The bounding region describes a coarse outline of the item's visual contents. Although it's expensive to calculate, it's also more precise than boundingRect(), and it can help to avoid unnecessary repainting when an item is updated. This is particularly efficient for thin items (e.g., lines or simple polygons). You can tune the granularity for the bounding region by calling setBoundingRegionGranularity(). The default granularity is 0; in which the item's bounding region is the same as its bounding rect.
itemToDeviceTransform is the transformation from item coordinates to device coordinates. If you want this function to return a QRegion in scene coordinates, you can pass sceneTransform() as an argument.
Definition at line 5545 of file qgraphicsitem.cpp.
Referenced by QGraphicsViewPrivate::mapToViewRegion().
qreal QGraphicsItem::boundingRegionGranularity | ( | ) | const |
Returns the item's bounding region granularity; a value between and including 0 and 1.
The default value is 0 (i.e., the lowest granularity, where the bounding region corresponds to the item's bounding rectangle).
\sa setBoundingRegionGranularity()
Definition at line 5611 of file qgraphicsitem.cpp.
Referenced by boundingRegion(), and QGraphicsScenePrivate::processDirtyItemsRecursive().
QGraphicsItem::CacheMode QGraphicsItem::cacheMode | ( | ) | const |
Returns the cache mode for this item.
Definition at line 2061 of file qgraphicsitem.cpp.
Referenced by QGraphicsSvgItem::isCachingEnabled().
QList< QGraphicsItem * > QGraphicsItem::childItems | ( | ) | const |
Returns a list of this item's children.
The items are sorted by stacking order. This takes into account both the items' insertion order and their Z-values.
Definition at line 1833 of file qgraphicsitem.cpp.
Referenced by QDeclarativeContents::calcHeight(), QDeclarativeContents::calcWidth(), QDeclarativeItem::childAt(), children(), QDeclarativeContents::complete(), QDeclarativeFlickablePrivate::data_at(), QDeclarativeFlickablePrivate::data_clear(), QDeclarativeFlickablePrivate::data_count(), QmlJSDebugger::LiveLayerItem::findAllChildItems(), QGraphicsProxyWidgetPrivate::setWidget_helper(), QDeclarativeContents::~QDeclarativeContents(), and QGraphicsWidget::~QGraphicsWidget().
QList< QGraphicsItem * > QGraphicsItem::children | ( | ) | const |
Use childItems() instead.
Definition at line 1815 of file qgraphicsitem.cpp.
Referenced by _q_qgraphicsItemSetFlag(), QGraphicsItemPrivate::addChild(), QGraphicsScene::destroyItemGroup(), QGraphicsItemPrivate::ensureSequentialSiblingIndex(), QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(), QGraphicsItemPrivate::invalidateDepthRecursively(), QGraphicsItemPrivate::removeChild(), QGraphicsScene::setActiveWindow(), QGraphicsItemPrivate::setEnabledHelper(), QGraphicsItemPrivate::setVisibleHelper(), and QGraphicsItemPrivate::updatePaintedViewBoundingRects().
QRectF QGraphicsItem::childrenBoundingRect | ( | ) | const |
Returns the bounding rect of this item's descendants (i.e., its children, their children, etc.) in local coordinates.
The rectangle will contain all descendants after they have been mapped to local coordinates. If the item has no children, this function returns an empty QRectF.
This does not include this item's own bounding rect; it only returns its descendants' accumulated bounding rect. If you need to include this item's bounding rect, you can add boundingRect() to childrenBoundingRect() using QRectF::operator|().
This function is linear in complexity; it determines the size of the returned bounding rect by iterating through all descendants.
Definition at line 5068 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QmlJSDebugger::LiveLayerItem::boundingRect(), QGraphicsItemGroup::removeFromGroup(), and QmlJSDebugger::SubcomponentMaskLayerItem::setCurrentItem().
void QGraphicsItem::clearFocus | ( | ) |
Takes keyboard input focus from the item.
If it has focus, a focus out event is sent to this item to tell it that it is about to lose the focus.
Only items that set the ItemIsFocusable flag, or widgets that set an appropriate focus policy, can accept keyboard focus.
Definition at line 3521 of file qgraphicsitem.cpp.
Referenced by QWidget::clearFocus(), QGraphicsScenePrivate::removeItemHelper(), QGraphicsItemPrivate::setEnabledHelper(), setFlags(), QDeclarativeItem::setFocus(), QGraphicsWidget::setFocusPolicy(), ~QGraphicsItem(), and QGraphicsWidget::~QGraphicsWidget().
QPainterPath QGraphicsItem::clipPath | ( | ) | const |
Returns this item's clip path, or an empty QPainterPath if this item is not clipped.
The clip path constrains the item's appearance and interaction (i.e., restricts the area the item can draw, and it also restricts the area that the item receives events).
You can enable clipping by setting the ItemClipsToShape or ItemClipsChildrenToShape flags. The item's clip path is calculated by intersecting all clipping ancestors' shapes. If the item sets ItemClipsToShape, the final clip is intersected with the item's own shape.
Definition at line 5215 of file qgraphicsitem.cpp.
Referenced by collidesWithItem(), collidesWithPath(), contains(), QGraphicsView::fitInView(), and QAbstractGraphicsShapeItem::opaqueArea().
|
virtual |
Returns true if this item collides with other; otherwise returns false.
The mode is applied to other, and the resulting shape or bounding rectangle is then compared to this item's shape. The default value for mode is Qt::IntersectsItemShape; other collides with this item if it either intersects, contains, or is contained by this item's shape (see Qt::ItemSelectionMode for details).
The default implementation is based on shape intersection, and it calls shape() on both items. Because the complexity of arbitrary shape-shape intersection grows with an order of magnitude when the shapes are complex, this operation can be noticably time consuming. You have the option of reimplementing this function in a subclass of QGraphicsItem to provide a custom algorithm. This allows you to make use of natural constraints in the shapes of your own items, in order to improve the performance of the collision detection. For instance, two untransformed perfectly circular items' collision can be determined very efficiently by comparing their positions and radii.
Keep in mind that when reimplementing this function and calling shape() or boundingRect() on other, the returned coordinates must be mapped to this item's coordinate system before any intersection can take place.
Definition at line 5307 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::collidingItems().
|
virtual |
Returns true if this item collides with path.
The collision is determined by mode. The default value for mode is Qt::IntersectsItemShape; path collides with this item if it either intersects, contains, or is contained by this item's shape.
Note that this function checks whether the item's shape or bounding rectangle (depending on mode) is contained within path, and not whether path is contained within the items shape or bounding rectangle.
Definition at line 5350 of file qgraphicsitem.cpp.
Referenced by collidesWithItem(), and QGraphicsSceneIndexPrivate::itemCollidesWithPath().
QList< QGraphicsItem * > QGraphicsItem::collidingItems | ( | Qt::ItemSelectionMode | mode = Qt::IntersectsItemShape | ) | const |
Returns a list of all items that collide with this item.
The way collisions are detected is determined by applying mode to items that are compared to this item, i.e., each item's shape or bounding rectangle is checked against this item's shape. The default value for mode is Qt::IntersectsItemShape.
Definition at line 5395 of file qgraphicsitem.cpp.
QGraphicsItem * QGraphicsItem::commonAncestorItem | ( | const QGraphicsItem * | other | ) | const |
Returns the closest common ancestor item of this item and other, or 0 if either other is 0, or there is no common ancestor.
Definition at line 6897 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::dispatchHoverEvent(), isBlockedByModalPanel(), itemTransform(), and QGraphicsItemPrivate::setFocusHelper().
|
virtual |
Returns true if this item contains point, which is in local coordinates; otherwise, false is returned.
It is most often called from QGraphicsView to determine what item is under the cursor, and for that reason, the implementation of this function should be as light-weight as possible.
By default, this function calls shape(), but you can reimplement it in a subclass to provide a (perhaps more efficient) implementation.
Reimplemented in QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, and QGraphicsPathItem.
Definition at line 5273 of file qgraphicsitem.cpp.
Referenced by QGraphicsPathItem::contains(), QGraphicsRectItem::contains(), QGraphicsEllipseItem::contains(), QGraphicsPolygonItem::contains(), QGraphicsLineItem::contains(), QGraphicsPixmapItem::contains(), QGraphicsScenePrivate::gestureEventHandler(), QGraphicsObject::grabGesture(), QGraphicsProxyWidget::hoverMoveEvent(), QGraphicsSceneIndexPointIntersector::intersect(), isUnderMouse(), QDeclarativeMouseArea::mouseMoveEvent(), QDeclarativeTextInput::mouseReleaseEvent(), QDeclarativeTextEdit::mouseReleaseEvent(), QGraphicsWidget::paintWindowFrame(), QDeclarativeTextEdit::positionAt(), qt_QGraphicsItem_isObscured(), and QGraphicsLineItem::setLine().
|
protectedvirtual |
This event handler can be reimplemented in a subclass to process context menu events.
The event parameter contains details about the event to be handled.
If you ignore the event, (i.e., by calling QEvent::ignore(),) event will propagate to any item beneath this item. If no items accept the event, it will be ignored by the scene, and propagate to the view.
It's common to open a QMenu in response to receiving a context menu event. Example:
The default implementation ignores the event.
Reimplemented in QGraphicsTextItem, QDeclarativeMouseArea, and QGraphicsProxyWidget.
Definition at line 7248 of file qgraphicsitem.cpp.
Referenced by QDeclarativeMouseArea::contextMenuEvent(), and sceneEvent().
QCursor QGraphicsItem::cursor | ( | ) | const |
Returns the current cursor shape for the item.
The mouse cursor will assume this shape when it's over this item. See the list of predefined cursor objects for a range of useful shapes.
An editor item might want to use an I-beam cursor:
If no cursor has been set, the cursor of the item beneath is used.
Definition at line 2256 of file qgraphicsitem.cpp.
Referenced by QGraphicsViewPrivate::_q_unsetViewportCursor(), QDeclarativeTextInput::mouseDoubleClickEvent(), QGraphicsViewPrivate::mouseMoveEventHandler(), QDeclarativeTextInput::mousePressEvent(), QDeclarativeTextInput::moveCursorSelection(), QDeclarativeTextEdit::moveCursorSelection(), QDeclarativeTextInput::positionAt(), QDeclarativeTextEdit::positionAt(), QDeclarativeTextEdit::select(), setCursor(), QDeclarativeTextEdit::setCursorPosition(), and QDeclarativeTextEditPrivate::updateSelection().
QVariant QGraphicsItem::data | ( | int | key | ) | const |
Returns this item's custom data for the key key as a QVariant.
Custom item data is useful for storing arbitrary properties in any item. Example:
Qt does not use this feature for storing data; it is provided solely for the convenience of the user.
Definition at line 6959 of file qgraphicsitem.cpp.
Referenced by QGraphicsWidget::close(), QDeclarativeImplicitSizePaintedItem::drawContents(), QmlJSDebugger::isEditorItem(), QDeclarativeGestureAreaParser::setCustomData(), and QmlJSDebugger::LiveSelectionIndicator::setItems().
QTransform QGraphicsItem::deviceTransform | ( | const QTransform & | viewportTransform | ) | const |
Returns this item's device transformation matrix, using viewportTransform to map from scene to device coordinates.
This matrix can be used to map coordinates and geometrical shapes from this item's local coordinate system to the viewport's (or any device's) coordinate system. To map coordinates from the viewport, you must first invert the returned matrix.
Example:
This function is the same as combining this item's scene transform with the view's viewport transform, but it also understands the ItemIgnoresTransformations flag. The device transform can be used to do accurate coordinate mapping (and collision detection) for untransformable items.
Definition at line 4463 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::drawSubtreeRecursive(), QGraphicsSceneIndexRectIntersector::intersect(), QGraphicsSceneIndexPointIntersector::intersect(), QGraphicsSceneIndexPathIntersector::intersect(), QGraphicsViewPrivate::mapToViewRect(), QGraphicsViewPrivate::mapToViewRegion(), mouseMoveEvent(), QGraphicsView::paintEvent(), QGraphicsViewPrivate::setUpdateClip(), and updateHelper().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive drag enter events for this item.
Drag enter events are generated as the cursor enters the item's area.
By accepting the event, (i.e., by calling QEvent::accept(),) the item will accept drop events, in addition to receiving drag move and drag leave. Otherwise, the event will be ignored and propagate to the item beneath. If the event is accepted, the item will receive a drag move event before control goes back to the event loop.
A common implementation of dragEnterEvent accepts or ignores event depending on the associated mime data in event. Example:
Items do not receive drag and drop events by default; to enable this feature, call setAcceptDrops(true)
.
The default implementation does nothing.
Reimplemented in QGraphicsTextItem, and QGraphicsProxyWidget.
Definition at line 7276 of file qgraphicsitem.cpp.
Referenced by sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive drag leave events for this item.
Drag leave events are generated as the cursor leaves the item's area. Most often you will not need to reimplement this function, but it can be useful for resetting state in your item (e.g., highlighting).
Calling QEvent::ignore() or QEvent::accept() on event has no effect.
Items do not receive drag and drop events by default; to enable this feature, call setAcceptDrops(true)
.
The default implementation does nothing.
Reimplemented in QGraphicsTextItem, and QGraphicsProxyWidget.
Definition at line 7300 of file qgraphicsitem.cpp.
Referenced by sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive drag move events for this item.
Drag move events are generated as the cursor moves around inside the item's area. Most often you will not need to reimplement this function; it is used to indicate that only parts of the item can accept drops.
Calling QEvent::ignore() or QEvent::accept() on event toggles whether or not the item will accept drops at the position from the event. By default, event is accepted, indicating that the item allows drops at the specified position.
Items do not receive drag and drop events by default; to enable this feature, call setAcceptDrops(true)
.
The default implementation does nothing.
Reimplemented in QGraphicsTextItem, and QGraphicsProxyWidget.
Definition at line 7327 of file qgraphicsitem.cpp.
Referenced by sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive drop events for this item.
Items can only receive drop events if the last drag move event was accepted.
Calling QEvent::ignore() or QEvent::accept() on event has no effect.
Items do not receive drag and drop events by default; to enable this feature, call setAcceptDrops(true)
.
The default implementation does nothing.
Reimplemented in QGraphicsTextItem, and QGraphicsProxyWidget.
Definition at line 7349 of file qgraphicsitem.cpp.
Referenced by sceneEvent().
qreal QGraphicsItem::effectiveOpacity | ( | ) | const |
Returns this item's effective opacity, which is between 0.
0 (transparent) and 1.0 (opaque). This value is a combination of this item's local opacity, and its parent and ancestors' opacities. The effective opacity decides how the item is rendered.
Definition at line 2819 of file qgraphicsitem.cpp.
Referenced by ShaderEffectItem::updateEffectState().
void QGraphicsItem::ensureVisible | ( | const QRectF & | rect = QRectF() , |
int | xmargin = 50 , |
||
int | ymargin = 50 |
||
) |
If this item is part of a scene that is viewed by a QGraphicsView, this convenience function will attempt to scroll the view to ensure that rect is visible inside the view's viewport.
If rect is a null rect (the default), QGraphicsItem will default to the item's bounding rect. xmargin and ymargin are the number of pixels the view should use for margins.
If the specified rect cannot be reached, the contents are scrolled to the nearest valid position.
If this item is not viewed by a QGraphicsView, this function does nothing.
Definition at line 4015 of file qgraphicsitem.cpp.
|
inline |
This convenience function is equivalent to calling ensureVisible(QRectF(x, y, w, h), xmargin, ymargin):
Definition at line 503 of file qgraphicsitem.h.
Note: This is provided as a hook to avoid future problems related to adding virtual functions.
Reimplemented in QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, and QGraphicsPathItem.
Definition at line 7920 of file qgraphicsitem.cpp.
bool QGraphicsItem::filtersChildEvents | ( | ) | const |
Returns true if this item filters child events (i.
e., all events intended for any of its children are instead sent to this item); otherwise, false is returned.
The default value is false; child events are not filtered.
Definition at line 3261 of file qgraphicsitem.cpp.
QGraphicsItem::GraphicsItemFlags QGraphicsItem::flags | ( | ) | const |
Returns this item's flags.
The flags describe what configurable features of the item are enabled and not. For example, if the flags include ItemIsFocusable, the item can accept input focus.
By default, no flags are enabled.
Definition at line 1890 of file qgraphicsitem.cpp.
Referenced by _q_qgraphicsItemSetFlag(), _qt_movableAncestorIsSelected(), QGraphicsItemPrivate::clearFocusHelper(), QGraphicsSceneBspTreeIndexPrivate::climbTree(), collidesWithItem(), QDeclarativeKeysAttached::componentComplete(), QDeclarativeItemPrivate::data(), QDeclarativeTextInput::drawContents(), QGraphicsScene::focusNextPrevChild(), QDeclarativeItem::forceActiveFocus(), QDeclarativeItem::hasFocus(), QDeclarativeKeysAttached::inputMethodEvent(), QDeclarativeKeysAttached::inputMethodQuery(), mouseMoveEvent(), mousePressEvent(), QGraphicsTextItem::mousePressEvent(), QGraphicsScenePrivate::mousePressEventHandler(), mouseReleaseEvent(), QGraphicsItemPrivate::movableAncestorIsSelected(), operator<<(), QGraphicsScenePrivate::removeItemHelper(), QGraphicsItemPrivate::sendScenePosChange(), QGraphicsScenePrivate::sendTouchBeginEvent(), setFlags(), QGraphicsItemPrivate::setFocusHelper(), QGraphicsScenePrivate::setFocusItemHelper(), QDeclarativeTextEdit::setReadOnly(), QGraphicsScene::setSelectionArea(), QGraphicsTextItem::setTextInteractionFlags(), QGraphicsItemPrivate::setVisibleHelper(), QmlJSDebugger::AbstractLiveEditTool::topMovableGraphicsItem(), QGraphicsScene::wheelEvent(), and ~QGraphicsItem().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive focus in events for this item.
The default implementation calls ensureVisible().
Reimplemented in QGraphicsTextItem, QDeclarativeTextEdit, QDeclarativeTextInput, QGraphicsWidget, and QGraphicsProxyWidget.
Definition at line 7364 of file qgraphicsitem.cpp.
Referenced by QDeclarativeTextInput::focusInEvent(), QDeclarativeTextEdit::focusInEvent(), and sceneEvent().
QGraphicsItem * QGraphicsItem::focusItem | ( | ) | const |
If this item, a child or descendant of this item currently has input focus, this function will return a pointer to that item.
If no descendant has input focus, 0 is returned.
Definition at line 3646 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::addItem(), QDeclarativeItemPrivate::focusChanged(), QDeclarativeItem::hasActiveFocus(), QGraphicsScenePrivate::mousePressEventHandler(), QGraphicsScenePrivate::sendTouchBeginEvent(), QGraphicsScenePrivate::setActivePanelHelper(), QGraphicsItemPrivate::setEnabledHelper(), QGraphicsItemPrivate::setFocusHelper(), QGraphicsItemPrivate::setParentItemHelper(), and QGraphicsItemPrivate::setVisibleHelper().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive focus out events for this item.
The default implementation does nothing.
Reimplemented in QGraphicsTextItem, QGraphicsWidget, and QGraphicsProxyWidget.
Definition at line 7376 of file qgraphicsitem.cpp.
Referenced by sceneEvent().
QGraphicsItem * QGraphicsItem::focusProxy | ( | ) | const |
Returns this item's focus proxy, or 0 if this item has no focus proxy.
Definition at line 3578 of file qgraphicsitem.cpp.
Referenced by QDeclarativeKeysAttachedPrivate::finalFocusProxy(), and setFocusProxy().
QGraphicsItem * QGraphicsItem::focusScopeItem | ( | ) | const |
Returns this item's focus scope item.
Definition at line 3659 of file qgraphicsitem.cpp.
Referenced by QDeclarativeItem::hasFocus().
void QGraphicsItem::grabKeyboard | ( | ) |
Grabs the keyboard input.
The item will receive all keyboard input to the scene until one of the following events occur:
When an item gains the keyboard grab, it receives a QEvent::GrabKeyboard event. When it loses the keyboard grab, it receives a QEvent::UngrabKeyboard event. These events can be used to detect when your item gains or loses the keyboard grab through other means than gaining input focus.
It is almost never necessary to explicitly grab the keyboard in Qt, as Qt grabs and releases it sensibly. In particular, Qt grabs the keyboard when your item gains input focus, and releases it when your item loses input focus, or when the item is hidden.
Note that only visible items can grab keyboard input. Calling grabKeyboard() on an invisible item has no effect.
Keyboard events are not affected.
Definition at line 3769 of file qgraphicsitem.cpp.
void QGraphicsItem::grabMouse | ( | ) |
Grabs the mouse input.
This item will receive all mouse events for the scene until any of the following events occurs:
When an item gains the mouse grab, it receives a QEvent::GrabMouse event. When it loses the mouse grab, it receives a QEvent::UngrabMouse event. These events can be used to detect when your item gains or loses the mouse grab through other means than receiving mouse button events.
It is almost never necessary to explicitly grab the mouse in Qt, as Qt grabs and releases it sensibly. In particular, Qt grabs the mouse when you press a mouse button, and keeps the mouse grabbed until you release the last mouse button. Also, Qt::Popup widgets implicitly call grabMouse() when shown, and ungrabMouse() when hidden.
Note that only visible items can grab mouse input. Calling grabMouse() on an invisible item has no effect.
Keyboard events are not affected.
Definition at line 3701 of file qgraphicsitem.cpp.
Referenced by QDeclarativePathView::sendMouseEvent(), QDeclarativeMouseArea::sendMouseEvent(), QDeclarativeFlickable::sendMouseEvent(), QDeclarativePinchArea::sendMouseEvent(), and QDeclarativePinchArea::updatePinch().
QGraphicsEffect * QGraphicsItem::graphicsEffect | ( | ) | const |
Returns a pointer to this item's effect if it has one; otherwise 0.
Definition at line 2892 of file qgraphicsitem.cpp.
Referenced by ShaderEffectSource::attachSourceItem(), ShaderEffectSource::detachSourceItem(), QGraphicsItemPrivate::effectiveBoundingRect(), and ShaderEffectSource::markSourceItemDirty().
QGraphicsItemGroup * QGraphicsItem::group | ( | ) | const |
Returns a pointer to this item's item group, or 0 if this item is not member of a group.
Definition at line 1594 of file qgraphicsitem.cpp.
Referenced by isSelected(), QGraphicsItemGroup::removeFromGroup(), setGroup(), and setSelected().
bool QGraphicsItem::handlesChildEvents | ( | ) | const |
Returns true if this item handles child events (i.
e., all events intended for any of its children are instead sent to this item); otherwise, false is returned.
This property is useful for item groups; it allows one item to handle events on behalf of its children, as opposed to its children handling their events individually.
The default is to return false; children handle their own events. The exception for this is if the item is a QGraphicsItemGroup, then it defaults to return true.
Definition at line 3309 of file qgraphicsitem.cpp.
bool QGraphicsItem::hasCursor | ( | ) | const |
Returns true if this item has a cursor set; otherwise, false is returned.
By default, items don't have any cursor set. cursor() will return a standard pointing arrow cursor.
Definition at line 2309 of file qgraphicsitem.cpp.
Referenced by QGraphicsViewPrivate::_q_unsetViewportCursor(), QGraphicsViewPrivate::mouseMoveEventHandler(), and setCursor().
bool QGraphicsItem::hasFocus | ( | ) | const |
Returns true if this item is active, and it or its focus proxy has keyboard input focus; otherwise, returns false.
Definition at line 3409 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemPrivate::clearFocusHelper(), QGraphicsWidget::close(), QGraphicsProxyWidget::contextMenuEvent(), QGraphicsWidget::focusNextPrevChild(), hasFocus(), QWidget::hasFocus(), QGraphicsWidget::initStyleOption(), QGraphicsTextItem::mouseDoubleClickEvent(), QGraphicsWidget::paintWindowFrame(), setFlags(), QGraphicsWidget::setFocusPolicy(), setInputMethodHints(), and QGraphicsItemPrivate::setVisibleHelper().
|
inline |
Hides the item.
(Items are visible by default.)
This convenience function is equivalent to calling setVisible(false)
.
Definition at line 222 of file qgraphicsitem.h.
Referenced by QGraphicsWidget::close(), QmlJSDebugger::BoundingRectHighlighter::freeBoundingBox(), QmlJSDebugger::LiveSelectionRectangle::hide(), QmlJSDebugger::LiveSelectionIndicator::hide(), ShaderEffectSource::hideSource(), and ShaderEffectSource::setHideSource().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive hover enter events for this item.
The default implementation calls update(); otherwise it does nothing.
Calling QEvent::ignore() or QEvent::accept() on event has no effect.
Reimplemented in QGraphicsTextItem, QDeclarativeMouseArea, and QGraphicsProxyWidget.
Definition at line 7391 of file qgraphicsitem.cpp.
Referenced by QDeclarativeMouseArea::hoverEnterEvent(), and sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive hover leave events for this item.
The default implementation calls update(); otherwise it does nothing.
Calling QEvent::ignore() or QEvent::accept() on event has no effect.
Reimplemented in QGraphicsTextItem, QGraphicsWidget, QDeclarativeMouseArea, and QGraphicsProxyWidget.
Definition at line 7419 of file qgraphicsitem.cpp.
Referenced by QDeclarativeMouseArea::hoverLeaveEvent(), and sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive hover move events for this item.
The default implementation does nothing.
Calling QEvent::ignore() or QEvent::accept() on event has no effect.
Reimplemented in QGraphicsTextItem, QGraphicsWidget, QDeclarativeMouseArea, and QGraphicsProxyWidget.
Definition at line 7405 of file qgraphicsitem.cpp.
Referenced by QDeclarativeMouseArea::hoverMoveEvent(), and sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive input method events for this item.
The default implementation ignores the event.
Reimplemented in QGraphicsTextItem, QDeclarativeTextEdit, QDeclarativeTextInput, and QDeclarativeItem.
Definition at line 7752 of file qgraphicsitem.cpp.
Referenced by sceneEvent().
Qt::InputMethodHints QGraphicsItem::inputMethodHints | ( | ) | const |
Returns the current input method hints of this item.
Input method hints are only relevant for input items. The hints are used by the input method to indicate how it should operate. For example, if the Qt::ImhNumbersOnly flag is set, the input method may change its visual components to reflect that only numbers can be entered.
The effect may vary between input method implementations.
Definition at line 7793 of file qgraphicsitem.cpp.
Referenced by QDeclarativeTextInputPrivate::updateInputMethodHints().
|
protectedvirtual |
This method is only relevant for input items.
It is used by the input method to query a set of properties of the item to be able to support complex input method operations, such as support for surrounding text and reconversions. query specifies which property is queried.
Reimplemented in QGraphicsTextItem, QDeclarativeTextInput, QDeclarativeTextEdit, and QDeclarativeItem.
Definition at line 7766 of file qgraphicsitem.cpp.
Referenced by QDeclarativeItemAccessor::doInputMethodQuery(), and QDeclarativeItem::inputMethodQuery().
void QGraphicsItem::installSceneEventFilter | ( | QGraphicsItem * | filterItem | ) |
Installs an event filter for this item on filterItem, causing all events for this item to first pass through filterItem's sceneEventFilter() function.
To filter another item's events, install this item as an event filter for the other item. Example:
An item can only filter events for other items in the same scene. Also, an item cannot filter its own events; instead, you can reimplement sceneEvent() directly.
Items must belong to a scene for scene event filters to be installed and used.
Definition at line 7037 of file qgraphicsitem.cpp.
bool QGraphicsItem::isActive | ( | ) | const |
Returns true if this item is active; otherwise returns false.
An item can only be active if the scene is active. An item is active if it is, or is a descendent of, an active panel. Items in non-active panels are not active.
Items that are not part of a panel follow scene activation when the scene has no active panel.
Only active items can gain input focus.
Definition at line 3363 of file qgraphicsitem.cpp.
Referenced by QGraphicsWidget::isActiveWindow(), QGraphicsWidget::paintWindowFrame(), and QGraphicsItemPrivate::setFocusHelper().
bool QGraphicsItem::isAncestorOf | ( | const QGraphicsItem * | child | ) | const |
Returns true if this item is an ancestor of child (i.e., if this item is child's parent, or one of child's parent's ancestors).
Definition at line 6872 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::cancelGesturesForChildren(), QGraphicsItemPrivate::clearSubFocus(), collidesWithItem(), QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(), QGraphicsScene::focusNextPrevChild(), isBlockedByModalPanel(), itemTransform(), QGraphicsItemPrivate::setParentItemHelper(), and QGraphicsItemPrivate::setVisibleHelper().
bool QGraphicsItem::isBlockedByModalPanel | ( | QGraphicsItem ** | blockingPanel = 0 | ) | const |
Returns true if this item is blocked by a modal panel, false otherwise.
If blockingPanel is non-zero, blockingPanel will be set to the modal panel that is blocking this item. If this item is not blocked, blockingPanel will not be set by this function.
This function always returns false for items not in a scene.
Definition at line 2175 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::enterModal(), QGraphicsScenePrivate::itemAcceptsHoverEvents_helper(), QGraphicsScene::keyPressEvent(), QGraphicsScene::keyReleaseEvent(), QGraphicsScenePrivate::leaveModal(), QGraphicsScenePrivate::mousePressEventHandler(), and QGraphicsScenePrivate::sendMouseEvent().
bool QGraphicsItem::isClipped | ( | ) | const |
Returns true if this item is clipped.
An item is clipped if it has either set the ItemClipsToShape flag, or if it or any of its ancestors has set the ItemClipsChildrenToShape flag.
Clipping affects the item's appearance (i.e., painting), as well as mouse and hover event delivery.
Definition at line 5185 of file qgraphicsitem.cpp.
Referenced by clipPath(), collidesWithItem(), collidesWithPath(), contains(), QGraphicsView::fitInView(), and QAbstractGraphicsShapeItem::opaqueArea().
bool QGraphicsItem::isEnabled | ( | ) | const |
Returns true if the item is enabled; otherwise, false is returned.
Definition at line 2604 of file qgraphicsitem.cpp.
Referenced by QShortcutMap::correctGraphicsWidgetContext(), QGraphicsScene::dragMoveEvent(), QGraphicsScene::focusNextPrevChild(), QGraphicsWidget::initStyleOption(), QGraphicsProxyWidget::itemChange(), QGraphicsScenePrivate::mousePressEventHandler(), QDeclarativeFlickable::sceneEventFilter(), QGraphicsScenePrivate::sendEvent(), QDeclarativeFlickable::sendMouseEvent(), QGraphicsScenePrivate::sendTouchBeginEvent(), QGraphicsScenePrivate::setFocusItemHelper(), QDeclarativeKeyNavigationAttached::setFocusNavigation(), and QGraphicsScene::wheelEvent().
bool QGraphicsItem::isObscured | ( | ) | const |
Returns true if this item's bounding rect is completely obscured by the opaque shape of any of colliding items above it (i.e., with a higher Z value than this item).
Its implementation is based on calling isObscuredBy(), which you can reimplement to provide a custom obscurity algorithm.
Definition at line 5412 of file qgraphicsitem.cpp.
bool QGraphicsItem::isObscured | ( | const QRectF & | rect | ) | const |
Returns true if rect is completely obscured by the opaque shape of any of colliding items above it (i.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
e., with a higher Z value than this item).
Unlike the default isObscured() function, this function does not call isObscuredBy(). \sa opaqueArea()
Definition at line 5452 of file qgraphicsitem.cpp.
This convenience function is equivalent to calling isObscured(QRectF(x, y, w, h)).
Definition at line 507 of file qgraphicsitem.h.
|
virtual |
Returns true if this item's bounding rect is completely obscured by the opaque shape of item.
The base implementation maps item's opaqueArea() to this item's coordinate system, and then checks if this item's boundingRect() is fully contained within the mapped shape.
You can reimplement this function to provide a custom algorithm for determining whether this item is obscured by item.
Reimplemented in QGraphicsItemGroup, QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, QGraphicsPathItem, and QAbstractGraphicsShapeItem.
Definition at line 5493 of file qgraphicsitem.cpp.
Referenced by QAbstractGraphicsShapeItem::isObscuredBy(), QGraphicsLineItem::isObscuredBy(), QGraphicsPixmapItem::isObscuredBy(), QGraphicsTextItem::isObscuredBy(), QGraphicsItemGroup::isObscuredBy(), and QGraphicsLineItem::setLine().
bool QGraphicsItem::isPanel | ( | ) | const |
Returns true if the item is a panel; otherwise returns false.
Definition at line 1876 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::addItem(), QGraphicsItemPrivate::clearSubFocus(), QGraphicsScenePrivate::dispatchHoverEvent(), QGraphicsScenePrivate::enterModal(), QGraphicsScene::event(), QGraphicsScene::focusNextPrevChild(), QGraphicsScenePrivate::gestureEventHandler(), QGraphicsScene::keyPressEvent(), QGraphicsScene::keyReleaseEvent(), QGraphicsScenePrivate::leaveModal(), QGraphicsScenePrivate::mousePressEventHandler(), QGraphicsScenePrivate::removeItemHelper(), sceneEvent(), QGraphicsScenePrivate::sendTouchBeginEvent(), QGraphicsScenePrivate::setActivePanelHelper(), QGraphicsItemPrivate::setEnabledHelper(), setPanelModality(), QGraphicsItemPrivate::setSubFocus(), QGraphicsItemPrivate::setVisibleHelper(), and QGraphicsScene::wheelEvent().
bool QGraphicsItem::isSelected | ( | ) | const |
Returns true if this item is selected; otherwise, false is returned.
Items that are in a group inherit the group's selected state.
Items are not selected by default.
Definition at line 2714 of file qgraphicsitem.cpp.
Referenced by _qt_movableAncestorIsSelected(), QGraphicsScene::addItem(), isSelected(), mouseReleaseEvent(), QGraphicsItemPrivate::movableAncestorIsSelected(), QGraphicsScene::selectedItems(), setFlags(), and QGraphicsScene::setSelectionArea().
bool QGraphicsItem::isUnderMouse | ( | ) | const |
Returns true if this item is currently under the mouse cursor in one of the views; otherwise, false is returned.
Definition at line 6932 of file qgraphicsitem.cpp.
Referenced by QGraphicsWidget::initStyleOption(), QDeclarativeMouseArea::itemChange(), and QDeclarativeMouseArea::setHoverEnabled().
bool QGraphicsItem::isVisible | ( | ) | const |
Returns true if the item is visible; otherwise, false is returned.
Note that the item's general visibility is unrelated to whether or not it is actually being visualized by a QGraphicsView.
Definition at line 2343 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::addItem(), QGraphicsWidget::close(), QShortcutMap::correctGraphicsWidgetContext(), QDeclarativeGrid::doPositioning(), QGraphicsScene::event(), QDeclarativePinchArea::event(), ShaderEffectItem::handleVisibilityChange(), QDeclarativeItem::hasActiveFocus(), QDeclarativeKeysAttached::inputMethodEvent(), QDeclarativeKeysAttached::inputMethodQuery(), QGraphicsProxyWidget::itemChange(), QDeclarativeMouseArea::itemChange(), QDeclarativeKeysAttached::keyPressed(), QDeclarativeKeysAttached::keyReleased(), QGraphicsScenePrivate::removeItemHelper(), QGraphicsScenePrivate::removePopup(), sceneEvent(), QDeclarativePathView::sceneEventFilter(), QDeclarativeFlickable::sceneEventFilter(), QDeclarativeMouseArea::sceneEventFilter(), QDeclarativePinchArea::sceneEventFilter(), QGraphicsScenePrivate::setActivePanelHelper(), QGraphicsItemPrivate::setFocusHelper(), QGraphicsScenePrivate::setFocusItemHelper(), QDeclarativeKeyNavigationAttached::setFocusNavigation(), setPanelModality(), QGraphicsItemPrivate::setVisibleHelper(), QGraphicsWidget::setWindowFlags(), ShaderEffectItem::ShaderEffectItem(), and QGraphicsWidget::updateGeometry().
bool QGraphicsItem::isVisibleTo | ( | const QGraphicsItem * | parent | ) | const |
Returns true if the item is visible to parent; otherwise, false is returned.
An item may not be visible to its ancestors even if isVisible() is true. It may also be visible to its ancestors even if isVisible() is false. If any ancestor is hidden, the item itself will be implicitly hidden, in which case this function will return false.
Definition at line 2364 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::focusNextPrevChild().
bool QGraphicsItem::isWidget | ( | ) | const |
Returns true if this item is a widget (i.
Definition at line 1847 of file qgraphicsitem.cpp.
Referenced by _q_paintItem(), QDeclarativeLoaderPrivate::_q_updateSize(), QGraphicsLayoutPrivate::addChildLayoutItem(), QGraphicsScene::addItem(), QShortcutMap::correctGraphicsWidgetContext(), QGraphicsScenePrivate::drawItemHelper(), QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(), QGraphicsScene::focusNextPrevChild(), QDeclarativeLoaderPrivate::initResize(), inputMethodQuery(), QGraphicsWidget::itemChange(), QGraphicsSceneIndexPrivate::itemCollidesWithPath(), QGraphicsScenePrivate::mousePressEventHandler(), parentWidget(), QGraphicsLayout::QGraphicsLayout(), QGraphicsLayoutPrivate::reparentChildItems(), QGraphicsScenePrivate::sendTouchBeginEvent(), QGraphicsItemPrivate::setEnabledHelper(), QGraphicsWidgetPrivate::setLayoutDirection_helper(), QGraphicsItemPrivate::setParentItemHelper(), QGraphicsScene::setStyle(), QGraphicsItemPrivate::setVisibleHelper(), QGraphicsGridLayoutPrivate::styleInfo(), QGraphicsLinearLayoutPrivate::styleInfo(), QGraphicsAnchorLayoutPrivate::styleInfo(), topLevelWidget(), QGraphicsProxyWidgetPrivate::unembedSubWindow(), QGraphicsWidgetPrivate::updateFont(), QGraphicsWidgetPrivate::updatePalette(), QGraphicsScene::wheelEvent(), and QGraphicsWidget::~QGraphicsWidget().
bool QGraphicsItem::isWindow | ( | ) | const |
Returns true if the item is a QGraphicsWidget window, otherwise returns false.
Definition at line 1862 of file qgraphicsitem.cpp.
Referenced by _q_paintItem(), QGraphicsProxyWidget::event(), QGraphicsWidget::focusNextPrevChild(), QGraphicsWidget::initStyleOption(), QGraphicsSceneIndexPrivate::itemCollidesWithPath(), QGraphicsScene::setActiveWindow(), QGraphicsWidgetPrivate::updateFont(), QGraphicsWidgetPrivate::updatePalette(), and window().
|
protectedvirtual |
This virtual function is called by QGraphicsItem to notify custom items that some part of the item's state changes.
By reimplementing this function, your can react to a change, and in some cases, (depending on change,) adjustments can be made.
change is the parameter of the item that is changing. value is the new value; the type of the value depends on change.
Example:
The default implementation does nothing, and returns value.
Note: Certain QGraphicsItem functions cannot be called in a reimplementation of this function; see the GraphicsItemChange documentation for details.
Reimplemented in QDeclarativePinchArea, QDeclarativeMouseArea, QGraphicsWidget, QDeclarativeItem, QDeclarativePaintedItem, QDeclarativeLoader, QDeclarativeRepeater, QDeclarativeBasePositioner, and QGraphicsProxyWidget.
Definition at line 7875 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::_q_polishItems(), QGraphicsScene::addItem(), QDeclarativeItem::itemChange(), QGraphicsWidget::itemChange(), QGraphicsScene::removeItem(), QGraphicsItemPrivate::sendScenePosChange(), setCursor(), setFlags(), setMatrix(), setOpacity(), setParentItem(), setPos(), setRotation(), setScale(), setSelected(), setToolTip(), setTransform(), setTransformOriginPoint(), QGraphicsItemPrivate::setVisibleHelper(), and setZValue().
QTransform QGraphicsItem::itemTransform | ( | const QGraphicsItem * | other, |
bool * | ok = 0 |
||
) | const |
Returns a QTransform that maps coordinates from this item to other.
If ok is not null, and if there is no such transform, the boolean pointed to by ok will be set to false; otherwise it will be set to true.
This transform provides an alternative to the mapToItem() or mapFromItem() functions, by returning the appropriate transform so that you can map shapes and coordinates yourself. It also helps you write more efficient code when repeatedly mapping between the same two items.
Definition at line 4530 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), clipPath(), QDeclarativeParentChangePrivate::doChange(), itemTransform(), mapFromItem(), mapRectFromItem(), mapRectToItem(), mapToItem(), mouseMoveEvent(), QGraphicsItemGroup::removeFromGroup(), and QDeclarativeParentAnimation::transition().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive key press events for this item.
The default implementation ignores the event. If you reimplement this handler, the event will by default be accepted.
Note that key events are only received for items that set the ItemIsFocusable flag, and that have keyboard input focus.
Reimplemented in QGraphicsTextItem, QDeclarativeTextEdit, QDeclarativeTextInput, QDeclarativeListView, QDeclarativeGridView, QDeclarativeItem, and QGraphicsProxyWidget.
Definition at line 7437 of file qgraphicsitem.cpp.
Referenced by sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive key release events for this item.
The default implementation ignores the event. If you reimplement this handler, the event will by default be accepted.
Note that key events are only received for items that set the ItemIsFocusable flag, and that have keyboard input focus.
Reimplemented in QGraphicsTextItem, QDeclarativeTextEdit, QDeclarativeItem, and QGraphicsProxyWidget.
Definition at line 7454 of file qgraphicsitem.cpp.
Referenced by sceneEvent().
QPointF QGraphicsItem::mapFromItem | ( | const QGraphicsItem * | item, |
const QPointF & | point | ||
) | const |
Maps the point point, which is in item's coordinate system, to this item's coordinate system, and returns the mapped coordinate.
If item is 0, this function returns the same as mapFromScene().
Definition at line 6633 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), collidesWithItem(), and QGraphicsItemPrivate::remapItemPos().
QPolygonF QGraphicsItem::mapFromItem | ( | const QGraphicsItem * | item, |
const QRectF & | rect | ||
) | const |
Maps the rectangle rect, which is in item's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.
If item is 0, this function returns the same as mapFromScene()
Definition at line 6711 of file qgraphicsitem.cpp.
QPolygonF QGraphicsItem::mapFromItem | ( | const QGraphicsItem * | item, |
const QPolygonF & | polygon | ||
) | const |
Maps the polygon polygon, which is in item's coordinate system, to this item's coordinate system, and returns the mapped polygon.
If item is 0, this function returns the same as mapFromScene().
Definition at line 6785 of file qgraphicsitem.cpp.
QPainterPath QGraphicsItem::mapFromItem | ( | const QGraphicsItem * | item, |
const QPainterPath & | path | ||
) | const |
Maps the path path, which is in item's coordinate system, to this item's coordinate system, and returns the mapped path.
If item is 0, this function returns the same as mapFromScene().
Definition at line 6830 of file qgraphicsitem.cpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This convenience function is equivalent to calling mapFromItem(item, QPointF(x, y)).
Definition at line 515 of file qgraphicsitem.h.
|
inline |
This convenience function is equivalent to calling mapFromItem(item, QRectF(x, y, w, h)).
Definition at line 533 of file qgraphicsitem.h.
Maps the point point, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped coordinate.
Definition at line 6656 of file qgraphicsitem.cpp.
Maps the rectangle rect, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.
Definition at line 6733 of file qgraphicsitem.cpp.
Maps the polygon polygon, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped polygon.
Definition at line 6799 of file qgraphicsitem.cpp.
QPainterPath QGraphicsItem::mapFromParent | ( | const QPainterPath & | path | ) | const |
Maps the path path, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped path.
Definition at line 6844 of file qgraphicsitem.cpp.
This convenience function is equivalent to calling mapFromParent(QPointF(x, y)).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 517 of file qgraphicsitem.h.
This convenience function is equivalent to calling mapFromItem(QRectF(x, y, w, h)).
Definition at line 535 of file qgraphicsitem.h.
Maps the point point, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped coordinate.
Definition at line 6683 of file qgraphicsitem.cpp.
Referenced by QGraphicsProxyWidget::event(), QDeclarativeMouseArea::geometryChanged(), isUnderMouse(), mapFromItem(), QDeclarativeMouseArea::mouseMoveEvent(), mouseMoveEvent(), QmlJSDebugger::LiveSelectionRectangle::rect(), QDeclarativePathView::sendMouseEvent(), QDeclarativeMouseArea::sendMouseEvent(), QDeclarativeFlickable::sendMouseEvent(), QDeclarativePinchArea::sendMouseEvent(), QDeclarativePinchArea::updatePinch(), and QGraphicsScenePrivate::updateTouchPointsForItem().
Maps the rectangle rect, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.
Definition at line 6759 of file qgraphicsitem.cpp.
Maps the polygon polygon, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped polygon.
Definition at line 6814 of file qgraphicsitem.cpp.
QPainterPath QGraphicsItem::mapFromScene | ( | const QPainterPath & | path | ) | const |
Maps the path path, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped path.
Definition at line 6859 of file qgraphicsitem.cpp.
This convenience function is equivalent to calling mapFromScene(QPointF(x, y)).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 519 of file qgraphicsitem.h.
This convenience function is equivalent to calling mapFromScene(QRectF(x, y, w, h)).
Definition at line 537 of file qgraphicsitem.h.
QRectF QGraphicsItem::mapRectFromItem | ( | const QGraphicsItem * | item, |
const QRectF & | rect | ||
) | const |
Maps the rectangle rect, which is in item's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a new rectangle (i.
e., the bounding rectangle of the resulting polygon).
If \a item is 0, this function returns the same as mapRectFromScene(). \sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System}
Definition at line 6454 of file qgraphicsitem.cpp.
|
inline |
This convenience function is equivalent to calling mapRectFromItem(item, QRectF(x, y, w, h)).
Definition at line 539 of file qgraphicsitem.h.
Maps the rectangle rect, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a new rectangle (i.
e., the bounding rectangle of the resulting polygon).
Definition at line 6482 of file qgraphicsitem.cpp.
This convenience function is equivalent to calling mapRectFromParent(QRectF(x, y, w, h)).
Definition at line 541 of file qgraphicsitem.h.
Maps the rectangle rect, which is in scene coordinates, to this item's coordinate system, and returns the mapped rectangle as a new rectangle (i.
e., the bounding rectangle of the resulting polygon).
\sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System}
Definition at line 6513 of file qgraphicsitem.cpp.
Referenced by QmlJSDebugger::BoundingRectHighlighter::highlightAll(), mapRectFromItem(), and QmlJSDebugger::LiveSelectionIndicator::setItems().
This convenience function is equivalent to calling mapRectFromScene(QRectF(x, y, w, h)).
Definition at line 543 of file qgraphicsitem.h.
QRectF QGraphicsItem::mapRectToItem | ( | const QGraphicsItem * | item, |
const QRectF & | rect | ||
) | const |
Maps the rectangle rect, which is in this item's coordinate system, to item's coordinate system, and returns the mapped rectangle as a new rectangle (i.
e., the bounding rectangle of the resulting polygon).
If \a item is 0, this function returns the same as mapRectToScene(). \sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System}
Definition at line 6364 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemPrivate::effectiveBoundingRect().
|
inline |
This convenience function is equivalent to calling mapRectToItem(item, QRectF(x, y, w, h)).
Definition at line 527 of file qgraphicsitem.h.
Maps the rectangle rect, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped rectangle as a new rectangle (i.
e., the bounding rectangle of the resulting polygon).
\sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System}
Definition at line 6391 of file qgraphicsitem.cpp.
This convenience function is equivalent to calling mapRectToParent(QRectF(x, y, w, h)).
Definition at line 529 of file qgraphicsitem.h.
Maps the rectangle rect, which is in this item's coordinate system, to the scene coordinate system, and returns the mapped rectangle as a new rectangle (i.
e., the bounding rectangle of the resulting polygon).
\sa itemTransform(), mapToParent(), mapToScene(), mapFromItem(), {The Graphics View Coordinate System}
Definition at line 6422 of file qgraphicsitem.cpp.
Referenced by mapRectToItem(), QmlJSDebugger::SubcomponentMaskLayerItem::setCurrentItem(), and QmlJSDebugger::LiveSelectionIndicator::setItems().
This convenience function is equivalent to calling mapRectToScene(QRectF(x, y, w, h)).
Definition at line 531 of file qgraphicsitem.h.
QPointF QGraphicsItem::mapToItem | ( | const QGraphicsItem * | item, |
const QPointF & | point | ||
) | const |
Maps the point point, which is in this item's coordinate system, to item's coordinate system, and returns the mapped coordinate.
If item is 0, this function returns the same as mapToScene().
Definition at line 6208 of file qgraphicsitem.cpp.
Referenced by qt_QGraphicsItem_isObscured(), and QGraphicsItemGroup::removeFromGroup().
QPolygonF QGraphicsItem::mapToItem | ( | const QGraphicsItem * | item, |
const QRectF & | rect | ||
) | const |
Maps the rectangle rect, which is in this item's coordinate system, to item's coordinate system, and returns the mapped rectangle as a polygon.
If item is 0, this function returns the same as mapToScene().
Definition at line 6284 of file qgraphicsitem.cpp.
QPolygonF QGraphicsItem::mapToItem | ( | const QGraphicsItem * | item, |
const QPolygonF & | polygon | ||
) | const |
Maps the polygon polygon, which is in this item's coordinate system, to item's coordinate system, and returns the mapped polygon.
If item is 0, this function returns the same as mapToScene().
Definition at line 6539 of file qgraphicsitem.cpp.
QPainterPath QGraphicsItem::mapToItem | ( | const QGraphicsItem * | item, |
const QPainterPath & | path | ||
) | const |
Maps the path path, which is in this item's coordinate system, to item's coordinate system, and returns the mapped path.
If item is 0, this function returns the same as mapToScene().
Definition at line 6586 of file qgraphicsitem.cpp.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This convenience function is equivalent to calling mapToItem(item, QPointF(x, y)).
Definition at line 509 of file qgraphicsitem.h.
|
inline |
This convenience function is equivalent to calling mapToItem(item, QRectF(x, y, w, h)).
Definition at line 521 of file qgraphicsitem.h.
Maps the point point, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped coordinate.
If the item has no parent, point will be mapped to the scene's coordinate system.
Definition at line 6231 of file qgraphicsitem.cpp.
Referenced by mouseMoveEvent().
Maps the rectangle rect, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped rectangle as a polygon.
If the item has no parent, rect will be mapped to the scene's coordinate system.
Definition at line 6307 of file qgraphicsitem.cpp.
Maps the polygon polygon, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped polygon.
If the item has no parent, polygon will be mapped to the scene's coordinate system.
Definition at line 6555 of file qgraphicsitem.cpp.
QPainterPath QGraphicsItem::mapToParent | ( | const QPainterPath & | path | ) | const |
Maps the path path, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped path.
If the item has no parent, path will be mapped to the scene's coordinate system.
Definition at line 6602 of file qgraphicsitem.cpp.
This convenience function is equivalent to calling mapToParent(QPointF(x, y)).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 511 of file qgraphicsitem.h.
This convenience function is equivalent to calling mapToParent(QRectF(x, y, w, h)).
Definition at line 523 of file qgraphicsitem.h.
Maps the point point, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped coordinate.
Definition at line 6257 of file qgraphicsitem.cpp.
Referenced by QDeclarativeMouseArea::geometryChanged(), QmlJSDebugger::BoundingRectHighlighter::highlightAll(), isObscured(), mapToItem(), scenePos(), QDeclarativePathView::sendMouseEvent(), QDeclarativeMouseArea::sendMouseEvent(), QDeclarativeFlickable::sendMouseEvent(), and QDeclarativePinchArea::sendMouseEvent().
Maps the rectangle rect, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped rectangle as a polygon.
Definition at line 6332 of file qgraphicsitem.cpp.
Maps the polygon polygon, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped polygon.
Definition at line 6570 of file qgraphicsitem.cpp.
QPainterPath QGraphicsItem::mapToScene | ( | const QPainterPath & | path | ) | const |
Maps the path path, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped path.
Definition at line 6617 of file qgraphicsitem.cpp.
This convenience function is equivalent to calling mapToScene(QPointF(x, y)).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 513 of file qgraphicsitem.h.
This convenience function is equivalent to calling mapToScene(QRectF(x, y, w, h)).
Definition at line 525 of file qgraphicsitem.h.
QMatrix QGraphicsItem::matrix | ( | ) | const |
Returns the item's affine transformation matrix.
This is a subset or the item's full transformation matrix, and might not represent the item's full transformation.
Use transform() instead.
Definition at line 4050 of file qgraphicsitem.cpp.
Referenced by deviceTransform(), ShaderEffectItem::meshResolution(), ShaderEffectItem::renderEffect(), and QGraphicsItemAnimation::reset().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive mouse doubleclick events for this item.
When doubleclicking an item, the item will first receive a mouse press event, followed by a release event (i.e., a click), then a doubleclick event, and finally a release event.
Calling QEvent::ignore() or QEvent::accept() on event has no effect.
The default implementation calls mousePressEvent(). If you want to keep the base implementation when reimplementing this function, call QGraphicsItem::mouseDoubleClickEvent() in your reimplementation.
Note that an item will not receive double click events if it is neither QGraphicsItem::ItemIsSelectable{selectable} nor movable (single mouse clicks are ignored in this case, and that stops the generation of double clicks).
Reimplemented in QGraphicsTextItem, QDeclarativeTextEdit, QDeclarativeTextInput, QDeclarativeMouseArea, and QGraphicsProxyWidget.
Definition at line 7721 of file qgraphicsitem.cpp.
Referenced by QDeclarativeMouseArea::mouseDoubleClickEvent(), QDeclarativeTextInput::mouseDoubleClickEvent(), QDeclarativeTextEdit::mouseDoubleClickEvent(), QGraphicsTextItem::mouseDoubleClickEvent(), and sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive mouse move events for this item.
If you do receive this event, you can be certain that this item also received a mouse press event, and that this item is the current mouse grabber.
Calling QEvent::ignore() or QEvent::accept() on event has no effect.
The default implementation handles basic item interaction, such as selection and moving. If you want to keep the base implementation when reimplementing this function, call QGraphicsItem::mouseMoveEvent() in your reimplementation.
Please note that mousePressEvent() decides which graphics item it is that receives mouse events. See the mousePressEvent() description for details.
Reimplemented in QGraphicsTextItem, QDeclarativeTextEdit, QDeclarativePinchArea, QDeclarativeTextInput, QDeclarativeMouseArea, QDeclarativeFlickable, QDeclarativePathView, and QGraphicsProxyWidget.
Definition at line 7556 of file qgraphicsitem.cpp.
Referenced by QDeclarativePathView::mouseMoveEvent(), QDeclarativeFlickable::mouseMoveEvent(), QDeclarativeMouseArea::mouseMoveEvent(), QDeclarativeTextInput::mouseMoveEvent(), QDeclarativePinchArea::mouseMoveEvent(), QDeclarativeTextEdit::mouseMoveEvent(), QGraphicsTextItem::mouseMoveEvent(), and sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive mouse press events for this item.
Mouse press events are only delivered to items that accept the mouse button that is pressed. By default, an item accepts all mouse buttons, but you can change this by calling setAcceptedMouseButtons().
The mouse press event decides which item should become the mouse grabber (see QGraphicsScene::mouseGrabberItem()). If you do not reimplement this function, the press event will propagate to any topmost item beneath this item, and no other mouse events will be delivered to this item.
If you do reimplement this function, event will by default be accepted (see QEvent::accept()), and this item is then the mouse grabber. This allows the item to receive future move, release and doubleclick events. If you call QEvent::ignore() on event, this item will lose the mouse grab, and event will propagate to any topmost item beneath. No further mouse events will be delivered to this item unless a new mouse press event is received.
The default implementation handles basic item interaction, such as selection and moving. If you want to keep the base implementation when reimplementing this function, call QGraphicsItem::mousePressEvent() in your reimplementation.
Reimplemented in QGraphicsTextItem, QDeclarativeTextEdit, QDeclarativePinchArea, QDeclarativeTextInput, QDeclarativeText, QDeclarativeMouseArea, QDeclarativeFlickable, QDeclarativePathView, and QGraphicsProxyWidget.
Definition at line 7492 of file qgraphicsitem.cpp.
Referenced by mouseDoubleClickEvent(), QDeclarativePathView::mousePressEvent(), QDeclarativeFlickable::mousePressEvent(), QDeclarativeMouseArea::mousePressEvent(), QDeclarativeText::mousePressEvent(), QDeclarativePinchArea::mousePressEvent(), QDeclarativeTextEdit::mousePressEvent(), QGraphicsTextItem::mousePressEvent(), and sceneEvent().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive mouse release events for this item.
Calling QEvent::ignore() or QEvent::accept() on event has no effect.
The default implementation handles basic item interaction, such as selection and moving. If you want to keep the base implementation when reimplementing this function, call QGraphicsItem::mouseReleaseEvent() in your reimplementation.
Please note that mousePressEvent() decides which graphics item it is that receives mouse events. See the mousePressEvent() description for details.
Reimplemented in QGraphicsTextItem, QDeclarativeTextEdit, QDeclarativePinchArea, QDeclarativeTextInput, QDeclarativeText, QDeclarativeFlickable, QDeclarativeMouseArea, QDeclarativePathView, and QGraphicsProxyWidget.
Definition at line 7658 of file qgraphicsitem.cpp.
Referenced by QDeclarativePathView::mouseReleaseEvent(), QDeclarativeMouseArea::mouseReleaseEvent(), QDeclarativeFlickable::mouseReleaseEvent(), QDeclarativeText::mouseReleaseEvent(), QDeclarativeTextInput::mouseReleaseEvent(), QDeclarativePinchArea::mouseReleaseEvent(), QDeclarativeTextEdit::mouseReleaseEvent(), QGraphicsTextItem::mouseReleaseEvent(), and sceneEvent().
Moves the item by dx points horizontally, and dy point vertically.
This function is equivalent to calling setPos(pos() + QPointF(dx, dy)).
Definition at line 287 of file qgraphicsitem.h.
Referenced by QDeclarativeListView::itemsMoved().
qreal QGraphicsItem::opacity | ( | ) | const |
Returns this item's local opacity, which is between 0.
0 (transparent) and 1.0 (opaque). This value is combined with parent and ancestor values into the effectiveOpacity(). The effective opacity decides how the item is rendered.
The opacity property decides the state of the painter passed to the paint() function. If the item is cached, i.e., ItemCoordinateCache or DeviceCoordinateCache, the effective property will be applied to the item's cache as it is rendered.
The default opacity is 1.0; fully opaque.
Definition at line 2800 of file qgraphicsitem.cpp.
|
virtual |
This virtual function returns a shape representing the area where this item is opaque.
An area is opaque if it is filled using an opaque brush or color (i.e., not transparent).
This function is used by isObscuredBy(), which is called by underlying items to determine if they are obscured by this item.
The default implementation returns an empty QPainterPath, indicating that this item is completely transparent and does not obscure any other items.
Reimplemented in QGraphicsItemGroup, QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, QGraphicsPathItem, and QAbstractGraphicsShapeItem.
Definition at line 5514 of file qgraphicsitem.cpp.
Referenced by QAbstractGraphicsShapeItem::opaqueArea(), QGraphicsLineItem::opaqueArea(), QGraphicsTextItem::opaqueArea(), QGraphicsItemGroup::opaqueArea(), qt_QGraphicsItem_isObscured(), and QGraphicsLineItem::setLine().
|
pure virtual |
This function, which is usually called by QGraphicsView, paints the contents of an item in local coordinates.
Reimplement this function in a QGraphicsItem subclass to provide the item's painting implementation, using painter. The option parameter provides style options for the item, such as its state, exposed area and its level-of-detail hints. The widget argument is optional. If provided, it points to the widget that is being painted on; otherwise, it is 0. For cached painting, widget is always 0.
The painter's pen is 0-width by default, and its pen is initialized to the QPalette::Text brush from the paint device's palette. The brush is initialized to QPalette::Window.
Make sure to constrain all painting inside the boundaries of boundingRect() to avoid rendering artifacts (as QGraphicsView does not clip the painter for you). In particular, when QPainter renders the outline of a shape using an assigned QPen, half of the outline will be drawn outside, and half inside, the shape you're rendering (e.g., with a pen width of 2 units, you must draw outlines 1 unit inside boundingRect()). QGraphicsItem does not support use of cosmetic pens with a non-zero width.
All painting is done in local coordinates.
Implemented in QGraphicsItemGroup, QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, QGraphicsPathItem, QDeclarativeParticlesPainter, QDeclarativeParticles, QGraphicsWidget, QDeclarativeText, QDeclarativeRectangle, QDeclarativeItem, QDeclarativePaintedItem, QGraphicsSvgItem, QDeclarativeBorderImage, QDeclarativeImage, QGraphicsProxyWidget, ShaderEffectItem, and QmlJSDebugger::LiveLayerItem.
Referenced by _q_paintItem(), boundingRegion(), QGraphicsScenePrivate::draw(), and QGraphicsLineItem::setLine().
QGraphicsItem * QGraphicsItem::panel | ( | ) | const |
Returns the item's panel, or 0 if this item does not have a panel.
If the item is a panel, it will return itself. Otherwise it will return the closest ancestor that is a panel.
Definition at line 1737 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::dispatchHoverEvent(), hasFocus(), isActive(), panel(), QGraphicsScenePrivate::setActivePanelHelper(), QGraphicsScene::setActiveWindow(), QGraphicsItemPrivate::setFocusHelper(), QGraphicsItemPrivate::setSubFocus(), and window().
QGraphicsItem::PanelModality QGraphicsItem::panelModality | ( | ) | const |
Returns the modality for this item.
Definition at line 2132 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::addItem(), isBlockedByModalPanel(), QGraphicsScenePrivate::mousePressEventHandler(), QGraphicsScenePrivate::removeItemHelper(), setPanelModality(), and QGraphicsItemPrivate::setVisibleHelper().
QGraphicsItem * QGraphicsItem::parentItem | ( | ) | const |
Returns a pointer to this item's parent item.
If this item does not have a parent, 0 is returned.
Definition at line 1631 of file qgraphicsitem.cpp.
Referenced by _qt_movableAncestorIsSelected(), QGraphicsLayoutPrivate::addChildLayoutItem(), QDeclarativeAnchorsPrivate::calcStretch(), QDeclarativeAnchorsPrivate::centerInChanged(), QDeclarativeAnchorsPrivate::checkHAnchorValid(), QDeclarativeAnchorsPrivate::checkVAnchorValid(), collidesWithItem(), QGraphicsScene::createItemGroup(), deviceTransform(), QGraphicsScenePrivate::dispatchHoverEvent(), QGraphicsScene::event(), QDeclarativeAnchorsPrivate::fillChanged(), QGraphicsScenePrivate::filterDescendantEvent(), QDeclarativeItem::forceActiveFocus(), QGraphicsScenePrivate::gestureEventHandler(), QDeclarativeItem::hasFocus(), QGraphicsScene::keyPressEvent(), QGraphicsScene::keyReleaseEvent(), QDeclarativeMouseArea::mouseMoveEvent(), operator<<(), QDeclarativeItem::parentItem(), parentWidget(), QGraphicsScenePrivate::removeItemHelper(), QGraphicsLayoutPrivate::reparentChildItems(), sceneBoundingRect(), QGraphicsItemPrivate::sceneEffectiveBoundingRect(), QmlJSDebugger::LiveRubberBandSelectionManipulator::select(), QGraphicsScenePrivate::setActivePanelHelper(), QGraphicsScene::setActiveWindow(), QDeclarativeAnchors::setCenterIn(), QDeclarativeAnchors::setFill(), stackBefore(), topLevelItem(), QGraphicsScenePrivate::updateFont(), QGraphicsWidget::updateGeometry(), QDeclarativeAnchorsPrivate::updateHorizontalAnchors(), QGraphicsScenePrivate::updatePalette(), QDeclarativeAnchorsPrivate::updateVerticalAnchors(), and QDeclarativeItem::~QDeclarativeItem().
QGraphicsObject * QGraphicsItem::parentObject | ( | ) | const |
Returns a pointer to the item's parent, cast to a QGraphicsObject.
returns 0 if the parent item is not a QGraphicsObject.
Definition at line 1662 of file qgraphicsitem.cpp.
Referenced by QGestureManager::filterEvent().
QGraphicsWidget * QGraphicsItem::parentWidget | ( | ) | const |
Returns a pointer to the item's parent widget.
The item's parent widget is the closest parent item that is a widget.
Definition at line 1679 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::addItem(), QShortcutMap::correctGraphicsWidgetContext(), QGraphicsWidget::focusNextPrevChild(), QGraphicsWidgetPrivate::naturalWidgetFont(), QGraphicsWidgetPrivate::naturalWidgetPalette(), QGraphicsWidgetPrivate::resolveFont(), QGraphicsItemPrivate::setEnabledHelper(), QGraphicsWidgetPrivate::setLayoutDirection_helper(), QGraphicsItemPrivate::setVisibleHelper(), topLevelWidget(), and QGraphicsWidget::updateGeometry().
QPointF QGraphicsItem::pos | ( | ) | const |
Returns the position of the item in parent coordinates.
If the item has no parent, its position is given in scene coordinates.
The position of the item describes its origin (local coordinate (0, 0)) in parent coordinates; this function returns the same as mapToParent(0, 0).
For convenience, you can also call scenePos() to determine the item's position in scene coordinates, regardless of its parent.
Definition at line 3813 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QGraphicsProxyWidget::contextMenuEvent(), deviceTransform(), QGraphicsProxyWidget::event(), QGraphicsWidget::insertAction(), QDeclarativeListView::itemsInserted(), ShaderEffectItem::lookThroughShaderCode(), mouseMoveEvent(), QDeclarativeTextEdit::moveCursorSelection(), operator<<(), QDeclarativeTextInput::positionAt(), QDeclarativeGridViewPrivate::positionViewAtIndex(), QDeclarativeListViewPrivate::positionViewAtIndex(), QDeclarativePathView::refill(), QGraphicsItemGroup::removeFromGroup(), QGraphicsItemAnimation::reset(), QGraphicsWidget::resize(), QDeclarativeFlickable::resizeContent(), QDeclarativeTextEdit::setCursorPosition(), QGraphicsWidget::setGeometry(), QGraphicsItemAnimation::setItem(), QGraphicsItemPrivate::setPosHelper(), QDeclarativeGridView::trackedPositionChanged(), QDeclarativeListView::trackedPositionChanged(), QDeclarativePinchArea::updatePinch(), QDeclarativeGridView::viewportMoved(), QDeclarativeListView::viewportMoved(), and QGraphicsProxyWidget::wheelEvent().
|
protected |
Prepares the item for a geometry change.
Call this function before changing the bounding rect of an item to keep QGraphicsScene's index up to date.
prepareGeometryChange() will call update() if this is necessary.
Example:
Definition at line 7979 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QGraphicsItemGroup::removeFromGroup(), QDeclarativePaintedItem::setContentsSize(), QGraphicsWidget::setGeometry(), setGraphicsEffect(), QDeclarativeItem::setImplicitHeight(), QDeclarativeItem::setImplicitWidth(), QGraphicsTransformPrivate::setItem(), QGraphicsLineItem::setLine(), QGraphicsPixmapItem::setOffset(), QGraphicsPathItem::setPath(), QAbstractGraphicsShapeItem::setPen(), QGraphicsLineItem::setPen(), QGraphicsPixmapItem::setPixmap(), QGraphicsPolygonItem::setPolygon(), QGraphicsRectItem::setRect(), QGraphicsEllipseItem::setRect(), setRotation(), setScale(), QDeclarativeItem::setSize(), QGraphicsEllipseItem::setSpanAngle(), QGraphicsEllipseItem::setStartAngle(), QDeclarativeText::setStyle(), setTransformations(), setTransformOriginPoint(), QDeclarativeText::setVAlign(), QGraphicsWidget::setWindowFrameMargins(), QGraphicsTransformPrivate::updateItem(), and QDeclarativeTextEdit::updateSize().
|
protected |
Removes this item from the scene's index.
Called in conjunction with addToIndex() to ensure the index bookkeeping is correct when the item's position, transformation or shape changes.
Definition at line 7956 of file qgraphicsitem.cpp.
void QGraphicsItem::removeSceneEventFilter | ( | QGraphicsItem * | filterItem | ) |
Removes an event filter on this item from filterItem.
Definition at line 7057 of file qgraphicsitem.cpp.
void QGraphicsItem::resetMatrix | ( | ) |
Use resetTransform() instead.
Definition at line 4736 of file qgraphicsitem.cpp.
void QGraphicsItem::resetTransform | ( | ) |
Resets this item's transformation matrix to the identity matrix or all the transformation properties to their default values.
This is equivalent to calling setTransform(QTransform())
.
Definition at line 4753 of file qgraphicsitem.cpp.
Referenced by resetMatrix().
void QGraphicsItem::rotate | ( | qreal | angle | ) |
Use.
instead.
Rotates the current item transformation angle degrees clockwise around its origin. To translate around an arbitrary point (x, y), you need to combine translation and rotation with setTransform().
Example:
Definition at line 4782 of file qgraphicsitem.cpp.
qreal QGraphicsItem::rotation | ( | ) | const |
Returns the clockwise rotation, in degrees, around the Z axis.
The default value is 0 (i.e., the item is not rotated).
The rotation is combined with the item's scale(), transform() and transformations() to map the item's coordinate system to the parent item.
Definition at line 4091 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QDeclarativeParentChangePrivate::doChange(), and QGraphicsItemGroup::removeFromGroup().
Use.
instead.
Scales the current item transformation by (sx, sy) around its origin. To scale from an arbitrary point (x, y), you need to combine translation and scaling with setTransform().
Example:
Definition at line 4811 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QDeclarativeParentChangePrivate::doChange(), and QGraphicsItemGroup::removeFromGroup().
qreal QGraphicsItem::scale | ( | ) | const |
Returns the scale factor of the item.
The default scale factor is 1.0 (i.e., the item is not scaled).
The scale is combined with the item's rotation(), transform() and transformations() to map the item's coordinate system to the parent item.
Definition at line 4165 of file qgraphicsitem.cpp.
Referenced by QDeclarativeBorderImage::paint(), QDeclarativePaintedItem::setContentsScale(), and QDeclarativePinchArea::updatePinch().
QGraphicsScene * QGraphicsItem::scene | ( | ) | const |
Returns the current scene for the item, or 0 if the item is not stored in a scene.
To add or move an item to a scene, call QGraphicsScene::addItem().
Definition at line 1583 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::addItem(), ShaderEffectItem::checkViewportUpdateMode(), QmlJSDebugger::LiveSelectionIndicator::clear(), QDeclarativeLoaderPrivate::clear(), QGraphicsItemPrivate::clearFocusHelper(), QDeclarativeTextEdit::closeSoftwareInputPanel(), QDeclarativeTextInput::closeSoftwareInputPanel(), QShortcutMap::correctGraphicsWidgetContext(), QDeclarativeFlickablePrivate::data_clear(), QGraphicsItemPrivate::discardUpdateRequest(), QGraphicsItemPrivate::effectiveBoundingRect(), QMotifStyle::event(), QMacStyle::event(), QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(), QDeclarativeTextEditPrivate::focusChanged(), QDeclarativeTextInputPrivate::focusChanged(), QGraphicsObject::grabGesture(), QDeclarativeItem::hasActiveFocus(), installSceneEventFilter(), mousePressEvent(), QDeclarativeMouseArea::mouseReleaseEvent(), QDeclarativeTextInput::mouseReleaseEvent(), QDeclarativePinchArea::mouseReleaseEvent(), QDeclarativeTextEdit::mouseReleaseEvent(), mouseReleaseEvent(), QDeclarativeTextEdit::openSoftwareInputPanel(), QDeclarativeTextInput::openSoftwareInputPanel(), QGraphicsItem(), QDeclarativeVisualItemModel::release(), QDeclarativeVisualDataModel::release(), QGraphicsScene::removeItem(), QGraphicsScenePrivate::removeItemHelper(), removeSceneEventFilter(), QWidgetPrivate::screenGeometry(), QGraphicsScene::sendEvent(), QDeclarativePathView::sendMouseEvent(), QDeclarativeMouseArea::sendMouseEvent(), QDeclarativeFlickable::sendMouseEvent(), QDeclarativePinchArea::sendMouseEvent(), QGraphicsItemPrivate::sendScenePosChange(), QGraphicsScenePrivate::setActivePanelHelper(), QGraphicsScene::setActiveWindow(), QGraphicsItemPrivate::setEnabledHelper(), QGraphicsItemPrivate::setFocusHelper(), QGraphicsScenePrivate::setFocusItemHelper(), QDeclarativeGridView::setFooter(), QDeclarativeListView::setFooter(), QDeclarativeGridView::setHeader(), QDeclarativeListView::setHeader(), setInputMethodHints(), QGraphicsItemPrivate::setPosHelper(), QGraphicsItemPrivate::setSubFocus(), QGraphicsWidget::setTabOrder(), QGraphicsItemPrivate::setVisibleHelper(), QGraphicsWidget::style(), QDeclarativeFlickable::timerEvent(), QGraphicsObject::ungrabGesture(), updateMicroFocus(), QGraphicsItemPrivate::updatePaintedViewBoundingRects(), QDeclarativePinchArea::updatePinch(), QmlJSDebugger::LiveSelectionRectangle::~LiveSelectionRectangle(), and QGraphicsWidget::~QGraphicsWidget().
QRectF QGraphicsItem::sceneBoundingRect | ( | ) | const |
Returns the bounding rect of this item in scene coordinates, by combining sceneTransform() with boundingRect().
Definition at line 5121 of file qgraphicsitem.cpp.
Referenced by QGraphicsView::centerOn(), QGraphicsScene::collidingItems(), QGraphicsView::ensureVisible(), ensureVisible(), and QGraphicsScene::itemsBoundingRect().
|
protectedvirtual |
This virtual function receives events to this item.
Reimplement this function to intercept events before they are dispatched to the specialized event handlers contextMenuEvent(), focusInEvent(), focusOutEvent(), hoverEnterEvent(), hoverMoveEvent(), hoverLeaveEvent(), keyPressEvent(), keyReleaseEvent(), mousePressEvent(), mouseReleaseEvent(), mouseMoveEvent(), and mouseDoubleClickEvent().
Returns true if the event was recognized and handled; otherwise, (e.g., if the event type was not recognized,) false is returned.
event is the intercepted event.
Reimplemented in QGraphicsTextItem, QDeclarativePinchArea, QDeclarativeTextInput, QDeclarativeFlickable, QGraphicsWidget, QDeclarativeMouseArea, QDeclarativeItem, QDeclarativeGestureArea, and QDeclarativeFocusPanel.
Definition at line 7101 of file qgraphicsitem.cpp.
Referenced by QDeclarativeItem::sceneEvent(), QGraphicsWidget::sceneEvent(), sceneEvent(), QGraphicsTextItem::sceneEvent(), and QGraphicsScenePrivate::sendEvent().
|
protectedvirtual |
Filters events for the item watched.
event is the filtered event.
Reimplementing this function in a subclass makes it possible for the item to be used as an event filter for other items, intercepting all the events send to those items before they are able to respond.
Reimplementations must return true to prevent further processing of a given event, ensuring that it will not be delivered to the watched item, or return false to indicate that the event should be propagated further by the event system.
Reimplemented in QDeclarativePinchArea, QDeclarativeMouseArea, QDeclarativeFlickable, and QDeclarativePathView.
Definition at line 7080 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::filterDescendantEvent(), QDeclarativePathView::sceneEventFilter(), QDeclarativeFlickable::sceneEventFilter(), QDeclarativeMouseArea::sceneEventFilter(), and QDeclarativePinchArea::sceneEventFilter().
QMatrix QGraphicsItem::sceneMatrix | ( | ) | const |
Use sceneTransform() instead.
Definition at line 4404 of file qgraphicsitem.cpp.
QPointF QGraphicsItem::scenePos | ( | ) | const |
Returns the item's position in scene coordinates.
This is equivalent to calling mapToScene(0, 0)
.
Definition at line 3890 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemPrivate::sendScenePosChange().
QTransform QGraphicsItem::sceneTransform | ( | ) | const |
Returns this item's scene transformation matrix.
This matrix can be used to map coordinates and geometrical shapes from this item's local coordinate system to the scene's coordinate system. To map coordinates from the scene, you must first invert the returned matrix.
Example:
Unlike transform(), which returns only an item's local transformation, this function includes the item's (and any parents') position, and all the transfomation properties.
Definition at line 4431 of file qgraphicsitem.cpp.
Referenced by deviceTransform(), ensureVisible(), QGraphicsViewPrivate::mapToViewRect(), mouseMoveEvent(), QGraphicsView::paintEvent(), QGraphicsItemEffectSourcePrivate::pixmap(), QGraphicsItemGroup::removeFromGroup(), QGraphicsItemPrivate::sceneEffectiveBoundingRect(), and QDeclarativeFlipablePrivate::updateSceneTransformFromParent().
Scrolls the contents of rect by dx, dy.
Scrolling provides a fast alternative to simply redrawing when the contents of the item (or parts of the item) are shifted vertically or horizontally. Depending on the current transformation and the capabilities of the paint device (i.e., the viewport), this operation may consist of simply moving pixels from one location to another using memmove(). In most cases this is faster than rerendering the entire area.
After scrolling, the item will issue an update for the newly exposed areas. If scrolling is not supported (e.g., you are rendering to an OpenGL viewport, which does not benefit from scroll optimizations), this function is equivalent to calling update(rect).
Note: Scrolling is only supported when QGraphicsItem::ItemCoordinateCache is enabled; in all other cases calling this function is equivalent to calling update(rect). If you for sure know that the item is opaque and not overlapped by other items, you can map the rect to viewport coordinates and scroll the viewport.
Definition at line 6114 of file qgraphicsitem.cpp.
void QGraphicsItem::setAcceptDrops | ( | bool | on | ) |
If on is true, this item will accept drag and drop events; otherwise, it is transparent for drag and drop events.
By default, items do not accept drag and drop events.
Definition at line 3076 of file qgraphicsitem.cpp.
Referenced by QGraphicsTextItem::QGraphicsTextItem().
void QGraphicsItem::setAcceptedMouseButtons | ( | Qt::MouseButtons | buttons | ) |
Sets the mouse buttons that this item accepts mouse events for.
By default, all mouse buttons are accepted. If an item accepts a mouse button, it will become the mouse grabber item when a mouse press event is delivered for that button. However, if the item does not accept the mouse button, QGraphicsScene will forward the mouse events to the first item beneath it that does.
To disable mouse events for an item (i.e., make it transparent for mouse events), call setAcceptedMouseButtons(0).
Definition at line 3112 of file qgraphicsitem.cpp.
Referenced by QDeclarativeGestureArea::QDeclarativeGestureArea(), and QDeclarativeMouseArea::setAcceptedButtons().
void QGraphicsItem::setAcceptHoverEvents | ( | bool | enabled | ) |
If enabled is true, this item will accept hover events; otherwise, it will ignore them.
By default, items do not accept hover events.
Hover events are delivered when there is no current mouse grabber item. They are sent when the mouse cursor enters an item, when it moves around inside the item, and when the cursor leaves an item. Hover events are commonly used to highlight an item when it's entered, and for tracking the mouse cursor as it hovers over the item (equivalent to QWidget::mouseTracking).
Parent items receive hover enter events before their children, and leave events after their children. The parent does not receive a hover leave event if the cursor enters a child, though; the parent stays "hovered" until the cursor leaves its area, including its children's areas.
If a parent item handles child events, it will receive hover move, drag move, and drop events as the cursor passes through its children, but it does not receive hover enter and hover leave, nor drag enter and drag leave events on behalf of its children.
A QGraphicsWidget with window decorations will accept hover events regardless of the value of acceptHoverEvents().
Definition at line 3187 of file qgraphicsitem.cpp.
Referenced by QGraphicsTextItem::QGraphicsTextItem(), setAcceptsHoverEvents(), and QDeclarativeMouseArea::setHoverEnabled().
void QGraphicsItem::setAcceptsHoverEvents | ( | bool | enabled | ) |
Use setAcceptHoverEvents(enabled) instead.
Definition at line 3206 of file qgraphicsitem.cpp.
void QGraphicsItem::setAcceptTouchEvents | ( | bool | enabled | ) |
If enabled is true, this item will accept touch events; otherwise, it will ignore them.
By default, items do not accept touch events.
Definition at line 3236 of file qgraphicsitem.cpp.
Referenced by QDeclarativeGestureArea::QDeclarativeGestureArea().
void QGraphicsItem::setActive | ( | bool | active | ) |
If active is true, and the scene is active, this item's panel will be activated.
Otherwise, the panel is deactivated.
If the item is not part of an active scene, active will decide what happens to the panel when the scene becomes active or the item is added to the scene. If true, the item's panel will be activated when the item is either added to the scene or the scene is activated. Otherwise, the item will stay inactive independent of the scene's activated state.
Definition at line 3387 of file qgraphicsitem.cpp.
void QGraphicsItem::setBoundingRegionGranularity | ( | qreal | granularity | ) |
Sets the bounding region granularity to granularity; a value between and including 0 and 1.
The granularity is used by boundingRegion() to calculate how fine the bounding region of the item should be. The highest achievable granularity is 1, where boundingRegion() will return the finest outline possible for the respective device (e.g., for a QGraphicsView viewport, this gives you a pixel-perfect bounding region). The lowest possible granularity is 0. The value of granularity describes the ratio between device resolution and the resolution of the bounding region (e.g., a value of 0.25 will provide a region where each chunk corresponds to 4x4 device units / pixels).
Definition at line 5640 of file qgraphicsitem.cpp.
Sets the item's cache mode to mode.
The optional logicalCacheSize argument is used only by ItemCoordinateCache mode, and describes the resolution of the cache buffer; if logicalCacheSize is (100, 100), QGraphicsItem will fit the item into 100x100 pixels in graphics memory, regardless of the logical size of the item itself. By default QGraphicsItem uses the size of boundingRect(). For all other cache modes than ItemCoordinateCache, logicalCacheSize is ignored.
Caching can speed up rendering if your item spends a significant time redrawing itself. In some cases the cache can also slow down rendering, in particular when the item spends less time redrawing than QGraphicsItem spends redrawing from the cache. When enabled, the item's paint() function will be called only once for each call to update(); for any subsequent repaint requests, the Graphics View framework will redraw from the cache. This approach works particularly well with QGLWidget, which stores all the cache as OpenGL textures.
Be aware that QPixmapCache's cache limit may need to be changed to obtain optimal performance.
You can read more about the different cache modes in the CacheMode documentation.
Definition at line 2098 of file qgraphicsitem.cpp.
Referenced by QGraphicsSvgItem::setCachingEnabled().
void QGraphicsItem::setCursor | ( | const QCursor & | cursor | ) |
Sets the current cursor shape for the item to cursor.
The mouse cursor will assume this shape when it's over this item. See the list of predefined cursor objects for a range of useful shapes.
An editor item might want to use an I-beam cursor:
If no cursor has been set, the cursor of the item beneath is used.
Definition at line 2276 of file qgraphicsitem.cpp.
Referenced by QApplicationPrivate::dispatchEnterLeave().
void QGraphicsItem::setData | ( | int | key, |
const QVariant & | value | ||
) |
Sets this item's custom data for the key key to value.
Custom item data is useful for storing arbitrary properties for any item. Qt does not use this feature for storing data; it is provided solely for the convenience of the user.
Definition at line 6976 of file qgraphicsitem.cpp.
Referenced by QmlJSDebugger::LiveSelectionIndicator::setItems(), and QmlJSDebugger::SubcomponentMaskLayerItem::SubcomponentMaskLayerItem().
void QGraphicsItem::setEnabled | ( | bool | enabled | ) |
If enabled is true, the item is enabled; otherwise, it is disabled.
Disabled items are visible, but they do not receive any events, and cannot take focus nor be selected. Mouse events are discarded; they are not propagated unless the item is also invisible, or if it does not accept mouse events (see acceptedMouseButtons()). A disabled item cannot become the mouse grabber, and as a result of this, an item loses the grab if it becomes disabled when grabbing the mouse, just like it loses focus if it had focus when it was disabled.
Disabled items are traditionally drawn using grayed-out colors (see QPalette::Disabled ).
If you disable a parent item, all its children will also be disabled. If you enable a parent item, all children will be enabled, unless they have been explicitly disabled (i.e., if you call setEnabled(false) on a child, it will not be reenabled if its parent is disabled, and then enabled again).
Items are enabled by default.
Definition at line 2700 of file qgraphicsitem.cpp.
Referenced by QGraphicsProxyWidget::eventFilter().
Note: This is provided as a hook to avoid future problems related to adding virtual functions.
Reimplemented in QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, and QGraphicsPathItem.
Definition at line 7905 of file qgraphicsitem.cpp.
void QGraphicsItem::setFiltersChildEvents | ( | bool | enabled | ) |
If enabled is true, this item is set to filter all events for all its children (i.
e., all events intented for any of its children are instead sent to this item); otherwise, if enabled is false, this item will only handle its own events. The default value is false.
Definition at line 3280 of file qgraphicsitem.cpp.
void QGraphicsItem::setFlag | ( | GraphicsItemFlag | flag, |
bool | enabled = true |
||
) |
If enabled is true, the item flag flag is enabled; otherwise, it is disabled.
Definition at line 1901 of file qgraphicsitem.cpp.
Referenced by _q_qgraphicsItemSetFlag(), QmlJSDebugger::BoundingBox::BoundingBox(), QmlJSDebugger::LiveLayerItem::LiveLayerItem(), QGraphicsTextItem::QGraphicsTextItem(), QDeclarativeItem::setClip(), QGraphicsWidget::setFocusPolicy(), QmlJSDebugger::LiveSelectionIndicator::setItems(), QDeclarativeTextInput::setReadOnly(), QDeclarativeTextEdit::setReadOnly(), QGraphicsWidget::setWindowFlags(), setZValue(), and ShaderEffectItem::ShaderEffectItem().
void QGraphicsItem::setFlags | ( | GraphicsItemFlags | flags | ) |
Sets the item flags to flags.
All flags in flags are enabled; all flags not in flags are disabled.
If the item had focus and flags does not enable ItemIsFocusable, the item loses focus as a result of calling this function. Similarly, if the item was selected, and flags does not enabled ItemIsSelectable, the item is automatically unselected.
By default, no flags are enabled. (QGraphicsWidget enables the ItemSendsGeometryChanges flag by default in order to track position changes.)
Definition at line 1945 of file qgraphicsitem.cpp.
Referenced by QGraphicsTextItem::QGraphicsTextItem(), setFlag(), and QGraphicsTextItem::setTextInteractionFlags().
void QGraphicsItem::setFocus | ( | Qt::FocusReason | focusReason = Qt::OtherFocusReason | ) |
Gives keyboard input focus to this item.
The focusReason argument will be passed into any focus event generated by this function; it is used to give an explanation of what caused the item to get focus.
Only enabled items that set the ItemIsFocusable flag can accept keyboard focus.
If this item is not visible, not active, or not associated with a scene, it will not gain immediate input focus. However, it will be registered as the preferred focus item for its subtree of items, should it later become visible.
As a result of calling this function, this item will receive a focus in event with focusReason. If another item already has focus, that item will first receive a focus out event indicating that it has lost input focus.
Definition at line 3442 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::addItem(), QGraphicsWidget::focusNextPrevChild(), QDeclarativeItem::forceActiveFocus(), QGraphicsScenePrivate::setActivePanelHelper(), QDeclarativeItem::setFocus(), QGraphicsScene::setFocusItem(), and QGraphicsScenePrivate::setFocusItemHelper().
void QGraphicsItem::setFocusProxy | ( | QGraphicsItem * | item | ) |
Sets the item's focus proxy to item.
If an item has a focus proxy, the focus proxy will receive input focus when the item gains input focus. The item itself will still have focus (i.e., hasFocus() will return true), but only the focus proxy will receive the keyboard input.
A focus proxy can itself have a focus proxy, and so on. In such case, keyboard input will be handled by the outermost focus proxy.
The focus proxy item must belong to the same scene as this item.
Definition at line 3605 of file qgraphicsitem.cpp.
void QGraphicsItem::setGraphicsEffect | ( | QGraphicsEffect * | effect | ) |
Sets effect as the item's effect.
If there already is an effect installed on this item, QGraphicsItem will delete the existing effect before installing the new effect.
If effect is the installed on a different item, setGraphicsEffect() will remove the effect from the item and install it on this item.
QGraphicsItem takes ownership of effect.
Definition at line 2911 of file qgraphicsitem.cpp.
Referenced by ShaderEffectSource::attachSourceItem().
void QGraphicsItem::setGroup | ( | QGraphicsItemGroup * | group | ) |
Adds this item to the item group group.
If group is 0, this item is removed from any current group and added as a child of the previous group's parent.
Definition at line 1615 of file qgraphicsitem.cpp.
void QGraphicsItem::setHandlesChildEvents | ( | bool | enabled | ) |
If enabled is true, this item is set to handle all events for all its children (i.
e., all events intented for any of its children are instead sent to this item); otherwise, if enabled is false, this item will only handle its own events. The default value is false.
This property is useful for item groups; it allows one item to handle events on behalf of its children, as opposed to its children handling their events individually.
If a child item accepts hover events, its parent will receive hover move events as the cursor passes through the child, but it does not receive hover enter and hover leave events on behalf of its child.
Definition at line 3337 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::QGraphicsItemGroup().
void QGraphicsItem::setInputMethodHints | ( | Qt::InputMethodHints | hints | ) |
Sets the current input method hints of this item to hints.
Definition at line 7806 of file qgraphicsitem.cpp.
Referenced by QGraphicsViewPrivate::updateInputMethodSensitivity().
void QGraphicsItem::setMatrix | ( | const QMatrix & | matrix, |
bool | combine = false |
||
) |
Sets the item's affine transformation matrix.
This is a subset or the item's full transformation matrix, and might not represent the item's full transformation.
Use setTransform() instead.
Definition at line 4644 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemAnimation::setStep().
void QGraphicsItem::setOpacity | ( | qreal | opacity | ) |
Sets this item's local opacity, between 0.
0 (transparent) and 1.0 (opaque). The item's local opacity is combined with parent and ancestor opacities into the effectiveOpacity().
By default, opacity propagates from parent to child, so if a parent's opacity is 0.5 and the child is also 0.5, the child's effective opacity will be 0.25.
The opacity property decides the state of the painter passed to the paint() function. If the item is cached, i.e., ItemCoordinateCache or DeviceCoordinateCache, the effective property will be applied to the item's cache as it is rendered.
There are two item flags that affect how the item's opacity is combined with the parent: ItemIgnoresParentOpacity and ItemDoesntPropagateOpacityToChildren.
Definition at line 2849 of file qgraphicsitem.cpp.
Referenced by QDeclarativeFlipablePrivate::updateSceneTransformFromParent().
void QGraphicsItem::setPanelModality | ( | PanelModality | panelModality | ) |
Sets the modality for this item to panelModality.
Changing the modality of a visible item takes effect immediately.
Definition at line 2147 of file qgraphicsitem.cpp.
void QGraphicsItem::setParentItem | ( | QGraphicsItem * | newParent | ) |
Sets this item's parent item to newParent.
If this item already has a parent, it is first removed from the previous parent. If newParent is 0, this item will become a top-level item.
Note that this implicitly adds this graphics item to the scene of the parent. You should not add the item to the scene yourself.
Calling this function on an item that is an ancestor of newParent have undefined behaviour.
Definition at line 1786 of file qgraphicsitem.cpp.
Referenced by QDeclarativeLoaderPrivate::_q_sourceLoaded(), QGraphicsScene::addItem(), QGraphicsItemGroup::addToGroup(), QGraphicsItemPrivate::children_append(), QGraphicsItemPrivate::children_clear(), children_clear_helper(), QDeclarativeLoaderPrivate::clear(), QDeclarativeItemPrivate::data_append(), QDeclarativeFlickablePrivate::data_append(), QGraphicsItem(), qgraphicsobject_autoParent(), QGraphicsItemGroup::removeFromGroup(), QGraphicsScenePrivate::removeItemHelper(), QDeclarativeItem::setParentItem(), and ~QGraphicsItem().
void QGraphicsItem::setPos | ( | const QPointF & | pos | ) |
Sets the position of the item to pos, which is in parent coordinates.
For items with no parent, pos is in scene coordinates.
The position of the item describes its origin (local coordinate (0, 0)) in parent coordinates.
Definition at line 3947 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QDeclarativeGridView::createdItem(), mouseMoveEvent(), QGraphicsItemGroup::removeFromGroup(), QGraphicsWidget::setGeometry(), FxGridItem::setPosition(), QGraphicsItemAnimation::setStep(), setX(), setY(), and QDeclarativeGridViewPrivate::updateUnrequestedPositions().
This convenience function is equivalent to calling setPos(QPointF(x, y)).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 501 of file qgraphicsitem.h.
void QGraphicsItem::setRotation | ( | qreal | angle | ) |
Sets the clockwise rotation angle, in degrees, around the Z axis.
The default value is 0 (i.e., the item is not rotated). Assigning a negative value will rotate the item counter-clockwise. Normally the rotation angle is in the range (-360, 360), but it's also possible to assign values outside of this range (e.g., a rotation of 370 degrees is the same as a rotation of 10 degrees).
The item is rotated around its transform origin point, which by default is (0, 0). You can select a different transformation origin by calling setTransformOriginPoint().
The rotation is combined with the item's scale(), transform() and transformations() to map the item's coordinate system to the parent item.
Definition at line 4120 of file qgraphicsitem.cpp.
Referenced by QDeclarativeParentChangePrivate::doChange(), and QDeclarativePinchArea::updatePinch().
void QGraphicsItem::setScale | ( | qreal | factor | ) |
Sets the scale factor of the item.
The default scale factor is 1.0 (i.e., the item is not scaled). A scale factor of 0.0 will collapse the item to a single point. If you provide a negative scale factor, the item will be flipped and mirrored (i.e., rotated 180 degrees).
The item is scaled around its transform origin point, which by default is (0, 0). You can select a different transformation origin by calling setTransformOriginPoint().
The scale is combined with the item's rotation(), transform() and transformations() to map the item's coordinate system to the parent item.
Definition at line 4192 of file qgraphicsitem.cpp.
Referenced by QDeclarativeParentChangePrivate::doChange(), and QDeclarativePinchArea::updatePinch().
void QGraphicsItem::setSelected | ( | bool | selected | ) |
If selected is true and this item is selectable, this item is selected; otherwise, it is unselected.
If the item is in a group, the whole group's selected state is toggled by this function. If the group is selected, all items in the group are also selected, and if the group is not selected, no item in the group is selected.
Only visible, enabled, selectable items can be selected. If selected is true and this item is either invisible or disabled or unselectable, this function does nothing.
By default, items cannot be selected. To enable selection, set the ItemIsSelectable flag.
This function is provided for convenience, allowing individual toggling of the selected state of an item. However, a more common way of selecting items is to call QGraphicsScene::setSelectionArea(), which will call this function for all visible, enabled, and selectable items within a specified area on the scene.
Definition at line 2745 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::clearSelection(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), setFlags(), setSelected(), QGraphicsScene::setSelectionArea(), and QGraphicsItemPrivate::setVisibleHelper().
void QGraphicsItem::setToolTip | ( | const QString & | toolTip | ) |
Sets the item's tool tip to toolTip.
If toolTip is empty, the item's tool tip is cleared.
Definition at line 2232 of file qgraphicsitem.cpp.
Referenced by QGraphicsProxyWidget::eventFilter().
void QGraphicsItem::setTransform | ( | const QTransform & | matrix, |
bool | combine = false |
||
) |
Sets the item's current transformation matrix to matrix.
If combine is true, then matrix is combined with the current matrix; otherwise, matrix replaces the current matrix. combine is false by default.
To simplify interation with items using a transformed view, QGraphicsItem provides mapTo... and mapFrom... functions that can translate between items' and the scene's coordinates. For example, you can call mapToScene() to map an item coordiate to a scene coordinate, or mapFromScene() to map from scene coordinates to item coordinates.
The transformation matrix is combined with the item's rotation(), scale() and transformations() into a combined transformation that maps the item's coordinate system to its parent.
Definition at line 4696 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QGraphicsItemGroup::removeFromGroup(), resetTransform(), rotate(), scale(), QDeclarativeFlipablePrivate::setBackTransform(), shear(), and translate().
void QGraphicsItem::setTransformations | ( | const QList< QGraphicsTransform *> & | transformations | ) |
Sets a list of graphics transformations (QGraphicsTransform) that currently apply to this item.
If all you want is to rotate or scale an item, you should call setRotation() or setScale() instead. If you want to set an arbitrary transformation on an item, you can call setTransform().
QGraphicsTransform is for applying and controlling a chain of individual transformation operations on an item. It's particularly useful in animations, where each transform operation needs to be interpolated independently, or differently.
The transformations are combined with the item's rotation(), scale() and transform() to map the item's coordinate system to the parent item.
Definition at line 4272 of file qgraphicsitem.cpp.
void QGraphicsItem::setTransformOriginPoint | ( | const QPointF & | origin | ) |
Sets the origin point for the transformation in item coordinates.
Definition at line 4348 of file qgraphicsitem.cpp.
Referenced by QDeclarativeItem::geometryChanged(), and QDeclarativeItem::setTransformOrigin().
Sets the origin point for the transformation in item coordinates.
This is equivalent to calling setTransformOriginPoint(QPointF(x, y)).
Definition at line 320 of file qgraphicsitem.h.
void QGraphicsItem::setVisible | ( | bool | visible | ) |
If visible is true, the item is made visible.
Otherwise, the item is made invisible. Invisible items are not painted, nor do they receive any events. In particular, mouse events pass right through invisible items, and are delivered to any item that may be behind. Invisible items are also unselectable, they cannot take input focus, and are not detected by QGraphicsScene's item location functions.
If an item becomes invisible while grabbing the mouse, (i.e., while it is receiving mouse events,) it will automatically lose the mouse grab, and the grab is not regained by making the item visible again; it must receive a new mouse press to regain the mouse grab.
Similarly, an invisible item cannot have focus, so if the item has focus when it becomes invisible, it will lose focus, and the focus is not regained by simply making the item visible again.
If you hide a parent item, all its children will also be hidden. If you show a parent item, all children will be shown, unless they have been explicitly hidden (i.e., if you call setVisible(false) on a child, it will not be reshown even if its parent is hidden, and then shown again).
Items are visible by default; it is unnecessary to call setVisible() on a new item.
Definition at line 2568 of file qgraphicsitem.cpp.
Referenced by QDeclarativeLoaderPrivate::clear(), QDeclarativeListViewPrivate::createSection(), QGraphicsProxyWidget::eventFilter(), and QDeclarativeListViewPrivate::releaseItem().
void QGraphicsItem::setX | ( | qreal | x | ) |
Set's the x coordinate of the item's position.
Equivalent to calling setPos(x, y()).
Definition at line 3840 of file qgraphicsitem.cpp.
Referenced by QDeclarativeListView::createdItem(), QDeclarativeParentChangePrivate::doChange(), QDeclarativeBasePositioner::positionX(), QDeclarativeLayoutItem::setGeometry(), QDeclarativeFlickablePrivate::setRoundedViewportX(), QDeclarativePathViewPrivate::updateItem(), QDeclarativePinchArea::updatePinch(), QDeclarativeParticlesPainter::updateSize(), and QDeclarativeListViewPrivate::updateUnrequestedPositions().
void QGraphicsItem::setY | ( | qreal | y | ) |
Set's the y coordinate of the item's position.
Equivalent to calling setPos(x(), y).
Definition at line 3873 of file qgraphicsitem.cpp.
Referenced by QDeclarativeListView::createdItem(), QDeclarativeParentChangePrivate::doChange(), QDeclarativeBasePositioner::positionY(), QDeclarativeLayoutItem::setGeometry(), QDeclarativeFlickablePrivate::setRoundedViewportY(), QDeclarativePathViewPrivate::updateItem(), QDeclarativePinchArea::updatePinch(), QDeclarativeParticlesPainter::updateSize(), and QDeclarativeListViewPrivate::updateUnrequestedPositions().
void QGraphicsItem::setZValue | ( | qreal | z | ) |
Sets the Z-value of the item to z.
The Z value decides the stacking order of sibling (neighboring) items. A sibling item of high Z value will always be drawn on top of another sibling item with a lower Z value.
If you restore the Z value, the item's insertion order will decide its stacking order.
The Z-value does not affect the item's size in any way.
The default Z-value is 0.
Definition at line 4914 of file qgraphicsitem.cpp.
Referenced by QDeclarativeGridViewPrivate::createItem(), QDeclarativeListViewPrivate::createItem(), QDeclarativeListViewPrivate::createSection(), QmlJSDebugger::LiveLayerItem::LiveLayerItem(), QDeclarativePathView::refill(), QGraphicsScene::setActiveWindow(), QDeclarativeGridViewPrivate::updateFooter(), QDeclarativeListViewPrivate::updateFooter(), QDeclarativeGridViewPrivate::updateHeader(), and QDeclarativeListViewPrivate::updateHeader().
|
virtual |
Returns the shape of this item as a QPainterPath in local coordinates.
The shape is used for many things, including collision detection, hit tests, and for the QGraphicsScene::items() functions.
The default implementation calls boundingRect() to return a simple rectangular shape, but subclasses can reimplement this function to return a more accurate shape for non-rectangular items. For example, a round item may choose to return an elliptic shape for better collision detection. For example:
The outline of a shape can vary depending on the width and style of the pen used when drawing. If you want to include this outline in the item's shape, you can create a shape from the stroke using QPainterPathStroker.
This function is called by the default implementations of contains() and collidesWithPath().
Reimplemented in QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, QGraphicsPathItem, and QGraphicsWidget.
Definition at line 5168 of file qgraphicsitem.cpp.
Referenced by clipPath(), collidesWithItem(), collidesWithPath(), contains(), QGraphicsView::fitInView(), QAbstractGraphicsShapeItem::opaqueArea(), QGraphicsSceneIndexPrivate::recursive_items_helper(), setClip(), and QGraphicsLineItem::setLine().
Use.
instead.
Shears the current item transformation by (sh, sv).
Definition at line 4834 of file qgraphicsitem.cpp.
|
inline |
Shows the item.
(Items are visible by default.)
This convenience function is equivalent to calling setVisible(true)
.
Definition at line 223 of file qgraphicsitem.h.
Referenced by QmlJSDebugger::BoundingRectHighlighter::createBoundingBox(), QmlJSDebugger::LiveSelectionRectangle::show(), and QmlJSDebugger::LiveSelectionIndicator::show().
void QGraphicsItem::stackBefore | ( | const QGraphicsItem * | sibling | ) |
Stacks this item before sibling, which must be a sibling item (i.
e., the two items must share the same parent item, or must both be toplevel items). The sibling must have the same Z value as this item, otherwise calling this function will have no effect.
By default, all sibling items are stacked by insertion order (i.e., the first item you add is drawn before the next item you add). If two items' Z values are different, then the item with the highest Z value is drawn on top. When the Z values are the same, the insertion order will decide the stacking order.
Definition at line 5007 of file qgraphicsitem.cpp.
Referenced by QDeclarativeParentChangePrivate::doChange(), QDeclarativeRepeater::itemsInserted(), QDeclarativeRepeater::itemsMoved(), and QDeclarativeRepeater::regenerate().
|
protectedvirtual |
Note: This is provided as a hook to avoid future problems related to adding virtual functions.
Reimplemented in QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, and QGraphicsPathItem.
Definition at line 7890 of file qgraphicsitem.cpp.
QGraphicsObject * QGraphicsItem::toGraphicsObject | ( | ) |
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object, 0 otherwise.
Definition at line 1753 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::cancelGesturesForChildren(), QGraphicsItemPrivate::children_at(), children_at_helper(), QmlJSDebugger::LiveSelectionTool::contextMenuElementHovered(), QDeclarativeFlickablePrivate::data_at(), QGraphicsScenePrivate::gestureEventHandler(), QmlJSDebugger::QDeclarativeViewInspectorPrivate::highlight(), QmlJSDebugger::LiveSelectionTool::hoverMoveEvent(), QDeclarativeBasePositioner::itemChange(), operator<<(), QDeclarativeBasePositioner::prePositioning(), qobject_cast(), QGraphicsScenePrivate::sendEvent(), QGraphicsScenePrivate::setFocusItemHelper(), QmlJSDebugger::QDeclarativeViewInspectorPrivate::setSelectedItemsForTools(), QmlJSDebugger::AbstractLiveEditTool::titleForItem(), QmlJSDebugger::AbstractLiveEditTool::toGraphicsObjectList(), QmlJSDebugger::AbstractLiveEditTool::toQDeclarativeItem(), and updateMicroFocus().
const QGraphicsObject * QGraphicsItem::toGraphicsObject | ( | ) | const |
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object, 0 otherwise.
Definition at line 1767 of file qgraphicsitem.cpp.
QString QGraphicsItem::toolTip | ( | ) | const |
Returns the item's tool tip, or an empty QString if no tool tip has been set.
Definition at line 2221 of file qgraphicsitem.cpp.
Referenced by QGraphicsProxyWidget::event(), and QGraphicsScene::helpEvent().
QGraphicsItem * QGraphicsItem::topLevelItem | ( | ) | const |
Returns this item's top-level item.
The top-level item is the item's topmost ancestor item whose parent is 0. If an item has no parent, its own pointer is returned (i.e., a top-level item is its own top-level item).
Definition at line 1643 of file qgraphicsitem.cpp.
Referenced by QGraphicsScene::drawItems(), QGraphicsSceneBspTreeIndexPrivate::estimateItems(), QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(), and QGraphicsSceneFindItemBspTreeVisitor::visit().
QGraphicsWidget * QGraphicsItem::topLevelWidget | ( | ) | const |
Returns a pointer to the item's top level widget (i.
e., the item's ancestor whose parent is 0, or whose parent is not a widget), or 0 if this item does not have a top level widget. If the item is its own top level widget, this function returns a pointer to the item itself.
Definition at line 1698 of file qgraphicsitem.cpp.
Referenced by topLevelWidget().
QTransform QGraphicsItem::transform | ( | ) | const |
Returns this item's transformation matrix.
The transformation matrix is combined with the item's rotation(), scale() and transformations() into a combined transformations for the item.
The default transformation matrix is an identity matrix.
Definition at line 4070 of file qgraphicsitem.cpp.
Referenced by matrix(), and QGraphicsItemPrivate::setTransformHelper().
QList< QGraphicsTransform * > QGraphicsItem::transformations | ( | ) | const |
Returns a list of graphics transforms that currently apply to this item.
QGraphicsTransform is for applying and controlling a chain of individual transformation operations on an item. It's particularly useful in animations, where each transform operation needs to be interpolated independently, or differently.
The transformations are combined with the item's rotation(), scale() and transform() to map the item's coordinate system to the parent item.
Definition at line 4242 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QGraphicsItemGroup::removeFromGroup(), and setTransformations().
QPointF QGraphicsItem::transformOriginPoint | ( | ) | const |
Returns the origin point for the transformation in item coordinates.
The default is QPointF(0,0).
Definition at line 4331 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), QDeclarativeItem::geometryChanged(), and QGraphicsItemGroup::removeFromGroup().
Use setPos() or setTransformOriginPoint() instead.
For identical behavior, use
Translates the current item transformation by (dx, dy).
If all you want is to move an item, you should call moveBy() or setPos() instead; this function changes the item's translation, which is conceptually separate from its position.
Definition at line 4860 of file qgraphicsitem.cpp.
|
virtual |
Returns the type of an item as an int.
All standard graphicsitem classes are associated with a unique value; see QGraphicsItem::Type. This type information is used by qgraphicsitem_cast() to distinguish between types.
The default implementation (in QGraphicsItem) returns UserType.
To enable use of qgraphicsitem_cast() with a custom item, reimplement this function and declare a Type enum value equal to your custom item's type. Custom items must return a value larger than or equal to UserType (65536).
For example:
Reimplemented in QGraphicsItemGroup, QGraphicsSimpleTextItem, QGraphicsTextItem, QGraphicsPixmapItem, QGraphicsLineItem, QGraphicsPolygonItem, QGraphicsEllipseItem, QGraphicsRectItem, QGraphicsPathItem, QGraphicsWidget, QmlJSDebugger::BoundingBoxPolygonItem, QGraphicsSvgItem, QGraphicsProxyWidget, QmlJSDebugger::SelectionRectShape, QmlJSDebugger::LiveLayerItem, and QmlJSDebugger::SubcomponentMaskLayerItem.
Definition at line 7013 of file qgraphicsitem.cpp.
Referenced by QDeclarativeGestureAreaParser::compile(), QMotifStyle::event(), QMacStyle::event(), QmlJSDebugger::isEditorItem(), ShaderEffectItem::lookThroughShaderCode(), qgraphicsitem_cast(), qt_graphicsItem_highlightSelected(), and ~QGraphicsItem().
void QGraphicsItem::ungrabKeyboard | ( | ) |
Releases the keyboard grab.
Definition at line 3791 of file qgraphicsitem.cpp.
void QGraphicsItem::ungrabMouse | ( | ) |
Releases the mouse grab.
Definition at line 3723 of file qgraphicsitem.cpp.
Referenced by QGraphicsScenePrivate::clearMouseGrabber(), QGraphicsScenePrivate::grabMouse(), QDeclarativePathView::mouseReleaseEvent(), QDeclarativeMouseArea::mouseReleaseEvent(), QDeclarativeFlickable::mouseReleaseEvent(), QDeclarativePinchArea::mouseReleaseEvent(), QDeclarativeMouseArea::sendMouseEvent(), QDeclarativePinchArea::sendMouseEvent(), and setAcceptedMouseButtons().
void QGraphicsItem::unsetCursor | ( | ) |
Clears the cursor from this item.
Definition at line 2319 of file qgraphicsitem.cpp.
Schedules a redraw of the area covered by rect in this item.
You can call this function whenever your item needs to be redrawn, such as if it changes appearance or size.
This function does not cause an immediate paint; instead it schedules a paint request that is processed by QGraphicsView after control reaches the event loop. The item will only be redrawn if it is visible in any associated view.
As a side effect of the item being repainted, other items that overlap the area rect may also be repainted.
If the item is invisible (i.e., isVisible() returns false), this function does nothing.
Definition at line 6048 of file qgraphicsitem.cpp.
Referenced by QGraphicsItemGroup::addToGroup(), ShaderEffectSource::attachSourceItem(), QGraphicsWidget::changeEvent(), QDeclarativeBorderImage::doUpdate(), QDeclarativeRectangle::doUpdate(), QGraphicsWidget::event(), QGraphicsWidget::focusInEvent(), focusInEvent(), QGraphicsTextItem::focusInEvent(), QGraphicsWidget::focusOutEvent(), focusOutEvent(), QGraphicsTextItem::focusOutEvent(), hoverEnterEvent(), hoverLeaveEvent(), QDeclarativePathView::itemsRemoved(), QDeclarativeGridView::itemsRemoved(), QDeclarativeListView::itemsRemoved(), QDeclarativeBorderImage::load(), QDeclarativeImageBase::load(), ShaderEffectItem::markDirty(), QDeclarativeBorderImage::requestFinished(), QDeclarativeImageBase::requestFinished(), scroll(), QGraphicsWidget::setAutoFillBackground(), QAbstractGraphicsShapeItem::setBrush(), setCacheMode(), QDeclarativeTextInput::setColor(), QDeclarativeTextEdit::setColor(), QDeclarativeRectangle::setColor(), QDeclarativePaintedItem::setContentsScale(), QDeclarativePaintedItem::setContentsSize(), QGraphicsTextItem::setDefaultTextColor(), QGraphicsSvgItem::setElementId(), QDeclarativePaintedItem::setFillColor(), QDeclarativeImage::setFillMode(), QGraphicsPolygonItem::setFillRule(), QDeclarativeTextEdit::setFont(), QDeclarativeRectangle::setGradient(), QDeclarativeBorderImage::setGridScaledImage(), QDeclarativeBorderImage::setHorizontalTileMode(), QGraphicsLineItem::setLine(), QGraphicsSvgItem::setMaximumCacheSize(), QDeclarativeImageBase::setMirror(), QGraphicsPixmapItem::setOffset(), QGraphicsPathItem::setPath(), QAbstractGraphicsShapeItem::setPen(), QGraphicsLineItem::setPen(), QGraphicsPixmapItem::setPixmap(), QGraphicsPolygonItem::setPolygon(), QDeclarativeRectangle::setRadius(), QGraphicsRectItem::setRect(), QGraphicsEllipseItem::setRect(), setSelected(), QDeclarativeTextInput::setSelectedTextColor(), QDeclarativeTextEdit::setSelectedTextColor(), QDeclarativeTextInput::setSelectionColor(), QDeclarativeTextEdit::setSelectionColor(), QGraphicsSvgItem::setSharedRenderer(), QDeclarativeItem::setSmooth(), QGraphicsEllipseItem::setSpanAngle(), QGraphicsEllipseItem::setStartAngle(), QGraphicsSimpleTextItem::setText(), QGraphicsPixmapItem::setTransformationMode(), QDeclarativeBorderImage::setVerticalTileMode(), QDeclarativeTextEdit::updateImgCache(), QDeclarativeTextInput::updateRect(), updateRedirectedToGraphicsProxyWidget(), QDeclarativeTextEdit::updateSize(), and QDeclarativeTextInput::updateSize().
This convenience function is equivalent to calling update(QRectF(x, y, width, height)).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 505 of file qgraphicsitem.h.
|
protected |
Updates the item's micro focus.
Definition at line 7831 of file qgraphicsitem.cpp.
Referenced by QGraphicsObject::updateMicroFocus().
|
protectedvirtual |
This event handler, for event event, can be reimplemented to receive wheel events for this item.
If you reimplement this function, event will be accepted by default.
If you ignore the event, (i.e., by calling QEvent::ignore(),) it will propagate to any item beneath this item. If no items accept the event, it will be ignored by the scene, and propagate to the view (e.g., the view's vertical scroll bar).
The default implementation ignores the event.
Reimplemented in QDeclarativeFlickable, and QGraphicsProxyWidget.
Definition at line 7740 of file qgraphicsitem.cpp.
Referenced by sceneEvent(), and QDeclarativeFlickable::wheelEvent().
QGraphicsWidget * QGraphicsItem::window | ( | ) | const |
Returns the item's window, or 0 if this item does not have a window.
If the item is a window, it will return itself. Otherwise it will return the closest ancestor that is a window.
Definition at line 1717 of file qgraphicsitem.cpp.
Referenced by QShortcutMap::correctGraphicsWidgetContext(), QGraphicsWidget::initStyleOption(), QGraphicsScenePrivate::mousePressEventHandler(), and QGraphicsWidget::paintWindowFrame().
|
inline |
This convenience function is equivalent to calling pos().
x().
\sa y()
Definition at line 280 of file qgraphicsitem.h.
Referenced by QGraphicsItemGroup::addToGroup(), QDeclarativeContents::calcWidth(), FxGridItem::colPos(), FxGridItem::contains(), QDeclarativeParentChangePrivate::doChange(), FxGridItem::endRowPos(), itemTransform(), QDeclarativeMouseArea::mouseMoveEvent(), QDeclarativePaintedItem::paint(), QDeclarativeParticlesPainter::paint(), QGraphicsItemGroup::removeFromGroup(), FxGridItem::rowPos(), QDeclarativeItem::setImplicitHeight(), QDeclarativeItem::setImplicitWidth(), QDeclarativeItem::setSize(), QDeclarativePinchArea::updatePinch(), QDeclarativeParticlesPainter::updateSize(), QDeclarativeListViewPrivate::updateUnrequestedPositions(), and QGraphicsWidget::windowFrameSectionAt().
|
inline |
This convenience function is equivalent to calling pos().
y().
\sa x()
Definition at line 282 of file qgraphicsitem.h.
Referenced by QGraphicsItemGroup::addToGroup(), QDeclarativeContents::calcHeight(), QDeclarativeItem::childAt(), FxGridItem::colPos(), FxGridItem::contains(), QDeclarativeParentChangePrivate::doChange(), FxGridItem::endRowPos(), QDeclarativeMouseArea::mouseMoveEvent(), QDeclarativeParticlesPainter::paint(), QGraphicsItemGroup::removeFromGroup(), FxGridItem::rowPos(), QDeclarativeItem::setImplicitHeight(), QDeclarativeItem::setImplicitWidth(), QDeclarativeItem::setSize(), setupTextLayout(), setY(), ShaderEffectItem::updateGeometry(), QDeclarativePinchArea::updatePinch(), QDeclarativeParticlesPainter::updateSize(), QDeclarativeListViewPrivate::updateUnrequestedPositions(), and QGraphicsWidget::windowFrameSectionAt().
qreal QGraphicsItem::zValue | ( | ) | const |
Returns the Z-value of the item.
The Z-value affects the stacking order of sibling (neighboring) items.
The default Z-value is 0.
Definition at line 4895 of file qgraphicsitem.cpp.
Referenced by operator<<(), and QGraphicsScene::setActiveWindow().
|
friend |
Definition at line 493 of file qgraphicsitem.h.
|
friend |
Definition at line 491 of file qgraphicsitem.h.
|
related |
Returns the given item cast to type T if item is of type T; otherwise, 0 is returned.
Definition at line 1139 of file qgraphicsitem.h.
|
friend |
Definition at line 488 of file qgraphicsitem.h.
Referenced by setGraphicsEffect().
|
friend |
Definition at line 473 of file qgraphicsitem.h.
|
friend |
Definition at line 480 of file qgraphicsitem.h.
|
friend |
Definition at line 483 of file qgraphicsitem.h.
|
friend |
Definition at line 474 of file qgraphicsitem.h.
|
friend |
Definition at line 477 of file qgraphicsitem.h.
|
friend |
Definition at line 486 of file qgraphicsitem.h.
|
friend |
Definition at line 487 of file qgraphicsitem.h.
|
friend |
Definition at line 476 of file qgraphicsitem.h.
|
friend |
Definition at line 484 of file qgraphicsitem.h.
|
friend |
Definition at line 485 of file qgraphicsitem.h.
|
friend |
Definition at line 475 of file qgraphicsitem.h.
|
friend |
Definition at line 489 of file qgraphicsitem.h.
|
friend |
Definition at line 478 of file qgraphicsitem.h.
|
friend |
Definition at line 479 of file qgraphicsitem.h.
|
friend |
Definition at line 481 of file qgraphicsitem.h.
|
friend |
Definition at line 482 of file qgraphicsitem.h.
|
friend |
Returns true if item1 is on top of item2.
The items don't need to be siblings.
Definition at line 729 of file qgraphicsitem_p.h.
Referenced by isObscuredBy().
|
friend |
Definition at line 791 of file qgraphicsitem_p.h.
|
protected |
Definition at line 464 of file qgraphicsitem.h.
Referenced by QGraphicsScenePrivate::_q_polishItems(), QGraphicsScenePrivate::_q_updateScenePosDescendants(), QGraphicsSceneBspTreeIndexPrivate::_q_updateSortCache(), acceptDrops(), acceptedMouseButtons(), acceptHoverEvents(), acceptsHoverEvents(), acceptTouchEvents(), QGraphicsItemPrivate::addChild(), QGraphicsSceneBspTreeIndexPrivate::addItem(), QGraphicsScene::addItem(), addToIndex(), boundingRegionGranularity(), cacheMode(), QGraphicsItemPrivate::calcEffectiveOpacity(), childItems(), childrenBoundingRect(), QGraphicsItemPrivate::childrenBoundingRectHelper(), clearFocus(), QGraphicsItemPrivate::clearFocusHelper(), QGraphicsItemPrivate::clearSubFocus(), QGraphicsSceneBspTreeIndexPrivate::climbTree(), clipPath(), QGraphicsSceneBspTreeIndexPrivate::closestItemFirst_withCache(), QGraphicsSceneBspTreeIndexPrivate::closestItemLast_withCache(), collidesWithItem(), collidesWithPath(), collidingItems(), commonAncestorItem(), QGraphicsScene::contextMenuEvent(), cursor(), deviceTransform(), QGraphicsScenePrivate::draw(), QDeclarativeImplicitSizePaintedItem::drawContents(), QGraphicsScenePrivate::drawItemHelper(), QGraphicsScene::drawItems(), QGraphicsScenePrivate::drawSubtreeRecursive(), QGraphicsItemPrivate::effectiveBoundingRect(), effectiveOpacity(), QGraphicsItemPrivate::ensureSceneTransformRecursive(), QGraphicsItemPrivate::ensureSequentialSiblingIndex(), ensureVisible(), QGraphicsScenePrivate::enterModal(), QGraphicsSceneBspTreeIndexPrivate::estimateItems(), QGraphicsScenePrivate::filterDescendantEvent(), filtersChildEvents(), QGraphicsView::fitInView(), flags(), focusItem(), focusProxy(), focusScopeItem(), QGraphicsObject::grabGesture(), grabKeyboard(), grabMouse(), graphicsEffect(), group(), handlesChildEvents(), hasCursor(), hasFocus(), inputMethodQuery(), QGraphicsItemPrivate::insertionOrder(), installSceneEventFilter(), QGraphicsItemPrivate::invalidateChildGraphicsEffectsRecursively(), QGraphicsItemPrivate::invalidateDepthRecursively(), QGraphicsItemPrivate::invalidateParentGraphicsEffectsRecursively(), isActive(), isAncestorOf(), isBlockedByModalPanel(), isEnabled(), isPanel(), isSelected(), isVisible(), isVisibleTo(), isWidget(), isWindow(), QGraphicsScenePrivate::itemAcceptsHoverEvents_helper(), QGraphicsSceneBspTreeIndex::itemChange(), QGraphicsSceneBspTree::items(), itemTransform(), mapFromParent(), mapFromScene(), mapRectFromParent(), mapRectFromScene(), mapRectToParent(), mapRectToScene(), mapToParent(), mapToScene(), QGraphicsViewPrivate::mapToViewRect(), QGraphicsScenePrivate::markDirty(), QGraphicsItemPrivate::markParentDirty(), mouseMoveEvent(), mousePressEvent(), QGraphicsTextItem::mousePressEvent(), QGraphicsScenePrivate::mousePressEventHandler(), mouseReleaseEvent(), QGraphicsItemPrivate::movableAncestorIsSelected(), opacity(), QGraphicsView::paintEvent(), panel(), panelModality(), parentItem(), parentObject(), pos(), QGraphicsSceneBspTreeIndex::prepareBoundingRectChange(), prepareGeometryChange(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QGraphicsItem(), QGraphicsObject::QGraphicsObject(), qt_closestItemFirst(), qt_closestLeaf(), QGraphicsSceneIndexPrivate::recursive_items_helper(), QGraphicsScenePrivate::registerTopLevelItem(), QGraphicsItemPrivate::removeChild(), QGraphicsItemGroup::removeFromGroup(), removeFromIndex(), QGraphicsSceneBspTreeIndexPrivate::removeItem(), QGraphicsScenePrivate::removeItemHelper(), removeSceneEventFilter(), QGraphicsScenePrivate::resetDirtyItem(), rotation(), scale(), scene(), sceneBoundingRect(), QGraphicsItemPrivate::sceneEffectiveBoundingRect(), sceneEvent(), sceneMatrix(), sceneTransform(), QGraphicsScenePrivate::sendDragDropEvent(), QGraphicsScenePrivate::sendHoverEvent(), QGraphicsScenePrivate::sendMouseEvent(), QGraphicsScenePrivate::sendTouchBeginEvent(), setAcceptDrops(), setAcceptedMouseButtons(), setAcceptHoverEvents(), setAcceptTouchEvents(), setActive(), setBoundingRegionGranularity(), setCacheMode(), setCursor(), setEnabled(), QGraphicsItemPrivate::setEnabledHelper(), setFiltersChildEvents(), setFlag(), setFlags(), setFocus(), QGraphicsItemPrivate::setFocusHelper(), setFocusProxy(), setGraphicsEffect(), setHandlesChildEvents(), QGraphicsTransformPrivate::setItem(), setMatrix(), QGraphicsSvgItem::setMaximumCacheSize(), setOpacity(), setPanelModality(), setParentItem(), QGraphicsItemPrivate::setParentItemHelper(), setPos(), setRotation(), setScale(), QGraphicsScenePrivate::setScenePosItemEnabled(), setSelected(), QGraphicsItemPrivate::setSubFocus(), setToolTip(), setTransform(), setTransformations(), setTransformOriginPoint(), QGraphicsViewPrivate::setUpdateClip(), setVisible(), QGraphicsItemPrivate::setVisibleHelper(), QGraphicsProxyWidgetPrivate::setWidget_helper(), setX(), setY(), setZValue(), stackBefore(), QGraphicsScenePrivate::storeMouseButtonsForMouseGrabber(), toGraphicsObject(), toolTip(), transform(), transformations(), transformOriginPoint(), QGraphicsScenePrivate::ungrabGesture(), QGraphicsObject::ungrabGesture(), ungrabKeyboard(), ungrabMouse(), QGraphicsScenePrivate::unregisterTopLevelItem(), unsetCursor(), update(), QGraphicsItemPrivate::updateChildWithGraphicsEffectFlagRecursively(), QGraphicsWidgetPrivate::updateFont(), QGraphicsScenePrivate::updateFont(), QGraphicsTransformPrivate::updateItem(), QGraphicsItemPrivate::updatePaintedViewBoundingRects(), QGraphicsWidgetPrivate::updatePalette(), QGraphicsScenePrivate::updatePalette(), QGraphicsScenePrivate::updateTouchPointsForItem(), QGraphicsSceneFindItemBspTreeVisitor::visit(), QGraphicsScene::wheelEvent(), zValue(), QDeclarativeItem::~QDeclarativeItem(), and ~QGraphicsItem().