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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QPainter Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QPainter Class Reference</h1><br clear="all">
<p>
The QPainter class paints on paint devices.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qpainter-h.html">qpainter.h</a>></code>
<p>
Inherits <a href="qt.html">Qt</a>.
<p><a href="qpainter-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#52dcf0"><b>QPainter</b></a>()</div>
<li><div class="fn"><a href="#ef30ce"><b>QPainter</b></a>(constQPaintDevice*)</div>
<li><div class="fn"><a href="#b29a94"><b>QPainter</b></a>(constQPaintDevice*, constQWidget*)</div>
<li><div class="fn"><a href="#e2b0a9"><b>~QPainter</b></a>()</div>
<li><div class="fn">bool<a href="#02ed5d"><b>begin</b></a>(constQPaintDevice*)</div>
<li><div class="fn">bool<a href="#a5093e"><b>begin</b></a>(constQPaintDevice*, constQWidget*)</div>
<li><div class="fn">bool<a href="#365784"><b>end</b></a>()</div>
<li><div class="fn">QPaintDevice*<a href="#82920f"><b>device</b></a>()const</div>
<li><div class="fn">bool<a href="#08ba62"><b>isActive</b></a>()const</div>
<li><div class="fn">void<a href="#dfe955"><b>flush</b></a>()</div>
<li><div class="fn">void<a href="#938d23"><b>save</b></a>()</div>
<li><div class="fn">void<a href="#ddb3f4"><b>restore</b></a>()</div>
<li><div class="fn">QFontMetrics<a href="#73b2e5"><b>fontMetrics</b></a>()const</div>
<li><div class="fn">QFontInfo<a href="#5bdc93"><b>fontInfo</b></a>()const</div>
<li><div class="fn">constQFont&<a href="#9c1c8b"><b>font</b></a>()const</div>
<li><div class="fn">void<a href="#998df2"><b>setFont</b></a>(constQFont&)</div>
<li><div class="fn">constQPen&<a href="#3d26af"><b>pen</b></a>()const</div>
<li><div class="fn">void<a href="#cce332"><b>setPen</b></a>(constQPen&)</div>
<li><div class="fn">void<a href="#0183e4"><b>setPen</b></a>(PenStyle)</div>
<li><div class="fn">void<a href="#5f7c0d"><b>setPen</b></a>(constQColor&)</div>
<li><div class="fn">constQBrush&<a href="#29891f"><b>brush</b></a>()const</div>
<li><div class="fn">void<a href="#bd0ce6"><b>setBrush</b></a>(constQBrush&)</div>
<li><div class="fn">void<a href="#e739d3"><b>setBrush</b></a>(BrushStyle)</div>
<li><div class="fn">void<a href="#3e0cc8"><b>setBrush</b></a>(constQColor&)</div>
<li><div class="fn">QPoint<a href="#6bba26"><b>pos</b></a>()const</div>
<li><div class="fn">constQColor&<a href="#c2639b"><b>backgroundColor</b></a>()const</div>
<li><div class="fn">void<a href="#11d243"><b>setBackgroundColor</b></a>(constQColor&)</div>
<li><div class="fn">BGMode<a href="#172861"><b>backgroundMode</b></a>()const</div>
<li><div class="fn">void<a href="#10e1fd"><b>setBackgroundMode</b></a>(BGMode)</div>
<li><div class="fn">RasterOp<a href="#c3c5ab"><b>rasterOp</b></a>()const</div>
<li><div class="fn">void<a href="#116b42"><b>setRasterOp</b></a>(RasterOp)</div>
<li><div class="fn">constQPoint&<a href="#7d6354"><b>brushOrigin</b></a>()const</div>
<li><div class="fn">void<a href="#f09597"><b>setBrushOrigin</b></a>(intx, inty)</div>
<li><div class="fn">void<a href="#9d7e84"><b>setBrushOrigin</b></a>(constQPoint&)</div>
<li><div class="fn">bool<a href="#80f190"><b>hasViewXForm</b></a>()const</div>
<li><div class="fn">bool<a href="#c99db4"><b>hasWorldXForm</b></a>()const</div>
<li><div class="fn">void<a href="#a0205c"><b>setViewXForm</b></a>(bool)</div>
<li><div class="fn">QRect<a href="#99513c"><b>window</b></a>()const</div>
<li><div class="fn">void<a href="#4b3b14"><b>setWindow</b></a>(constQRect&)</div>
<li><div class="fn">void<a href="#ad8b2b"><b>setWindow</b></a>(intx, inty, intw, inth)</div>
<li><div class="fn">QRect<a href="#3ea58a"><b>viewport</b></a>()const</div>
<li><div class="fn">void<a href="#e8bac4"><b>setViewport</b></a>(constQRect&)</div>
<li><div class="fn">void<a href="#42d67a"><b>setViewport</b></a>(intx, inty, intw, inth)</div>
<li><div class="fn">void<a href="#f94066"><b>setWorldXForm</b></a>(bool)</div>
<li><div class="fn">constQWMatrix&<a href="#e876ac"><b>worldMatrix</b></a>()const</div>
<li><div class="fn">void<a href="#862c4d"><b>setWorldMatrix</b></a>(constQWMatrix&, boolcombine=FALSE)</div>
<li><div class="fn">voidsaveWorldMatrix()<em>(obsolete)</em></div>
<li><div class="fn">voidrestoreWorldMatrix()<em>(obsolete)</em></div>
<li><div class="fn">void<a href="#e5ec3e"><b>scale</b></a>(doublesx, doublesy)</div>
<li><div class="fn">void<a href="#c8634b"><b>shear</b></a>(doublesh, doublesv)</div>
<li><div class="fn">void<a href="#b5205c"><b>rotate</b></a>(doublea)</div>
<li><div class="fn">void<a href="#eb778c"><b>translate</b></a>(doubledx, doubledy)</div>
<li><div class="fn">void<a href="#ce98a7"><b>resetXForm</b></a>()</div>
<li><div class="fn">QPoint<a href="#1dcf7e"><b>xForm</b></a>(constQPoint&)const</div>
<li><div class="fn">QRect<a href="#7bdc70"><b>xForm</b></a>(constQRect&)const</div>
<li><div class="fn">QPointArray<a href="#e0c8bb"><b>xForm</b></a>(constQPointArray&)const</div>
<li><div class="fn">QPointArray<a href="#d8e506"><b>xForm</b></a>(constQPointArray&, intindex, intnpoints)const</div>
<li><div class="fn">QPoint<a href="#c40aed"><b>xFormDev</b></a>(constQPoint&)const</div>
<li><div class="fn">QRect<a href="#072c4d"><b>xFormDev</b></a>(constQRect&)const</div>
<li><div class="fn">QPointArray<a href="#055761"><b>xFormDev</b></a>(constQPointArray&)const</div>
<li><div class="fn">QPointArray<a href="#dad1e3"><b>xFormDev</b></a>(constQPointArray&, intindex, intnpoints)const</div>
<li><div class="fn">void<a href="#79ea5e"><b>setClipping</b></a>(bool)</div>
<li><div class="fn">bool<a href="#c10fd1"><b>hasClipping</b></a>()const</div>
<li><div class="fn">constQRegion&<a href="#621dc8"><b>clipRegion</b></a>()const</div>
<li><div class="fn">void<a href="#37ec7f"><b>setClipRect</b></a>(constQRect&)</div>
<li><div class="fn">void<a href="#898839"><b>setClipRect</b></a>(intx, inty, intw, inth)</div>
<li><div class="fn">void<a href="#15cc78"><b>setClipRegion</b></a>(constQRegion&)</div>
<li><div class="fn">void<a href="#8e172b"><b>drawPoint</b></a>(intx, inty)</div>
<li><div class="fn">void<a href="#d39635"><b>drawPoint</b></a>(constQPoint&)</div>
<li><div class="fn">void<a href="#be1650"><b>drawPoints</b></a>(constQPointArray&a, intindex=0, intnpoints=-1)</div>
<li><div class="fn">void<a href="#093b37"><b>moveTo</b></a>(intx, inty)</div>
<li><div class="fn">void<a href="#52fc53"><b>moveTo</b></a>(constQPoint&)</div>
<li><div class="fn">void<a href="#d645f0"><b>lineTo</b></a>(intx, inty)</div>
<li><div class="fn">void<a href="#aee897"><b>lineTo</b></a>(constQPoint&)</div>
<li><div class="fn">void<a href="#e3a489"><b>drawLine</b></a>(intx1, inty1, intx2, inty2)</div>
<li><div class="fn">void<a href="#1db3a3"><b>drawLine</b></a>(constQPoint&, constQPoint&)</div>
<li><div class="fn">void<a href="#4c0077"><b>drawRect</b></a>(intx, inty, intw, inth)</div>
<li><div class="fn">void<a href="#139035"><b>drawRect</b></a>(constQRect&)</div>
<li><div class="fn">void<a href="#a439ba"><b>drawWinFocusRect</b></a>(intx, inty, intw, inth)</div>
<li><div class="fn">void<a href="#eb8e3d"><b>drawWinFocusRect</b></a>(intx, inty, intw, inth, constQColor&bgColor)</div>
<li><div class="fn">void<a href="#98179c"><b>drawWinFocusRect</b></a>(constQRect&)</div>
<li><div class="fn">void<a href="#fe168c"><b>drawWinFocusRect</b></a>(constQRect&, constQColor&bgColor)</div>
<li><div class="fn">void<a href="#887bfb"><b>drawRoundRect</b></a>(intx, inty, intw, inth, int, int)</div>
<li><div class="fn">void<a href="#c651e9"><b>drawRoundRect</b></a>(constQRect&, int, int)</div>
<li><div class="fn">void<a href="#a7ca82"><b>drawRoundRect</b></a>(intx, inty, intw, inth)</div>
<li><div class="fn">void<a href="#95b1c1"><b>drawRoundRect</b></a>(constQRect&)</div>
<li><div class="fn">void<a href="#f4ec3a"><b>drawEllipse</b></a>(intx, inty, intw, inth)</div>
<li><div class="fn">void<a href="#3aad04"><b>drawEllipse</b></a>(constQRect&)</div>
<li><div class="fn">void<a href="#5f530b"><b>drawArc</b></a>(intx, inty, intw, inth, inta, intalen)</div>
<li><div class="fn">void<a href="#606bfa"><b>drawArc</b></a>(constQRect&, inta, intalen)</div>
<li><div class="fn">void<a href="#3ca7a2"><b>drawPie</b></a>(intx, inty, intw, inth, inta, intalen)</div>
<li><div class="fn">void<a href="#b9bbaf"><b>drawPie</b></a>(constQRect&, inta, intalen)</div>
<li><div class="fn">void<a href="#53c4a8"><b>drawChord</b></a>(intx, inty, intw, inth, inta, intalen)</div>
<li><div class="fn">void<a href="#299450"><b>drawChord</b></a>(constQRect&, inta, intalen)</div>
<li><div class="fn">void<a href="#f0bc44"><b>drawLineSegments</b></a>(constQPointArray&, intindex=0, intnlines=-1)</div>
<li><div class="fn">void<a href="#134ad2"><b>drawPolyline</b></a>(constQPointArray&, intindex=0, intnpoints=-1)</div>
<li><div class="fn">void<a href="#2efe17"><b>drawPolygon</b></a>(constQPointArray&, boolwinding=FALSE, intindex=0, intnpoints=-1)</div>
<li><div class="fn">void<a href="#3d49cd"><b>drawQuadBezier</b></a>(constQPointArray&, intindex=0)</div>
<li><div class="fn">void<a href="#c64b89"><b>drawPixmap</b></a>(intx, inty, constQPixmap&, intsx=0, intsy=0, intsw=-1, intsh=-1)</div>
<li><div class="fn">void<a href="#a0cccd"><b>drawPixmap</b></a>(constQPoint&, constQPixmap&, constQRect&sr)</div>
<li><div class="fn">void<a href="#3b2d09"><b>drawPixmap</b></a>(constQPoint&, constQPixmap&)</div>
<li><div class="fn">void<a href="#8bee1c"><b>drawImage</b></a>(intx, inty, constQImage&, intsx=0, intsy=0, intsw=-1, intsh=-1)</div>
<li><div class="fn">void<a href="#cda718"><b>drawImage</b></a>(constQPoint&, constQImage&, constQRect&sr)</div>
<li><div class="fn">void<a href="#e33a64"><b>drawImage</b></a>(constQPoint&, constQImage&)</div>
<li><div class="fn">void<a href="#97b8df"><b>drawImage</b></a>(intx, inty, constQImage&, intsx, intsy, intsw, intsh, intconversion_flags)</div>
<li><div class="fn">void<a href="#3d2f25"><b>drawImage</b></a>(constQPoint&, constQImage&, constQRect&sr, intconversion_flags)</div>
<li><div class="fn">void<a href="#2cb865"><b>drawImage</b></a>(constQPoint&, constQImage&, intconversion_flags)</div>
<li><div class="fn">void<a href="#f56c59"><b>drawTiledPixmap</b></a>(intx, inty, intw, inth, constQPixmap&, intsx=0, intsy=0)</div>
<li><div class="fn">void<a href="#fa3eeb"><b>drawTiledPixmap</b></a>(constQRect&, constQPixmap&, constQPoint&)</div>
<li><div class="fn">void<a href="#8d1b87"><b>drawTiledPixmap</b></a>(constQRect&, constQPixmap&)</div>
<li><div class="fn">void<a href="#de93a0"><b>drawPicture</b></a>(constQPicture&)</div>
<li><div class="fn">void<a href="#5308a7"><b>fillRect</b></a>(intx, inty, intw, inth, constQBrush&)</div>
<li><div class="fn">void<a href="#329888"><b>fillRect</b></a>(constQRect&, constQBrush&)</div>
<li><div class="fn">void<a href="#bd5570"><b>eraseRect</b></a>(intx, inty, intw, inth)</div>
<li><div class="fn">void<a href="#04ae92"><b>eraseRect</b></a>(constQRect&)</div>
<li><div class="fn">void<a href="#0f088f"><b>drawText</b></a>(intx, inty, constQString&, intlen=-1)</div>
<li><div class="fn">void<a href="#9f83c5"><b>drawText</b></a>(constQPoint&, constQString&, intlen=-1)</div>
<li><div class="fn">void<a href="#a096b1"><b>drawText</b></a>(intx, inty, intw, inth, intflags, constQString&, intlen=-1, QRect*br=0, char**internal=0)</div>
<li><div class="fn">void<a href="#f06f01"><b>drawText</b></a>(constQRect&, intflags, constQString&, intlen=-1, QRect*br=0, char**internal=0)</div>
<li><div class="fn">QRect<a href="#c89857"><b>boundingRect</b></a>(intx, inty, intw, inth, intflags, constQString&, intlen=-1, char**intern=0)</div>
<li><div class="fn">QRect<a href="#ae4891"><b>boundingRect</b></a>(constQRect&, intflags, constQString&, intlen=-1, char**intern=0)</div>
<li><div class="fn">int<a href="#a33db6"><b>tabStops</b></a>()const</div>
<li><div class="fn">void<a href="#9e77b6"><b>setTabStops</b></a>(int)</div>
<li><div class="fn">int*<a href="#2ecad2"><b>tabArray</b></a>()const</div>
<li><div class="fn">void<a href="#c37498"><b>setTabArray</b></a>(int*)</div>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class="fn">void<a href="#ab2ec8"><b>redirect</b></a>(QPaintDevice*pdev, QPaintDevice*replacement)</div>
<li><div class="fn">void<a href="#360b25"><b>initialize</b></a>()</div>
<li><div class="fn">void<a href="#433f9d"><b>cleanup</b></a>()</div>
</ul>
<h2>Related Functions</h2>
(Note that these are not member functions.)
<ul>
<li>void <a href="qpainter.html#0553b3"><b>qDrawPlainRect</b></a> (QPainter * p, int x, int y, int w, int h, const QColor & c, int lineWidth, const QBrush * fill)
<li>void <a href="qpainter.html#2d8a65"><b>qDrawWinPanel</b></a> (QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, const QBrush * fill)
<li>void <a href="qpainter.html#3beef6"><b>qDrawShadeLine</b></a> (QPainter * p, int x1, int y1, int x2, int y2, const QColorGroup & g, bool sunken, int lineWidth, int midLineWidth)
<li>void <a href="qpainter.html#a47a35"><b>qDrawShadeRect</b></a> (QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, int lineWidth, int midLineWidth, const QBrush * fill)
<li>void <a href="qpainter.html#b03ffb"><b>qDrawShadePanel</b></a> (QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, int lineWidth, const QBrush * fill)
<li>void <a href="qpainter.html#e5134d"><b>qDrawWinButton</b></a> (QPainter * p, int x, int y, int w, int h, const QColorGroup & g, bool sunken, const QBrush * fill)
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QPainter class paints on paint devices.
<p>
The painter provides efficient graphics rendering on any
<a href="qpaintdevice.html">QPaintDevice</a> object. QPainter can draw everything from simple lines
to complex shapes like pies and chords. It can also draw aligned
text and pixmaps. Normally, it draws in a "natural" coordinate
system, but it can also do view and world transformation.
<p>The typical use of a painter is:
<p><ol>
<li> Construct a painter.
<li> Set a pen, a brush etc.
<li> Draw.
<li> Destroy the painter.
</ol>
<p>Mostly, all this is done inside a paint event. (In fact, 99% of all
QPainter use is in a reimplementation of <a href="qwidget.html#e3d821">QWidget::paintEvent</a>()).
Here's one very simple example:
<p><pre> void SimpleExampleWidget::paintEvent()
{
<a href="qpainter.html">QPainter</a> paint( this );
paint.<a href="#0183e4">setPen</a>( Qt::blue );
paint.<a href="#0f088f">drawText</a>( rect(), AlignCenter, "The Text" );
}
</pre>
<p>Simple. However, there are many settings you may use: <ul>
<li> <a href="#9c1c8b">font</a>() is the currently set font. If you set a font that isn't
available, Qt finds a close match. In that case font() returns what
you set using <a href="#998df2">setFont</a>() and <a href="#5bdc93">fontInfo</a>() returns the font actually
being used.
<li> <a href="#29891f">brush</a>() is the currently set brush; the color or pattern
that's used for filling e.g. circles.
<li> <a href="#3d26af">pen</a>() is the currently set pen; the color or stipple that's
used for drawing lines or boundaries.
<li> <a href="#172861">backgroundMode</a>() is <code>Opaque</code> or <code>Transparent,</code> ie. whether
<a href="#c2639b">backgroundColor</a>() is used or not.
<li> backgroundColor() only applies when backgroundMode() is Opaque
and pen() is a stipple. In that case, it describes the color of the
background pixels in the stipple.
<li> <a href="#c3c5ab">rasterOp</a>() is how pixels drawn interact with the data already
there.
<li> <a href="#7d6354">brushOrigin</a>() is the origin of the tiled brushes, normally the
origin of the window.
<li> <a href="#3ea58a">viewport</a>(), <a href="#99513c">window</a>(), <a href="#e876ac">worldMatrix</a>() and many more make up the
painter's coordinate transformation system. See <a href="coordsys.html">The Coordinate System</a> for an explanation of this, or a
paragraph below for a quick overview of the functions.
<li> clipping() is whether the painter clips at all. (The paint
device clips, too.) If the painter clips, it clips to <a href="#621dc8">clipRegion</a>().
<li> <a href="#6bba26">pos</a>() is the current position, set by <a href="#093b37">moveTo</a>() and used by
<a href="#d645f0">lineTo</a>().
<p></ul>
<p>Note that some of these settings mirror settings in some paint
devices, e.g. <a href="qwidget.html#167922">QWidget::font</a>(). <a href="#02ed5d">QPainter::begin</a>() (or the QPainter
constructor) copies these attributes from the paint device, changing
calling e.g. <a href="qwidget.html#090d60">QWidget::setFont</a>() doesn't take effect until the next
time a painter begins painting on it.
<p><a href="#938d23">save</a>() saves all of these settings on an internal stack, <a href="#ddb3f4">restore</a>()
pops them back.
<p>The core functionality of QPainter is drawing, and there are
functions to draw most primitives: <a href="#8e172b">drawPoint</a>(), <a href="#be1650">drawPoints</a>(),
<a href="#e3a489">drawLine</a>(), <a href="#4c0077">drawRect</a>(), <a href="#a1d38a">drawWinFocusRect</a>(), <a href="#887bfb">drawRoundRect</a>(),
<a href="#f4ec3a">drawEllipse</a>(), <a href="#5f530b">drawArc</a>(), <a href="#3ca7a2">drawPie</a>(), <a href="#53c4a8">drawChord</a>(),
<a href="#f0bc44">drawLineSegments</a>(), <a href="#134ad2">drawPolyline</a>(), <a href="#2efe17">drawPolygon</a>(), and
<a href="#3d49cd">drawQuadBezier</a>().
<p>There are functions to draw pixmaps/images, namely <a href="#c64b89">drawPixmap</a>(),
<a href="#97b8df">drawImage</a>() and <a href="#f56c59">drawTiledPixmap</a>(). drawPixmap() and drawImage()
produce the same result, except that drawPixmap() is faster
on-screen and drawImage() faster and sometimes better on <a href="qprinter.html">QPrinter</a>
and <a href="qpicture.html">QPicture</a>.
<p>Text drawing is done using <a href="#0f088f">drawText</a>(), and when you need
fine-grained positioning, <a href="#c89857">boundingRect</a>() tells you where a given
drawText() command would draw.
<p>There is a <a href="#de93a0">drawPicture</a>() that draws the contents of an entire
QPicture using this painter. drawPicture() is the only function
that disregards all the painter's settings: The QPicture has its own
settings.
<p>Normally, the QPainter operates on the device's own coordinate
system (usually pixels), but QPainter has good support for
coordinate transformation. See <a href="coordsys.html">The Coordinate
System</a> for a more general overview and a walkthrough of a
simple example.
<p>The most common functions used are <a href="#e5ec3e">scale</a>(), <a href="#b5205c">rotate</a>(), <a href="#eb778c">translate</a>()
and <a href="#c8634b">shear</a>(), all of which operate on the worldMatrix().
<a href="#862c4d">setWorldMatrix</a>() can replace or add to the currently set matrix().
<p><a href="#42d67a">setViewport</a>() sets the rectangle on which QPainter operates. The
default is the entire device, which is usually fine, except on
printers. <a href="#ad8b2b">setWindow</a>() sets the coordinate system, that is, the
rectangle that maps to viewport(). What's draws 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 a little speed.
<p>After all the coordinate transformation is done, QPainter can clip
the drawing to and arbitrary rectangle or region. <a href="#c10fd1">hasClipping</a>() is
TRUE if QPainter clips, and clipRegion() returns the clip region.
You can set it using either <a href="#15cc78">setClipRegion</a>() or <a href="#898839">setClipRect</a>(). Note
that the clipping can be slow. It's all system-dependent, but as a
rule of thumb, you can assume that drawing speed is inversely
proportional to the number of rectangles in the clip region.
<p>After QPainter's clipping, the paint device too will clip a bit.
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 <em>not</em> reflected by the return
value of clipRegion() or hasClipping().
<p>Finally, QPainter includes some little-used functions that are very
handy the few times you need them.
<p><a href="#08ba62">isActive</a>() indicates whether the painter is active. <a href="#02ed5d">begin</a>() (and
the most usual constructor) makes it active. <a href="#365784">end</a>() (and the
destructor) deactivates it. If the painter is active, <a href="#82920f">device</a>()
returns the paint device on which the painter paints.
<p>Sometimes it is desirable to make someone else paint on an unusual
QPaintDevice. QPainter supports a static function to do this,
<a href="#ab2ec8">redirect</a>(). We recommend not using it, but for some hacks it's
perfect.
<p><a href="#9e77b6">setTabStops</a>() and <a href="#c37498">setTabArray</a>() can change where the
tab stops are, but these are very seldomly used.<p><b>Warning:</b> Note that QPainter does not attempt to work around
coordinate limitations in the underlying window system. Some
platforms may behave incorrectly with coordinates as small as +/-
4000.
<p>See also <a href="qpaintdevice.html">QPaintDevice</a>, <a href="qwidget.html">QWidget</a>, <a href="qpixmap.html">QPixmap</a>, <a href="qprinter.html">QPrinter</a>, <a href="qpicture.html">QPicture</a>, <a href="simple-application.html">Application Walkthrough</a> and <a href="coordsys.html">Coordinate System Overview</a>
<p>Examples:
<a href="qtimage-qtimage-cpp.html#QPainter">qtimage/qtimage.cpp</a>
<a href="grapher-grapher-cpp.html#QPainter">grapher/grapher.cpp</a>
<a href="drawlines-connect-cpp.html#QPainter">drawlines/connect.cpp</a>
<a href="xform-xform-cpp.html#QPainter">xform/xform.cpp</a>
<a href="drawdemo-drawdemo-cpp.html#QPainter">drawdemo/drawdemo.cpp</a>
<a href="menu-menu-cpp.html#QPainter">menu/menu.cpp</a>
<a href="progress-progress-cpp.html#QPainter">progress/progress.cpp</a>
<a href="qmag-qmag-cpp.html#QPainter">qmag/qmag.cpp</a>
<a href="splitter-splitter-cpp.html#QPainter">splitter/splitter.cpp</a>
<a href="forever-forever-cpp.html#QPainter">forever/forever.cpp</a>
<a href="desktop-desktop-cpp.html#QPainter">desktop/desktop.cpp</a>
<a href="scrollview-scrollview-cpp.html#QPainter">scrollview/scrollview.cpp</a>
<a href="trivial-trivial-cpp.html#QPainter">trivial/trivial.cpp</a>
<a href="movies-main-cpp.html#QPainter">movies/main.cpp</a>
<a href="picture-picture-cpp.html#QPainter">picture/picture.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="52dcf0"></a>QPainter::QPainter()</h3>
<p>Constructs a painter.
<p>Notice that all painter settings (setPen,setBrush etc.) are reset to
default values when <a href="#02ed5d">begin</a>() is called.
<p>See also <a href="#02ed5d">begin</a>() and <a href="#365784">end</a>().
<h3 class="fn"><a name="ef30ce"></a>QPainter::QPainter(const<a href="qpaintdevice.html">QPaintDevice</a>*pd)</h3>
<p>Constructs a painter that begins painting the paint device <em>pd</em>
immediately.
<p>This constructor is convenient for short-lived painters, e.g. in
a <a href="qwidget.html#e3d821">paint event</a> and should be
used only once. The constructor calls <a href="#02ed5d">begin</a>() for you and the QPainter
destructor automatically calls <a href="#365784">end</a>().
<p>Here's an example using begin() and end():
<pre> void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
{
<a href="qpainter.html">QPainter</a> p;
p.<a href="#02ed5d">begin</a>( this );
p.<a href="#e3a489">drawLine</a>( ... ); // drawing code
p.<a href="#365784">end</a>();
}
</pre>
<p>The same example using this constructor:
<pre> void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
{
<a href="qpainter.html">QPainter</a> p( this );
p.<a href="#e3a489">drawLine</a>( ... ); // drawing code
}
</pre>
<p>See also <a href="#02ed5d">begin</a>() and <a href="#365784">end</a>().
<h3 class="fn"><a name="b29a94"></a>QPainter::QPainter(const<a href="qpaintdevice.html">QPaintDevice</a>*pd, const<a href="qwidget.html">QWidget</a>*copyAttributes)</h3>
<p>Constructs a painter that begins painting the paint device <em>pd</em>
immediately, with the default arguments taken from <em>copyAttributes.</em>
<p>See also <a href="#02ed5d">begin</a>().
<h3 class="fn"><a name="e2b0a9"></a>QPainter::~QPainter()</h3>
<p>Destructs the painter.
<h3 class="fn">const<a href="qcolor.html">QColor</a>&<a name="c2639b"></a>QPainter::backgroundColor()const</h3>
<p>Returns the current background color.
<p>See also <a href="#11d243">setBackgroundColor</a>() and <a href="qcolor.html">QColor</a>.
<h3 class="fn">BGMode<a name="172861"></a>QPainter::backgroundMode()const</h3>
<p>Returns the current background mode.
<p>See also <a href="#10e1fd">setBackgroundMode</a>() and BGMode.
<h3 class="fn">bool<a name="02ed5d"></a>QPainter::begin(const<a href="qpaintdevice.html">QPaintDevice</a>*pd)</h3>
<p>Begins painting the paint device <em>pd</em> and returns TRUE if successful,
or FALSE if an error occurs.
<p>The errors that can occur are serious problems, such as these:
<p><pre> p->begin( 0 ); // impossible - paint device cannot be 0
<a href="qpixmap.html">QPixmap</a> pm( 0, 0 );
p->begin( pm ); // impossible - pm.<a href="qpixmap.html#7803c4">isNull</a>();
p->begin( myWidget );
p2->begin( myWidget ); // impossible - only one painter at a time
</pre>
<p>Note that most of the time, you can use one of the constructors
instead of begin(), and that <a href="#365784">end</a>() is automatically done at
destruction.<p><b>Warning:</b> A paint device can only be painted by one painter at a time.
<p>See also <a href="#365784">end</a>() and <a href="#dfe955">flush</a>().
<p>Examples:
<a href="drawdemo-drawdemo-cpp.html#begin">drawdemo/drawdemo.cpp</a>
<a href="desktop-desktop-cpp.html#begin">desktop/desktop.cpp</a>
<a href="picture-picture-cpp.html#begin">picture/picture.cpp</a>
<h3 class="fn">bool<a name="a5093e"></a>QPainter::begin(const<a href="qpaintdevice.html">QPaintDevice</a>*pd, const<a href="qwidget.html">QWidget</a>*copyAttributes)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>This version opens the painter on a paint device <em>pd</em> and sets the initial
pen, background color and font from <em>copyAttributes.</em> This is equivalent
with:
<pre> <a href="qpainter.html">QPainter</a> p;
p.<a href="#02ed5d">begin</a>( pd );
p.<a href="#0183e4">setPen</a>( copyAttributes->foregroundColor() );
p.<a href="#11d243">setBackgroundColor</a>( copyAttributes->backgroundColor() );
p.<a href="#998df2">setFont</a>( copyAttributes->font() );
</pre>
<p>This begin function is convenient for double buffering. When you
draw in a pixmap instead of directly in a widget (to later bitBlt
the pixmap into the widget) you will need to set the widgets's
font etc. This function does exactly that.
<p>Example:
<pre> void MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
{
<a href="qpixmap.html">QPixmap</a> pm(size());
<a href="qpainter.html">QPainter</a> p;
p.<a href="#02ed5d">begin</a>(&pm, this);
// ... potential flickering paint operation ...
p.<a href="#365784">end</a>();
<a href="qpaintdevice.html#35ae2e">bitBlt</a>(this, 0, 0, &pm);
}
</pre>
<p>See also <a href="#365784">end</a>().
<h3 class="fn"><a href="qrect.html">QRect</a><a name="c89857"></a>QPainter::boundingRect(intx, inty, intw, inth, inttf, const<a href="qstring.html">QString</a>&str, intlen=-1, char**internal=0)</h3>
<p>Returns the bounding rectangle of the aligned text that would be
printed with the corresponding <a href="#0f088f">drawText</a>() function (the first <em>len</em>
characters from <em>str).</em> The drawing, and hence the bounding
rectangle, is constrained to the rectangle <em>(x,y,w,h).</em>
<p>If <em>len</em> is negative (default value), the whole string is used.
<p>The <em>tf</em> argument is
the bitwise OR of the following flags: <ul>
<li> <code>AlignLeft</code> aligns to the left border.
<li> <code>AlignRight</code> aligns to the right border.
<li> <code>AlignHCenter</code> aligns horizontally centered.
<li> <code>AlignTop</code> aligns to the top border.
<li> <code>AlignBottom</code> aligns to the bottom border.
<li> <code>AlignVCenter</code> aligns vertically centered
<li> <code>AlignCenter</code> (= <code>AlignHCenter</code> | AlignVCenter)
<li> <code>SingleLine</code> ignores newline characters in the text.
<li> <code>ExpandTabs</code> expands tabulators.
<li> <code>ShowPrefix</code> interprets "&x" as "x" underlined.
<li> <code>WordBreak</code> breaks the text to fit the rectangle.
</ul>
<p>Horizontal alignment defaults to AlignLeft and vertical alignment
defaults to AlignTop.
<p>If several of the horizontal or several of the vertical alignment flags
are set, the resulting alignment is undefined.
<p>These flags are defined in <a href="qnamespace-h.html">qnamespace.h</a>.
<p>See also <a href="#0f088f">drawText</a>(), <a href="#73b2e5">fontMetrics</a>(), <a href="qfontmetrics.html#b1cd55">QFontMetrics::boundingRect</a>() and <a href="qt.html#AlignmentFlags">Qt::AlignmentFlags</a>.
<h3 class="fn"><a href="qrect.html">QRect</a><a name="ae4891"></a>QPainter::boundingRect(const<a href="qrect.html">QRect</a>&r, inttf, const<a href="qstring.html">QString</a>&, intlen=-1, char**i=0)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">const<a href="qbrush.html">QBrush</a>&<a name="29891f"></a>QPainter::brush()const</h3>
<p>Returns the current painter brush.
<p>See also <a href="#3e0cc8">QPainter::setBrush</a>().
<h3 class="fn">const<a href="qpoint.html">QPoint</a>&<a name="7d6354"></a>QPainter::brushOrigin()const</h3>
<p>Returns the brush origin currently set.
<p>See also <a href="#f09597">setBrushOrigin</a>().
<h3 class="fn">void<a name="433f9d"></a>QPainter::cleanup() <code>[static]</code></h3>
<p>Internal function that cleans up the painter.
<h3 class="fn">const<a href="qregion.html">QRegion</a>&<a name="621dc8"></a>QPainter::clipRegion()const</h3>
<p>Returns the currently set clip region. Note that the clip region is
given in physical device coordinates and <em>not</em> subject to any
<a href="coordsys.html">coordinate transformation.</a>
<p>See also <a href="#15cc78">setClipRegion</a>(), <a href="#898839">setClipRect</a>() and <a href="#79ea5e">setClipping</a>().
<h3 class="fn"><a href="qpaintdevice.html">QPaintDevice</a>*<a name="82920f"></a>QPainter::device()const</h3>
<p>Returns the paint device on which this painter is currently
painting, or null if the painter is not active.
<p>See also <a href="qpaintdevice.html#11c528">QPaintDevice::paintingActive</a>().
<h3 class="fn">void<a name="5f530b"></a>QPainter::drawArc(intx, inty, intw, inth, inta, intalen)</h3>
<p>Draws an arc defined by the rectangle <em>(x,y,w,h),</em> the start
angle <em>a</em> and the arc length <em>alen.</em>
<p>The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em> mean
counter-clockwise while negative values mean clockwise direction.
Zero degrees is at the 3'o clock position.
<p>Example:
<pre> <a href="qpainter.html">QPainter</a> p( myWidget );
p.<a href="#5f530b">drawArc</a>( 10,10, 70,100, 100*16, 160*16 ); // draws a "(" arc
</pre>
<p>See also <a href="#3ca7a2">drawPie</a>() and <a href="#53c4a8">drawChord</a>().
<h3 class="fn">void<a name="606bfa"></a>QPainter::drawArc(const<a href="qrect.html">QRect</a>&r, inta, intalen)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="53c4a8"></a>QPainter::drawChord(intx, inty, intw, inth, inta, intalen)</h3>
<p>Draws a chord defined by the rectangle <em>(x,y,w,h),</em> the start
angle <em>a</em> and the arc length <em>alen.</em>
<p>The chord is filled with the current <a href="#29891f">brush</a>().
<p>The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em> mean
counter-clockwise while negative values mean clockwise direction.
Zero degrees is at the 3'o clock position.
<p>See also <a href="#5f530b">drawArc</a>() and <a href="#3ca7a2">drawPie</a>().
<h3 class="fn">void<a name="299450"></a>QPainter::drawChord(const<a href="qrect.html">QRect</a>&r, inta, intalen)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="f4ec3a"></a>QPainter::drawEllipse(intx, inty, intw, inth)</h3>
<p>Draws an ellipse with center at <em>(x+w/2,y+h/2)</em> and size <em>(w,h).</em>
<p>Examples:
<a href="drawdemo-drawdemo-cpp.html#drawEllipse">drawdemo/drawdemo.cpp</a>
<a href="picture-picture-cpp.html#drawEllipse">picture/picture.cpp</a>
<h3 class="fn">void<a name="3aad04"></a>QPainter::drawEllipse(const<a href="qrect.html">QRect</a>&r)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="97b8df"></a>QPainter::drawImage(intx, inty, const<a href="qimage.html">QImage</a>&image, intsx, intsy, intsw, intsh, intconversion_flags)</h3>
<p>Draws at (<em>x, y)</em> the <em>sw</em> by <em>sh</em> area of pixels
from (<em>sx, sy)</em> in <em>image,</em> using <em>conversion_flags</em> if
the image needs to be converted to a pixmap.
<p>This function may convert <em>image</em> to a pixmap and then draw it, if
<a href="#82920f">device</a>() is a <a href="qpixmap.html">QPixmap</a> or a <a href="qwidget.html">QWidget</a>, or else draw it directly, if
device() is a <a href="qprinter.html">QPrinter</a> or <a href="qpicture.html">QPicture</a>.
<p>See also <a href="#c64b89">drawPixmap</a>() and <a href="qpixmap.html#00951a">QPixmap::convertFromImage</a>().
<h3 class="fn">void<a name="e33a64"></a>QPainter::drawImage(const<a href="qpoint.html">QPoint</a>&, const<a href="qimage.html">QImage</a>&)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="cda718"></a>QPainter::drawImage(const<a href="qpoint.html">QPoint</a>&, const<a href="qimage.html">QImage</a>&, const<a href="qrect.html">QRect</a>&sr)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="3d2f25"></a>QPainter::drawImage(const<a href="qpoint.html">QPoint</a>&, const<a href="qimage.html">QImage</a>&, const<a href="qrect.html">QRect</a>&sr, intconversion_flags)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="2cb865"></a>QPainter::drawImage(const<a href="qpoint.html">QPoint</a>&, const<a href="qimage.html">QImage</a>&, intconversion_flags)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="8bee1c"></a>QPainter::drawImage(intx, inty, const<a href="qimage.html">QImage</a>&image, intsx=0, intsy=0, intsw=-1, intsh=-1)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="e3a489"></a>QPainter::drawLine(intx1, inty1, intx2, inty2)</h3>
<p>Draws a line from <em>(x1,y2)</em> to <em>(x2,y2)</em> and sets <em>(x2,y2)</em> to be
the new current pen position.
<p>See also <a href="qpen.html">QPen</a>.
<p>Examples:
<a href="grapher-grapher-cpp.html#drawLine">grapher/grapher.cpp</a>
<a href="drawlines-connect-cpp.html#drawLine">drawlines/connect.cpp</a>
<a href="progress-progress-cpp.html#drawLine">progress/progress.cpp</a>
<a href="splitter-splitter-cpp.html#drawLine">splitter/splitter.cpp</a>
<a href="scrollview-scrollview-cpp.html#drawLine">scrollview/scrollview.cpp</a>
<h3 class="fn">void<a name="1db3a3"></a>QPainter::drawLine(const<a href="qpoint.html">QPoint</a>&p1, const<a href="qpoint.html">QPoint</a>&p2)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="f0bc44"></a>QPainter::drawLineSegments(const<a href="qpointarray.html">QPointArray</a>&a, intindex=0, intnlines=-1)</h3>
<p>Draws <em>nlines</em> separate lines from points defined in <em>a,</em> starting
at a[<em>index]</em> (<em>index</em> defaults to 0). If <em>nlines</em> is -1 (the
defauls) all points until the end of the array are used
(i.e. (a.size()-index)/2 lines are drawn).
<p>Draws the 1st line from <em>a[index]</em> to <em>a[index+1].</em>
Draws the 2nd line from <em>a[index+2]</em> to <em>a[index+3]</em> etc.
<p>See also <a href="#134ad2">drawPolyline</a>(), <a href="#2efe17">drawPolygon</a>() and <a href="qpen.html">QPen</a>.
<h3 class="fn">void<a name="de93a0"></a>QPainter::drawPicture(const<a href="qpicture.html">QPicture</a>&pic)</h3>
<p>Replays the picture <em>pic.</em>
<p>This function does exactly the same as <a href="qpicture.html#b515a5">QPicture::play</a>().
<p>Examples:
<a href="picture-picture-cpp.html#drawPicture">picture/picture.cpp</a>
<h3 class="fn">void<a name="3ca7a2"></a>QPainter::drawPie(intx, inty, intw, inth, inta, intalen)</h3>
<p>Draws a pie defined by the rectangle <em>(x,y,w,h),</em> the start
angle <em>a</em> and the arc length <em>alen.</em>
<p>The pie is filled with the current <a href="#29891f">brush</a>().
<p>The angles <em>a</em> and <em>alen</em> are 1/16th of a degree, i.e. a full
circle equals 5760 (16*360). Positive values of <em>a</em> and <em>alen</em> mean
counter-clockwise while negative values mean clockwise direction.
Zero degrees is at the 3'o clock position.
<p>See also <a href="#5f530b">drawArc</a>() and <a href="#53c4a8">drawChord</a>().
<p>Examples:
<a href="grapher-grapher-cpp.html#drawPie">grapher/grapher.cpp</a>
<a href="drawdemo-drawdemo-cpp.html#drawPie">drawdemo/drawdemo.cpp</a>
<h3 class="fn">void<a name="b9bbaf"></a>QPainter::drawPie(const<a href="qrect.html">QRect</a>&r, inta, intalen)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="c64b89"></a>QPainter::drawPixmap(intx, inty, const<a href="qpixmap.html">QPixmap</a>&pixmap, intsx=0, intsy=0, intsw=-1, intsh=-1)</h3>
<p>Draws a pixmap at <em>(x,y)</em> by copying a part of <em>pixmap</em> into the
paint device.
<p><em>(x,y)</em> specify the top-left point in the paint device that is to
be drawn onto. <em>(sx,sy)</em> specify the top-left point in <em>pixmap</em>
that is to be drawn (the default is (0,0). <em>(sw,sh)</em> specify the
size of the pixmap that is to be drawn (the default, (-1,-1), means
all the way to the right/bottom of the pixmap).
<p>See also <a href="qpaintdevice.html#35ae2e">bitBlt</a>() and <a href="qpixmap.html#68a75d">QPixmap::setMask</a>().
<p>Examples:
<a href="qtimage-qtimage-cpp.html#drawPixmap">qtimage/qtimage.cpp</a>
<a href="grapher-grapher-cpp.html#drawPixmap">grapher/grapher.cpp</a>
<a href="qmag-qmag-cpp.html#drawPixmap">qmag/qmag.cpp</a>
<a href="scrollview-scrollview-cpp.html#drawPixmap">scrollview/scrollview.cpp</a>
<a href="movies-main-cpp.html#drawPixmap">movies/main.cpp</a>
<a href="picture-picture-cpp.html#drawPixmap">picture/picture.cpp</a>
<h3 class="fn">void<a name="3b2d09"></a>QPainter::drawPixmap(const<a href="qpoint.html">QPoint</a>&p, const<a href="qpixmap.html">QPixmap</a>&pm)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>This version of the call draws the entire pixmap.
<h3 class="fn">void<a name="a0cccd"></a>QPainter::drawPixmap(const<a href="qpoint.html">QPoint</a>&p, const<a href="qpixmap.html">QPixmap</a>&pm, const<a href="qrect.html">QRect</a>&sr)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="8e172b"></a>QPainter::drawPoint(intx, inty)</h3>
<p>Draws/plots a single point at <em>(x,y)</em> using the current pen.
<p>See also <a href="qpen.html">QPen</a>.
<p>Examples:
<a href="drawlines-connect-cpp.html#drawPoint">drawlines/connect.cpp</a>
<a href="desktop-desktop-cpp.html#drawPoint">desktop/desktop.cpp</a>
<h3 class="fn">void<a name="d39635"></a>QPainter::drawPoint(const<a href="qpoint.html">QPoint</a>&p)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="be1650"></a>QPainter::drawPoints(const<a href="qpointarray.html">QPointArray</a>&a, intindex=0, intnpoints=-1)</h3>
<p>Draws/plots an array of points using the current pen.
<p>If <em>index</em> is non-zero (the default is zero) only points from <em>index</em> are drawn. If <em>npoints</em> is negative (the default) the rest
of the points from <em>index</em> are drawn. If is is zero or greater, <em>npoints</em> points are drawn.
<h3 class="fn">void<a name="2efe17"></a>QPainter::drawPolygon(const<a href="qpointarray.html">QPointArray</a>&a, boolwinding=FALSE, intindex=0, intnpoints=-1)</h3>
<p>Draws the polygon defined by the <em>npoints</em> points in <em>a</em> starting at
<em>a[index].</em> (<em>index</em> defaults to 0.)
<p>If <em>npoints</em> is -1 (the default) all points until the end of the
array are used (i.e. a.size()-index line segments define the
polygon).
<p>The first point is always connected to the last point.
<p>The polygon is filled with the current <a href="#29891f">brush</a>().
If <em>winding</em> is TRUE, the polygon is filled using the winding
fill algorithm. If <em>winding</em> is FALSE, the polygon is filled using the
even-odd (alternative) fill algorithm.
<p>See also <a href="#f0bc44">drawLineSegments</a>(), <a href="#134ad2">drawPolyline</a>() and <a href="qpen.html">QPen</a>.
<p>Examples:
<a href="desktop-desktop-cpp.html#drawPolygon">desktop/desktop.cpp</a>
<a href="picture-picture-cpp.html#drawPolygon">picture/picture.cpp</a>
<h3 class="fn">void<a name="134ad2"></a>QPainter::drawPolyline(const<a href="qpointarray.html">QPointArray</a>&a, intindex=0, intnpoints=-1)</h3>
<p>Draws the polyline defined by the <em>npoints</em> points in <em>a</em> starting
at <em>a[index].</em> (<em>index</em> defaults to 0.)
<p>If <em>npoints</em> is -1 (the default) all points until the end of the
array are used (i.e. a.size()-index-1 line segments are drawn).
<p>See also <a href="#f0bc44">drawLineSegments</a>(), <a href="#2efe17">drawPolygon</a>() and <a href="qpen.html">QPen</a>.
<h3 class="fn">void<a name="3d49cd"></a>QPainter::drawQuadBezier(const<a href="qpointarray.html">QPointArray</a>&a, intindex=0)</h3>
<p>Draws a cubic Bezier curve defined by the control points in <em>a,</em>
starting at <em>a[index].</em> (<em>index</em> defaults to 0.)
<p>Control points after <em>a[index+3]</em> are ignored. Nothing happens if
there aren't enough control points.
<h3 class="fn">void<a name="4c0077"></a>QPainter::drawRect(intx, inty, intw, inth)</h3>
<p>Draws a rectangle with upper left corner at <em>(x,y)</em> and with
width <em>w</em> and height <em>h.</em>
<p>See also <a href="qpen.html">QPen</a> and <a href="#887bfb">drawRoundRect</a>().
<p>Examples:
<a href="grapher-grapher-cpp.html#drawRect">grapher/grapher.cpp</a>
<a href="drawdemo-drawdemo-cpp.html#drawRect">drawdemo/drawdemo.cpp</a>
<a href="forever-forever-cpp.html#drawRect">forever/forever.cpp</a>
<a href="trivial-trivial-cpp.html#drawRect">trivial/trivial.cpp</a>
<a href="picture-picture-cpp.html#drawRect">picture/picture.cpp</a>
<h3 class="fn">void<a name="139035"></a>QPainter::drawRect(const<a href="qrect.html">QRect</a>&r)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="887bfb"></a>QPainter::drawRoundRect(intx, inty, intw, inth, intxRnd, intyRnd)</h3>
<p>Draws a rectangle with round corners at <em>(x,y),</em> with width <em>w</em>
and height <em>h.</em>
<p>The <em>xRnd</em> and <em>yRnd</em> arguments specify how rounded the corners
should be. 0 is angled corners, 99 is maximum roundedness.
<p>The width and height include all of the drawn lines.
<p>See also <a href="#4c0077">drawRect</a>() and <a href="qpen.html">QPen</a>.
<p>Examples:
<a href="drawdemo-drawdemo-cpp.html#drawRoundRect">drawdemo/drawdemo.cpp</a>
<h3 class="fn">void<a name="c651e9"></a>QPainter::drawRoundRect(const<a href="qrect.html">QRect</a>&r, intxRnd, intyRnd)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="95b1c1"></a>QPainter::drawRoundRect(const<a href="qrect.html">QRect</a>&)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>As the main version of the function, but with the roundness
arguments fixed at 25.
<h3 class="fn">void<a name="a7ca82"></a>QPainter::drawRoundRect(intx, inty, intw, inth)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>As the main version of the function, but with the roundness
arguments fixed at 25.
<h3 class="fn">void<a name="0f088f"></a>QPainter::drawText(intx, inty, const<a href="qstring.html">QString</a>&str, intlen=-1)</h3>
<p>Draws at most <em>len</em> characters from <em>str</em> at position <em>(x,y).</em>
<p><em>(x,y)</em> is the base line position. Note that the meaning of
<em>y</em> is not the same for the two drawText() varieties.
<p>Examples:
<a href="grapher-grapher-cpp.html#drawText">grapher/grapher.cpp</a>
<a href="drawdemo-drawdemo-cpp.html#drawText">drawdemo/drawdemo.cpp</a>
<a href="menu-menu-cpp.html#drawText">menu/menu.cpp</a>
<a href="progress-progress-cpp.html#drawText">progress/progress.cpp</a>
<a href="desktop-desktop-cpp.html#drawText">desktop/desktop.cpp</a>
<a href="scrollview-scrollview-cpp.html#drawText">scrollview/scrollview.cpp</a>
<a href="trivial-trivial-cpp.html#drawText">trivial/trivial.cpp</a>
<a href="movies-main-cpp.html#drawText">movies/main.cpp</a>
<a href="picture-picture-cpp.html#drawText">picture/picture.cpp</a>
<h3 class="fn">void<a name="a096b1"></a>QPainter::drawText(intx, inty, intw, inth, inttf, const<a href="qstring.html">QString</a>&str, intlen=-1, <a href="qrect.html">QRect</a>*brect=0, char**internal=0)</h3>
<p>Draws at most <em>len</em> characters from <em>str</em> in the rectangle <em>(x,y,w,h).</em>
<p>Note that the meaning of <em>y</em> is not the same for the two <a href="#0f088f">drawText</a>()
varieties.
<p>This function draws formatted text. The <em>tf</em> text formatting is
really of type <a href="qt.html#AlignmentFlags">Qt::AlignmentFlags</a>.
<p>Horizontal alignment defaults to AlignLeft and vertical alignment
defaults to AlignTop.
<p><em>brect</em> (if non-null) is set to the actual bounding rectangle of
the output. <em>internal</em> is, yes, internal.
<p>See also <a href="#c89857">boundingRect</a>().
<h3 class="fn">void<a name="9f83c5"></a>QPainter::drawText(const<a href="qpoint.html">QPoint</a>&p, const<a href="qstring.html">QString</a>&, intlen=-1)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="f06f01"></a>QPainter::drawText(const<a href="qrect.html">QRect</a>&r, inttf, const<a href="qstring.html">QString</a>&, intlen=-1, <a href="qrect.html">QRect</a>*br=0, char**i=0)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="f56c59"></a>QPainter::drawTiledPixmap(intx, inty, intw, inth, const<a href="qpixmap.html">QPixmap</a>&pixmap, intsx=0, intsy=0)</h3>
<p>Draws a tiled <em>pixmap</em> in the specified rectangle.
<p><em>(x,y)</em> specify the top-left point in the paint device that is to
be drawn onto. <em>(sx,sy)</em> specify the top-left point in <em>pixmap</em>
that is to be drawn (the default is (0,0).
<p>Calling drawTiledPixmap() is similar to calling <a href="#c64b89">drawPixmap</a>() several
times to fill (tile) an area with a pixmap, but is potentially
much more efficient depending on the underlying window system.
<p>See also <a href="#c64b89">drawPixmap</a>().
<h3 class="fn">void<a name="8d1b87"></a>QPainter::drawTiledPixmap(const<a href="qrect.html">QRect</a>&r, const<a href="qpixmap.html">QPixmap</a>&pm)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="fa3eeb"></a>QPainter::drawTiledPixmap(const<a href="qrect.html">QRect</a>&r, const<a href="qpixmap.html">QPixmap</a>&pm, const<a href="qpoint.html">QPoint</a>&sp)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="a439ba"></a>QPainter::drawWinFocusRect(intx, inty, intw, inth)</h3>
<p>Draws a Windows focus rectangle with upper left corner at <em>(x,y)</em> and with
width <em>w</em> and height <em>h.</em>
<p>This function draws a stippled XOR rectangle that is used to indicate
keyboard focus (when <a href="qapplication.html#1bada8">QApplication::style</a>() is <code>WindowStyle).<p><b>Warning:</b></code> This function draws nothing if the coordinate system has been
<a href="#b5205c">rotated</a> or <a href="#c8634b">sheared</a>.
<p>See also <a href="#4c0077">drawRect</a>() and <a href="qapplication.html#1bada8">QApplication::style</a>().
<h3 class="fn">void<a name="eb8e3d"></a>QPainter::drawWinFocusRect(intx, inty, intw, inth, const<a href="qcolor.html">QColor</a>&bgColor)</h3>
<p>Draws a Windows focus rectangle with upper left corner at <em>(x,y)</em> and with
width <em>w</em> and height <em>h</em> using a pen color that contrasts with <em>bgColor.</em>
<p>This function draws a stippled rectangle (XOR is not used) that is
used to indicate keyboard focus (when the <a href="qapplication.html#1bada8">QApplication::style</a>() is
<code>WindowStyle).</code>
<p>The pen color used to draw the rectangle is either white or black
depending on the color of <em>bgColor</em> (see QColor::gray()).<p><b>Warning:</b> This function draws nothing if the coordinate system has been
<a href="#b5205c">rotated</a> or <a href="#c8634b">sheared</a>.
<p>See also <a href="#4c0077">drawRect</a>() and <a href="qapplication.html#1bada8">QApplication::style</a>().
<h3 class="fn">void<a name="98179c"></a>QPainter::drawWinFocusRect(const<a href="qrect.html">QRect</a>&r)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="fe168c"></a>QPainter::drawWinFocusRect(const<a href="qrect.html">QRect</a>&r, const<a href="qcolor.html">QColor</a>&bgColor)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">bool<a name="365784"></a>QPainter::end()</h3>
<p>Ends painting. Any resources used while painting are released.
<p>Note that while you mostly don't need to call end(), the destructor
will do it, there is at least one common case, namely double
buffering.
<p><pre> <a href="qpainter.html">QPainter</a> p( myPixmap, this )
// ...
p.<a href="#365784">end</a>(); // stops drawing on myPixmap
p.<a href="#02ed5d">begin</a>( this );
p.<a href="#c64b89">drawPixmap</a>( myPixmap );
</pre>
<p>Since you can't draw a <a href="qpixmap.html">QPixmap</a> while it is being painted, it is
necessary to close the active painter.
<p>See also <a href="#02ed5d">begin</a>() and <a href="#08ba62">isActive</a>().
<p>Examples:
<a href="desktop-desktop-cpp.html#end">desktop/desktop.cpp</a>
<a href="picture-picture-cpp.html#end">picture/picture.cpp</a>
<h3 class="fn">void<a name="bd5570"></a>QPainter::eraseRect(intx, inty, intw, inth)</h3>
<p>Erases the area inside <em>(x,y,w,h).</em>
Equivalent to <code><a href="#5308a7">fillRect</a>( x, y, w, h, <a href="#c2639b">backgroundColor</a>() )</code>
<h3 class="fn">void<a name="04ae92"></a>QPainter::eraseRect(const<a href="qrect.html">QRect</a>&r)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="5308a7"></a>QPainter::fillRect(intx, inty, intw, inth, const<a href="qbrush.html">QBrush</a>&brush)</h3>
<p>Fills the rectangle <em>(x,y,w,h)</em> with the <em>brush.</em>
<p>You can specify a <a href="qcolor.html">QColor</a> as <em>brush,</em> since there is a <a href="qbrush.html">QBrush</a> constructor
that takes a QColor argument and creates a solid pattern brush.
<p>See also <a href="#4c0077">drawRect</a>().
<p>Examples:
<a href="progress-progress-cpp.html#fillRect">progress/progress.cpp</a>
<a href="scrollview-scrollview-cpp.html#fillRect">scrollview/scrollview.cpp</a>
<h3 class="fn">void<a name="329888"></a>QPainter::fillRect(const<a href="qrect.html">QRect</a>&r, const<a href="qbrush.html">QBrush</a>&brush)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="dfe955"></a>QPainter::flush()</h3>
<p>Flushes any buffered drawing operations.
<h3 class="fn">const<a href="qfont.html">QFont</a>&<a name="9c1c8b"></a>QPainter::font()const</h3>
<p>Returns the currently set painter font.
<p>See also <a href="#998df2">setFont</a>() and <a href="qfont.html">QFont</a>.
<h3 class="fn"><a href="qfontinfo.html">QFontInfo</a><a name="5bdc93"></a>QPainter::fontInfo()const</h3>
<p>Returns the font info for the painter, if the painter is active. It
is not possible to obtain font information for an inactive painter,
so the return value is undefined if the painter is not active.
<p>See also <a href="#73b2e5">fontMetrics</a>() and <a href="#08ba62">isActive</a>().
<h3 class="fn"><a href="qfontmetrics.html">QFontMetrics</a><a name="73b2e5"></a>QPainter::fontMetrics()const</h3>
<p>Returns the font metrics for the painter, if the painter is active.
It is not possible to obtain metrics for an inactive painter, so the
return value is undefined if the painter is not active.
<p>See also <a href="#5bdc93">fontInfo</a>() and <a href="#08ba62">isActive</a>().
<p>Examples:
<a href="drawdemo-drawdemo-cpp.html#fontMetrics">drawdemo/drawdemo.cpp</a>
<a href="desktop-desktop-cpp.html#fontMetrics">desktop/desktop.cpp</a>
<a href="scrollview-scrollview-cpp.html#fontMetrics">scrollview/scrollview.cpp</a>
<a href="movies-main-cpp.html#fontMetrics">movies/main.cpp</a>
<h3 class="fn">bool<a name="c10fd1"></a>QPainter::hasClipping()const</h3>
<p>Returns TRUE if clipping has been set, otherwise FALSE.
<p>See also <a href="#79ea5e">setClipping</a>().
<h3 class="fn">bool<a name="80f190"></a>QPainter::hasViewXForm()const</h3>
<p>Returns TRUE if view transformation is enabled, otherwise FALSE.
<p>See also <a href="#a0205c">setViewXForm</a>() and <a href="#1dcf7e">xForm</a>().
<h3 class="fn">bool<a name="c99db4"></a>QPainter::hasWorldXForm()const</h3>
<p>Returns TRUE if world transformation is enabled, otherwise FALSE.
<p>See also <a href="#f94066">setWorldXForm</a>().
<h3 class="fn">void<a name="360b25"></a>QPainter::initialize() <code>[static]</code></h3>
<p>Internal function that initializes the painter.
<h3 class="fn">bool<a name="08ba62"></a>QPainter::isActive()const</h3>
<p>Returns TRUE if the painter is active painting, i.e. <a href="#02ed5d">begin</a>() has
been called and <a href="#365784">end</a>() has not yet been called.
<p>See also <a href="qpaintdevice.html#11c528">QPaintDevice::paintingActive</a>().
<p>Examples:
<a href="desktop-desktop-cpp.html#isActive">desktop/desktop.cpp</a>
<h3 class="fn">void<a name="d645f0"></a>QPainter::lineTo(intx, inty)</h3>
<p>Draws a line from the current pen position to <em>(x,y)</em> and sets <em>(x,y)</em> to be the new current pen position.
<p>See also <a href="qpen.html">QPen</a>, <a href="#093b37">moveTo</a>(), <a href="#e3a489">drawLine</a>() and <a href="#6bba26">pos</a>().
<h3 class="fn">void<a name="aee897"></a>QPainter::lineTo(const<a href="qpoint.html">QPoint</a>&p)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="093b37"></a>QPainter::moveTo(intx, inty)</h3>
<p>Sets the current pen position to <em>(x,y)</em>
<p>See also <a href="#d645f0">lineTo</a>() and <a href="#6bba26">pos</a>().
<h3 class="fn">void<a name="52fc53"></a>QPainter::moveTo(const<a href="qpoint.html">QPoint</a>&p)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">const<a href="qpen.html">QPen</a>&<a name="3d26af"></a>QPainter::pen()const</h3>
<p>Returns the current pen for the painter.
<p>See also <a href="#0183e4">setPen</a>().
<p>Examples:
<a href="progress-progress-cpp.html#pen">progress/progress.cpp</a>
<h3 class="fn"><a href="qpoint.html">QPoint</a><a name="6bba26"></a>QPainter::pos()const</h3>
<p>Returns the current position of the pen.
<p>See also <a href="#093b37">moveTo</a>().
<h3 class="fn"><a href="qt.html#RasterOp">RasterOp</a><a name="c3c5ab"></a>QPainter::rasterOp()const</h3>
<p>Returns the current raster operation.
<p>See also <a href="#116b42">setRasterOp</a>() and <a href="qt.html#RasterOp">RasterOp</a>.
<h3 class="fn">void<a name="ab2ec8"></a>QPainter::redirect(<a href="qpaintdevice.html">QPaintDevice</a>*pdev, <a href="qpaintdevice.html">QPaintDevice</a>*replacement) <code>[static]</code></h3>
<p>Redirects all paint command for a paint device <em>pdev</em> to another
paint device <em>replacement,</em> unless <em>replacement</em> is 0. If <em>replacement</em> is 0, the redirection for <em>pdev</em> is removed.
<p>Mostly, you can get better results with less work by calling
<a href="qpixmap.html#e492b7">QPixmap::grabWidget</a>() or QPixmap::grapWindow().
<h3 class="fn">void<a name="ce98a7"></a>QPainter::resetXForm()</h3>
<p>Resets any transformations that were made using <a href="#eb778c">translate</a>(), <a href="#e5ec3e">scale</a>(),
<a href="#c8634b">shear</a>(), <a href="#b5205c">rotate</a>(), <a href="#862c4d">setWorldMatrix</a>(), <a href="#42d67a">setViewport</a>() and <a href="#ad8b2b">setWindow</a>()
<p>See also <a href="#e876ac">worldMatrix</a>(), <a href="#3ea58a">viewport</a>() and <a href="#99513c">window</a>().
<h3 class="fn">void<a name="ddb3f4"></a>QPainter::restore()</h3>
<p>Restores the current painter state (pops a saved state off the stack).
<p>See also <a href="#938d23">save</a>().
<h3 class="fn">void<a name="88dcb8"></a>QPainter::restoreWorldMatrix()</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.<p>
We recommend using <a href="#938d23">save</a>() instead.
<h3 class="fn">void<a name="b5205c"></a>QPainter::rotate(doublea)</h3>
<p>Rotates the coordinate system <em>a</em> degrees.
<p>See also <a href="#eb778c">translate</a>(), <a href="#e5ec3e">scale</a>(), <a href="#c8634b">shear</a>(), <a href="#ce98a7">resetXForm</a>(), <a href="#862c4d">setWorldMatrix</a>() and <a href="#1dcf7e">xForm</a>().
<h3 class="fn">void<a name="938d23"></a>QPainter::save()</h3>
<p>Saves the current painter state (pushes the state onto a stack). A
save() must be followed by a corresponding <a href="#ddb3f4">restore</a>(). <a href="#365784">end</a>() unwinds
the stack().
<p>See also <a href="#ddb3f4">restore</a>().
<h3 class="fn">void<a name="ea2f35"></a>QPainter::saveWorldMatrix()</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code.<p>
<p>We recommend using <a href="#938d23">save</a>() instead.
<h3 class="fn">void<a name="e5ec3e"></a>QPainter::scale(doublesx, doublesy)</h3>
<p>Scales the coordinate system by <em>(sx,sy).</em>
<p>See also <a href="#eb778c">translate</a>(), <a href="#c8634b">shear</a>(), <a href="#b5205c">rotate</a>(), <a href="#ce98a7">resetXForm</a>(), <a href="#862c4d">setWorldMatrix</a>() and <a href="#1dcf7e">xForm</a>().
<h3 class="fn">void<a name="11d243"></a>QPainter::setBackgroundColor(const<a href="qcolor.html">QColor</a>&c)</h3>
<p>Sets the background color of the painter to <em>c.</em>
<p>The background color is the color that is filled in when drawing
opaque text, stippled lines and bitmaps. The background color has
no effect in transparent background mode (which is the default).
<p>See also <a href="#c2639b">backgroundColor</a>(), <a href="#10e1fd">setBackgroundMode</a>() and BackgroundMode.
<h3 class="fn">void<a name="10e1fd"></a>QPainter::setBackgroundMode(BGModem)</h3>
<p>Sets the background mode of the painter to <em>m,</em> which must be one
of <code>TransparentMode</code> (the default) and <code>OpaqueMode.</code>
<p>Transparent mode draws stippled lines and text without setting the
background pixels. Opaque mode fills these space with the current
background color.
<p>Note that in order to draw a bitmap or pixmap transparently, you must use
<a href="qpixmap.html#68a75d">QPixmap::setMask</a>().
<p>See also <a href="#172861">backgroundMode</a>() and <a href="#11d243">setBackgroundColor</a>().
<p>Examples:
<a href="picture-picture-cpp.html#setBackgroundMode">picture/picture.cpp</a>
<h3 class="fn">void<a name="e739d3"></a>QPainter::setBrush(BrushStylestyle)</h3>
<p>Sets a new painter brush with black color and the specified <em>style.</em>
<p>See also <a href="#29891f">brush</a>() and <a href="qbrush.html">QBrush</a>.
<h3 class="fn">void<a name="bd0ce6"></a>QPainter::setBrush(const<a href="qbrush.html">QBrush</a>&brush)</h3>
<p>Sets a new painter brush.
<p>The brush defines how to fill shapes.
<p>See also <a href="#29891f">brush</a>().
<h3 class="fn">void<a name="3e0cc8"></a>QPainter::setBrush(const<a href="qcolor.html">QColor</a>&color)</h3>
<p>Sets a new painter brush with the style <code>SolidPattern</code> and the specified
<em>color.</em>
<p>See also <a href="#29891f">brush</a>() and <a href="qbrush.html">QBrush</a>.
<p>Examples:
<a href="grapher-grapher-cpp.html#setBrush">grapher/grapher.cpp</a>
<a href="drawdemo-drawdemo-cpp.html#setBrush">drawdemo/drawdemo.cpp</a>
<a href="forever-forever-cpp.html#setBrush">forever/forever.cpp</a>
<a href="desktop-desktop-cpp.html#setBrush">desktop/desktop.cpp</a>
<a href="picture-picture-cpp.html#setBrush">picture/picture.cpp</a>
<h3 class="fn">void<a name="f09597"></a>QPainter::setBrushOrigin(intx, inty)</h3>
<p>Sets the brush origin to <em>(x,y).</em>
<p>The brush origin specifies the (0,0) coordinate of the painter's
brush. This setting only applies to pattern brushes and pixmap
brushes.
<p>See also <a href="#7d6354">brushOrigin</a>().
<h3 class="fn">void<a name="9d7e84"></a>QPainter::setBrushOrigin(const<a href="qpoint.html">QPoint</a>&p)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="898839"></a>QPainter::setClipRect(intx, inty, intw, inth)</h3>
<p>Sets the clip region to the the rectangle <em>(x,y,w,h)</em> and enables clipping.
<p>Note that the clip region is given in physical device coordinates and
<em>not</em> subject to any <a href="coordsys.html">coordinate
transformation.</a>
<p>See also <a href="#15cc78">setClipRegion</a>(), <a href="#621dc8">clipRegion</a>() and <a href="#79ea5e">setClipping</a>().
<p>Examples:
<a href="qtimage-qtimage-cpp.html#setClipRect">qtimage/qtimage.cpp</a>
<a href="grapher-grapher-cpp.html#setClipRect">grapher/grapher.cpp</a>
<a href="progress-progress-cpp.html#setClipRect">progress/progress.cpp</a>
<a href="splitter-splitter-cpp.html#setClipRect">splitter/splitter.cpp</a>
<a href="trivial-trivial-cpp.html#setClipRect">trivial/trivial.cpp</a>
<h3 class="fn">void<a name="37ec7f"></a>QPainter::setClipRect(const<a href="qrect.html">QRect</a>&r)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>If the rectangle is invalid, the rectangle will be normalized() before the clipping region is set. This semantics will change in Qt-3
and an invalid rectangle will clip the painter to an empty rectangle.
<p>See also <a href="qrect.html#6d4ece">QRect::isValid</a>() and <a href="qrect.html#cd60e4">QRect::normalize</a>().
<h3 class="fn">void<a name="15cc78"></a>QPainter::setClipRegion(const<a href="qregion.html">QRegion</a>&rgn)</h3>
<p>Sets the clip region to <em>rgn</em> and enables clipping.
<p>Note that the clip region is given in physical device coordinates and
<em>not</em> subject to any <a href="coordsys.html">coordinate
transformation.</a>
<p>See also <a href="#898839">setClipRect</a>(), <a href="#621dc8">clipRegion</a>() and <a href="#79ea5e">setClipping</a>().
<h3 class="fn">void<a name="79ea5e"></a>QPainter::setClipping(boolenable)</h3>
<p>Enables clipping if <em>enable</em> is TRUE, or disables clipping if <em>enable</em>
is FALSE.
<p>See also <a href="#c10fd1">hasClipping</a>(), <a href="#898839">setClipRect</a>() and <a href="#15cc78">setClipRegion</a>().
<h3 class="fn">void<a name="998df2"></a>QPainter::setFont(const<a href="qfont.html">QFont</a>&font)</h3>
<p>Sets a new painter font.
<p>This font is used by subsequent <a href="#0f088f">drawText</a>() functions. The text
color is the same as the pen color.
<p>See also <a href="#9c1c8b">font</a>() and <a href="#0f088f">drawText</a>().
<p>Examples:
<a href="grapher-grapher-cpp.html#setFont">grapher/grapher.cpp</a>
<a href="drawdemo-drawdemo-cpp.html#setFont">drawdemo/drawdemo.cpp</a>
<a href="menu-menu-cpp.html#setFont">menu/menu.cpp</a>
<a href="scrollview-scrollview-cpp.html#setFont">scrollview/scrollview.cpp</a>
<a href="movies-main-cpp.html#setFont">movies/main.cpp</a>
<a href="picture-picture-cpp.html#setFont">picture/picture.cpp</a>
<h3 class="fn">void<a name="0183e4"></a>QPainter::setPen(<a href="qt.html#PenStyle">PenStyle</a>style)</h3>
<p>Sets a new painter pen with style <code>style,</code> width 0 and black color.
<p>See also <a href="#3d26af">pen</a>() and <a href="qpen.html">QPen</a>.
<p>Examples:
<a href="grapher-grapher-cpp.html#setPen">grapher/grapher.cpp</a>
<a href="drawlines-connect-cpp.html#setPen">drawlines/connect.cpp</a>
<a href="drawdemo-drawdemo-cpp.html#setPen">drawdemo/drawdemo.cpp</a>
<a href="progress-progress-cpp.html#setPen">progress/progress.cpp</a>
<a href="forever-forever-cpp.html#setPen">forever/forever.cpp</a>
<a href="desktop-desktop-cpp.html#setPen">desktop/desktop.cpp</a>
<a href="scrollview-scrollview-cpp.html#setPen">scrollview/scrollview.cpp</a>
<a href="movies-main-cpp.html#setPen">movies/main.cpp</a>
<h3 class="fn">void<a name="5f7c0d"></a>QPainter::setPen(const<a href="qcolor.html">QColor</a>&color)</h3>
<p>Sets a new painter pen with style <code>SolidLine,</code> width 0 and the specified
<em>color.</em>
<p>See also <a href="#3d26af">pen</a>() and <a href="qpen.html">QPen</a>.
<h3 class="fn">void<a name="cce332"></a>QPainter::setPen(const<a href="qpen.html">QPen</a>&pen)</h3>
<p>Sets a new painter pen.
<p>The pen defines how to draw lines and outlines, and it also defines
the text color.
<p>See also <a href="#3d26af">pen</a>().
<h3 class="fn">void<a name="116b42"></a>QPainter::setRasterOp(<a href="qt.html#RasterOp">RasterOp</a>r)</h3>
<p>Sets the raster operation to <em>r.</em> The default is <code>CopyROP.</code>
<p>See also <a href="#c3c5ab">rasterOp</a>().
<h3 class="fn">void<a name="c37498"></a>QPainter::setTabArray(int*ta)</h3>
<p>Sets the tab stop array to <em>ta.</em> This puts tab stops at <em>ta[0],</em>
ta[1] and so on. The array is null-terminated.
<p>If both a tab array and a tab top size is set, the tab array wins.
<p>See also <a href="#2ecad2">tabArray</a>(), <a href="#9e77b6">setTabStops</a>(), <a href="#0f088f">drawText</a>() and <a href="#73b2e5">fontMetrics</a>().
<h3 class="fn">void<a name="9e77b6"></a>QPainter::setTabStops(intts)</h3>
<p>Set the tab stop width to <em>ts,</em> ie. locates tab stops at ts, 2*ts,
3*ts and so on.
<p>Tab stops are used when drawing formatted text with <code>ExpandTabs</code>
set. This fixed tab stop value is used only if no tab array is set
(which is the default case).
<p>See also <a href="#a33db6">tabStops</a>(), <a href="#c37498">setTabArray</a>(), <a href="#0f088f">drawText</a>() and <a href="#73b2e5">fontMetrics</a>().
<h3 class="fn">void<a name="a0205c"></a>QPainter::setViewXForm(boolenable)</h3>
<p>Enables view transformations if <em>enable</em> is TRUE, or disables
view transformations if <em>enable</em> is FALSE.
<p>See also <a href="#80f190">hasViewXForm</a>(), <a href="#ad8b2b">setWindow</a>(), <a href="#42d67a">setViewport</a>(), <a href="#862c4d">setWorldMatrix</a>(), <a href="#f94066">setWorldXForm</a>() and <a href="#1dcf7e">xForm</a>().
<h3 class="fn">void<a name="42d67a"></a>QPainter::setViewport(intx, inty, intw, inth)</h3>
<p>Sets the viewport rectangle view transformation for the painter and
enables view transformation.
<p>The viewport rectangle is part of the view transformation. The
viewport specifies the device coordinate system. Its sister, the
<a href="#99513c">window</a>(), specifies the logical coordinate system.
<p>The default viewport rectangle is the same as the device's rectangle.
See the <a href="coordsys.html">Coordinate System Overview</a> for
an overview of coordinate transformation.
<p>See also <a href="#3ea58a">viewport</a>(), <a href="#ad8b2b">setWindow</a>(), <a href="#a0205c">setViewXForm</a>(), <a href="#862c4d">setWorldMatrix</a>(), <a href="#f94066">setWorldXForm</a>() and <a href="#1dcf7e">xForm</a>().
<h3 class="fn">void<a name="e8bac4"></a>QPainter::setViewport(const<a href="qrect.html">QRect</a>&r)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="ad8b2b"></a>QPainter::setWindow(intx, inty, intw, inth)</h3>
<p>Sets the window rectangle view transformation for the painter and
enables view transformation.
<p>The window rectangle is part of the view transformation. The window
specifies the logical coordinate system. Its sister, the
<a href="#3ea58a">viewport</a>(), specifies the device coordinate system.
<p>The default window rectangle is the same as the device's rectangle.
See the <a href="coordsys.html">Coordinate System Overview</a> for
an overview of coordinate transformation.
<p>See also <a href="#99513c">window</a>(), <a href="#42d67a">setViewport</a>(), <a href="#a0205c">setViewXForm</a>(), <a href="#862c4d">setWorldMatrix</a>() and <a href="#f94066">setWorldXForm</a>().
<p>Examples:
<a href="drawdemo-drawdemo-cpp.html#setWindow">drawdemo/drawdemo.cpp</a>
<h3 class="fn">void<a name="4b3b14"></a>QPainter::setWindow(const<a href="qrect.html">QRect</a>&r)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">void<a name="862c4d"></a>QPainter::setWorldMatrix(const<a href="qwmatrix.html">QWMatrix</a>&m, boolcombine=FALSE)</h3>
<p>Sets the world transformation matrix to <em>m</em> and enables world
transformation.
<p>If <em>combine</em> is TRUE, then <em>m</em> is combined with the current
transformation matrix, otherwise <em>m</em> replaces the current
transformation matrix.
<p>If <em>m</em> the identity matrix and <em>combine</em> is FALSE, this function calls
<a href="#f94066">setWorldXForm</a>(FALSE). (The identity matrix is the matrix where
<a href="qwmatrix.html#b24a8d">QWMatrix::m11</a>() and <a href="qwmatrix.html#5ceba1">QWMatrix::m22</a>() are 1.0 and the rest are 0.0.)
<p>World transformations are applied after the view transformations
(i.e. <a href="#ad8b2b">window</a> and <a href="#42d67a">viewport</a>).
<p>The following functions can transform the coordinate system without using
a QWMatrix:
<ul>
<li><a href="#eb778c">translate</a>()
<li><a href="#e5ec3e">scale</a>()
<li><a href="#c8634b">shear</a>()
<li><a href="#b5205c">rotate</a>()
</ul>
<p>They operate on the painter's <a href="#e876ac">worldMatrix</a>() and are implemented like this:
<p><pre> void QPainter::rotate( double a )
{
<a href="qwmatrix.html">QWMatrix</a> m;
m.<a href="qwmatrix.html#71020d">rotate</a>( a );
setWorldMatrix( m, TRUE );
}
</pre>
<p>Note that you should always use <em>combine</em> when you are drawing into
a <a href="qpicture.html">QPicture</a>. Otherwise it may not be possible to replay the picture
with additional transformations. Using translate(), scale(),
etc. is safe.
<p>For a brief overview of coordinate transformation, see the <a href="coordsys.html">Coordinate System Overview.</a>
<p>See also <a href="#e876ac">worldMatrix</a>(), <a href="#f94066">setWorldXForm</a>(), <a href="#ad8b2b">setWindow</a>(), <a href="#42d67a">setViewport</a>(), <a href="#a0205c">setViewXForm</a>(), <a href="#1dcf7e">xForm</a>() and <a href="qwmatrix.html">QWMatrix</a>.
<p>Examples:
<a href="drawdemo-drawdemo-cpp.html#setWorldMatrix">drawdemo/drawdemo.cpp</a>
<h3 class="fn">void<a name="f94066"></a>QPainter::setWorldXForm(boolenable)</h3>
<p>Enables world transformations if <em>enable</em> is TRUE, or disables
world transformations if <em>enable</em> is FALSE. The world
transformation matrix is not changed.
<p>See also <a href="#862c4d">setWorldMatrix</a>(), <a href="#ad8b2b">setWindow</a>(), <a href="#42d67a">setViewport</a>(), <a href="#a0205c">setViewXForm</a>() and <a href="#1dcf7e">xForm</a>().
<h3 class="fn">void<a name="c8634b"></a>QPainter::shear(doublesh, doublesv)</h3>
<p>Shears the coordinate system <em>(sh,sv).</em>
<p>See also <a href="#eb778c">translate</a>(), <a href="#e5ec3e">scale</a>(), <a href="#b5205c">rotate</a>(), <a href="#ce98a7">resetXForm</a>(), <a href="#862c4d">setWorldMatrix</a>() and <a href="#1dcf7e">xForm</a>().
<h3 class="fn">int*<a name="2ecad2"></a>QPainter::tabArray()const</h3>
<p>Returns the currently set tab stop array.
<p>See also <a href="#c37498">setTabArray</a>().
<h3 class="fn">int<a name="a33db6"></a>QPainter::tabStops()const</h3>
<p>Returns the tab stop setting.
<p>See also <a href="#9e77b6">setTabStops</a>().
<h3 class="fn">void<a name="eb778c"></a>QPainter::translate(doubledx, doubledy)</h3>
<p>Translates the coordinate system by <em>(dx,dy).</em>
<p>For example, the following code draws a single vertical line 20 pixels high.
<pre> void MyWidget::paintEvent()
{
<a href="qpainter.html">QPainter</a> paint( this );
paint.<a href="#e3a489">drawLine</a>(10,0,10,20);
paint.<a href="#eb778c">translate</a>(100.0,100.0);
paint.<a href="#e3a489">drawLine</a>(-90,-80,-90,-70);
}
</pre>
<p>See also <a href="#e5ec3e">scale</a>(), <a href="#c8634b">shear</a>(), <a href="#b5205c">rotate</a>(), <a href="#ce98a7">resetXForm</a>(), <a href="#862c4d">setWorldMatrix</a>() and <a href="#1dcf7e">xForm</a>().
<h3 class="fn"><a href="qrect.html">QRect</a><a name="3ea58a"></a>QPainter::viewport()const</h3>
<p>Returns the viewport rectangle.
<p>See also <a href="#42d67a">setViewport</a>() and <a href="#a0205c">setViewXForm</a>().
<h3 class="fn"><a href="qrect.html">QRect</a><a name="99513c"></a>QPainter::window()const</h3>
<p>Returns the window rectangle.
<p>See also <a href="#ad8b2b">setWindow</a>() and <a href="#a0205c">setViewXForm</a>().
<h3 class="fn">const<a href="qwmatrix.html">QWMatrix</a>&<a name="e876ac"></a>QPainter::worldMatrix()const</h3>
<p>Returns the world transformation matrix.
<p>See also <a href="#862c4d">setWorldMatrix</a>().
<h3 class="fn"><a href="qpoint.html">QPoint</a><a name="1dcf7e"></a>QPainter::xForm(const<a href="qpoint.html">QPoint</a>&pv)const</h3>
<p>Returns the point <em>pv</em> transformed from model coordinates to device
coordinates.
<p>See also <a href="#055761">xFormDev</a>() and <a href="qwmatrix.html#83c725">QWMatrix::map</a>().
<h3 class="fn"><a href="qpointarray.html">QPointArray</a><a name="e0c8bb"></a>QPainter::xForm(const<a href="qpointarray.html">QPointArray</a>&av)const</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>Returns the point array <em>av</em> transformed from model coordinates to device
coordinates.
<p>See also <a href="#055761">xFormDev</a>() and <a href="qwmatrix.html#83c725">QWMatrix::map</a>().
<h3 class="fn"><a href="qpointarray.html">QPointArray</a><a name="d8e506"></a>QPainter::xForm(const<a href="qpointarray.html">QPointArray</a>&av, intindex, intnpoints)const</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>Returns the point array <em>av</em> transformed from model coordinates to device
coordinates. The <em>index</em> is the first point in the array and <em>npoints</em>
denotes the number of points to be transformed. If <em>npoints</em> is negative,
all points from <em>av[index]</em> until the last point in the array are
transformed.
<p>The returned point array consists of the number of points that were
transformed.
<p>Example:
<pre> <a href="qpointarray.html">QPointArray</a> a(10);
<a href="qpointarray.html">QPointArray</a> b;
b = painter.xForm(a,2,4); // b.<a href="qarray.html#743206">size</a>() == 4
b = painter.xForm(a,2,-1); // b.<a href="qarray.html#743206">size</a>() == 8
</pre>
<p>See also <a href="#055761">xFormDev</a>() and <a href="qwmatrix.html#83c725">QWMatrix::map</a>().
<h3 class="fn"><a href="qrect.html">QRect</a><a name="7bdc70"></a>QPainter::xForm(const<a href="qrect.html">QRect</a>&rv)const</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>Returns the rectangle <em>rv</em> transformed from model coordinates to device
coordinates.
<p>If world transformation is enabled and rotation or shearing has been
specified, then the bounding rectangle is returned.
<p>See also <a href="#055761">xFormDev</a>() and <a href="qwmatrix.html#83c725">QWMatrix::map</a>().
<h3 class="fn"><a href="qpoint.html">QPoint</a><a name="c40aed"></a>QPainter::xFormDev(const<a href="qpoint.html">QPoint</a>&pd)const</h3>
<p>Returns the point <em>pv</em> transformed from device coordinates to model
coordinates.
<p>See also <a href="#1dcf7e">xForm</a>() and <a href="qwmatrix.html#83c725">QWMatrix::map</a>().
<h3 class="fn"><a href="qpointarray.html">QPointArray</a><a name="055761"></a>QPainter::xFormDev(const<a href="qpointarray.html">QPointArray</a>&ad)const</h3>
<p>Returns the point array <em>av</em> transformed from device coordinates
to model coordinates.
<p>See also <a href="#1dcf7e">xForm</a>() and <a href="qwmatrix.html#83c725">QWMatrix::map</a>().
<h3 class="fn"><a href="qrect.html">QRect</a><a name="072c4d"></a>QPainter::xFormDev(const<a href="qrect.html">QRect</a>&rd)const</h3>
<p>Returns the rectangle <em>rv</em> transformed from device coordinates to model
coordinates.
<p>If world transformation is enabled and rotation or shearing is used,
then the bounding rectangle is returned.
<p>See also <a href="#1dcf7e">xForm</a>() and <a href="qwmatrix.html#83c725">QWMatrix::map</a>().
<h3 class="fn"><a href="qpointarray.html">QPointArray</a><a name="dad1e3"></a>QPainter::xFormDev(const<a href="qpointarray.html">QPointArray</a>&ad, intindex, intnpoints)const</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<p>Returns the point array <em>ad</em> transformed from device coordinates to model
coordinates. The <em>index</em> is the first point in the array and <em>npoints</em>
denotes the number of points to be transformed. If <em>npoints</em> is negative,
all points from <em>av[index]</em> until the last point in the array are
transformed.
<p>The returned point array consists of the number of points that were
transformed.
<p>Example:
<pre> <a href="qpointarray.html">QPointArray</a> a(10);
<a href="qpointarray.html">QPointArray</a> b;
b = painter.xFormDev(a,1,3); // b.<a href="qarray.html#743206">size</a>() == 3
b = painter.xFormDev(a,1,-1); // b.<a href="qarray.html#743206">size</a>() == 9
</pre>
<p>See also <a href="#1dcf7e">xForm</a>() and <a href="qwmatrix.html#83c725">QWMatrix::map</a>().
<hr><h2>Related Functions</h2>
<h3>void <a name="0553b3"></a>qDrawPlainRect (QPainter * p, int x, int y, int w, int h, const <a href="qcolor.html">QColor</a> & c, int lineWidth, const <a href="qbrush.html">QBrush</a> * fill)</h3>
<p><code>#include <<a href="qdrawutil-h.html">qdrawutil.h</a>></code>
<p>Draws a plain rectangle given by (<em>x, y, w, h)</em>
using the painter <em>p.</em>
<p>The color argument <em>c</em> specifies the line color.
<p>The <em>lineWidth</em> argument specifies the line width.
<p>The rectangle interior is filled with the <em>fill</em> brush unless <em>fill</em>
is null.
<p>If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it display a
plain rectangle, for example
<code><a href="qframe.html#558f79">QFrame::setFrameStyle</a>( QFrame::Box | QFrame::Plain )</code>.<p><b>Warning:</b> This function does not look at <a href="qwidget.html#027381">QWidget::style</a>()
or <a href="qapplication.html#1bada8">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p>See also <a href="qpainter.html#a47a35">qDrawShadeRect</a>() and <a href="qstyle.html#f74d28">QStyle::drawRect</a>().
<h3>void <a name="2d8a65"></a>qDrawWinPanel (QPainter * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, const <a href="qbrush.html">QBrush</a> * fill)</h3>
<p><code>#include <<a href="qdrawutil-h.html">qdrawutil.h</a>></code>
<p>Draws a Windows-style panel given by (<em>x, y, w, h)</em>
using the painter <em>p.</em>
<p>The color group argument <em>g</em> specifies the shading colors.
<p>The panel appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is
FALSE.
<p>The line width is 2 pixels.
<p>The button interior is filled with the <em>fill</em> brush unless <em>fill</em> is
null.
<p>If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it display a
shaded panel, for example
<code><a href="qframe.html#558f79">QFrame::setFrameStyle</a>( QFrame::WinPanel | QFrame::Raised )</code>.<p><b>Warning:</b> This function does not look at <a href="qwidget.html#027381">QWidget::style</a>()
or <a href="qapplication.html#1bada8">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p>See also <a href="qpainter.html#b03ffb">qDrawShadePanel</a>(), <a href="qpainter.html#e5134d">qDrawWinButton</a>() and <a href="qstyle.html#414a7e">QStyle::drawPanel</a>().
<h3>void <a name="3beef6"></a>qDrawShadeLine (QPainter * p, int x1, int y1, int x2, int y2, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, int lineWidth, int midLineWidth)</h3>
<p><code>#include <<a href="qdrawutil-h.html">qdrawutil.h</a>></code>
<p>Draws a horizontal (<em>y1</em> == <em>y2)</em> or vertical (<em>x1</em> == <em>x2)</em> shaded
line using the painter <em>p.</em>
<p>Nothing is drawn if <em>y1</em> != <em>y2</em> and <em>x1</em> != <em>x2</em> (i.e. the line
is neither horizontal nor vertical).
<p>The color group argument <em>g</em> specifies the shading colors
(<a href="qcolorgroup.html#5ff1d5">light</a>,
<a href="qcolorgroup.html#9f3d58">dark</a> and
<a href="qcolorgroup.html#d96e71">middle</a> colors).
<p>The line appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is
FALSE.
<p>The <em>lineWidth</em> argument specifies the line width for each of the
lines. It is not the total line width.
<p>The <em>midLineWidth</em> argument specifies the width of a middle line drawn
in the <a href="qcolorgroup.html#d96e71">QColorGroup::mid</a>() color.
<p>If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it display a
shaded line, for example
<code><a href="qframe.html#558f79">QFrame::setFrameStyle</a>( QFrame::HLine | QFrame::Sunken )</code>.<p><b>Warning:</b> This function does not look at <a href="qwidget.html#027381">QWidget::style</a>()
or <a href="qapplication.html#1bada8">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p>See also <a href="qpainter.html#a47a35">qDrawShadeRect</a>(), <a href="qpainter.html#b03ffb">qDrawShadePanel</a>() and <a href="qstyle.html#cf53b2">QStyle::drawSeparator</a>().
<h3>void <a name="a47a35"></a>qDrawShadeRect (QPainter * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, int lineWidth, int midLineWidth, const <a href="qbrush.html">QBrush</a> * fill)</h3>
<p><code>#include <<a href="qdrawutil-h.html">qdrawutil.h</a>></code>
<p>Draws a shaded rectangle/box given by (<em>x, y, w, h)</em>
using the painter <em>p.</em>
<p>The color group argument <em>g</em> specifies the shading colors
(<a href="qcolorgroup.html#5ff1d5">light</a>,
<a href="qcolorgroup.html#9f3d58">dark</a> and
<a href="qcolorgroup.html#d96e71">middle</a> colors).
<p>The rectangle appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is FALSE.
<p>The <em>lineWidth</em> argument specifies the line width for each of the
lines. It is not the total line width.
<p>The <em>midLineWidth</em> argument specifies the width of a middle line drawn
in the <a href="qcolorgroup.html#d96e71">QColorGroup::mid</a>() color.
<p>The rectangle interior is filled with the <em>fill</em> brush unless <em>fill</em>
is null.
<p>If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it display a
shaded rectangle, for example
<code><a href="qframe.html#558f79">QFrame::setFrameStyle</a>( QFrame::Box | QFrame::Raised )</code>.<p><b>Warning:</b> This function does not look at <a href="qwidget.html#027381">QWidget::style</a>()
or <a href="qapplication.html#1bada8">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p>See also <a href="qpainter.html#3beef6">qDrawShadeLine</a>(), <a href="qpainter.html#b03ffb">qDrawShadePanel</a>(), <a href="qpainter.html#0553b3">qDrawPlainRect</a>(), <a href="qstyle.html#f74d28">QStyle::drawRect</a>() and <a href="qstyle.html#1d5617">QStyle::drawRectStrong</a>().
<h3>void <a name="b03ffb"></a>qDrawShadePanel (QPainter * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, int lineWidth, const <a href="qbrush.html">QBrush</a> * fill)</h3>
<p><code>#include <<a href="qdrawutil-h.html">qdrawutil.h</a>></code>
<p>Draws a shaded panel given by (<em>x, y, w, h)</em>
using the painter <em>p.</em>
<p>The color group argument <em>g</em> specifies the shading colors
(<a href="qcolorgroup.html#5ff1d5">light</a>,
<a href="qcolorgroup.html#9f3d58">dark</a> and
<a href="qcolorgroup.html#d96e71">middle</a> colors).
<p>The panel appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em> is
FALSE.
<p>The <em>lineWidth</em> argument specifies the line width.
<p>The panel interior is filled with the <em>fill</em> brush unless <em>fill</em> is
null.
<p>If you want to use a <a href="qframe.html">QFrame</a> widget instead, you can make it display a
shaded panel, for example
<code><a href="qframe.html#558f79">QFrame::setFrameStyle</a>( QFrame::Panel | QFrame::Sunken )</code>.<p><b>Warning:</b> This function does not look at <a href="qwidget.html#027381">QWidget::style</a>()
or <a href="qapplication.html#1bada8">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p>See also <a href="qpainter.html#2d8a65">qDrawWinPanel</a>(), <a href="qpainter.html#3beef6">qDrawShadeLine</a>(), <a href="qpainter.html#a47a35">qDrawShadeRect</a>() and <a href="qstyle.html#414a7e">QStyle::drawPanel</a>().
<h3>void <a name="e5134d"></a>qDrawWinButton (QPainter * p, int x, int y, int w, int h, const <a href="qcolorgroup.html">QColorGroup</a> & g, bool sunken, const <a href="qbrush.html">QBrush</a> * fill)</h3>
<p><code>#include <<a href="qdrawutil-h.html">qdrawutil.h</a>></code>
<p>Draws a Windows-style button given by (<em>x, y, w, h)</em>
using the painter <em>p.</em>
<p>The color group argument <em>g</em> specifies the shading colors
(<a href="qcolorgroup.html#5ff1d5">light</a>,
<a href="qcolorgroup.html#9f3d58">dark</a> and
<a href="qcolorgroup.html#d96e71">middle</a> colors).
<p>The button appears sunken if <em>sunken</em> is TRUE, or raised if <em>sunken</em>
is FALSE.
<p>The line width is 2 pixels.
<p>The button interior is filled with the <em>*fill</em> brush unless <em>fill</em> is
null.<p><b>Warning:</b> This function does not look at <a href="qwidget.html#027381">QWidget::style</a>()
or <a href="qapplication.html#1bada8">QApplication::style</a>(). Use the drawing functions in <a href="qstyle.html">QStyle</a> to make
widgets that follow the current GUI style.
<p>See also <a href="qpainter.html#2d8a65">qDrawWinPanel</a>() and <a href="qstyle.html#20fd59">QStyle::drawButton</a>().
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|