source: trunk/doc/html/qpainter.html@ 208

Last change on this file since 208 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 117.7 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpainter.cpp:68 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QPainter Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<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>
33
34<p>The QPainter class does low-level painting e.g. on widgets.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qpainter-h.html">qpainter.h</a>&gt;</tt>
37<p>Inherits <a href="qt.html">Qt</a>.
38<p>Inherited by <a href="qdirectpainter.html">QDirectPainter</a>.
39<p><a href="qpainter-members.html">List of all member functions.</a>
40<h2>Public Members</h2>
41<ul>
42<li class=fn>enum <a href="#CoordinateMode-enum"><b>CoordinateMode</b></a> { CoordDevice, CoordPainter }</li>
43<li class=fn><a href="#QPainter"><b>QPainter</b></a> ()</li>
44<li class=fn><a href="#QPainter-2"><b>QPainter</b></a> ( const&nbsp;QPaintDevice&nbsp;*&nbsp;pd, bool&nbsp;unclipped = FALSE )</li>
45<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>
46<li class=fn><a href="#~QPainter"><b>~QPainter</b></a> ()</li>
47<li class=fn>bool <a href="#begin"><b>begin</b></a> ( const&nbsp;QPaintDevice&nbsp;*&nbsp;pd, bool&nbsp;unclipped = FALSE )</li>
48<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>
49<li class=fn>bool <a href="#end"><b>end</b></a> ()</li>
50<li class=fn>QPaintDevice * <a href="#device"><b>device</b></a> () const</li>
51<li class=fn>bool <a href="#isActive"><b>isActive</b></a> () const</li>
52<li class=fn>void <a href="#flush"><b>flush</b></a> ( const&nbsp;QRegion&nbsp;&amp;&nbsp;region, CoordinateMode&nbsp;cm = CoordDevice )</li>
53<li class=fn>void <a href="#flush-2"><b>flush</b></a> ()</li>
54<li class=fn>void <a href="#save"><b>save</b></a> ()</li>
55<li class=fn>void <a href="#restore"><b>restore</b></a> ()</li>
56<li class=fn>QFontMetrics <a href="#fontMetrics"><b>fontMetrics</b></a> () const</li>
57<li class=fn>QFontInfo <a href="#fontInfo"><b>fontInfo</b></a> () const</li>
58<li class=fn>const QFont &amp; <a href="#font"><b>font</b></a> () const</li>
59<li class=fn>void <a href="#setFont"><b>setFont</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;font )</li>
60<li class=fn>const QPen &amp; <a href="#pen"><b>pen</b></a> () const</li>
61<li class=fn>void <a href="#setPen"><b>setPen</b></a> ( const&nbsp;QPen&nbsp;&amp;&nbsp;pen )</li>
62<li class=fn>void <a href="#setPen-2"><b>setPen</b></a> ( PenStyle&nbsp;style )</li>
63<li class=fn>void <a href="#setPen-3"><b>setPen</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;color )</li>
64<li class=fn>const QBrush &amp; <a href="#brush"><b>brush</b></a> () const</li>
65<li class=fn>void <a href="#setBrush-2"><b>setBrush</b></a> ( const&nbsp;QBrush&nbsp;&amp;&nbsp;brush )</li>
66<li class=fn>void <a href="#setBrush"><b>setBrush</b></a> ( BrushStyle&nbsp;style )</li>
67<li class=fn>void <a href="#setBrush-3"><b>setBrush</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;color )</li>
68<li class=fn>QPoint pos () const &nbsp;<em>(obsolete)</em></li>
69<li class=fn>const QColor &amp; <a href="#backgroundColor"><b>backgroundColor</b></a> () const</li>
70<li class=fn>void <a href="#setBackgroundColor"><b>setBackgroundColor</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;c )</li>
71<li class=fn>BGMode <a href="#backgroundMode"><b>backgroundMode</b></a> () const</li>
72<li class=fn>void <a href="#setBackgroundMode"><b>setBackgroundMode</b></a> ( BGMode&nbsp;m )</li>
73<li class=fn>RasterOp <a href="#rasterOp"><b>rasterOp</b></a> () const</li>
74<li class=fn>void <a href="#setRasterOp"><b>setRasterOp</b></a> ( RasterOp&nbsp;r )</li>
75<li class=fn>const QPoint &amp; <a href="#brushOrigin"><b>brushOrigin</b></a> () const</li>
76<li class=fn>void <a href="#setBrushOrigin"><b>setBrushOrigin</b></a> ( int&nbsp;x, int&nbsp;y )</li>
77<li class=fn>void <a href="#setBrushOrigin-2"><b>setBrushOrigin</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
78<li class=fn>bool <a href="#hasViewXForm"><b>hasViewXForm</b></a> () const</li>
79<li class=fn>bool <a href="#hasWorldXForm"><b>hasWorldXForm</b></a> () const</li>
80<li class=fn>void <a href="#setViewXForm"><b>setViewXForm</b></a> ( bool&nbsp;enable )</li>
81<li class=fn>QRect <a href="#window"><b>window</b></a> () const</li>
82<li class=fn>void <a href="#setWindow-2"><b>setWindow</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
83<li class=fn>void <a href="#setWindow"><b>setWindow</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
84<li class=fn>QRect <a href="#viewport"><b>viewport</b></a> () const</li>
85<li class=fn>void <a href="#setViewport-2"><b>setViewport</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
86<li class=fn>void <a href="#setViewport"><b>setViewport</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
87<li class=fn>void <a href="#setWorldXForm"><b>setWorldXForm</b></a> ( bool&nbsp;enable )</li>
88<li class=fn>const QWMatrix &amp; <a href="#worldMatrix"><b>worldMatrix</b></a> () const</li>
89<li class=fn>void <a href="#setWorldMatrix"><b>setWorldMatrix</b></a> ( const&nbsp;QWMatrix&nbsp;&amp;&nbsp;m, bool&nbsp;combine = FALSE )</li>
90<li class=fn>void saveWorldMatrix () &nbsp;<em>(obsolete)</em></li>
91<li class=fn>void restoreWorldMatrix () &nbsp;<em>(obsolete)</em></li>
92<li class=fn>void <a href="#scale"><b>scale</b></a> ( double&nbsp;sx, double&nbsp;sy )</li>
93<li class=fn>void <a href="#shear"><b>shear</b></a> ( double&nbsp;sh, double&nbsp;sv )</li>
94<li class=fn>void <a href="#rotate"><b>rotate</b></a> ( double&nbsp;a )</li>
95<li class=fn>void <a href="#translate"><b>translate</b></a> ( double&nbsp;dx, double&nbsp;dy )</li>
96<li class=fn>void <a href="#resetXForm"><b>resetXForm</b></a> ()</li>
97<li class=fn>QPoint <a href="#xForm"><b>xForm</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pv ) const</li>
98<li class=fn>QRect <a href="#xForm-2"><b>xForm</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;rv ) const</li>
99<li class=fn>QPointArray <a href="#xForm-3"><b>xForm</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;av ) const</li>
100<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>
101<li class=fn>QPoint <a href="#xFormDev-2"><b>xFormDev</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pd ) const</li>
102<li class=fn>QRect <a href="#xFormDev"><b>xFormDev</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;rd ) const</li>
103<li class=fn>QPointArray <a href="#xFormDev-3"><b>xFormDev</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;ad ) const</li>
104<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>
105<li class=fn>void <a href="#setClipping"><b>setClipping</b></a> ( bool&nbsp;enable )</li>
106<li class=fn>bool <a href="#hasClipping"><b>hasClipping</b></a> () const</li>
107<li class=fn>QRegion <a href="#clipRegion"><b>clipRegion</b></a> ( CoordinateMode&nbsp;m = CoordDevice ) const</li>
108<li class=fn>void <a href="#setClipRect-2"><b>setClipRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r, CoordinateMode&nbsp;m = CoordDevice )</li>
109<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>
110<li class=fn>void <a href="#setClipRegion"><b>setClipRegion</b></a> ( const&nbsp;QRegion&nbsp;&amp;&nbsp;rgn, CoordinateMode&nbsp;m = CoordDevice )</li>
111<li class=fn>void <a href="#drawPoint"><b>drawPoint</b></a> ( int&nbsp;x, int&nbsp;y )</li>
112<li class=fn>void <a href="#drawPoint-2"><b>drawPoint</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p )</li>
113<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>
114<li class=fn>void moveTo ( int&nbsp;x, int&nbsp;y ) &nbsp;<em>(obsolete)</em></li>
115<li class=fn>void moveTo ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p ) &nbsp;<em>(obsolete)</em></li>
116<li class=fn>void lineTo ( int&nbsp;x, int&nbsp;y ) &nbsp;<em>(obsolete)</em></li>
117<li class=fn>void lineTo ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p ) &nbsp;<em>(obsolete)</em></li>
118<li class=fn>void <a href="#drawLine"><b>drawLine</b></a> ( int&nbsp;x1, int&nbsp;y1, int&nbsp;x2, int&nbsp;y2 )</li>
119<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>
120<li class=fn>void <a href="#drawRect"><b>drawRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
121<li class=fn>void <a href="#drawRect-2"><b>drawRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
122<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>
123<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>
124<li class=fn>void <a href="#drawWinFocusRect-3"><b>drawWinFocusRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
125<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>
126<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>
127<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>
128<li class=fn>void <a href="#drawEllipse"><b>drawEllipse</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
129<li class=fn>void <a href="#drawEllipse-2"><b>drawEllipse</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
130<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>
131<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>
132<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>
133<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>
134<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>
135<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>
136<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>
137<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>
138<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>
139<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>
140<li class=fn>void <a href="#drawCubicBezier"><b>drawCubicBezier</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;a, int&nbsp;index = 0 )</li>
141<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>
142<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>
143<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>
144<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>
145<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>
146<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>
147<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>
148<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>
149<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>
150<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>
151<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>
152<li class=fn>void drawPicture ( const&nbsp;QPicture&nbsp;&amp;&nbsp;pic ) &nbsp;<em>(obsolete)</em></li>
153<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>
154<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>
155<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>
156<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>
157<li class=fn>void <a href="#eraseRect"><b>eraseRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )</li>
158<li class=fn>void <a href="#eraseRect-2"><b>eraseRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
159<li class=fn>enum <a href="#TextDirection-enum"><b>TextDirection</b></a> { Auto, RTL, LTR }</li>
160<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>
161<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>
162<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>
163<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>
164<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>
165<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>
166<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>
167<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>
168<li class=fn>int <a href="#tabStops"><b>tabStops</b></a> () const</li>
169<li class=fn>void <a href="#setTabStops"><b>setTabStops</b></a> ( int&nbsp;ts )</li>
170<li class=fn>int * <a href="#tabArray"><b>tabArray</b></a> () const</li>
171<li class=fn>void <a href="#setTabArray"><b>setTabArray</b></a> ( int&nbsp;*&nbsp;ta )</li>
172<li class=fn>HDC <a href="#handle"><b>handle</b></a> () const</li>
173</ul>
174<h2>Static Public Members</h2>
175<ul>
176<li class=fn>void <a href="#redirect"><b>redirect</b></a> ( QPaintDevice&nbsp;*&nbsp;pdev, QPaintDevice&nbsp;*&nbsp;replacement )</li>
177</ul>
178<h2>Related Functions</h2>
179<ul>
180<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>
181<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>
182<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>
183<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>
184<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>
185<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>
186</ul>
187<hr><a name="details"></a><h2>Detailed Description</h2>
188
189
190The QPainter class does low-level painting e.g. on widgets.
191<p>
192
193
194<p> The painter provides highly optimized functions to do most of the
195drawing GUI programs require. QPainter can draw everything from
196simple lines to complex shapes like pies and chords. It can also
197draw aligned text and pixmaps. Normally, it draws in a "natural"
198coordinate system, but it can also do view and world
199transformation.
200<p> The typical use of a painter is:
201<p> <ul>
202<li> Construct a painter.
203<li> Set a pen, a brush etc.
204<li> Draw.
205<li> Destroy the painter.
206</ul>
207<p> Mostly, all this is done inside a paint event. (In fact, 99% of
208all QPainter use is in a reimplementation of
209<a href="qwidget.html#paintEvent">QWidget::paintEvent</a>(), and the painter is heavily optimized for
210such use.) Here's one very simple example:
211<p> <pre>
212 void SimpleExampleWidget::paintEvent()
213 {
214 QPainter paint( this );
215 paint.<a href="#setPen">setPen</a>( Qt::blue );
216 paint.<a href="#drawText">drawText</a>( rect(), AlignCenter, "The Text" );
217 }
218 </pre>
219
220<p> Usage is simple, and there are many settings you can use:
221<p> <ul>
222<p> <li> <a href="#font">font</a>() is the currently set font. If you set a font that isn't
223available, Qt finds a close match. In fact font() returns what
224you set using <a href="#setFont">setFont</a>() and <a href="#fontInfo">fontInfo</a>() returns the font actually
225being used (which may be the same).
226<p> <li> <a href="#brush">brush</a>() is the currently set brush; the color or pattern that's
227used for filling e.g. circles.
228<p> <li> <a href="#pen">pen</a>() is the currently set pen; the color or stipple that's
229used for drawing lines or boundaries.
230<p> <li> <a href="#backgroundMode">backgroundMode</a>() is <tt>Opaque</tt> or <tt>Transparent</tt>, i.e. whether
231<a href="#backgroundColor">backgroundColor</a>() is used or not.
232<p> <li> backgroundColor() only applies when backgroundMode() is Opaque
233and pen() is a stipple. In that case, it describes the color of
234the background pixels in the stipple.
235<p> <li> <a href="#rasterOp">rasterOp</a>() is how pixels drawn interact with the pixels already
236there.
237<p> <li> <a href="#brushOrigin">brushOrigin</a>() is the origin of the tiled brushes, normally the
238origin of the window.
239<p> <li> <a href="#viewport">viewport</a>(), <a href="#window">window</a>(), <a href="#worldMatrix">worldMatrix</a>() and many more make up the
240painter's coordinate transformation system. See <a href="coordsys.html">The Coordinate System</a> for an explanation of
241this, or see below for a very brief overview of the functions.
242<p> <li> <a href="#hasClipping">hasClipping</a>() is whether the painter clips at all. (The paint
243device clips, too.) If the painter clips, it clips to <a href="#clipRegion">clipRegion</a>().
244<p> <li> <a href="#pos">pos</a>() is the current position, set by <a href="#moveTo">moveTo</a>() and used by
245<a href="#lineTo">lineTo</a>().
246<p> </ul>
247<p> Note that some of these settings mirror settings in some paint
248devices, e.g. <a href="qwidget.html#font">QWidget::font</a>(). <a href="#begin">QPainter::begin</a>() (or the QPainter
249constructor) copies these attributes from the paint device.
250Calling, for example, <a href="qwidget.html#setFont">QWidget::setFont</a>() doesn't take effect until
251the next time a painter begins painting on it.
252<p> <a href="#save">save</a>() saves all of these settings on an internal stack, <a href="#restore">restore</a>()
253pops them back.
254<p> The core functionality of QPainter is drawing, and there are
255functions to draw most primitives: <a href="#drawPoint">drawPoint</a>(), <a href="#drawPoints">drawPoints</a>(),
256<a href="#drawLine">drawLine</a>(), <a href="#drawRect">drawRect</a>(), <a href="#drawWinFocusRect">drawWinFocusRect</a>(), <a href="#drawRoundRect">drawRoundRect</a>(),
257<a href="#drawEllipse">drawEllipse</a>(), <a href="#drawArc">drawArc</a>(), <a href="#drawPie">drawPie</a>(), <a href="#drawChord">drawChord</a>(),
258<a href="#drawLineSegments">drawLineSegments</a>(), <a href="#drawPolyline">drawPolyline</a>(), <a href="#drawPolygon">drawPolygon</a>(),
259<a href="#drawConvexPolygon">drawConvexPolygon</a>() and <a href="#drawCubicBezier">drawCubicBezier</a>(). All of these functions
260take integer coordinates; there are no floating-point versions
261since we want drawing to be as fast as possible.
262<p> There are functions to draw pixmaps/images, namely <a href="#drawPixmap">drawPixmap</a>(),
263<a href="#drawImage">drawImage</a>() and <a href="#drawTiledPixmap">drawTiledPixmap</a>(). drawPixmap() and drawImage()
264produce the same result, except that drawPixmap() is faster
265on-screen and drawImage() faster and sometimes better on <a href="qprinter.html">QPrinter</a>
266and <a href="qpicture.html">QPicture</a>.
267<p> Text drawing is done using <a href="#drawText">drawText</a>(), and when you need
268fine-grained positioning, <a href="#boundingRect">boundingRect</a>() tells you where a given
269drawText() command would draw.
270<p> There is a <a href="#drawPicture">drawPicture</a>() function that draws the contents of an
271entire QPicture using this painter. drawPicture() is the only
272function that disregards all the painter's settings: the QPicture
273has its own settings.
274<p> Normally, the QPainter operates on the device's own coordinate
275system (usually pixels), but QPainter has good support for
276coordinate transformation. See <a href="coordsys.html">The Coordinate
277 System</a> for a more general overview and a simple example.
278<p> The most common functions used are <a href="#scale">scale</a>(), <a href="#rotate">rotate</a>(), <a href="#translate">translate</a>()
279and <a href="#shear">shear</a>(), all of which operate on the <a href="#worldMatrix">worldMatrix</a>().
280<a href="#setWorldMatrix">setWorldMatrix</a>() can replace or add to the currently set
281worldMatrix().
282<p> <a href="#setViewport">setViewport</a>() sets the rectangle on which QPainter operates. The
283default is the entire device, which is usually fine, except on
284printers. <a href="#setWindow">setWindow</a>() sets the coordinate system, that is, the
285rectangle that maps to <a href="#viewport">viewport</a>(). What's drawn inside the
286<a href="#window">window</a>() ends up being inside the viewport(). The window's
287default is the same as the viewport, and if you don't use the
288transformations, they are optimized away, gaining another little
289bit of speed.
290<p> After all the coordinate transformation is done, QPainter can clip
291the drawing to an arbitrary rectangle or region. <a href="#hasClipping">hasClipping</a>() is
292TRUE if QPainter clips, and <a href="#clipRegion">clipRegion</a>() returns the clip region.
293You can set it using either <a href="#setClipRegion">setClipRegion</a>() or <a href="#setClipRect">setClipRect</a>().
294Note that the clipping can be slow. It's all system-dependent,
295but as a rule of thumb, you can assume that drawing speed is
296inversely proportional to the number of rectangles in the clip
297region.
298<p> After QPainter's clipping, the paint device may also clip. For
299example, most widgets clip away the pixels used by child widgets,
300and most printers clip away an area near the edges of the paper.
301This additional clipping is not reflected by the return value of
302clipRegion() or hasClipping().
303<p> QPainter also includes some less-used functions that are very
304useful on those occasions when they're needed.
305<p> <a href="#isActive">isActive</a>() indicates whether the painter is active. <a href="#begin">begin</a>() (and
306the most usual constructor) makes it active. <a href="#end">end</a>() (and the
307destructor) deactivates it. If the painter is active, <a href="#device">device</a>()
308returns the paint device on which the painter paints.
309<p> Sometimes it is desirable to make someone else paint on an unusual
310<a href="qpaintdevice.html">QPaintDevice</a>. QPainter supports a static function to do this,
311<a href="#redirect">redirect</a>(). We recommend not using it, but for some hacks it's
312perfect.
313<p> <a href="#setTabStops">setTabStops</a>() and <a href="#setTabArray">setTabArray</a>() can change where the tab stops
314are, but these are very seldomly used.
315<p> <b>Warning:</b> Note that QPainter does not attempt to work around
316coordinate limitations in the underlying window system. Some
317platforms may behave incorrectly with coordinates as small as
318+/-4000.
319
320<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>.
321
322<hr><h2>Member Type Documentation</h2>
323<h3 class=fn><a name="CoordinateMode-enum"></a>QPainter::CoordinateMode</h3>
324
325<ul>
326<li><tt>QPainter::CoordDevice</tt>
327<li><tt>QPainter::CoordPainter</tt>
328</ul><p> <p>See also <a href="#clipRegion">clipRegion</a>().
329
330<h3 class=fn><a name="TextDirection-enum"></a>QPainter::TextDirection</h3>
331
332<ul>
333<li><tt>QPainter::Auto</tt>
334<li><tt>QPainter::RTL</tt> - right to left
335<li><tt>QPainter::LTR</tt> - left to right
336</ul><p> <p>See also <a href="#drawText">drawText</a>().
337
338<hr><h2>Member Function Documentation</h2>
339<h3 class=fn><a name="QPainter"></a>QPainter::QPainter ()
340</h3>
341Constructs a painter.
342<p> Notice that all painter settings (setPen, setBrush etc.) are reset
343to default values when <a href="#begin">begin</a>() is called.
344<p> <p>See also <a href="#begin">begin</a>() and <a href="#end">end</a>().
345
346<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 )
347</h3>
348Constructs a painter that begins painting the paint device <em>pd</em>
349immediately. Depending on the underlying graphic system the
350painter will paint over children of the paintdevice if <em>unclipped</em> is TRUE.
351<p> This constructor is convenient for short-lived painters, e.g. in a
352<a href="qwidget.html#paintEvent">paint event</a> and should be used
353only once. The constructor calls <a href="#begin">begin</a>() for you and the QPainter
354destructor automatically calls <a href="#end">end</a>().
355<p> Here's an example using begin() and end():
356<pre>
357 void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
358 {
359 QPainter p;
360 p.<a href="#begin">begin</a>( this );
361 p.<a href="#drawLine">drawLine</a>( ... ); // drawing code
362 p.<a href="#end">end</a>();
363 }
364 </pre>
365
366<p> The same example using this constructor:
367<pre>
368 void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
369 {
370 QPainter p( this );
371 p.<a href="#drawLine">drawLine</a>( ... ); // drawing code
372 }
373 </pre>
374
375<p> Since the constructor cannot provide feedback when the initialization
376of the painter failed you should rather use begin() and end() to paint
377on external devices, e.g. printers.
378<p> <p>See also <a href="#begin">begin</a>() and <a href="#end">end</a>().
379
380<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 )
381</h3>
382Constructs a painter that begins painting the paint device <em>pd</em>
383immediately, with the default arguments taken from <em>copyAttributes</em>. The painter will paint over children of the paint
384device if <em>unclipped</em> is TRUE (although this is not supported on
385all platforms).
386<p> <p>See also <a href="#begin">begin</a>().
387
388<h3 class=fn><a name="~QPainter"></a>QPainter::~QPainter ()
389</h3>
390Destroys the painter.
391
392<h3 class=fn>const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp; <a name="backgroundColor"></a>QPainter::backgroundColor () const
393</h3>
394
395<p> Returns the current background color.
396<p> <p>See also <a href="#setBackgroundColor">setBackgroundColor</a>() and <a href="qcolor.html">QColor</a>.
397
398<h3 class=fn><a href="qt.html#BGMode-enum">BGMode</a> <a name="backgroundMode"></a>QPainter::backgroundMode () const
399</h3>
400
401<p> Returns the current background mode.
402<p> <p>See also <a href="#setBackgroundMode">setBackgroundMode</a>() and <a href="qt.html#BGMode-enum">BGMode</a>.
403
404<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 )
405</h3>
406Begins painting the paint device <em>pd</em> and returns TRUE if
407successful; otherwise returns FALSE. If <em>unclipped</em> is TRUE, the
408painting will not be clipped at the paint device's boundaries,
409(although this is not supported by all platforms).
410<p> The errors that can occur are serious problems, such as these:
411<p> <pre>
412 p-&gt;begin( 0 ); // impossible - paint device cannot be 0
413
414 <a href="qpixmap.html">QPixmap</a> pm( 0, 0 );
415 p-&gt;begin( pm ); // impossible - pm.<a href="qpixmap.html#isNull">isNull</a>();
416
417 p-&gt;begin( myWidget );
418 p2-&gt;begin( myWidget ); // impossible - only one painter at a time
419 </pre>
420
421<p> Note that most of the time, you can use one of the constructors
422instead of <a href="#begin">begin</a>(), and that <a href="#end">end</a>() is automatically done at
423destruction.
424<p> <b>Warning:</b> A paint device can only be painted by one painter at a
425time.
426<p> <p>See also <a href="#end">end</a>() and <a href="#flush">flush</a>().
427
428<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>.
429<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 )
430</h3>
431This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
432<p> This version opens the painter on a paint device <em>pd</em> and sets
433the initial pen, background color and font from <em>copyAttributes</em>,
434painting over the paint device's children when <em>unclipped</em> is
435TRUE. This is equivalent to:
436<p> <pre>
437 QPainter p;
438 p.<a href="#begin">begin</a>( pd );
439 p.<a href="#setPen">setPen</a>( copyAttributes-&gt;foregroundColor() );
440 p.<a href="#setBackgroundColor">setBackgroundColor</a>( copyAttributes-&gt;backgroundColor() );
441 p.<a href="#setFont">setFont</a>( copyAttributes-&gt;font() );
442 </pre>
443
444<p> This begin function is convenient for double buffering. When you
445draw in a pixmap instead of directly in a widget (to later bitBlt
446the pixmap into the widget) you will need to set the widget's
447font etc. This function does exactly that.
448<p> Example:
449<pre>
450 void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
451 {
452 <a href="qpixmap.html">QPixmap</a> pm(size());
453 QPainter p;
454 p.<a href="#begin">begin</a>(&amp;pm, this);
455 // ... potentially flickering paint operation ...
456 p.<a href="#end">end</a>();
457 <a href="qimage.html#bitBlt">bitBlt</a>(this, 0, 0, &amp;pm);
458 }
459 </pre>
460
461<p> <p>See also <a href="#end">end</a>().
462
463<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 )
464</h3>
465
466<p> Returns the bounding rectangle of the aligned text that would be
467printed with the corresponding <a href="#drawText">drawText</a>() function using the first
468<em>len</em> characters of the string if <em>len</em> is > -1, or the whole of
469the string if <em>len</em> is -1. The drawing, and hence the bounding
470rectangle, 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
471rectangle required to draw the text, whichever is the larger.
472<p> The <em>flags</em> argument is
473the bitwise OR of the following flags:
474<center><table cellpadding="4" cellspacing="2" border="0">
475<tr bgcolor="#a2c511"> <th valign="top">Flag <th valign="top">Meaning
476<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignAuto</a> <td valign="top">aligns according to the language, usually left.
477<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignLeft</a> <td valign="top">aligns to the left border.
478<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignRight</a> <td valign="top">aligns to the right border.
479<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignHCenter</a> <td valign="top">aligns horizontally centered.
480<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignTop</a> <td valign="top">aligns to the top border.
481<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignBottom</a> <td valign="top">aligns to the bottom border.
482<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#AlignmentFlags-enum">AlignVCenter</a> <td valign="top">aligns vertically centered.
483<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>).
484<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#TextFlags-enum">SingleLine</a> <td valign="top">ignores newline characters in the text.
485<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#TextFlags-enum">ExpandTabs</a> <td valign="top">expands tabs.
486<tr bgcolor="#f0f0f0"> <td valign="top"><a href="qt.html#TextFlags-enum">ShowPrefix</a> <td valign="top">interprets "&x" as "<u>x</u>".
487<tr bgcolor="#d0d0d0"> <td valign="top"><a href="qt.html#TextFlags-enum">WordBreak</a> <td valign="top">breaks the text to fit the rectangle.
488</table></center>
489<p> Horizontal alignment defaults to <a href="qt.html#AlignmentFlags-enum">AlignLeft</a> and vertical
490alignment defaults to <a href="qt.html#AlignmentFlags-enum">AlignTop</a>.
491<p> If several of the horizontal or several of the vertical alignment flags
492are set, the resulting alignment is undefined.
493<p> The <em>intern</em> parameter should not be used.
494<p> <p>See also <a href="qt.html#TextFlags-enum">Qt::TextFlags</a>.
495
496<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 )
497</h3>
498This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
499<p> Returns the bounding rectangle of the aligned text that would be
500printed with the corresponding <a href="#drawText">drawText</a>() function using the first
501<em>len</em> characters from <em>str</em> if <em>len</em> is > -1, or the whole of
502<em>str</em> if <em>len</em> is -1. The drawing, and hence the bounding
503rectangle, is constrained to the rectangle <em>r</em>, or to the
504rectangle required to draw the text, whichever is the larger.
505<p> The <em>internal</em> parameter should not be used.
506<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>.
507
508<h3 class=fn>const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp; <a name="brush"></a>QPainter::brush () const
509</h3>
510
511<p> Returns the painter's current brush.
512<p> <p>See also <a href="#setBrush">QPainter::setBrush</a>().
513
514<p>Examples: <a href="themes-example.html#x283">themes/metal.cpp</a> and <a href="themes-example.html#x212">themes/wood.cpp</a>.
515<h3 class=fn>const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; <a name="brushOrigin"></a>QPainter::brushOrigin () const
516</h3>
517
518<p> Returns the brush origin currently set.
519<p> <p>See also <a href="#setBrushOrigin">setBrushOrigin</a>().
520
521<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
522</h3>
523Returns the currently set clip region. Note that the clip region
524is given in physical device coordinates and <em>not</em> subject to any
525<a href="coordsys.html">coordinate transformation</a> if <em>m</em> is
526equal 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.
527<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>.
528
529<p>Example: <a href="themes-example.html#x213">themes/wood.cpp</a>.
530<h3 class=fn><a href="qpaintdevice.html">QPaintDevice</a>&nbsp;* <a name="device"></a>QPainter::device () const
531</h3>
532
533<p> Returns the paint device on which this painter is currently
534painting, or 0 if the painter is not active.
535<p> <p>See also <a href="qpaintdevice.html#paintingActive">QPaintDevice::paintingActive</a>().
536
537<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>.
538<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 )
539</h3>
540Draws an arc defined by the rectangle <em>(x, y, w, h)</em>, the start
541angle <em>a</em> and the arc length <em>alen</em>.
542<p> The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
543circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
544mean counter-clockwise while negative values mean the clockwise
545direction. Zero degrees is at the 3 o'clock position.
546<p> Example:
547<pre>
548 QPainter p( myWidget );
549 p.<a href="#drawArc">drawArc</a>( 10,10, 70,100, 100*16, 160*16 ); // draws a "(" arc
550 </pre>
551
552<p> <p>See also <a href="#drawPie">drawPie</a>() and <a href="#drawChord">drawChord</a>().
553
554<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 )
555</h3>
556This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
557<p> Draws the arc that fits inside the rectangle <em>r</em> with start angle
558<em>a</em> and arc length <em>alen</em>.
559
560<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 )
561</h3>
562Draws a chord defined by the rectangle <em>(x, y, w, h)</em>, the start
563angle <em>a</em> and the arc length <em>alen</em>.
564<p> The chord is filled with the current <a href="#brush">brush</a>().
565<p> The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
566circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
567mean counter-clockwise while negative values mean the clockwise
568direction. Zero degrees is at the 3 o'clock position.
569<p> <p>See also <a href="#drawArc">drawArc</a>() and <a href="#drawPie">drawPie</a>().
570
571<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 )
572</h3>
573This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
574<p> Draws a chord that fits inside the rectangle <em>r</em> with start angle
575<em>a</em> and arc length <em>alen</em>.
576
577<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 )
578</h3>
579Draws the convex polygon defined by the <em>npoints</em> points in <em>pa</em>
580starting at <em>pa[index]</em> (<em>index</em> defaults to 0).
581<p> If the supplied polygon is not convex, the results are undefined.
582<p> On some platforms (e.g. X Window), this is faster than
583<a href="#drawPolygon">drawPolygon</a>().
584<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
585values are truncated. This limitation is expected to go away in
586Qt 4.
587
588<p>Example: <a href="coordsys.html#x2271">aclock/aclock.cpp</a>.
589<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 )
590</h3>
591Draws a cubic Bezier curve defined by the control points in <em>a</em>,
592starting at <em>a[index]</em> (<em>index</em> defaults to 0).
593<p> Control points after <em>a[index + 3]</em> are ignored. Nothing happens
594if there aren't enough control points.
595<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
596values are truncated. This limitation is expected to go away in
597Qt 4.
598
599<h3 class=fn>void <a name="drawEllipse"></a>QPainter::drawEllipse ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
600</h3>
601Draws an ellipse with center at <em>(x + w/2, y + h/2)</em> and size <em>(w, h)</em>.
602
603<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>.
604<h3 class=fn>void <a name="drawEllipse-2"></a>QPainter::drawEllipse ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
605</h3>
606This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
607<p> Draws the ellipse that fits inside rectangle <em>r</em>.
608
609<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 )
610</h3>
611Draws 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
612needs to be converted to a pixmap. The default value for <em>conversionFlags</em> is 0; see convertFromImage() for information about
613what other values do.
614<p> This function may convert <em>image</em> to a pixmap and then draw it,
615if <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,
616if device() is a <a href="qprinter.html">QPrinter</a> or <a href="qpicture.html">QPicture</a>.
617<p> Currently alpha masks of the image are ignored when painting on a QPrinter.
618<p> <p>See also <a href="#drawPixmap">drawPixmap</a>() and <a href="qpixmap.html#convertFromImage">QPixmap::convertFromImage</a>().
619
620<p>Example: <a href="canvas-example.html#x2941">canvas/canvas.cpp</a>.
621<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 )
622</h3>
623This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
624<p> Draws the rectangle <em>sr</em> from the image at the given point.
625
626<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 )
627</h3>
628This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
629<p> Draws the image <em>i</em> at point <em>p</em>.
630<p> If the image needs to be modified to fit in a lower-resolution
631result (e.g. converting from 32-bit to 8-bit), use the <em>conversion_flags</em> to specify how you'd prefer this to happen.
632<p> <p>See also <a href="qt.html#ImageConversionFlags-enum">Qt::ImageConversionFlags</a>.
633
634<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 )
635</h3>
636This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
637<p> Draws the image <em>i</em> into the rectangle <em>r</em>. The image will be
638scaled to fit the rectangle if image and rectangle dimensions
639differ.
640
641<h3 class=fn>void <a name="drawLine"></a>QPainter::drawLine ( int&nbsp;x1, int&nbsp;y1, int&nbsp;x2, int&nbsp;y2 )
642</h3>
643Draws a line from (<em>x1</em>, <em>y1</em>) to (<em>x2</em>, <em>y2</em>) and sets the
644current pen position to (<em>x2</em>, <em>y2</em>).
645<p> <p>See also <a href="#pen">pen</a>().
646
647<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>.
648<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 )
649</h3>
650This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
651<p> Draws a line from point <em>p1</em> to point <em>p2</em>.
652
653<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 )
654</h3>
655Draws <em>nlines</em> separate lines from points defined in <em>a</em>,
656starting at <em>a[index]</em> (<em>index</em> defaults to 0). If <em>nlines</em> is
657-1 (the default) all points until the end of the array are used
658(i.e. (a.size()-index)/2 lines are drawn).
659<p> Draws the 1st line from <em>a[index]</em> to <em>a[index+1]</em>. Draws the
6602nd line from <em>a[index+2]</em> to <em>a[index+3]</em> etc.
661<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
662values are truncated. This limitation is expected to go away in
663Qt 4.
664<p> <p>See also <a href="#drawPolyline">drawPolyline</a>(), <a href="#drawPolygon">drawPolygon</a>(), and <a href="qpen.html">QPen</a>.
665
666<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 )
667</h3>
668Replays the picture <em>pic</em> translated by (<em>x</em>, <em>y</em>).
669<p> This function does exactly the same as <a href="qpicture.html#play">QPicture::play</a>() when
670called with (<em>x</em>, <em>y</em>) = (0, 0).
671
672<p>Examples: <a href="picture-example.html#x113">picture/picture.cpp</a> and <a href="xform-example.html#x1234">xform/xform.cpp</a>.
673<h3 class=fn>void <a name="drawPicture-2"></a>QPainter::drawPicture ( const&nbsp;<a href="qpicture.html">QPicture</a>&nbsp;&amp;&nbsp;pic )
674</h3>
675<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
676<p> Use one of the other <a href="#drawPicture">QPainter::drawPicture</a>() functions with a (0, 0)
677offset instead.
678
679<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 )
680</h3>
681This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
682<p> Draws picture <em>pic</em> at point <em>p</em>.
683
684<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 )
685</h3>
686Draws a pie defined by the rectangle <em>(x, y, w, h)</em>, the start
687angle <em>a</em> and the arc length <em>alen</em>.
688<p> The pie is filled with the current <a href="#brush">brush</a>().
689<p> The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
690circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
691mean counter-clockwise while negative values mean the clockwise
692direction. Zero degrees is at the 3 o'clock position.
693<p> <p>See also <a href="#drawArc">drawArc</a>() and <a href="#drawChord">drawChord</a>().
694
695<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>.
696<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 )
697</h3>
698This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
699<p> Draws a pie segment that fits inside the rectangle <em>r</em> with start
700angle <em>a</em> and arc length <em>alen</em>.
701
702<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 )
703</h3>
704Draws a pixmap at <em>(x, y)</em> by copying a part of <em>pixmap</em> into
705the paint device.
706<p> <em>(x, y)</em> specifies the top-left point in the paint device that is
707to 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).
708<p> <em>(sw, sh)</em> specifies the size of the pixmap that is to be drawn.
709The default, (-1, -1), means all the way to the bottom right of
710the pixmap.
711<p> Currently the mask of the pixmap or it's alpha channel are ignored
712when painting on a <a href="qprinter.html">QPrinter</a>.
713<p> <p>See also <a href="qimage.html#bitBlt">bitBlt</a>() and <a href="qpixmap.html#setMask">QPixmap::setMask</a>().
714
715<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>.
716<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 )
717</h3>
718This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
719<p> Draws the rectangle <em>sr</em> of pixmap <em>pm</em> with its origin at point
720<em>p</em>.
721
722<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 )
723</h3>
724This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
725<p> Draws the pixmap <em>pm</em> with its origin at point <em>p</em>.
726
727<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 )
728</h3>
729This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
730<p> Draws the pixmap <em>pm</em> into the rectangle <em>r</em>. The pixmap is
731scaled to fit the rectangle, if image and rectangle size disagree.
732
733<h3 class=fn>void <a name="drawPoint"></a>QPainter::drawPoint ( int&nbsp;x, int&nbsp;y )
734</h3>
735Draws/plots a single point at <em>(x, y)</em> using the current pen.
736<p> <p>See also <a href="qpen.html">QPen</a>.
737
738<p>Examples: <a href="desktop-example.html#x1734">desktop/desktop.cpp</a> and <a href="drawlines-example.html#x1656">drawlines/connect.cpp</a>.
739<h3 class=fn>void <a name="drawPoint-2"></a>QPainter::drawPoint ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
740</h3>
741This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
742<p> Draws the point <em>p</em>.
743
744<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 )
745</h3>
746Draws/plots an array of points, <em>a</em>, using the current pen.
747<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
748of the points from <em>index</em> are drawn. If <em>npoints</em> is zero or
749greater, <em>npoints</em> points are drawn.
750<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
751values are truncated. This limitation is expected to go away in
752Qt 4.
753
754<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 )
755</h3>
756Draws the polygon defined by the <em>npoints</em> points in <em>a</em>
757starting at <em>a[index]</em>. (<em>index</em> defaults to 0.)
758<p> If <em>npoints</em> is -1 (the default) all points until the end of the
759array are used (i.e. a.size()-index line segments define the
760polygon).
761<p> The first point is always connected to the last point.
762<p> The polygon is filled with the current <a href="#brush">brush</a>(). If <em>winding</em> is
763TRUE, the polygon is filled using the winding fill algorithm. If
764<em>winding</em> is FALSE, the polygon is filled using the even-odd
765(alternative) fill algorithm.
766<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
767values are truncated. This limitation is expected to go away in
768Qt 4.
769<p> <p>See also <a href="#drawLineSegments">drawLineSegments</a>(), <a href="#drawPolyline">drawPolyline</a>(), and <a href="qpen.html">QPen</a>.
770
771<p>Examples: <a href="desktop-example.html#x1735">desktop/desktop.cpp</a> and <a href="picture-example.html#x115">picture/picture.cpp</a>.
772<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 )
773</h3>
774Draws the polyline defined by the <em>npoints</em> points in <em>a</em>
775starting at <em>a[index]</em>. (<em>index</em> defaults to 0.)
776<p> If <em>npoints</em> is -1 (the default) all points until the end of the
777array are used (i.e. a.size()-index-1 line segments are drawn).
778<p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
779values are truncated. This limitation is expected to go away in
780Qt 4.
781<p> <p>See also <a href="#drawLineSegments">drawLineSegments</a>(), <a href="#drawPolygon">drawPolygon</a>(), and <a href="qpen.html">QPen</a>.
782
783<p>Examples: <a href="scribble-example.html#x917">scribble/scribble.cpp</a> and <a href="themes-example.html#x285">themes/metal.cpp</a>.
784<h3 class=fn>void <a name="drawRect"></a>QPainter::drawRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
785</h3>
786Draws a rectangle with upper left corner at <em>(x, y)</em> and with
787width <em>w</em> and height <em>h</em>.
788<p> <p>See also <a href="qpen.html">QPen</a> and <a href="#drawRoundRect">drawRoundRect</a>().
789
790<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>.
791<h3 class=fn>void <a name="drawRect-2"></a>QPainter::drawRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
792</h3>
793This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
794<p> Draws the rectangle <em>r</em>.
795
796<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 )
797</h3>
798Draws a rectangle with rounded corners at <em>(x, y)</em>, with width <em>w</em> and height <em>h</em>.
799<p> The <em>xRnd</em> and <em>yRnd</em> arguments specify how rounded the corners
800should be. 0 is angled corners, 99 is maximum roundedness.
801<p> The width and height include all of the drawn lines.
802<p> <p>See also <a href="#drawRect">drawRect</a>() and <a href="qpen.html">QPen</a>.
803
804<p>Examples: <a href="drawdemo-example.html#x1071">drawdemo/drawdemo.cpp</a> and <a href="themes-example.html#x215">themes/wood.cpp</a>.
805<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 )
806</h3>
807This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
808<p> Draws a rounded rectangle <em>r</em>, rounding to the x position <em>xRnd</em>
809and the y position <em>yRnd</em> on each corner.
810
811<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 )
812</h3>
813
814<p> Draws the text from position <em>pos</em>, at point <em>p</em>. If <em>len</em> is
815-1 the entire string is drawn, otherwise just the first <em>len</em>
816characters. The text's direction is specified by <em>dir</em>.
817<p> Note that the meaning of <em>y</em> is not the same for the two
818<a href="#drawText">drawText</a>() varieties. For overloads that take a simple <em>x</em>, <em>y</em>
819pair (or a point), the <em>y</em> value is the text's baseline; for
820overloads that take a rectangle, <em>rect.y()</em> is the top of the
821rectangle and the text is aligned within that rectangle in
822accordance with the alignment flags.
823<p> <p>See also <a href="#TextDirection-enum">QPainter::TextDirection</a>.
824
825<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>.
826<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 )
827</h3>
828
829<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
830<p> Draws the given text at position <em>x</em>, <em>y</em>. If <em>len</em> is -1 (the
831default) all the text is drawn, otherwise the first <em>len</em>
832characters are drawn. The text's direction is given by <em>dir</em>.
833<p> <p>See also <a href="#TextDirection-enum">QPainter::TextDirection</a>.
834
835<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 )
836</h3>
837
838<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
839<p> Draws the text at the given point.
840<p> <p>See also <a href="#TextDirection-enum">QPainter::TextDirection</a>.
841
842<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 )
843</h3>
844
845<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
846<p> Draws the text from position <em>pos</em>, at point <em>(x, y)</em>. If <em>len</em> is
847-1 the entire string is drawn, otherwise just the first <em>len</em>
848characters. The text's direction is specified by <em>dir</em>.
849
850<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 )
851</h3>
852
853<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
854<p> Draws the given text within the rectangle starting at <em>x</em>, <em>y</em>,
855with width <em>w</em> and height <em>h</em>. If <em>len</em> is -1 (the default) all
856the text is drawn, otherwise the first <em>len</em> characters are
857drawn. The text's flags that are given in the <em>flags</em> parameter
858are <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
859output. The <em>internal</em> parameter is for internal use only.
860
861<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 )
862</h3>
863This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
864<p> Draws at most <em>len</em> characters from <em>str</em> in the rectangle <em>r</em>.
865<p> This function draws formatted text. The <em>tf</em> text format is
866really of type <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> and <a href="qt.html#TextFlags-enum">Qt::TextFlags</a> OR'd
867together.
868<p> Horizontal alignment defaults to AlignAuto and vertical alignment
869defaults to AlignTop.
870<p> <em>brect</em> (if not null) is set to the actual bounding rectangle of
871the output. <em>internal</em> is, yes, internal.
872<p> <p>See also <a href="#boundingRect">boundingRect</a>().
873
874<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 )
875</h3>
876Draws a tiled <em>pixmap</em> in the specified rectangle.
877<p> <em>(x, y)</em> specifies the top-left point in the paint device that is
878to 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
879to be drawn. The default is (0, 0).
880<p> Calling <a href="#drawTiledPixmap">drawTiledPixmap</a>() is similar to calling <a href="#drawPixmap">drawPixmap</a>()
881several times to fill (tile) an area with a pixmap, but is
882potentially much more efficient depending on the underlying window
883system.
884<p> <p>See also <a href="#drawPixmap">drawPixmap</a>().
885
886<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 )
887</h3>
888This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
889<p> Draws a tiled pixmap, <em>pm</em>, inside rectangle <em>r</em> with its origin
890at point <em>sp</em>.
891
892<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 )
893</h3>
894This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
895<p> Draws a tiled pixmap, <em>pm</em>, inside rectangle <em>r</em>.
896
897<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 )
898</h3>
899Draws a Windows focus rectangle with upper left corner at (<em>x</em>,
900<em>y</em>) and with width <em>w</em> and height <em>h</em> using a pen color that
901contrasts with <em>bgColor</em>.
902<p> This function draws a stippled rectangle (XOR is not used) that is
903used to indicate <a href="focus.html#keyboard-focus">keyboard focus</a> (when the <a href="qapplication.html#style">QApplication::style</a>() is
904<tt>WindowStyle</tt>).
905<p> The pen color used to draw the rectangle is either white or black
906depending on the color of <em>bgColor</em> (see QColor::gray()).
907<p> <b>Warning:</b> This function draws nothing if the coordinate system has
908been <a href="#rotate">rotated</a> or <a href="#shear">sheared</a>.
909<p> <p>See also <a href="#drawRect">drawRect</a>() and <a href="qapplication.html#style">QApplication::style</a>().
910
911<h3 class=fn>void <a name="drawWinFocusRect-2"></a>QPainter::drawWinFocusRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
912</h3>
913This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
914<p> Draws a Windows focus rectangle with upper left corner at (<em>x</em>,
915<em>y</em>) and with width <em>w</em> and height <em>h</em>.
916<p> This function draws a stippled XOR rectangle that is used to
917indicate <a href="focus.html#keyboard-focus">keyboard focus</a> (when <a href="qapplication.html#style">QApplication::style</a>() is <tt>WindowStyle</tt>).
918<p> <b>Warning:</b> This function draws nothing if the coordinate system has
919been <a href="#rotate">rotated</a> or <a href="#shear">sheared</a>.
920<p> <p>See also <a href="#drawRect">drawRect</a>() and <a href="qapplication.html#style">QApplication::style</a>().
921
922<h3 class=fn>void <a name="drawWinFocusRect-3"></a>QPainter::drawWinFocusRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
923</h3>
924This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
925<p> Draws rectangle <em>r</em> as a window focus rectangle.
926
927<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 )
928</h3>
929This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
930<p> Draws rectangle <em>r</em> as a window focus rectangle using background
931color <em>bgColor</em>.
932
933<h3 class=fn>bool <a name="end"></a>QPainter::end ()
934</h3>
935Ends painting. Any resources used while painting are released.
936<p> Note that while you mostly don't need to call <a href="#end">end</a>(), the
937destructor will do it, there is at least one common case when it
938is needed, namely double buffering.
939<p> <pre>
940 QPainter p( myPixmap, this )
941 // ...
942 p.<a href="#end">end</a>(); // stops drawing on myPixmap
943 p.<a href="#begin">begin</a>( this );
944 p.<a href="#drawPixmap">drawPixmap</a>( 0, 0, myPixmap );
945 </pre>
946
947<p> Since you can't draw a <a href="qpixmap.html">QPixmap</a> while it is being painted, it is
948necessary to close the active painter.
949<p> <p>See also <a href="#begin">begin</a>() and <a href="#isActive">isActive</a>().
950
951<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>.
952<h3 class=fn>void <a name="eraseRect"></a>QPainter::eraseRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
953</h3>
954
955<p> Erases the area inside <em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>. Equivalent to
956<tt>fillRect( x, y, w, h, backgroundColor() )</tt>.
957
958<p>Examples: <a href="listboxcombo-example.html#x1414">listboxcombo/listboxcombo.cpp</a> and <a href="showimg-example.html#x1338">showimg/showimg.cpp</a>.
959<h3 class=fn>void <a name="eraseRect-2"></a>QPainter::eraseRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
960</h3>
961This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
962<p> Erases the area inside the rectangle <em>r</em>.
963
964<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 )
965</h3>
966Fills the rectangle <em>(x, y, w, h)</em> with the <em>brush</em>.
967<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>
968constructor that takes a QColor argument and creates a solid
969pattern brush.
970<p> <p>See also <a href="#drawRect">drawRect</a>().
971
972<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>.
973<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 )
974</h3>
975This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
976<p> Fills the rectangle <em>r</em> using brush <em>brush</em>.
977
978<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 )
979</h3>
980Flushes any buffered drawing operations inside the region <em>region</em> using clipping mode <em>cm</em>.
981<p> The flush may update the whole device if the platform does not
982support flushing to a specified region.
983<p> <p>See also <a href="#CoordinateMode-enum">CoordinateMode</a>.
984
985<h3 class=fn>void <a name="flush-2"></a>QPainter::flush ()
986</h3>
987This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
988<p> Flushes any buffered drawing operations.
989
990<h3 class=fn>const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp; <a name="font"></a>QPainter::font () const
991</h3>
992
993<p> Returns the currently set painter font.
994<p> <p>See also <a href="#setFont">setFont</a>() and <a href="qfont.html">QFont</a>.
995
996<p>Example: <a href="fileiconview-example.html#x861">fileiconview/qfileiconview.cpp</a>.
997<h3 class=fn><a href="qfontinfo.html">QFontInfo</a> <a name="fontInfo"></a>QPainter::fontInfo () const
998</h3>
999Returns the font info for the painter, if the painter is active.
1000It is not possible to obtain font information for an inactive
1001painter, so the return value is undefined if the painter is not
1002active.
1003<p> <p>See also <a href="#fontMetrics">fontMetrics</a>() and <a href="#isActive">isActive</a>().
1004
1005<h3 class=fn><a href="qfontmetrics.html">QFontMetrics</a> <a name="fontMetrics"></a>QPainter::fontMetrics () const
1006</h3>
1007Returns the font metrics for the painter, if the painter is
1008active. It is not possible to obtain metrics for an inactive
1009painter, so the return value is undefined if the painter is not
1010active.
1011<p> <p>See also <a href="#fontInfo">fontInfo</a>() and <a href="#isActive">isActive</a>().
1012
1013<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>.
1014<h3 class=fn>HDC <a name="handle"></a>QPainter::handle () const
1015</h3>
1016
1017<p> Returns the platform-dependent handle used for drawing. Using this
1018function is not portable.
1019
1020<h3 class=fn>bool <a name="hasClipping"></a>QPainter::hasClipping () const
1021</h3>
1022
1023<p> Returns TRUE if clipping has been set; otherwise returns FALSE.
1024<p> <p>See also <a href="#setClipping">setClipping</a>().
1025
1026<p>Example: <a href="themes-example.html#x217">themes/wood.cpp</a>.
1027<h3 class=fn>bool <a name="hasViewXForm"></a>QPainter::hasViewXForm () const
1028</h3>
1029
1030<p> Returns TRUE if view transformation is enabled; otherwise returns
1031FALSE.
1032<p> <p>See also <a href="#setViewXForm">setViewXForm</a>() and <a href="#xForm">xForm</a>().
1033
1034<h3 class=fn>bool <a name="hasWorldXForm"></a>QPainter::hasWorldXForm () const
1035</h3>
1036
1037<p> Returns TRUE if world transformation is enabled; otherwise returns
1038FALSE.
1039<p> <p>See also <a href="#setWorldXForm">setWorldXForm</a>().
1040
1041<h3 class=fn>bool <a name="isActive"></a>QPainter::isActive () const
1042</h3>
1043
1044<p> Returns TRUE if the painter is active painting, i.e. <a href="#begin">begin</a>() has
1045been called and <a href="#end">end</a>() has not yet been called; otherwise returns
1046FALSE.
1047<p> <p>See also <a href="qpaintdevice.html#paintingActive">QPaintDevice::paintingActive</a>().
1048
1049<p>Examples: <a href="desktop-example.html#x1739">desktop/desktop.cpp</a> and <a href="helpviewer-example.html#x1002">helpviewer/helpwindow.cpp</a>.
1050<h3 class=fn>void <a name="lineTo"></a>QPainter::lineTo ( int&nbsp;x, int&nbsp;y )
1051</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1052<p> Use <a href="#drawLine">drawLine</a>() instead.
1053<p> Draws a line from the current pen position to <em>(x, y)</em> and sets
1054<em>(x, y)</em> to be the new current pen position.
1055<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>().
1056
1057<h3 class=fn>void <a name="lineTo-2"></a>QPainter::lineTo ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
1058</h3>
1059This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1060<p> Draws a line to the point <em>p</em>.
1061
1062<h3 class=fn>void <a name="moveTo"></a>QPainter::moveTo ( int&nbsp;x, int&nbsp;y )
1063</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1064<p> Sets the current pen position to <em>(x, y)</em>
1065<p> <p>See also <a href="#lineTo">lineTo</a>() and <a href="#pos">pos</a>().
1066
1067<h3 class=fn>void <a name="moveTo-2"></a>QPainter::moveTo ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
1068</h3>
1069This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1070<p> Moves to the point <em>p</em>.
1071
1072<h3 class=fn>const&nbsp;<a href="qpen.html">QPen</a>&nbsp;&amp; <a name="pen"></a>QPainter::pen () const
1073</h3>
1074
1075<p> Returns the painter's current pen.
1076<p> <p>See also <a href="#setPen">setPen</a>().
1077
1078<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>.
1079<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="pos"></a>QPainter::pos () const
1080</h3>
1081<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1082<p> Returns the current position of the pen.
1083<p> <p>See also <a href="#moveTo">moveTo</a>().
1084
1085<h3 class=fn><a href="qt.html#RasterOp-enum">RasterOp</a> <a name="rasterOp"></a>QPainter::rasterOp () const
1086</h3>
1087
1088<p> Returns the current <a href="qt.html#RasterOp-enum">raster operation</a>.
1089<p> <p>See also <a href="#setRasterOp">setRasterOp</a>() and <a href="qt.html#RasterOp-enum">RasterOp</a>.
1090
1091<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>
1092</h3>
1093Redirects all paint commands for a paint device, <em>pdev</em>, to
1094another paint device, <em>replacement</em>, unless <em>replacement</em> is 0.
1095If <em>replacement</em> is 0, the redirection for <em>pdev</em> is removed.
1096<p> In general, you'll probably find calling <a href="qpixmap.html#grabWidget">QPixmap::grabWidget</a>() or
1097<a href="qpixmap.html#grabWindow">QPixmap::grabWindow</a>() is an easier solution.
1098
1099<h3 class=fn>void <a name="resetXForm"></a>QPainter::resetXForm ()
1100</h3>
1101Resets any transformations that were made using <a href="#translate">translate</a>(), <a href="#scale">scale</a>(),
1102<a href="#shear">shear</a>(), <a href="#rotate">rotate</a>(), <a href="#setWorldMatrix">setWorldMatrix</a>(), <a href="#setViewport">setViewport</a>() and
1103<a href="#setWindow">setWindow</a>().
1104<p> <p>See also <a href="#worldMatrix">worldMatrix</a>(), <a href="#viewport">viewport</a>(), and <a href="#window">window</a>().
1105
1106<h3 class=fn>void <a name="restore"></a>QPainter::restore ()
1107</h3>
1108Restores the current painter state (pops a saved state off the
1109stack).
1110<p> <p>See also <a href="#save">save</a>().
1111
1112<p>Example: <a href="coordsys.html#x2273">aclock/aclock.cpp</a>.
1113<h3 class=fn>void <a name="restoreWorldMatrix"></a>QPainter::restoreWorldMatrix ()
1114</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1115<p> We recommend using <a href="#restore">restore</a>() instead.
1116
1117<h3 class=fn>void <a name="rotate"></a>QPainter::rotate ( double&nbsp;a )
1118</h3>
1119Rotates the coordinate system <em>a</em> degrees counterclockwise.
1120<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>().
1121
1122<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>.
1123<h3 class=fn>void <a name="save"></a>QPainter::save ()
1124</h3>
1125Saves the current painter state (pushes the state onto a stack). A
1126<a href="#save">save</a>() must be followed by a corresponding <a href="#restore">restore</a>(). <a href="#end">end</a>()
1127unwinds the stack.
1128<p> <p>See also <a href="#restore">restore</a>().
1129
1130<p>Example: <a href="coordsys.html#x2275">aclock/aclock.cpp</a>.
1131<h3 class=fn>void <a name="saveWorldMatrix"></a>QPainter::saveWorldMatrix ()
1132</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1133<p> We recommend using <a href="#save">save</a>() instead.
1134
1135<h3 class=fn>void <a name="scale"></a>QPainter::scale ( double&nbsp;sx, double&nbsp;sy )
1136</h3>
1137Scales the coordinate system by <em>(sx, sy)</em>.
1138<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>().
1139
1140<p>Example: <a href="xform-example.html#x1239">xform/xform.cpp</a>.
1141<h3 class=fn>void <a name="setBackgroundColor"></a>QPainter::setBackgroundColor ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;c )
1142</h3>
1143Sets the background color of the painter to <em>c</em>.
1144<p> The background color is the color that is filled in when drawing
1145opaque text, stippled lines and bitmaps. The background color has
1146no effect in transparent background mode (which is the default).
1147<p> <p>See also <a href="#backgroundColor">backgroundColor</a>(), <a href="#setBackgroundMode">setBackgroundMode</a>(), and <a href="qt.html#BackgroundMode-enum">BackgroundMode</a>.
1148
1149<h3 class=fn>void <a name="setBackgroundMode"></a>QPainter::setBackgroundMode ( <a href="qt.html#BGMode-enum">BGMode</a>&nbsp;m )
1150</h3>
1151Sets the background mode of the painter to <em>m</em>, which must be
1152either <a href="qt.html#BGMode-enum">TransparentMode</a> (the default) or <a href="qt.html#BGMode-enum">OpaqueMode</a>.
1153<p> Transparent mode draws stippled lines and text without setting the
1154background pixels. Opaque mode fills these space with the current
1155background color.
1156<p> Note that in order to draw a bitmap or pixmap transparently, you
1157must use <a href="qpixmap.html#setMask">QPixmap::setMask</a>().
1158<p> <p>See also <a href="#backgroundMode">backgroundMode</a>() and <a href="#setBackgroundColor">setBackgroundColor</a>().
1159
1160<p>Example: <a href="picture-example.html#x119">picture/picture.cpp</a>.
1161<h3 class=fn>void <a name="setBrush"></a>QPainter::setBrush ( <a href="qt.html#BrushStyle-enum">BrushStyle</a>&nbsp;style )
1162</h3>
1163Sets the painter's brush to black color and the specified <em>style</em>.
1164<p> <p>See also <a href="#brush">brush</a>() and <a href="qbrush.html">QBrush</a>.
1165
1166<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>.
1167<h3 class=fn>void <a name="setBrush-2"></a>QPainter::setBrush ( const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;brush )
1168</h3>
1169This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1170<p> Sets the painter's brush to <em>brush</em>.
1171<p> The <em>brush</em> defines how shapes are filled.
1172<p> <p>See also <a href="#brush">brush</a>().
1173
1174<h3 class=fn>void <a name="setBrush-3"></a>QPainter::setBrush ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;color )
1175</h3>
1176This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1177<p> Sets the painter's brush to have style <a href="qt.html#BrushStyle-enum">SolidPattern</a> and the
1178specified <em>color</em>.
1179<p> <p>See also <a href="#brush">brush</a>() and <a href="qbrush.html">QBrush</a>.
1180
1181<h3 class=fn>void <a name="setBrushOrigin"></a>QPainter::setBrushOrigin ( int&nbsp;x, int&nbsp;y )
1182</h3>
1183Sets the brush origin to <em>(x, y)</em>.
1184<p> The brush origin specifies the (0, 0) coordinate of the painter's
1185brush. This setting only applies to pattern brushes and pixmap
1186brushes.
1187<p> <p>See also <a href="#brushOrigin">brushOrigin</a>().
1188
1189<h3 class=fn>void <a name="setBrushOrigin-2"></a>QPainter::setBrushOrigin ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p )
1190</h3>
1191This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1192<p> Sets the brush origin to point <em>p</em>.
1193
1194<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 )
1195</h3>
1196
1197<p> Sets the clip region to the rectangle <em>x</em>, <em>y</em>, <em>w</em>, <em>h</em> and
1198enables clipping. The clip mode is set to <em>m</em>.
1199<p> If <em>m</em> is <a href="#CoordinateMode-enum">CoordDevice</a> (the default), the coordinates given for
1200the clip region are taken to be physical device coordinates and
1201are <em>not</em> subject to any <a href="coordsys.html">coordinate
1202 transformations</a>. If <em>m</em> is <a href="#CoordinateMode-enum">CoordPainter</a>, the
1203coordinates given for the clip region are taken to be model
1204coordinates.
1205<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>.
1206
1207<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>.
1208<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 )
1209</h3>
1210This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1211<p> Sets the clip region to the rectangle <em>r</em> and enables clipping.
1212The clip mode is set to <em>m</em>.
1213<p> <p>See also <a href="#CoordinateMode-enum">CoordinateMode</a>.
1214
1215<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 )
1216</h3>
1217Sets the clip region to <em>rgn</em> and enables clipping. The clip mode
1218is set to <em>m</em>.
1219<p> Note that the clip region is given in physical device coordinates
1220and <em>not</em> subject to any <a href="coordsys.html">coordinate
1221 transformation.</a>
1222<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>.
1223
1224<p>Examples: <a href="qfd-example.html#x1999">qfd/fontdisplayer.cpp</a> and <a href="themes-example.html#x220">themes/wood.cpp</a>.
1225<h3 class=fn>void <a name="setClipping"></a>QPainter::setClipping ( bool&nbsp;enable )
1226</h3>
1227Enables clipping if <em>enable</em> is TRUE, or disables clipping if <em>enable</em> is FALSE.
1228<p> <p>See also <a href="#hasClipping">hasClipping</a>(), <a href="#setClipRect">setClipRect</a>(), and <a href="#setClipRegion">setClipRegion</a>().
1229
1230<p>Example: <a href="themes-example.html#x221">themes/wood.cpp</a>.
1231<h3 class=fn>void <a name="setFont"></a>QPainter::setFont ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )
1232</h3>
1233Sets the painter's font to <em>font</em>.
1234<p> This font is used by subsequent <a href="#drawText">drawText</a>() functions. The text
1235color is the same as the pen color.
1236<p> <p>See also <a href="#font">font</a>() and <a href="#drawText">drawText</a>().
1237
1238<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>.
1239<h3 class=fn>void <a name="setPen"></a>QPainter::setPen ( const&nbsp;<a href="qpen.html">QPen</a>&nbsp;&amp;&nbsp;pen )
1240</h3>
1241Sets a new painter pen.
1242<p> The <em>pen</em> defines how to draw lines and outlines, and it also
1243defines the text color.
1244<p> <p>See also <a href="#pen">pen</a>().
1245
1246<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>.
1247<h3 class=fn>void <a name="setPen-2"></a>QPainter::setPen ( <a href="qt.html#PenStyle-enum">PenStyle</a>&nbsp;style )
1248</h3>
1249This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1250<p> Sets the painter's pen to have style <em>style</em>, width 0 and black
1251color.
1252<p> <p>See also <a href="#pen">pen</a>() and <a href="qpen.html">QPen</a>.
1253
1254<h3 class=fn>void <a name="setPen-3"></a>QPainter::setPen ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;color )
1255</h3>
1256This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1257<p> Sets the painter's pen to have style <a href="qt.html#PenStyle-enum">SolidLine</a>, width 0 and the
1258specified <em>color</em>.
1259<p> <p>See also <a href="#pen">pen</a>() and <a href="qpen.html">QPen</a>.
1260
1261<h3 class=fn>void <a name="setRasterOp"></a>QPainter::setRasterOp ( <a href="qt.html#RasterOp-enum">RasterOp</a>&nbsp;r )
1262</h3>
1263Sets the <a href="qt.html#RasterOp-enum">raster operation</a> to <em>r</em>.
1264The default is <a href="qt.html#RasterOp-enum">CopyROP</a>.
1265<p> <p>See also <a href="#rasterOp">rasterOp</a>() and <a href="qt.html#RasterOp-enum">Qt::RasterOp</a>.
1266
1267<h3 class=fn>void <a name="setTabArray"></a>QPainter::setTabArray ( int&nbsp;*&nbsp;ta )
1268</h3>
1269Sets the tab stop array to <em>ta</em>. This puts tab stops at <em>ta[0]</em>,
1270<em>ta[1]</em> and so on. The array is null-terminated.
1271<p> If both a tab array and a tab top size is set, the tab array wins.
1272<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>().
1273
1274<h3 class=fn>void <a name="setTabStops"></a>QPainter::setTabStops ( int&nbsp;ts )
1275</h3>
1276Set the tab stop width to <em>ts</em>, i.e. locates tab stops at <em>ts</em>,
12772*<em>ts</em>, 3*<em>ts</em> and so on.
1278<p> Tab stops are used when drawing formatted text with <a href="qt.html#TextFlags-enum">ExpandTabs</a>
1279set. This fixed tab stop value is used only if no tab array is set
1280(which is the default case).
1281<p> A value of 0 (the default) implies a tabstop setting of 8 times the width of the
1282character 'x' in the font currently set on the painter.
1283<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>().
1284
1285<h3 class=fn>void <a name="setViewXForm"></a>QPainter::setViewXForm ( bool&nbsp;enable )
1286</h3>
1287Enables view transformations if <em>enable</em> is TRUE, or disables
1288view transformations if <em>enable</em> is FALSE.
1289<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>().
1290
1291<h3 class=fn>void <a name="setViewport"></a>QPainter::setViewport ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
1292</h3>
1293Sets the viewport rectangle view transformation for the painter
1294and enables view transformation.
1295<p> The viewport rectangle is part of the view transformation. The
1296viewport specifies the device coordinate system and is specified
1297by the <em>x</em>, <em>y</em>, <em>w</em> width and <em>h</em> height parameters. Its
1298sister, the <a href="#window">window</a>(), specifies the logical coordinate system.
1299<p> The default viewport rectangle is the same as the device's
1300rectangle. See the <a href="coordsys.html">Coordinate System Overview</a> for an overview of coordinate transformation.
1301<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>().
1302
1303<p>Example: <a href="coordsys.html#x2276">aclock/aclock.cpp</a>.
1304<h3 class=fn>void <a name="setViewport-2"></a>QPainter::setViewport ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
1305</h3>
1306This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1307<p> Sets the painter's viewport to rectangle <em>r</em>.
1308
1309<h3 class=fn>void <a name="setWindow"></a>QPainter::setWindow ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h )
1310</h3>
1311Sets the window rectangle view transformation for the painter and
1312enables view transformation.
1313<p> The window rectangle is part of the view transformation. The
1314window specifies the logical coordinate system and is specified by
1315the <em>x</em>, <em>y</em>, <em>w</em> width and <em>h</em> height parameters. Its sister,
1316the <a href="#viewport">viewport</a>(), specifies the device coordinate system.
1317<p> The default window rectangle is the same as the device's
1318rectangle. See the <a href="coordsys.html">Coordinate System Overview</a> for an overview of coordinate transformation.
1319<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>().
1320
1321<p>Examples: <a href="coordsys.html#x2277">aclock/aclock.cpp</a> and <a href="drawdemo-example.html#x1077">drawdemo/drawdemo.cpp</a>.
1322<h3 class=fn>void <a name="setWindow-2"></a>QPainter::setWindow ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )
1323</h3>
1324This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1325<p> Sets the painter's window to rectangle <em>r</em>.
1326
1327<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 )
1328</h3>
1329Sets the world <a href="qwmatrix.html#TransformationMode">transformation matrix</a> to <em>m</em> and enables world
1330transformation.
1331<p> If <em>combine</em> is TRUE, then <em>m</em> is combined with the current
1332transformation matrix, otherwise <em>m</em> replaces the current
1333transformation matrix.
1334<p> If <em>m</em> is the identity matrix and <em>combine</em> is FALSE, this
1335function calls <a href="#setWorldXForm">setWorldXForm</a>(FALSE). (The identity matrix is the
1336matrix where <a href="qwmatrix.html#m11">QWMatrix::m11</a>() and <a href="qwmatrix.html#m22">QWMatrix::m22</a>() are 1.0 and the
1337rest are 0.0.)
1338<p> World transformations are applied after the view transformations
1339(i.e. <a href="#setWindow">window</a> and <a href="#setViewport">viewport</a>).
1340<p> The following functions can transform the coordinate system without using
1341a QWMatrix:
1342<ul>
1343<li> <a href="#translate">translate</a>()
1344<li> <a href="#scale">scale</a>()
1345<li> <a href="#shear">shear</a>()
1346<li> <a href="#rotate">rotate</a>()
1347</ul>
1348<p> They operate on the painter's <a href="#worldMatrix">worldMatrix</a>() and are implemented like this:
1349<p> <pre>
1350 void QPainter::rotate( double a )
1351 {
1352 <a href="qwmatrix.html">QWMatrix</a> m;
1353 m.<a href="qwmatrix.html#rotate">rotate</a>( a );
1354 <a href="#setWorldMatrix">setWorldMatrix</a>( m, TRUE );
1355 }
1356 </pre>
1357
1358<p> Note that you should always use <em>combine</em> when you are drawing
1359into a <a href="qpicture.html">QPicture</a>. Otherwise it may not be possible to replay the
1360picture with additional transformations. Using translate(),
1361scale(), etc., is safe.
1362<p> For a brief overview of coordinate transformation, see the <a href="coordsys.html">Coordinate System Overview.</a>
1363<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>.
1364
1365<p>Examples: <a href="drawdemo-example.html#x1078">drawdemo/drawdemo.cpp</a> and <a href="xform-example.html#x1242">xform/xform.cpp</a>.
1366<h3 class=fn>void <a name="setWorldXForm"></a>QPainter::setWorldXForm ( bool&nbsp;enable )
1367</h3>
1368Enables world transformations if <em>enable</em> is TRUE, or disables
1369world transformations if <em>enable</em> is FALSE. The world
1370<a href="qwmatrix.html#TransformationMode">transformation matrix</a> is not changed.
1371<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>().
1372
1373<h3 class=fn>void <a name="shear"></a>QPainter::shear ( double&nbsp;sh, double&nbsp;sv )
1374</h3>
1375Shears the coordinate system by <em>(sh, sv)</em>.
1376<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>().
1377
1378<h3 class=fn>int * <a name="tabArray"></a>QPainter::tabArray () const
1379</h3>
1380
1381<p> Returns the currently set tab stop array.
1382<p> <p>See also <a href="#setTabArray">setTabArray</a>().
1383
1384<h3 class=fn>int <a name="tabStops"></a>QPainter::tabStops () const
1385</h3>
1386
1387<p> Returns the tab stop setting.
1388<p> <p>See also <a href="#setTabStops">setTabStops</a>().
1389
1390<h3 class=fn>void <a name="translate"></a>QPainter::translate ( double&nbsp;dx, double&nbsp;dy )
1391</h3>
1392Translates the coordinate system by <em>(dx, dy)</em>. After this call,
1393<em>(dx, dy)</em> is added to points.
1394<p> For example, the following code draws the same point twice:
1395<pre>
1396 void MyWidget::paintEvent()
1397 {
1398 QPainter paint( this );
1399
1400 paint.<a href="#drawPoint">drawPoint</a>( 0, 0 );
1401
1402 paint.<a href="#translate">translate</a>( 100.0, 40.0 );
1403 paint.<a href="#drawPoint">drawPoint</a>( -100, -40 );
1404 }
1405 </pre>
1406
1407<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>().
1408
1409<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>.
1410<h3 class=fn><a href="qrect.html">QRect</a> <a name="viewport"></a>QPainter::viewport () const
1411</h3>
1412Returns the viewport rectangle.
1413<p> <p>See also <a href="#setViewport">setViewport</a>() and <a href="#setViewXForm">setViewXForm</a>().
1414
1415<p>Example: <a href="coordsys.html#x2278">aclock/aclock.cpp</a>.
1416<h3 class=fn><a href="qrect.html">QRect</a> <a name="window"></a>QPainter::window () const
1417</h3>
1418Returns the window rectangle.
1419<p> <p>See also <a href="#setWindow">setWindow</a>() and <a href="#setViewXForm">setViewXForm</a>().
1420
1421<h3 class=fn>const&nbsp;<a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp; <a name="worldMatrix"></a>QPainter::worldMatrix () const
1422</h3>
1423Returns the world <a href="qwmatrix.html#TransformationMode">transformation matrix</a>.
1424<p> <p>See also <a href="#setWorldMatrix">setWorldMatrix</a>().
1425
1426<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
1427</h3>
1428Returns the point <em>pv</em> transformed from model coordinates to
1429device coordinates.
1430<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
1431
1432<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
1433</h3>
1434This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1435<p> Returns the rectangle <em>rv</em> transformed from model coordinates to
1436device coordinates.
1437<p> If world transformation is enabled and rotation or shearing has
1438been specified, then the bounding rectangle is returned.
1439<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
1440
1441<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
1442</h3>
1443This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1444<p> Returns the point array <em>av</em> transformed from model coordinates
1445to device coordinates.
1446<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
1447
1448<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
1449</h3>
1450This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1451<p> Returns the point array <em>av</em> transformed from model coordinates
1452to device coordinates. The <em>index</em> is the first point in the
1453array and <em>npoints</em> denotes the number of points to be
1454transformed. If <em>npoints</em> is negative, all points from <em>av[index]</em> until the last point in the array are transformed.
1455<p> The returned point array consists of the number of points that
1456were transformed.
1457<p> Example:
1458<pre>
1459 <a href="qpointarray.html">QPointArray</a> a(10);
1460 <a href="qpointarray.html">QPointArray</a> b;
1461 b = painter.xForm(a, 2, 4); // b.<a href="qmemarray.html#size">size</a>() == 4
1462 b = painter.xForm(a, 2, -1); // b.<a href="qmemarray.html#size">size</a>() == 8
1463 </pre>
1464
1465<p> <p>See also <a href="#xFormDev">xFormDev</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
1466
1467<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
1468</h3>
1469Returns the rectangle <em>rd</em> transformed from device coordinates to
1470model coordinates.
1471<p> If world transformation is enabled and rotation or shearing is
1472used, then the bounding rectangle is returned.
1473<p> <p>See also <a href="#xForm">xForm</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
1474
1475<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
1476</h3>
1477This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1478<p> Returns the point <em>pd</em> transformed from device coordinates to
1479model coordinates.
1480<p> <p>See also <a href="#xForm">xForm</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
1481
1482<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
1483</h3>
1484This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1485<p> Returns the point array <em>ad</em> transformed from device coordinates
1486to model coordinates.
1487<p> <p>See also <a href="#xForm">xForm</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
1488
1489<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
1490</h3>
1491This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1492<p> Returns the point array <em>ad</em> transformed from device coordinates
1493to model coordinates. The <em>index</em> is the first point in the array
1494and <em>npoints</em> denotes the number of points to be transformed. If
1495<em>npoints</em> is negative, all points from <em>ad[index]</em> until the
1496last point in the array are transformed.
1497<p> The returned point array consists of the number of points that
1498were transformed.
1499<p> Example:
1500<pre>
1501 <a href="qpointarray.html">QPointArray</a> a(10);
1502 <a href="qpointarray.html">QPointArray</a> b;
1503 b = painter.xFormDev(a, 1, 3); // b.<a href="qmemarray.html#size">size</a>() == 3
1504 b = painter.xFormDev(a, 1, -1); // b.<a href="qmemarray.html#size">size</a>() == 9
1505 </pre>
1506
1507<p> <p>See also <a href="#xForm">xForm</a>() and <a href="qwmatrix.html#map">QWMatrix::map</a>().
1508
1509<hr><h2>Related Functions</h2>
1510<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 )
1511</h3>
1512
1513<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
1514<p> Draws the plain rectangle specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>)
1515using the painter <em>p</em>.
1516<p> The color argument <em>c</em> specifies the line color.
1517<p> The <em>lineWidth</em> argument specifies the line width.
1518<p> The rectangle's interior is filled with the <em>fill</em> brush unless
1519<em>fill</em> is 0.
1520<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
1521display a plain rectangle, for example <tt>QFrame::setFrameStyle( QFrame::Box | QFrame::Plain )</tt>.
1522<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
1523<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
1524widgets that follow the current GUI style.
1525<p> <p>See also <a href="#qDrawShadeRect">qDrawShadeRect</a>() and <a href="qstyle.html#drawPrimitive">QStyle::drawPrimitive</a>().
1526
1527<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 )
1528</h3>
1529
1530<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
1531<p> Draws a horizontal (<em>y1</em> == <em>y2</em>) or vertical (<em>x1</em> == <em>x2</em>)
1532shaded line using the painter <em>p</em>.
1533<p> Nothing is drawn if <em>y1</em> != <em>y2</em> and <em>x1</em> != <em>x2</em> (i.e. the
1534line is neither horizontal nor vertical).
1535<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).
1536<p> The line appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
1537<p> The <em>lineWidth</em> argument specifies the line width for each of the
1538lines. It is not the total line width.
1539<p> The <em>midLineWidth</em> argument specifies the width of a middle line
1540drawn in the <a href="qcolorgroup.html#mid">QColorGroup::mid</a>() color.
1541<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
1542display a shaded line, for example <tt>QFrame::setFrameStyle( QFrame::HLine | QFrame::Sunken )</tt>.
1543<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
1544<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
1545widgets that follow the current GUI style.
1546<p> <p>See also <a href="#qDrawShadeRect">qDrawShadeRect</a>(), <a href="#qDrawShadePanel">qDrawShadePanel</a>(), and <a href="qstyle.html#drawPrimitive">QStyle::drawPrimitive</a>().
1547
1548<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 )
1549</h3>
1550
1551<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
1552<p> Draws the shaded panel specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>) using
1553the painter <em>p</em>.
1554<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).
1555<p> The panel appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
1556<p> The <em>lineWidth</em> argument specifies the line width.
1557<p> The panel's interior is filled with the <em>fill</em> brush unless <em>fill</em> is 0.
1558<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
1559display a shaded panel, for example <tt>QFrame::setFrameStyle( QFrame::Panel | QFrame::Sunken )</tt>.
1560<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
1561<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
1562widgets that follow the current GUI style.
1563<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>().
1564
1565<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 )
1566</h3>
1567
1568<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
1569<p> Draws the shaded rectangle specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>)
1570using the painter <em>p</em>.
1571<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).
1572<p> The rectangle appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
1573<p> The <em>lineWidth</em> argument specifies the line width for each of the
1574lines. It is not the total line width.
1575<p> The <em>midLineWidth</em> argument specifies the width of a middle line
1576drawn in the <a href="qcolorgroup.html#mid">QColorGroup::mid</a>() color.
1577<p> The rectangle's interior is filled with the <em>fill</em> brush unless
1578<em>fill</em> is 0.
1579<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
1580display a shaded rectangle, for example <tt>QFrame::setFrameStyle( QFrame::Box | QFrame::Raised )</tt>.
1581<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
1582<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
1583widgets that follow the current GUI style.
1584<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>().
1585
1586<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 )
1587</h3>
1588
1589<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
1590<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>.
1591<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).
1592<p> The button appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
1593<p> The line width is 2 pixels.
1594<p> The button's interior is filled with the <em>*fill</em> brush unless <em>fill</em> is 0.
1595<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
1596<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
1597widgets that follow the current GUI style.
1598<p> <p>See also <a href="#qDrawWinPanel">qDrawWinPanel</a>() and <a href="qstyle.html#drawControl">QStyle::drawControl</a>().
1599
1600<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 )
1601</h3>
1602
1603<p> <tt>#include &lt;qdrawutil.h&gt;</tt>
1604<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>.
1605<p> The color group argument <em>g</em> specifies the shading colors.
1606<p> The panel appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
1607<p> The line width is 2 pixels.
1608<p> The button's interior is filled with the <em>fill</em> brush unless <em>fill</em> is 0.
1609<p> If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it
1610display a shaded panel, for example <tt>QFrame::setFrameStyle( QFrame::WinPanel | QFrame::Raised )</tt>.
1611<p> <b>Warning:</b> This function does not look at <a href="qwidget.html#style">QWidget::style</a>() or
1612<a href="qapplication.html#style">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
1613widgets that follow the current GUI style.
1614<p> <p>See also <a href="#qDrawShadePanel">qDrawShadePanel</a>(), <a href="#qDrawWinButton">qDrawWinButton</a>(), and <a href="qstyle.html#drawPrimitive">QStyle::drawPrimitive</a>().
1615
1616<!-- eof -->
1617<hr><p>
1618This file is part of the <a href="index.html">Qt toolkit</a>.
1619Copyright &copy; 1995-2007
1620<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
1621<table width=100% cellspacing=0 border=0><tr>
1622<td>Copyright &copy; 2007
1623<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
1624<td align=right><div align=right>Qt 3.3.8</div>
1625</table></div></address></body>
1626</html>
Note: See TracBrowser for help on using the repository browser.