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

.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqpainter.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qpainter.3qt) and the Qt
version (3.3.8).