QGraphicsEllipseItem 类

QGraphicsEllipseItem 类提供的椭圆项可以被添加到 QGraphicsScene . 更多...

头: #include <QGraphicsEllipseItem>
qmake: QT += widgets
Since: Qt 4.2
继承: QAbstractGraphicsShapeItem

该类在 Qt 4.2 引入。

公共类型

enum anonymous { Type }

公共函数

QGraphicsEllipseItem (qreal x , qreal y , qreal width , qreal height , QGraphicsItem * parent = nullptr)
QGraphicsEllipseItem (const QRectF & rect , QGraphicsItem * parent = nullptr)
QGraphicsEllipseItem (QGraphicsItem * parent = nullptr)
virtual ~QGraphicsEllipseItem ()
QRectF rect () const
void setRect (const QRectF & rect )
void setRect (qreal x , qreal y , qreal width , qreal height )
void setSpanAngle (int angle )
void setStartAngle (int angle )
int spanAngle () const
int startAngle () const

重实现公共函数

virtual QRectF boundingRect () const override
virtual bool contains (const QPointF & point ) const override
virtual bool isObscuredBy (const QGraphicsItem * item ) const override
virtual QPainterPath opaqueArea () const override
virtual void paint (QPainter * painter , const QStyleOptionGraphicsItem * option , QWidget * widget = nullptr) override
virtual QPainterPath shape () const override
virtual int type () const override

详细描述

QGraphicsEllipseItem respresents an ellipse with a fill and an outline, and you can also use it for ellipse segments (see startAngle (), spanAngle ()).

To set the item's ellipse, pass a QRectF to QGraphicsEllipseItem's constructor, or call setRect ()。 rect () function returns the current ellipse geometry.

QGraphicsEllipseItem uses the rect and the pen width to provide a reasonable implementation of boundingRect (), shape (),和 contains ()。 paint () function draws the ellipse using the item's associated pen and brush, which you can set by calling setPen () 和 setBrush ().

另请参阅 QGraphicsPathItem , QGraphicsRectItem , QGraphicsPolygonItem , QGraphicsTextItem , QGraphicsLineItem , QGraphicsPixmapItem ,和 图形视图框架 .

成员类型文档编制

enum QGraphicsEllipseItem:: anonymous

值的返回通过虚拟 type () 函数。

常量 描述
QGraphicsEllipseItem::Type 4 图形椭圆项

成员函数文档编制

void QGraphicsEllipseItem:: setRect ( qreal x , qreal y , qreal width , qreal height )

将项的矩形设为矩形,定义通过 ( x , y ) 和给定 width and height .

此方便函数相当于调用 setRect(QRectF(x, y, width, height))

另请参阅 rect ().

QGraphicsEllipseItem:: QGraphicsEllipseItem ( qreal x , qreal y , qreal width , qreal height , QGraphicsItem * parent = nullptr)

Constructs a QGraphicsEllipseItem using the rectangle defined by ( x , y ) 和给定 width and height , as the default rectangle. parent 会被传递给 QAbstractGraphicsShapeItem 的构造函数。

该函数在 Qt 4.3 引入。

另请参阅 QGraphicsScene::addItem ().

QGraphicsEllipseItem:: QGraphicsEllipseItem (const QRectF & rect , QGraphicsItem * parent = nullptr)

Constructs a QGraphicsEllipseItem using rect 作为默认矩形。 parent 会被传递给 QAbstractGraphicsShapeItem 的构造函数。

另请参阅 QGraphicsScene::addItem ().

QGraphicsEllipseItem:: QGraphicsEllipseItem ( QGraphicsItem * parent = nullptr)

Constructs a QGraphicsEllipseItem. parent 会被传递给 QAbstractGraphicsShapeItem 的构造函数。

另请参阅 QGraphicsScene::addItem ().

[虚拟] QGraphicsEllipseItem:: ~QGraphicsEllipseItem ()

销毁 QGraphicsEllipseItem .

[override virtual] QRectF QGraphicsEllipseItem:: boundingRect () const

重实现: QGraphicsItem::boundingRect () const.

[override virtual] bool QGraphicsEllipseItem:: contains (const QPointF & point ) const

重实现: QGraphicsItem::contains (const QPointF &point) const.

[override virtual] bool QGraphicsEllipseItem:: isObscuredBy (const QGraphicsItem * item ) const

重实现: QAbstractGraphicsShapeItem::isObscuredBy (const QGraphicsItem *item) const.

[override virtual] QPainterPath QGraphicsEllipseItem:: opaqueArea () const

重实现: QAbstractGraphicsShapeItem::opaqueArea () const.

[override virtual] void QGraphicsEllipseItem:: paint ( QPainter * painter , const QStyleOptionGraphicsItem * option , QWidget * widget = nullptr)

重实现: QGraphicsItem::paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget).

QRectF QGraphicsEllipseItem:: rect () const

Returns the item's ellipse geometry as a QRectF .

另请参阅 setRect () 和 QPainter::drawEllipse ().

void QGraphicsEllipseItem:: setRect (const QRectF & rect )

Sets the item's ellipse geometry to rect . The rectangle's left edge defines the left edge of the ellipse, and the rectangle's top edge describes the top of the ellipse. The height and width of the rectangle describe the height and width of the ellipse.

另请参阅 rect () 和 QPainter::drawEllipse ().

void QGraphicsEllipseItem:: setSpanAngle ( int angle )

Sets the span angle for an ellipse segment to angle , which is in 16ths of a degree. This angle is used together with startAngle () to represent an ellipse segment (a pie). By default, the span angle is 5760 (360 * 16, a full ellipse).

另请参阅 spanAngle (), setStartAngle (),和 QPainter::drawPie ().

void QGraphicsEllipseItem:: setStartAngle ( int angle )

Sets the start angle for an ellipse segment to angle , which is in 16ths of a degree. This angle is used together with spanAngle () for representing an ellipse segment (a pie). By default, the start angle is 0.

另请参阅 startAngle (), setSpanAngle (),和 QPainter::drawPie ().

[override virtual] QPainterPath QGraphicsEllipseItem:: shape () const

重实现: QGraphicsItem::shape () const.

int QGraphicsEllipseItem:: spanAngle () const

Returns the span angle of an ellipse segment in 16ths of a degree. This angle is used together with startAngle () for representing an ellipse segment (a pie). By default, this function returns 5760 (360 * 16, a full ellipse).

另请参阅 setSpanAngle () 和 startAngle ().

int QGraphicsEllipseItem:: startAngle () const

Returns the start angle for an ellipse segment in 16ths of a degree. This angle is used together with spanAngle () for representing an ellipse segment (a pie). By default, the start angle is 0.

另请参阅 setStartAngle () 和 spanAngle ().

[override virtual] int QGraphicsEllipseItem:: type () const

重实现: QGraphicsItem::type () const.