|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# Qt 3 Support Members for QPainter

The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.

- QPainter class reference

### Public Functions

- const QColor & backgroundColor () const
- bool begin ( QPaintDevice * pdev, const QWidget * init )
- QRect boundingRect ( const QRect & rect, int flags, const QString & text, int len )
- QRect boundingRect ( int x, int y, int w, int h, int flags, const QString & text, int len )
- void drawConvexPolygon ( const QPolygonF & polygon, int index, int npoints = -1 )
- void drawConvexPolygon ( const QPolygon & polygon, int index, int npoints = -1 )
- void drawCubicBezier ( const QPolygon & a, int index = 0 )
- void drawLineSegments ( const QPolygon & a, int index = 0, int nlines = -1 )
- void drawPoints ( const QPolygon & points, int index, int npoints = -1 )
- void drawPolygon ( const QPolygon & pa, bool winding, int index = 0, int npoints = -1 )
- void drawPolygon ( const QPolygonF & polygon, bool winding, int index = 0, int npoints = -1 )
- void drawPolyline ( const QPolygon & pa, int index, int npoints = -1 )
- void drawText ( int x, int y, const QString & text, int pos, int len )
- void drawText ( const QPoint & p, const QString & text, int pos, int len )
- void drawText ( int x, int y, const QString & text, int len )
- void drawText ( const QPoint & p, const QString & s, int len )
- void drawText ( const QRect & r, int flags, const QString & str, int len, QRect * br = 0 )
- void drawText ( int x, int y, int w, int h, int flags, const QString & str, int len, QRect * br = 0 )
- bool hasViewXForm () const
- bool hasWorldXForm () const
- void resetXForm ()
- void setBackgroundColor ( const QColor & color )
- void setViewXForm ( bool enabled )
- void setWorldMatrix ( const QMatrix & wm, bool combine = false )
- void setWorldXForm ( bool enabled )
- const QMatrix & worldMatrix () const
- QPoint xForm ( const QPoint & p ) const
- QRect xForm ( const QRect & r ) const
- QPolygon xForm ( const QPolygon & a ) const
- QPolygon xForm ( const QPolygon & av, int index, int npoints ) const
- QRect xFormDev ( const QRect & r ) const
- QPoint xFormDev ( const QPoint & p ) const
- QPolygon xFormDev ( const QPolygon & a ) const
- QPolygon xFormDev ( const QPolygon & ad, int index, int npoints ) const

### Static Public Members

- void redirect ( QPaintDevice * pdev, QPaintDevice * replacement )
- QPaintDevice * redirect ( QPaintDevice * pdev )

## Member Function Documentation

### const QColor & QPainter::backgroundColor () const

Use background().color() instead.

See also setBackgroundColor().

### bool QPainter::begin ( QPaintDevice * pdev, const QWidget * init )

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

### QRect QPainter::boundingRect ( const QRect & rect, int flags, const QString & text, int len )

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

### QRect QPainter::boundingRect ( int x, int y, int w, int h, int flags, const QString & text, int len )

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

Returns the bounding rectangle of the first len characters of the given text constrained by the rectangle that begins at point (x, y) with width w and height h.

### void QPainter::drawConvexPolygon ( const QPolygonF & polygon, int index, int npoints = -1 )

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

Draws the convex polygon defined by polygon using the current pen and brush.

### void QPainter::drawConvexPolygon ( const QPolygon & polygon, int index, int npoints = -1 )

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

Draws the convex polygon defined by polygon using the current pen and brush.

### void QPainter::drawCubicBezier ( const QPolygon & a, int index = 0 )

Draws a cubic Bezier curve defined by the control points in a, starting at a[index] (index defaults to 0).

Control points after a[index + 3] are ignored. Nothing happens if there aren't enough control points.

### void QPainter::drawLineSegments ( const QPolygon & a, int index = 0, int nlines = -1 )

Draws nlines separate lines from points defined in a, starting at a[index] (index defaults to 0). If nlines is -1 (the default) all points until the end of the array are used (i.e. (a.size()-index)/2 lines are drawn).

Draws the 1st line from a[index] to a[index + 1]. Draws the 2nd line from a[index + 2] to a[index + 3] etc.

See also drawPolyline(), drawPolygon(), and QPen.

### void QPainter::drawPoints ( const QPolygon & points, int index, int npoints = -1 )

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

Draws npoints points in the polygon points starting on index using the current pen.

### void QPainter::drawPolygon ( const QPolygon & pa, bool winding, int index = 0, int npoints = -1 )

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

Draws the polygon defined by the points in the point array pa.

### void QPainter::drawPolygon ( const QPolygonF & polygon, bool winding, int index = 0, int npoints = -1 )

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

### void QPainter::drawPolyline ( const QPolygon & pa, int index, int npoints = -1 )

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

Draws the polyline defined by the npoints points in pa starting at index. (index defaults to 0.)

### void QPainter::drawText ( int x, int y, const QString & text, int pos, int len )

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

Use drawText(x, y, text.mid(pos, len)) instead.

### void QPainter::drawText ( const QPoint & p, const QString & text, int pos, int len )

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

Use drawText(p, text.mid(pos, len)) instead.

### void QPainter::drawText ( int x, int y, const QString & text, int len )

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

Use drawText(x, y, text.left(len)) instead.

### void QPainter::drawText ( const QPoint & p, const QString & s, int len )

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

Use drawText(p, text.left(len)) instead.

### void QPainter::drawText ( const QRect & r, int flags, const QString & str, int len, QRect * br = 0 )

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

### void QPainter::drawText ( int x, int y, int w, int h, int flags, const QString & str, int len, QRect * br = 0 )

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

Draws the string str within the rectangle with origin (x, y), width w and height h. If len is -1 (the default) all the text is drawn, otherwise only the first len characters are drawn. The flags that are given in the flags parameter are Qt::AlignmentFlags and Qt::TextFlags OR'd together. br (if not null) is set to the actual bounding rectangle of the output.

### bool QPainter::hasViewXForm () const

Use viewTransformEnabled() instead.

### bool QPainter::hasWorldXForm () const

Use matrixEnabled() instead.

### void QPainter::redirect ( QPaintDevice * pdev, QPaintDevice * replacement ) `[static]`

Use setRedirected() instead.

### QPaintDevice * QPainter::redirect ( QPaintDevice * pdev ) `[static]`

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

Use redirected() instead.

### void QPainter::resetXForm ()

Use resetMatrix() instead.

### void QPainter::setBackgroundColor ( const QColor & color )

Use setBackground() instead.

See also backgroundColor().

### void QPainter::setViewXForm ( bool enabled )

Use setViewTransformEnabled() instead.

See also hasViewXForm().

### void QPainter::setWorldMatrix ( const QMatrix & wm, bool combine = false )

Use setMatrix() instead.

See also worldMatrix().

### void QPainter::setWorldXForm ( bool enabled )

Use setMatrixEnabled() instead.

See also hasWorldXForm().

### const QMatrix & QPainter::worldMatrix () const

Use matrix() instead.

See also setWorldMatrix().

### QPoint QPainter::xForm ( const QPoint & p ) const

Use p * matrix() instead.

### QRect QPainter::xForm ( const QRect & r ) const

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

Use r * matrix() instead.

### QPolygon QPainter::xForm ( const QPolygon & a ) const

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

Use a * matrix() instead.

### QPolygon QPainter::xForm ( const QPolygon & av, int index, int npoints ) const

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

Use av * matrix() instead.

If index and npoints are specified, you will need to create a sub-QPolygon before you can apply the transformation.

### QRect QPainter::xFormDev ( const QRect & r ) const

Use r * matrix().inverted() instead.

### QPoint QPainter::xFormDev ( const QPoint & p ) const

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

Use p * matrix().inverted() instead.

### QPolygon QPainter::xFormDev ( const QPolygon & a ) const

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

Use a * matrix().inverted() instead.

### QPolygon QPainter::xFormDev ( const QPolygon & ad, int index, int npoints ) const

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

Use ad * matrix().inverted() instead.

If index and npoints are specified, you will need to create a sub-QPolygon before you can apply the transformation.