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

# Compatibility Members for QPainter

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

QPainter class reference

### Public Functions

- const QColor & backgroundColor () const
- bool begin ( QPaintDevice * pdev, const QWidget * init )
- void drawCubicBezier ( const QPointArray & a, int index = 0 )
- void drawPolygon ( const QPointArray & pa, bool winding, int index = 0, int npoints = -1 )
- void drawPolygon ( const QPolygon & polygon, bool winding, int index = 0, int npoints = -1 )
- void drawText ( int x, int y, const QString & text, int pos, int len, TextDirection dir = Auto )
- void drawText ( const QPoint & p, const QString & text, int pos, int len, TextDirection dir = Auto )
- void drawText ( int x, int y, const QString & text, int len, TextDirection dir = Auto )
- void drawText ( const QPoint & p, const QString & s, int len, TextDirection dir = Auto )
- 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
- QPointArray xForm ( const QPointArray & a ) const
- QPointArray xForm ( const QPointArray & av, int index, int npoints ) const
- QRect xFormDev ( const QRect & r ) const
- QPoint xFormDev ( const QPoint & p ) const
- QPointArray xFormDev ( const QPointArray & a ) const
- QPointArray xFormDev ( const QPointArray & 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.

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

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

###

### void QPainter::drawCubicBezier ( const QPointArray & 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::drawPolygon ( const QPointArray & 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.

### void QPainter::drawPolygon ( const QPolygon & 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::drawText ( int x, int y, const QString & text, int pos, int len, TextDirection dir = Auto )

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

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

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

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

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

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

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

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

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

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

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

### bool QPainter::hasViewXForm () const

### bool QPainter::hasWorldXForm () const

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

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

Use setBackground() instead.

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

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

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

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

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

Returns the point p transformed from model coordinates to device coordinates.

See also xFormDev() and QMatrix::map().

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

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

Returns the rectangle r transformed from model coordinates to device coordinates.

If world transformation is enabled and rotation or shearing has been specified, then the bounding rectangle is returned.

See also xFormDev() and QMatrix::map().

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

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

Returns the point array a transformed from model coordinates to device coordinates.

See also xFormDev() and QMatrix::map().

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

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

Returns the point array av transformed from model coordinates to device coordinates. The index is the first point in the array and npoints denotes the number of points to be transformed. If npoints is negative, all points from av[index] until the last point in the array are transformed.

The returned point array consists of the number of points that were transformed.

Example:

        QPointArray a(10);
        QPointArray b;
        b = painter.xForm(a, 2, 4);  // b.size() == 4
        b = painter.xForm(a, 2, -1); // b.size() == 8

See also xFormDev() and QMatrix::map().

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

Returns the rectangle r transformed from device coordinates to model coordinates.

If world transformation is enabled and rotation or shearing is used, then the bounding rectangle is returned.

See also xForm() and QMatrix::map().

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

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

Returns the point p transformed from device coordinates to model coordinates.

See also xForm() and QMatrix::map().

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

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

Returns the point array a transformed from device coordinates to model coordinates.

See also xForm() and QMatrix::map().

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

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

Returns the point array ad transformed from device coordinates to model coordinates. The index is the first point in the array and npoints denotes the number of points to be transformed. If npoints is negative, all points from ad[index] until the last point in the array are transformed.

The returned point array consists of the number of points that were transformed.

Example:

        QPointArray a(10);
        QPointArray b;
        b = painter.xFormDev(a, 1, 3);  // b.size() == 3
        b = painter.xFormDev(a, 1, -1); // b.size() == 9

See also xForm() and QMatrix::map().