QtBase  v6.3.1
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
HarakiriItem Class Reference
Inheritance diagram for HarakiriItem:
Inheritance graph
[legend]
Collaboration diagram for HarakiriItem:
Collaboration graph
[legend]

Public Member Functions

 HarakiriItem (int harakiriPoint)
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 
void advance (int n) override
 
- Public Member Functions inherited from QGraphicsRectItem
 QGraphicsRectItem (QGraphicsItem *parent=nullptr)
 
 QGraphicsRectItem (const QRectF &rect, QGraphicsItem *parent=nullptr)
 
 QGraphicsRectItem (qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent=nullptr)
 
 ~QGraphicsRectItem ()
 
QRectF rect () const
 
void setRect (const QRectF &rect)
 
void setRect (qreal x, qreal y, qreal w, qreal h)
 
QRectF boundingRect () const override
 
QPainterPath shape () const override
 
bool contains (const QPointF &point) const override
 
bool isObscuredBy (const QGraphicsItem *item) const override
 
QPainterPath opaqueArea () const override
 
int type () const override
 
- Public Member Functions inherited from QAbstractGraphicsShapeItem
 QAbstractGraphicsShapeItem (QGraphicsItem *parent=nullptr)
 
 ~QAbstractGraphicsShapeItem ()
 
QPen pen () const
 
void setPen (const QPen &pen)
 
QBrush brush () const
 
void setBrush (const QBrush &brush)
 
- Public Member Functions inherited from QGraphicsItem
 QGraphicsItem (QGraphicsItem *parent=nullptr)
 
virtual ~QGraphicsItem ()
 
QGraphicsScenescene () const
 
QGraphicsItemparentItem () const
 
QGraphicsItemtopLevelItem () const
 
QGraphicsObjectparentObject () const
 
QGraphicsWidgetparentWidget () const
 
QGraphicsWidgettopLevelWidget () const
 
QGraphicsWidgetwindow () const
 
QGraphicsItempanel () const
 
void setParentItem (QGraphicsItem *parent)
 
QList< QGraphicsItem * > childItems () const
 
bool isWidget () const
 
bool isWindow () const
 
bool isPanel () const
 
QGraphicsObjecttoGraphicsObject ()
 
const QGraphicsObjecttoGraphicsObject () const
 
QGraphicsItemGroupgroup () const
 
void setGroup (QGraphicsItemGroup *group)
 
GraphicsItemFlags flags () const
 
void setFlag (GraphicsItemFlag flag, bool enabled=true)
 
void setFlags (GraphicsItemFlags flags)
 
CacheMode cacheMode () const
 
void setCacheMode (CacheMode mode, const QSize &cacheSize=QSize())
 
PanelModality panelModality () const
 
void setPanelModality (PanelModality panelModality)
 
bool isBlockedByModalPanel (QGraphicsItem **blockingPanel=nullptr) const
 
QCursor cursor () const
 
void setCursor (const QCursor &cursor)
 
bool hasCursor () const
 
void unsetCursor ()
 
bool isVisible () const
 
bool isVisibleTo (const QGraphicsItem *parent) const
 
void setVisible (bool visible)
 
void hide ()
 
void show ()
 
bool isEnabled () const
 
void setEnabled (bool enabled)
 
bool isSelected () const
 
void setSelected (bool selected)
 
bool acceptDrops () const
 
void setAcceptDrops (bool on)
 
qreal opacity () const
 
qreal effectiveOpacity () const
 
void setOpacity (qreal opacity)
 
Qt::MouseButtons acceptedMouseButtons () const
 
void setAcceptedMouseButtons (Qt::MouseButtons buttons)
 
bool acceptHoverEvents () const
 
void setAcceptHoverEvents (bool enabled)
 
bool acceptTouchEvents () const
 
void setAcceptTouchEvents (bool enabled)
 
bool filtersChildEvents () const
 
void setFiltersChildEvents (bool enabled)
 
bool handlesChildEvents () const
 
void setHandlesChildEvents (bool enabled)
 
bool isActive () const
 
void setActive (bool active)
 
bool hasFocus () const
 
void setFocus (Qt::FocusReason focusReason=Qt::OtherFocusReason)
 
void clearFocus ()
 
QGraphicsItemfocusProxy () const
 
void setFocusProxy (QGraphicsItem *item)
 
QGraphicsItemfocusItem () const
 
QGraphicsItemfocusScopeItem () const
 
void grabMouse ()
 
void ungrabMouse ()
 
void grabKeyboard ()
 
void ungrabKeyboard ()
 
QPointF pos () const
 
qreal x () const
 
void setX (qreal x)
 
qreal y () const
 
void setY (qreal y)
 
QPointF scenePos () const
 
void setPos (const QPointF &pos)
 
void setPos (qreal x, qreal y)
 
void moveBy (qreal dx, qreal dy)
 
void ensureVisible (const QRectF &rect=QRectF(), int xmargin=50, int ymargin=50)
 
void ensureVisible (qreal x, qreal y, qreal w, qreal h, int xmargin=50, int ymargin=50)
 
QTransform transform () const
 
QTransform sceneTransform () const
 
QTransform deviceTransform (const QTransform &viewportTransform) const
 
QTransform itemTransform (const QGraphicsItem *other, bool *ok=nullptr) const
 
void setTransform (const QTransform &matrix, bool combine=false)
 
void resetTransform ()
 
void setRotation (qreal angle)
 
qreal rotation () const
 
void setScale (qreal scale)
 
qreal scale () const
 
QList< QGraphicsTransform * > transformations () const
 
void setTransformations (const QList< QGraphicsTransform * > &transformations)
 
QPointF transformOriginPoint () const
 
void setTransformOriginPoint (const QPointF &origin)
 
void setTransformOriginPoint (qreal ax, qreal ay)
 
qreal zValue () const
 
void setZValue (qreal z)
 
void stackBefore (const QGraphicsItem *sibling)
 
QRectF childrenBoundingRect () const
 
QRectF sceneBoundingRect () const
 
bool isClipped () const
 
QPainterPath clipPath () const
 
virtual bool collidesWithItem (const QGraphicsItem *other, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 
virtual bool collidesWithPath (const QPainterPath &path, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 
QList< QGraphicsItem * > collidingItems (Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 
bool isObscured (const QRectF &rect=QRectF()) const
 
bool isObscured (qreal x, qreal y, qreal w, qreal h) const
 
QRegion boundingRegion (const QTransform &itemToDeviceTransform) const
 
qreal boundingRegionGranularity () const
 
void setBoundingRegionGranularity (qreal granularity)
 
void update (const QRectF &rect=QRectF())
 
void update (qreal x, qreal y, qreal width, qreal height)
 
void scroll (qreal dx, qreal dy, const QRectF &rect=QRectF())
 
QPointF mapToItem (const QGraphicsItem *item, const QPointF &point) const
 
QPointF mapToParent (const QPointF &point) const
 
QPointF mapToScene (const QPointF &point) const
 
QPolygonF mapToItem (const QGraphicsItem *item, const QRectF &rect) const
 
QPolygonF mapToParent (const QRectF &rect) const
 
QPolygonF mapToScene (const QRectF &rect) const
 
QRectF mapRectToItem (const QGraphicsItem *item, const QRectF &rect) const
 
QRectF mapRectToParent (const QRectF &rect) const
 
QRectF mapRectToScene (const QRectF &rect) const
 
QPolygonF mapToItem (const QGraphicsItem *item, const QPolygonF &polygon) const
 
QPolygonF mapToParent (const QPolygonF &polygon) const
 
QPolygonF mapToScene (const QPolygonF &polygon) const
 
QPainterPath mapToItem (const QGraphicsItem *item, const QPainterPath &path) const
 
QPainterPath mapToParent (const QPainterPath &path) const
 
QPainterPath mapToScene (const QPainterPath &path) const
 
QPointF mapFromItem (const QGraphicsItem *item, const QPointF &point) const
 
QPointF mapFromParent (const QPointF &point) const
 
QPointF mapFromScene (const QPointF &point) const
 
QPolygonF mapFromItem (const QGraphicsItem *item, const QRectF &rect) const
 
QPolygonF mapFromParent (const QRectF &rect) const
 
QPolygonF mapFromScene (const QRectF &rect) const
 
QRectF mapRectFromItem (const QGraphicsItem *item, const QRectF &rect) const
 
QRectF mapRectFromParent (const QRectF &rect) const
 
QRectF mapRectFromScene (const QRectF &rect) const
 
QPolygonF mapFromItem (const QGraphicsItem *item, const QPolygonF &polygon) const
 
QPolygonF mapFromParent (const QPolygonF &polygon) const
 
QPolygonF mapFromScene (const QPolygonF &polygon) const
 
QPainterPath mapFromItem (const QGraphicsItem *item, const QPainterPath &path) const
 
QPainterPath mapFromParent (const QPainterPath &path) const
 
QPainterPath mapFromScene (const QPainterPath &path) const
 
QPointF mapToItem (const QGraphicsItem *item, qreal x, qreal y) const
 
QPointF mapToParent (qreal x, qreal y) const
 
QPointF mapToScene (qreal x, qreal y) const
 
QPolygonF mapToItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const
 
QPolygonF mapToParent (qreal x, qreal y, qreal w, qreal h) const
 
QPolygonF mapToScene (qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectToItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectToParent (qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectToScene (qreal x, qreal y, qreal w, qreal h) const
 
QPointF mapFromItem (const QGraphicsItem *item, qreal x, qreal y) const
 
QPointF mapFromParent (qreal x, qreal y) const
 
QPointF mapFromScene (qreal x, qreal y) const
 
QPolygonF mapFromItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const
 
QPolygonF mapFromParent (qreal x, qreal y, qreal w, qreal h) const
 
QPolygonF mapFromScene (qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectFromItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectFromParent (qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectFromScene (qreal x, qreal y, qreal w, qreal h) const
 
bool isAncestorOf (const QGraphicsItem *child) const
 
QGraphicsItemcommonAncestorItem (const QGraphicsItem *other) const
 
bool isUnderMouse () const
 
QVariant data (int key) const
 
void setData (int key, const QVariant &value)
 
Qt::InputMethodHints inputMethodHints () const
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void installSceneEventFilter (QGraphicsItem *filterItem)
 
void removeSceneEventFilter (QGraphicsItem *filterItem)
 

Static Public Attributes

static bool dead
 

Protected Member Functions

void contextMenuEvent (QGraphicsSceneContextMenuEvent *) override
 
void dragEnterEvent (QGraphicsSceneDragDropEvent *event) override
 
void dragLeaveEvent (QGraphicsSceneDragDropEvent *event) override
 
void dragMoveEvent (QGraphicsSceneDragDropEvent *event) override
 
void dropEvent (QGraphicsSceneDragDropEvent *event) override
 
void focusInEvent (QFocusEvent *) override
 
void focusOutEvent (QFocusEvent *) override
 
void hoverEnterEvent (QGraphicsSceneHoverEvent *) override
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *) override
 
void hoverMoveEvent (QGraphicsSceneHoverEvent *) override
 
void inputMethodEvent (QInputMethodEvent *event) override
 
QVariant inputMethodQuery (Qt::InputMethodQuery query) const override
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 
void keyPressEvent (QKeyEvent *) override
 
void keyReleaseEvent (QKeyEvent *) override
 
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *) override
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *) override
 
void mousePressEvent (QGraphicsSceneMouseEvent *) override
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *) override
 
bool sceneEvent (QEvent *event) override
 
bool sceneEventFilter (QGraphicsItem *watched, QEvent *event) override
 
void wheelEvent (QGraphicsSceneWheelEvent *) override
 
- Protected Member Functions inherited from QGraphicsRectItem
bool supportsExtension (Extension extension) const override
 
void setExtension (Extension extension, const QVariant &variant) override
 
QVariant extension (const QVariant &variant) const override
 
- Protected Member Functions inherited from QAbstractGraphicsShapeItem
 QAbstractGraphicsShapeItem (QAbstractGraphicsShapeItemPrivate &dd, QGraphicsItem *parent)
 
- Protected Member Functions inherited from QGraphicsItem
void updateMicroFocus ()
 
 QGraphicsItem (QGraphicsItemPrivate &dd, QGraphicsItem *parent)
 
void addToIndex ()
 
void removeFromIndex ()
 
void prepareGeometryChange ()
 

Additional Inherited Members

- Public Types inherited from QGraphicsRectItem
enum  { Type = 3 }
 
- Public Types inherited from QGraphicsItem
enum  GraphicsItemFlag {
  ItemIsMovable = 0x1 , ItemIsSelectable = 0x2 , ItemIsFocusable = 0x4 , ItemClipsToShape = 0x8 ,
  ItemClipsChildrenToShape = 0x10 , ItemIgnoresTransformations = 0x20 , ItemIgnoresParentOpacity = 0x40 , ItemDoesntPropagateOpacityToChildren = 0x80 ,
  ItemStacksBehindParent = 0x100 , ItemUsesExtendedStyleOption = 0x200 , ItemHasNoContents = 0x400 , ItemSendsGeometryChanges = 0x800 ,
  ItemAcceptsInputMethod = 0x1000 , ItemNegativeZStacksBehindParent = 0x2000 , ItemIsPanel = 0x4000 , ItemIsFocusScope = 0x8000 ,
  ItemSendsScenePositionChanges = 0x10000 , ItemStopsClickFocusPropagation = 0x20000 , ItemStopsFocusHandling = 0x40000 , ItemContainsChildrenInShape = 0x80000
}
 
enum  GraphicsItemChange {
  ItemPositionChange , ItemVisibleChange = 2 , ItemEnabledChange , ItemSelectedChange ,
  ItemParentChange , ItemChildAddedChange , ItemChildRemovedChange , ItemTransformChange ,
  ItemPositionHasChanged , ItemTransformHasChanged , ItemSceneChange , ItemVisibleHasChanged ,
  ItemEnabledHasChanged , ItemSelectedHasChanged , ItemParentHasChanged , ItemSceneHasChanged ,
  ItemCursorChange , ItemCursorHasChanged , ItemToolTipChange , ItemToolTipHasChanged ,
  ItemFlagsChange , ItemFlagsHaveChanged , ItemZValueChange , ItemZValueHasChanged ,
  ItemOpacityChange , ItemOpacityHasChanged , ItemScenePositionHasChanged , ItemRotationChange ,
  ItemRotationHasChanged , ItemScaleChange , ItemScaleHasChanged , ItemTransformOriginPointChange ,
  ItemTransformOriginPointHasChanged
}
 
enum  CacheMode { NoCache , ItemCoordinateCache , DeviceCoordinateCache }
 
enum  PanelModality { NonModal , PanelModal , SceneModal }
 
enum  { Type = 1 , UserType = 65536 }
 
- Protected Types inherited from QGraphicsItem
enum  Extension { UserExtension = 0x80000000 }
 
- Protected Attributes inherited from QGraphicsItem
QScopedPointer< QGraphicsItemPrivated_ptr
 

Detailed Description

Definition at line 5138 of file tst_qgraphicsitem.cpp.

Constructor & Destructor Documentation

◆ HarakiriItem()

HarakiriItem::HarakiriItem ( int  harakiriPoint)
inline

Definition at line 5141 of file tst_qgraphicsitem.cpp.

Member Function Documentation

◆ advance()

void HarakiriItem::advance ( int  phase)
inlineoverridevirtual

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.

This function is intended for animations. An alternative is to multiple-inherit from QObject and QGraphicsItem and use the \l{The Animation Framework}{Animation Framework}.

See also
QGraphicsScene::advance(), QTimeLine

Reimplemented from QGraphicsItem.

Definition at line 5159 of file tst_qgraphicsitem.cpp.

◆ contextMenuEvent()

void HarakiriItem::contextMenuEvent ( QGraphicsSceneContextMenuEvent event)
inlineoverrideprotectedvirtual

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.

See also
sceneEvent()

Reimplemented from QGraphicsItem.

Definition at line 5176 of file tst_qgraphicsitem.cpp.

◆ dragEnterEvent()

void HarakiriItem::dragEnterEvent ( QGraphicsSceneDragDropEvent event)
inlineoverrideprotectedvirtual

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.

See also
dropEvent(), dragMoveEvent(), dragLeaveEvent()

Reimplemented from QGraphicsItem.

Definition at line 5185 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ dragLeaveEvent()

void HarakiriItem::dragLeaveEvent ( QGraphicsSceneDragDropEvent event)
inlineoverrideprotectedvirtual

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.

See also
dragEnterEvent(), dropEvent(), dragMoveEvent()

Reimplemented from QGraphicsItem.

Definition at line 5191 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ dragMoveEvent()

void HarakiriItem::dragMoveEvent ( QGraphicsSceneDragDropEvent event)
inlineoverrideprotectedvirtual

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.

See also
dropEvent(), dragEnterEvent(), dragLeaveEvent()

Reimplemented from QGraphicsItem.

Definition at line 5197 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ dropEvent()

void HarakiriItem::dropEvent ( QGraphicsSceneDragDropEvent event)
inlineoverrideprotectedvirtual

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.

See also
dragEnterEvent(), dragMoveEvent(), dragLeaveEvent()

Reimplemented from QGraphicsItem.

Definition at line 5203 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ focusInEvent()

void HarakiriItem::focusInEvent ( QFocusEvent event)
inlineoverrideprotectedvirtual

This event handler, for event event, can be reimplemented to receive focus in events for this item. The default implementation calls ensureVisible().

See also
focusOutEvent(), sceneEvent(), setFocus()

Reimplemented from QGraphicsItem.

Definition at line 5209 of file tst_qgraphicsitem.cpp.

◆ focusOutEvent()

void HarakiriItem::focusOutEvent ( QFocusEvent event)
inlineoverrideprotectedvirtual

This event handler, for event event, can be reimplemented to receive focus out events for this item. The default implementation does nothing.

See also
focusInEvent(), sceneEvent(), setFocus()

Reimplemented from QGraphicsItem.

Definition at line 5217 of file tst_qgraphicsitem.cpp.

◆ hoverEnterEvent()

void HarakiriItem::hoverEnterEvent ( QGraphicsSceneHoverEvent event)
inlineoverrideprotectedvirtual

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.

See also
hoverMoveEvent(), hoverLeaveEvent(), sceneEvent(), setAcceptHoverEvents()

Reimplemented from QGraphicsItem.

Definition at line 5225 of file tst_qgraphicsitem.cpp.

◆ hoverLeaveEvent()

void HarakiriItem::hoverLeaveEvent ( QGraphicsSceneHoverEvent event)
inlineoverrideprotectedvirtual

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.

See also
hoverEnterEvent(), hoverMoveEvent(), sceneEvent(), setAcceptHoverEvents()

Reimplemented from QGraphicsItem.

Definition at line 5233 of file tst_qgraphicsitem.cpp.

◆ hoverMoveEvent()

void HarakiriItem::hoverMoveEvent ( QGraphicsSceneHoverEvent event)
inlineoverrideprotectedvirtual

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.

See also
hoverEnterEvent(), hoverLeaveEvent(), sceneEvent(), setAcceptHoverEvents()

Reimplemented from QGraphicsItem.

Definition at line 5241 of file tst_qgraphicsitem.cpp.

◆ inputMethodEvent()

void HarakiriItem::inputMethodEvent ( QInputMethodEvent event)
inlineoverrideprotectedvirtual

This event handler, for event event, can be reimplemented to receive input method events for this item. The default implementation ignores the event.

See also
inputMethodQuery(), sceneEvent()

Reimplemented from QGraphicsItem.

Definition at line 5249 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ inputMethodQuery()

QVariant HarakiriItem::inputMethodQuery ( Qt::InputMethodQuery  query) const
inlineoverrideprotectedvirtual

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.

See also
inputMethodEvent(), QInputMethodEvent

Reimplemented from QGraphicsItem.

Definition at line 5255 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ itemChange()

QVariant HarakiriItem::itemChange ( GraphicsItemChange  change,
const QVariant value 
)
inlineoverrideprotectedvirtual

This virtual function is called by QGraphicsItem to notify custom items that some part of the item's state changes. By reimplementing this function, you 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.

See also
GraphicsItemChange

Reimplemented from QGraphicsItem.

Definition at line 5261 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ keyPressEvent()

void HarakiriItem::keyPressEvent ( QKeyEvent event)
inlineoverrideprotectedvirtual

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.

See also
keyReleaseEvent(), setFocus(), QGraphicsScene::setFocusItem(), sceneEvent()

Reimplemented from QGraphicsItem.

Definition at line 5267 of file tst_qgraphicsitem.cpp.

◆ keyReleaseEvent()

void HarakiriItem::keyReleaseEvent ( QKeyEvent event)
inlineoverrideprotectedvirtual

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.

See also
keyPressEvent(), setFocus(), QGraphicsScene::setFocusItem(), sceneEvent()

Reimplemented from QGraphicsItem.

Definition at line 5275 of file tst_qgraphicsitem.cpp.

◆ mouseDoubleClickEvent()

void HarakiriItem::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent event)
inlineoverrideprotectedvirtual

This event handler, for event event, can be reimplemented to receive mouse double-click 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 double-click 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 \l {QGraphicsItem::ItemIsSelectable}{selectable} nor \l{QGraphicsItem::ItemIsMovable}{movable} (single mouse clicks are ignored in this case, and that stops the generation of double clicks).

See also
mousePressEvent(), mouseMoveEvent(), mouseReleaseEvent(), sceneEvent()

Reimplemented from QGraphicsItem.

Definition at line 5283 of file tst_qgraphicsitem.cpp.

◆ mouseMoveEvent()

void HarakiriItem::mouseMoveEvent ( QGraphicsSceneMouseEvent event)
inlineoverrideprotectedvirtual

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.

See also
mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), sceneEvent()

Reimplemented from QGraphicsItem.

Definition at line 5291 of file tst_qgraphicsitem.cpp.

◆ mousePressEvent()

void HarakiriItem::mousePressEvent ( QGraphicsSceneMouseEvent event)
inlineoverrideprotectedvirtual

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 double-click 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.

The event is \l{QEvent::ignore()}d for items that are neither \l{QGraphicsItem::ItemIsMovable}{movable} nor \l{QGraphicsItem::ItemIsSelectable}{selectable}.

See also
mouseMoveEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), sceneEvent()

Reimplemented from QGraphicsItem.

Definition at line 5299 of file tst_qgraphicsitem.cpp.

◆ mouseReleaseEvent()

void HarakiriItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent event)
inlineoverrideprotectedvirtual

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.

See also
mousePressEvent(), mouseMoveEvent(), mouseDoubleClickEvent(), sceneEvent()

Reimplemented from QGraphicsItem.

Definition at line 5307 of file tst_qgraphicsitem.cpp.

◆ paint()

void HarakiriItem::paint ( QPainter painter,
const QStyleOptionGraphicsItem option,
QWidget widget 
)
inlineoverridevirtual

\reimp

Reimplemented from QGraphicsRectItem.

Definition at line 5147 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ sceneEvent()

bool HarakiriItem::sceneEvent ( QEvent event)
inlineoverrideprotectedvirtual

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 from QGraphicsItem.

Definition at line 5315 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ sceneEventFilter()

bool HarakiriItem::sceneEventFilter ( QGraphicsItem watched,
QEvent event 
)
inlineoverrideprotectedvirtual

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 sent 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.

See also
installSceneEventFilter()

Reimplemented from QGraphicsItem.

Definition at line 5321 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ wheelEvent()

void HarakiriItem::wheelEvent ( QGraphicsSceneWheelEvent event)
inlineoverrideprotectedvirtual

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.

See also
sceneEvent()

Reimplemented from QGraphicsItem.

Definition at line 5327 of file tst_qgraphicsitem.cpp.

Member Data Documentation

◆ dead

bool HarakiriItem::dead
static

Definition at line 5145 of file tst_qgraphicsitem.cpp.


The documentation for this class was generated from the following file: