QGraphicsEllipseItem 類

The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene . 更多...

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

公共函數

QGraphicsEllipseItem (QGraphicsItem * parent = Q_NULLPTR)
QGraphicsEllipseItem (const QRectF & rect , QGraphicsItem * parent = Q_NULLPTR)
QGraphicsEllipseItem (qreal x , qreal y , qreal width , qreal height , QGraphicsItem * parent = Q_NULLPTR)
~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
virtual bool contains (const QPointF & point ) const
virtual bool isObscuredBy (const QGraphicsItem * item ) const
virtual QPainterPath opaqueArea () const
virtual void paint (QPainter * painter , const QStyleOptionGraphicsItem * option , QWidget * widget = Q_NULLPTR)
virtual QPainterPath shape () const
virtual int type () const

額外繼承成員

詳細描述

The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene .

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 ,和 圖形視圖框架 .

成員函數文檔編製

QGraphicsEllipseItem:: QGraphicsEllipseItem ( QGraphicsItem * parent = Q_NULLPTR)

構造 QGraphicsEllipseItem . parent 被傳遞給 QAbstractGraphicsShapeItem 的構造函數。

另請參閱 QGraphicsScene::addItem ().

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

構造 QGraphicsEllipseItem 使用 rect 作為默認矩形。 parent 被傳遞給 QAbstractGraphicsShapeItem 的構造函數。

另請參閱 QGraphicsScene::addItem ().

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

構造 QGraphicsEllipseItem using the rectangle defined by ( x , y ) 和給定 width and height , as the default rectangle. parent 被傳遞給 QAbstractGraphicsShapeItem 的構造函數。

該函數在 Qt 4.3 引入。

另請參閱 QGraphicsScene::addItem ().

QGraphicsEllipseItem:: ~QGraphicsEllipseItem ()

銷毀 QGraphicsEllipseItem .

[虛擬] QRectF QGraphicsEllipseItem:: boundingRect () const

重實現自 QGraphicsItem::boundingRect ().

[虛擬] bool QGraphicsEllipseItem:: contains (const QPointF & point ) const

重實現自 QGraphicsItem::contains ().

[虛擬] bool QGraphicsEllipseItem:: isObscuredBy (const QGraphicsItem * item ) const

重實現自 QGraphicsItem::isObscuredBy ().

[虛擬] QPainterPath QGraphicsEllipseItem:: opaqueArea () const

重實現自 QGraphicsItem::opaqueArea ().

[虛擬] void QGraphicsEllipseItem:: paint ( QPainter * painter , const QStyleOptionGraphicsItem * option , QWidget * widget = Q_NULLPTR)

重實現自 QGraphicsItem::paint ().

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:: setRect ( qreal x , qreal y , qreal width , qreal height )

將項的矩形設為矩形,定義通過 ( x , y ) 和給定 width and height .

此方便函數相當於調用 setRect(QRectF(x, y, width, height))

另請參閱 rect ().

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 ().

[虛擬] QPainterPath QGraphicsEllipseItem:: shape () const

重實現自 QGraphicsItem::shape ().

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 ().

[虛擬] int QGraphicsEllipseItem:: type () const

重實現自 QGraphicsItem::type ().