58 return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
59 20 + penWidth, 20 + penWidth);
140 QRectF CircleItem::boundingRect()
const
143 return QRectF(-radius - penWidth / 2, -radius - penWidth / 2,
144 diameter + penWidth, diameter + penWidth);
153 path.addEllipse(boundingRect());
170 static const int ObjectName = 0;
174 if (qgraphicsitem_cast<ButtonItem *>(
item))
214 event->setAccepted(
event->mimeData()->hasFormat(
"text/plain"));
222 if (change == ItemPositionChange &&
scene()) {
228 newPos.
setX(qMin(
rect.right(), qMax(newPos.
x(),
rect.left())));
229 newPos.
setY(qMin(
rect.bottom(), qMax(newPos.
y(),
rect.top())));
239 void CircleItem::setRadius(
qreal newRadius)
241 if (radius != newRadius) {
242 prepareGeometryChange();
CustomItem(qreal x, qreal y, qreal width, qreal height, QGraphicsItem *parent=nullptr)
int type() const override
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)
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
void setTransform(const QTransform &matrix, bool combine=false)
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value)
void installSceneEventFilter(QGraphicsItem *filterItem)
void setPos(const QPointF &pos)
QVariant data(int key) const
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
void setAcceptDrops(bool on)
QTransform sceneTransform() const
void setCursor(const QCursor &cursor)
The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene.
int type() const override
The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene.
bool contains(const QPointF &point) const override
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)
QGraphicsEllipseItem * addEllipse(const QRectF &rect, const QPen &pen=QPen(), const QBrush &brush=QBrush())
QRectF sceneRect
the scene rectangle; the bounding rectangle of the scene
QGraphicsItemGroup * createItemGroup(const QList< QGraphicsItem * > &items)
QGraphicsLineItem * addLine(const QLineF &line, const QPen &pen=QPen())
QGraphicsItem * itemAt(const QPointF &pos, const QTransform &deviceTransform) const
The QLineF class provides a two-dimensional vector using floating point precision.
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)
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
The QPointF class defines a point in the plane using floating point precision.
constexpr qreal x() const noexcept
constexpr qreal y() const noexcept
constexpr void setY(qreal y) noexcept
constexpr void setX(qreal x) noexcept
The QRectF class defines a finite rectangle in the plane using floating point precision.
The QRect class defines a rectangle in the plane using integer precision.
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem.
The QVariant class acts like a union for the most common Qt data types.
QRectF boundingRect() const override
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
EGLOutputLayerEXT EGLint EGLAttrib value
QT_END_INCLUDE_NAMESPACE typedef double qreal
GLint GLint GLint GLint GLint x
[0]
GLsizei const GLchar *const * path
item setTransform(QTransform().translate(x, y).rotate(45).translate(-x, -y))
QGraphicsRectItem rect
[3]
QGraphicsEllipseItem * ellipse
rect rect item rotate(45)
[5]