11 return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
12 20 + penWidth, 20 + penWidth);
75QRectF CircleItem::boundingRect()
const
78 return QRectF(-radius - penWidth / 2, -radius - penWidth / 2,
79 diameter + penWidth, diameter + penWidth);
109 if (qgraphicsitem_cast<ButtonItem *>(
item))
141CustomItem::CustomItem()
149 event->setAccepted(
event->mimeData()->hasFormat(
"text/plain"));
157 if (change == ItemPositionChange &&
scene()) {
174void CircleItem::setRadius(
qreal newRadius)
176 if (radius != newRadius) {
177 prepareGeometryChange();
int type() const override
Returns the type of an item as an int.
The QAbstractGraphicsShapeItem class provides a common base for all path items.
The QAction class provides an abstraction for user commands that can be added to different user inter...
The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene.
The QGraphicsItemGroup class provides a container that treats a group of items as a single item.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QTransform deviceTransform(const QTransform &viewportTransform) const
void setData(int key, const QVariant &value)
Sets this item's custom data for the key key to value.
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
This event handler, for event event, can be reimplemented to receive drag enter events for this item.
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 ...
void installSceneEventFilter(QGraphicsItem *filterItem)
Installs an event filter for this item on filterItem, causing all events for this item to first pass ...
void setPos(const QPointF &pos)
Sets the position of the item to pos, which is in parent coordinates.
QVariant data(int key) const
Returns this item's custom data for the key key as a QVariant.
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
This event handler can be reimplemented in a subclass to process context menu events.
void setAcceptDrops(bool on)
If on is true, this item will accept drag and drop events; otherwise, it is transparent for drag and ...
QTransform sceneTransform() const
void setCursor(const QCursor &cursor)
Sets the current cursor shape for the item to cursor.
The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene.
int type() const override
\reimp
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
bool contains(const QPointF &point) const override
\reimp
The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framewor...
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
void destroyItemGroup(QGraphicsItemGroup *group)
Reparents all items in group to group's parent item, then removes group from the scene,...
QGraphicsEllipseItem * addEllipse(const QRectF &rect, const QPen &pen=QPen(), const QBrush &brush=QBrush())
Creates and adds an ellipse item to the scene, and returns the item pointer.
QRectF sceneRect
the scene rectangle; the bounding rectangle of the scene
QGraphicsItemGroup * createItemGroup(const QList< QGraphicsItem * > &items)
Groups all items in items into a new QGraphicsItemGroup, and returns a pointer to the group.
QGraphicsLineItem * addLine(const QLineF &line, const QPen &pen=QPen())
Creates and adds a line item to the scene, and returns the item pointer.
QGraphicsItem * itemAt(const QPointF &pos, const QTransform &deviceTransform) const
The QPainter class performs low-level painting on widgets and other paint devices.
void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem.
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
QRectF boundingRect() const override
This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be ...
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
This function, which is usually called by QGraphicsView, paints the contents of an item in local coor...
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLchar *const * path
static const QRectF boundingRect(const QPointF *points, int pointCount)
QGraphicsRectItem rect
[3]
static const int ObjectName
[10]
QGraphicsEllipseItem * ellipse