返回介绍

QCanvasEllipse Class

发布于 2019-10-04 14:58:35 字数 4821 浏览 1077 评论 0 收藏 0

The QCanvasEllipse class provides an ellipse or ellipse segment on a QCanvas. More...

#include <qcanvas.h>

Inherits QCanvasPolygonalItem.

List of all member functions.

Public Members

  • QCanvasEllipse ( QCanvas*canvas )
  • QCanvasEllipse ( intwidth, intheight, QCanvas*canvas )
  • QCanvasEllipse ( intwidth, intheight, intstartangle, intangle, QCanvas*canvas )
  • ~QCanvasEllipse ()
  • int width () const
  • int height () const
  • void setSize ( intwidth, intheight )
  • void setAngles ( intstart, intlength )
  • int angleStart () const
  • int angleLength () const
  • virtual int rtti () const

Protected Members

  • virtual void drawShape ( QPainter&p )

Detailed Description

The QCanvasEllipse class provides an ellipse or ellipse segment on a QCanvas.

A canvas item that paints an ellipse or ellipse segment with a QBrush. The ellipse's height, width, start angle and angle length can be set at construction time. The size can be changed at runtime with setSize(), and the angles can be changed (if you're displaying an ellipse segment rather than a whole ellipse) with setAngles().

Note that angles are specified in 16ths of a degree.

Ellipse If a start angle and length angle are set then an ellipse segment will be drawn. The start angle is the angle that goes from zero in a counter-clockwise direction (shown in green in the diagram). The length angle is the angle from the start angle in a counter-clockwise direction (shown in blue in the diagram). The blue segment is the segment of the ellipse that would be drawn. If no start angle and length angle are specified the entire ellipse is drawn.

The ellipse can be drawn on a painter with drawShape().

Like any other canvas item ellipses can be moved with move() and moveBy(), or by setting coordinates with setX(), setY() and setZ().

See also Graphics Classes and Image Processing Classes.


Member Function Documentation

QCanvasEllipse::QCanvasEllipse ( QCanvas*canvas )

Constructs a 32x32 ellipse, centered at (0, 0) on canvas.

QCanvasEllipse::QCanvasEllipse ( intwidth, intheight, QCanvas*canvas )

Constructs a width by height pixel ellipse, centered at (0,0) on canvas.

QCanvasEllipse::QCanvasEllipse ( intwidth, intheight, intstartangle, intangle, QCanvas*canvas )

Constructs a width by height pixel ellipse, centered at (0,0) on canvas. Only a segment of the ellipse is drawn, starting at angle startangle, and extending for angle angle (the angle length).

Note that angles are specified in 1/16ths of a degree.

QCanvasEllipse::~QCanvasEllipse ()

Destroys the ellipse.

int QCanvasEllipse::angleLength () const

Returns the length angle (the extent of the ellipse segment) in 16ths of a degree. Initially this will be 360 * 16 (a complete ellipse).

See also setAngles() and angleStart().

int QCanvasEllipse::angleStart () const

Returns the start angle in 16ths of a degree. Initially this will be 0.

See also setAngles() and angleLength().

void QCanvasEllipse::drawShape ( QPainter&p ) [virtual protected]

Draws the ellipse, centered at x(), y() using the painter p.

Note that QCanvasEllipse does not support an outline (pen is always NoPen).

Reimplemented from QCanvasPolygonalItem.

int QCanvasEllipse::height () const

Returns the height of the ellipse.

int QCanvasEllipse::rtti () const [virtual]

Returns 6 (QCanvasItem::Rtti_Ellipse).

See also QCanvasItem::rtti().

Reimplemented from QCanvasPolygonalItem.

void QCanvasEllipse::setAngles ( intstart, intlength )

Sets the angles for the ellipse. The start angle is start and the extent of the segment is length (the angle length) from the start. The angles are specified in 16ths of a degree. By default the ellipse will start at 0 and have an angle length of 360 * 16 (a complete ellipse).

See also angleStart() and angleLength().

void QCanvasEllipse::setSize ( intwidth, intheight )

Sets the width and height of the ellipse.

int QCanvasEllipse::width () const

Returns the width of the ellipse.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文