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"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { 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 Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main 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 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 <<a href="qpainter-h.html">qpainter.h</a>></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 QPaintDevice * pd, bool unclipped = FALSE )</li>
|
---|
45 | <li class=fn><a href="#QPainter-3"><b>QPainter</b></a> ( const QPaintDevice * pd, const QWidget * copyAttributes, bool 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 QPaintDevice * pd, bool unclipped = FALSE )</li>
|
---|
48 | <li class=fn>bool <a href="#begin-2"><b>begin</b></a> ( const QPaintDevice * pd, const QWidget * copyAttributes, bool 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 QRegion & region, CoordinateMode 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 & <a href="#font"><b>font</b></a> () const</li>
|
---|
59 | <li class=fn>void <a href="#setFont"><b>setFont</b></a> ( const QFont & font )</li>
|
---|
60 | <li class=fn>const QPen & <a href="#pen"><b>pen</b></a> () const</li>
|
---|
61 | <li class=fn>void <a href="#setPen"><b>setPen</b></a> ( const QPen & pen )</li>
|
---|
62 | <li class=fn>void <a href="#setPen-2"><b>setPen</b></a> ( PenStyle style )</li>
|
---|
63 | <li class=fn>void <a href="#setPen-3"><b>setPen</b></a> ( const QColor & color )</li>
|
---|
64 | <li class=fn>const QBrush & <a href="#brush"><b>brush</b></a> () const</li>
|
---|
65 | <li class=fn>void <a href="#setBrush-2"><b>setBrush</b></a> ( const QBrush & brush )</li>
|
---|
66 | <li class=fn>void <a href="#setBrush"><b>setBrush</b></a> ( BrushStyle style )</li>
|
---|
67 | <li class=fn>void <a href="#setBrush-3"><b>setBrush</b></a> ( const QColor & color )</li>
|
---|
68 | <li class=fn>QPoint pos () const <em>(obsolete)</em></li>
|
---|
69 | <li class=fn>const QColor & <a href="#backgroundColor"><b>backgroundColor</b></a> () const</li>
|
---|
70 | <li class=fn>void <a href="#setBackgroundColor"><b>setBackgroundColor</b></a> ( const QColor & 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 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 r )</li>
|
---|
75 | <li class=fn>const QPoint & <a href="#brushOrigin"><b>brushOrigin</b></a> () const</li>
|
---|
76 | <li class=fn>void <a href="#setBrushOrigin"><b>setBrushOrigin</b></a> ( int x, int y )</li>
|
---|
77 | <li class=fn>void <a href="#setBrushOrigin-2"><b>setBrushOrigin</b></a> ( const QPoint & 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 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 QRect & r )</li>
|
---|
83 | <li class=fn>void <a href="#setWindow"><b>setWindow</b></a> ( int x, int y, int w, int 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 QRect & r )</li>
|
---|
86 | <li class=fn>void <a href="#setViewport"><b>setViewport</b></a> ( int x, int y, int w, int h )</li>
|
---|
87 | <li class=fn>void <a href="#setWorldXForm"><b>setWorldXForm</b></a> ( bool enable )</li>
|
---|
88 | <li class=fn>const QWMatrix & <a href="#worldMatrix"><b>worldMatrix</b></a> () const</li>
|
---|
89 | <li class=fn>void <a href="#setWorldMatrix"><b>setWorldMatrix</b></a> ( const QWMatrix & m, bool combine = FALSE )</li>
|
---|
90 | <li class=fn>void saveWorldMatrix () <em>(obsolete)</em></li>
|
---|
91 | <li class=fn>void restoreWorldMatrix () <em>(obsolete)</em></li>
|
---|
92 | <li class=fn>void <a href="#scale"><b>scale</b></a> ( double sx, double sy )</li>
|
---|
93 | <li class=fn>void <a href="#shear"><b>shear</b></a> ( double sh, double sv )</li>
|
---|
94 | <li class=fn>void <a href="#rotate"><b>rotate</b></a> ( double a )</li>
|
---|
95 | <li class=fn>void <a href="#translate"><b>translate</b></a> ( double dx, double 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 QPoint & pv ) const</li>
|
---|
98 | <li class=fn>QRect <a href="#xForm-2"><b>xForm</b></a> ( const QRect & rv ) const</li>
|
---|
99 | <li class=fn>QPointArray <a href="#xForm-3"><b>xForm</b></a> ( const QPointArray & av ) const</li>
|
---|
100 | <li class=fn>QPointArray <a href="#xForm-4"><b>xForm</b></a> ( const QPointArray & av, int index, int npoints ) const</li>
|
---|
101 | <li class=fn>QPoint <a href="#xFormDev-2"><b>xFormDev</b></a> ( const QPoint & pd ) const</li>
|
---|
102 | <li class=fn>QRect <a href="#xFormDev"><b>xFormDev</b></a> ( const QRect & rd ) const</li>
|
---|
103 | <li class=fn>QPointArray <a href="#xFormDev-3"><b>xFormDev</b></a> ( const QPointArray & ad ) const</li>
|
---|
104 | <li class=fn>QPointArray <a href="#xFormDev-4"><b>xFormDev</b></a> ( const QPointArray & ad, int index, int npoints ) const</li>
|
---|
105 | <li class=fn>void <a href="#setClipping"><b>setClipping</b></a> ( bool 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 m = CoordDevice ) const</li>
|
---|
108 | <li class=fn>void <a href="#setClipRect-2"><b>setClipRect</b></a> ( const QRect & r, CoordinateMode m = CoordDevice )</li>
|
---|
109 | <li class=fn>void <a href="#setClipRect"><b>setClipRect</b></a> ( int x, int y, int w, int h, CoordinateMode m = CoordDevice )</li>
|
---|
110 | <li class=fn>void <a href="#setClipRegion"><b>setClipRegion</b></a> ( const QRegion & rgn, CoordinateMode m = CoordDevice )</li>
|
---|
111 | <li class=fn>void <a href="#drawPoint"><b>drawPoint</b></a> ( int x, int y )</li>
|
---|
112 | <li class=fn>void <a href="#drawPoint-2"><b>drawPoint</b></a> ( const QPoint & p )</li>
|
---|
113 | <li class=fn>void <a href="#drawPoints"><b>drawPoints</b></a> ( const QPointArray & a, int index = 0, int npoints = -1 )</li>
|
---|
114 | <li class=fn>void moveTo ( int x, int y ) <em>(obsolete)</em></li>
|
---|
115 | <li class=fn>void moveTo ( const QPoint & p ) <em>(obsolete)</em></li>
|
---|
116 | <li class=fn>void lineTo ( int x, int y ) <em>(obsolete)</em></li>
|
---|
117 | <li class=fn>void lineTo ( const QPoint & p ) <em>(obsolete)</em></li>
|
---|
118 | <li class=fn>void <a href="#drawLine"><b>drawLine</b></a> ( int x1, int y1, int x2, int y2 )</li>
|
---|
119 | <li class=fn>void <a href="#drawLine-2"><b>drawLine</b></a> ( const QPoint & p1, const QPoint & p2 )</li>
|
---|
120 | <li class=fn>void <a href="#drawRect"><b>drawRect</b></a> ( int x, int y, int w, int h )</li>
|
---|
121 | <li class=fn>void <a href="#drawRect-2"><b>drawRect</b></a> ( const QRect & r )</li>
|
---|
122 | <li class=fn>void <a href="#drawWinFocusRect-2"><b>drawWinFocusRect</b></a> ( int x, int y, int w, int h )</li>
|
---|
123 | <li class=fn>void <a href="#drawWinFocusRect"><b>drawWinFocusRect</b></a> ( int x, int y, int w, int h, const QColor & bgColor )</li>
|
---|
124 | <li class=fn>void <a href="#drawWinFocusRect-3"><b>drawWinFocusRect</b></a> ( const QRect & r )</li>
|
---|
125 | <li class=fn>void <a href="#drawWinFocusRect-4"><b>drawWinFocusRect</b></a> ( const QRect & r, const QColor & bgColor )</li>
|
---|
126 | <li class=fn>void <a href="#drawRoundRect"><b>drawRoundRect</b></a> ( int x, int y, int w, int h, int xRnd = 25, int yRnd = 25 )</li>
|
---|
127 | <li class=fn>void <a href="#drawRoundRect-2"><b>drawRoundRect</b></a> ( const QRect & r, int xRnd = 25, int yRnd = 25 )</li>
|
---|
128 | <li class=fn>void <a href="#drawEllipse"><b>drawEllipse</b></a> ( int x, int y, int w, int h )</li>
|
---|
129 | <li class=fn>void <a href="#drawEllipse-2"><b>drawEllipse</b></a> ( const QRect & r )</li>
|
---|
130 | <li class=fn>void <a href="#drawArc"><b>drawArc</b></a> ( int x, int y, int w, int h, int a, int alen )</li>
|
---|
131 | <li class=fn>void <a href="#drawArc-2"><b>drawArc</b></a> ( const QRect & r, int a, int alen )</li>
|
---|
132 | <li class=fn>void <a href="#drawPie"><b>drawPie</b></a> ( int x, int y, int w, int h, int a, int alen )</li>
|
---|
133 | <li class=fn>void <a href="#drawPie-2"><b>drawPie</b></a> ( const QRect & r, int a, int alen )</li>
|
---|
134 | <li class=fn>void <a href="#drawChord"><b>drawChord</b></a> ( int x, int y, int w, int h, int a, int alen )</li>
|
---|
135 | <li class=fn>void <a href="#drawChord-2"><b>drawChord</b></a> ( const QRect & r, int a, int alen )</li>
|
---|
136 | <li class=fn>void <a href="#drawLineSegments"><b>drawLineSegments</b></a> ( const QPointArray & a, int index = 0, int nlines = -1 )</li>
|
---|
137 | <li class=fn>void <a href="#drawPolyline"><b>drawPolyline</b></a> ( const QPointArray & a, int index = 0, int npoints = -1 )</li>
|
---|
138 | <li class=fn>void <a href="#drawPolygon"><b>drawPolygon</b></a> ( const QPointArray & a, bool winding = FALSE, int index = 0, int npoints = -1 )</li>
|
---|
139 | <li class=fn>void <a href="#drawConvexPolygon"><b>drawConvexPolygon</b></a> ( const QPointArray & pa, int index = 0, int npoints = -1 )</li>
|
---|
140 | <li class=fn>void <a href="#drawCubicBezier"><b>drawCubicBezier</b></a> ( const QPointArray & a, int index = 0 )</li>
|
---|
141 | <li class=fn>void <a href="#drawPixmap"><b>drawPixmap</b></a> ( int x, int y, const QPixmap & pixmap, int sx = 0, int sy = 0, int sw = -1, int sh = -1 )</li>
|
---|
142 | <li class=fn>void <a href="#drawPixmap-2"><b>drawPixmap</b></a> ( const QPoint & p, const QPixmap & pm, const QRect & sr )</li>
|
---|
143 | <li class=fn>void <a href="#drawPixmap-3"><b>drawPixmap</b></a> ( const QPoint & p, const QPixmap & pm )</li>
|
---|
144 | <li class=fn>void <a href="#drawPixmap-4"><b>drawPixmap</b></a> ( const QRect & r, const QPixmap & pm )</li>
|
---|
145 | <li class=fn>void <a href="#drawImage"><b>drawImage</b></a> ( int x, int y, const QImage & image, int sx = 0, int sy = 0, int sw = -1, int sh = -1, int conversionFlags = 0 )</li>
|
---|
146 | <li class=fn>void <a href="#drawImage-2"><b>drawImage</b></a> ( const QPoint &, const QImage &, const QRect & sr, int conversionFlags = 0 )</li>
|
---|
147 | <li class=fn>void <a href="#drawImage-3"><b>drawImage</b></a> ( const QPoint & p, const QImage & i, int conversion_flags = 0 )</li>
|
---|
148 | <li class=fn>void <a href="#drawImage-4"><b>drawImage</b></a> ( const QRect & r, const QImage & i )</li>
|
---|
149 | <li class=fn>void <a href="#drawTiledPixmap"><b>drawTiledPixmap</b></a> ( int x, int y, int w, int h, const QPixmap & pixmap, int sx = 0, int sy = 0 )</li>
|
---|
150 | <li class=fn>void <a href="#drawTiledPixmap-2"><b>drawTiledPixmap</b></a> ( const QRect & r, const QPixmap & pm, const QPoint & sp )</li>
|
---|
151 | <li class=fn>void <a href="#drawTiledPixmap-3"><b>drawTiledPixmap</b></a> ( const QRect & r, const QPixmap & pm )</li>
|
---|
152 | <li class=fn>void drawPicture ( const QPicture & pic ) <em>(obsolete)</em></li>
|
---|
153 | <li class=fn>void <a href="#drawPicture"><b>drawPicture</b></a> ( int x, int y, const QPicture & pic )</li>
|
---|
154 | <li class=fn>void <a href="#drawPicture-3"><b>drawPicture</b></a> ( const QPoint & p, const QPicture & pic )</li>
|
---|
155 | <li class=fn>void <a href="#fillRect"><b>fillRect</b></a> ( int x, int y, int w, int h, const QBrush & brush )</li>
|
---|
156 | <li class=fn>void <a href="#fillRect-2"><b>fillRect</b></a> ( const QRect & r, const QBrush & brush )</li>
|
---|
157 | <li class=fn>void <a href="#eraseRect"><b>eraseRect</b></a> ( int x, int y, int w, int h )</li>
|
---|
158 | <li class=fn>void <a href="#eraseRect-2"><b>eraseRect</b></a> ( const QRect & 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 x, int y, const QString &, int len = -1, TextDirection dir = Auto )</li>
|
---|
161 | <li class=fn>void <a href="#drawText-3"><b>drawText</b></a> ( const QPoint &, const QString &, int len = -1, TextDirection dir = Auto )</li>
|
---|
162 | <li class=fn>void <a href="#drawText-4"><b>drawText</b></a> ( int x, int y, const QString &, int pos, int len, TextDirection dir = Auto )</li>
|
---|
163 | <li class=fn>void <a href="#drawText"><b>drawText</b></a> ( const QPoint & p, const QString &, int pos, int len, TextDirection dir = Auto )</li>
|
---|
164 | <li class=fn>void <a href="#drawText-5"><b>drawText</b></a> ( int x, int y, int w, int h, int flags, const QString &, int len = -1, QRect * br = 0, QTextParag ** internal = 0 )</li>
|
---|
165 | <li class=fn>void <a href="#drawText-6"><b>drawText</b></a> ( const QRect & r, int tf, const QString & str, int len = -1, QRect * brect = 0, QTextParag ** internal = 0 )</li>
|
---|
166 | <li class=fn>QRect <a href="#boundingRect"><b>boundingRect</b></a> ( int x, int y, int w, int h, int flags, const QString &, int len = -1, QTextParag ** intern = 0 )</li>
|
---|
167 | <li class=fn>QRect <a href="#boundingRect-2"><b>boundingRect</b></a> ( const QRect & r, int flags, const QString & str, int len = -1, QTextParag ** 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 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 * 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 * pdev, QPaintDevice * replacement )</li>
|
---|
177 | </ul>
|
---|
178 | <h2>Related Functions</h2>
|
---|
179 | <ul>
|
---|
180 | <li class=fn>void <a href="#qDrawShadeLine"><b>qDrawShadeLine</b></a> ( QPainter * p, int x1, int y1, int x2, int y2, const QColorGroup & g, bool sunken, int lineWidth, int midLineWidth )</li>
|
---|
181 | <li class=fn>void <a href="#qDrawShadeRect"><b>qDrawShadeRect</b></a> ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, int lineWidth, int midLineWidth, const QBrush * fill )</li>
|
---|
182 | <li class=fn>void <a href="#qDrawShadePanel"><b>qDrawShadePanel</b></a> ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, int lineWidth, const QBrush * fill )</li>
|
---|
183 | <li class=fn>void <a href="#qDrawWinButton"><b>qDrawWinButton</b></a> ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, const QBrush * fill )</li>
|
---|
184 | <li class=fn>void <a href="#qDrawWinPanel"><b>qDrawWinPanel</b></a> ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, const QBrush * fill )</li>
|
---|
185 | <li class=fn>void <a href="#qDrawPlainRect"><b>qDrawPlainRect</b></a> ( QPainter * p, int x, int y, int w, int h, const QColor & c, int lineWidth, const QBrush * fill )</li>
|
---|
186 | </ul>
|
---|
187 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
188 |
|
---|
189 |
|
---|
190 | The 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
|
---|
195 | drawing GUI programs require. QPainter can draw everything from
|
---|
196 | simple lines to complex shapes like pies and chords. It can also
|
---|
197 | draw aligned text and pixmaps. Normally, it draws in a "natural"
|
---|
198 | coordinate system, but it can also do view and world
|
---|
199 | transformation.
|
---|
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
|
---|
208 | all QPainter use is in a reimplementation of
|
---|
209 | <a href="qwidget.html#paintEvent">QWidget::paintEvent</a>(), and the painter is heavily optimized for
|
---|
210 | such 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
|
---|
223 | available, Qt finds a close match. In fact font() returns what
|
---|
224 | you set using <a href="#setFont">setFont</a>() and <a href="#fontInfo">fontInfo</a>() returns the font actually
|
---|
225 | being 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
|
---|
227 | used for filling e.g. circles.
|
---|
228 | <p> <li> <a href="#pen">pen</a>() is the currently set pen; the color or stipple that's
|
---|
229 | used 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
|
---|
233 | and pen() is a stipple. In that case, it describes the color of
|
---|
234 | the background pixels in the stipple.
|
---|
235 | <p> <li> <a href="#rasterOp">rasterOp</a>() is how pixels drawn interact with the pixels already
|
---|
236 | there.
|
---|
237 | <p> <li> <a href="#brushOrigin">brushOrigin</a>() is the origin of the tiled brushes, normally the
|
---|
238 | origin 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
|
---|
240 | painter's coordinate transformation system. See <a href="coordsys.html">The Coordinate System</a> for an explanation of
|
---|
241 | this, 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
|
---|
243 | device 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
|
---|
248 | devices, e.g. <a href="qwidget.html#font">QWidget::font</a>(). <a href="#begin">QPainter::begin</a>() (or the QPainter
|
---|
249 | constructor) copies these attributes from the paint device.
|
---|
250 | Calling, for example, <a href="qwidget.html#setFont">QWidget::setFont</a>() doesn't take effect until
|
---|
251 | the 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>()
|
---|
253 | pops them back.
|
---|
254 | <p> The core functionality of QPainter is drawing, and there are
|
---|
255 | functions 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
|
---|
260 | take integer coordinates; there are no floating-point versions
|
---|
261 | since 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()
|
---|
264 | produce the same result, except that drawPixmap() is faster
|
---|
265 | on-screen and drawImage() faster and sometimes better on <a href="qprinter.html">QPrinter</a>
|
---|
266 | and <a href="qpicture.html">QPicture</a>.
|
---|
267 | <p> Text drawing is done using <a href="#drawText">drawText</a>(), and when you need
|
---|
268 | fine-grained positioning, <a href="#boundingRect">boundingRect</a>() tells you where a given
|
---|
269 | drawText() command would draw.
|
---|
270 | <p> There is a <a href="#drawPicture">drawPicture</a>() function that draws the contents of an
|
---|
271 | entire QPicture using this painter. drawPicture() is the only
|
---|
272 | function that disregards all the painter's settings: the QPicture
|
---|
273 | has its own settings.
|
---|
274 | <p> Normally, the QPainter operates on the device's own coordinate
|
---|
275 | system (usually pixels), but QPainter has good support for
|
---|
276 | coordinate 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>()
|
---|
279 | and <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
|
---|
281 | worldMatrix().
|
---|
282 | <p> <a href="#setViewport">setViewport</a>() sets the rectangle on which QPainter operates. The
|
---|
283 | default is the entire device, which is usually fine, except on
|
---|
284 | printers. <a href="#setWindow">setWindow</a>() sets the coordinate system, that is, the
|
---|
285 | rectangle 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
|
---|
287 | default is the same as the viewport, and if you don't use the
|
---|
288 | transformations, they are optimized away, gaining another little
|
---|
289 | bit of speed.
|
---|
290 | <p> After all the coordinate transformation is done, QPainter can clip
|
---|
291 | the drawing to an arbitrary rectangle or region. <a href="#hasClipping">hasClipping</a>() is
|
---|
292 | TRUE if QPainter clips, and <a href="#clipRegion">clipRegion</a>() returns the clip region.
|
---|
293 | You can set it using either <a href="#setClipRegion">setClipRegion</a>() or <a href="#setClipRect">setClipRect</a>().
|
---|
294 | Note that the clipping can be slow. It's all system-dependent,
|
---|
295 | but as a rule of thumb, you can assume that drawing speed is
|
---|
296 | inversely proportional to the number of rectangles in the clip
|
---|
297 | region.
|
---|
298 | <p> After QPainter's clipping, the paint device may also clip. For
|
---|
299 | example, most widgets clip away the pixels used by child widgets,
|
---|
300 | and most printers clip away an area near the edges of the paper.
|
---|
301 | This additional clipping is not reflected by the return value of
|
---|
302 | clipRegion() or hasClipping().
|
---|
303 | <p> QPainter also includes some less-used functions that are very
|
---|
304 | useful 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
|
---|
306 | the most usual constructor) makes it active. <a href="#end">end</a>() (and the
|
---|
307 | destructor) deactivates it. If the painter is active, <a href="#device">device</a>()
|
---|
308 | returns 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
|
---|
312 | perfect.
|
---|
313 | <p> <a href="#setTabStops">setTabStops</a>() and <a href="#setTabArray">setTabArray</a>() can change where the tab stops
|
---|
314 | are, but these are very seldomly used.
|
---|
315 | <p> <b>Warning:</b> Note that QPainter does not attempt to work around
|
---|
316 | coordinate limitations in the underlying window system. Some
|
---|
317 | platforms 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>
|
---|
341 | Constructs a painter.
|
---|
342 | <p> Notice that all painter settings (setPen, setBrush etc.) are reset
|
---|
343 | to 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 <a href="qpaintdevice.html">QPaintDevice</a> * pd, bool unclipped = FALSE )
|
---|
347 | </h3>
|
---|
348 | Constructs a painter that begins painting the paint device <em>pd</em>
|
---|
349 | immediately. Depending on the underlying graphic system the
|
---|
350 | painter 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
|
---|
353 | only once. The constructor calls <a href="#begin">begin</a>() for you and the QPainter
|
---|
354 | destructor 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
|
---|
376 | of the painter failed you should rather use begin() and end() to paint
|
---|
377 | on 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 <a href="qpaintdevice.html">QPaintDevice</a> * pd, const <a href="qwidget.html">QWidget</a> * copyAttributes, bool unclipped = FALSE )
|
---|
381 | </h3>
|
---|
382 | Constructs a painter that begins painting the paint device <em>pd</em>
|
---|
383 | immediately, with the default arguments taken from <em>copyAttributes</em>. The painter will paint over children of the paint
|
---|
384 | device if <em>unclipped</em> is TRUE (although this is not supported on
|
---|
385 | all platforms).
|
---|
386 | <p> <p>See also <a href="#begin">begin</a>().
|
---|
387 |
|
---|
388 | <h3 class=fn><a name="~QPainter"></a>QPainter::~QPainter ()
|
---|
389 | </h3>
|
---|
390 | Destroys the painter.
|
---|
391 |
|
---|
392 | <h3 class=fn>const <a href="qcolor.html">QColor</a> & <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 <a href="qpaintdevice.html">QPaintDevice</a> * pd, bool unclipped = FALSE )
|
---|
405 | </h3>
|
---|
406 | Begins painting the paint device <em>pd</em> and returns TRUE if
|
---|
407 | successful; otherwise returns FALSE. If <em>unclipped</em> is TRUE, the
|
---|
408 | painting 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->begin( 0 ); // impossible - paint device cannot be 0
|
---|
413 |
|
---|
414 | <a href="qpixmap.html">QPixmap</a> pm( 0, 0 );
|
---|
415 | p->begin( pm ); // impossible - pm.<a href="qpixmap.html#isNull">isNull</a>();
|
---|
416 |
|
---|
417 | p->begin( myWidget );
|
---|
418 | p2->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
|
---|
422 | instead of <a href="#begin">begin</a>(), and that <a href="#end">end</a>() is automatically done at
|
---|
423 | destruction.
|
---|
424 | <p> <b>Warning:</b> A paint device can only be painted by one painter at a
|
---|
425 | time.
|
---|
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 <a href="qpaintdevice.html">QPaintDevice</a> * pd, const <a href="qwidget.html">QWidget</a> * copyAttributes, bool unclipped = FALSE )
|
---|
430 | </h3>
|
---|
431 | This 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
|
---|
433 | the initial pen, background color and font from <em>copyAttributes</em>,
|
---|
434 | painting over the paint device's children when <em>unclipped</em> is
|
---|
435 | TRUE. 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->foregroundColor() );
|
---|
440 | p.<a href="#setBackgroundColor">setBackgroundColor</a>( copyAttributes->backgroundColor() );
|
---|
441 | p.<a href="#setFont">setFont</a>( copyAttributes->font() );
|
---|
442 | </pre>
|
---|
443 |
|
---|
444 | <p> This begin function is convenient for double buffering. When you
|
---|
445 | draw in a pixmap instead of directly in a widget (to later bitBlt
|
---|
446 | the pixmap into the widget) you will need to set the widget's
|
---|
447 | font 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>(&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, &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 x, int y, int w, int h, int flags, const <a href="qstring.html">QString</a> &, int len = -1, QTextParag ** intern = 0 )
|
---|
464 | </h3>
|
---|
465 |
|
---|
466 | <p> Returns the bounding rectangle of the aligned text that would be
|
---|
467 | printed 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
|
---|
469 | the string if <em>len</em> is -1. The drawing, and hence the bounding
|
---|
470 | rectangle, is constrained to the rectangle that begins at point <em>(x, y)</em> with width <em>w</em> and hight <em>h</em>, or to the
|
---|
471 | rectangle required to draw the text, whichever is the larger.
|
---|
472 | <p> The <em>flags</em> argument is
|
---|
473 | the 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
|
---|
490 | alignment defaults to <a href="qt.html#AlignmentFlags-enum">AlignTop</a>.
|
---|
491 | <p> If several of the horizontal or several of the vertical alignment flags
|
---|
492 | are 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 <a href="qrect.html">QRect</a> & r, int flags, const <a href="qstring.html">QString</a> & str, int len = -1, QTextParag ** internal = 0 )
|
---|
497 | </h3>
|
---|
498 | This 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
|
---|
500 | printed 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
|
---|
503 | rectangle, is constrained to the rectangle <em>r</em>, or to the
|
---|
504 | rectangle 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 <a href="qbrush.html">QBrush</a> & <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 <a href="qpoint.html">QPoint</a> & <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> m = CoordDevice ) const
|
---|
522 | </h3>
|
---|
523 | Returns the currently set clip region. Note that the clip region
|
---|
524 | is 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
|
---|
526 | equal to <a href="#CoordinateMode-enum">CoordDevice</a> (the default). If <em>m</em> equals <a href="#CoordinateMode-enum">CoordPainter</a> the returned region is in model coordinates.
|
---|
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> * <a name="device"></a>QPainter::device () const
|
---|
531 | </h3>
|
---|
532 |
|
---|
533 | <p> Returns the paint device on which this painter is currently
|
---|
534 | painting, 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 x, int y, int w, int h, int a, int alen )
|
---|
539 | </h3>
|
---|
540 | Draws an arc defined by the rectangle <em>(x, y, w, h)</em>, the start
|
---|
541 | angle <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
|
---|
543 | circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
|
---|
544 | mean counter-clockwise while negative values mean the clockwise
|
---|
545 | direction. 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 <a href="qrect.html">QRect</a> & r, int a, int alen )
|
---|
555 | </h3>
|
---|
556 | This 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 x, int y, int w, int h, int a, int alen )
|
---|
561 | </h3>
|
---|
562 | Draws a chord defined by the rectangle <em>(x, y, w, h)</em>, the start
|
---|
563 | angle <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
|
---|
566 | circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
|
---|
567 | mean counter-clockwise while negative values mean the clockwise
|
---|
568 | direction. 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 <a href="qrect.html">QRect</a> & r, int a, int alen )
|
---|
572 | </h3>
|
---|
573 | This 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 <a href="qpointarray.html">QPointArray</a> & pa, int index = 0, int npoints = -1 )
|
---|
578 | </h3>
|
---|
579 | Draws the convex polygon defined by the <em>npoints</em> points in <em>pa</em>
|
---|
580 | starting 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
|
---|
585 | values are truncated. This limitation is expected to go away in
|
---|
586 | Qt 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 <a href="qpointarray.html">QPointArray</a> & a, int index = 0 )
|
---|
590 | </h3>
|
---|
591 | Draws a cubic Bezier curve defined by the control points in <em>a</em>,
|
---|
592 | starting 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
|
---|
594 | if there aren't enough control points.
|
---|
595 | <p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
|
---|
596 | values are truncated. This limitation is expected to go away in
|
---|
597 | Qt 4.
|
---|
598 |
|
---|
599 | <h3 class=fn>void <a name="drawEllipse"></a>QPainter::drawEllipse ( int x, int y, int w, int h )
|
---|
600 | </h3>
|
---|
601 | Draws 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 <a href="qrect.html">QRect</a> & r )
|
---|
605 | </h3>
|
---|
606 | This 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 x, int y, const <a href="qimage.html">QImage</a> & image, int sx = 0, int sy = 0, int sw = -1, int sh = -1, int conversionFlags = 0 )
|
---|
610 | </h3>
|
---|
611 | Draws at (<em>x</em>, <em>y</em>) the <em>sw</em> by <em>sh</em> area of pixels from (<em>sx</em>, <em>sy</em>) in <em>image</em>, using <em>conversionFlags</em> if the image
|
---|
612 | needs to be converted to a pixmap. The default value for <em>conversionFlags</em> is 0; see convertFromImage() for information about
|
---|
613 | what other values do.
|
---|
614 | <p> This function may convert <em>image</em> to a pixmap and then draw it,
|
---|
615 | if <a href="#device">device</a>() is a <a href="qpixmap.html">QPixmap</a> or a <a href="qwidget.html">QWidget</a>, or else draw it directly,
|
---|
616 | if 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 <a href="qpoint.html">QPoint</a> &, const <a href="qimage.html">QImage</a> &, const <a href="qrect.html">QRect</a> & sr, int conversionFlags = 0 )
|
---|
622 | </h3>
|
---|
623 | This 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 <a href="qpoint.html">QPoint</a> & p, const <a href="qimage.html">QImage</a> & i, int conversion_flags = 0 )
|
---|
627 | </h3>
|
---|
628 | This 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
|
---|
631 | result (e.g. converting from 32-bit to 8-bit), use the <em>conversion_flags</em> to specify how you'd prefer this to happen.
|
---|
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 <a href="qrect.html">QRect</a> & r, const <a href="qimage.html">QImage</a> & i )
|
---|
635 | </h3>
|
---|
636 | This 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
|
---|
638 | scaled to fit the rectangle if image and rectangle dimensions
|
---|
639 | differ.
|
---|
640 |
|
---|
641 | <h3 class=fn>void <a name="drawLine"></a>QPainter::drawLine ( int x1, int y1, int x2, int y2 )
|
---|
642 | </h3>
|
---|
643 | Draws a line from (<em>x1</em>, <em>y1</em>) to (<em>x2</em>, <em>y2</em>) and sets the
|
---|
644 | current 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 <a href="qpoint.html">QPoint</a> & p1, const <a href="qpoint.html">QPoint</a> & p2 )
|
---|
649 | </h3>
|
---|
650 | This 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 <a href="qpointarray.html">QPointArray</a> & a, int index = 0, int nlines = -1 )
|
---|
654 | </h3>
|
---|
655 | Draws <em>nlines</em> separate lines from points defined in <em>a</em>,
|
---|
656 | starting 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
|
---|
660 | 2nd 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
|
---|
662 | values are truncated. This limitation is expected to go away in
|
---|
663 | Qt 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 x, int y, const <a href="qpicture.html">QPicture</a> & pic )
|
---|
667 | </h3>
|
---|
668 | Replays 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
|
---|
670 | called 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 <a href="qpicture.html">QPicture</a> & 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)
|
---|
677 | offset instead.
|
---|
678 |
|
---|
679 | <h3 class=fn>void <a name="drawPicture-3"></a>QPainter::drawPicture ( const <a href="qpoint.html">QPoint</a> & p, const <a href="qpicture.html">QPicture</a> & pic )
|
---|
680 | </h3>
|
---|
681 | This 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 x, int y, int w, int h, int a, int alen )
|
---|
685 | </h3>
|
---|
686 | Draws a pie defined by the rectangle <em>(x, y, w, h)</em>, the start
|
---|
687 | angle <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
|
---|
690 | circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em>
|
---|
691 | mean counter-clockwise while negative values mean the clockwise
|
---|
692 | direction. 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 <a href="qrect.html">QRect</a> & r, int a, int alen )
|
---|
697 | </h3>
|
---|
698 | This 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
|
---|
700 | angle <em>a</em> and arc length <em>alen</em>.
|
---|
701 |
|
---|
702 | <h3 class=fn>void <a name="drawPixmap"></a>QPainter::drawPixmap ( int x, int y, const <a href="qpixmap.html">QPixmap</a> & pixmap, int sx = 0, int sy = 0, int sw = -1, int sh = -1 )
|
---|
703 | </h3>
|
---|
704 | Draws a pixmap at <em>(x, y)</em> by copying a part of <em>pixmap</em> into
|
---|
705 | the paint device.
|
---|
706 | <p> <em>(x, y)</em> specifies the top-left point in the paint device that is
|
---|
707 | to be drawn onto. <em>(sx, sy)</em> specifies the top-left point in <em>pixmap</em> that is to be drawn. The default is (0, 0).
|
---|
708 | <p> <em>(sw, sh)</em> specifies the size of the pixmap that is to be drawn.
|
---|
709 | The default, (-1, -1), means all the way to the bottom right of
|
---|
710 | the pixmap.
|
---|
711 | <p> Currently the mask of the pixmap or it's alpha channel are ignored
|
---|
712 | when 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 <a href="qpoint.html">QPoint</a> & p, const <a href="qpixmap.html">QPixmap</a> & pm, const <a href="qrect.html">QRect</a> & sr )
|
---|
717 | </h3>
|
---|
718 | This 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 <a href="qpoint.html">QPoint</a> & p, const <a href="qpixmap.html">QPixmap</a> & pm )
|
---|
723 | </h3>
|
---|
724 | This 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 <a href="qrect.html">QRect</a> & r, const <a href="qpixmap.html">QPixmap</a> & pm )
|
---|
728 | </h3>
|
---|
729 | This 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
|
---|
731 | scaled to fit the rectangle, if image and rectangle size disagree.
|
---|
732 |
|
---|
733 | <h3 class=fn>void <a name="drawPoint"></a>QPainter::drawPoint ( int x, int y )
|
---|
734 | </h3>
|
---|
735 | Draws/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 <a href="qpoint.html">QPoint</a> & p )
|
---|
740 | </h3>
|
---|
741 | This 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 <a href="qpointarray.html">QPointArray</a> & a, int index = 0, int npoints = -1 )
|
---|
745 | </h3>
|
---|
746 | Draws/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
|
---|
748 | of the points from <em>index</em> are drawn. If <em>npoints</em> is zero or
|
---|
749 | greater, <em>npoints</em> points are drawn.
|
---|
750 | <p> <b>Warning:</b> On X11, coordinates that do not fit into 16-bit signed
|
---|
751 | values are truncated. This limitation is expected to go away in
|
---|
752 | Qt 4.
|
---|
753 |
|
---|
754 | <h3 class=fn>void <a name="drawPolygon"></a>QPainter::drawPolygon ( const <a href="qpointarray.html">QPointArray</a> & a, bool winding = FALSE, int index = 0, int npoints = -1 )
|
---|
755 | </h3>
|
---|
756 | Draws the polygon defined by the <em>npoints</em> points in <em>a</em>
|
---|
757 | starting 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
|
---|
759 | array are used (i.e. a.size()-index line segments define the
|
---|
760 | polygon).
|
---|
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
|
---|
763 | TRUE, 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
|
---|
767 | values are truncated. This limitation is expected to go away in
|
---|
768 | Qt 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 <a href="qpointarray.html">QPointArray</a> & a, int index = 0, int npoints = -1 )
|
---|
773 | </h3>
|
---|
774 | Draws the polyline defined by the <em>npoints</em> points in <em>a</em>
|
---|
775 | starting 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
|
---|
777 | array 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
|
---|
779 | values are truncated. This limitation is expected to go away in
|
---|
780 | Qt 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 x, int y, int w, int h )
|
---|
785 | </h3>
|
---|
786 | Draws a rectangle with upper left corner at <em>(x, y)</em> and with
|
---|
787 | width <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 <a href="qrect.html">QRect</a> & r )
|
---|
792 | </h3>
|
---|
793 | This 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 x, int y, int w, int h, int xRnd = 25, int yRnd = 25 )
|
---|
797 | </h3>
|
---|
798 | Draws 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
|
---|
800 | should 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 <a href="qrect.html">QRect</a> & r, int xRnd = 25, int yRnd = 25 )
|
---|
806 | </h3>
|
---|
807 | This 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>
|
---|
809 | and the y position <em>yRnd</em> on each corner.
|
---|
810 |
|
---|
811 | <h3 class=fn>void <a name="drawText"></a>QPainter::drawText ( const <a href="qpoint.html">QPoint</a> & p, const <a href="qstring.html">QString</a> &, int pos, int len, <a href="qpainter.html#TextDirection-enum">TextDirection</a> 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>
|
---|
816 | characters. 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>
|
---|
819 | pair (or a point), the <em>y</em> value is the text's baseline; for
|
---|
820 | overloads that take a rectangle, <em>rect.y()</em> is the top of the
|
---|
821 | rectangle and the text is aligned within that rectangle in
|
---|
822 | accordance 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 x, int y, const <a href="qstring.html">QString</a> &, int len = -1, <a href="qpainter.html#TextDirection-enum">TextDirection</a> 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
|
---|
831 | default) all the text is drawn, otherwise the first <em>len</em>
|
---|
832 | characters 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 <a href="qpoint.html">QPoint</a> &, const <a href="qstring.html">QString</a> &, int len = -1, <a href="qpainter.html#TextDirection-enum">TextDirection</a> 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 x, int y, const <a href="qstring.html">QString</a> &, int pos, int len, <a href="qpainter.html#TextDirection-enum">TextDirection</a> 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>
|
---|
848 | characters. The text's direction is specified by <em>dir</em>.
|
---|
849 |
|
---|
850 | <h3 class=fn>void <a name="drawText-5"></a>QPainter::drawText ( int x, int y, int w, int h, int flags, const <a href="qstring.html">QString</a> &, int len = -1, <a href="qrect.html">QRect</a> * br = 0, QTextParag ** 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>,
|
---|
855 | with width <em>w</em> and height <em>h</em>. If <em>len</em> is -1 (the default) all
|
---|
856 | the text is drawn, otherwise the first <em>len</em> characters are
|
---|
857 | drawn. The text's flags that are given in the <em>flags</em> parameter
|
---|
858 | are <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> and <a href="qt.html#TextFlags-enum">Qt::TextFlags</a> OR'd together. <em>br</em> (if not null) is set to the actual bounding rectangle of the
|
---|
859 | output. The <em>internal</em> parameter is for internal use only.
|
---|
860 |
|
---|
861 | <h3 class=fn>void <a name="drawText-6"></a>QPainter::drawText ( const <a href="qrect.html">QRect</a> & r, int tf, const <a href="qstring.html">QString</a> & str, int len = -1, <a href="qrect.html">QRect</a> * brect = 0, QTextParag ** internal = 0 )
|
---|
862 | </h3>
|
---|
863 | This 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
|
---|
866 | really of type <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a> and <a href="qt.html#TextFlags-enum">Qt::TextFlags</a> OR'd
|
---|
867 | together.
|
---|
868 | <p> Horizontal alignment defaults to AlignAuto and vertical alignment
|
---|
869 | defaults to AlignTop.
|
---|
870 | <p> <em>brect</em> (if not null) is set to the actual bounding rectangle of
|
---|
871 | the 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 x, int y, int w, int h, const <a href="qpixmap.html">QPixmap</a> & pixmap, int sx = 0, int sy = 0 )
|
---|
875 | </h3>
|
---|
876 | Draws 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
|
---|
878 | to be drawn onto; with the width and height given by <em>w</em> and <em>h</em>. <em>(sx, sy)</em> specifies the top-left point in <em>pixmap</em> that is
|
---|
879 | to be drawn. The default is (0, 0).
|
---|
880 | <p> Calling <a href="#drawTiledPixmap">drawTiledPixmap</a>() is similar to calling <a href="#drawPixmap">drawPixmap</a>()
|
---|
881 | several times to fill (tile) an area with a pixmap, but is
|
---|
882 | potentially much more efficient depending on the underlying window
|
---|
883 | system.
|
---|
884 | <p> <p>See also <a href="#drawPixmap">drawPixmap</a>().
|
---|
885 |
|
---|
886 | <h3 class=fn>void <a name="drawTiledPixmap-2"></a>QPainter::drawTiledPixmap ( const <a href="qrect.html">QRect</a> & r, const <a href="qpixmap.html">QPixmap</a> & pm, const <a href="qpoint.html">QPoint</a> & sp )
|
---|
887 | </h3>
|
---|
888 | This 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
|
---|
890 | at point <em>sp</em>.
|
---|
891 |
|
---|
892 | <h3 class=fn>void <a name="drawTiledPixmap-3"></a>QPainter::drawTiledPixmap ( const <a href="qrect.html">QRect</a> & r, const <a href="qpixmap.html">QPixmap</a> & pm )
|
---|
893 | </h3>
|
---|
894 | This 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 x, int y, int w, int h, const <a href="qcolor.html">QColor</a> & bgColor )
|
---|
898 | </h3>
|
---|
899 | Draws 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
|
---|
901 | contrasts with <em>bgColor</em>.
|
---|
902 | <p> This function draws a stippled rectangle (XOR is not used) that is
|
---|
903 | used 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
|
---|
906 | depending on the color of <em>bgColor</em> (see QColor::gray()).
|
---|
907 | <p> <b>Warning:</b> This function draws nothing if the coordinate system has
|
---|
908 | been <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 x, int y, int w, int h )
|
---|
912 | </h3>
|
---|
913 | This 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
|
---|
917 | indicate <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
|
---|
919 | been <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 <a href="qrect.html">QRect</a> & r )
|
---|
923 | </h3>
|
---|
924 | This 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 <a href="qrect.html">QRect</a> & r, const <a href="qcolor.html">QColor</a> & bgColor )
|
---|
928 | </h3>
|
---|
929 | This 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
|
---|
931 | color <em>bgColor</em>.
|
---|
932 |
|
---|
933 | <h3 class=fn>bool <a name="end"></a>QPainter::end ()
|
---|
934 | </h3>
|
---|
935 | Ends 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
|
---|
937 | destructor will do it, there is at least one common case when it
|
---|
938 | is 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
|
---|
948 | necessary 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 x, int y, int w, int 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 <a href="qrect.html">QRect</a> & r )
|
---|
960 | </h3>
|
---|
961 | This 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 x, int y, int w, int h, const <a href="qbrush.html">QBrush</a> & brush )
|
---|
965 | </h3>
|
---|
966 | Fills 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>
|
---|
968 | constructor that takes a QColor argument and creates a solid
|
---|
969 | pattern 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 <a href="qrect.html">QRect</a> & r, const <a href="qbrush.html">QBrush</a> & brush )
|
---|
974 | </h3>
|
---|
975 | This 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 <a href="qregion.html">QRegion</a> & region, <a href="qpainter.html#CoordinateMode-enum">CoordinateMode</a> cm = CoordDevice )
|
---|
979 | </h3>
|
---|
980 | Flushes 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
|
---|
982 | support 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>
|
---|
987 | This 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 <a href="qfont.html">QFont</a> & <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>
|
---|
999 | Returns the font info for the painter, if the painter is active.
|
---|
1000 | It is not possible to obtain font information for an inactive
|
---|
1001 | painter, so the return value is undefined if the painter is not
|
---|
1002 | active.
|
---|
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>
|
---|
1007 | Returns the font metrics for the painter, if the painter is
|
---|
1008 | active. It is not possible to obtain metrics for an inactive
|
---|
1009 | painter, so the return value is undefined if the painter is not
|
---|
1010 | active.
|
---|
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
|
---|
1018 | function 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
|
---|
1031 | FALSE.
|
---|
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
|
---|
1038 | FALSE.
|
---|
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
|
---|
1045 | been called and <a href="#end">end</a>() has not yet been called; otherwise returns
|
---|
1046 | FALSE.
|
---|
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 x, int 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 <a href="qpoint.html">QPoint</a> & p )
|
---|
1058 | </h3>
|
---|
1059 | This 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 x, int 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 <a href="qpoint.html">QPoint</a> & p )
|
---|
1068 | </h3>
|
---|
1069 | This 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 <a href="qpen.html">QPen</a> & <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> * pdev, <a href="qpaintdevice.html">QPaintDevice</a> * replacement )<tt> [static]</tt>
|
---|
1092 | </h3>
|
---|
1093 | Redirects all paint commands for a paint device, <em>pdev</em>, to
|
---|
1094 | another paint device, <em>replacement</em>, unless <em>replacement</em> is 0.
|
---|
1095 | If <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>
|
---|
1101 | Resets 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>
|
---|
1108 | Restores the current painter state (pops a saved state off the
|
---|
1109 | stack).
|
---|
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 a )
|
---|
1118 | </h3>
|
---|
1119 | Rotates 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>
|
---|
1125 | Saves 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>()
|
---|
1127 | unwinds 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 sx, double sy )
|
---|
1136 | </h3>
|
---|
1137 | Scales 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 <a href="qcolor.html">QColor</a> & c )
|
---|
1142 | </h3>
|
---|
1143 | Sets the background color of the painter to <em>c</em>.
|
---|
1144 | <p> The background color is the color that is filled in when drawing
|
---|
1145 | opaque text, stippled lines and bitmaps. The background color has
|
---|
1146 | no 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> m )
|
---|
1150 | </h3>
|
---|
1151 | Sets the background mode of the painter to <em>m</em>, which must be
|
---|
1152 | either <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
|
---|
1154 | background pixels. Opaque mode fills these space with the current
|
---|
1155 | background color.
|
---|
1156 | <p> Note that in order to draw a bitmap or pixmap transparently, you
|
---|
1157 | must 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> style )
|
---|
1162 | </h3>
|
---|
1163 | Sets 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 <a href="qbrush.html">QBrush</a> & brush )
|
---|
1168 | </h3>
|
---|
1169 | This 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 <a href="qcolor.html">QColor</a> & color )
|
---|
1175 | </h3>
|
---|
1176 | This 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
|
---|
1178 | specified <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 x, int y )
|
---|
1182 | </h3>
|
---|
1183 | Sets the brush origin to <em>(x, y)</em>.
|
---|
1184 | <p> The brush origin specifies the (0, 0) coordinate of the painter's
|
---|
1185 | brush. This setting only applies to pattern brushes and pixmap
|
---|
1186 | brushes.
|
---|
1187 | <p> <p>See also <a href="#brushOrigin">brushOrigin</a>().
|
---|
1188 |
|
---|
1189 | <h3 class=fn>void <a name="setBrushOrigin-2"></a>QPainter::setBrushOrigin ( const <a href="qpoint.html">QPoint</a> & p )
|
---|
1190 | </h3>
|
---|
1191 | This 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 x, int y, int w, int h, <a href="qpainter.html#CoordinateMode-enum">CoordinateMode</a> 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
|
---|
1198 | enables 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
|
---|
1200 | the clip region are taken to be physical device coordinates and
|
---|
1201 | are <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
|
---|
1203 | coordinates given for the clip region are taken to be model
|
---|
1204 | coordinates.
|
---|
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 <a href="qrect.html">QRect</a> & r, <a href="qpainter.html#CoordinateMode-enum">CoordinateMode</a> m = CoordDevice )
|
---|
1209 | </h3>
|
---|
1210 | This 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.
|
---|
1212 | The 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 <a href="qregion.html">QRegion</a> & rgn, <a href="qpainter.html#CoordinateMode-enum">CoordinateMode</a> m = CoordDevice )
|
---|
1216 | </h3>
|
---|
1217 | Sets the clip region to <em>rgn</em> and enables clipping. The clip mode
|
---|
1218 | is set to <em>m</em>.
|
---|
1219 | <p> Note that the clip region is given in physical device coordinates
|
---|
1220 | and <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 enable )
|
---|
1226 | </h3>
|
---|
1227 | Enables 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 <a href="qfont.html">QFont</a> & font )
|
---|
1232 | </h3>
|
---|
1233 | Sets the painter's font to <em>font</em>.
|
---|
1234 | <p> This font is used by subsequent <a href="#drawText">drawText</a>() functions. The text
|
---|
1235 | color 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 <a href="qpen.html">QPen</a> & pen )
|
---|
1240 | </h3>
|
---|
1241 | Sets a new painter pen.
|
---|
1242 | <p> The <em>pen</em> defines how to draw lines and outlines, and it also
|
---|
1243 | defines 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> style )
|
---|
1248 | </h3>
|
---|
1249 | This 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
|
---|
1251 | color.
|
---|
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 <a href="qcolor.html">QColor</a> & color )
|
---|
1255 | </h3>
|
---|
1256 | This 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
|
---|
1258 | specified <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> r )
|
---|
1262 | </h3>
|
---|
1263 | Sets the <a href="qt.html#RasterOp-enum">raster operation</a> to <em>r</em>.
|
---|
1264 | The 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 * ta )
|
---|
1268 | </h3>
|
---|
1269 | Sets 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 ts )
|
---|
1275 | </h3>
|
---|
1276 | Set the tab stop width to <em>ts</em>, i.e. locates tab stops at <em>ts</em>,
|
---|
1277 | 2*<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>
|
---|
1279 | set. 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
|
---|
1282 | character '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 enable )
|
---|
1286 | </h3>
|
---|
1287 | Enables view transformations if <em>enable</em> is TRUE, or disables
|
---|
1288 | view 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 x, int y, int w, int h )
|
---|
1292 | </h3>
|
---|
1293 | Sets the viewport rectangle view transformation for the painter
|
---|
1294 | and enables view transformation.
|
---|
1295 | <p> The viewport rectangle is part of the view transformation. The
|
---|
1296 | viewport specifies the device coordinate system and is specified
|
---|
1297 | by the <em>x</em>, <em>y</em>, <em>w</em> width and <em>h</em> height parameters. Its
|
---|
1298 | sister, the <a href="#window">window</a>(), specifies the logical coordinate system.
|
---|
1299 | <p> The default viewport rectangle is the same as the device's
|
---|
1300 | rectangle. 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 <a href="qrect.html">QRect</a> & r )
|
---|
1305 | </h3>
|
---|
1306 | This 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 x, int y, int w, int h )
|
---|
1310 | </h3>
|
---|
1311 | Sets the window rectangle view transformation for the painter and
|
---|
1312 | enables view transformation.
|
---|
1313 | <p> The window rectangle is part of the view transformation. The
|
---|
1314 | window specifies the logical coordinate system and is specified by
|
---|
1315 | the <em>x</em>, <em>y</em>, <em>w</em> width and <em>h</em> height parameters. Its sister,
|
---|
1316 | the <a href="#viewport">viewport</a>(), specifies the device coordinate system.
|
---|
1317 | <p> The default window rectangle is the same as the device's
|
---|
1318 | rectangle. 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 <a href="qrect.html">QRect</a> & r )
|
---|
1323 | </h3>
|
---|
1324 | This 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 <a href="qwmatrix.html">QWMatrix</a> & m, bool combine = FALSE )
|
---|
1328 | </h3>
|
---|
1329 | Sets the world <a href="qwmatrix.html#TransformationMode">transformation matrix</a> to <em>m</em> and enables world
|
---|
1330 | transformation.
|
---|
1331 | <p> If <em>combine</em> is TRUE, then <em>m</em> is combined with the current
|
---|
1332 | transformation matrix, otherwise <em>m</em> replaces the current
|
---|
1333 | transformation matrix.
|
---|
1334 | <p> If <em>m</em> is the identity matrix and <em>combine</em> is FALSE, this
|
---|
1335 | function calls <a href="#setWorldXForm">setWorldXForm</a>(FALSE). (The identity matrix is the
|
---|
1336 | matrix where <a href="qwmatrix.html#m11">QWMatrix::m11</a>() and <a href="qwmatrix.html#m22">QWMatrix::m22</a>() are 1.0 and the
|
---|
1337 | rest 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
|
---|
1341 | a 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
|
---|
1359 | into a <a href="qpicture.html">QPicture</a>. Otherwise it may not be possible to replay the
|
---|
1360 | picture with additional transformations. Using translate(),
|
---|
1361 | scale(), 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 enable )
|
---|
1367 | </h3>
|
---|
1368 | Enables world transformations if <em>enable</em> is TRUE, or disables
|
---|
1369 | world 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 sh, double sv )
|
---|
1374 | </h3>
|
---|
1375 | Shears 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 dx, double dy )
|
---|
1391 | </h3>
|
---|
1392 | Translates 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>
|
---|
1412 | Returns 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>
|
---|
1418 | Returns 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 <a href="qwmatrix.html">QWMatrix</a> & <a name="worldMatrix"></a>QPainter::worldMatrix () const
|
---|
1422 | </h3>
|
---|
1423 | Returns 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 <a href="qpoint.html">QPoint</a> & pv ) const
|
---|
1427 | </h3>
|
---|
1428 | Returns the point <em>pv</em> transformed from model coordinates to
|
---|
1429 | device 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 <a href="qrect.html">QRect</a> & rv ) const
|
---|
1433 | </h3>
|
---|
1434 | This 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
|
---|
1436 | device coordinates.
|
---|
1437 | <p> If world transformation is enabled and rotation or shearing has
|
---|
1438 | been 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 <a href="qpointarray.html">QPointArray</a> & av ) const
|
---|
1442 | </h3>
|
---|
1443 | This 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
|
---|
1445 | to 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 <a href="qpointarray.html">QPointArray</a> & av, int index, int npoints ) const
|
---|
1449 | </h3>
|
---|
1450 | This 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
|
---|
1452 | to device coordinates. The <em>index</em> is the first point in the
|
---|
1453 | array and <em>npoints</em> denotes the number of points to be
|
---|
1454 | transformed. 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
|
---|
1456 | were 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 <a href="qrect.html">QRect</a> & rd ) const
|
---|
1468 | </h3>
|
---|
1469 | Returns the rectangle <em>rd</em> transformed from device coordinates to
|
---|
1470 | model coordinates.
|
---|
1471 | <p> If world transformation is enabled and rotation or shearing is
|
---|
1472 | used, 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 <a href="qpoint.html">QPoint</a> & pd ) const
|
---|
1476 | </h3>
|
---|
1477 | This 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
|
---|
1479 | model 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 <a href="qpointarray.html">QPointArray</a> & ad ) const
|
---|
1483 | </h3>
|
---|
1484 | This 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
|
---|
1486 | to 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 <a href="qpointarray.html">QPointArray</a> & ad, int index, int npoints ) const
|
---|
1490 | </h3>
|
---|
1491 | This 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
|
---|
1493 | to model coordinates. The <em>index</em> is the first point in the array
|
---|
1494 | and <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
|
---|
1496 | last point in the array are transformed.
|
---|
1497 | <p> The returned point array consists of the number of points that
|
---|
1498 | were 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> * p, int x, int y, int w, int h, const <a href="qcolor.html">QColor</a> & c, int lineWidth, const <a href="qbrush.html">QBrush</a> * fill )
|
---|
1511 | </h3>
|
---|
1512 |
|
---|
1513 | <p> <tt>#include <qdrawutil.h></tt>
|
---|
1514 | <p> Draws the plain rectangle specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>)
|
---|
1515 | using 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
|
---|
1521 | display 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
|
---|
1524 | widgets 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> * p, int x1, int y1, int x2, int y2, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, int lineWidth, int midLineWidth )
|
---|
1528 | </h3>
|
---|
1529 |
|
---|
1530 | <p> <tt>#include <qdrawutil.h></tt>
|
---|
1531 | <p> Draws a horizontal (<em>y1</em> == <em>y2</em>) or vertical (<em>x1</em> == <em>x2</em>)
|
---|
1532 | shaded 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
|
---|
1534 | line 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
|
---|
1538 | lines. It is not the total line width.
|
---|
1539 | <p> The <em>midLineWidth</em> argument specifies the width of a middle line
|
---|
1540 | drawn 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
|
---|
1542 | display 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
|
---|
1545 | widgets 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> * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, int lineWidth, const <a href="qbrush.html">QBrush</a> * fill )
|
---|
1549 | </h3>
|
---|
1550 |
|
---|
1551 | <p> <tt>#include <qdrawutil.h></tt>
|
---|
1552 | <p> Draws the shaded panel specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>) using
|
---|
1553 | the 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
|
---|
1559 | display 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
|
---|
1562 | widgets 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> * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, int lineWidth, int midLineWidth, const <a href="qbrush.html">QBrush</a> * fill )
|
---|
1566 | </h3>
|
---|
1567 |
|
---|
1568 | <p> <tt>#include <qdrawutil.h></tt>
|
---|
1569 | <p> Draws the shaded rectangle specified by (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>)
|
---|
1570 | using 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
|
---|
1574 | lines. It is not the total line width.
|
---|
1575 | <p> The <em>midLineWidth</em> argument specifies the width of a middle line
|
---|
1576 | drawn 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
|
---|
1580 | display 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
|
---|
1583 | widgets 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> * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, const <a href="qbrush.html">QBrush</a> * fill )
|
---|
1587 | </h3>
|
---|
1588 |
|
---|
1589 | <p> <tt>#include <qdrawutil.h></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
|
---|
1597 | widgets 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> * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, const <a href="qbrush.html">QBrush</a> * fill )
|
---|
1601 | </h3>
|
---|
1602 |
|
---|
1603 | <p> <tt>#include <qdrawutil.h></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
|
---|
1610 | display 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
|
---|
1613 | widgets 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>
|
---|
1618 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
1619 | Copyright © 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 © 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>
|
---|