Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Q3Painter Class Reference

Q3Painter is the compat version of QPainter. More...

    #include <Q3Painter>

This class is part of the Qt 3 compatibility library. It is provided to keep old source code working. We strongly advise against using it in new code. See the Porting Guide for more information.

Inherits QPainter.

- List of all members, including inherited members

### Public Functions

- Q3Painter ()
- Q3Painter ( QPaintDevice * pdev )
- void drawArc ( const QRect & r, int a, int alen )
- void drawArc ( int x, int y, int w, int h, int startAngle, int spanAngle )
- void drawChord ( const QRect & , int a, int alen )
- void drawChord ( int x, int y, int w, int h, int startAngle, int spanAngle )
- void drawEllipse ( const QRect & r )
- void drawEllipse ( int x, int y, int width, int height )
- void drawPie ( const QRect & , int a, int alen )
- void drawPie ( int x, int y, int w, int h, int startAngle, int spanAngle )
- void drawRect ( const QRect & rect )
- void drawRect ( int x, int y, int w, int h )
- void drawRoundRect ( const QRect & r, int xround = 25, int yround = 25 )
- void drawRoundRect ( int x, int y, int w, int h, int xround = 25, int yround = 25 )

- 140 public functions inherited from QPainter

## Detailed Description

Q3Painter is the compat version of QPainter.

Prior to Qt 4, QPainter specialized the pen drawing for rectangle based functions (in particular: drawRect, drawEllipse, drawRoundRect, drawArc, drawChord and drawPie). When stroking a rectangle of width 10, the pen would draw a rectangle of width 10. Drawing a polygon defined by the corner points of the same rectangle the stroke would have a width of 11.

The reason for this is best explained using the picture below:

As we can see, stroking the rectangle so it gets a width of 10, means the pen is drawn on a rectangle on width 9. The polygon, however follows a consistent model.

In Qt 4, all rectangle based functions have changed to follow the polygon approach, which means that the rectangle defines the size of the fill, and the pen follows the edges of the shape. For pen widths of 0 and 1 this means that the stroke will be inside the shape on the left and the top and outside on the bottom and right.

The reason for the change in Qt 4 is so that we provide consistency for all drawing functions even with complex transformations.

## Member Function Documentation

### Q3Painter::Q3Painter ()

### Q3Painter::Q3Painter ( QPaintDevice * pdev )

### void Q3Painter::drawArc ( const QRect & r, int a, int alen )

Draws an arc defined by the rectangle r, the start angle a and the arc length alen.

The angles a and alen are 1/16th of a degree, i.e. a full circle equals 5760 (16*360). Positive values of a and alen mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.

Example:

        QPainter p(myWidget);
        p.drawArc(QRect(10,10, 70,100), 100*16, 160*16); // draws a "(" arc

See also drawPie() and drawChord().

### void Q3Painter::drawArc ( int x, int y, int w, int h, int startAngle, int spanAngle )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Draws the arc that fits inside the rectangle (x, y, w, h), with the given startAngle and spanAngle.

### void Q3Painter::drawChord ( const QRect & , int a, int alen )

### void Q3Painter::drawChord ( int x, int y, int w, int h, int startAngle, int spanAngle )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Draws a chord that fits inside the rectangle (x, y, w, h) with the given startAngle and spanAngle.

### void Q3Painter::drawEllipse ( const QRect & r )

Draws the ellipse that fits inside the rectangle r.

A filled ellipse has a size of r.size(). An stroked ellipse has a size of r.size() plus the pen width.

### void Q3Painter::drawEllipse ( int x, int y, int width, int height )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

### void Q3Painter::drawPie ( const QRect & , int a, int alen )

### void Q3Painter::drawPie ( int x, int y, int w, int h, int startAngle, int spanAngle )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Draws a pie segment that fits inside the rectangle (x, y, w, h) with the given startAngle and spanAngle.

### void Q3Painter::drawRect ( const QRect & rect )

### void Q3Painter::drawRect ( int x, int y, int w, int h )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Draws the rectangle \r with the current pen and brush.

A filled rectangle has a size of r.size(). A stroked rectangle has a size of r.size() plus the pen width.

### void Q3Painter::drawRoundRect ( const QRect & r, int xround = 25, int yround = 25 )

### void Q3Painter::drawRoundRect ( int x, int y, int w, int h, int xround = 25, int yround = 25 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.