Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
CustomItem Class Reference

[0] More...

+ Inheritance diagram for CustomItem:
+ Collaboration diagram for CustomItem:

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
}
 This enum describes different flags that you can set on an item to toggle different features in the item's behavior. More...
 
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
}
 This enum describes the state changes that are notified by QGraphicsItem::itemChange(). More...
 
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 }
 This enum describes the types that are used to describe standard items. More...
 

Public Member Functions

int type () const override
 Returns the type of an item as an int.
 
int type () const override
 Returns the type of an item as an int.
 
void mousePressEvent (QGraphicsSceneMouseEvent *event)
 [5]
 
QStandardItemclone () const override
 Returns a copy of this item.
 
 QStandardItem ()
 Constructs an item.
 
 QStandardItem (const QString &text)
 Constructs an item with the given text.
 
 QStandardItem (const QIcon &icon, const QString &text)
 Constructs an item with the given icon and text.
 
 QStandardItem (int rows, int columns=1)
 Constructs an item with rows rows and columns columns of child items.
 
 QStandardItem (const QStandardItem &other)
 Constructs a copy of other.
 
 QStandardItem (QStandardItemPrivate &dd)
 
- Public Member Functions inherited from QGraphicsItem
 QGraphicsItem (QGraphicsItem *parent=nullptr)
 Constructs a QGraphicsItem with the given parent item.
 
virtual ~QGraphicsItem ()
 Destroys the QGraphicsItem and all its children.
 
QGraphicsScenescene () const
 Returns the current scene for the item, or \nullptr if the item is not stored in a scene.
 
QGraphicsItemparentItem () const
 Returns a pointer to this item's parent item.
 
QGraphicsItemtopLevelItem () const
 Returns this item's top-level item.
 
QGraphicsObjectparentObject () const
 
QGraphicsWidgetparentWidget () const
 
QGraphicsWidgettopLevelWidget () const
 
QGraphicsWidgetwindow () const
 
QGraphicsItempanel () const
 
void setParentItem (QGraphicsItem *parent)
 Sets this item's parent item to newParent.
 
QList< QGraphicsItem * > childItems () const
 
bool isWidget () const
 
bool isWindow () const
 
bool isPanel () const
 
QGraphicsObjecttoGraphicsObject ()
 
const QGraphicsObjecttoGraphicsObject () const
 
QGraphicsItemGroupgroup () const
 Returns a pointer to this item's item group, or \nullptr if this item is not member of a group.
 
void setGroup (QGraphicsItemGroup *group)
 Adds this item to the item group group.
 
GraphicsItemFlags flags () const
 Returns this item's flags.
 
void setFlag (GraphicsItemFlag flag, bool enabled=true)
 If enabled is true, the item flag flag is enabled; otherwise, it is disabled.
 
void setFlags (GraphicsItemFlags flags)
 Sets the item flags to 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
 Returns the current cursor shape for the item.
 
void setCursor (const QCursor &cursor)
 Sets the current cursor shape for the item to cursor.
 
bool hasCursor () const
 Returns true if this item has a cursor set; otherwise, false is returned.
 
void unsetCursor ()
 Clears the cursor from this item.
 
bool isVisible () const
 Returns true if the item is visible; otherwise, false is returned.
 
bool isVisibleTo (const QGraphicsItem *parent) const
 
void setVisible (bool visible)
 If visible is true, the item is made visible.
 
void hide ()
 Hides the item (items are visible by default).
 
void show ()
 Shows the item (items are visible by default).
 
bool isEnabled () const
 Returns true if the item is enabled; otherwise, false is returned.
 
void setEnabled (bool enabled)
 If enabled is true, the item is enabled; otherwise, it is disabled.
 
bool isSelected () const
 Returns true if this item is selected; otherwise, false is returned.
 
void setSelected (bool selected)
 If selected is true and this item is selectable, this item is selected; otherwise, it is unselected.
 
bool acceptDrops () const
 Returns true if this item can accept drag and drop events; otherwise, returns false.
 
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.
 
qreal opacity () const
 
qreal effectiveOpacity () const
 
void setOpacity (qreal opacity)
 
Qt::MouseButtons acceptedMouseButtons () const
 Returns the mouse buttons that this item accepts mouse events for.
 
void setAcceptedMouseButtons (Qt::MouseButtons buttons)
 Sets the mouse buttons that this item accepts mouse events for.
 
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
 Returns true if this item is active, and it or its \l{focusProxy()}{focus proxy} has keyboard input focus; otherwise, returns false.
 
void setFocus (Qt::FocusReason focusReason=Qt::OtherFocusReason)
 Gives keyboard input focus to this item.
 
void clearFocus ()
 Takes keyboard input focus from the item.
 
QGraphicsItemfocusProxy () const
 
void setFocusProxy (QGraphicsItem *item)
 
QGraphicsItemfocusItem () const
 
QGraphicsItemfocusScopeItem () const
 
void grabMouse ()
 
void ungrabMouse ()
 
void grabKeyboard ()
 
void ungrabKeyboard ()
 
QPointF pos () const
 Returns the position of the item in parent coordinates.
 
qreal x () const
 This convenience function is equivalent to calling pos().x().
 
void setX (qreal x)
 
qreal y () const
 This convenience function is equivalent to calling pos().y().
 
void setY (qreal y)
 
QPointF scenePos () const
 Returns the item's position in scene coordinates.
 
void setPos (const QPointF &pos)
 Sets the position of the item to pos, which is in parent coordinates.
 
void setPos (qreal x, qreal y)
 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 setPos(QPointF(x, y)).
 
void moveBy (qreal dx, qreal dy)
 Moves the item by dx points horizontally, and dy point vertically.
 
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.
 
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).
 
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)
 This virtual function is called twice for all items by the QGraphicsScene::advance() slot.
 
qreal zValue () const
 Returns the Z-value of the item.
 
void setZValue (qreal z)
 Sets the Z-value of the item to z.
 
void stackBefore (const QGraphicsItem *sibling)
 
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.
 
QRectF childrenBoundingRect () const
 Returns the bounding rect of this item's descendants (i.e., its children, their children, etc.) in local coordinates.
 
QRectF sceneBoundingRect () const
 Returns the bounding rect of this item in scene coordinates, by combining sceneTransform() with boundingRect().
 
virtual QPainterPath shape () const
 Returns the shape of this item as a QPainterPath in local coordinates.
 
bool isClipped () const
 Returns true if this item is clipped.
 
QPainterPath clipPath () const
 
virtual bool contains (const QPointF &point) const
 Returns true if this item contains point, which is in local coordinates; otherwise, false is returned.
 
virtual bool collidesWithItem (const QGraphicsItem *other, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 Returns true if this item collides with other; otherwise returns false.
 
virtual bool collidesWithPath (const QPainterPath &path, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 Returns true if this item collides with path.
 
QList< QGraphicsItem * > collidingItems (Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 Returns a list of all items that collide with this item.
 
bool isObscured (const QRectF &rect=QRectF()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool isObscured (qreal x, qreal y, qreal w, qreal h) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual bool isObscuredBy (const QGraphicsItem *item) const
 Returns true if this item's bounding rect is completely obscured by the opaque shape of item.
 
virtual QPainterPath opaqueArea () const
 This virtual function returns a shape representing the area where this item is opaque.
 
QRegion boundingRegion (const QTransform &itemToDeviceTransform) const
 
qreal boundingRegionGranularity () const
 
void setBoundingRegionGranularity (qreal granularity)
 
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)=0
 This function, which is usually called by QGraphicsView, paints the contents of an item in local coordinates.
 
void update (const QRectF &rect=QRectF())
 Schedules a redraw of the area covered by rect in this item.
 
void update (qreal x, qreal y, qreal width, qreal height)
 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 update(QRectF(x, y, width, height)).
 
void scroll (qreal dx, qreal dy, const QRectF &rect=QRectF())
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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
 Maps the polygon polygon, which is in this item's coordinate system, to item's coordinate system, and returns the mapped polygon.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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
 Maps the polygon polygon, which is in item's coordinate system, to this item's coordinate system, and returns the mapped polygon.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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)).
 
QPointF mapToParent (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 mapToParent(QPointF(x, y)).
 
QPointF mapToScene (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 mapToScene(QPointF(x, y)).
 
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
 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)).
 
QPointF mapFromParent (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 mapFromParent(QPointF(x, y)).
 
QPointF mapFromScene (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 mapFromScene(QPointF(x, y)).
 
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
 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).
 
QGraphicsItemcommonAncestorItem (const QGraphicsItem *other) const
 
bool isUnderMouse () const
 
QVariant data (int key) const
 Returns this item's custom data for the key key as a QVariant.
 
void setData (int key, const QVariant &value)
 Sets this item's custom data for the key key to value.
 
Qt::InputMethodHints inputMethodHints () const
 Returns the current input method hints of this item.
 
void setInputMethodHints (Qt::InputMethodHints hints)
 Sets the current input method hints of this item to hints.
 
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.
 
void removeSceneEventFilter (QGraphicsItem *filterItem)
 Removes an event filter on this item from filterItem.
 
- Public Member Functions inherited from QStandardItem
 QStandardItem ()
 Constructs an item.
 
 QStandardItem (const QString &text)
 Constructs an item with the given text.
 
 QStandardItem (const QIcon &icon, const QString &text)
 Constructs an item with the given icon and text.
 
 QStandardItem (int rows, int columns=1)
 Constructs an item with rows rows and columns columns of child items.
 
virtual ~QStandardItem ()
 Destructs the item.
 
virtual QVariant data (int role=Qt::UserRole+1) const
 Returns the item's data for the given role, or an invalid QVariant if there is no data for the role.
 
virtual void multiData (QModelRoleDataSpan roleDataSpan) const
 
virtual void setData (const QVariant &value, int role=Qt::UserRole+1)
 Sets the item's data for the given role to the specified value.
 
void clearData ()
 
QString text () const
 Returns the item's text.
 
void setText (const QString &text)
 Sets the item's text to the text specified.
 
QIcon icon () const
 Returns the item's icon.
 
void setIcon (const QIcon &icon)
 Sets the item's icon to the icon specified.
 
QString toolTip () const
 Returns the item's tooltip.
 
void setToolTip (const QString &toolTip)
 Sets the item's tooltip to the string specified by toolTip.
 
QString statusTip () const
 Returns the item's status tip.
 
void setStatusTip (const QString &statusTip)
 Sets the item's status tip to the string specified by statusTip.
 
QSize sizeHint () const
 Returns the size hint set for the item, or an invalid QSize if no size hint has been set.
 
void setSizeHint (const QSize &sizeHint)
 Sets the size hint for the item to be size.
 
QFont font () const
 Returns the font used to render the item's text.
 
void setFont (const QFont &font)
 Sets the font used to display the item's text to the given font.
 
Qt::Alignment textAlignment () const
 Returns the text alignment for the item's text.
 
void setTextAlignment (Qt::Alignment textAlignment)
 Sets the text alignment for the item's text to the alignment specified.
 
QBrush background () const
 Returns the brush used to render the item's background.
 
void setBackground (const QBrush &brush)
 Sets the item's background brush to the specified brush.
 
QBrush foreground () const
 Returns the brush used to render the item's foreground (e.g.
 
void setForeground (const QBrush &brush)
 Sets the brush used to display the item's foreground (e.g.
 
Qt::CheckState checkState () const
 Returns the checked state of the item.
 
void setCheckState (Qt::CheckState checkState)
 Sets the check state of the item to be state.
 
QString accessibleText () const
 Returns the item's accessible text.
 
void setAccessibleText (const QString &accessibleText)
 Sets the item's accessible text to the string specified by accessibleText.
 
QString accessibleDescription () const
 Returns the item's accessible description.
 
void setAccessibleDescription (const QString &accessibleDescription)
 Sets the item's accessible description to the string specified by accessibleDescription.
 
Qt::ItemFlags flags () const
 Returns the item flags for the item.
 
void setFlags (Qt::ItemFlags flags)
 Sets the item flags for the item to flags.
 
bool isEnabled () const
 Returns whether the item is enabled.
 
void setEnabled (bool enabled)
 Sets whether the item is enabled.
 
bool isEditable () const
 Returns whether the item can be edited by the user.
 
void setEditable (bool editable)
 Sets whether the item is editable.
 
bool isSelectable () const
 Returns whether the item is selectable by the user.
 
void setSelectable (bool selectable)
 Sets whether the item is selectable.
 
bool isCheckable () const
 Returns whether the item is user-checkable.
 
void setCheckable (bool checkable)
 Sets whether the item is user-checkable.
 
bool isAutoTristate () const
 Returns whether the item is tristate and is controlled by QTreeWidget.
 
void setAutoTristate (bool tristate)
 Determines that the item is tristate and controlled by QTreeWidget if tristate is true.
 
bool isUserTristate () const
 
void setUserTristate (bool tristate)
 Sets whether the item is tristate and controlled by the user.
 
QStandardItemparent () const
 Returns the item's parent item, or \nullptr if the item has no parent.
 
int row () const
 Returns the row where the item is located in its parent's child table, or -1 if the item has no parent.
 
int column () const
 Returns the column where the item is located in its parent's child table, or -1 if the item has no parent.
 
QModelIndex index () const
 Returns the QModelIndex associated with this item.
 
QStandardItemModelmodel () const
 Returns the QStandardItemModel that this item belongs to.
 
int rowCount () const
 Returns the number of child item rows that the item has.
 
void setRowCount (int rows)
 Sets the number of child item rows to rows.
 
int columnCount () const
 Returns the number of child item columns that the item has.
 
void setColumnCount (int columns)
 Sets the number of child item columns to columns.
 
bool hasChildren () const
 Returns true if this item has any children; otherwise returns false.
 
QStandardItemchild (int row, int column=0) const
 Returns the child item at (row, column) if one has been set; otherwise returns \nullptr.
 
void setChild (int row, int column, QStandardItem *item)
 Sets the child item at (row, column) to item.
 
void setChild (int row, QStandardItem *item)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the child at row to item.
 
void insertRow (int row, const QList< QStandardItem * > &items)
 Inserts a row at row containing items.
 
void insertColumn (int column, const QList< QStandardItem * > &items)
 Inserts a column at column containing items.
 
void insertRows (int row, const QList< QStandardItem * > &items)
 Inserts items at row.
 
void insertRows (int row, int count)
 Inserts count rows of child items at row row.
 
void insertColumns (int column, int count)
 Inserts count columns of child items at column column.
 
void removeRow (int row)
 Removes the given row.
 
void removeColumn (int column)
 Removes the given column.
 
void removeRows (int row, int count)
 Removes count rows at row row.
 
void removeColumns (int column, int count)
 Removes count columns at column column.
 
void appendRow (const QList< QStandardItem * > &items)
 Appends a row containing items.
 
void appendRows (const QList< QStandardItem * > &items)
 Appends rows containing items.
 
void appendColumn (const QList< QStandardItem * > &items)
 Appends a column containing items.
 
void insertRow (int row, QStandardItem *item)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Inserts a row at row containing item.
 
void appendRow (QStandardItem *item)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Appends a row containing item.
 
QStandardItemtakeChild (int row, int column=0)
 Removes the child item at (row, column) without deleting it, and returns a pointer to the item.
 
QList< QStandardItem * > takeRow (int row)
 Removes row without deleting the row items, and returns a list of pointers to the removed items.
 
QList< QStandardItem * > takeColumn (int column)
 Removes column without deleting the column items, and returns a list of pointers to the removed items.
 
void sortChildren (int column, Qt::SortOrder order=Qt::AscendingOrder)
 Sorts the children of the item using the given order, by the values in the given column.
 
virtual void read (QDataStream &in)
 Reads the item from stream in.
 
virtual void write (QDataStream &out) const
 Writes the item to stream out.
 
virtual bool operator< (const QStandardItem &other) const
 Returns true if this item is less than other; otherwise returns false.
 

Additional Inherited Members

- Protected Types inherited from QGraphicsItem
enum  Extension { UserExtension = 0x80000000 }
 
- Protected Member Functions inherited from QGraphicsItem
void updateMicroFocus ()
 Updates the item's micro focus.
 
virtual bool sceneEventFilter (QGraphicsItem *watched, QEvent *event)
 Filters events for the item watched.
 
virtual bool sceneEvent (QEvent *event)
 This virtual function receives events to this item.
 
virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
 This event handler can be reimplemented in a subclass to process context menu events.
 
virtual void dragEnterEvent (QGraphicsSceneDragDropEvent *event)
 This event handler, for event event, can be reimplemented to receive drag enter events for this item.
 
virtual void dragLeaveEvent (QGraphicsSceneDragDropEvent *event)
 This event handler, for event event, can be reimplemented to receive drag leave events for this item.
 
virtual void dragMoveEvent (QGraphicsSceneDragDropEvent *event)
 This event handler, for event event, can be reimplemented to receive drag move events for this item.
 
virtual void dropEvent (QGraphicsSceneDragDropEvent *event)
 This event handler, for event event, can be reimplemented to receive drop events for this item.
 
virtual void focusInEvent (QFocusEvent *event)
 This event handler, for event event, can be reimplemented to receive focus in events for this item.
 
virtual void focusOutEvent (QFocusEvent *event)
 This event handler, for event event, can be reimplemented to receive focus out events for this item.
 
virtual void hoverEnterEvent (QGraphicsSceneHoverEvent *event)
 This event handler, for event event, can be reimplemented to receive hover enter events for this item.
 
virtual void hoverMoveEvent (QGraphicsSceneHoverEvent *event)
 This event handler, for event event, can be reimplemented to receive hover move events for this item.
 
virtual void hoverLeaveEvent (QGraphicsSceneHoverEvent *event)
 This event handler, for event event, can be reimplemented to receive hover leave events for this item.
 
virtual void keyPressEvent (QKeyEvent *event)
 This event handler, for event event, can be reimplemented to receive key press events for this item.
 
virtual void keyReleaseEvent (QKeyEvent *event)
 This event handler, for event event, can be reimplemented to receive key release events for this item.
 
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 This event handler, for event event, can be reimplemented to receive mouse move events for this item.
 
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 This event handler, for event event, can be reimplemented to receive mouse release events for this item.
 
virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 This event handler, for event event, can be reimplemented to receive mouse double-click events for this item.
 
virtual void wheelEvent (QGraphicsSceneWheelEvent *event)
 This event handler, for event event, can be reimplemented to receive wheel events for this item.
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 This event handler, for event event, can be reimplemented to receive input method events for this item.
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
 This method is only relevant for input items.
 
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.
 
virtual bool supportsExtension (Extension extension) const
 
virtual void setExtension (Extension extension, const QVariant &variant)
 
virtual QVariant extension (const QVariant &variant) const
 
 QGraphicsItem (QGraphicsItemPrivate &dd, QGraphicsItem *parent)
 
void addToIndex ()
 
void removeFromIndex ()
 
void prepareGeometryChange ()
 Prepares the item for a geometry change.
 
- Protected Member Functions inherited from QStandardItem
 QStandardItem (const QStandardItem &other)
 Constructs a copy of other.
 
 QStandardItem (QStandardItemPrivate &dd)
 
QStandardItemoperator= (const QStandardItem &other)
 Assigns other's data and flags to this item.
 
void emitDataChanged ()
 
- Protected Attributes inherited from QGraphicsItem
QScopedPointer< QGraphicsItemPrivated_ptr
 
- Protected Attributes inherited from QStandardItem
QScopedPointer< QStandardItemPrivated_ptr
 

Detailed Description

[0]

[1]

Definition at line 25 of file src_gui_graphicsview_qgraphicsitem.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 28 of file src_gui_graphicsview_qgraphicsitem.cpp.

Member Function Documentation

◆ clone()

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 47 of file graphicsview.cpp.

◆ mousePressEvent()

void CustomItem::mousePressEvent ( QGraphicsSceneMouseEvent * event)
virtual

[5]

Reimplemented from QGraphicsItem.

Definition at line 83 of file graphicsview.cpp.

References QDrag::exec(), and QDrag::setMimeData().

+ Here is the call graph for this function:

◆ QStandardItem() [1/6]

QStandardItem::QStandardItem ( )

Constructs an item.

Definition at line 26 of file qstandarditemmodel.cpp.

◆ QStandardItem() [2/6]

QStandardItem::QStandardItem ( const QIcon & icon,
const QString & text )

Constructs an item with the given icon and text.

Definition at line 28 of file qstandarditemmodel.cpp.

◆ QStandardItem() [3/6]

QStandardItem::QStandardItem ( const QStandardItem & other)

Constructs a copy of other.

Note that model() is not copied.

This function is useful when reimplementing clone().

Definition at line 202 of file qstandarditemmodel.cpp.

◆ QStandardItem() [4/6]

QStandardItem::QStandardItem ( const QString & text)
explicit

Constructs an item with the given text.

Definition at line 27 of file qstandarditemmodel.cpp.

◆ QStandardItem() [5/6]

QStandardItem::QStandardItem ( int rows,
int columns = 1 )
explicit

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

Definition at line 29 of file qstandarditemmodel.cpp.

◆ QStandardItem() [6/6]

QStandardItem::QStandardItem ( QStandardItemPrivate & dd)

Definition at line 203 of file qstandarditemmodel.cpp.

◆ type() [1/2]

int CustomItem::type ( ) const
inlineoverridevirtual

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:

class CustomItem : public QGraphicsItem
{
public:
enum { Type = UserType + 1 };
int type() const override
{
// Enable the use of qgraphicsitem_cast with this item.
return Type;
}
...
};
See also
UserType

Reimplemented from QGraphicsItem.

Definition at line 30 of file src_gui_graphicsview_qgraphicsitem.cpp.

References Type.

◆ type() [2/2]

int CustomItem::type ( ) const
inlineoverridevirtual

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:

class CustomItem : public QGraphicsItem
{
public:
enum { Type = UserType + 1 };
int type() const override
{
// Enable the use of qgraphicsitem_cast with this item.
return Type;
}
...
};
See also
UserType

Reimplemented from QGraphicsItem.

Definition at line 45 of file graphicsview.cpp.

References QStandardItem::UserType.


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