QtBase  v6.3.1
Public Types | Public Member Functions | Public Attributes | List of all members
CustomItem Class Reference

[0] More...

#include <customitem.h>

Inheritance diagram for CustomItem:
Inheritance graph
[legend]
Collaboration diagram for CustomItem:
Collaboration graph
[legend]

Public Types

enum  { Type = UserType + 1 }
 
- 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 }
 
- Public Types inherited from QStandardItem
enum  ItemType { Type = 0 , UserType = 1000 }
 
- Public Types inherited from QGraphicsRectItem
enum  { Type = 3 }
 

Public Member Functions

int type () const override
 
int type () const override
 
void mousePressEvent (QGraphicsSceneMouseEvent *event)
 [5] More...
 
QStandardItemclone () const override
 
int type () const override
 
bool operator< (const QStandardItem &other) const override
 
int type () const override
 
QStandardItemclone () const override
 
 CustomItem (qreal x, qreal y, qreal width, qreal height, QGraphicsItem *parent=nullptr)
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 
void reset ()
 
 CustomItem (qreal x, qreal y, qreal width, qreal height)
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 
void reset ()
 
QRectF boundingRect () const override
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
 
 CustomItem (qreal x, qreal y, qreal width, qreal height, const QBrush &brush=QBrush())
 
virtual ~CustomItem ()
 
 QStandardItem ()
 
 QStandardItem (const QString &text)
 
 QStandardItem (const QIcon &icon, const QString &text)
 
 QStandardItem (int rows, int columns=1)
 
 QStandardItem (const QStandardItem &other)
 
 QStandardItem (QStandardItemPrivate &dd)
 
 QStandardItem ()
 
 QStandardItem (const QString &text)
 
 QStandardItem (const QIcon &icon, const QString &text)
 
 QStandardItem (int rows, int columns=1)
 
 QStandardItem (const QStandardItem &other)
 
 QStandardItem (QStandardItemPrivate &dd)
 
virtual QStandardItemclone () const
 
void emitDataChanged ()
 
 QStandardItem ()
 
 QStandardItem (const QString &text)
 
 QStandardItem (const QIcon &icon, const QString &text)
 
 QStandardItem (int rows, int columns=1)
 
 QStandardItem (const QStandardItem &other)
 
 QStandardItem (QStandardItemPrivate &dd)
 
- 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)
 
virtual void advance (int phase)
 
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)
 
- Public Member Functions inherited from QStandardItem
 QStandardItem ()
 
 QStandardItem (const QString &text)
 
 QStandardItem (const QIcon &icon, const QString &text)
 
 QStandardItem (int rows, int columns=1)
 
virtual ~QStandardItem ()
 
virtual QVariant data (int role=Qt::UserRole+1) const
 
virtual void multiData (QModelRoleDataSpan roleDataSpan) const
 
virtual void setData (const QVariant &value, int role=Qt::UserRole+1)
 
void clearData ()
 
QString text () const
 
void setText (const QString &text)
 
QIcon icon () const
 
void setIcon (const QIcon &icon)
 
QString toolTip () const
 
void setToolTip (const QString &toolTip)
 
QString statusTip () const
 
void setStatusTip (const QString &statusTip)
 
QSize sizeHint () const
 
void setSizeHint (const QSize &sizeHint)
 
QFont font () const
 
void setFont (const QFont &font)
 
Qt::Alignment textAlignment () const
 
void setTextAlignment (Qt::Alignment textAlignment)
 
QBrush background () const
 
void setBackground (const QBrush &brush)
 
QBrush foreground () const
 
void setForeground (const QBrush &brush)
 
Qt::CheckState checkState () const
 
void setCheckState (Qt::CheckState checkState)
 
QString accessibleText () const
 
void setAccessibleText (const QString &accessibleText)
 
QString accessibleDescription () const
 
void setAccessibleDescription (const QString &accessibleDescription)
 
Qt::ItemFlags flags () const
 
void setFlags (Qt::ItemFlags flags)
 
bool isEnabled () const
 
void setEnabled (bool enabled)
 
bool isEditable () const
 
void setEditable (bool editable)
 
bool isSelectable () const
 
void setSelectable (bool selectable)
 
bool isCheckable () const
 
void setCheckable (bool checkable)
 
bool isAutoTristate () const
 
void setAutoTristate (bool tristate)
 
bool isUserTristate () const
 
void setUserTristate (bool tristate)
 
QStandardItemparent () const
 
int row () const
 
int column () const
 
QModelIndex index () const
 
QStandardItemModelmodel () const
 
int rowCount () const
 
void setRowCount (int rows)
 
int columnCount () const
 
void setColumnCount (int columns)
 
bool hasChildren () const
 
QStandardItemchild (int row, int column=0) const
 
void setChild (int row, int column, QStandardItem *item)
 
void setChild (int row, QStandardItem *item)
 
void insertRow (int row, const QList< QStandardItem * > &items)
 
void insertColumn (int column, const QList< QStandardItem * > &items)
 
void insertRows (int row, const QList< QStandardItem * > &items)
 
void insertRows (int row, int count)
 
void insertColumns (int column, int count)
 
void removeRow (int row)
 
void removeColumn (int column)
 
void removeRows (int row, int count)
 
void removeColumns (int column, int count)
 
void appendRow (const QList< QStandardItem * > &items)
 
void appendRows (const QList< QStandardItem * > &items)
 
void appendColumn (const QList< QStandardItem * > &items)
 
void insertRow (int row, QStandardItem *item)
 
void appendRow (QStandardItem *item)
 
QStandardItemtakeChild (int row, int column=0)
 
QList< QStandardItem * > takeRow (int row)
 
QList< QStandardItem * > takeColumn (int column)
 
void sortChildren (int column, Qt::SortOrder order=Qt::AscendingOrder)
 
virtual void read (QDataStream &in)
 
virtual void write (QDataStream &out) const
 
- 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)
 
QPainterPath shape () const override
 
bool contains (const QPointF &point) const override
 
bool isObscuredBy (const QGraphicsItem *item) const override
 
QPainterPath opaqueArea () 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 Attributes

int numRepaints
 
QPainterm_painter
 
const QStyleOptionm_styleOption
 

Additional Inherited Members

- Protected Types inherited from QGraphicsItem
enum  Extension { UserExtension = 0x80000000 }
 
- Protected Member Functions inherited from QGraphicsItem
void updateMicroFocus ()
 
virtual bool sceneEventFilter (QGraphicsItem *watched, QEvent *event)
 
virtual bool sceneEvent (QEvent *event)
 
virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
 
virtual void dragEnterEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dragLeaveEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dragMoveEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void dropEvent (QGraphicsSceneDragDropEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event)
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 
virtual void keyPressEvent (QKeyEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 
virtual void wheelEvent (QGraphicsSceneWheelEvent *event)
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
 
virtual QVariant itemChange (GraphicsItemChange change, const QVariant &value)
 
 QGraphicsItem (QGraphicsItemPrivate &dd, QGraphicsItem *parent)
 
void addToIndex ()
 
void removeFromIndex ()
 
void prepareGeometryChange ()
 
- Protected Member Functions inherited from QStandardItem
 QStandardItem (const QStandardItem &other)
 
 QStandardItem (QStandardItemPrivate &dd)
 
QStandardItemoperator= (const QStandardItem &other)
 
void emitDataChanged ()
 
- 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 Attributes inherited from QGraphicsItem
QScopedPointer< QGraphicsItemPrivated_ptr
 
- Protected Attributes inherited from QStandardItem
QScopedPointer< QStandardItemPrivated_ptr
 

Detailed Description

[0]

[1]

Definition at line 72 of file src_gui_graphicsview_qgraphicsitem.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 75 of file src_gui_graphicsview_qgraphicsitem.cpp.

Constructor & Destructor Documentation

◆ CustomItem() [1/3]

CustomItem::CustomItem ( qreal  x,
qreal  y,
qreal  width,
qreal  height,
QGraphicsItem parent = nullptr 
)
inline

Definition at line 71 of file tst_qgraphicseffect.cpp.

Here is the caller graph for this function:

◆ CustomItem() [2/3]

CustomItem::CustomItem ( qreal  x,
qreal  y,
qreal  width,
qreal  height 
)
inline

Definition at line 41 of file tst_qgraphicseffectsource.cpp.

◆ CustomItem() [3/3]

CustomItem::CustomItem ( qreal  x,
qreal  y,
qreal  width,
qreal  height,
const QBrush brush = QBrush() 
)

Definition at line 86 of file customitem.cpp.

Here is the call graph for this function:

◆ ~CustomItem()

virtual CustomItem::~CustomItem ( )
inlinevirtual

Definition at line 51 of file customitem.h.

Member Function Documentation

◆ boundingRect()

QRectF CustomItem::boundingRect ( ) const
inlineoverridevirtual

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 it 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 within 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:

See also
boundingRegion(), shape(), contains(), {The Graphics View Coordinate System}, prepareGeometryChange()

Implements QGraphicsItem.

Definition at line 4122 of file tst_qgraphicsitem.cpp.

Here is the caller graph for this function:

◆ clone() [1/3]

QStandardItem * QStandardItem::clone

Returns a copy of this item. The item's children are not copied.

When subclassing QStandardItem, you can reimplement this function to provide QStandardItemModel with a factory that it can use to create new items on demand.

See also
QStandardItemModel::setItemPrototype(), operator=()

Definition at line 226 of file qstandarditemmodel.cpp.

◆ clone() [2/3]

QStandardItem* CustomItem::clone ( ) const
inlineoverridevirtual

Returns a copy of this item. The item's children are not copied.

When subclassing QStandardItem, you can reimplement this function to provide QStandardItemModel with a factory that it can use to create new items on demand.

See also
QStandardItemModel::setItemPrototype(), operator=()

Reimplemented from QStandardItem.

Definition at line 94 of file graphicsview.cpp.

Here is the call graph for this function:

◆ clone() [3/3]

QStandardItem* CustomItem::clone ( ) const
inlineoverridevirtual

Returns a copy of this item. The item's children are not copied.

When subclassing QStandardItem, you can reimplement this function to provide QStandardItemModel with a factory that it can use to create new items on demand.

See also
QStandardItemModel::setItemPrototype(), operator=()

Reimplemented from QStandardItem.

Definition at line 1029 of file tst_qstandarditemmodel.cpp.

Here is the call graph for this function:

◆ emitDataChanged()

void QStandardItem::emitDataChanged
Since
4.4

Causes the model associated with this item to emit a \l{QAbstractItemModel::dataChanged()}{dataChanged}() signal for this item.

You normally only need to call this function if you have subclassed QStandardItem and reimplemented data() and/or setData().

See also
setData()

Definition at line 243 of file qstandarditemmodel.cpp.

◆ mousePressEvent()

void CustomItem::mousePressEvent ( QGraphicsSceneMouseEvent event)
virtual

[5]

Reimplemented from QGraphicsItem.

Definition at line 130 of file graphicsview.cpp.

Here is the call graph for this function:

◆ operator<()

bool CustomItem::operator< ( const QStandardItem other) const
inlineoverridevirtual

Returns true if this item is less than other; otherwise returns false.

The default implementation uses the data for the item's sort role (see QStandardItemModel::sortRole) to perform the comparison if the item belongs to a model; otherwise, the data for the item's Qt::DisplayRole (text()) is used to perform the comparison.

sortChildren() and QStandardItemModel::sort() use this function when sorting items. If you want custom sorting, you can subclass QStandardItem and reimplement this function.

Reimplemented from QStandardItem.

Definition at line 1028 of file tst_qstandarditem.cpp.

Here is the call graph for this function:

◆ paint() [1/3]

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

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.

Note
It is mandatory that an item will always redraw itself in the exact same way, unless update() was called; otherwise visual artifacts may occur. In other words, two subsequent calls to paint() must always produce the same output, unless update() was called between them.
Enabling caching for an item does not guarantee that paint() will be invoked only once by the Graphics View framework, even without any explicit call to update(). See the documentation of setCacheMode() for more details.
See also
setCacheMode(), QPen::width(), {Item Coordinates}, ItemUsesExtendedStyleOption

Implements QGraphicsItem.

Definition at line 4125 of file tst_qgraphicsitem.cpp.

Here is the call graph for this function:

◆ paint() [2/3]

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

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.

Note
It is mandatory that an item will always redraw itself in the exact same way, unless update() was called; otherwise visual artifacts may occur. In other words, two subsequent calls to paint() must always produce the same output, unless update() was called between them.
Enabling caching for an item does not guarantee that paint() will be invoked only once by the Graphics View framework, even without any explicit call to update(). See the documentation of setCacheMode() for more details.
See also
setCacheMode(), QPen::width(), {Item Coordinates}, ItemUsesExtendedStyleOption

Implements QGraphicsItem.

Definition at line 76 of file tst_qgraphicseffect.cpp.

Here is the call graph for this function:

◆ paint() [3/3]

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

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.

Note
It is mandatory that an item will always redraw itself in the exact same way, unless update() was called; otherwise visual artifacts may occur. In other words, two subsequent calls to paint() must always produce the same output, unless update() was called between them.
Enabling caching for an item does not guarantee that paint() will be invoked only once by the Graphics View framework, even without any explicit call to update(). See the documentation of setCacheMode() for more details.
See also
setCacheMode(), QPen::width(), {Item Coordinates}, ItemUsesExtendedStyleOption

Implements QGraphicsItem.

Definition at line 46 of file tst_qgraphicseffectsource.cpp.

Here is the call graph for this function:

◆ QStandardItem() [1/18]

QStandardItem::QStandardItem

Constructs an item.

Definition at line 62 of file qstandarditemmodel.cpp.

◆ QStandardItem() [2/18]

QStandardItem::QStandardItem

Constructs an item.

Definition at line 62 of file qstandarditemmodel.cpp.

◆ QStandardItem() [3/18]

QStandardItem::QStandardItem

Constructs an item.

Definition at line 62 of file qstandarditemmodel.cpp.

◆ QStandardItem() [4/18]

QStandardItem::QStandardItem

Constructs an item with the given icon and text.

Definition at line 64 of file qstandarditemmodel.cpp.

◆ QStandardItem() [5/18]

QStandardItem::QStandardItem

Constructs an item with the given icon and text.

Definition at line 64 of file qstandarditemmodel.cpp.

◆ QStandardItem() [6/18]

QStandardItem::QStandardItem

Constructs an item with the given icon and text.

Definition at line 64 of file qstandarditemmodel.cpp.

◆ QStandardItem() [7/18]

QStandardItem::QStandardItem

Constructs a copy of other. Note that model() is not copied.

This function is useful when reimplementing clone().

Definition at line 238 of file qstandarditemmodel.cpp.

◆ QStandardItem() [8/18]

QStandardItem::QStandardItem

Constructs a copy of other. Note that model() is not copied.

This function is useful when reimplementing clone().

Definition at line 238 of file qstandarditemmodel.cpp.

◆ QStandardItem() [9/18]

QStandardItem::QStandardItem

Constructs a copy of other. Note that model() is not copied.

This function is useful when reimplementing clone().

Definition at line 238 of file qstandarditemmodel.cpp.

◆ QStandardItem() [10/18]

QStandardItem::QStandardItem
explicit

Constructs an item with the given text.

Definition at line 63 of file qstandarditemmodel.cpp.

◆ QStandardItem() [11/18]

QStandardItem::QStandardItem
explicit

Constructs an item with the given text.

Definition at line 63 of file qstandarditemmodel.cpp.

◆ QStandardItem() [12/18]

QStandardItem::QStandardItem
explicit

Constructs an item with the given text.

Definition at line 63 of file qstandarditemmodel.cpp.

◆ QStandardItem() [13/18]

QStandardItem::QStandardItem
explicit

Constructs an item with rows rows and columns columns of child items.

Definition at line 65 of file qstandarditemmodel.cpp.

◆ QStandardItem() [14/18]

QStandardItem::QStandardItem
explicit

Constructs an item with rows rows and columns columns of child items.

Definition at line 65 of file qstandarditemmodel.cpp.

◆ QStandardItem() [15/18]

QStandardItem::QStandardItem
explicit

Constructs an item with rows rows and columns columns of child items.

Definition at line 65 of file qstandarditemmodel.cpp.

◆ QStandardItem() [16/18]

QStandardItem::QStandardItem

Definition at line 239 of file qstandarditemmodel.cpp.

◆ QStandardItem() [17/18]

QStandardItem::QStandardItem

Definition at line 239 of file qstandarditemmodel.cpp.

◆ QStandardItem() [18/18]

QStandardItem::QStandardItem

Definition at line 239 of file qstandarditemmodel.cpp.

◆ reset() [1/2]

void CustomItem::reset ( )
inline

Definition at line 84 of file tst_qgraphicseffect.cpp.

Here is the caller graph for this function:

◆ reset() [2/2]

void CustomItem::reset ( )
inline

Definition at line 53 of file tst_qgraphicseffectsource.cpp.

◆ type() [1/4]

int CustomItem::type ( ) const
inlineoverridevirtual

Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to \l UserType.

See also
QStandardItem::Type

Reimplemented from QStandardItem.

Definition at line 77 of file src_gui_graphicsview_qgraphicsitem.cpp.

◆ type() [2/4]

int CustomItem::type ( ) const
inlineoverridevirtual

Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to \l UserType.

See also
QStandardItem::Type

Reimplemented from QStandardItem.

Definition at line 92 of file graphicsview.cpp.

◆ type() [3/4]

int CustomItem::type ( ) const
inlineoverridevirtual

Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to \l UserType.

See also
QStandardItem::Type

Reimplemented from QStandardItem.

Definition at line 1026 of file tst_qstandarditem.cpp.

◆ type() [4/4]

int CustomItem::type ( ) const
inlineoverridevirtual

Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to \l UserType.

See also
QStandardItem::Type

Reimplemented from QStandardItem.

Definition at line 1028 of file tst_qstandarditemmodel.cpp.

Member Data Documentation

◆ m_painter

QPainter * CustomItem::m_painter

Definition at line 92 of file tst_qgraphicseffect.cpp.

◆ m_styleOption

const QStyleOption* CustomItem::m_styleOption

Definition at line 93 of file tst_qgraphicseffect.cpp.

◆ numRepaints

int CustomItem::numRepaints

Definition at line 91 of file tst_qgraphicseffect.cpp.


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