1QPainter(3qt) QPainter(3qt)
2
3
4
6 QPainter - Does low-level painting e.g. on widgets
7
9 #include <qpainter.h>
10
11 Inherits Qt.
12
13 Inherited by QDirectPainter.
14
15 Public Members
16 enum CoordinateMode { CoordDevice, CoordPainter }
17 QPainter ()
18 QPainter ( const QPaintDevice * pd, bool unclipped = FALSE )
19 QPainter ( const QPaintDevice * pd, const QWidget * copyAttributes,
20 bool unclipped = FALSE )
21 ~QPainter ()
22 bool begin ( const QPaintDevice * pd, bool unclipped = FALSE )
23 bool begin ( const QPaintDevice * pd, const QWidget * copyAttributes,
24 bool unclipped = FALSE )
25 bool end ()
26 QPaintDevice * device () const
27 bool isActive () const
28 void flush ( const QRegion & region, CoordinateMode cm = CoordDevice )
29 void flush ()
30 void save ()
31 void restore ()
32 QFontMetrics fontMetrics () const
33 QFontInfo fontInfo () const
34 const QFont & font () const
35 void setFont ( const QFont & font )
36 const QPen & pen () const
37 void setPen ( const QPen & pen )
38 void setPen ( PenStyle style )
39 void setPen ( const QColor & color )
40 const QBrush & brush () const
41 void setBrush ( const QBrush & brush )
42 void setBrush ( BrushStyle style )
43 void setBrush ( const QColor & color )
44 QPoint pos () const (obsolete)
45 const QColor & backgroundColor () const
46 void setBackgroundColor ( const QColor & c )
47 BGMode backgroundMode () const
48 void setBackgroundMode ( BGMode m )
49 RasterOp rasterOp () const
50 void setRasterOp ( RasterOp r )
51 const QPoint & brushOrigin () const
52 void setBrushOrigin ( int x, int y )
53 void setBrushOrigin ( const QPoint & p )
54 bool hasViewXForm () const
55 bool hasWorldXForm () const
56 void setViewXForm ( bool enable )
57 QRect window () const
58 void setWindow ( const QRect & r )
59 void setWindow ( int x, int y, int w, int h )
60 QRect viewport () const
61 void setViewport ( const QRect & r )
62 void setViewport ( int x, int y, int w, int h )
63 void setWorldXForm ( bool enable )
64 const QWMatrix & worldMatrix () const
65 void setWorldMatrix ( const QWMatrix & m, bool combine = FALSE )
66 void saveWorldMatrix () (obsolete)
67 void restoreWorldMatrix () (obsolete)
68 void scale ( double sx, double sy )
69 void shear ( double sh, double sv )
70 void rotate ( double a )
71 void translate ( double dx, double dy )
72 void resetXForm ()
73 QPoint xForm ( const QPoint & pv ) const
74 QRect xForm ( const QRect & rv ) const
75 QPointArray xForm ( const QPointArray & av ) const
76 QPointArray xForm ( const QPointArray & av, int index, int npoints )
77 const
78 QPoint xFormDev ( const QPoint & pd ) const
79 QRect xFormDev ( const QRect & rd ) const
80 QPointArray xFormDev ( const QPointArray & ad ) const
81 QPointArray xFormDev ( const QPointArray & ad, int index, int npoints )
82 const
83 void setClipping ( bool enable )
84 bool hasClipping () const
85 QRegion clipRegion ( CoordinateMode m = CoordDevice ) const
86 void setClipRect ( const QRect & r, CoordinateMode m = CoordDevice )
87 void setClipRect ( int x, int y, int w, int h, CoordinateMode m =
88 CoordDevice )
89 void setClipRegion ( const QRegion & rgn, CoordinateMode m =
90 CoordDevice )
91 void drawPoint ( int x, int y )
92 void drawPoint ( const QPoint & p )
93 void drawPoints ( const QPointArray & a, int index = 0, int npoints =
94 -1 )
95 void moveTo ( int x, int y ) (obsolete)
96 void moveTo ( const QPoint & p ) (obsolete)
97 void lineTo ( int x, int y ) (obsolete)
98 void lineTo ( const QPoint & p ) (obsolete)
99 void drawLine ( int x1, int y1, int x2, int y2 )
100 void drawLine ( const QPoint & p1, const QPoint & p2 )
101 void drawRect ( int x, int y, int w, int h )
102 void drawRect ( const QRect & r )
103 void drawWinFocusRect ( int x, int y, int w, int h )
104 void drawWinFocusRect ( int x, int y, int w, int h, const QColor &
105 bgColor )
106 void drawWinFocusRect ( const QRect & r )
107 void drawWinFocusRect ( const QRect & r, const QColor & bgColor )
108 void drawRoundRect ( int x, int y, int w, int h, int xRnd = 25, int
109 yRnd = 25 )
110 void drawRoundRect ( const QRect & r, int xRnd = 25, int yRnd = 25 )
111 void drawEllipse ( int x, int y, int w, int h )
112 void drawEllipse ( const QRect & r )
113 void drawArc ( int x, int y, int w, int h, int a, int alen )
114 void drawArc ( const QRect & r, int a, int alen )
115 void drawPie ( int x, int y, int w, int h, int a, int alen )
116 void drawPie ( const QRect & r, int a, int alen )
117 void drawChord ( int x, int y, int w, int h, int a, int alen )
118 void drawChord ( const QRect & r, int a, int alen )
119 void drawLineSegments ( const QPointArray & a, int index = 0, int
120 nlines = -1 )
121 void drawPolyline ( const QPointArray & a, int index = 0, int npoints =
122 -1 )
123 void drawPolygon ( const QPointArray & a, bool winding = FALSE, int
124 index = 0, int npoints = -1 )
125 void drawConvexPolygon ( const QPointArray & pa, int index = 0, int
126 npoints = -1 )
127 void drawCubicBezier ( const QPointArray & a, int index = 0 )
128 void drawPixmap ( int x, int y, const QPixmap & pixmap, int sx = 0, int
129 sy = 0, int sw = -1, int sh = -1 )
130 void drawPixmap ( const QPoint & p, const QPixmap & pm, const QRect &
131 sr )
132 void drawPixmap ( const QPoint & p, const QPixmap & pm )
133 void drawPixmap ( const QRect & r, const QPixmap & pm )
134 void drawImage ( int x, int y, const QImage & image, int sx = 0, int sy
135 = 0, int sw = -1, int sh = -1, int conversionFlags = 0 )
136 void drawImage ( const QPoint &, const QImage &, const QRect & sr, int
137 conversionFlags = 0 )
138 void drawImage ( const QPoint & p, const QImage & i, int
139 conversion_flags = 0 )
140 void drawImage ( const QRect & r, const QImage & i )
141 void drawTiledPixmap ( int x, int y, int w, int h, const QPixmap &
142 pixmap, int sx = 0, int sy = 0 )
143 void drawTiledPixmap ( const QRect & r, const QPixmap & pm, const
144 QPoint & sp )
145 void drawTiledPixmap ( const QRect & r, const QPixmap & pm )
146 void drawPicture ( const QPicture & pic ) (obsolete)
147 void drawPicture ( int x, int y, const QPicture & pic )
148 void drawPicture ( const QPoint & p, const QPicture & pic )
149 void fillRect ( int x, int y, int w, int h, const QBrush & brush )
150 void fillRect ( const QRect & r, const QBrush & brush )
151 void eraseRect ( int x, int y, int w, int h )
152 void eraseRect ( const QRect & r )
153 enum TextDirection { Auto, RTL, LTR }
154 void drawText ( int x, int y, const QString &, int len = -1,
155 TextDirection dir = Auto )
156 void drawText ( const QPoint &, const QString &, int len = -1,
157 TextDirection dir = Auto )
158 void drawText ( int x, int y, const QString &, int pos, int len,
159 TextDirection dir = Auto )
160 void drawText ( const QPoint & p, const QString &, int pos, int len,
161 TextDirection dir = Auto )
162 void drawText ( int x, int y, int w, int h, int flags, const QString &,
163 int len = -1, QRect * br = 0, QTextParag ** internal = 0 )
164 void drawText ( const QRect & r, int tf, const QString & str, int len =
165 -1, QRect * brect = 0, QTextParag ** internal = 0 )
166 QRect boundingRect ( int x, int y, int w, int h, int flags, const
167 QString &, int len = -1, QTextParag ** intern = 0 )
168 QRect boundingRect ( const QRect & r, int flags, const QString & str,
169 int len = -1, QTextParag ** internal = 0 )
170 int tabStops () const
171 void setTabStops ( int ts )
172 int * tabArray () const
173 void setTabArray ( int * ta )
174 HDC handle () const
175
176 Static Public Members
177 void redirect ( QPaintDevice * pdev, QPaintDevice * replacement )
178
180 void qDrawShadeLine ( QPainter * p, int x1, int y1, int x2, int y2,
181 const QColorGroup & g, bool sunken, int lineWidth, int midLineWidth
182 )
183 void qDrawShadeRect ( QPainter * p, int x, int y, int w, int h, const
184 QColorGroup & g, bool sunken, int lineWidth, int midLineWidth,
185 const QBrush * fill )
186 void qDrawShadePanel ( QPainter * p, int x, int y, int w, int h, const
187 QColorGroup & g, bool sunken, int lineWidth, const QBrush * fill )
188 void qDrawWinButton ( QPainter * p, int x, int y, int w, int h, const
189 QColorGroup & g, bool sunken, const QBrush * fill )
190 void qDrawWinPanel ( QPainter * p, int x, int y, int w, int h, const
191 QColorGroup & g, bool sunken, const QBrush * fill )
192 void qDrawPlainRect ( QPainter * p, int x, int y, int w, int h, const
193 QColor & c, int lineWidth, const QBrush * fill )
194
196 The QPainter class does low-level painting e.g. on widgets.
197
198 The painter provides highly optimized functions to do most of the
199 drawing GUI programs require. QPainter can draw everything from simple
200 lines to complex shapes like pies and chords. It can also draw aligned
201 text and pixmaps. Normally, it draws in a "natural" coordinate system,
202 but it can also do view and world transformation.
203
204 The typical use of a painter is:
205
206 Construct a painter.
207
208 Set a pen, a brush etc.
209
210 Draw.
211
212 Destroy the painter.
213
214 Mostly, all this is done inside a paint event. (In fact, 99% of all
215 QPainter use is in a reimplementation of QWidget::paintEvent(), and the
216 painter is heavily optimized for such use.) Here's one very simple
217 example:
218
219 void SimpleExampleWidget::paintEvent()
220 {
221 QPainter paint( this );
222 paint.setPen( Qt::blue );
223 paint.drawText( rect(), AlignCenter, "The Text" );
224 }
225
226 Usage is simple, and there are many settings you can use:
227
228 font() is the currently set font. If you set a font that isn't
229 available, Qt finds a close match. In fact font() returns what you set
230 using setFont() and fontInfo() returns the font actually being used
231 (which may be the same).
232
233 brush() is the currently set brush; the color or pattern that's used
234 for filling e.g. circles.
235
236 pen() is the currently set pen; the color or stipple that's used for
237 drawing lines or boundaries.
238
239 backgroundMode() is Opaque or Transparent, i.e. whether
240 backgroundColor() is used or not.
241
242 backgroundColor() only applies when backgroundMode() is Opaque and
243 pen() is a stipple. In that case, it describes the color of the
244 background pixels in the stipple.
245
246 rasterOp() is how pixels drawn interact with the pixels already there.
247
248 brushOrigin() is the origin of the tiled brushes, normally the origin
249 of the window.
250
251 viewport(), window(), worldMatrix() and many more make up the painter's
252 coordinate transformation system. See The Coordinate System for an
253 explanation of this, or see below for a very brief overview of the
254 functions.
255
256 hasClipping() is whether the painter clips at all. (The paint device
257 clips, too.) If the painter clips, it clips to clipRegion().
258
259 pos() is the current position, set by moveTo() and used by lineTo().
260
261 Note that some of these settings mirror settings in some paint devices,
262 e.g. QWidget::font(). QPainter::begin() (or the QPainter constructor)
263 copies these attributes from the paint device. Calling, for example,
264 QWidget::setFont() doesn't take effect until the next time a painter
265 begins painting on it.
266
267 save() saves all of these settings on an internal stack, restore() pops
268 them back.
269
270 The core functionality of QPainter is drawing, and there are functions
271 to draw most primitives: drawPoint(), drawPoints(), drawLine(),
272 drawRect(), drawWinFocusRect(), drawRoundRect(), drawEllipse(),
273 drawArc(), drawPie(), drawChord(), drawLineSegments(), drawPolyline(),
274 drawPolygon(), drawConvexPolygon() and drawCubicBezier(). All of these
275 functions take integer coordinates; there are no floating-point
276 versions since we want drawing to be as fast as possible.
277
278 There are functions to draw pixmaps/images, namely drawPixmap(),
279 drawImage() and drawTiledPixmap(). drawPixmap() and drawImage() produce
280 the same result, except that drawPixmap() is faster on-screen and
281 drawImage() faster and sometimes better on QPrinter and QPicture.
282
283 Text drawing is done using drawText(), and when you need fine-grained
284 positioning, boundingRect() tells you where a given drawText() command
285 would draw.
286
287 There is a drawPicture() function that draws the contents of an entire
288 QPicture using this painter. drawPicture() is the only function that
289 disregards all the painter's settings: the QPicture has its own
290 settings.
291
292 Normally, the QPainter operates on the device's own coordinate system
293 (usually pixels), but QPainter has good support for coordinate
294 transformation. See The Coordinate System for a more general overview
295 and a simple example.
296
297 The most common functions used are scale(), rotate(), translate() and
298 shear(), all of which operate on the worldMatrix(). setWorldMatrix()
299 can replace or add to the currently set worldMatrix().
300
301 setViewport() sets the rectangle on which QPainter operates. The
302 default is the entire device, which is usually fine, except on
303 printers. setWindow() sets the coordinate system, that is, the
304 rectangle that maps to viewport(). What's drawn inside the window()
305 ends up being inside the viewport(). The window's default is the same
306 as the viewport, and if you don't use the transformations, they are
307 optimized away, gaining another little bit of speed.
308
309 After all the coordinate transformation is done, QPainter can clip the
310 drawing to an arbitrary rectangle or region. hasClipping() is TRUE if
311 QPainter clips, and clipRegion() returns the clip region. You can set
312 it using either setClipRegion() or setClipRect(). Note that the
313 clipping can be slow. It's all system-dependent, but as a rule of
314 thumb, you can assume that drawing speed is inversely proportional to
315 the number of rectangles in the clip region.
316
317 After QPainter's clipping, the paint device may also clip. For example,
318 most widgets clip away the pixels used by child widgets, and most
319 printers clip away an area near the edges of the paper. This additional
320 clipping is not reflected by the return value of clipRegion() or
321 hasClipping().
322
323 QPainter also includes some less-used functions that are very useful on
324 those occasions when they're needed.
325
326 isActive() indicates whether the painter is active. begin() (and the
327 most usual constructor) makes it active. end() (and the destructor)
328 deactivates it. If the painter is active, device() returns the paint
329 device on which the painter paints.
330
331 Sometimes it is desirable to make someone else paint on an unusual
332 QPaintDevice. QPainter supports a static function to do this,
333 redirect(). We recommend not using it, but for some hacks it's perfect.
334
335 setTabStops() and setTabArray() can change where the tab stops are, but
336 these are very seldomly used.
337
338 Warning: Note that QPainter does not attempt to work around coordinate
339 limitations in the underlying window system. Some platforms may behave
340 incorrectly with coordinates as small as +/-4000.
341
342 See also QPaintDevice, QWidget, QPixmap, QPrinter, QPicture,
343 Application Walkthrough, Coordinate System Overview, Graphics Classes,
344 and Image Processing Classes.
345
346 Member Type Documentation
348 QPainter::CoordDevice
349
350 QPainter::CoordPainter
351
352 See also clipRegion().
353
355 QPainter::Auto
356
357 QPainter::RTL - right to left
358
359 QPainter::LTR - left to right
360
361 See also drawText().
362
365 Constructs a painter.
366
367 Notice that all painter settings (setPen, setBrush etc.) are reset to
368 default values when begin() is called.
369
370 See also begin() and end().
371
373 Constructs a painter that begins painting the paint device pd
374 immediately. Depending on the underlying graphic system the painter
375 will paint over children of the paintdevice if unclipped is TRUE.
376
377 This constructor is convenient for short-lived painters, e.g. in a
378 paint event and should be used only once. The constructor calls begin()
379 for you and the QPainter destructor automatically calls end().
380
381 Here's an example using begin() and end():
382
383 void MyWidget::paintEvent( QPaintEvent * )
384 {
385 QPainter p;
386 p.begin( this );
387 p.drawLine( ... ); // drawing code
388 p.end();
389 }
390
391 The same example using this constructor:
392
393 void MyWidget::paintEvent( QPaintEvent * )
394 {
395 QPainter p( this );
396 p.drawLine( ... ); // drawing code
397 }
398
399 Since the constructor cannot provide feedback when the initialization
400 of the painter failed you should rather use begin() and end() to paint
401 on external devices, e.g. printers.
402
403 See also begin() and end().
404
406 bool unclipped = FALSE )
407 Constructs a painter that begins painting the paint device pd
408 immediately, with the default arguments taken from copyAttributes. The
409 painter will paint over children of the paint device if unclipped is
410 TRUE (although this is not supported on all platforms).
411
412 See also begin().
413
415 Destroys the painter.
416
418 Returns the current background color.
419
420 See also setBackgroundColor() and QColor.
421
423 Returns the current background mode.
424
425 See also setBackgroundMode() and BGMode.
426
428 Begins painting the paint device pd and returns TRUE if successful;
429 otherwise returns FALSE. If unclipped is TRUE, the painting will not be
430 clipped at the paint device's boundaries, (although this is not
431 supported by all platforms).
432
433 The errors that can occur are serious problems, such as these:
434
435 p->begin( 0 ); // impossible - paint device cannot be 0
436 QPixmap pm( 0, 0 );
437 p->begin( pm ); // impossible - pm.isNull();
438 p->begin( myWidget );
439 p2->begin( myWidget ); // impossible - only one painter at a time
440
441 Note that most of the time, you can use one of the constructors instead
442 of begin(), and that end() is automatically done at destruction.
443
444 Warning: A paint device can only be painted by one painter at a time.
445
446 See also end() and flush().
447
448 Examples:
449
451 copyAttributes, bool unclipped = FALSE )
452 This is an overloaded member function, provided for convenience. It
453 behaves essentially like the above function.
454
455 This version opens the painter on a paint device pd and sets the
456 initial pen, background color and font from copyAttributes, painting
457 over the paint device's children when unclipped is TRUE. This is
458 equivalent to:
459
460 QPainter p;
461 p.begin( pd );
462 p.setPen( copyAttributes->foregroundColor() );
463 p.setBackgroundColor( copyAttributes->backgroundColor() );
464 p.setFont( copyAttributes->font() );
465
466 This begin function is convenient for double buffering. When you draw
467 in a pixmap instead of directly in a widget (to later bitBlt the pixmap
468 into the widget) you will need to set the widget's font etc. This
469 function does exactly that.
470
471 Example:
472
473 void MyWidget::paintEvent( QPaintEvent * )
474 {
475 QPixmap pm(size());
476 QPainter p;
477 p.begin(&pm, this);
478 // ... potentially flickering paint operation ...
479 p.end();
480 bitBlt(this, 0, 0, &pm);
481 }
482
483 See also end().
484
486 QString &, int len = -1, QTextParag ** intern = 0 )
487 Returns the bounding rectangle of the aligned text that would be
488 printed with the corresponding drawText() function using the first len
489 characters of the string if len is > -1, or the whole of the string if
490 len is -1. The drawing, and hence the bounding rectangle, is
491 constrained to the rectangle that begins at point (x, y) with width w
492 and hight h, or to the rectangle required to draw the text, whichever
493 is the larger.
494
495 The flags argument is the bitwise OR of the following flags:
496 <center>.nf
497
498 </center>
499
500 Horizontal alignment defaults to AlignLeft and vertical alignment
501 defaults to AlignTop.
502
503 If several of the horizontal or several of the vertical alignment flags
504 are set, the resulting alignment is undefined.
505
506 The intern parameter should not be used.
507
508 See also Qt::TextFlags.
509
511 str, int len = -1, QTextParag ** internal = 0 )
512 This is an overloaded member function, provided for convenience. It
513 behaves essentially like the above function.
514
515 Returns the bounding rectangle of the aligned text that would be
516 printed with the corresponding drawText() function using the first len
517 characters from str if len is > -1, or the whole of str if len is -1.
518 The drawing, and hence the bounding rectangle, is constrained to the
519 rectangle r, or to the rectangle required to draw the text, whichever
520 is the larger.
521
522 The internal parameter should not be used.
523
524 See also drawText(), fontMetrics(), QFontMetrics::boundingRect(), and
525 Qt::TextFlags.
526
528 Returns the painter's current brush.
529
530 See also QPainter::setBrush().
531
532 Examples:
533
535 Returns the brush origin currently set.
536
537 See also setBrushOrigin().
538
540 Returns the currently set clip region. Note that the clip region is
541 given in physical device coordinates and not subject to any coordinate
542 transformation if m is equal to CoordDevice (the default). If m equals
543 CoordPainter the returned region is in model coordinates.
544
545 See also setClipRegion(), setClipRect(), setClipping(), and
546 QPainter::CoordinateMode.
547
548 Example: themes/wood.cpp.
549
551 Returns the paint device on which this painter is currently painting,
552 or 0 if the painter is not active.
553
554 See also QPaintDevice::paintingActive().
555
556 Examples:
557
559 Draws an arc defined by the rectangle (x, y, w, h), the start angle a
560 and the arc length alen.
561
562 The angles a and alen are 1/16th of a degree, i.e. a full circle equals
563 5760 (16*360). Positive values of a and alen mean counter-clockwise
564 while negative values mean the clockwise direction. Zero degrees is at
565 the 3 o'clock position.
566
567 Example:
568
569 QPainter p( myWidget );
570 p.drawArc( 10,10, 70,100, 100*16, 160*16 ); // draws a "(" arc
571
572 See also drawPie() and drawChord().
573
575 This is an overloaded member function, provided for convenience. It
576 behaves essentially like the above function.
577
578 Draws the arc that fits inside the rectangle r with start angle a and
579 arc length alen.
580
582 Draws a chord defined by the rectangle (x, y, w, h), the start angle a
583 and the arc length alen.
584
585 The chord is filled with the current brush().
586
587 The angles a and alen are 1/16th of a degree, i.e. a full circle equals
588 5760 (16*360). Positive values of a and alen mean counter-clockwise
589 while negative values mean the clockwise direction. Zero degrees is at
590 the 3 o'clock position.
591
592 See also drawArc() and drawPie().
593
595 This is an overloaded member function, provided for convenience. It
596 behaves essentially like the above function.
597
598 Draws a chord that fits inside the rectangle r with start angle a and
599 arc length alen.
600
602 npoints = -1 )
603 Draws the convex polygon defined by the npoints points in pa starting
604 at pa[index] (index defaults to 0).
605
606 If the supplied polygon is not convex, the results are undefined.
607
608 On some platforms (e.g. X Window), this is faster than drawPolygon().
609
610 Warning: On X11, coordinates that do not fit into 16-bit signed values
611 are truncated. This limitation is expected to go away in Qt 4.
612
613 Example: aclock/aclock.cpp.
614
616 Draws a cubic Bezier curve defined by the control points in a, starting
617 at a[index] (index defaults to 0).
618
619 Control points after a[index + 3] are ignored. Nothing happens if there
620 aren't enough control points.
621
622 Warning: On X11, coordinates that do not fit into 16-bit signed values
623 are truncated. This limitation is expected to go away in Qt 4.
624
626 Draws an ellipse with center at (x + w/2, y + h/2) and size (w, h).
627
628 Examples:
629
631 This is an overloaded member function, provided for convenience. It
632 behaves essentially like the above function.
633
634 Draws the ellipse that fits inside rectangle r.
635
637 sy = 0, int sw = -1, int sh = -1, int conversionFlags = 0 )
638 Draws at (x, y) the sw by sh area of pixels from (sx, sy) in image,
639 using conversionFlags if the image needs to be converted to a pixmap.
640 The default value for conversionFlags is 0; see convertFromImage() for
641 information about what other values do.
642
643 This function may convert image to a pixmap and then draw it, if
644 device() is a QPixmap or a QWidget, or else draw it directly, if
645 device() is a QPrinter or QPicture.
646
647 Currently alpha masks of the image are ignored when painting on a
648 QPrinter.
649
650 See also drawPixmap() and QPixmap::convertFromImage().
651
652 Example: canvas/canvas.cpp.
653
655 int conversionFlags = 0 )
656 This is an overloaded member function, provided for convenience. It
657 behaves essentially like the above function.
658
659 Draws the rectangle sr from the image at the given point.
660
662 conversion_flags = 0 )
663 This is an overloaded member function, provided for convenience. It
664 behaves essentially like the above function.
665
666 Draws the image i at point p.
667
668 If the image needs to be modified to fit in a lower-resolution result
669 (e.g. converting from 32-bit to 8-bit), use the conversion_flags to
670 specify how you'd prefer this to happen.
671
672 See also Qt::ImageConversionFlags.
673
675 This is an overloaded member function, provided for convenience. It
676 behaves essentially like the above function.
677
678 Draws the image i into the rectangle r. The image will be scaled to fit
679 the rectangle if image and rectangle dimensions differ.
680
682 Draws a line from (x1, y1) to (x2, y2) and sets the current pen
683 position to (x2, y2).
684
685 See also pen().
686
687 Examples:
688
690 This is an overloaded member function, provided for convenience. It
691 behaves essentially like the above function.
692
693 Draws a line from point p1 to point p2.
694
696 nlines = -1 )
697 Draws nlines separate lines from points defined in a, starting at
698 a[index] (index defaults to 0). If nlines is -1 (the default) all
699 points until the end of the array are used (i.e. (a.size()-index)/2
700 lines are drawn).
701
702 Draws the 1st line from a[index] to a[index+1]. Draws the 2nd line from
703 a[index+2] to a[index+3] etc.
704
705 Warning: On X11, coordinates that do not fit into 16-bit signed values
706 are truncated. This limitation is expected to go away in Qt 4.
707
708 See also drawPolyline(), drawPolygon(), and QPen.
709
711 Replays the picture pic translated by (x, y).
712
713 This function does exactly the same as QPicture::play() when called
714 with (x, y) = (0, 0).
715
716 Examples:
717
719 This function is obsolete. It is provided to keep old source working.
720 We strongly advise against using it in new code.
721
722 Use one of the other QPainter::drawPicture() functions with a (0, 0)
723 offset instead.
724
726 This is an overloaded member function, provided for convenience. It
727 behaves essentially like the above function.
728
729 Draws picture pic at point p.
730
732 Draws a pie defined by the rectangle (x, y, w, h), the start angle a
733 and the arc length alen.
734
735 The pie is filled with the current brush().
736
737 The angles a and alen are 1/16th of a degree, i.e. a full circle equals
738 5760 (16*360). Positive values of a and alen mean counter-clockwise
739 while negative values mean the clockwise direction. Zero degrees is at
740 the 3 o'clock position.
741
742 See also drawArc() and drawChord().
743
744 Examples:
745
747 This is an overloaded member function, provided for convenience. It
748 behaves essentially like the above function.
749
750 Draws a pie segment that fits inside the rectangle r with start angle a
751 and arc length alen.
752
754 int sy = 0, int sw = -1, int sh = -1 )
755 Draws a pixmap at (x, y) by copying a part of pixmap into the paint
756 device.
757
758 (x, y) specifies the top-left point in the paint device that is to be
759 drawn onto. (sx, sy) specifies the top-left point in pixmap that is to
760 be drawn. The default is (0, 0).
761
762 (sw, sh) specifies the size of the pixmap that is to be drawn. The
763 default, (-1, -1), means all the way to the bottom right of the pixmap.
764
765 Currently the mask of the pixmap or it's alpha channel are ignored when
766 painting on a QPrinter.
767
768 See also bitBlt() and QPixmap::setMask().
769
770 Examples:
771
773 & sr )
774 This is an overloaded member function, provided for convenience. It
775 behaves essentially like the above function.
776
777 Draws the rectangle sr of pixmap pm with its origin at point p.
778
780 This is an overloaded member function, provided for convenience. It
781 behaves essentially like the above function.
782
783 Draws the pixmap pm with its origin at point p.
784
786 This is an overloaded member function, provided for convenience. It
787 behaves essentially like the above function.
788
789 Draws the pixmap pm into the rectangle r. The pixmap is scaled to fit
790 the rectangle, if image and rectangle size disagree.
791
793 Draws/plots a single point at (x, y) using the current pen.
794
795 See also QPen.
796
797 Examples:
798
800 This is an overloaded member function, provided for convenience. It
801 behaves essentially like the above function.
802
803 Draws the point p.
804
806 = -1 )
807 Draws/plots an array of points, a, using the current pen.
808
809 If index is non-zero (the default is zero) only points from index are
810 drawn. If npoints is negative (the default) the rest of the points from
811 index are drawn. If npoints is zero or greater, npoints points are
812 drawn.
813
814 Warning: On X11, coordinates that do not fit into 16-bit signed values
815 are truncated. This limitation is expected to go away in Qt 4.
816
818 index = 0, int npoints = -1 )
819 Draws the polygon defined by the npoints points in a starting at
820 a[index]. (index defaults to 0.)
821
822 If npoints is -1 (the default) all points until the end of the array
823 are used (i.e. a.size()-index line segments define the polygon).
824
825 The first point is always connected to the last point.
826
827 The polygon is filled with the current brush(). If winding is TRUE, the
828 polygon is filled using the winding fill algorithm. If winding is
829 FALSE, the polygon is filled using the even-odd (alternative) fill
830 algorithm.
831
832 Warning: On X11, coordinates that do not fit into 16-bit signed values
833 are truncated. This limitation is expected to go away in Qt 4.
834
835 See also drawLineSegments(), drawPolyline(), and QPen.
836
837 Examples:
838
840 npoints = -1 )
841 Draws the polyline defined by the npoints points in a starting at
842 a[index]. (index defaults to 0.)
843
844 If npoints is -1 (the default) all points until the end of the array
845 are used (i.e. a.size()-index-1 line segments are drawn).
846
847 Warning: On X11, coordinates that do not fit into 16-bit signed values
848 are truncated. This limitation is expected to go away in Qt 4.
849
850 See also drawLineSegments(), drawPolygon(), and QPen.
851
852 Examples:
853
855 Draws a rectangle with upper left corner at (x, y) and with width w and
856 height h.
857
858 See also QPen and drawRoundRect().
859
860 Examples:
861
863 This is an overloaded member function, provided for convenience. It
864 behaves essentially like the above function.
865
866 Draws the rectangle r.
867
869 yRnd = 25 )
870 Draws a rectangle with rounded corners at (x, y), with width w and
871 height h.
872
873 The xRnd and yRnd arguments specify how rounded the corners should be.
874 0 is angled corners, 99 is maximum roundedness.
875
876 The width and height include all of the drawn lines.
877
878 See also drawRect() and QPen.
879
880 Examples:
881
883
884 This is an overloaded member function, provided for convenience. It
885 behaves essentially like the above function.
886
887 Draws a rounded rectangle r, rounding to the x position xRnd and the y
888 position yRnd on each corner.
889
891 TextDirection dir = Auto )
892 Draws the text from position pos, at point p. If len is -1 the entire
893 string is drawn, otherwise just the first len characters. The text's
894 direction is specified by dir.
895
896 Note that the meaning of y is not the same for the two drawText()
897 varieties. For overloads that take a simple x, y pair (or a point), the
898 y value is the text's baseline; for overloads that take a rectangle,
899 rect.y() is the top of the rectangle and the text is aligned within
900 that rectangle in accordance with the alignment flags.
901
902 See also QPainter::TextDirection.
903
904 Examples:
905
907 TextDirection dir = Auto )
908 This is an overloaded member function, provided for convenience. It
909 behaves essentially like the above function.
910
911 Draws the given text at position x, y. If len is -1 (the default) all
912 the text is drawn, otherwise the first len characters are drawn. The
913 text's direction is given by dir.
914
915 See also QPainter::TextDirection.
916
918 TextDirection dir = Auto )
919 This is an overloaded member function, provided for convenience. It
920 behaves essentially like the above function.
921
922 Draws the text at the given point.
923
924 See also QPainter::TextDirection.
925
927 TextDirection dir = Auto )
928 This is an overloaded member function, provided for convenience. It
929 behaves essentially like the above function.
930
931 Draws the text from position pos, at point (x, y). If len is -1 the
932 entire string is drawn, otherwise just the first len characters. The
933 text's direction is specified by dir.
934
936 &, int len = -1, QRect * br = 0, QTextParag ** internal = 0 )
937 This is an overloaded member function, provided for convenience. It
938 behaves essentially like the above function.
939
940 Draws the given text within the rectangle starting at x, y, with width
941 w and height h. If len is -1 (the default) all the text is drawn,
942 otherwise the first len characters are drawn. The text's flags that are
943 given in the flags parameter are Qt::AlignmentFlags and Qt::TextFlags
944 OR'd together. br (if not null) is set to the actual bounding rectangle
945 of the output. The internal parameter is for internal use only.
946
948 len = -1, QRect * brect = 0, QTextParag ** internal = 0 )
949 This is an overloaded member function, provided for convenience. It
950 behaves essentially like the above function.
951
952 Draws at most len characters from str in the rectangle r.
953
954 This function draws formatted text. The tf text format is really of
955 type Qt::AlignmentFlags and Qt::TextFlags OR'd together.
956
957 Horizontal alignment defaults to AlignAuto and vertical alignment
958 defaults to AlignTop.
959
960 brect (if not null) is set to the actual bounding rectangle of the
961 output. internal is, yes, internal.
962
963 See also boundingRect().
964
966 pixmap, int sx = 0, int sy = 0 )
967 Draws a tiled pixmap in the specified rectangle.
968
969 (x, y) specifies the top-left point in the paint device that is to be
970 drawn onto; with the width and height given by w and h. (sx, sy)
971 specifies the top-left point in pixmap that is to be drawn. The default
972 is (0, 0).
973
974 Calling drawTiledPixmap() is similar to calling drawPixmap() several
975 times to fill (tile) an area with a pixmap, but is potentially much
976 more efficient depending on the underlying window system.
977
978 See also drawPixmap().
979
981 QPoint & sp )
982 This is an overloaded member function, provided for convenience. It
983 behaves essentially like the above function.
984
985 Draws a tiled pixmap, pm, inside rectangle r with its origin at point
986 sp.
987
989 This is an overloaded member function, provided for convenience. It
990 behaves essentially like the above function.
991
992 Draws a tiled pixmap, pm, inside rectangle r.
993
995 bgColor )
996 Draws a Windows focus rectangle with upper left corner at (x, y) and
997 with width w and height h using a pen color that contrasts with
998 bgColor.
999
1000 This function draws a stippled rectangle (XOR is not used) that is used
1001 to indicate keyboard focus (when the QApplication::style() is
1002 WindowStyle).
1003
1004 The pen color used to draw the rectangle is either white or black
1005 depending on the color of bgColor (see QColor::gray()).
1006
1007 Warning: This function draws nothing if the coordinate system has been
1008 rotated or sheared.
1009
1010 See also drawRect() and QApplication::style().
1011
1013 This is an overloaded member function, provided for convenience. It
1014 behaves essentially like the above function.
1015
1016 Draws a Windows focus rectangle with upper left corner at (x, y) and
1017 with width w and height h.
1018
1019 This function draws a stippled XOR rectangle that is used to indicate
1020 keyboard focus (when QApplication::style() is WindowStyle).
1021
1022 Warning: This function draws nothing if the coordinate system has been
1023 rotated or sheared.
1024
1025 See also drawRect() and QApplication::style().
1026
1028 This is an overloaded member function, provided for convenience. It
1029 behaves essentially like the above function.
1030
1031 Draws rectangle r as a window focus rectangle.
1032
1034 This is an overloaded member function, provided for convenience. It
1035 behaves essentially like the above function.
1036
1037 Draws rectangle r as a window focus rectangle using background color
1038 bgColor.
1039
1041 Ends painting. Any resources used while painting are released.
1042
1043 Note that while you mostly don't need to call end(), the destructor
1044 will do it, there is at least one common case when it is needed, namely
1045 double buffering.
1046
1047 QPainter p( myPixmap, this )
1048 // ...
1049 p.end(); // stops drawing on myPixmap
1050 p.begin( this );
1051 p.drawPixmap( 0, 0, myPixmap );
1052
1053 Since you can't draw a QPixmap while it is being painted, it is
1054 necessary to close the active painter.
1055
1056 See also begin() and isActive().
1057
1058 Examples:
1059
1061 Erases the area inside x, y, w, h. Equivalent to fillRect( x, y, w, h,
1062 backgroundColor() ).
1063
1064 Examples:
1065
1067 This is an overloaded member function, provided for convenience. It
1068 behaves essentially like the above function.
1069
1070 Erases the area inside the rectangle r.
1071
1073 Fills the rectangle (x, y, w, h) with the brush.
1074
1075 You can specify a QColor as brush, since there is a QBrush constructor
1076 that takes a QColor argument and creates a solid pattern brush.
1077
1078 See also drawRect().
1079
1080 Examples:
1081
1083 This is an overloaded member function, provided for convenience. It
1084 behaves essentially like the above function.
1085
1086 Fills the rectangle r using brush brush.
1087
1089 )
1090 Flushes any buffered drawing operations inside the region region using
1091 clipping mode cm.
1092
1093 The flush may update the whole device if the platform does not support
1094 flushing to a specified region.
1095
1096 See also CoordinateMode.
1097
1099 This is an overloaded member function, provided for convenience. It
1100 behaves essentially like the above function.
1101
1102 Flushes any buffered drawing operations.
1103
1105 Returns the currently set painter font.
1106
1107 See also setFont() and QFont.
1108
1109 Example: fileiconview/qfileiconview.cpp.
1110
1112 Returns the font info for the painter, if the painter is active. It is
1113 not possible to obtain font information for an inactive painter, so the
1114 return value is undefined if the painter is not active.
1115
1116 See also fontMetrics() and isActive().
1117
1119 Returns the font metrics for the painter, if the painter is active. It
1120 is not possible to obtain metrics for an inactive painter, so the
1121 return value is undefined if the painter is not active.
1122
1123 See also fontInfo() and isActive().
1124
1125 Examples:
1126
1128 Returns the platform-dependent handle used for drawing. Using this
1129 function is not portable.
1130
1132 Returns TRUE if clipping has been set; otherwise returns FALSE.
1133
1134 See also setClipping().
1135
1136 Example: themes/wood.cpp.
1137
1139 Returns TRUE if view transformation is enabled; otherwise returns
1140 FALSE.
1141
1142 See also setViewXForm() and xForm().
1143
1145 Returns TRUE if world transformation is enabled; otherwise returns
1146 FALSE.
1147
1148 See also setWorldXForm().
1149
1151 Returns TRUE if the painter is active painting, i.e. begin() has been
1152 called and end() has not yet been called; otherwise returns FALSE.
1153
1154 See also QPaintDevice::paintingActive().
1155
1156 Examples:
1157
1159 This function is obsolete. It is provided to keep old source working.
1160 We strongly advise against using it in new code.
1161
1162 Use drawLine() instead.
1163
1164 Draws a line from the current pen position to (x, y) and sets (x, y) to
1165 be the new current pen position.
1166
1167 See also QPen, moveTo(), drawLine(), and pos().
1168
1170 This is an overloaded member function, provided for convenience. It
1171 behaves essentially like the above function.
1172
1173 Draws a line to the point p.
1174
1176 This function is obsolete. It is provided to keep old source working.
1177 We strongly advise against using it in new code.
1178
1179 Sets the current pen position to (x, y)
1180
1181 See also lineTo() and pos().
1182
1184 This is an overloaded member function, provided for convenience. It
1185 behaves essentially like the above function.
1186
1187 Moves to the point p.
1188
1190 Returns the painter's current pen.
1191
1192 See also setPen().
1193
1194 Examples:
1195
1197 This function is obsolete. It is provided to keep old source working.
1198 We strongly advise against using it in new code.
1199
1200 Returns the current position of the pen.
1201
1202 See also moveTo().
1203
1205 Returns the current raster operation.
1206
1207 See also setRasterOp() and RasterOp.
1208
1210 [static]
1211 Redirects all paint commands for a paint device, pdev, to another paint
1212 device, replacement, unless replacement is 0. If replacement is 0, the
1213 redirection for pdev is removed.
1214
1215 In general, you'll probably find calling QPixmap::grabWidget() or
1216 QPixmap::grabWindow() is an easier solution.
1217
1219 Resets any transformations that were made using translate(), scale(),
1220 shear(), rotate(), setWorldMatrix(), setViewport() and setWindow().
1221
1222 See also worldMatrix(), viewport(), and window().
1223
1225 Restores the current painter state (pops a saved state off the stack).
1226
1227 See also save().
1228
1229 Example: aclock/aclock.cpp.
1230
1232 This function is obsolete. It is provided to keep old source working.
1233 We strongly advise against using it in new code.
1234
1235 We recommend using restore() instead.
1236
1238 Rotates the coordinate system a degrees counterclockwise.
1239
1240 See also translate(), scale(), shear(), resetXForm(), setWorldMatrix(),
1241 and xForm().
1242
1243 Examples:
1244
1246 Saves the current painter state (pushes the state onto a stack). A
1247 save() must be followed by a corresponding restore(). end() unwinds the
1248 stack.
1249
1250 See also restore().
1251
1252 Example: aclock/aclock.cpp.
1253
1255 This function is obsolete. It is provided to keep old source working.
1256 We strongly advise against using it in new code.
1257
1258 We recommend using save() instead.
1259
1261 Scales the coordinate system by (sx, sy).
1262
1263 See also translate(), shear(), rotate(), resetXForm(),
1264 setWorldMatrix(), and xForm().
1265
1266 Example: xform/xform.cpp.
1267
1269 Sets the background color of the painter to c.
1270
1271 The background color is the color that is filled in when drawing opaque
1272 text, stippled lines and bitmaps. The background color has no effect in
1273 transparent background mode (which is the default).
1274
1275 See also backgroundColor(), setBackgroundMode(), and BackgroundMode.
1276
1278 Sets the background mode of the painter to m, which must be either
1279 TransparentMode (the default) or OpaqueMode.
1280
1281 Transparent mode draws stippled lines and text without setting the
1282 background pixels. Opaque mode fills these space with the current
1283 background color.
1284
1285 Note that in order to draw a bitmap or pixmap transparently, you must
1286 use QPixmap::setMask().
1287
1288 See also backgroundMode() and setBackgroundColor().
1289
1290 Example: picture/picture.cpp.
1291
1293 Sets the painter's brush to black color and the specified style.
1294
1295 See also brush() and QBrush.
1296
1297 Examples:
1298
1300 This is an overloaded member function, provided for convenience. It
1301 behaves essentially like the above function.
1302
1303 Sets the painter's brush to brush.
1304
1305 The brush defines how shapes are filled.
1306
1307 See also brush().
1308
1310 This is an overloaded member function, provided for convenience. It
1311 behaves essentially like the above function.
1312
1313 Sets the painter's brush to have style SolidPattern and the specified
1314 color.
1315
1316 See also brush() and QBrush.
1317
1319 Sets the brush origin to (x, y).
1320
1321 The brush origin specifies the (0, 0) coordinate of the painter's
1322 brush. This setting only applies to pattern brushes and pixmap brushes.
1323
1324 See also brushOrigin().
1325
1327 This is an overloaded member function, provided for convenience. It
1328 behaves essentially like the above function.
1329
1330 Sets the brush origin to point p.
1331
1333 CoordDevice )
1334 Sets the clip region to the rectangle x, y, w, h and enables clipping.
1335 The clip mode is set to m.
1336
1337 If m is CoordDevice (the default), the coordinates given for the clip
1338 region are taken to be physical device coordinates and are not subject
1339 to any coordinate transformations. If m is CoordPainter, the
1340 coordinates given for the clip region are taken to be model
1341 coordinates.
1342
1343 See also setClipRegion(), clipRegion(), setClipping(), and
1344 QPainter::CoordinateMode.
1345
1346 Examples:
1347
1349
1350 This is an overloaded member function, provided for convenience. It
1351 behaves essentially like the above function.
1352
1353 Sets the clip region to the rectangle r and enables clipping. The clip
1354 mode is set to m.
1355
1356 See also CoordinateMode.
1357
1359 CoordDevice )
1360 Sets the clip region to rgn and enables clipping. The clip mode is set
1361 to m.
1362
1363 Note that the clip region is given in physical device coordinates and
1364 not subject to any coordinate transformation.
1365
1366 See also setClipRect(), clipRegion(), setClipping(), and
1367 CoordinateMode.
1368
1369 Examples:
1370
1372 Enables clipping if enable is TRUE, or disables clipping if enable is
1373 FALSE.
1374
1375 See also hasClipping(), setClipRect(), and setClipRegion().
1376
1377 Example: themes/wood.cpp.
1378
1380 Sets the painter's font to font.
1381
1382 This font is used by subsequent drawText() functions. The text color is
1383 the same as the pen color.
1384
1385 See also font() and drawText().
1386
1387 Examples:
1388
1390 Sets a new painter pen.
1391
1392 The pen defines how to draw lines and outlines, and it also defines the
1393 text color.
1394
1395 See also pen().
1396
1397 Examples:
1398
1400 This is an overloaded member function, provided for convenience. It
1401 behaves essentially like the above function.
1402
1403 Sets the painter's pen to have style style, width 0 and black color.
1404
1405 See also pen() and QPen.
1406
1408 This is an overloaded member function, provided for convenience. It
1409 behaves essentially like the above function.
1410
1411 Sets the painter's pen to have style SolidLine, width 0 and the
1412 specified color.
1413
1414 See also pen() and QPen.
1415
1417 Sets the raster operation to r. The default is CopyROP.
1418
1419 See also rasterOp() and Qt::RasterOp.
1420
1422 Sets the tab stop array to ta. This puts tab stops at ta[0], ta[1] and
1423 so on. The array is null-terminated.
1424
1425 If both a tab array and a tab top size is set, the tab array wins.
1426
1427 See also tabArray(), setTabStops(), drawText(), and fontMetrics().
1428
1430 Set the tab stop width to ts, i.e. locates tab stops at ts, 2*ts, 3*ts
1431 and so on.
1432
1433 Tab stops are used when drawing formatted text with ExpandTabs set.
1434 This fixed tab stop value is used only if no tab array is set (which is
1435 the default case).
1436
1437 A value of 0 (the default) implies a tabstop setting of 8 times the
1438 width of the character 'x' in the font currently set on the painter.
1439
1440 See also tabStops(), setTabArray(), drawText(), and fontMetrics().
1441
1443 Enables view transformations if enable is TRUE, or disables view
1444 transformations if enable is FALSE.
1445
1446 See also hasViewXForm(), setWindow(), setViewport(), setWorldMatrix(),
1447 setWorldXForm(), and xForm().
1448
1450 Sets the viewport rectangle view transformation for the painter and
1451 enables view transformation.
1452
1453 The viewport rectangle is part of the view transformation. The viewport
1454 specifies the device coordinate system and is specified by the x, y, w
1455 width and h height parameters. Its sister, the window(), specifies the
1456 logical coordinate system.
1457
1458 The default viewport rectangle is the same as the device's rectangle.
1459 See the Coordinate System Overview for an overview of coordinate
1460 transformation.
1461
1462 See also viewport(), setWindow(), setViewXForm(), setWorldMatrix(),
1463 setWorldXForm(), and xForm().
1464
1465 Example: aclock/aclock.cpp.
1466
1468 This is an overloaded member function, provided for convenience. It
1469 behaves essentially like the above function.
1470
1471 Sets the painter's viewport to rectangle r.
1472
1474 Sets the window rectangle view transformation for the painter and
1475 enables view transformation.
1476
1477 The window rectangle is part of the view transformation. The window
1478 specifies the logical coordinate system and is specified by the x, y, w
1479 width and h height parameters. Its sister, the viewport(), specifies
1480 the device coordinate system.
1481
1482 The default window rectangle is the same as the device's rectangle. See
1483 the Coordinate System Overview for an overview of coordinate
1484 transformation.
1485
1486 See also window(), setViewport(), setViewXForm(), setWorldMatrix(), and
1487 setWorldXForm().
1488
1489 Examples:
1490
1492 This is an overloaded member function, provided for convenience. It
1493 behaves essentially like the above function.
1494
1495 Sets the painter's window to rectangle r.
1496
1498 Sets the world transformation matrix to m and enables world
1499 transformation.
1500
1501 If combine is TRUE, then m is combined with the current transformation
1502 matrix, otherwise m replaces the current transformation matrix.
1503
1504 If m is the identity matrix and combine is FALSE, this function calls
1505 setWorldXForm(FALSE). (The identity matrix is the matrix where
1506 QWMatrix::m11() and QWMatrix::m22() are 1.0 and the rest are 0.0.)
1507
1508 World transformations are applied after the view transformations (i.e.
1509 window and viewport).
1510
1511 The following functions can transform the coordinate system without
1512 using a QWMatrix:
1513
1514 translate()
1515
1516 scale()
1517
1518 shear()
1519
1520 rotate()
1521
1522 They operate on the painter's worldMatrix() and are implemented like
1523 this:
1524
1525 void QPainter::rotate( double a )
1526 {
1527 QWMatrix m;
1528 m.rotate( a );
1529 setWorldMatrix( m, TRUE );
1530 }
1531
1532 Note that you should always use combine when you are drawing into a
1533 QPicture. Otherwise it may not be possible to replay the picture with
1534 additional transformations. Using translate(), scale(), etc., is safe.
1535
1536 For a brief overview of coordinate transformation, see the Coordinate
1537 System Overview.
1538
1539 See also worldMatrix(), setWorldXForm(), setWindow(), setViewport(),
1540 setViewXForm(), xForm(), and QWMatrix.
1541
1542 Examples:
1543
1545 Enables world transformations if enable is TRUE, or disables world
1546 transformations if enable is FALSE. The world transformation matrix is
1547 not changed.
1548
1549 See also setWorldMatrix(), setWindow(), setViewport(), setViewXForm(),
1550 and xForm().
1551
1553 Shears the coordinate system by (sh, sv).
1554
1555 See also translate(), scale(), rotate(), resetXForm(),
1556 setWorldMatrix(), and xForm().
1557
1559 Returns the currently set tab stop array.
1560
1561 See also setTabArray().
1562
1564 Returns the tab stop setting.
1565
1566 See also setTabStops().
1567
1569 Translates the coordinate system by (dx, dy). After this call, (dx, dy)
1570 is added to points.
1571
1572 For example, the following code draws the same point twice:
1573
1574 void MyWidget::paintEvent()
1575 {
1576 QPainter paint( this );
1577 paint.drawPoint( 0, 0 );
1578 paint.translate( 100.0, 40.0 );
1579 paint.drawPoint( -100, -40 );
1580 }
1581
1582 See also scale(), shear(), rotate(), resetXForm(), setWorldMatrix(),
1583 and xForm().
1584
1585 Examples:
1586
1588 Returns the viewport rectangle.
1589
1590 See also setViewport() and setViewXForm().
1591
1592 Example: aclock/aclock.cpp.
1593
1595 Returns the window rectangle.
1596
1597 See also setWindow() and setViewXForm().
1598
1600 Returns the world transformation matrix.
1601
1602 See also setWorldMatrix().
1603
1605 Returns the point pv transformed from model coordinates to device
1606 coordinates.
1607
1608 See also xFormDev() and QWMatrix::map().
1609
1611 This is an overloaded member function, provided for convenience. It
1612 behaves essentially like the above function.
1613
1614 Returns the rectangle rv transformed from model coordinates to device
1615 coordinates.
1616
1617 If world transformation is enabled and rotation or shearing has been
1618 specified, then the bounding rectangle is returned.
1619
1620 See also xFormDev() and QWMatrix::map().
1621
1623 This is an overloaded member function, provided for convenience. It
1624 behaves essentially like the above function.
1625
1626 Returns the point array av transformed from model coordinates to device
1627 coordinates.
1628
1629 See also xFormDev() and QWMatrix::map().
1630
1632 const
1633 This is an overloaded member function, provided for convenience. It
1634 behaves essentially like the above function.
1635
1636 Returns the point array av transformed from model coordinates to device
1637 coordinates. The index is the first point in the array and npoints
1638 denotes the number of points to be transformed. If npoints is negative,
1639 all points from av[index] until the last point in the array are
1640 transformed.
1641
1642 The returned point array consists of the number of points that were
1643 transformed.
1644
1645 Example:
1646
1647 QPointArray a(10);
1648 QPointArray b;
1649 b = painter.xForm(a, 2, 4); // b.size() == 4
1650 b = painter.xForm(a, 2, -1); // b.size() == 8
1651
1652 See also xFormDev() and QWMatrix::map().
1653
1655 Returns the rectangle rd transformed from device coordinates to model
1656 coordinates.
1657
1658 If world transformation is enabled and rotation or shearing is used,
1659 then the bounding rectangle is returned.
1660
1661 See also xForm() and QWMatrix::map().
1662
1664 This is an overloaded member function, provided for convenience. It
1665 behaves essentially like the above function.
1666
1667 Returns the point pd transformed from device coordinates to model
1668 coordinates.
1669
1670 See also xForm() and QWMatrix::map().
1671
1673 This is an overloaded member function, provided for convenience. It
1674 behaves essentially like the above function.
1675
1676 Returns the point array ad transformed from device coordinates to model
1677 coordinates.
1678
1679 See also xForm() and QWMatrix::map().
1680
1682 npoints ) const
1683 This is an overloaded member function, provided for convenience. It
1684 behaves essentially like the above function.
1685
1686 Returns the point array ad transformed from device coordinates to model
1687 coordinates. The index is the first point in the array and npoints
1688 denotes the number of points to be transformed. If npoints is negative,
1689 all points from ad[index] until the last point in the array are
1690 transformed.
1691
1692 The returned point array consists of the number of points that were
1693 transformed.
1694
1695 Example:
1696
1697 QPointArray a(10);
1698 QPointArray b;
1699 b = painter.xFormDev(a, 1, 3); // b.size() == 3
1700 b = painter.xFormDev(a, 1, -1); // b.size() == 9
1701
1702 See also xForm() and QWMatrix::map().
1703
1706 c, int lineWidth, const QBrush * fill )
1707 #include <qdrawutil.h>
1708
1709 Draws the plain rectangle specified by (x, y, w, h) using the painter
1710 p.
1711
1712 The color argument c specifies the line color.
1713
1714 The lineWidth argument specifies the line width.
1715
1716 The rectangle's interior is filled with the fill brush unless fill is
1717 0.
1718
1719 If you want to use a QFrame widget instead, you can make it display a
1720 plain rectangle, for example QFrame::setFrameStyle( QFrame::Box |
1721 QFrame::Plain ).
1722
1723 Warning: This function does not look at QWidget::style() or
1724 QApplication::style(). Use the drawing functions in QStyle to make
1725 widgets that follow the current GUI style.
1726
1727 See also qDrawShadeRect() and QStyle::drawPrimitive().
1728
1730 QColorGroup & g, bool sunken, int lineWidth, int midLineWidth )
1731 #include <qdrawutil.h>
1732
1733 Draws a horizontal (y1 == y2) or vertical (x1 == x2) shaded line using
1734 the painter p.
1735
1736 Nothing is drawn if y1 != y2 and x1 != x2 (i.e. the line is neither
1737 horizontal nor vertical).
1738
1739 The color group argument g specifies the shading colors (light, dark
1740 and middle colors).
1741
1742 The line appears sunken if sunken is TRUE, or raised if sunken is
1743 FALSE.
1744
1745 The lineWidth argument specifies the line width for each of the lines.
1746 It is not the total line width.
1747
1748 The midLineWidth argument specifies the width of a middle line drawn in
1749 the QColorGroup::mid() color.
1750
1751 If you want to use a QFrame widget instead, you can make it display a
1752 shaded line, for example QFrame::setFrameStyle( QFrame::HLine |
1753 QFrame::Sunken ).
1754
1755 Warning: This function does not look at QWidget::style() or
1756 QApplication::style(). Use the drawing functions in QStyle to make
1757 widgets that follow the current GUI style.
1758
1759 See also qDrawShadeRect(), qDrawShadePanel(), and
1760 QStyle::drawPrimitive().
1761
1763 QColorGroup & g, bool sunken, int lineWidth, const QBrush * fill )
1764 #include <qdrawutil.h>
1765
1766 Draws the shaded panel specified by (x, y, w, h) using the painter p.
1767
1768 The color group argument g specifies the shading colors (light, dark
1769 and middle colors).
1770
1771 The panel appears sunken if sunken is TRUE, or raised if sunken is
1772 FALSE.
1773
1774 The lineWidth argument specifies the line width.
1775
1776 The panel's interior is filled with the fill brush unless fill is 0.
1777
1778 If you want to use a QFrame widget instead, you can make it display a
1779 shaded panel, for example QFrame::setFrameStyle( QFrame::Panel |
1780 QFrame::Sunken ).
1781
1782 Warning: This function does not look at QWidget::style() or
1783 QApplication::style(). Use the drawing functions in QStyle to make
1784 widgets that follow the current GUI style.
1785
1786 See also qDrawWinPanel(), qDrawShadeLine(), qDrawShadeRect(), and
1787 QStyle::drawPrimitive().
1788
1790 QColorGroup & g, bool sunken, int lineWidth, int midLineWidth, const
1791 QBrush * fill )
1792 #include <qdrawutil.h>
1793
1794 Draws the shaded rectangle specified by (x, y, w, h) using the painter
1795 p.
1796
1797 The color group argument g specifies the shading colors (light, dark
1798 and middle colors).
1799
1800 The rectangle appears sunken if sunken is TRUE, or raised if sunken is
1801 FALSE.
1802
1803 The lineWidth argument specifies the line width for each of the lines.
1804 It is not the total line width.
1805
1806 The midLineWidth argument specifies the width of a middle line drawn in
1807 the QColorGroup::mid() color.
1808
1809 The rectangle's interior is filled with the fill brush unless fill is
1810 0.
1811
1812 If you want to use a QFrame widget instead, you can make it display a
1813 shaded rectangle, for example QFrame::setFrameStyle( QFrame::Box |
1814 QFrame::Raised ).
1815
1816 Warning: This function does not look at QWidget::style() or
1817 QApplication::style(). Use the drawing functions in QStyle to make
1818 widgets that follow the current GUI style.
1819
1820 See also qDrawShadeLine(), qDrawShadePanel(), qDrawPlainRect(),
1821 QStyle::drawItem(), QStyle::drawControl(), and
1822 QStyle::drawComplexControl().
1823
1825 QColorGroup & g, bool sunken, const QBrush * fill )
1826 #include <qdrawutil.h>
1827
1828 Draws the Windows-style button specified by (x, y, w, h) using the
1829 painter p.
1830
1831 The color group argument g specifies the shading colors (light, dark
1832 and middle colors).
1833
1834 The button appears sunken if sunken is TRUE, or raised if sunken is
1835 FALSE.
1836
1837 The line width is 2 pixels.
1838
1839 The button's interior is filled with the *fill brush unless fill is 0.
1840
1841 Warning: This function does not look at QWidget::style() or
1842 QApplication::style(). Use the drawing functions in QStyle to make
1843 widgets that follow the current GUI style.
1844
1845 See also qDrawWinPanel() and QStyle::drawControl().
1846
1848 QColorGroup & g, bool sunken, const QBrush * fill )
1849 #include <qdrawutil.h>
1850
1851 Draws the Windows-style panel specified by (x, y, w, h) using the
1852 painter p.
1853
1854 The color group argument g specifies the shading colors.
1855
1856 The panel appears sunken if sunken is TRUE, or raised if sunken is
1857 FALSE.
1858
1859 The line width is 2 pixels.
1860
1861 The button's interior is filled with the fill brush unless fill is 0.
1862
1863 If you want to use a QFrame widget instead, you can make it display a
1864 shaded panel, for example QFrame::setFrameStyle( QFrame::WinPanel |
1865 QFrame::Raised ).
1866
1867 Warning: This function does not look at QWidget::style() or
1868 QApplication::style(). Use the drawing functions in QStyle to make
1869 widgets that follow the current GUI style.
1870
1871 See also qDrawShadePanel(), qDrawWinButton(), and
1872 QStyle::drawPrimitive().
1873
1874
1876 http://doc.trolltech.com/qpainter.html
1877 http://www.trolltech.com/faq/tech.html
1878
1880 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
1881 license file included in the distribution for a complete license
1882 statement.
1883
1885 Generated automatically from the source code.
1886
1888 If you find a bug in Qt, please report it as described in
1889 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
1890 help you. Thank you.
1891
1892 The definitive Qt documentation is provided in HTML format; it is
1893 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
1894 web browser. This man page is provided as a convenience for those users
1895 who prefer man pages, although this format is not officially supported
1896 by Trolltech.
1897
1898 If you find errors in this manual page, please report them to qt-
1899 bugs@trolltech.com. Please include the name of the manual page
1900 (qpainter.3qt) and the Qt version (3.3.8).
1901
1902
1903
1904Trolltech AS 2 February 2007 QPainter(3qt)