Eneboo - Documentación para desarrolladores
|
The QCanvasEllipse class provides an ellipse or ellipse segment on a QCanvas.canvasA 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(). Más...
#include <qcanvas.h>
Métodos públicos | |
QCanvasEllipse (QCanvas *canvas) | |
QCanvasEllipse (int width, int height, QCanvas *canvas) | |
QCanvasEllipse (int width, int height, int startangle, int angle, QCanvas *canvas) | |
~QCanvasEllipse () | |
int | width () const |
int | height () const |
void | setSize (int w, int h) |
void | setAngles (int start, int length) |
int | angleStart () const |
int | angleLength () const |
QPointArray | areaPoints () const |
bool | collidesWith (const QCanvasItem *) const |
int | rtti () const |
QCanvasEllipse (QCanvas *canvas) | |
QCanvasEllipse (int width, int height, QCanvas *canvas) | |
QCanvasEllipse (int width, int height, int startangle, int angle, QCanvas *canvas) | |
~QCanvasEllipse () | |
int | width () const |
int | height () const |
void | setSize (int w, int h) |
void | setAngles (int start, int length) |
int | angleStart () const |
int | angleLength () const |
QPointArray | areaPoints () const |
bool | collidesWith (const QCanvasItem *) const |
int | rtti () const |
Atributos públicos estáticos | |
static int | RTTI = Rtti_Ellipse |
Métodos protegidos | |
void | drawShape (QPainter &) |
void | drawShape (QPainter &) |
The QCanvasEllipse class provides an ellipse or ellipse segment on a QCanvas.
canvas
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.
anglediagram qcanvasellipse.png 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().
Note: QCanvasEllipse does not use the pen.
QCanvasEllipse::QCanvasEllipse | ( | QCanvas * | canvas | ) |
Constructs a 32x32 ellipse, centered at (0, 0) on canvas.
Constructs a width by height pixel ellipse, centered at (0, 0) on canvas.
QCanvasEllipse::QCanvasEllipse | ( | int | width, |
int | height, | ||
int | startangle, | ||
int | angle, | ||
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.
QCanvasEllipse::QCanvasEllipse | ( | QCanvas * | canvas | ) |
QCanvasEllipse::QCanvasEllipse | ( | int | width, |
int | height, | ||
int | startangle, | ||
int | angle, | ||
QCanvas * | canvas | ||
) |
QCanvasEllipse::~QCanvasEllipse | ( | ) |
int QCanvasEllipse::angleLength | ( | ) | const [inline] |
Returns the length angle (the extent of the ellipse segment) in 16ths of a degree. Initially this will be 360 * 16 (a complete ellipse).
int QCanvasEllipse::angleLength | ( | ) | const [inline] |
int QCanvasEllipse::angleStart | ( | ) | const [inline] |
Returns the start angle in 16ths of a degree. Initially this will be 0.
int QCanvasEllipse::angleStart | ( | ) | const [inline] |
QPointArray QCanvasEllipse::areaPoints | ( | ) | const [virtual] |
This function must be reimplemented by subclasses. It must return the points bounding (i.e. outside and not touching) the shape or drawing errors will occur.
Implementa QCanvasPolygonalItem.
QPointArray QCanvasEllipse::areaPoints | ( | ) | const [virtual] |
Implementa QCanvasPolygonalItem.
bool QCanvasEllipse::collidesWith | ( | const QCanvasItem * | i | ) | const [virtual] |
Reimplementado de QCanvasPolygonalItem.
bool QCanvasEllipse::collidesWith | ( | const QCanvasItem * | i | ) | const [virtual] |
Reimplementado de QCanvasPolygonalItem.
void QCanvasEllipse::drawShape | ( | QPainter & | p | ) | [protected, virtual] |
Draws the ellipse, centered at x(), y() using the painter p.
Note that QCanvasEllipse does not support an outline (the pen is always NoPen).
Implementa QCanvasPolygonalItem.
void QCanvasEllipse::drawShape | ( | QPainter & | p | ) | [protected, virtual] |
Subclasses must reimplement this function to draw their shape. The pen and brush of p are already set to pen() and brush() prior to calling this function.
Implementa QCanvasPolygonalItem.
int QCanvasEllipse::height | ( | ) | const |
Returns the height of the ellipse.
int QCanvasEllipse::height | ( | ) | const |
int QCanvasEllipse::rtti | ( | ) | const [virtual] |
Returns 2 (QCanvasItem::Rtti_PolygonalItem).
Reimplementado de QCanvasPolygonalItem.
int QCanvasEllipse::rtti | ( | ) | const [virtual] |
Returns 6 (QCanvasItem::Rtti_Ellipse).
Reimplementado de QCanvasPolygonalItem.
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).
int QCanvasEllipse::width | ( | ) | const |
int QCanvasEllipse::width | ( | ) | const |
Returns the width of the ellipse.
static int QCanvasEllipse::RTTI = Rtti_Ellipse [static] |
Reimplementado de QCanvasPolygonalItem.