You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/html/qpainter.html

1627 lines
116 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpainter.cpp:68 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QPainter Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QPainter Class Reference</h1>
<p>The QPainter class does low-level painting e.g. on widgets.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qpainter-h.html">qpainter.h</a>&gt;</tt>
<p>Inherits <a href="qt.html">Qt</a>.
<p>Inherited by <a href="qdirectpainter.html">QDirectPainter</a>.
<p><a href="qpainter-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#CoordinateMode-enum"><b>CoordinateMode</b></a> { CoordDevice, CoordPainter }</li>
<li class=fn><a href="#QPainter"><b>QPainter</b></a> ()</li>
<li class=fn><a href="#QPainter-2"><b>QPainter</b></a> ( const&nbsp;QPaintDevice&nbsp;*&nbsp;pd, bool&nbsp;unclipped = FALSE )</li>
<li class=fn><a href="#QPainter-3"><b>QPainter</b></a> ( const&nbsp;QPaintDevice&nbsp;*&nbsp;pd, const&nbsp;QWidget&nbsp;*&nbsp;copyAttributes, bool&nbsp;unclipped = FALSE )</li>
<li class=fn><a href="#~QPainter"><b>~QPainter</b></a> ()</li>
<li class=fn>bool <a href="#begin"><b>begin</b></a> ( const&nbsp;QPaintDevice&nbsp;*&nbsp;pd, bool&nbsp;unclipped = FALSE )</li>
<li class=fn>bool <a href="#begin-2"><b>begin</b></a> ( const&nbsp;QPaintDevice&nbsp;*&nbsp;pd, const&nbsp;QWidget&nbsp;*&nbsp;copyAttributes, bool&nbsp;unclipped = FALSE )</li>
<li class=fn>bool <a href="#end"><b>end</b></a> ()</li>
<li class=fn>QPaintDevice * <a href="#device"><b>device</b></a> () const</li>
<li class=fn>bool <a href="#isActive"><b>isActive</b></a> () const</li>
<li class=fn>void <a href="#flush"><b>flush</b></a> ( const&nbsp;QRegion&nbsp;&amp;&nbsp;region, CoordinateMode&nbsp;cm = CoordDevice )</li>
<li class=fn>void <a href="#flush-2"><b>flush</b></a> ()</li>
<li class=fn>void <a href="#save"><b>save</b></a> ()</li>
<li class=fn>void <a href="#restore"><b>restore</b></a> ()</li>
<li class=fn>QFontMetrics <a href="#fontMetrics"><b>fontMetrics</b></a> () const</li>
<li class=fn>QFontInfo <a href="#fontInfo"><b>fontInfo</b></a> () const</li>
<li class=fn>const QFont &amp; <a href="#font"><b>font</b></a> () const</li>
<li class=fn>void <a href="#setFont"><b>setFont</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;font )</li>
<li class=fn>const QPen &amp; <a href="#pen"><b>pen</b></a> () const</li>
<li class=fn>void <a href="#setPen"><b>setPen</b></a> ( const&nbsp;QPen&nbsp;&amp;&nbsp;pen )</li>
<li class=fn>void <a href="#setPen-2"><b>setPen</b></a> ( PenStyle&nbsp;style )</li>
<li class=fn>void <a href="#setPen-3"><b>setPen</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;color )</li>
<li class=fn>const QBrush &amp; <a href="#brush"><b>brush</b></a> () const</li>
<li class=fn>void <a href="#setBrush-2"><b>setBrush</b></a> ( const&nbsp;QBrush&nbsp;&amp;&nbsp;brush )</li>
<li class=fn>void <a href="#setBrush"><b>setBrush</b></a> ( BrushStyle&nbsp;style )</li>
<li class=fn>void <a href="#setBrush-3"><b>setBrush</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;color )</li>
<li class=fn>QPoint pos () const &nbsp;<em>(obsolete)</em></li>
<li class=fn>const QColor &amp; <a href="#backgroundColor"><b>backgroundColor</b></a> () const</li>
<li class=fn>void <a href="#setBackgroundColor"><b>setBackgroundColor</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;c )</li>
<li class=fn>BGMode <a href="#backgroundMode"><b>backgroundMode</b></a> () const</li>
<li class=fn>void <a href="#setBackgroundMode"><b>setBackgroundMode</b></a> ( BGMode&nbsp;m )</li>
<li class=fn>RasterOp <a href="#rasterOp"><b>rasterOp</b></a> () const</li>
<li class=fn>void <a href="#setRasterOp"><b>setRasterOp</b></a> ( RasterOp&nbsp;r )</li>
<li class=fn>const QPoint &amp; <a href="#brushOrigin"><b>brushOrigin</b></a> () const</li>
<li class=fn>void <a href="#setBrushOrigin"><b>setBrushOrigin</b></a> ( int&nbsp;x, int&nbsp;y )</li>
<li class=fn>void <a href="#setBrushOrigin-2"><b>setBrushOrigin</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>bool <a href="#hasViewXForm"><b>hasViewXForm</b></a> () const</li>
<li class=fn>bool <a href="#hasWorldXForm"><b>hasWorldXForm</b></a> () const</li>
<li class=fn>void <a href="#setViewXForm"><b>setViewXForm</b></a> ( bool&nbsp;enable )</li>
<li class=fn>QRect <a href="#window"><b>window</b></a> () const</li>
<li class=fn>void <a href="#setWindow-2"><b>setWindow</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>void <a href="#setWindow"><b>setWindow</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
<li class=fn>QRect <a href="#viewport"><b>viewport</b></a> () const</li>
<li class=fn>void <a href="#setViewport-2"><b>setViewport</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>void <a href="#setViewport"><b>setViewport</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
<li class=fn>void <a href="#setWorldXForm"><b>setWorldXForm</b></a> ( bool&nbsp;enable )</li>
<li class=fn>const QWMatrix &amp; <a href="#worldMatrix"><b>worldMatrix</b></a> () const</li>
<li class=fn>void <a href="#setWorldMatrix"><b>setWorldMatrix</b></a> ( const&nbsp;QWMatrix&nbsp;&amp;&nbsp;m, bool&nbsp;combine = FALSE )</li>
<li class=fn>void saveWorldMatrix () &nbsp;<em>(obsolete)</em></li>
<li class=fn>void restoreWorldMatrix () &nbsp;<em>(obsolete)</em></li>
<li class=fn>void <a href="#scale"><b>scale</b></a> ( double&nbsp;sx, double&nbsp;sy )</li>
<li class=fn>void <a href="#shear"><b>shear</b></a> ( double&nbsp;sh, double&nbsp;sv )</li>
<li class=fn>void <a href="#rotate"><b>rotate</b></a> ( double&nbsp;a )</li>
<li class=fn>void <a href="#translate"><b>translate</b></a> ( double&nbsp;dx, double&nbsp;dy )</li>
<li class=fn>void <a href="#resetXForm"><b>resetXForm</b></a> ()</li>
<li class=fn>QPoint <a href="#xForm"><b>xForm</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pv ) const</li>
<li class=fn>QRect <a href="#xForm-2"><b>xForm</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;rv ) const</li>
<li class=fn>QPointArray <a href="#xForm-3"><b>xForm</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;av ) const</li>
<li class=fn>QPointArray <a href="#xForm-4"><b>xForm</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;av, int&nbsp;index, int&nbsp;npoints ) const</li>
<li class=fn>QPoint <a href="#xFormDev-2"><b>xFormDev</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pd ) const</li>
<li class=fn>QRect <a href="#xFormDev"><b>xFormDev</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;rd ) const</li>
<li class=fn>QPointArray <a href="#xFormDev-3"><b>xFormDev</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;ad ) const</li>
<li class=fn>QPointArray <a href="#xFormDev-4"><b>xFormDev</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;ad, int&nbsp;index, int&nbsp;npoints ) const</li>
<li class=fn>void <a href="#setClipping"><b>setClipping</b></a> ( bool&nbsp;enable )</li>
<li class=fn>bool <a href="#hasClipping"><b>hasClipping</b></a> () const</li>
<li class=fn>QRegion <a href="#clipRegion"><b>clipRegion</b></a> ( CoordinateMode&nbsp;m = CoordDevice ) const</li>
<li class=fn>void <a href="#setClipRect-2"><b>setClipRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, CoordinateMode&nbsp;m = CoordDevice )</li>
<li class=fn>void <a href="#setClipRect"><b>setClipRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, CoordinateMode&nbsp;m = CoordDevice )</li>
<li class=fn>void <a href="#setClipRegion"><b>setClipRegion</b></a> ( const&nbsp;QRegion&nbsp;&amp;&nbsp;rgn, CoordinateMode&nbsp;m = CoordDevice )</li>
<li class=fn>void <a href="#drawPoint"><b>drawPoint</b></a> ( int&nbsp;x, int&nbsp;y )</li>
<li class=fn>void <a href="#drawPoint-2"><b>drawPoint</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
<li class=fn>void <a href="#drawPoints"><b>drawPoints</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;a, int&nbsp;index = 0, int&nbsp;npoints = -1 )</li>
<li class=fn>void moveTo ( int&nbsp;x, int&nbsp;y ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void moveTo ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void lineTo ( int&nbsp;x, int&nbsp;y ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void lineTo ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void <a href="#drawLine"><b>drawLine</b></a> ( int&nbsp;x1, int&nbsp;y1, int&nbsp;x2, int&nbsp;y2 )</li>
<li class=fn>void <a href="#drawLine-2"><b>drawLine</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p1, const&nbsp;QPoint&nbsp;&amp;&nbsp;p2 )</li>
<li class=fn>void <a href="#drawRect"><b>drawRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
<li class=fn>void <a href="#drawRect-2"><b>drawRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>void <a href="#drawWinFocusRect-2"><b>drawWinFocusRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
<li class=fn>void <a href="#drawWinFocusRect"><b>drawWinFocusRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;QColor&nbsp;&amp;&nbsp;bgColor )</li>
<li class=fn>void <a href="#drawWinFocusRect-3"><b>drawWinFocusRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>void <a href="#drawWinFocusRect-4"><b>drawWinFocusRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, const&nbsp;QColor&nbsp;&amp;&nbsp;bgColor )</li>
<li class=fn>void <a href="#drawRoundRect"><b>drawRoundRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;xRnd = 25, int&nbsp;yRnd = 25 )</li>
<li class=fn>void <a href="#drawRoundRect-2"><b>drawRoundRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, int&nbsp;xRnd = 25, int&nbsp;yRnd = 25 )</li>
<li class=fn>void <a href="#drawEllipse"><b>drawEllipse</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
<li class=fn>void <a href="#drawEllipse-2"><b>drawEllipse</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>void <a href="#drawArc"><b>drawArc</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;a, int&nbsp;alen )</li>
<li class=fn>void <a href="#drawArc-2"><b>drawArc</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, int&nbsp;a, int&nbsp;alen )</li>
<li class=fn>void <a href="#drawPie"><b>drawPie</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;a, int&nbsp;alen )</li>
<li class=fn>void <a href="#drawPie-2"><b>drawPie</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, int&nbsp;a, int&nbsp;alen )</li>
<li class=fn>void <a href="#drawChord"><b>drawChord</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;a, int&nbsp;alen )</li>
<li class=fn>void <a href="#drawChord-2"><b>drawChord</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, int&nbsp;a, int&nbsp;alen )</li>
<li class=fn>void <a href="#drawLineSegments"><b>drawLineSegments</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;a, int&nbsp;index = 0, int&nbsp;nlines = -1 )</li>
<li class=fn>void <a href="#drawPolyline"><b>drawPolyline</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;a, int&nbsp;index = 0, int&nbsp;npoints = -1 )</li>
<li class=fn>void <a href="#drawPolygon"><b>drawPolygon</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;a, bool&nbsp;winding = FALSE, int&nbsp;index = 0, int&nbsp;npoints = -1 )</li>
<li class=fn>void <a href="#drawConvexPolygon"><b>drawConvexPolygon</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;pa, int&nbsp;index = 0, int&nbsp;npoints = -1 )</li>
<li class=fn>void <a href="#drawCubicBezier"><b>drawCubicBezier</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;a, int&nbsp;index = 0 )</li>
<li class=fn>void <a href="#drawPixmap"><b>drawPixmap</b></a> ( int&nbsp;x, int&nbsp;y, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, int&nbsp;sx = 0, int&nbsp;sy = 0, int&nbsp;sw = -1, int&nbsp;sh = -1 )</li>
<li class=fn>void <a href="#drawPixmap-2"><b>drawPixmap</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pm, const&nbsp;QRect&nbsp;&amp;&nbsp;sr )</li>
<li class=fn>void <a href="#drawPixmap-3"><b>drawPixmap</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pm )</li>
<li class=fn>void <a href="#drawPixmap-4"><b>drawPixmap</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pm )</li>
<li class=fn>void <a href="#drawImage"><b>drawImage</b></a> ( int&nbsp;x, int&nbsp;y, const&nbsp;QImage&nbsp;&amp;&nbsp;image, int&nbsp;sx = 0, int&nbsp;sy = 0, int&nbsp;sw = -1, int&nbsp;sh = -1, int&nbsp;conversionFlags = 0 )</li>
<li class=fn>void <a href="#drawImage-2"><b>drawImage</b></a> ( const QPoint &amp;, const QImage &amp;, const&nbsp;QRect&nbsp;&amp;&nbsp;sr, int&nbsp;conversionFlags = 0 )</li>
<li class=fn>void <a href="#drawImage-3"><b>drawImage</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p, const&nbsp;QImage&nbsp;&amp;&nbsp;i, int&nbsp;conversion_flags = 0 )</li>
<li class=fn>void <a href="#drawImage-4"><b>drawImage</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, const&nbsp;QImage&nbsp;&amp;&nbsp;i )</li>
<li class=fn>void <a href="#drawTiledPixmap"><b>drawTiledPixmap</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, int&nbsp;sx = 0, int&nbsp;sy = 0 )</li>
<li class=fn>void <a href="#drawTiledPixmap-2"><b>drawTiledPixmap</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pm, const&nbsp;QPoint&nbsp;&amp;&nbsp;sp )</li>
<li class=fn>void <a href="#drawTiledPixmap-3"><b>drawTiledPixmap</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pm )</li>
<li class=fn>void drawPicture ( const&nbsp;QPicture&nbsp;&amp;&nbsp;pic ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void <a href="#drawPicture"><b>drawPicture</b></a> ( int&nbsp;x, int&nbsp;y, const&nbsp;QPicture&nbsp;&amp;&nbsp;pic )</li>
<li class=fn>void <a href="#drawPicture-3"><b>drawPicture</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p, const&nbsp;QPicture&nbsp;&amp;&nbsp;pic )</li>
<li class=fn>void <a href="#fillRect"><b>fillRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;QBrush&nbsp;&amp;&nbsp;brush )</li>
<li class=fn>void <a href="#fillRect-2"><b>fillRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, const&nbsp;QBrush&nbsp;&amp;&nbsp;brush )</li>
<li class=fn>void <a href="#eraseRect"><b>eraseRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
<li class=fn>void <a href="#eraseRect-2"><b>eraseRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
<li class=fn>enum <a href="#TextDirection-enum"><b>TextDirection</b></a> { Auto, RTL, LTR }</li>
<li class=fn>void <a href="#drawText-2"><b>drawText</b></a> ( int&nbsp;x, int&nbsp;y, const QString &amp;, int&nbsp;len = -1, TextDirection&nbsp;dir = Auto )</li>
<li class=fn>void <a href="#drawText-3"><b>drawText</b></a> ( const QPoint &amp;, const QString &amp;, int&nbsp;len = -1, TextDirection&nbsp;dir = Auto )</li>
<li class=fn>void <a href="#drawText-4"><b>drawText</b></a> ( int&nbsp;x, int&nbsp;y, const QString &amp;, int&nbsp;pos, int&nbsp;len, TextDirection&nbsp;dir = Auto )</li>
<li class=fn>void <a href="#drawText"><b>drawText</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p, const QString &amp;, int&nbsp;pos, int&nbsp;len, TextDirection&nbsp;dir = Auto )</li>
<li class=fn>void <a href="#drawText-5"><b>drawText</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;flags, const QString &amp;, int&nbsp;len = -1, QRect&nbsp;*&nbsp;br = 0, QTextParag&nbsp;**&nbsp;internal = 0 )</li>
<li class=fn>void <a href="#drawText-6"><b>drawText</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, int&nbsp;tf, const&nbsp;QString&nbsp;&amp;&nbsp;str, int&nbsp;len = -1, QRect&nbsp;*&nbsp;brect = 0, QTextParag&nbsp;**&nbsp;internal = 0 )</li>
<li class=fn>QRect <a href="#boundingRect"><b>boundingRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;flags, const QString &amp;, int&nbsp;len = -1, QTextParag&nbsp;**&nbsp;intern = 0 )</li>
<li class=fn>QRect <a href="#boundingRect-2"><b>boundingRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, int&nbsp;flags, const&nbsp;QString&nbsp;&amp;&nbsp;str, int&nbsp;len = -1, QTextParag&nbsp;**&nbsp;internal = 0 )</li>
<li class=fn>int <a href="#tabStops"><b>tabStops</b></a> () const</li>
<li class=fn>void <a href="#setTabStops"><b>setTabStops</b></a> ( int&nbsp;ts )</li>
<li class=fn>int * <a href="#tabArray"><b>tabArray</b></a> () const</li>
<li class=fn>void <a href="#setTabArray"><b>setTabArray</b></a> ( int&nbsp;*&nbsp;ta )</li>
<li class=fn>HDC <a href="#handle"><b>handle</b></a> () const</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>void <a href="#redirect"><b>redirect</b></a> ( QPaintDevice&nbsp;*&nbsp;pdev, QPaintDevice&nbsp;*&nbsp;replacement )</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>void <a href="#qDrawShadeLine"><b>qDrawShadeLine</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;x1, int&nbsp;y1, int&nbsp;x2, int&nbsp;y2, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, int&nbsp;lineWidth, int&nbsp;midLineWidth )</li>
<li class=fn>void <a href="#qDrawShadeRect"><b>qDrawShadeRect</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, int&nbsp;lineWidth, int&nbsp;midLineWidth, const&nbsp;QBrush&nbsp;*&nbsp;fill )</li>
<li class=fn>void <a href="#qDrawShadePanel"><b>qDrawShadePanel</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, int&nbsp;lineWidth, const&nbsp;QBrush&nbsp;*&nbsp;fill )</li>
<li class=fn>void <a href="#qDrawWinButton"><b>qDrawWinButton</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, const&nbsp;QBrush&nbsp;*&nbsp;fill )</li>
<li class=fn>void <a href="#qDrawWinPanel"><b>qDrawWinPanel</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, const&nbsp;QBrush&nbsp;*&nbsp;fill )</li>
<li class=fn>void <a href="#qDrawPlainRect"><b>qDrawPlainRect</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;QColor&nbsp;&amp;&nbsp;c, int&nbsp;lineWidth, const&nbsp;QBrush&nbsp;*&nbsp;fill )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QPainter class does low-level painting e.g. on widgets.
<p>
<p> The painter provides highly optimized functions to do most of the
drawing GUI programs require. QPainter can draw everything from
simple lines to complex shapes like pies and chords. It can also
draw aligned text and pixmaps. Normally, it draws in a "natural"
coordinate system, but it can also do view and world
transformation.
<p> The typical use of a painter is:
<p> <ul>
<li> Construct a painter.
<li> Set a pen, a brush etc.
<li> Draw.
<li> Destroy the painter.
</ul>
<p> Mostly, all this is done inside a paint event. (In fact, 99% of
all QPainter use is in a reimplementation of
<a href="qwidget.html#paintEvent">QWidget::paintEvent</a>(), and the painter is heavily optimized for
such use.) Here's one very simple example:
<p> <pre>
void SimpleExampleWidget::paintEvent()
{
QPainter paint( this );
paint.<a href="#setPen">setPen</a>( Qt::blue );
paint.<a href="#drawText">drawText</a>( rect(), AlignCenter, "The Text" );
}
</pre>
<p> Usage is simple, and there are many settings you can use:
<p> <ul>
<p> <li> <a href="#font">font</a>() is the currently set font. If you set a font that isn't
available, Qt finds a close match. In fact font() returns what
you set using <a href="#setFont">setFont</a>() and <a href="#fontInfo">fontInfo</a>() returns the font actually
being used (which may be the same).
<p> <li> <a href="#brush">brush</a>() is the currently set brush; the color or pattern that's
used for filling e.g. circles.
<p> <li> <a href="#pen">pen</a>() is the currently set pen; the color or stipple that's
used for drawing lines or boundaries.
<p> <li> <a href="#backgroundMode">backgroundMode</a>() is <tt>Opaque</tt> or <tt>Transparent</tt>, i.e. whether
<a href="#backgroundColor">backgroundColor</a>() is used or not.
<p> <li> backgroundColor() only applies when backgroundMode() is Opaque
and pen() is a stipple. In that case, it describes the color of
the background pixels in the stipple.
<p> <li> <a href="#rasterOp">rasterOp</a>() is how pixels drawn interact with the pixels already
there.
<p> <li> <a href="#brushOrigin">brushOrigin</a>() is the origin of the tiled brushes, normally the
origin of the window.
<p> <li> <a href="#viewport">viewport</a>(), <a href="#window">window</a>(), <a href="#worldMatrix">worldMatrix</a>() and many more make up the
painter's coordinate transformation system. See <a href="coordsys.html">The Coordinate System</a> for an explanation of
this, or see below for a very brief overview of the functions.
<p> <li> <a href="#hasClipping">hasClipping</a>() is whether the painter clips at all. (The paint
device clips, too.) If the painter clips, it clips to <a href="#clipRegion">clipRegion</a>().
<p> <li> <a href="#pos">pos</a>() is the current position, set by <a href="#moveTo">moveTo</a>() and used by
<a href="#lineTo">lineTo</a>().
<p> </ul>
<p> Note that some of these settings mirror settings in some paint
devices, e.g. <a href="qwidget.html#font">QWidget::font</a>(). <a href="#begin">QPainter::begin</a>() (or the QPainter
constructor) copies these attributes from the paint device.
Calling, for example, <a href="qwidget.html#setFont">QWidget::setFont</a>() doesn't take effect until
the next time a painter begins painting on it.
<p> <a href="#save">save</a>() saves all of these settings on an internal stack, <a href="#restore">restore</a>()
pops them back.
<p> The core functionality of QPainter is drawing, and there are
functions to draw most primitives: <a href="#drawPoint">drawPoint</a>(), <a href="#drawPoints">drawPoints</a>(),
<a href="#drawLine">drawLine</a>(), <a href="#drawRect">drawRect</a>(), <a href="#drawWinFocusRect">drawWinFocusRect</a>(), <a href="#drawRoundRect">drawRoundRect</a>(),
<a href="#drawEllipse">drawEllipse</a>(), <a href="#drawArc">drawArc</a>(), <a href="#drawPie">drawPie</a>(), <a href="#drawChord">drawChord</a>(),
<a href="#drawLineSegments">drawLineSegments</a>(), <a href="#drawPolyline">drawPolyline</a>(), <a href="#drawPolygon">drawPolygon</a>(),
<a href="#drawConvexPolygon">drawConvexPolygon</a>() and <a href="#drawCubicBezier">drawCubicBezier</a>(). All of these functions
take integer coordinates; there are no floating-point versions
since we want drawing to be as fast as possible.
<p> There are functions to draw pixmaps/images, namely <a href="#drawPixmap">drawPixmap</a>(),
<a href="#drawImage">drawImage</a>() and <a href="#drawTiledPixmap">drawTiledPixmap</a>(). drawPixmap() and drawImage()
produce the same result, except that drawPixmap() is faster
on-screen and drawImage() faster and sometimes better on <a href="qprinter.html">QPrinter</a>
and <a href="qpicture.html">QPicture</a>.
<p> Text drawing is done using <a href="#drawText">drawText</a>(), and when you need
fine-grained positioning, <a href="#boundingRect">boundingRect</a>() tells you where a given
drawText() command would draw.
<p> There is a <a href="#drawPicture">drawPicture</a>() function that draws the contents of an
entire QPicture using this painter. drawPicture() is the only
function that disregards all the painter's settings: the QPicture
has its own settings.
<p> Normally, the QPainter operates on the device's own coordinate
system (usually pixels), but QPainter has good support for
coordinate transformation. See <a href="coordsys.html">The Coordinate
System</a> for a more general overview and a simple example.
<p> The most common functions used are <a href="#scale">scale</a>(), <a href="#rotate">rotate</a>(), <a href="#translate">translate</a>()
and <a href="#shear">shear</a>(), all of which operate on the <a href="#worldMatrix">worldMatrix</a>().
<a href="#setWorldMatrix">setWorldMatrix</a>() can replace or add to the currently set
worldMatrix().
<p> <a href="#setViewport">setViewport</a>() sets the rectangle on which QPainter operates. The
default is the entire device, which is usually fine, except on
printers. <a href="#setWindow">setWindow</a>() sets the coordinate system, that is, the
rectangle that maps to <a href="#viewport">viewport</a>(). What's drawn inside the
<a href="#window">window</a>() ends up being inside the viewport(). The window's
default is the same as the viewport, and if you don't use the
transformations, they are optimized away, gaining another little
bit of speed.
<p> After all the coordinate transformation is done, QPainter can clip
the drawing to an arbitrary rectangle or region. <a href="#hasClipping">hasClipping</a>() is
TRUE if QPainter clips, and <a href="#clipRegion">clipRegion</a>() returns the clip region.
You can set it using either <a href="#setClipRegion">setClipRegion</a>() or <a href="#setClipRect">setClipRect</a>().
Note that the clipping can be slow. It's all system-dependent,
but as a rule of thumb, you can assume that drawing speed is
inversely proportional to the number of rectangles in the clip
region.
<p> After QPainter's clipping, the paint device may also clip. For
example, most widgets clip away the pixels used by child widgets,
and most printers clip away an area near the edges of the paper.
This additional clipping is not reflected by the return value of
clipRegion() or hasClipping().
<p> QPainter also includes some less-used functions that are very
useful on those occasions when they're needed.
<p> <a href="#isActive">isActive</a>() indicates whether the painter is active. <a href="#begin">begin</a>() (and
the most usual constructor) makes it active. <a href="#end">end</a>() (and the
destructor) deactivates it. If the painter is active, <a href="#device">device</a>()
returns the paint device on which the painter paints.
<p> Sometimes it is desirable to make someone else paint on an unusual
<a href="qpaintdevice.html">QPaintDevice</a>. QPainter supports a static function to do this,
<a href="#redirect">redirect</a>(). We recommend not using it, but for some hacks it's
perfect.
<p> <a href="#setTabStops">setTabStops</a>() and <a href="#setTabArray">setTabArray</a>() can change where the tab stops
are, but these are very seldomly used.
<p> <b>Warning:</b> Note that QPainter does not attempt to work around
coordinate limitations in the underlying window system. Some
platforms may behave incorrectly with coordinates as small as
+/-4000.
<p> <p>See also <a href="qpaintdevice.html">QPaintDevice</a>, <a href="qwidget.html">QWidget</a>, <a href="qpixmap.html">QPixmap</a>, <a href="qprinter.html">QPrinter</a>, <a href="qpicture.html">QPicture</a>, <a href="simple-application.html">Application Walkthrough</a>, <a href="coordsys.html">Coordinate System Overview</a>, <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="CoordinateMode-enum"></a>QPainter::CoordinateMode</h3>
<ul>
<li><tt>QPainter::CoordDevice</tt>
<li><tt>QPainter::CoordPainter</tt>
</ul><p> <p>See also <a href="#clipRegion">clipRegion</a>().
<h3 class=fn><a name="TextDirection-enum"></a>QPainter::TextDirection</h3>
<ul>
<li><tt>QPainter::Auto</tt>
<li><tt>QPainter::RTL</tt> - right to left
<li><tt>QPainter::LTR</tt> - left to right
</ul><p> <p>See also <a href="#drawText">drawText</a>().
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QPainter"></a>QPainter::QPainter ()
</h3>
Constructs a painter.
<p> Notice that all painter settings (setPen, setBrush etc.) are reset
to default values when <a href="#begin">begin</a>() is called.
<p> <p>See also <a href="#begin">begin</a>() and <a href="#end">end</a>().
<h3 class=fn><a name="QPainter-2"></a>QPainter::QPainter ( const&nbsp;<a href="qpaintdevice.html">QPaintDevice</a>&nbsp;*&nbsp;pd, bool&nbsp;unclipped = FALSE )
</h3>
Constructs a painter that begins painting the paint device <em>pd</em>
immediately. Depending on the underlying graphic system the
painter will paint over children of the paintdevice if <em>unclipped</em> is TRUE.
<p> This constructor is convenient for short-lived painters, e.g. in a
<a href="qwidget.html#paintEvent">paint event</a> and should be used
only once. The constructor calls <a href="#begin">begin</a>() for you and the QPainter
destructor automatically calls <a href="#end">end</a>().
<p> Here's an example using begin() and end():
<pre>
void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
{
QPainter p;
p.<a href="#begin">begin</a>( this );
p.<a href="#drawLine">drawLine</a>( ... ); // drawing code
p.<a href="#end">end</a>();
}
</pre>
<p> The same example using this constructor:
<pre>
void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
{
QPainter p( this );
p.<a href="#drawLine">drawLine</a>( ... ); // drawing code
}
</pre>
<p> Since the constructor cannot provide feedback when the initialization
of the painter failed you should rather use begin() and end() to paint
on external devices, e.g. printers.
<p> <p>See also <a href="#begin">begin</a>() and <a href="#end">end</a>().
<h3 class=fn><a name="QPainter-3"></a>QPainter::QPainter ( const&nbsp;<a href="qpaintdevice.html">QPaintDevice</a>&nbsp;*&nbsp;pd, const&nbsp;<a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;copyAttributes, bool&nbsp;unclipped = FALSE )
</h3>
Constructs a painter that begins painting the paint device <em>pd</em>
immediately, with the default arguments taken from <em>copyAttributes</em>. The painter will paint over children of the paint
device if <em>unclipped</em> is TRUE (although this is not supported on
all platforms).
<p> <p>See also <a href="#begin">begin</a>().
<h3 class=fn><a name="~QPainter"></a>QPainter::~QPainter ()
</h3>
Destroys the painter.
<h3 class=fn>const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp; <a name="backgroundColor"></a>QPainter::backgroundColor () const
</h3>
<p> Returns the current background color.
<p> <p>See also <a href="#setBackgroundColor">setBackgroundColor</a>() and <a href="qcolor.html">QColor</a>.
<h3 class=fn><a href="qt.html#BGMode-enum">BGMode</a> <a name="backgroundMode"></a>QPainter::backgroundMode () const
</h3>
<p> Returns the current background mode.
<p> <p>See also <a href="#setBackgroundMode">setBackgroundMode</a>() and <a href="qt.html#BGMode-enum">BGMode</a>.
<h3 class=fn>bool <a name="begin"></a>QPainter::begin ( const&nbsp;<a href="qpaintdevice.html">QPaintDevice</a>&nbsp;*&nbsp;pd, bool&nbsp;unclipped = FALSE )
</h3>
Begins painting the paint device <em>pd</em> and returns TRUE if
successful; otherwise returns FALSE. If <em>unclipped</em> is TRUE, the
painting will not be clipped at the paint device's boundaries,
(although this is not supported by all platforms).
<p> The errors that can occur are serious problems, such as these:
<p> <pre>
p-&gt;begin( 0 ); // impossible - paint device cannot be 0
<a href="qpixmap.html">QPixmap</a> pm( 0, 0 );
p-&gt;begin( pm ); // impossible - pm.<a href="qpixmap.html#isNull">isNull</a>();
p-&gt;begin( myWidget );
p2-&gt;begin( myWidget ); // impossible - only one painter at a time
</pre>
<p> Note that most of the time, you can use one of the constructors
instead of <a href="#begin">begin</a>(), and that <a href="#end">end</a>() is automatically done at
destruction.
<p> <b>Warning:</b> A paint device can only be painted by one painter at a
time.
<p> <p>See also <a href="#end">end</a>() and <a href="#flush">flush</a>().
<p>Examples: <a href="aclock-example.html#x1183">aclock/aclock.cpp</a>, <a href="desktop-example.html#x1733">desktop/desktop.cpp</a>, <a href="drawdemo-example.html#x1067">drawdemo/drawdemo.cpp</a>, <a href="hello-example.html#x1633">hello/hello.cpp</a>, <a href="picture-example.html#x111">picture/picture.cpp</a>, <a href="tutorial1-10.html#x2348">t10/cannon.cpp</a>, and <a href="xform-example.html#x1233">xform/xform.cpp</a>.
<h3 class=fn>bool <a name="begin-2"></a>QPainter::begin ( const&nbsp;<a href="qpaintdevice.html">QPaintDevice</a>&nbsp;*&nbsp;pd, const&nbsp;<a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;copyAttributes, bool&nbsp;unclipped = FALSE )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This version opens the painter on a paint device <em>pd</em> and sets
the initial pen, background color and font from <em>copyAttributes</em>,
painting over the paint device's children when <em>unclipped</em> is
TRUE. This is equivalent to:
<p> <pre>
QPainter p;
p.<a href="#begin">begin</a>( pd );
p.<a href="#setPen">setPen</a>( copyAttributes-&gt;foregroundColor() );
p.<a href="#setBackgroundColor">setBackgroundColor</a>( copyAttributes-&gt;backgroundColor() );
p.<a href="#setFont">setFont</a>( copyAttributes-&gt;font() );
</pre>
<p> This begin function is convenient for double buffering. When you
draw in a pixmap instead of directly in a widget (to later bitBlt
the pixmap into the widget) you will need to set the widget's
font etc. This function does exactly that.
<p> Example:
<pre>
void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
{
<a href="qpixmap.html">QPixmap</a> pm(size());
QPainter p;
p.<a href="#begin">begin</a>(&amp;pm, this);
// ... potentially flickering paint operation ...
p.<a href="#end">end</a>();
<a href="qimage.html#bitBlt">bitBlt</a>(this, 0, 0, &amp;pm);
}
</pre>
<p> <p>See also <a href="#end">end</a>().
<h3 class=fn><a href="qrect.html">QRect</a> <a name="boundingRect"></a>QPainter::boundingRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;flags, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;, int&nbsp;len = -1, QTextParag&nbsp;**&nbsp;intern = 0 )
</h3>
<p> Returns the bounding rectangle of the aligned text that would be
printed with the corresponding <a href="#drawText">drawText</a>() function using the first
<em>len</em> characters of the string if <em>len</em> is > -1, or the whole of
the string if <em>len</em> is -1. The drawing, and hence the bounding
rectangle, is constrained to the rectangle that begins at point <em>(x, y)</em> with width <em>w</em> and hight <em>h</em>, or to the
rectangle required to draw the text, whichever is the larger.
<p> The <em>flags</em> argument is
the bitwise OR of the following flags:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Flag <th valign="top">Meaning
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignAuto</a> <td valign="top">aligns according to the language, usually left.
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignLeft</a> <td valign="top">aligns to the left border.
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignRight</a> <td valign="top">aligns to the right border.
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignHCenter</a> <td valign="top">aligns horizontally centered.
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignTop</a> <td valign="top">aligns to the top border.
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignBottom</a> <td valign="top">aligns to the bottom border.
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignVCenter</a> <td valign="top">aligns vertically centered.
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignCenter</a> <td valign="top">(== <a href="qt.html#AlignmentFlags-enum">AlignHCenter</a> | <a href="qt.html#AlignmentFlags-enum">AlignVCenter</a>).
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#TextFlags-enum">SingleLine</a> <td valign="top">ignores newline characters in the text.
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#TextFlags-enum">ExpandTabs</a> <td valign="top">expands tabs.
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#TextFlags-enum">ShowPrefix</a> <td valign="top">interprets "&x" as "<u>x</u>".
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#TextFlags-enum">WordBreak</a> <td valign="top">breaks the text to fit the rectangle.
</table></center>
<p> Horizontal alignment defaults to <a href="qt.html#AlignmentFlags-enum">AlignLeft</a> and vertical
alignment defaults to <a href="qt.html#AlignmentFlags-enum">AlignTop</a>.
<p> If several of the horizontal or several of the vertical alignment flags
are set, the resulting alignment is undefined.
<p> The <em>intern</em> parameter should not be used.
<p> <p>See also <a href="qt.html#TextFlags-enum">Qt::TextFlags</a>.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="boundingRect-2"></a>QPainter::boundingRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, int&nbsp;flags, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str, int&nbsp;len = -1, QTextParag&nbsp;**&nbsp;internal = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the bounding rectangle of the aligned text that would be
printed with the corresponding <a href="#drawText">drawText</a>() function using the first
<em>len</em> characters from <em>str</em> if <em>len</em> is > -1, or the whole of
<em>str</em> if <em>len</em> is -1. The drawing, and hence the bounding
rectangle, is constrained to the rectangle <em>r</em>, or to the
rectangle required to draw the text, whichever is the larger.
<p> The <em>internal</em> parameter should not be used.
<p> <p>See also <a href="#drawText">drawText</a>(), <a href="#fontMetrics">fontMetrics</a>(), <a href="qfontmetrics.html#boundingRect">QFontMetrics::boundingRect</a>(), and <a href="qt.html#TextFlags-enum">Qt::TextFlags</a>.
<h3 class=fn>const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp; <a name="brush"></a>QPainter::brush () const
</h3>
<p> Returns the painter's current brush.
<p> <p>See also <a href="#setBrush">QPainter::setBrush</a>().
<p>Examples: <a href="themes-example.html#x283">themes/metal.cpp</a> and <a href="themes-example.html#x212">themes/wood.cpp</a>.
<h3 class=fn>const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; <a name="brushOrigin"></a>QPainter::brushOrigin () const
</h3>
<p> Returns the brush origin currently set.
<p> <p>See also <a href="#setBrushOrigin">setBrushOrigin</a>().
<h3 class=fn><a href="qregion.html">QRegion</a> <a name="clipRegion"></a>QPainter::clipRegion ( <a href="qpainter.html#CoordinateMode-enum">CoordinateMode</a>&nbsp;m = CoordDevice ) const
</h3>
Returns the currently set clip region. Note that the clip region
is given in physical device coordinates and <em>not</em> subject to any
<a href="coordsys.html">coordinate transformation</a> if <em>m</em> is
equal to <a href="#CoordinateMode-enum">CoordDevice</a> (the default). If <em>m</em> equals <a href="#CoordinateMode-enum">CoordPainter</a> the returned region is in model coordinates.
<p> <p>See also <a href="#setClipRegion">setClipRegion</a>(), <a href="#setClipRect">setClipRect</a>(), <a href="#setClipping">setClipping</a>(), and <a href="#CoordinateMode-enum">QPainter::CoordinateMode</a>.
<p>Example: <a href="themes-example.html#x213">themes/wood.cpp</a>.
<h3 class=fn><a href="qpaintdevice.html">QPaintDevice</a>&nbsp;* <a name="device"></a>QPainter::device () const
</h3>
<p> Returns the paint device on which this painter is currently
painting, or 0 if the painter is not active.
<p> <p>See also <a href="qpaintdevice.html#paintingActive">QPaintDevice::paintingActive</a>().
<p>Examples: <a href="qaction-application-example.html#x1145">action/application.cpp</a>, <a href="simple-application-example.html#x1563">application/application.cpp</a>, <a href="helpviewer-example.html#x999">helpviewer/helpwindow.cpp</a>, <a href="listboxcombo-example.html#x1413">listboxcombo/listboxcombo.cpp</a>, and <a href="mdi-example.html#x2044">mdi/application.cpp</a>.
<h3 class=fn>void <a name="drawArc"></a>QPainter::drawArc ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;a, int&nbsp;alen )
</h3>
Draws an arc defined by the rectangle <em>(x, y, w, h)</em>, the start
angle <em>a</em> and the arc length <em>alen</em>.
<p> The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
mean counter-clockwise while negative values mean the clockwise
direction. Zero degrees is at the 3 o'clock position.
<p> Example:
<pre>
QPainter p( myWidget );
p.<a href="#drawArc">drawArc</a>( 10,10, 70,100, 100*16, 160*16 ); // draws a "(" arc
</pre>
<p> <p>See also <a href="#drawPie">drawPie</a>() and <a href="#drawChord">drawChord</a>().
<h3 class=fn>void <a name="drawArc-2"></a>QPainter::drawArc ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, int&nbsp;a, int&nbsp;alen )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the arc that fits inside the rectangle <em>r</em> with start angle
<em>a</em> and arc length <em>alen</em>.
<h3 class=fn>void <a name="drawChord"></a>QPainter::drawChord ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;a, int&nbsp;alen )
</h3>
Draws a chord defined by the rectangle <em>(x, y, w, h)</em>, the start
angle <em>a</em> and the arc length <em>alen</em>.
<p> The chord is filled with the current <a href="#brush">brush</a>().
<p> The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
mean counter-clockwise while negative values mean the clockwise
direction. Zero degrees is at the 3 o'clock position.
<p> <p>See also <a href="#drawArc">drawArc</a>() and <a href="#drawPie">drawPie</a>().
<h3 class=fn>void <a name="drawChord-2"></a>QPainter::drawChord ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, int&nbsp;a, int&nbsp;alen )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws a chord that fits inside the rectangle <em>r</em> with start angle
<em>a</em> and arc length <em>alen</em>.
<h3 class=fn>void <a name="drawConvexPolygon"></a>QPainter::drawConvexPolygon ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;pa, int&nbsp;index = 0, int&nbsp;npoints = -1 )
</h3>
Draws the convex polygon defined by the <em>npoints</em> points in <em>pa</em>
starting at <em>pa[index]</em> (<em>index</em> defaults to 0).
<p> If the supplied polygon is not convex, the results are undefined.
<p> On some platforms (e.g. X Window), this is faster than
<a href="#drawPolygon">drawPolygon</a>().
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
values are truncated. This limitation is expected to go away in
Qt 4.
<p>Example: <a href="coordsys.html#x2271">aclock/aclock.cpp</a>.
<h3 class=fn>void <a name="drawCubicBezier"></a>QPainter::drawCubicBezier ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;a, int&nbsp;index = 0 )
</h3>
Draws a cubic Bezier curve defined by the control points in <em>a</em>,
starting at <em>a[index]</em> (<em>index</em> defaults to 0).
<p> Control points after <em>a[index + 3]</em> are ignored. Nothing happens
if there aren't enough control points.
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
values are truncated. This limitation is expected to go away in
Qt 4.
<h3 class=fn>void <a name="drawEllipse"></a>QPainter::drawEllipse ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
</h3>
Draws an ellipse with center at <em>(x + w/2, y + h/2)</em> and size <em>(w, h)</em>.
<p>Examples: <a href="drawdemo-example.html#x1068">drawdemo/drawdemo.cpp</a>, <a href="qaxserver-example-multiple.html#x2545">multiple/ax2.h</a>, <a href="picture-example.html#x112">picture/picture.cpp</a>, and <a href="tictac-example.html#x28">tictac/tictac.cpp</a>.
<h3 class=fn>void <a name="drawEllipse-2"></a>QPainter::drawEllipse ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the ellipse that fits inside rectangle <em>r</em>.
<h3 class=fn>void <a name="drawImage"></a>QPainter::drawImage ( int&nbsp;x, int&nbsp;y, const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image, int&nbsp;sx = 0, int&nbsp;sy = 0, int&nbsp;sw = -1, int&nbsp;sh = -1, int&nbsp;conversionFlags = 0 )
</h3>
Draws at (<em>x</em>, <em>y</em>) the <em>sw</em> by <em>sh</em> area of pixels from (<em>sx</em>, <em>sy</em>) in <em>image</em>, using <em>conversionFlags</em> if the image
needs to be converted to a pixmap. The default value for <em>conversionFlags</em> is 0; see convertFromImage() for information about
what other values do.
<p> This function may convert <em>image</em> to a pixmap and then draw it,
if <a href="#device">device</a>() is a <a href="qpixmap.html">QPixmap</a> or a <a href="qwidget.html">QWidget</a>, or else draw it directly,
if device() is a <a href="qprinter.html">QPrinter</a> or <a href="qpicture.html">QPicture</a>.
<p> Currently alpha masks of the image are ignored when painting on a QPrinter.
<p> <p>See also <a href="#drawPixmap">drawPixmap</a>() and <a href="qpixmap.html#convertFromImage">QPixmap::convertFromImage</a>().
<p>Example: <a href="canvas-example.html#x2941">canvas/canvas.cpp</a>.
<h3 class=fn>void <a name="drawImage-2"></a>QPainter::drawImage ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;, const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;sr, int&nbsp;conversionFlags = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the rectangle <em>sr</em> from the image at the given point.
<h3 class=fn>void <a name="drawImage-3"></a>QPainter::drawImage ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p, const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;i, int&nbsp;conversion_flags = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the image <em>i</em> at point <em>p</em>.
<p> If the image needs to be modified to fit in a lower-resolution
result (e.g. converting from 32-bit to 8-bit), use the <em>conversion_flags</em> to specify how you'd prefer this to happen.
<p> <p>See also <a href="qt.html#ImageConversionFlags-enum">Qt::ImageConversionFlags</a>.
<h3 class=fn>void <a name="drawImage-4"></a>QPainter::drawImage ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;i )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the image <em>i</em> into the rectangle <em>r</em>. The image will be
scaled to fit the rectangle if image and rectangle dimensions
differ.
<h3 class=fn>void <a name="drawLine"></a>QPainter::drawLine ( int&nbsp;x1, int&nbsp;y1, int&nbsp;x2, int&nbsp;y2 )
</h3>
Draws a line from (<em>x1</em>, <em>y1</em>) to (<em>x2</em>, <em>y2</em>) and sets the
current pen position to (<em>x2</em>, <em>y2</em>).
<p> <p>See also <a href="#pen">pen</a>().
<p>Examples: <a href="coordsys.html#x2272">aclock/aclock.cpp</a>, <a href="drawlines-example.html#x1655">drawlines/connect.cpp</a>, <a href="progress-example.html#x73">progress/progress.cpp</a>, <a href="splitter-example.html#x1297">splitter/splitter.cpp</a>, <a href="themes-example.html#x284">themes/metal.cpp</a>, and <a href="themes-example.html#x214">themes/wood.cpp</a>.
<h3 class=fn>void <a name="drawLine-2"></a>QPainter::drawLine ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p1, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p2 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws a line from point <em>p1</em> to point <em>p2</em>.
<h3 class=fn>void <a name="drawLineSegments"></a>QPainter::drawLineSegments ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;a, int&nbsp;index = 0, int&nbsp;nlines = -1 )
</h3>
Draws <em>nlines</em> separate lines from points defined in <em>a</em>,
starting at <em>a[index]</em> (<em>index</em> defaults to 0). If <em>nlines</em> is
-1 (the default) all points until the end of the array are used
(i.e. (a.size()-index)/2 lines are drawn).
<p> Draws the 1st line from <em>a[index]</em> to <em>a[index+1]</em>. Draws the
2nd line from <em>a[index+2]</em> to <em>a[index+3]</em> etc.
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
values are truncated. This limitation is expected to go away in
Qt 4.
<p> <p>See also <a href="#drawPolyline">drawPolyline</a>(), <a href="#drawPolygon">drawPolygon</a>(), and <a href="qpen.html">QPen</a>.
<h3 class=fn>void <a name="drawPicture"></a>QPainter::drawPicture ( int&nbsp;x, int&nbsp;y, const&nbsp;<a href="qpicture.html">QPicture</a>&nbsp;&amp;&nbsp;pic )
</h3>
Replays the picture <em>pic</em> translated by (<em>x</em>, <em>y</em>).
<p> This function does exactly the same as <a href="qpicture.html#play">QPicture::play</a>() when
called with (<em>x</em>, <em>y</em>) = (0, 0).
<p>Examples: <a href="picture-example.html#x113">picture/picture.cpp</a> and <a href="xform-example.html#x1234">xform/xform.cpp</a>.
<h3 class=fn>void <a name="drawPicture-2"></a>QPainter::drawPicture ( const&nbsp;<a href="qpicture.html">QPicture</a>&nbsp;&amp;&nbsp;pic )
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Use one of the other <a href="#drawPicture">QPainter::drawPicture</a>() functions with a (0, 0)
offset instead.
<h3 class=fn>void <a name="drawPicture-3"></a>QPainter::drawPicture ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p, const&nbsp;<a href="qpicture.html">QPicture</a>&nbsp;&amp;&nbsp;pic )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws picture <em>pic</em> at point <em>p</em>.
<h3 class=fn>void <a name="drawPie"></a>QPainter::drawPie ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;a, int&nbsp;alen )
</h3>
Draws a pie defined by the rectangle <em>(x, y, w, h)</em>, the start
angle <em>a</em> and the arc length <em>alen</em>.
<p> The pie is filled with the current <a href="#brush">brush</a>().
<p> The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
mean counter-clockwise while negative values mean the clockwise
direction. Zero degrees is at the 3 o'clock position.
<p> <p>See also <a href="#drawArc">drawArc</a>() and <a href="#drawChord">drawChord</a>().
<p>Examples: <a href="drawdemo-example.html#x1069">drawdemo/drawdemo.cpp</a>, <a href="grapher-nsplugin-example.html#x2757">grapher/grapher.cpp</a>, <a href="tutorial1-10.html#x2349">t10/cannon.cpp</a>, and <a href="tutorial1-09.html#x2340">t9/cannon.cpp</a>.
<h3 class=fn>void <a name="drawPie-2"></a>QPainter::drawPie ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, int&nbsp;a, int&nbsp;alen )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws a pie segment that fits inside the rectangle <em>r</em> with start
angle <em>a</em> and arc length <em>alen</em>.
<h3 class=fn>void <a name="drawPixmap"></a>QPainter::drawPixmap ( int&nbsp;x, int&nbsp;y, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, int&nbsp;sx = 0, int&nbsp;sy = 0, int&nbsp;sw = -1, int&nbsp;sh = -1 )
</h3>
Draws a pixmap at <em>(x, y)</em> by copying a part of <em>pixmap</em> into
the paint device.
<p> <em>(x, y)</em> specifies the top-left point in the paint device that is
to be drawn onto. <em>(sx, sy)</em> specifies the top-left point in <em>pixmap</em> that is to be drawn. The default is (0, 0).
<p> <em>(sw, sh)</em> specifies the size of the pixmap that is to be drawn.
The default, (-1, -1), means all the way to the bottom right of
the pixmap.
<p> Currently the mask of the pixmap or it's alpha channel are ignored
when painting on a <a href="qprinter.html">QPrinter</a>.
<p> <p>See also <a href="qimage.html#bitBlt">bitBlt</a>() and <a href="qpixmap.html#setMask">QPixmap::setMask</a>().
<p>Examples: <a href="grapher-nsplugin-example.html#x2758">grapher/grapher.cpp</a>, <a href="picture-example.html#x114">picture/picture.cpp</a>, <a href="qdir-example.html#x1832">qdir/qdir.cpp</a>, <a href="qmag-example.html#x1782">qmag/qmag.cpp</a>, <a href="showimg-example.html#x1337">showimg/showimg.cpp</a>, <a href="tutorial1-10.html#x2350">t10/cannon.cpp</a>, and <a href="xform-example.html#x1235">xform/xform.cpp</a>.
<h3 class=fn>void <a name="drawPixmap-2"></a>QPainter::drawPixmap ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pm, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;sr )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the rectangle <em>sr</em> of pixmap <em>pm</em> with its origin at point
<em>p</em>.
<h3 class=fn>void <a name="drawPixmap-3"></a>QPainter::drawPixmap ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pm )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the pixmap <em>pm</em> with its origin at point <em>p</em>.
<h3 class=fn>void <a name="drawPixmap-4"></a>QPainter::drawPixmap ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pm )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the pixmap <em>pm</em> into the rectangle <em>r</em>. The pixmap is
scaled to fit the rectangle, if image and rectangle size disagree.
<h3 class=fn>void <a name="drawPoint"></a>QPainter::drawPoint ( int&nbsp;x, int&nbsp;y )
</h3>
Draws/plots a single point at <em>(x, y)</em> using the current pen.
<p> <p>See also <a href="qpen.html">QPen</a>.
<p>Examples: <a href="desktop-example.html#x1734">desktop/desktop.cpp</a> and <a href="drawlines-example.html#x1656">drawlines/connect.cpp</a>.
<h3 class=fn>void <a name="drawPoint-2"></a>QPainter::drawPoint ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the point <em>p</em>.
<h3 class=fn>void <a name="drawPoints"></a>QPainter::drawPoints ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;a, int&nbsp;index = 0, int&nbsp;npoints = -1 )
</h3>
Draws/plots an array of points, <em>a</em>, using the current pen.
<p> If <em>index</em> is non-zero (the default is zero) only points from <em>index</em> are drawn. If <em>npoints</em> is negative (the default) the rest
of the points from <em>index</em> are drawn. If <em>npoints</em> is zero or
greater, <em>npoints</em> points are drawn.
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
values are truncated. This limitation is expected to go away in
Qt 4.
<h3 class=fn>void <a name="drawPolygon"></a>QPainter::drawPolygon ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;a, bool&nbsp;winding = FALSE, int&nbsp;index = 0, int&nbsp;npoints = -1 )
</h3>
Draws the polygon defined by the <em>npoints</em> points in <em>a</em>
starting at <em>a[index]</em>. (<em>index</em> defaults to 0.)
<p> If <em>npoints</em> is -1 (the default) all points until the end of the
array are used (i.e. a.size()-index line segments define the
polygon).
<p> The first point is always connected to the last point.
<p> The polygon is filled with the current <a href="#brush">brush</a>(). If <em>winding</em> is
TRUE, the polygon is filled using the winding fill algorithm. If
<em>winding</em> is FALSE, the polygon is filled using the even-odd
(alternative) fill algorithm.
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
values are truncated. This limitation is expected to go away in
Qt 4.
<p> <p>See also <a href="#drawLineSegments">drawLineSegments</a>(), <a href="#drawPolyline">drawPolyline</a>(), and <a href="qpen.html">QPen</a>.
<p>Examples: <a href="desktop-example.html#x1735">desktop/desktop.cpp</a> and <a href="picture-example.html#x115">picture/picture.cpp</a>.
<h3 class=fn>void <a name="drawPolyline"></a>QPainter::drawPolyline ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;a, int&nbsp;index = 0, int&nbsp;npoints = -1 )
</h3>
Draws the polyline defined by the <em>npoints</em> points in <em>a</em>
starting at <em>a[index]</em>. (<em>index</em> defaults to 0.)
<p> If <em>npoints</em> is -1 (the default) all points until the end of the
array are used (i.e. a.size()-index-1 line segments are drawn).
<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
values are truncated. This limitation is expected to go away in
Qt 4.
<p> <p>See also <a href="#drawLineSegments">drawLineSegments</a>(), <a href="#drawPolygon">drawPolygon</a>(), and <a href="qpen.html">QPen</a>.
<p>Examples: <a href="scribble-example.html#x917">scribble/scribble.cpp</a> and <a href="themes-example.html#x285">themes/metal.cpp</a>.
<h3 class=fn>void <a name="drawRect"></a>QPainter::drawRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
</h3>
Draws a rectangle with upper left corner at <em>(x, y)</em> and with
width <em>w</em> and height <em>h</em>.
<p> <p>See also <a href="qpen.html">QPen</a> and <a href="#drawRoundRect">drawRoundRect</a>().
<p>Examples: <a href="drawdemo-example.html#x1070">drawdemo/drawdemo.cpp</a>, <a href="picture-example.html#x116">picture/picture.cpp</a>, <a href="tutorial1-10.html#x2351">t10/cannon.cpp</a>, <a href="tutorial1-11.html#x2366">t11/cannon.cpp</a>, <a href="tutorial1-09.html#x2341">t9/cannon.cpp</a>, <a href="tooltip-example.html#x444">tooltip/tooltip.cpp</a>, and <a href="trivial-nsplugin-example.html#x2737">trivial/trivial.cpp</a>.
<h3 class=fn>void <a name="drawRect-2"></a>QPainter::drawRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the rectangle <em>r</em>.
<h3 class=fn>void <a name="drawRoundRect"></a>QPainter::drawRoundRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;xRnd = 25, int&nbsp;yRnd = 25 )
</h3>
Draws a rectangle with rounded corners at <em>(x, y)</em>, with width <em>w</em> and height <em>h</em>.
<p> The <em>xRnd</em> and <em>yRnd</em> arguments specify how rounded the corners
should be. 0 is angled corners, 99 is maximum roundedness.
<p> The width and height include all of the drawn lines.
<p> <p>See also <a href="#drawRect">drawRect</a>() and <a href="qpen.html">QPen</a>.
<p>Examples: <a href="drawdemo-example.html#x1071">drawdemo/drawdemo.cpp</a> and <a href="themes-example.html#x215">themes/wood.cpp</a>.
<h3 class=fn>void <a name="drawRoundRect-2"></a>QPainter::drawRoundRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, int&nbsp;xRnd = 25, int&nbsp;yRnd = 25 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws a rounded rectangle <em>r</em>, rounding to the x position <em>xRnd</em>
and the y position <em>yRnd</em> on each corner.
<h3 class=fn>void <a name="drawText"></a>QPainter::drawText ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;, int&nbsp;pos, int&nbsp;len, <a href="qpainter.html#TextDirection-enum">TextDirection</a>&nbsp;dir = Auto )
</h3>
<p> Draws the text from position <em>pos</em>, at point <em>p</em>. If <em>len</em> is
-1 the entire string is drawn, otherwise just the first <em>len</em>
characters. The text's direction is specified by <em>dir</em>.
<p> Note that the meaning of <em>y</em> is not the same for the two
<a href="#drawText">drawText</a>() varieties. For overloads that take a simple <em>x</em>, <em>y</em>
pair (or a point), the <em>y</em> value is the text's baseline; for
overloads that take a rectangle, <em>rect.y()</em> is the top of the
rectangle and the text is aligned within that rectangle in
accordance with the alignment flags.
<p> <p>See also <a href="#TextDirection-enum">QPainter::TextDirection</a>.
<p>Examples: <a href="desktop-example.html#x1736">desktop/desktop.cpp</a>, <a href="drawdemo-example.html#x1072">drawdemo/drawdemo.cpp</a>, <a href="grapher-nsplugin-example.html#x2760">grapher/grapher.cpp</a>, <a href="picture-example.html#x117">picture/picture.cpp</a>, <a href="progress-example.html#x74">progress/progress.cpp</a>, <a href="tutorial1-08.html#x2335">t8/cannon.cpp</a>, and <a href="trivial-nsplugin-example.html#x2738">trivial/trivial.cpp</a>.
<h3 class=fn>void <a name="drawText-2"></a>QPainter::drawText ( int&nbsp;x, int&nbsp;y, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;, int&nbsp;len = -1, <a href="qpainter.html#TextDirection-enum">TextDirection</a>&nbsp;dir = Auto )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the given text at position <em>x</em>, <em>y</em>. If <em>len</em> is -1 (the
default) all the text is drawn, otherwise the first <em>len</em>
characters are drawn. The text's direction is given by <em>dir</em>.
<p> <p>See also <a href="#TextDirection-enum">QPainter::TextDirection</a>.
<h3 class=fn>void <a name="drawText-3"></a>QPainter::drawText ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;, int&nbsp;len = -1, <a href="qpainter.html#TextDirection-enum">TextDirection</a>&nbsp;dir = Auto )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the text at the given point.
<p> <p>See also <a href="#TextDirection-enum">QPainter::TextDirection</a>.
<h3 class=fn>void <a name="drawText-4"></a>QPainter::drawText ( int&nbsp;x, int&nbsp;y, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;, int&nbsp;pos, int&nbsp;len, <a href="qpainter.html#TextDirection-enum">TextDirection</a>&nbsp;dir = Auto )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the text from position <em>pos</em>, at point <em>(x, y)</em>. If <em>len</em> is
-1 the entire string is drawn, otherwise just the first <em>len</em>
characters. The text's direction is specified by <em>dir</em>.
<h3 class=fn>void <a name="drawText-5"></a>QPainter::drawText ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;flags, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;, int&nbsp;len = -1, <a href="qrect.html">QRect</a>&nbsp;*&nbsp;br = 0, QTextParag&nbsp;**&nbsp;internal = 0 )
</h3>
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws the given text within the rectangle starting at <em>x</em>, <em>y</em>,
with width <em>w</em> and height <em>h</em>. If <em>len</em> is -1 (the default) all
the text is drawn, otherwise the first <em>len</em> characters are
drawn. The text's flags that are given in the <em>flags</em> parameter
are <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> and <a href="qt.html#TextFlags-enum">Qt::TextFlags</a> OR'd together. <em>br</em> (if not null) is set to the actual bounding rectangle of the
output. The <em>internal</em> parameter is for internal use only.
<h3 class=fn>void <a name="drawText-6"></a>QPainter::drawText ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, int&nbsp;tf, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str, int&nbsp;len = -1, <a href="qrect.html">QRect</a>&nbsp;*&nbsp;brect = 0, QTextParag&nbsp;**&nbsp;internal = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws at most <em>len</em> characters from <em>str</em> in the rectangle <em>r</em>.
<p> This function draws formatted text. The <em>tf</em> text format is
really of type <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> and <a href="qt.html#TextFlags-enum">Qt::TextFlags</a> OR'd
together.
<p> Horizontal alignment defaults to AlignAuto and vertical alignment
defaults to AlignTop.
<p> <em>brect</em> (if not null) is set to the actual bounding rectangle of
the output. <em>internal</em> is, yes, internal.
<p> <p>See also <a href="#boundingRect">boundingRect</a>().
<h3 class=fn>void <a name="drawTiledPixmap"></a>QPainter::drawTiledPixmap ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, int&nbsp;sx = 0, int&nbsp;sy = 0 )
</h3>
Draws a tiled <em>pixmap</em> in the specified rectangle.
<p> <em>(x, y)</em> specifies the top-left point in the paint device that is
to be drawn onto; with the width and height given by <em>w</em> and <em>h</em>. <em>(sx, sy)</em> specifies the top-left point in <em>pixmap</em> that is
to be drawn. The default is (0, 0).
<p> Calling <a href="#drawTiledPixmap">drawTiledPixmap</a>() is similar to calling <a href="#drawPixmap">drawPixmap</a>()
several times to fill (tile) an area with a pixmap, but is
potentially much more efficient depending on the underlying window
system.
<p> <p>See also <a href="#drawPixmap">drawPixmap</a>().
<h3 class=fn>void <a name="drawTiledPixmap-2"></a>QPainter::drawTiledPixmap ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pm, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;sp )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws a tiled pixmap, <em>pm</em>, inside rectangle <em>r</em> with its origin
at point <em>sp</em>.
<h3 class=fn>void <a name="drawTiledPixmap-3"></a>QPainter::drawTiledPixmap ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pm )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws a tiled pixmap, <em>pm</em>, inside rectangle <em>r</em>.
<h3 class=fn>void <a name="drawWinFocusRect"></a>QPainter::drawWinFocusRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;bgColor )
</h3>
Draws a Windows focus rectangle with upper left corner at (<em>x</em>,
<em>y</em>) and with width <em>w</em> and height <em>h</em> using a pen color that
contrasts with <em>bgColor</em>.
<p> This function draws a stippled rectangle (XOR is not used) that is
used to indicate <a href="focus.html#keyboard-focus">keyboard focus</a> (when the <a href="qapplication.html#style">QApplication::style</a>() is
<tt>WindowStyle</tt>).
<p> The pen color used to draw the rectangle is either white or black
depending on the color of <em>bgColor</em> (see QColor::gray()).
<p> <b>Warning:</b> This function draws nothing if the coordinate system has
been <a href="#rotate">rotated</a> or <a href="#shear">sheared</a>.
<p> <p>See also <a href="#drawRect">drawRect</a>() and <a href="qapplication.html#style">QApplication::style</a>().
<h3 class=fn>void <a name="drawWinFocusRect-2"></a>QPainter::drawWinFocusRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws a Windows focus rectangle with upper left corner at (<em>x</em>,
<em>y</em>) and with width <em>w</em> and height <em>h</em>.
<p> This function draws a stippled XOR rectangle that is used to
indicate <a href="focus.html#keyboard-focus">keyboard focus</a> (when <a href="qapplication.html#style">QApplication::style</a>() is <tt>WindowStyle</tt>).
<p> <b>Warning:</b> This function draws nothing if the coordinate system has
been <a href="#rotate">rotated</a> or <a href="#shear">sheared</a>.
<p> <p>See also <a href="#drawRect">drawRect</a>() and <a href="qapplication.html#style">QApplication::style</a>().
<h3 class=fn>void <a name="drawWinFocusRect-3"></a>QPainter::drawWinFocusRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws rectangle <em>r</em> as a window focus rectangle.
<h3 class=fn>void <a name="drawWinFocusRect-4"></a>QPainter::drawWinFocusRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;bgColor )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws rectangle <em>r</em> as a window focus rectangle using background
color <em>bgColor</em>.
<h3 class=fn>bool <a name="end"></a>QPainter::end ()
</h3>
Ends painting. Any resources used while painting are released.
<p> Note that while you mostly don't need to call <a href="#end">end</a>(), the
destructor will do it, there is at least one common case when it
is needed, namely double buffering.
<p> <pre>
QPainter p( myPixmap, this )
// ...
p.<a href="#end">end</a>(); // stops drawing on myPixmap
p.<a href="#begin">begin</a>( this );
p.<a href="#drawPixmap">drawPixmap</a>( 0, 0, myPixmap );
</pre>
<p> Since you can't draw a <a href="qpixmap.html">QPixmap</a> while it is being painted, it is
necessary to close the active painter.
<p> <p>See also <a href="#begin">begin</a>() and <a href="#isActive">isActive</a>().
<p>Examples: <a href="aclock-example.html#x1186">aclock/aclock.cpp</a>, <a href="desktop-example.html#x1737">desktop/desktop.cpp</a>, <a href="hello-example.html#x1635">hello/hello.cpp</a>, <a href="picture-example.html#x118">picture/picture.cpp</a>, <a href="scribble-example.html#x918">scribble/scribble.cpp</a>, <a href="tutorial1-10.html#x2352">t10/cannon.cpp</a>, and <a href="xform-example.html#x1238">xform/xform.cpp</a>.
<h3 class=fn>void <a name="eraseRect"></a>QPainter::eraseRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
</h3>
<p> Erases the area inside <em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>. Equivalent to
<tt>fillRect( x, y, w, h, backgroundColor() )</tt>.
<p>Examples: <a href="listboxcombo-example.html#x1414">listboxcombo/listboxcombo.cpp</a> and <a href="showimg-example.html#x1338">showimg/showimg.cpp</a>.
<h3 class=fn>void <a name="eraseRect-2"></a>QPainter::eraseRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Erases the area inside the rectangle <em>r</em>.
<h3 class=fn>void <a name="fillRect"></a>QPainter::fillRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;brush )
</h3>
Fills the rectangle <em>(x, y, w, h)</em> with the <em>brush</em>.
<p> You can specify a <a href="qcolor.html">QColor</a> as <em>brush</em>, since there is a <a href="qbrush.html">QBrush</a>
constructor that takes a QColor argument and creates a solid
pattern brush.
<p> <p>See also <a href="#drawRect">drawRect</a>().
<p>Examples: <a href="listboxcombo-example.html#x1415">listboxcombo/listboxcombo.cpp</a>, <a href="qaxserver-example-multiple.html#x2543">multiple/ax1.h</a>, <a href="progress-example.html#x75">progress/progress.cpp</a>, <a href="qdir-example.html#x1833">qdir/qdir.cpp</a>, <a href="qfd-example.html#x1998">qfd/fontdisplayer.cpp</a>, <a href="themes-example.html#x286">themes/metal.cpp</a>, and <a href="themes-example.html#x216">themes/wood.cpp</a>.
<h3 class=fn>void <a name="fillRect-2"></a>QPainter::fillRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;brush )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Fills the rectangle <em>r</em> using brush <em>brush</em>.
<h3 class=fn>void <a name="flush"></a>QPainter::flush ( const&nbsp;<a href="qregion.html">QRegion</a>&nbsp;&amp;&nbsp;region, <a href="qpainter.html#CoordinateMode-enum">CoordinateMode</a>&nbsp;cm = CoordDevice )
</h3>
Flushes any buffered drawing operations inside the region <em>region</em> using clipping mode <em>cm</em>.
<p> The flush may update the whole device if the platform does not
support flushing to a specified region.
<p> <p>See also <a href="#CoordinateMode-enum">CoordinateMode</a>.
<h3 class=fn>void <a name="flush-2"></a>QPainter::flush ()
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Flushes any buffered drawing operations.
<h3 class=fn>const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp; <a name="font"></a>QPainter::font () const
</h3>
<p> Returns the currently set painter font.
<p> <p>See also <a href="#setFont">setFont</a>() and <a href="qfont.html">QFont</a>.
<p>Example: <a href="fileiconview-example.html#x861">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn><a href="qfontinfo.html">QFontInfo</a> <a name="fontInfo"></a>QPainter::fontInfo () const
</h3>
Returns the font info for the painter, if the painter is active.
It is not possible to obtain font information for an inactive
painter, so the return value is undefined if the painter is not
active.
<p> <p>See also <a href="#fontMetrics">fontMetrics</a>() and <a href="#isActive">isActive</a>().
<h3 class=fn><a href="qfontmetrics.html">QFontMetrics</a> <a name="fontMetrics"></a>QPainter::fontMetrics () const
</h3>
Returns the font metrics for the painter, if the painter is
active. It is not possible to obtain metrics for an inactive
painter, so the return value is undefined if the painter is not
active.
<p> <p>See also <a href="#fontInfo">fontInfo</a>() and <a href="#isActive">isActive</a>().
<p>Examples: <a href="qaction-application-example.html#x1147">action/application.cpp</a>, <a href="simple-application-example.html#x1565">application/application.cpp</a>, <a href="desktop-example.html#x1738">desktop/desktop.cpp</a>, <a href="drawdemo-example.html#x1073">drawdemo/drawdemo.cpp</a>, <a href="helpviewer-example.html#x1001">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2046">mdi/application.cpp</a>, and <a href="qwerty-example.html#x384">qwerty/qwerty.cpp</a>.
<h3 class=fn>HDC <a name="handle"></a>QPainter::handle () const
</h3>
<p> Returns the platform-dependent handle used for drawing. Using this
function is not portable.
<h3 class=fn>bool <a name="hasClipping"></a>QPainter::hasClipping () const
</h3>
<p> Returns TRUE if clipping has been set; otherwise returns FALSE.
<p> <p>See also <a href="#setClipping">setClipping</a>().
<p>Example: <a href="themes-example.html#x217">themes/wood.cpp</a>.
<h3 class=fn>bool <a name="hasViewXForm"></a>QPainter::hasViewXForm () const
</h3>
<p> Returns TRUE if view transformation is enabled; otherwise returns
FALSE.
<p> <p>See also <a href="#setViewXForm">setViewXForm</a>() and <a href="#xForm">xForm</a>().
<h3 class=fn>bool <a name="hasWorldXForm"></a>QPainter::hasWorldXForm () const
</h3>
<p> Returns TRUE if world transformation is enabled; otherwise returns
FALSE.
<p> <p>See also <a href="#setWorldXForm">setWorldXForm</a>().
<h3 class=fn>bool <a name="isActive"></a>QPainter::isActive () const
</h3>
<p> Returns TRUE if the painter is active painting, i.e. <a href="#begin">begin</a>() has
been called and <a href="#end">end</a>() has not yet been called; otherwise returns
FALSE.
<p> <p>See also <a href="qpaintdevice.html#paintingActive">QPaintDevice::paintingActive</a>().
<p>Examples: <a href="desktop-example.html#x1739">desktop/desktop.cpp</a> and <a href="helpviewer-example.html#x1002">helpviewer/helpwindow.cpp</a>.
<h3 class=fn>void <a name="lineTo"></a>QPainter::lineTo ( int&nbsp;x, int&nbsp;y )
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Use <a href="#drawLine">drawLine</a>() instead.
<p> Draws a line from the current pen position to <em>(x, y)</em> and sets
<em>(x, y)</em> to be the new current pen position.
<p> <p>See also <a href="qpen.html">QPen</a>, <a href="#moveTo">moveTo</a>(), <a href="#drawLine">drawLine</a>(), and <a href="#pos">pos</a>().
<h3 class=fn>void <a name="lineTo-2"></a>QPainter::lineTo ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Draws a line to the point <em>p</em>.
<h3 class=fn>void <a name="moveTo"></a>QPainter::moveTo ( int&nbsp;x, int&nbsp;y )
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Sets the current pen position to <em>(x, y)</em>
<p> <p>See also <a href="#lineTo">lineTo</a>() and <a href="#pos">pos</a>().
<h3 class=fn>void <a name="moveTo-2"></a>QPainter::moveTo ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Moves to the point <em>p</em>.
<h3 class=fn>const&nbsp;<a href="qpen.html">QPen</a>&nbsp;&amp; <a name="pen"></a>QPainter::pen () const
</h3>
<p> Returns the painter's current pen.
<p> <p>See also <a href="#setPen">setPen</a>().
<p>Examples: <a href="qaxserver-example-multiple.html#x2546">multiple/ax2.h</a>, <a href="progress-example.html#x76">progress/progress.cpp</a>, and <a href="themes-example.html#x218">themes/wood.cpp</a>.
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="pos"></a>QPainter::pos () const
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Returns the current position of the pen.
<p> <p>See also <a href="#moveTo">moveTo</a>().
<h3 class=fn><a href="qt.html#RasterOp-enum">RasterOp</a> <a name="rasterOp"></a>QPainter::rasterOp () const
</h3>
<p> Returns the current <a href="qt.html#RasterOp-enum">raster operation</a>.
<p> <p>See also <a href="#setRasterOp">setRasterOp</a>() and <a href="qt.html#RasterOp-enum">RasterOp</a>.
<h3 class=fn>void <a name="redirect"></a>QPainter::redirect ( <a href="qpaintdevice.html">QPaintDevice</a>&nbsp;*&nbsp;pdev, <a href="qpaintdevice.html">QPaintDevice</a>&nbsp;*&nbsp;replacement )<tt> [static]</tt>
</h3>
Redirects all paint commands for a paint device, <em>pdev</em>, to
another paint device, <em>replacement</em>, unless <em>replacement</em> is 0.
If <em>replacement</em> is 0, the redirection for <em>pdev</em> is removed.
<p> In general, you'll probably find calling <a href="qpixmap.html#grabWidget">QPixmap::grabWidget</a>() or
<a href="qpixmap.html#grabWindow">QPixmap::grabWindow</a>() is an easier solution.
<h3 class=fn>void <a name="resetXForm"></a>QPainter::resetXForm ()
</h3>
Resets any transformations that were made using <a href="#translate">translate</a>(), <a href="#scale">scale</a>(),
<a href="#shear">shear</a>(), <a href="#rotate">rotate</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), <a href="#setViewport">setViewport</a>() and
<a href="#setWindow">setWindow</a>().
<p> <p>See also <a href="#worldMatrix">worldMatrix</a>(), <a href="#viewport">viewport</a>(), and <a href="#window">window</a>().
<h3 class=fn>void <a name="restore"></a>QPainter::restore ()
</h3>
Restores the current painter state (pops a saved state off the
stack).
<p> <p>See also <a href="#save">save</a>().
<p>Example: <a href="coordsys.html#x2273">aclock/aclock.cpp</a>.
<h3 class=fn>void <a name="restoreWorldMatrix"></a>QPainter::restoreWorldMatrix ()
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> We recommend using <a href="#restore">restore</a>() instead.
<h3 class=fn>void <a name="rotate"></a>QPainter::rotate ( double&nbsp;a )
</h3>
Rotates the coordinate system <em>a</em> degrees counterclockwise.
<p> <p>See also <a href="#translate">translate</a>(), <a href="#scale">scale</a>(), <a href="#shear">shear</a>(), <a href="#resetXForm">resetXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#xForm">xForm</a>().
<p>Examples: <a href="coordsys.html#x2274">aclock/aclock.cpp</a>, <a href="tutorial1-10.html#x2353">t10/cannon.cpp</a>, and <a href="tutorial1-09.html#x2342">t9/cannon.cpp</a>.
<h3 class=fn>void <a name="save"></a>QPainter::save ()
</h3>
Saves the current painter state (pushes the state onto a stack). A
<a href="#save">save</a>() must be followed by a corresponding <a href="#restore">restore</a>(). <a href="#end">end</a>()
unwinds the stack.
<p> <p>See also <a href="#restore">restore</a>().
<p>Example: <a href="coordsys.html#x2275">aclock/aclock.cpp</a>.
<h3 class=fn>void <a name="saveWorldMatrix"></a>QPainter::saveWorldMatrix ()
</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> We recommend using <a href="#save">save</a>() instead.
<h3 class=fn>void <a name="scale"></a>QPainter::scale ( double&nbsp;sx, double&nbsp;sy )
</h3>
Scales the coordinate system by <em>(sx, sy)</em>.
<p> <p>See also <a href="#translate">translate</a>(), <a href="#shear">shear</a>(), <a href="#rotate">rotate</a>(), <a href="#resetXForm">resetXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#xForm">xForm</a>().
<p>Example: <a href="xform-example.html#x1239">xform/xform.cpp</a>.
<h3 class=fn>void <a name="setBackgroundColor"></a>QPainter::setBackgroundColor ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;c )
</h3>
Sets the background color of the painter to <em>c</em>.
<p> The background color is the color that is filled in when drawing
opaque text, stippled lines and bitmaps. The background color has
no effect in transparent background mode (which is the default).
<p> <p>See also <a href="#backgroundColor">backgroundColor</a>(), <a href="#setBackgroundMode">setBackgroundMode</a>(), and <a href="qt.html#BackgroundMode-enum">BackgroundMode</a>.
<h3 class=fn>void <a name="setBackgroundMode"></a>QPainter::setBackgroundMode ( <a href="qt.html#BGMode-enum">BGMode</a>&nbsp;m )
</h3>
Sets the background mode of the painter to <em>m</em>, which must be
either <a href="qt.html#BGMode-enum">TransparentMode</a> (the default) or <a href="qt.html#BGMode-enum">OpaqueMode</a>.
<p> Transparent mode draws stippled lines and text without setting the
background pixels. Opaque mode fills these space with the current
background color.
<p> Note that in order to draw a bitmap or pixmap transparently, you
must use <a href="qpixmap.html#setMask">QPixmap::setMask</a>().
<p> <p>See also <a href="#backgroundMode">backgroundMode</a>() and <a href="#setBackgroundColor">setBackgroundColor</a>().
<p>Example: <a href="picture-example.html#x119">picture/picture.cpp</a>.
<h3 class=fn>void <a name="setBrush"></a>QPainter::setBrush ( <a href="qt.html#BrushStyle-enum">BrushStyle</a>&nbsp;style )
</h3>
Sets the painter's brush to black color and the specified <em>style</em>.
<p> <p>See also <a href="#brush">brush</a>() and <a href="qbrush.html">QBrush</a>.
<p>Examples: <a href="aclock-example.html#x1190">aclock/aclock.cpp</a>, <a href="drawdemo-example.html#x1074">drawdemo/drawdemo.cpp</a>, <a href="picture-example.html#x120">picture/picture.cpp</a>, <a href="tutorial1-10.html#x2354">t10/cannon.cpp</a>, <a href="tutorial1-09.html#x2343">t9/cannon.cpp</a>, <a href="themes-example.html#x219">themes/wood.cpp</a>, and <a href="tooltip-example.html#x445">tooltip/tooltip.cpp</a>.
<h3 class=fn>void <a name="setBrush-2"></a>QPainter::setBrush ( const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;brush )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the painter's brush to <em>brush</em>.
<p> The <em>brush</em> defines how shapes are filled.
<p> <p>See also <a href="#brush">brush</a>().
<h3 class=fn>void <a name="setBrush-3"></a>QPainter::setBrush ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;color )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the painter's brush to have style <a href="qt.html#BrushStyle-enum">SolidPattern</a> and the
specified <em>color</em>.
<p> <p>See also <a href="#brush">brush</a>() and <a href="qbrush.html">QBrush</a>.
<h3 class=fn>void <a name="setBrushOrigin"></a>QPainter::setBrushOrigin ( int&nbsp;x, int&nbsp;y )
</h3>
Sets the brush origin to <em>(x, y)</em>.
<p> The brush origin specifies the (0, 0) coordinate of the painter's
brush. This setting only applies to pattern brushes and pixmap
brushes.
<p> <p>See also <a href="#brushOrigin">brushOrigin</a>().
<h3 class=fn>void <a name="setBrushOrigin-2"></a>QPainter::setBrushOrigin ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the brush origin to point <em>p</em>.
<h3 class=fn>void <a name="setClipRect"></a>QPainter::setClipRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, <a href="qpainter.html#CoordinateMode-enum">CoordinateMode</a>&nbsp;m = CoordDevice )
</h3>
<p> Sets the clip region to the rectangle <em>x</em>, <em>y</em>, <em>w</em>, <em>h</em> and
enables clipping. The clip mode is set to <em>m</em>.
<p> If <em>m</em> is <a href="#CoordinateMode-enum">CoordDevice</a> (the default), the coordinates given for
the clip region are taken to be physical device coordinates and
are <em>not</em> subject to any <a href="coordsys.html">coordinate
transformations</a>. If <em>m</em> is <a href="#CoordinateMode-enum">CoordPainter</a>, the
coordinates given for the clip region are taken to be model
coordinates.
<p> <p>See also <a href="#setClipRegion">setClipRegion</a>(), <a href="#clipRegion">clipRegion</a>(), <a href="#setClipping">setClipping</a>(), and <a href="#CoordinateMode-enum">QPainter::CoordinateMode</a>.
<p>Examples: <a href="grapher-nsplugin-example.html#x2762">grapher/grapher.cpp</a>, <a href="progress-example.html#x77">progress/progress.cpp</a>, <a href="showimg-example.html#x1339">showimg/showimg.cpp</a>, <a href="splitter-example.html#x1298">splitter/splitter.cpp</a>, and <a href="trivial-nsplugin-example.html#x2739">trivial/trivial.cpp</a>.
<h3 class=fn>void <a name="setClipRect-2"></a>QPainter::setClipRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r, <a href="qpainter.html#CoordinateMode-enum">CoordinateMode</a>&nbsp;m = CoordDevice )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the clip region to the rectangle <em>r</em> and enables clipping.
The clip mode is set to <em>m</em>.
<p> <p>See also <a href="#CoordinateMode-enum">CoordinateMode</a>.
<h3 class=fn>void <a name="setClipRegion"></a>QPainter::setClipRegion ( const&nbsp;<a href="qregion.html">QRegion</a>&nbsp;&amp;&nbsp;rgn, <a href="qpainter.html#CoordinateMode-enum">CoordinateMode</a>&nbsp;m = CoordDevice )
</h3>
Sets the clip region to <em>rgn</em> and enables clipping. The clip mode
is set to <em>m</em>.
<p> Note that the clip region is given in physical device coordinates
and <em>not</em> subject to any <a href="coordsys.html">coordinate
transformation.</a>
<p> <p>See also <a href="#setClipRect">setClipRect</a>(), <a href="#clipRegion">clipRegion</a>(), <a href="#setClipping">setClipping</a>(), and <a href="#CoordinateMode-enum">CoordinateMode</a>.
<p>Examples: <a href="qfd-example.html#x1999">qfd/fontdisplayer.cpp</a> and <a href="themes-example.html#x220">themes/wood.cpp</a>.
<h3 class=fn>void <a name="setClipping"></a>QPainter::setClipping ( bool&nbsp;enable )
</h3>
Enables clipping if <em>enable</em> is TRUE, or disables clipping if <em>enable</em> is FALSE.
<p> <p>See also <a href="#hasClipping">hasClipping</a>(), <a href="#setClipRect">setClipRect</a>(), and <a href="#setClipRegion">setClipRegion</a>().
<p>Example: <a href="themes-example.html#x221">themes/wood.cpp</a>.
<h3 class=fn>void <a name="setFont"></a>QPainter::setFont ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )
</h3>
Sets the painter's font to <em>font</em>.
<p> This font is used by subsequent <a href="#drawText">drawText</a>() functions. The text
color is the same as the pen color.
<p> <p>See also <a href="#font">font</a>() and <a href="#drawText">drawText</a>().
<p>Examples: <a href="drawdemo-example.html#x1075">drawdemo/drawdemo.cpp</a>, <a href="grapher-nsplugin-example.html#x2763">grapher/grapher.cpp</a>, <a href="hello-example.html#x1636">hello/hello.cpp</a>, <a href="picture-example.html#x121">picture/picture.cpp</a>, <a href="qwerty-example.html#x385">qwerty/qwerty.cpp</a>, <a href="tutorial1-13.html#x2403">t13/cannon.cpp</a>, and <a href="xform-example.html#x1240">xform/xform.cpp</a>.
<h3 class=fn>void <a name="setPen"></a>QPainter::setPen ( const&nbsp;<a href="qpen.html">QPen</a>&nbsp;&amp;&nbsp;pen )
</h3>
Sets a new painter pen.
<p> The <em>pen</em> defines how to draw lines and outlines, and it also
defines the text color.
<p> <p>See also <a href="#pen">pen</a>().
<p>Examples: <a href="desktop-example.html#x1741">desktop/desktop.cpp</a>, <a href="drawdemo-example.html#x1076">drawdemo/drawdemo.cpp</a>, <a href="qaxserver-example-multiple.html#x2547">multiple/ax2.h</a>, <a href="progress-example.html#x78">progress/progress.cpp</a>, <a href="tutorial1-09.html#x2344">t9/cannon.cpp</a>, <a href="themes-example.html#x288">themes/metal.cpp</a>, and <a href="themes-example.html#x222">themes/wood.cpp</a>.
<h3 class=fn>void <a name="setPen-2"></a>QPainter::setPen ( <a href="qt.html#PenStyle-enum">PenStyle</a>&nbsp;style )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the painter's pen to have style <em>style</em>, width 0 and black
color.
<p> <p>See also <a href="#pen">pen</a>() and <a href="qpen.html">QPen</a>.
<h3 class=fn>void <a name="setPen-3"></a>QPainter::setPen ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;color )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the painter's pen to have style <a href="qt.html#PenStyle-enum">SolidLine</a>, width 0 and the
specified <em>color</em>.
<p> <p>See also <a href="#pen">pen</a>() and <a href="qpen.html">QPen</a>.
<h3 class=fn>void <a name="setRasterOp"></a>QPainter::setRasterOp ( <a href="qt.html#RasterOp-enum">RasterOp</a>&nbsp;r )
</h3>
Sets the <a href="qt.html#RasterOp-enum">raster operation</a> to <em>r</em>.
The default is <a href="qt.html#RasterOp-enum">CopyROP</a>.
<p> <p>See also <a href="#rasterOp">rasterOp</a>() and <a href="qt.html#RasterOp-enum">Qt::RasterOp</a>.
<h3 class=fn>void <a name="setTabArray"></a>QPainter::setTabArray ( int&nbsp;*&nbsp;ta )
</h3>
Sets the tab stop array to <em>ta</em>. This puts tab stops at <em>ta[0]</em>,
<em>ta[1]</em> and so on. The array is null-terminated.
<p> If both a tab array and a tab top size is set, the tab array wins.
<p> <p>See also <a href="#tabArray">tabArray</a>(), <a href="#setTabStops">setTabStops</a>(), <a href="#drawText">drawText</a>(), and <a href="#fontMetrics">fontMetrics</a>().
<h3 class=fn>void <a name="setTabStops"></a>QPainter::setTabStops ( int&nbsp;ts )
</h3>
Set the tab stop width to <em>ts</em>, i.e. locates tab stops at <em>ts</em>,
2*<em>ts</em>, 3*<em>ts</em> and so on.
<p> Tab stops are used when drawing formatted text with <a href="qt.html#TextFlags-enum">ExpandTabs</a>
set. This fixed tab stop value is used only if no tab array is set
(which is the default case).
<p> A value of 0 (the default) implies a tabstop setting of 8 times the width of the
character 'x' in the font currently set on the painter.
<p> <p>See also <a href="#tabStops">tabStops</a>(), <a href="#setTabArray">setTabArray</a>(), <a href="#drawText">drawText</a>(), and <a href="#fontMetrics">fontMetrics</a>().
<h3 class=fn>void <a name="setViewXForm"></a>QPainter::setViewXForm ( bool&nbsp;enable )
</h3>
Enables view transformations if <em>enable</em> is TRUE, or disables
view transformations if <em>enable</em> is FALSE.
<p> <p>See also <a href="#hasViewXForm">hasViewXForm</a>(), <a href="#setWindow">setWindow</a>(), <a href="#setViewport">setViewport</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), <a href="#setWorldXForm">setWorldXForm</a>(), and <a href="#xForm">xForm</a>().
<h3 class=fn>void <a name="setViewport"></a>QPainter::setViewport ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
</h3>
Sets the viewport rectangle view transformation for the painter
and enables view transformation.
<p> The viewport rectangle is part of the view transformation. The
viewport specifies the device coordinate system and is specified
by the <em>x</em>, <em>y</em>, <em>w</em> width and <em>h</em> height parameters. Its
sister, the <a href="#window">window</a>(), specifies the logical coordinate system.
<p> The default viewport rectangle is the same as the device's
rectangle. See the <a href="coordsys.html">Coordinate System Overview</a> for an overview of coordinate transformation.
<p> <p>See also <a href="#viewport">viewport</a>(), <a href="#setWindow">setWindow</a>(), <a href="#setViewXForm">setViewXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), <a href="#setWorldXForm">setWorldXForm</a>(), and <a href="#xForm">xForm</a>().
<p>Example: <a href="coordsys.html#x2276">aclock/aclock.cpp</a>.
<h3 class=fn>void <a name="setViewport-2"></a>QPainter::setViewport ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the painter's viewport to rectangle <em>r</em>.
<h3 class=fn>void <a name="setWindow"></a>QPainter::setWindow ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
</h3>
Sets the window rectangle view transformation for the painter and
enables view transformation.
<p> The window rectangle is part of the view transformation. The
window specifies the logical coordinate system and is specified by
the <em>x</em>, <em>y</em>, <em>w</em> width and <em>h</em> height parameters. Its sister,
the <a href="#viewport">viewport</a>(), specifies the device coordinate system.
<p> The default window rectangle is the same as the device's
rectangle. See the <a href="coordsys.html">Coordinate System Overview</a> for an overview of coordinate transformation.
<p> <p>See also <a href="#window">window</a>(), <a href="#setViewport">setViewport</a>(), <a href="#setViewXForm">setViewXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#setWorldXForm">setWorldXForm</a>().
<p>Examples: <a href="coordsys.html#x2277">aclock/aclock.cpp</a> and <a href="drawdemo-example.html#x1077">drawdemo/drawdemo.cpp</a>.
<h3 class=fn>void <a name="setWindow-2"></a>QPainter::setWindow ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the painter's window to rectangle <em>r</em>.
<h3 class=fn>void <a name="setWorldMatrix"></a>QPainter::setWorldMatrix ( const&nbsp;<a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp;&nbsp;m, bool&nbsp;combine = FALSE )
</h3>
Sets the world <a href="qwmatrix.html#TransformationMode">transformation matrix</a> to <em>m</em> and enables world
transformation.
<p> If <em>combine</em> is TRUE, then <em>m</em> is combined with the current
transformation matrix, otherwise <em>m</em> replaces the current
transformation matrix.
<p> If <em>m</em> is the identity matrix and <em>combine</em> is FALSE, this
function calls <a href="#setWorldXForm">setWorldXForm</a>(FALSE). (The identity matrix is the
matrix where <a href="qwmatrix.html#m11">QWMatrix::m11</a>() and <a href="qwmatrix.html#m22">QWMatrix::m22</a>() are 1.0 and the
rest are 0.0.)
<p> World transformations are applied after the view transformations
(i.e. <a href="#setWindow">window</a> and <a href="#setViewport">viewport</a>).
<p> The following functions can transform the coordinate system without using
a QWMatrix:
<ul>
<li> <a href="#translate">translate</a>()
<li> <a href="#scale">scale</a>()
<li> <a href="#shear">shear</a>()
<li> <a href="#rotate">rotate</a>()
</ul>
<p> They operate on the painter's <a href="#worldMatrix">worldMatrix</a>() and are implemented like this:
<p> <pre>
void QPainter::rotate( double a )
{
<a href="qwmatrix.html">QWMatrix</a> m;
m.<a href="qwmatrix.html#rotate">rotate</a>( a );
<a href="#setWorldMatrix">setWorldMatrix</a>( m, TRUE );
}
</pre>
<p> Note that you should always use <em>combine</em> when you are drawing
into a <a href="qpicture.html">QPicture</a>. Otherwise it may not be possible to replay the
picture with additional transformations. Using translate(),
scale(), etc., is safe.
<p> For a brief overview of coordinate transformation, see the <a href="coordsys.html">Coordinate System Overview.</a>
<p> <p>See also <a href="#worldMatrix">worldMatrix</a>(), <a href="#setWorldXForm">setWorldXForm</a>(), <a href="#setWindow">setWindow</a>(), <a href="#setViewport">setViewport</a>(), <a href="#setViewXForm">setViewXForm</a>(), <a href="#xForm">xForm</a>(), and <a href="qwmatrix.html">QWMatrix</a>.
<p>Examples: <a href="drawdemo-example.html#x1078">drawdemo/drawdemo.cpp</a> and <a href="xform-example.html#x1242">xform/xform.cpp</a>.
<h3 class=fn>void <a name="setWorldXForm"></a>QPainter::setWorldXForm ( bool&nbsp;enable )
</h3>
Enables world transformations if <em>enable</em> is TRUE, or disables
world transformations if <em>enable</em> is FALSE. The world
<a href="qwmatrix.html#TransformationMode">transformation matrix</a> is not changed.
<p> <p>See also <a href="#setWorldMatrix">setWorldMatrix</a>(), <a href="#setWindow">setWindow</a>(), <a href="#setViewport">setViewport</a>(), <a href="#setViewXForm">setViewXForm</a>(), and <a href="#xForm">xForm</a>().
<h3 class=fn>void <a name="shear"></a>QPainter::shear ( double&nbsp;sh, double&nbsp;sv )
</h3>
Shears the coordinate system by <em>(sh, sv)</em>.
<p> <p>See also <a href="#translate">translate</a>(), <a href="#scale">scale</a>(), <a href="#rotate">rotate</a>(), <a href="#resetXForm">resetXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#xForm">xForm</a>().
<h3 class=fn>int * <a name="tabArray"></a>QPainter::tabArray () const
</h3>
<p> Returns the currently set tab stop array.
<p> <p>See also <a href="#setTabArray">setTabArray</a>().
<h3 class=fn>int <a name="tabStops"></a>QPainter::tabStops () const
</h3>
<p> Returns the tab stop setting.
<p> <p>See also <a href="#setTabStops">setTabStops</a>().
<h3 class=fn>void <a name="translate"></a>QPainter::translate ( double&nbsp;dx, double&nbsp;dy )
</h3>
Translates the coordinate system by <em>(dx, dy)</em>. After this call,
<em>(dx, dy)</em> is added to points.
<p> For example, the following code draws the same point twice:
<pre>
void MyWidget::paintEvent()
{
QPainter paint( this );
paint.<a href="#drawPoint">drawPoint</a>( 0, 0 );
paint.<a href="#translate">translate</a>( 100.0, 40.0 );
paint.<a href="#drawPoint">drawPoint</a>( -100, -40 );
}
</pre>
<p> <p>See also <a href="#scale">scale</a>(), <a href="#shear">shear</a>(), <a href="#rotate">rotate</a>(), <a href="#resetXForm">resetXForm</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), and <a href="#xForm">xForm</a>().
<p>Examples: <a href="qaction-application-example.html#x1148">action/application.cpp</a>, <a href="simple-application-example.html#x1566">application/application.cpp</a>, <a href="tutorial1-10.html#x2356">t10/cannon.cpp</a>, <a href="tutorial1-09.html#x2345">t9/cannon.cpp</a>, <a href="themes-example.html#x289">themes/metal.cpp</a>, <a href="themes-example.html#x223">themes/wood.cpp</a>, and <a href="xform-example.html#x1243">xform/xform.cpp</a>.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="viewport"></a>QPainter::viewport () const
</h3>
Returns the viewport rectangle.
<p> <p>See also <a href="#setViewport">setViewport</a>() and <a href="#setViewXForm">setViewXForm</a>().
<p>Example: <a href="coordsys.html#x2278">aclock/aclock.cpp</a>.
<h3 class=fn><a href="qrect.html">QRect</a> <a name="window"></a>QPainter::window () const
</h3>
Returns the window rectangle.
<p> <p>See also <a href="#setWindow">setWindow</a>() and <a href="#setViewXForm">setViewXForm</a>().
<h3 class=fn>const&nbsp;<a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp; <a name="worldMatrix"></a>QPainter::worldMatrix () const
</h3>
Returns the world <a href="qwmatrix.html#TransformationMode">transformation matrix</a>.
<p> <p>See also <a href="#setWorldMatrix">setWorldMatrix</a>().
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="xForm"></a>QPainter::xForm ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pv ) const
</h3>
Returns the point <em>pv</em> transformed from model coordinates to
device coordinates.
<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
<h3 class=fn><a href="qrect.html">QRect</a> <a name="xForm-2"></a>QPainter::xForm ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;rv ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the rectangle <em>rv</em> transformed from model coordinates to
device coordinates.
<p> If world transformation is enabled and rotation or shearing has
been specified, then the bounding rectangle is returned.
<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
<h3 class=fn><a href="qpointarray.html">QPointArray</a> <a name="xForm-3"></a>QPainter::xForm ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;av ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the point array <em>av</em> transformed from model coordinates
to device coordinates.
<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
<h3 class=fn><a href="qpointarray.html">QPointArray</a> <a name="xForm-4"></a>QPainter::xForm ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;av, int&nbsp;index, int&nbsp;npoints ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the point array <em>av</em> transformed from model coordinates
to device coordinates. The <em>index</em> is the first point in the
array and <em>npoints</em> denotes the number of points to be
transformed. If <em>npoints</em> is negative, all points from <em>av[index]</em> until the last point in the array are transformed.
<p> The returned point array consists of the number of points that
were transformed.
<p> Example:
<pre>
<a href="qpointarray.html">QPointArray</a> a(10);
<a href="qpointarray.html">QPointArray</a> b;
b = painter.xForm(a, 2, 4); // b.<a href="qmemarray.html#size">size</a>() == 4
b = painter.xForm(a, 2, -1); // b.<a href="qmemarray.html#size">size</a>() == 8
</pre>
<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
<h3 class=fn><a href="qrect.html">QRect</a> <a name="xFormDev"></a>QPainter::xFormDev ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;rd ) const
</h3>
Returns the rectangle <em>rd</em> transformed from device coordinates to
model coordinates.
<p> If world transformation is enabled and rotation or shearing is
used, then the bounding rectangle is returned.
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="xFormDev-2"></a>QPainter::xFormDev ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pd ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the point <em>pd</em> transformed from device coordinates to
model coordinates.
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
<h3 class=fn><a href="qpointarray.html">QPointArray</a> <a name="xFormDev-3"></a>QPainter::xFormDev ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;ad ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the point array <em>ad</em> transformed from device coordinates
to model coordinates.
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
<h3 class=fn><a href="qpointarray.html">QPointArray</a> <a name="xFormDev-4"></a>QPainter::xFormDev ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;ad, int&nbsp;index, int&nbsp;npoints ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the point array <em>ad</em> transformed from device coordinates
to model coordinates. The <em>index</em> is the first point in the array
and <em>npoints</em> denotes the number of points to be transformed. If
<em>npoints</em> is negative, all points from <em>ad[index]</em> until the
last point in the array are transformed.
<p> The returned point array consists of the number of points that
were transformed.
<p> Example:
<pre>
<a href="qpointarray.html">QPointArray</a> a(10);
<a href="qpointarray.html">QPointArray</a> b;
b = painter.xFormDev(a, 1, 3); // b.<a href="qmemarray.html#size">size</a>() == 3
b = painter.xFormDev(a, 1, -1); // b.<a href="qmemarray.html#size">size</a>() == 9
</pre>
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
<hr><h2>Related Functions</h2>
<h3 class=fn>void <a name="qDrawPlainRect"></a>qDrawPlainRect ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;c, int&nbsp;lineWidth, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;*&nbsp;fill )
</h3>
<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
<p> Draws the plain rectangle specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>)
using the painter <em>p</em>.
<p> The color argument <em>c</em> specifies the line color.
<p> The <em>lineWidth</em> argument specifies the line width.
<p> The rectangle's interior is filled with the <em>fill</em> brush unless
<em>fill</em> is 0.
<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
display a plain rectangle, for example <tt>QFrame::setFrameStyle( QFrame::Box | QFrame::Plain )</tt>.
<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p> <p>See also <a href="#qDrawShadeRect">qDrawShadeRect</a>() and <a href="qstyle.html#drawPrimitive">QStyle::drawPrimitive</a>().
<h3 class=fn>void <a name="qDrawShadeLine"></a>qDrawShadeLine ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;x1, int&nbsp;y1, int&nbsp;x2, int&nbsp;y2, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, int&nbsp;lineWidth, int&nbsp;midLineWidth )
</h3>
<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
<p> Draws a horizontal (<em>y1</em> == <em>y2</em>) or vertical (<em>x1</em> == <em>x2</em>)
shaded line using the painter <em>p</em>.
<p> Nothing is drawn if <em>y1</em> != <em>y2</em> and <em>x1</em> != <em>x2</em> (i.e. the
line is neither horizontal nor vertical).
<p> The color group argument <em>g</em> specifies the shading colors (<a href="qcolorgroup.html#light">light</a>, <a href="qcolorgroup.html#dark">dark</a> and <a href="qcolorgroup.html#mid">middle</a> colors).
<p> The line appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
<p> The <em>lineWidth</em> argument specifies the line width for each of the
lines. It is not the total line width.
<p> The <em>midLineWidth</em> argument specifies the width of a middle line
drawn in the <a href="qcolorgroup.html#mid">QColorGroup::mid</a>() color.
<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
display a shaded line, for example <tt>QFrame::setFrameStyle( QFrame::HLine | QFrame::Sunken )</tt>.
<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p> <p>See also <a href="#qDrawShadeRect">qDrawShadeRect</a>(), <a href="#qDrawShadePanel">qDrawShadePanel</a>(), and <a href="qstyle.html#drawPrimitive">QStyle::drawPrimitive</a>().
<h3 class=fn>void <a name="qDrawShadePanel"></a>qDrawShadePanel ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, int&nbsp;lineWidth, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;*&nbsp;fill )
</h3>
<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
<p> Draws the shaded panel specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>) using
the painter <em>p</em>.
<p> The color group argument <em>g</em> specifies the shading colors (<a href="qcolorgroup.html#light">light</a>, <a href="qcolorgroup.html#dark">dark</a> and <a href="qcolorgroup.html#mid">middle</a> colors).
<p> The panel appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
<p> The <em>lineWidth</em> argument specifies the line width.
<p> The panel's interior is filled with the <em>fill</em> brush unless <em>fill</em> is 0.
<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
display a shaded panel, for example <tt>QFrame::setFrameStyle( QFrame::Panel | QFrame::Sunken )</tt>.
<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p> <p>See also <a href="#qDrawWinPanel">qDrawWinPanel</a>(), <a href="#qDrawShadeLine">qDrawShadeLine</a>(), <a href="#qDrawShadeRect">qDrawShadeRect</a>(), and <a href="qstyle.html#drawPrimitive">QStyle::drawPrimitive</a>().
<h3 class=fn>void <a name="qDrawShadeRect"></a>qDrawShadeRect ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, int&nbsp;lineWidth, int&nbsp;midLineWidth, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;*&nbsp;fill )
</h3>
<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
<p> Draws the shaded rectangle specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>)
using the painter <em>p</em>.
<p> The color group argument <em>g</em> specifies the shading colors (<a href="qcolorgroup.html#light">light</a>, <a href="qcolorgroup.html#dark">dark</a> and <a href="qcolorgroup.html#mid">middle</a> colors).
<p> The rectangle appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
<p> The <em>lineWidth</em> argument specifies the line width for each of the
lines. It is not the total line width.
<p> The <em>midLineWidth</em> argument specifies the width of a middle line
drawn in the <a href="qcolorgroup.html#mid">QColorGroup::mid</a>() color.
<p> The rectangle's interior is filled with the <em>fill</em> brush unless
<em>fill</em> is 0.
<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
display a shaded rectangle, for example <tt>QFrame::setFrameStyle( QFrame::Box | QFrame::Raised )</tt>.
<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p> <p>See also <a href="#qDrawShadeLine">qDrawShadeLine</a>(), <a href="#qDrawShadePanel">qDrawShadePanel</a>(), <a href="#qDrawPlainRect">qDrawPlainRect</a>(), <a href="qstyle.html#drawItem">QStyle::drawItem</a>(), <a href="qstyle.html#drawControl">QStyle::drawControl</a>(), and <a href="qstyle.html#drawComplexControl">QStyle::drawComplexControl</a>().
<h3 class=fn>void <a name="qDrawWinButton"></a>qDrawWinButton ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;*&nbsp;fill )
</h3>
<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
<p> Draws the Windows-style button specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>) using the painter <em>p</em>.
<p> The color group argument <em>g</em> specifies the shading colors (<a href="qcolorgroup.html#light">light</a>, <a href="qcolorgroup.html#dark">dark</a> and <a href="qcolorgroup.html#mid">middle</a> colors).
<p> The button appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
<p> The line width is 2 pixels.
<p> The button's interior is filled with the <em>*fill</em> brush unless <em>fill</em> is 0.
<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p> <p>See also <a href="#qDrawWinPanel">qDrawWinPanel</a>() and <a href="qstyle.html#drawControl">QStyle::drawControl</a>().
<h3 class=fn>void <a name="qDrawWinPanel"></a>qDrawWinPanel ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;g, bool&nbsp;sunken, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;*&nbsp;fill )
</h3>
<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
<p> Draws the Windows-style panel specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>) using the painter <em>p</em>.
<p> The color group argument <em>g</em> specifies the shading colors.
<p> The panel appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
<p> The line width is 2 pixels.
<p> The button's interior is filled with the <em>fill</em> brush unless <em>fill</em> is 0.
<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
display a shaded panel, for example <tt>QFrame::setFrameStyle( QFrame::WinPanel | QFrame::Raised )</tt>.
<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p> <p>See also <a href="#qDrawShadePanel">qDrawShadePanel</a>(), <a href="#qDrawWinButton">qDrawWinButton</a>(), and <a href="qstyle.html#drawPrimitive">QStyle::drawPrimitive</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>