1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QPainter Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPainter Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPainter class performs low-level painting on widgets and
other paint devices. <a href="#details">More...</a></p>
<p>Inherited by <a href="qstylepainter.html">QStylePainter</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qpainter.html#CompositionMode-enum">CompositionMode</a></b> { CompositionMode_SourceOver, CompositionMode_DestinationOver, CompositionMode_Clear, CompositionMode_Source, ..., RasterOp_SourceAndNotDestination }</li><li><div class="fn" />class <b><a href="qpainter-pixmapfragment.html">PixmapFragment</a></b></li><li><div class="fn" />enum <b><a href="qpainter.html#PixmapFragmentHint-enum">PixmapFragmentHint</a></b> { OpaqueHint }</li><li><div class="fn" />class <b><a href="qpainter-pixmapfragmenthints.html">PixmapFragmentHints</a></b></li><li><div class="fn" />enum <b><a href="qpainter.html#RenderHint-enum">RenderHint</a></b> { Antialiasing, TextAntialiasing, SmoothPixmapTransform, HighQualityAntialiasing, NonCosmeticDefaultPen }</li><li><div class="fn" />class <b><a href="qpainter-renderhints.html">RenderHints</a></b></li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpainter.html#QPainter">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#QPainter-2">__init__</a></b> (<i>self</i>, QPaintDevice)</li><li><div class="fn" />QBrush <b><a href="qpainter.html#background">background</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.BGMode <b><a href="qpainter.html#backgroundMode">backgroundMode</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#begin">begin</a></b> (<i>self</i>, QPaintDevice)</li><li><div class="fn" /><b><a href="qpainter.html#beginNativePainting">beginNativePainting</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qpainter.html#boundingRect">boundingRect</a></b> (<i>self</i>, QRectF <i>rect</i>, int <i>flags</i>, QString <i>text</i>)</li><li><div class="fn" />QRect <b><a href="qpainter.html#boundingRect-2">boundingRect</a></b> (<i>self</i>, QRect <i>rect</i>, int <i>flags</i>, QString <i>text</i>)</li><li><div class="fn" />QRectF <b><a href="qpainter.html#boundingRect-3">boundingRect</a></b> (<i>self</i>, QRectF <i>rectangle</i>, QString <i>text</i>, QTextOption <i>option</i> = QTextOption())</li><li><div class="fn" />QRect <b><a href="qpainter.html#boundingRect-4">boundingRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>flags</i>, QString <i>text</i>)</li><li><div class="fn" />QBrush <b><a href="qpainter.html#brush">brush</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qpainter.html#brushOrigin">brushOrigin</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qpainter.html#clipBoundingRect">clipBoundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />QPainterPath <b><a href="qpainter.html#clipPath">clipPath</a></b> (<i>self</i>)</li><li><div class="fn" />QRegion <b><a href="qpainter.html#clipRegion">clipRegion</a></b> (<i>self</i>)</li><li><div class="fn" />QMatrix <b><a href="qpainter.html#combinedMatrix">combinedMatrix</a></b> (<i>self</i>)</li><li><div class="fn" />QTransform <b><a href="qpainter.html#combinedTransform">combinedTransform</a></b> (<i>self</i>)</li><li><div class="fn" />CompositionMode <b><a href="qpainter.html#compositionMode">compositionMode</a></b> (<i>self</i>)</li><li><div class="fn" />QPaintDevice <b><a href="qpainter.html#device">device</a></b> (<i>self</i>)</li><li><div class="fn" />QMatrix <b><a href="qpainter.html#deviceMatrix">deviceMatrix</a></b> (<i>self</i>)</li><li><div class="fn" />QTransform <b><a href="qpainter.html#deviceTransform">deviceTransform</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawArc">drawArc</a></b> (<i>self</i>, QRectF <i>rect</i>, int <i>a</i>, int <i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawArc-2">drawArc</a></b> (<i>self</i>, QRect <i>r</i>, int <i>a</i>, int <i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawArc-3">drawArc</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>a</i>, int <i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawChord">drawChord</a></b> (<i>self</i>, QRectF <i>rect</i>, int <i>a</i>, int <i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawChord-2">drawChord</a></b> (<i>self</i>, QRect <i>rect</i>, int <i>a</i>, int <i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawChord-3">drawChord</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>a</i>, int <i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a></b> (<i>self</i>, QPointF <i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawConvexPolygon-2">drawConvexPolygon</a></b> (<i>self</i>, QPolygonF <i>poly</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawConvexPolygon-3">drawConvexPolygon</a></b> (<i>self</i>, QPoint <i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawConvexPolygon-4">drawConvexPolygon</a></b> (<i>self</i>, QPolygon <i>poly</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse">drawEllipse</a></b> (<i>self</i>, QRectF <i>r</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse-2">drawEllipse</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse-3">drawEllipse</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse-4">drawEllipse</a></b> (<i>self</i>, QPointF <i>center</i>, float <i>rx</i>, float <i>ry</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawEllipse-5">drawEllipse</a></b> (<i>self</i>, QPoint <i>center</i>, int <i>rx</i>, int <i>ry</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawGlyphRun">drawGlyphRun</a></b> (<i>self</i>, QPointF <i>position</i>, QGlyphRun <i>glyphRun</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage">drawImage</a></b> (<i>self</i>, QRectF <i>targetRect</i>, QImage <i>image</i>, QRectF <i>sourceRect</i>, Qt.ImageConversionFlags <i>flags</i> = Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-2">drawImage</a></b> (<i>self</i>, QRect <i>targetRect</i>, QImage <i>image</i>, QRect <i>sourceRect</i>, Qt.ImageConversionFlags <i>flags</i> = Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-3">drawImage</a></b> (<i>self</i>, QPointF <i>p</i>, QImage <i>image</i>, QRectF <i>sr</i>, Qt.ImageConversionFlags <i>flags</i> = Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-4">drawImage</a></b> (<i>self</i>, QPoint <i>p</i>, QImage <i>image</i>, QRect <i>sr</i>, Qt.ImageConversionFlags <i>flags</i> = Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-5">drawImage</a></b> (<i>self</i>, QRectF <i>r</i>, QImage <i>image</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-6">drawImage</a></b> (<i>self</i>, QRect <i>r</i>, QImage <i>image</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-7">drawImage</a></b> (<i>self</i>, QPointF <i>p</i>, QImage <i>image</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-8">drawImage</a></b> (<i>self</i>, QPoint <i>p</i>, QImage <i>image</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawImage-9">drawImage</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, QImage <i>image</i>, int <i>sx</i> = 0, int <i>sy</i> = 0, int <i>sw</i> = -1, int <i>sh</i> = -1, Qt.ImageConversionFlags <i>flags</i> = Qt.AutoColor)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine">drawLine</a></b> (<i>self</i>, QLineF <i>l</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine-2">drawLine</a></b> (<i>self</i>, QLine <i>line</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine-3">drawLine</a></b> (<i>self</i>, int <i>x1</i>, int <i>y1</i>, int <i>x2</i>, int <i>y2</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine-4">drawLine</a></b> (<i>self</i>, QPoint <i>p1</i>, QPoint <i>p2</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLine-5">drawLine</a></b> (<i>self</i>, QPointF <i>p1</i>, QPointF <i>p2</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines">drawLines</a></b> (<i>self</i>, QLineF <i>line</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-2">drawLines</a></b> (<i>self</i>, unknown-type <i>lines</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-3">drawLines</a></b> (<i>self</i>, QPointF <i>pointPair</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-4">drawLines</a></b> (<i>self</i>, unknown-type <i>pointPairs</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-5">drawLines</a></b> (<i>self</i>, QLine <i>line</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-6">drawLines</a></b> (<i>self</i>, unknown-type <i>lines</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-7">drawLines</a></b> (<i>self</i>, QPoint <i>pointPair</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawLines-8">drawLines</a></b> (<i>self</i>, unknown-type <i>pointPairs</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPath">drawPath</a></b> (<i>self</i>, QPainterPath <i>path</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPicture">drawPicture</a></b> (<i>self</i>, QPointF <i>p</i>, QPicture <i>picture</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPicture-2">drawPicture</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, QPicture <i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPicture-3">drawPicture</a></b> (<i>self</i>, QPoint <i>pt</i>, QPicture <i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPie">drawPie</a></b> (<i>self</i>, QRectF <i>rect</i>, int <i>a</i>, int <i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPie-2">drawPie</a></b> (<i>self</i>, QRect <i>rect</i>, int <i>a</i>, int <i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPie-3">drawPie</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>a</i>, int <i>alen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap">drawPixmap</a></b> (<i>self</i>, QRectF <i>targetRect</i>, QPixmap <i>pixmap</i>, QRectF <i>sourceRect</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-2">drawPixmap</a></b> (<i>self</i>, QRect <i>targetRect</i>, QPixmap <i>pixmap</i>, QRect <i>sourceRect</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-3">drawPixmap</a></b> (<i>self</i>, QPointF <i>p</i>, QPixmap <i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-4">drawPixmap</a></b> (<i>self</i>, QPoint <i>p</i>, QPixmap <i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-5">drawPixmap</a></b> (<i>self</i>, QRect <i>r</i>, QPixmap <i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-6">drawPixmap</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, QPixmap <i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-7">drawPixmap</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, QPixmap <i>pm</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-8">drawPixmap</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, QPixmap <i>pm</i>, int <i>sx</i>, int <i>sy</i>, int <i>sw</i>, int <i>sh</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-9">drawPixmap</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, QPixmap <i>pm</i>, int <i>sx</i>, int <i>sy</i>, int <i>sw</i>, int <i>sh</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-10">drawPixmap</a></b> (<i>self</i>, QPointF <i>p</i>, QPixmap <i>pm</i>, QRectF <i>sr</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmap-11">drawPixmap</a></b> (<i>self</i>, QPoint <i>p</i>, QPixmap <i>pm</i>, QRect <i>sr</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmapFragments">drawPixmapFragments</a></b> (<i>self</i>, list <i>fragments</i>, QPixmap <i>pixmap</i>, PixmapFragmentHints <i>hints</i> = 0)</li><li><div class="fn" /><b><a href="qpainter.html#drawPixmapFragments-2">drawPixmapFragments</a></b> (<i>self</i>, list <i>targetRects</i>, list <i>sourceRects</i>, QPixmap <i>pixmap</i>, PixmapFragmentHints <i>hints</i> = 0)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoint">drawPoint</a></b> (<i>self</i>, QPointF <i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoint-2">drawPoint</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoint-3">drawPoint</a></b> (<i>self</i>, QPoint <i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoints">drawPoints</a></b> (<i>self</i>, QPointF <i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoints-2">drawPoints</a></b> (<i>self</i>, QPolygonF <i>points</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoints-3">drawPoints</a></b> (<i>self</i>, QPoint <i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPoints-4">drawPoints</a></b> (<i>self</i>, QPolygon <i>points</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolygon">drawPolygon</a></b> (<i>self</i>, QPointF <i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolygon-2">drawPolygon</a></b> (<i>self</i>, QPolygonF <i>points</i>, Qt.FillRule <i>fillRule</i> = Qt.OddEvenFill)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolygon-3">drawPolygon</a></b> (<i>self</i>, QPoint <i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolygon-4">drawPolygon</a></b> (<i>self</i>, QPolygon <i>points</i>, Qt.FillRule <i>fillRule</i> = Qt.OddEvenFill)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolyline">drawPolyline</a></b> (<i>self</i>, QPointF <i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolyline-2">drawPolyline</a></b> (<i>self</i>, QPolygonF <i>polyline</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolyline-3">drawPolyline</a></b> (<i>self</i>, QPoint <i>point</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawPolyline-4">drawPolyline</a></b> (<i>self</i>, QPolygon <i>polyline</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRect">drawRect</a></b> (<i>self</i>, QRectF <i>rect</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRect-2">drawRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRect-3">drawRect</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRects">drawRects</a></b> (<i>self</i>, QRectF <i>rect</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawRects-2">drawRects</a></b> (<i>self</i>, unknown-type <i>rects</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRects-3">drawRects</a></b> (<i>self</i>, QRect <i>rect</i>, ...)</li><li><div class="fn" /><b><a href="qpainter.html#drawRects-4">drawRects</a></b> (<i>self</i>, unknown-type <i>rects</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundedRect">drawRoundedRect</a></b> (<i>self</i>, QRectF <i>rect</i>, float <i>xRadius</i>, float <i>yRadius</i>, Qt.SizeMode <i>mode</i> = Qt.AbsoluteSize)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundedRect-2">drawRoundedRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, float <i>xRadius</i>, float <i>yRadius</i>, Qt.SizeMode <i>mode</i> = Qt.AbsoluteSize)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundedRect-3">drawRoundedRect</a></b> (<i>self</i>, QRect <i>rect</i>, float <i>xRadius</i>, float <i>yRadius</i>, Qt.SizeMode <i>mode</i> = Qt.AbsoluteSize)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundRect">drawRoundRect</a></b> (<i>self</i>, QRectF <i>r</i>, int <i>xRound</i> = 25, int <i>yRound</i> = 25)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundRect-2">drawRoundRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>xRound</i> = 25, int <i>yRound</i> = 25)</li><li><div class="fn" /><b><a href="qpainter.html#drawRoundRect-3">drawRoundRect</a></b> (<i>self</i>, QRect <i>r</i>, int <i>xRound</i> = 25, int <i>yRound</i> = 25)</li><li><div class="fn" /><b><a href="qpainter.html#drawStaticText">drawStaticText</a></b> (<i>self</i>, QPointF <i>topLeftPosition</i>, QStaticText <i>staticText</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawStaticText-2">drawStaticText</a></b> (<i>self</i>, QPoint <i>p</i>, QStaticText <i>staticText</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawStaticText-3">drawStaticText</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, QStaticText <i>staticText</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawText">drawText</a></b> (<i>self</i>, QPointF <i>p</i>, QString <i>s</i>)</li><li><div class="fn" />QRectF <i>boundingRect</i> <b><a href="qpainter.html#drawText-2">drawText</a></b> (<i>self</i>, QRectF <i>rectangle</i>, int <i>flags</i>, QString <i>text</i>)</li><li><div class="fn" />QRect <i>boundingRect</i> <b><a href="qpainter.html#drawText-3">drawText</a></b> (<i>self</i>, QRect <i>rectangle</i>, int <i>flags</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawText-4">drawText</a></b> (<i>self</i>, QRectF <i>rectangle</i>, QString <i>text</i>, QTextOption <i>option</i> = QTextOption())</li><li><div class="fn" /><b><a href="qpainter.html#drawText-5">drawText</a></b> (<i>self</i>, QPoint <i>p</i>, QString <i>s</i>)</li><li><div class="fn" />QRect <i>boundingRect</i> <b><a href="qpainter.html#drawText-6">drawText</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, int <i>flags</i>, QString <i>text</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawText-7">drawText</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, QString <i>s</i>)</li><li><div class="fn" /><b><a href="qpainter.html#drawTiledPixmap">drawTiledPixmap</a></b> (<i>self</i>, QRectF <i>rectangle</i>, QPixmap <i>pixmap</i>, QPointF <i>pos</i> = QPointF())</li><li><div class="fn" /><b><a href="qpainter.html#drawTiledPixmap-2">drawTiledPixmap</a></b> (<i>self</i>, QRect <i>rectangle</i>, QPixmap <i>pixmap</i>, QPoint <i>pos</i> = QPoint())</li><li><div class="fn" /><b><a href="qpainter.html#drawTiledPixmap-3">drawTiledPixmap</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, QPixmap <i>pixmap</i>, int <i>sx</i> = 0, int <i>sy</i> = 0)</li><li><div class="fn" />bool <b><a href="qpainter.html#end">end</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#endNativePainting">endNativePainting</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#eraseRect">eraseRect</a></b> (<i>self</i>, QRectF)</li><li><div class="fn" /><b><a href="qpainter.html#eraseRect-2">eraseRect</a></b> (<i>self</i>, QRect <i>rect</i>)</li><li><div class="fn" /><b><a href="qpainter.html#eraseRect-3">eraseRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillPath">fillPath</a></b> (<i>self</i>, QPainterPath <i>path</i>, QBrush <i>brush</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect">fillRect</a></b> (<i>self</i>, QRectF, QBrush)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-2">fillRect</a></b> (<i>self</i>, QRect, QBrush)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-3">fillRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, QBrush <i>b</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-4">fillRect</a></b> (<i>self</i>, QRectF, QColor <i>color</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-5">fillRect</a></b> (<i>self</i>, QRect, QColor <i>color</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-6">fillRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, QColor <i>b</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-7">fillRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, Qt.GlobalColor <i>c</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-8">fillRect</a></b> (<i>self</i>, QRect <i>r</i>, Qt.GlobalColor <i>c</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-9">fillRect</a></b> (<i>self</i>, QRectF <i>r</i>, Qt.GlobalColor <i>c</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-10">fillRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, Qt.BrushStyle <i>style</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-11">fillRect</a></b> (<i>self</i>, QRect <i>r</i>, Qt.BrushStyle <i>style</i>)</li><li><div class="fn" /><b><a href="qpainter.html#fillRect-12">fillRect</a></b> (<i>self</i>, QRectF <i>r</i>, Qt.BrushStyle <i>style</i>)</li><li><div class="fn" />QFont <b><a href="qpainter.html#font">font</a></b> (<i>self</i>)</li><li><div class="fn" />QFontInfo <b><a href="qpainter.html#fontInfo">fontInfo</a></b> (<i>self</i>)</li><li><div class="fn" />QFontMetrics <b><a href="qpainter.html#fontMetrics">fontMetrics</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#hasClipping">hasClipping</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#initFrom">initFrom</a></b> (<i>self</i>, QWidget <i>widget</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#isActive">isActive</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.LayoutDirection <b><a href="qpainter.html#layoutDirection">layoutDirection</a></b> (<i>self</i>)</li><li><div class="fn" />QMatrix <b><a href="qpainter.html#matrix">matrix</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#matrixEnabled">matrixEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qpainter.html#opacity">opacity</a></b> (<i>self</i>)</li><li><div class="fn" />QPaintEngine <b><a href="qpainter.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />QPen <b><a href="qpainter.html#pen">pen</a></b> (<i>self</i>)</li><li><div class="fn" />RenderHints <b><a href="qpainter.html#renderHints">renderHints</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#resetMatrix">resetMatrix</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#resetTransform">resetTransform</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#restore">restore</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#rotate">rotate</a></b> (<i>self</i>, float <i>a</i>)</li><li><div class="fn" /><b><a href="qpainter.html#save">save</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#scale">scale</a></b> (<i>self</i>, float <i>sx</i>, float <i>sy</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBackground">setBackground</a></b> (<i>self</i>, QBrush <i>bg</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBackgroundMode">setBackgroundMode</a></b> (<i>self</i>, Qt.BGMode <i>mode</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBrush">setBrush</a></b> (<i>self</i>, QBrush <i>brush</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBrush-2">setBrush</a></b> (<i>self</i>, Qt.BrushStyle <i>style</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBrushOrigin">setBrushOrigin</a></b> (<i>self</i>, QPointF)</li><li><div class="fn" /><b><a href="qpainter.html#setBrushOrigin-2">setBrushOrigin</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setBrushOrigin-3">setBrushOrigin</a></b> (<i>self</i>, QPoint <i>p</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setClipPath">setClipPath</a></b> (<i>self</i>, QPainterPath <i>path</i>, Qt.ClipOperation <i>operation</i> = Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setClipping">setClipping</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setClipRect">setClipRect</a></b> (<i>self</i>, QRectF <i>rectangle</i>, Qt.ClipOperation <i>operation</i> = Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setClipRect-2">setClipRect</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, Qt.ClipOperation <i>operation</i> = Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setClipRect-3">setClipRect</a></b> (<i>self</i>, QRect <i>rectangle</i>, Qt.ClipOperation <i>operation</i> = Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setClipRegion">setClipRegion</a></b> (<i>self</i>, QRegion <i>region</i>, Qt.ClipOperation <i>operation</i> = Qt.ReplaceClip)</li><li><div class="fn" /><b><a href="qpainter.html#setCompositionMode">setCompositionMode</a></b> (<i>self</i>, CompositionMode <i>mode</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setFont">setFont</a></b> (<i>self</i>, QFont <i>f</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setLayoutDirection">setLayoutDirection</a></b> (<i>self</i>, Qt.LayoutDirection <i>direction</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setMatrix">setMatrix</a></b> (<i>self</i>, QMatrix <i>matrix</i>, bool <i>combine</i> = False)</li><li><div class="fn" /><b><a href="qpainter.html#setMatrixEnabled">setMatrixEnabled</a></b> (<i>self</i>, bool <i>enabled</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setOpacity">setOpacity</a></b> (<i>self</i>, float <i>opacity</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setPen">setPen</a></b> (<i>self</i>, QColor <i>color</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setPen-2">setPen</a></b> (<i>self</i>, QPen <i>pen</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setPen-3">setPen</a></b> (<i>self</i>, Qt.PenStyle <i>style</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setRenderHint">setRenderHint</a></b> (<i>self</i>, RenderHint <i>hint</i>, bool <i>on</i> = True)</li><li><div class="fn" /><b><a href="qpainter.html#setRenderHints">setRenderHints</a></b> (<i>self</i>, RenderHints <i>hints</i>, bool <i>on</i> = True)</li><li><div class="fn" /><b><a href="qpainter.html#setTransform">setTransform</a></b> (<i>self</i>, QTransform <i>transform</i>, bool <i>combine</i> = False)</li><li><div class="fn" /><b><a href="qpainter.html#setViewport">setViewport</a></b> (<i>self</i>, QRect <i>viewport</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setViewport-2">setViewport</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a></b> (<i>self</i>, bool <i>enable</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setWindow">setWindow</a></b> (<i>self</i>, QRect <i>window</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setWindow-2">setWindow</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setWorldMatrix">setWorldMatrix</a></b> (<i>self</i>, QMatrix <i>matrix</i>, bool <i>combine</i> = False)</li><li><div class="fn" /><b><a href="qpainter.html#setWorldMatrixEnabled">setWorldMatrixEnabled</a></b> (<i>self</i>, bool <i>enabled</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setWorldTransform">setWorldTransform</a></b> (<i>self</i>, QTransform <i>matrix</i>, bool <i>combine</i> = False)</li><li><div class="fn" /><b><a href="qpainter.html#shear">shear</a></b> (<i>self</i>, float <i>sh</i>, float <i>sv</i>)</li><li><div class="fn" /><b><a href="qpainter.html#strokePath">strokePath</a></b> (<i>self</i>, QPainterPath <i>path</i>, QPen <i>pen</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#testRenderHint">testRenderHint</a></b> (<i>self</i>, RenderHint <i>hint</i>)</li><li><div class="fn" />QTransform <b><a href="qpainter.html#transform">transform</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#translate">translate</a></b> (<i>self</i>, QPointF <i>offset</i>)</li><li><div class="fn" /><b><a href="qpainter.html#translate-2">translate</a></b> (<i>self</i>, float <i>dx</i>, float <i>dy</i>)</li><li><div class="fn" /><b><a href="qpainter.html#translate-3">translate</a></b> (<i>self</i>, QPoint <i>offset</i>)</li><li><div class="fn" />QRect <b><a href="qpainter.html#viewport">viewport</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qpainter.html#window">window</a></b> (<i>self</i>)</li><li><div class="fn" />QMatrix <b><a href="qpainter.html#worldMatrix">worldMatrix</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpainter.html#worldMatrixEnabled">worldMatrixEnabled</a></b> (<i>self</i>)</li><li><div class="fn" />QTransform <b><a href="qpainter.html#worldTransform">worldTransform</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QPaintDevice <b><a href="qpainter.html#redirected">redirected</a></b> (QPaintDevice <i>device</i>, QPoint <i>offset</i> = None)</li><li><div class="fn" /><b><a href="qpainter.html#restoreRedirected">restoreRedirected</a></b> (QPaintDevice <i>device</i>)</li><li><div class="fn" /><b><a href="qpainter.html#setRedirected">setRedirected</a></b> (QPaintDevice <i>device</i>, QPaintDevice <i>replacement</i>, QPoint <i>offset</i> = QPoint())</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />object <b><a href="qpainter.html#__enter__">__enter__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpainter.html#__exit__">__exit__</a></b> (<i>self</i>, object <i>type</i>, object <i>value</i>, object <i>traceback</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPainter class performs low-level painting on widgets and
other paint devices.</p>
<p>QPainter provides highly optimized functions to do most of the
drawing GUI programs require. It 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. QPainter can operate on any object that inherits
the <a href="qpaintdevice.html">QPaintDevice</a> class.</p>
<p>The common use of QPainter is inside a widget's paint event:
Construct and customize (e.g. set the pen or the brush) the
painter. Then draw. Remember to destroy the QPainter object after
drawing. For example:</p>
<pre class="cpp">
<span class="type">void</span> SimpleExampleWidget<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
{
<span class="type">QPainter</span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>setPen(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>blue);
painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">"Arial"</span><span class="operator">,</span> <span class="number">30</span>));
painter<span class="operator">.</span>drawText(rect()<span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>AlignCenter<span class="operator">,</span> <span class="string">"Qt"</span>);
}
</pre>
<p>The core functionality of QPainter is drawing, but the class
also provide several functions that allows you to customize
QPainter's settings and its rendering quality, and others that
enable clipping. In addition you can control how different shapes
are merged together by specifying the painter's composition
mode.</p>
<p>The <a href="qpainter.html#isActive">isActive</a>() function
indicates whether the painter is active. A painter is activated by
the <a href="qpainter.html#begin">begin</a>() function and the
constructor that takes a <a href="qpaintdevice.html">QPaintDevice</a> argument. The <a href="qpainter.html#end">end</a>() function, and the destructor,
deactivates it.</p>
<p>Together with the <a href="qpaintdevice.html">QPaintDevice</a>
and <a href="qpaintengine.html">QPaintEngine</a> classes, QPainter
form the basis for Qt's paint system. QPainter is the class used to
perform drawing operations. <a href="qpaintdevice.html">QPaintDevice</a> represents a device that can
be painted on using a QPainter. <a href="qpaintengine.html">QPaintEngine</a> provides the interface that
the painter uses to draw onto different types of devices. If the
painter is active, <a href="qpainter.html#device">device</a>()
returns the paint device on which the painter paints, and <a href="qpainter.html#paintEngine">paintEngine</a>() returns the paint
engine that the painter is currently operating on. For more
information, see the <a href="paintsystem.html">Paint
System</a>.</p>
<p>Sometimes it is desirable to make someone else paint on an
unusual <a href="qpaintdevice.html">QPaintDevice</a>. QPainter
supports a static function to do this, <a class="obsolete" href="qpainter-obsolete.html#setRedirected">setRedirected</a>().</p>
<p><b>Warning:</b> When the paintdevice is a widget, QPainter can
only be used inside a paintEvent() function or in a function called
by paintEvent(); that is unless the <a href="qt.html#WidgetAttribute-enum">Qt.WA_PaintOutsidePaintEvent</a>
widget attribute is set. On Mac OS X and Windows, you can only
paint in a paintEvent() function regardless of this attribute's
setting.</p>
<a id="settings" name="settings" />
<h3>Settings</h3>
<p>There are several settings that you can customize to make
QPainter draw according to your preferences:</p>
<ul>
<li><a href="qpainter.html#font">font</a>() is the font used for
drawing text. If the painter <a href="qpainter.html#isActive">isActive</a>(), you can retrieve
information about the currently set font, and its metrics, using
the <a href="qpainter.html#fontInfo">fontInfo</a>() and <a href="qpainter.html#fontMetrics">fontMetrics</a>() functions
respectively.</li>
<li><a href="qpainter.html#brush">brush</a>() defines the color or
pattern that is used for filling shapes.</li>
<li><a href="qpainter.html#pen">pen</a>() defines the color or
stipple that is used for drawing lines or boundaries.</li>
<li><a href="qpainter.html#backgroundMode">backgroundMode</a>()
defines whether there is a <a href="qpainter.html#background">background</a>() or not, i.e it is
either <a href="qt.html#BGMode-enum">Qt.OpaqueMode</a> or <a href="qt.html#BGMode-enum">Qt.TransparentMode</a>.</li>
<li><a href="qpainter.html#background">background</a>() only
applies when <a href="qpainter.html#backgroundMode">backgroundMode</a>() is <a href="qt.html#BGMode-enum">Qt.OpaqueMode</a> and <a href="qpainter.html#pen">pen</a>() is a stipple. In that case, it
describes the color of the background pixels in the stipple.</li>
<li><a href="qpainter.html#brushOrigin">brushOrigin</a>() defines
the origin of the tiled brushes, normally the origin of widget's
background.</li>
<li><a href="qpainter.html#viewport">viewport</a>(), <a href="qpainter.html#window">window</a>(), <a href="qpainter.html#worldTransform">worldTransform</a>() make up the
painter's coordinate transformation system. For more information,
see the <a href="#coordinate-transformations">Coordinate
Transformations</a> section and the <a href="coordsys.html">Coordinate System</a> documentation.</li>
<li><a href="qpainter.html#hasClipping">hasClipping</a>() tells
whether the painter clips at all. (The paint device clips, too.) If
the painter clips, it clips to <a href="qpainter.html#clipRegion">clipRegion</a>().</li>
<li><a href="qpainter.html#layoutDirection">layoutDirection</a>()
defines the layout direction used by the painter when drawing
text.</li>
<li><a href="qpainter.html#worldMatrixEnabled">worldMatrixEnabled</a>() tells
whether world transformation is enabled.</li>
<li><a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>()
tells whether view transformation is enabled.</li>
</ul>
<p>Note that some of these settings mirror settings in some paint
devices, e.g. <a href="qwidget.html#font-prop">QWidget.font</a>().
The <a href="qpainter.html#begin">QPainter.begin</a>() function
(or equivalently the QPainter constructor) copies these attributes
from the paint device.</p>
<p>You can at any time save the QPainter's state by calling the
<a href="qpainter.html#save">save</a>() function which saves all
the available settings on an internal stack. The <a href="qpainter.html#restore">restore</a>() function pops them back.</p>
<a id="drawing" name="drawing" />
<h3>Drawing</h3>
<p>QPainter provides functions to draw most primitives: <a href="qpainter.html#drawPoint">drawPoint</a>(), <a href="qpainter.html#drawPoints">drawPoints</a>(), <a href="qpainter.html#drawLine">drawLine</a>(), <a href="qpainter.html#drawRect">drawRect</a>(), <a href="qpainter.html#drawRoundedRect">drawRoundedRect</a>(), <a href="qpainter.html#drawEllipse">drawEllipse</a>(), <a href="qpainter.html#drawArc">drawArc</a>(), <a href="qpainter.html#drawPie">drawPie</a>(), <a href="qpainter.html#drawChord">drawChord</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), <a href="qpainter.html#drawPolygon">drawPolygon</a>(), <a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a>() and
<a class="compat" href="qpainter-qt3.html#drawCubicBezier">drawCubicBezier</a>(). The two convenience functions,
<a href="qpainter.html#drawRects">drawRects</a>() and <a href="qpainter.html#drawLines">drawLines</a>(), draw the given number of
rectangles or lines in the given array of <a href="qrect.html">QRects</a> or <a href="qline.html">QLines</a> using
the current pen and brush.</p>
<p>The QPainter class also provides the <a href="qpainter.html#fillRect">fillRect</a>() function which fills the
given <a href="qrect.html">QRect</a>, with the given <a href="qbrush.html">QBrush</a>, and the <a href="qpainter.html#eraseRect">eraseRect</a>() function that erases the
area inside the given rectangle.</p>
<p>All of these functions have both integer and floating point
versions.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-basicdrawing.png" /></td>
<td><b>Basic Drawing Example</b>
<p>The <a href="painting-basicdrawing.html">Basic Drawing</a>
example shows how to display basic graphics primitives in a variety
of styles using the QPainter class.</p>
</td>
</tr>
</table>
<p>If you need to draw a complex shape, especially if you need to
do so repeatedly, consider creating a <a href="qpainterpath.html">QPainterPath</a> and drawing it using <a href="qpainter.html#drawPath">drawPath</a>().</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><b>Painter Paths example</b>
<p>The <a href="qpainterpath.html">QPainterPath</a> class provides
a container for painting operations, enabling graphical shapes to
be constructed and reused.</p>
<p>The <a href="painting-painterpaths.html">Painter Paths</a>
example shows how painter paths can be used to build complex shapes
for rendering.</p>
</td>
<td><img alt="" src="images/qpainter-painterpaths.png" /></td>
</tr>
</table>
<p>QPainter also provides the <a href="qpainter.html#fillPath">fillPath</a>() function which fills the
given <a href="qpainterpath.html">QPainterPath</a> with the given
<a href="qbrush.html">QBrush</a>, and the <a href="qpainter.html#strokePath">strokePath</a>() function that draws the
outline of the given path (i.e. strokes the path).</p>
<p>See also the <a href="demos-deform.html">Vector Deformation</a>
demo which shows how to use advanced vector techniques to draw text
using a <a href="qpainterpath.html">QPainterPath</a>, the <a href="demos-gradients.html">Gradients</a> demo which shows the different
types of gradients that are available in Qt, and the <a href="demos-pathstroke.html">Path Stroking</a> demo which shows Qt's
built-in dash patterns and shows how custom patterns can be used to
extend the range of available patterns.</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th><a href="demos-deform.html">Vector Deformation</a></th>
<th><a href="demos-gradients.html">Gradients</a></th>
<th><a href="demos-pathstroke.html">Path Stroking</a></th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-vectordeformation.png" /></td>
<td><img alt="" src="images/qpainter-gradients.png" /></td>
<td><img alt="" src="images/qpainter-pathstroking.png" /></td>
</tr>
</table>
<p>There are functions to draw pixmaps/images, namely <a href="qpainter.html#drawPixmap">drawPixmap</a>(), <a href="qpainter.html#drawImage">drawImage</a>() and <a href="qpainter.html#drawTiledPixmap">drawTiledPixmap</a>(). Both
<a href="qpainter.html#drawPixmap">drawPixmap</a>() and <a href="qpainter.html#drawImage">drawImage</a>() produce the same result,
except that <a href="qpainter.html#drawPixmap">drawPixmap</a>() is
faster on-screen while <a href="qpainter.html#drawImage">drawImage</a>() may be faster on a
<a href="qprinter.html">QPrinter</a> or other devices.</p>
<p>Text drawing is done using <a href="qpainter.html#drawText">drawText</a>(). When you need fine-grained
positioning, <a href="qpainter.html#boundingRect">boundingRect</a>() tells you where a
given <a href="qpainter.html#drawText">drawText</a>() command will
draw.</p>
<p>There is a <a href="qpainter.html#drawPicture">drawPicture</a>()
function that draws the contents of an entire <a href="qpicture.html">QPicture</a>. The <a href="qpainter.html#drawPicture">drawPicture</a>() function is the only
function that disregards all the painter's settings as <a href="qpicture.html">QPicture</a> has its own settings.</p>
<a id="rendering-quality" name="rendering-quality" />
<h3>Rendering Quality</h3>
<p>To get the optimal rendering result using QPainter, you should
use the platform independent <a href="qimage.html">QImage</a> as
paint device; i.e. using <a href="qimage.html">QImage</a> will
ensure that the result has an identical pixel representation on any
platform.</p>
<p>The QPainter class also provides a means of controlling the
rendering quality through its <a href="qpainter.html#RenderHint-enum">RenderHint</a> enum and the support
for floating point precision: All the functions for drawing
primitives has a floating point version. These are often used in
combination with the <a href="qpainter.html#RenderHint-enum">QPainter.Antialiasing</a> render
hint.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-concentriccircles.png" /></td>
<td><b>Concentric Circles Example</b>
<p>The <a href="painting-concentriccircles.html">Concentric
Circles</a> example shows the improved rendering quality that can
be obtained using floating point precision and anti-aliasing when
drawing custom widgets.</p>
<p>The application's main window displays several widgets which are
drawn using the various combinations of precision and
anti-aliasing.</p>
</td>
</tr>
</table>
<p>The <a href="qpainter.html#RenderHint-enum">RenderHint</a> enum
specifies flags to QPainter that may or may not be respected by any
given engine. <a href="qpainter.html#RenderHint-enum">QPainter.Antialiasing</a>
indicates that the engine should antialias edges of primitives if
possible, <a href="qpainter.html#RenderHint-enum">QPainter.TextAntialiasing</a>
indicates that the engine should antialias text if possible, and
the <a href="qpainter.html#RenderHint-enum">QPainter.SmoothPixmapTransform</a>
indicates that the engine should use a smooth pixmap transformation
algorithm. <a href="qpainter.html#RenderHint-enum">HighQualityAntialiasing</a> is an
OpenGL-specific rendering hint indicating that the engine should
use fragment programs and offscreen rendering for antialiasing.</p>
<p>The <a href="qpainter.html#renderHints">renderHints</a>()
function returns a flag that specifies the rendering hints that are
set for this painter. Use the <a href="qpainter.html#setRenderHint">setRenderHint</a>() function to set
or clear the currently set <a href="qpainter.html#RenderHint-enum">RenderHints</a>.</p>
<a id="coordinate-transformations" name="coordinate-transformations" />
<h3>Coordinate Transformations</h3>
<p>Normally, the QPainter operates on the device's own coordinate
system (usually pixels), but QPainter has good support for
coordinate transformations.</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th>nop</th>
<th><a href="qpainter.html#rotate">rotate</a>()</th>
<th><a href="qpainter.html#scale">scale</a>()</th>
<th><a href="qpainter.html#translate">translate</a>()</th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-clock.png" /></td>
<td><img alt="" src="images/qpainter-rotation.png" /></td>
<td><img alt="" src="images/qpainter-scale.png" /></td>
<td><img alt="" src="images/qpainter-translation.png" /></td>
</tr>
</table>
<p>The most commonly used transformations are scaling, rotation,
translation and shearing. Use the <a href="qpainter.html#scale">scale</a>() function to scale the coordinate
system by a given offset, the <a href="qpainter.html#rotate">rotate</a>() function to rotate it clockwise
and <a href="qpainter.html#translate">translate</a>() to translate
it (i.e. adding a given offset to the points). You can also twist
the coordinate system around the origin using the <a href="qpainter.html#shear">shear</a>() function. See the <a href="demos-affine.html">Affine Transformations</a> demo for a
visualization of a sheared coordinate system.</p>
<p>See also the <a href="painting-transformations.html">Transformations</a> example which
shows how transformations influence the way that QPainter renders
graphics primitives. In particular it shows how the order of
transformations affects the result.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><b>Affine Transformations Demo</b>
<p>The <a href="demos-affine.html">Affine Transformations</a> demo
show Qt's ability to perform affine transformations on painting
operations. The demo also allows the user to experiment with the
transformation operations and see the results immediately.</p>
</td>
<td><img alt="" src="images/qpainter-affinetransformations.png" /></td>
</tr>
</table>
<p>All the tranformation operations operate on the transformation
<a href="qpainter.html#worldTransform">worldTransform</a>(). A
matrix transforms a point in the plane to another point. For more
information about the transformation matrix, see the <a href="coordsys.html">Coordinate System</a> and <a href="qtransform.html">QTransform</a> documentation.</p>
<p>The <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() function
can replace or add to the currently set <a href="qpainter.html#worldTransform">worldTransform</a>(). The <a href="qpainter.html#resetTransform">resetTransform</a>() function resets
any transformations that were made using <a href="qpainter.html#translate">translate</a>(), <a href="qpainter.html#scale">scale</a>(), <a href="qpainter.html#shear">shear</a>(), <a href="qpainter.html#rotate">rotate</a>(), <a href="qpainter.html#setWorldTransform">setWorldTransform</a>(), <a href="qpainter.html#setViewport">setViewport</a>() and <a href="qpainter.html#setWindow">setWindow</a>() functions. The <a href="qpainter.html#deviceTransform">deviceTransform</a>() returns the
matrix that transforms from logical coordinates to device
coordinates of the platform dependent paint device. The latter
function is only needed when using platform painting commands on
the platform dependent handle, and the platform does not do
transformations nativly.</p>
<p>When drawing with QPainter, we specify points using logical
coordinates which then are converted into the physical coordinates
of the paint device. The mapping of the logical coordinates to the
physical coordinates are handled by QPainter's <a href="qpainter.html#combinedTransform">combinedTransform</a>(), a
combination of <a href="qpainter.html#viewport">viewport</a>() and
<a href="qpainter.html#window">window</a>() and <a href="qpainter.html#worldTransform">worldTransform</a>(). The <a href="qpainter.html#viewport">viewport</a>() represents the physical
coordinates specifying an arbitrary rectangle, the <a href="qpainter.html#window">window</a>() describes the same rectangle in
logical coordinates, and the <a href="qpainter.html#worldTransform">worldTransform</a>() is identical
with the transformation matrix.</p>
<p>See also <a href="coordsys.html">Coordinate System</a></p>
<a id="clipping" name="clipping" />
<h3>Clipping</h3>
<p>QPainter can clip any drawing operation to a rectangle, a
region, or a vector path. The current clip is available using the
functions <a href="qpainter.html#clipRegion">clipRegion</a>() and
<a href="qpainter.html#clipPath">clipPath</a>(). Whether paths or
regions are preferred (faster) depends on the underlying <a href="qpainter.html#paintEngine">paintEngine</a>(). For example, the
<a href="qimage.html">QImage</a> paint engine prefers paths while
the X11 paint engine prefers regions. Setting a clip is done in the
painters logical coordinates.</p>
<p>After QPainter's clipping, the paint device may also clip. For
example, most widgets clip away the pixels used by child widgets,
and most printers clip away an area near the edges of the paper.
This additional clipping is not reflected by the return value of
<a href="qpainter.html#clipRegion">clipRegion</a>() or <a href="qpainter.html#hasClipping">hasClipping</a>().</p>
<a id="composition-modes" name="composition-modes" />
<h3>Composition Modes</h3>
<a id="composition-modes" name="composition-modes" />
<p>QPainter provides the <a href="qpainter.html#CompositionMode-enum">CompositionMode</a> enum which
defines the Porter-Duff rules for digital image compositing; it
describes a model for combining the pixels in one image, the
source, with the pixels in another image, the destination.</p>
<p>The two most common forms of composition are <a href="qpainter.html#CompositionMode-enum">Source</a> and <a href="qpainter.html#CompositionMode-enum">SourceOver</a>. <a href="qpainter.html#CompositionMode-enum">Source</a> is used to draw
opaque objects onto a paint device. In this mode, each pixel in the
source replaces the corresponding pixel in the destination. In
<a href="qpainter.html#CompositionMode-enum">SourceOver</a>
composition mode, the source object is transparent and is drawn on
top of the destination.</p>
<p>Note that composition transformation operates pixelwise. For
that reason, there is a difference between using the graphic
primitive itself and its bounding rectangle: The bounding rect
contains pixels with alpha == 0 (i.e the pixels surrounding the
primitive). These pixels will overwrite the other image's pixels,
affectively clearing those, while the primitive only overwrites its
own area.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-compositiondemo.png" /></td>
<td><b>Composition Modes Demo</b>
<p>The <a href="demos-composition.html">Composition Modes</a> demo,
available in Qt's demo directory, allows you to experiment with the
various composition modes and see the results immediately.</p>
</td>
</tr>
</table>
<a id="limitations" name="limitations" />
<h3>Limitations</h3>
<a id="limitations" name="limitations" />
<p>If you are using coordinates with Qt's raster-based paint
engine, it is important to note that, while coordinates greater
than +/- 2<sup>15</sup> can be used, any painting performed with
coordinates outside this range is not guaranteed to be shown; the
drawing may be clipped. This is due to the use of <tt>short
int</tt> in the implementation.</p>
<p>The outlines generated by Qt's stroker are only an approximation
when dealing with curved shapes. It is in most cases impossible to
represent the outline of a bezier curve segment using another
bezier curve segment, and so Qt approximates the curve outlines by
using several smaller curves. For performance reasons there is a
limit to how many curves Qt uses for these outlines, and thus when
using large pen widths or scales the outline error increases. To
generate outlines with smaller errors it is possible to use the
<a href="qpainterpathstroker.html">QPainterPathStroker</a> class,
which has the setCurveThreshold member function which let's the
user specify the error tolerance. Another workaround is to convert
the paths to polygons first and then draw the polygons instead.</p>
<a id="performance" name="performance" />
<h3>Performance</h3>
<p>QPainter is a rich framework that allows developers to do a
great variety of graphical operations, such as gradients,
composition modes and vector graphics. And QPainter can do this
across a variety of different hardware and software stacks.
Naturally the underlying combination of hardware and software has
some implications for performance, and ensuring that every single
operation is fast in combination with all the various combinations
of composition modes, brushes, clipping, transformation, etc, is
close to an impossible task because of the number of permutations.
As a compromise we have selected a subset of the QPainter API and
backends, where performance is guaranteed to be as good as we can
sensibly get it for the given combination of hardware and
software.</p>
<p>The backends we focus on as high-performance engines are:</p>
<ul>
<li>Raster - This backend implements all rendering in pure software
and is always used to render into QImages. For optimal performance
only use the format types <a href="qimage.html#Format-enum">QImage.Format_ARGB32_Premultiplied</a>,
<a href="qimage.html#Format-enum">QImage.Format_RGB32</a> or
<a href="qimage.html#Format-enum">QImage.Format_RGB16</a>. Any
other format, including <a href="qimage.html#Format-enum">QImage.Format_ARGB32</a>, has
significantly worse performance. This engine is also used by
default on Windows and on QWS. It can be used as default graphics
system on any OS/hardware/software combination by passing
<tt>-graphicssystem raster</tt> on the command line</li>
<li>OpenGL 2.0 (ES) - This backend is the primary backend for
hardware accelerated graphics. It can be run on desktop machines
and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0
specification. This includes most graphics chips produced in the
last couple of years. The engine can be enabled by using QPainter
onto a <a href="qglwidget.html">QGLWidget</a> or by passing
<tt>-graphicssystem opengl</tt> on the command line when the
underlying system supports it.</li>
<li>OpenVG - This backend implements the Khronos standard for 2D
and Vector Graphics. It is primarily for embedded devices with
hardware support for OpenVG. The engine can be enabled by passing
<tt>-graphicssystem openvg</tt> on the command line when the
underlying system supports it.</li>
</ul>
<p>These operations are:</p>
<ul>
<li>Simple transformations, meaning translation and scaling, pluss
0, 90, 180, 270 degree rotations.</li>
<li><tt>drawPixmap()</tt> in combination with simple
transformations and opacity with non-smooth transformation mode
(<tt>QPainter.SmoothPixmapTransform</tt> not enabled as a render
hint).</li>
<li>Rectangle fills with solid color, two-color linear gradients
and simple transforms.</li>
<li>Rectangular clipping with simple transformations and intersect
clip.</li>
<li>Composition Modes <tt>QPainter.CompositionMode_Source</tt> and
<a href="qpainter.html#CompositionMode-enum">QPainter.CompositionMode_SourceOver</a></li>
<li>Rounded rectangle filling using solid color and two-color
linear gradients fills.</li>
<li>3x3 patched pixmaps, via qDrawBorderPixmap.</li>
</ul>
<p>This list gives an indication of which features to safely use in
an application where performance is critical. For certain setups,
other operations may be fast too, but before making extensive use
of them, it is recommended to benchmark and verify them on the
system where the software will run in the end. There are also cases
where expensive operations are ok to use, for instance when the
result is cached in a <a href="qpixmap.html">QPixmap</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="CompositionMode-enum" />QPainter.CompositionMode</h3><p>Defines the modes supported for digital image compositing.
Composition modes are used to specify how the pixels in one image,
the source, are merged with the pixel in another image, the
destination.</p>
<p>Please note that the bitwise raster operation modes, denoted
with a RasterOp prefix, are only natively supported in the X11 and
raster paint engines. This means that the only way to utilize these
modes on the Mac is via a <a href="qimage.html">QImage</a>. The
RasterOp denoted blend modes are <i>not</i> supported for pens and
brushes with alpha components. Also, turning on the <a href="qpainter.html#RenderHint-enum">QPainter.Antialiasing</a> render
hint will effectively disable the RasterOp modes.</p>
<p class="centerAlign"><img alt="" src="images/qpainter-compositionmode1.png" /></p>
<p class="centerAlign"><img alt="" src="images/qpainter-compositionmode2.png" /></p>
<p>The most common type is SourceOver (often referred to as just
alpha blending) where the source pixel is blended on top of the
destination pixel in such a way that the alpha component of the
source defines the translucency of the pixel.</p>
<p>When the paint device is a <a href="qimage.html">QImage</a>, the
image format must be set to <a href="qimage.html#Format-enum">Format_ARGB32Premultiplied</a> or
<a href="qimage.html#Format-enum">Format_ARGB32</a> for the
composition modes to have any effect. For performance the
premultiplied version is the preferred format.</p>
<p>When a composition mode is set it applies to all painting
operator, pens, brushes, gradients and pixmap/image drawing.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SourceOver</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">This is the default mode. The alpha of the
source is used to blend the pixel on top of the destination.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_DestinationOver</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The alpha of the destination is used to blend
it on top of the source pixels. This mode is the inverse of
CompositionMode_SourceOver.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Clear</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The pixels in the destination are cleared (set
to fully transparent) independent of the source.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Source</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">The output is the source pixel. (This means a
basic copy operation and is identical to SourceOver when the source
pixel is opaque).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Destination</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">The output is the destination pixel. This
means that the blending has no effect. This mode is the inverse of
CompositionMode_Source.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SourceIn</tt></td>
<td class="topAlign"><tt>5</tt></td>
<td class="topAlign">The output is the source, where the alpha is
reduced by that of the destination.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_DestinationIn</tt></td>
<td class="topAlign"><tt>6</tt></td>
<td class="topAlign">The output is the destination, where the alpha
is reduced by that of the source. This mode is the inverse of
CompositionMode_SourceIn.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SourceOut</tt></td>
<td class="topAlign"><tt>7</tt></td>
<td class="topAlign">The output is the source, where the alpha is
reduced by the inverse of destination.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_DestinationOut</tt></td>
<td class="topAlign"><tt>8</tt></td>
<td class="topAlign">The output is the destination, where the alpha
is reduced by the inverse of the source. This mode is the inverse
of CompositionMode_SourceOut.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SourceAtop</tt></td>
<td class="topAlign"><tt>9</tt></td>
<td class="topAlign">The source pixel is blended on top of the
destination, with the alpha of the source pixel reduced by the
alpha of the destination pixel.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_DestinationAtop</tt></td>
<td class="topAlign"><tt>10</tt></td>
<td class="topAlign">The destination pixel is blended on top of the
source, with the alpha of the destination pixel is reduced by the
alpha of the destination pixel. This mode is the inverse of
CompositionMode_SourceAtop.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Xor</tt></td>
<td class="topAlign"><tt>11</tt></td>
<td class="topAlign">The source, whose alpha is reduced with the
inverse of the destination alpha, is merged with the destination,
whose alpha is reduced by the inverse of the source alpha.
CompositionMode_Xor is not the same as the bitwise Xor.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Plus</tt></td>
<td class="topAlign"><tt>12</tt></td>
<td class="topAlign">Both the alpha and color of the source and
destination pixels are added together.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Multiply</tt></td>
<td class="topAlign"><tt>13</tt></td>
<td class="topAlign">The output is the source color multiplied by
the destination. Multiplying a color with white leaves the color
unchanged, while multiplying a color with black produces
black.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Screen</tt></td>
<td class="topAlign"><tt>14</tt></td>
<td class="topAlign">The source and destination colors are inverted
and then multiplied. Screening a color with white produces white,
whereas screening a color with black leaves the color
unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Overlay</tt></td>
<td class="topAlign"><tt>15</tt></td>
<td class="topAlign">Multiplies or screens the colors depending on
the destination color. The destination color is mixed with the
source color to reflect the lightness or darkness of the
destination.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.CompositionMode_Darken</tt></td>
<td class="topAlign"><tt>16</tt></td>
<td class="topAlign">The darker of the source and destination
colors is selected.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Lighten</tt></td>
<td class="topAlign"><tt>17</tt></td>
<td class="topAlign">The lighter of the source and destination
colors is selected.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_ColorDodge</tt></td>
<td class="topAlign"><tt>18</tt></td>
<td class="topAlign">The destination color is brightened to reflect
the source color. A black source color leaves the destination color
unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_ColorBurn</tt></td>
<td class="topAlign"><tt>19</tt></td>
<td class="topAlign">The destination color is darkened to reflect
the source color. A white source color leaves the destination color
unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_HardLight</tt></td>
<td class="topAlign"><tt>20</tt></td>
<td class="topAlign">Multiplies or screens the colors depending on
the source color. A light source color will lighten the destination
color, whereas a dark source color will darken the destination
color.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_SoftLight</tt></td>
<td class="topAlign"><tt>21</tt></td>
<td class="topAlign">Darkens or lightens the colors depending on
the source color. Similar to CompositionMode_HardLight.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Difference</tt></td>
<td class="topAlign"><tt>22</tt></td>
<td class="topAlign">Subtracts the darker of the colors from the
lighter. Painting with white inverts the destination color, whereas
painting with black leaves the destination color unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.CompositionMode_Exclusion</tt></td>
<td class="topAlign"><tt>23</tt></td>
<td class="topAlign">Similar to CompositionMode_Difference, but
with a lower contrast. Painting with white inverts the destination
color, whereas painting with black leaves the destination color
unchanged.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_SourceOrDestination</tt></td>
<td class="topAlign"><tt>24</tt></td>
<td class="topAlign">Does a bitwise OR operation on the source and
destination pixels (src OR dst).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_SourceAndDestination</tt></td>
<td class="topAlign"><tt>25</tt></td>
<td class="topAlign">Does a bitwise AND operation on the source and
destination pixels (src AND dst).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_SourceXorDestination</tt></td>
<td class="topAlign"><tt>26</tt></td>
<td class="topAlign">Does a bitwise XOR operation on the source and
destination pixels (src XOR dst).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_NotSourceAndNotDestination</tt></td>
<td class="topAlign"><tt>27</tt></td>
<td class="topAlign">Does a bitwise NOR operation on the source and
destination pixels ((NOT src) AND (NOT dst)).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_NotSourceOrNotDestination</tt></td>
<td class="topAlign"><tt>28</tt></td>
<td class="topAlign">Does a bitwise NAND operation on the source
and destination pixels ((NOT src) OR (NOT dst)).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_NotSourceXorDestination</tt></td>
<td class="topAlign"><tt>29</tt></td>
<td class="topAlign">Does a bitwise operation where the source
pixels are inverted and then XOR'ed with the destination ((NOT src)
XOR dst).</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.RasterOp_NotSource</tt></td>
<td class="topAlign"><tt>30</tt></td>
<td class="topAlign">Does a bitwise operation where the source
pixels are inverted (NOT src).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_NotSourceAndDestination</tt></td>
<td class="topAlign"><tt>31</tt></td>
<td class="topAlign">Does a bitwise operation where the source is
inverted and then AND'ed with the destination ((NOT src) AND
dst).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.RasterOp_SourceAndNotDestination</tt></td>
<td class="topAlign"><tt>32</tt></td>
<td class="topAlign">Does a bitwise operation where the source is
AND'ed with the inverted destination pixels (src AND (NOT
dst)).</td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#compositionMode">compositionMode</a>(), <a href="qpainter.html#setCompositionMode">setCompositionMode</a>(),
<a href="qpainter.html#composition-modes">Composition Modes</a>,
and <a href="painting-imagecomposition.html">Image Composition
Example</a>.</p>
<h3 class="fn"><a name="PixmapFragmentHint-enum" />QPainter.PixmapFragmentHint</h3><table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.OpaqueHint</tt></td>
<td class="topAlign"><tt>0x01</tt></td>
<td class="topAlign">Indicates that the pixmap fragments to be
drawn are opaque. Opaque fragments are potentially faster to
draw.</td>
</tr>
</table>
<p>This enum was introduced or modified in Qt 4.7.</p>
<p>The PixmapFragmentHints type is a typedef for <a href="qflags.html">QFlags</a><PixmapFragmentHint>. It stores an OR
combination of PixmapFragmentHint values.</p>
<p><b>See also</b> <a href="qpainter.html#drawPixmapFragments">QPainter.drawPixmapFragments</a>()
and <a href="qpainter-pixmapfragment.html">QPainter.PixmapFragment</a>.</p>
<h3 class="fn"><a name="RenderHint-enum" />QPainter.RenderHint</h3><p>Renderhints are used to specify flags to <a href="qpainter.html">QPainter</a> that may or may not be respected by
any given engine.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.Antialiasing</tt></td>
<td class="topAlign"><tt>0x01</tt></td>
<td class="topAlign">Indicates that the engine should antialias
edges of primitives if possible.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.TextAntialiasing</tt></td>
<td class="topAlign"><tt>0x02</tt></td>
<td class="topAlign">Indicates that the engine should antialias
text if possible. To forcibly disable antialiasing for text, do not
use this hint. Instead, set <a href="qfont.html#StyleStrategy-enum">QFont.NoAntialias</a> on your
font's style strategy.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.SmoothPixmapTransform</tt></td>
<td class="topAlign"><tt>0x04</tt></td>
<td class="topAlign">Indicates that the engine should use a smooth
pixmap transformation algorithm (such as bilinear) rather than
nearest neighbor.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QPainter.HighQualityAntialiasing</tt></td>
<td class="topAlign"><tt>0x08</tt></td>
<td class="topAlign">An OpenGL-specific rendering hint indicating
that the engine should use fragment programs and offscreen
rendering for antialiasing.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPainter.NonCosmeticDefaultPen</tt></td>
<td class="topAlign"><tt>0x10</tt></td>
<td class="topAlign">The engine should interpret pens with a width
of 0 (which otherwise enables <a href="qpen.html#isCosmetic">QPen.isCosmetic</a>()) as being a
non-cosmetic pen with a width of 1.</td>
</tr>
</table>
<p>The RenderHints type is a typedef for <a href="qflags.html">QFlags</a><RenderHint>. It stores an OR
combination of RenderHint values.</p>
<p><b>See also</b> <a href="qpainter.html#renderHints">renderHints</a>(), <a href="qpainter.html#setRenderHint">setRenderHint</a>(), <a href="qpainter.html#rendering-quality">Rendering Quality</a>, and
<a href="painting-concentriccircles.html">Concentric Circles
Example</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPainter" />QPainter.__init__ (<i>self</i>)</h3><p>Constructs a painter.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpainter.html#end">end</a>().</p>
<h3 class="fn"><a name="QPainter-2" />QPainter.__init__ (<i>self</i>, <a href="qpaintdevice.html">QPaintDevice</a>)</h3><p>Constructs a painter that begins painting the paint
<i>device</i> immediately.</p>
<p>This constructor is convenient for short-lived painters, e.g. in
a <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>() and
should be used only once. The constructor calls <a href="qpainter.html#begin">begin</a>() for you and the <a href="qpainter.html">QPainter</a> destructor automatically calls
<a href="qpainter.html#end">end</a>().</p>
<p>Here's an example using <a href="qpainter.html#begin">begin</a>() and <a href="qpainter.html#end">end</a>():</p>
<pre class="cpp">
<span class="type">void</span> MyWidget<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
{
<span class="type"><a href="qpainter.html">QPainter</a></span> p;
p<span class="operator">.</span>begin(<span class="keyword">this</span>);
p<span class="operator">.</span>drawLine(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>); <span class="comment">// drawing code</span>
p<span class="operator">.</span>end();
}
</pre>
<p>The same example using this constructor:</p>
<pre class="cpp">
<span class="type">void</span> MyWidget<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
{
<span class="type"><a href="qpainter.html">QPainter</a></span> p(<span class="keyword">this</span>);
p<span class="operator">.</span>drawLine(<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>); <span class="comment">// drawing code</span>
}
</pre>
<p>Since the constructor cannot provide feedback when the
initialization of the painter failed you should rather use <a href="qpainter.html#begin">begin</a>() and <a href="qpainter.html#end">end</a>() to paint on external devices, e.g.
printers.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpainter.html#end">end</a>().</p>
<h3 class="fn"><a name="background" /><a href="qbrush.html">QBrush</a> QPainter.background (<i>self</i>)</h3><p>Returns the current background brush.</p>
<p><b>See also</b> <a href="qpainter.html#setBackground">setBackground</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="backgroundMode" /><a href="qt.html#BGMode-enum">Qt.BGMode</a> QPainter.backgroundMode (<i>self</i>)</h3><p>Returns the current background mode.</p>
<p><b>See also</b> <a href="qpainter.html#setBackgroundMode">setBackgroundMode</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="begin" />bool QPainter.begin (<i>self</i>, <a href="qpaintdevice.html">QPaintDevice</a>)</h3><p>Begins painting the paint <i>device</i> and returns true if
successful; otherwise returns false.</p>
<p>Notice that all painter settings (<a href="qpainter.html#setPen">setPen</a>(), <a href="qpainter.html#setBrush">setBrush</a>() etc.) are reset to default
values when begin() is called.</p>
<p>The errors that can occur are serious problems, such as
these:</p>
<pre class="cpp">
painter<span class="operator">-</span><span class="operator">></span>begin(<span class="number">0</span>); <span class="comment">// impossible - paint device cannot be 0</span>
<span class="type"><a href="qpixmap.html">QPixmap</a></span> image(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
painter<span class="operator">-</span><span class="operator">></span>begin(<span class="operator">&</span>image); <span class="comment">// impossible - image.isNull() == true;</span>
painter<span class="operator">-</span><span class="operator">></span>begin(myWidget);
painter2<span class="operator">-</span><span class="operator">></span>begin(myWidget); <span class="comment">// impossible - only one painter at a time</span>
</pre>
<p>Note that most of the time, you can use one of the constructors
instead of begin(), and that <a href="qpainter.html#end">end</a>()
is automatically done at destruction.</p>
<p><b>Warning:</b> A paint device can only be painted by one
painter at a time.</p>
<p><b>Warning:</b> Painting on a <a href="qimage.html">QImage</a>
with the format <a href="qimage.html#Format-enum">QImage.Format_Indexed8</a> is not
supported.</p>
<p><b>See also</b> <a href="qpainter.html#end">end</a>() and
<a href="qpainter.html#QPainter">QPainter</a>().</p>
<h3 class="fn"><a name="beginNativePainting" />QPainter.beginNativePainting (<i>self</i>)</h3><p>Flushes the painting pipeline and prepares for the user issuing
commands directly to the underlying graphics context. Must be
followed by a call to <a href="qpainter.html#endNativePainting">endNativePainting</a>().</p>
<p>Note that only the states the underlying paint engine changes
will be reset to their respective default states. The states we
reset may change from release to release. The following states are
currently reset in the OpenGL 2 engine:</p>
<ul>
<li>blending is disabled</li>
<li>the depth, stencil and scissor tests are disabled</li>
<li>the active texture unit is reset to 0</li>
<li>the depth mask, depth function and the clear depth are reset to
their default values</li>
<li>the stencil mask, stencil operation and stencil function are
reset to their default values</li>
<li>the current color is reset to solid white</li>
</ul>
<p>If, for example, the OpenGL polygon mode is changed by the user
inside a beginNativePaint()/<a href="qpainter.html#endNativePainting">endNativePainting</a>() block, it
will not be reset to the default state by <a href="qpainter.html#endNativePainting">endNativePainting</a>(). Here is
an example that shows intermixing of painter commands and raw
OpenGL commands:</p>
<pre class="cpp">
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span><a href="qpainter.html#fillRect">fillRect</a>(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">128</span><span class="operator">,</span> <span class="number">128</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>green);
painter<span class="operator">.</span>beginNativePainting();
glEnable(GL_SCISSOR_TEST);
glScissor(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">64</span><span class="operator">,</span> <span class="number">64</span>);
glClearColor(<span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
painter<span class="operator">.</span><a href="qpainter.html#endNativePainting">endNativePainting</a>();
</pre>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qpainter.html#endNativePainting">endNativePainting</a>().</p>
<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QPainter.boundingRect (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rect</i>, int <i>flags</i>, QString <i>text</i>)</h3><p>Returns the bounding rectangle of the <i>text</i> as it will
appear when drawn inside the given <i>rectangle</i> with the
specified <i>flags</i> using the currently set <a href="qpainter.html#font">font</a>(); i.e the function tells you where
the <a href="qpainter.html#drawText">drawText</a>() function will
draw when given the same arguments.</p>
<p>If the <i>text</i> does not fit within the given
<i>rectangle</i> using the specified <i>flags</i>, the function
returns the required rectangle.</p>
<p>The <i>flags</i> argument is a bitwise OR of the following
flags:</p>
<ul>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignLeft</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignRight</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignHCenter</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignTop</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignBottom</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignVCenter</a></li>
<li><a href="qt.html#AlignmentFlag-enum">Qt.AlignCenter</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextSingleLine</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextExpandTabs</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextShowMnemonic</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextWordWrap</a></li>
<li><a href="qt.html#TextFlag-enum">Qt.TextIncludeTrailingSpaces</a></li>
</ul>
<p>If several of the horizontal or several of the vertical
alignment flags are set, the resulting alignment is undefined.</p>
<p><b>See also</b> <a href="qpainter.html#drawText">drawText</a>(),
<a href="qt.html#AlignmentFlag-enum">Qt.Alignment</a>, and
<a href="qt.html#TextFlag-enum">Qt.TextFlag</a>.</p>
<h3 class="fn"><a name="boundingRect-2" /><a href="qrect.html">QRect</a> QPainter.boundingRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>, int <i>flags</i>, QString <i>text</i>)</h3><h3 class="fn"><a name="boundingRect-3" /><a href="qrectf.html">QRectF</a> QPainter.boundingRect (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rectangle</i>, QString <i>text</i>, <a href="qtextoption.html">QTextOption</a> <i>option</i> = QTextOption())</h3><h3 class="fn"><a name="boundingRect-4" /><a href="qrect.html">QRect</a> QPainter.boundingRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>flags</i>, QString <i>text</i>)</h3><p>This is an overloaded function.</p>
<p>Returns the bounding rectangle of the <i>text</i> as it will
appear when drawn inside the given <i>rectangle</i> with the
specified <i>flags</i> using the currently set <a href="qpainter.html#font">font</a>().</p>
<h3 class="fn"><a name="brush" /><a href="qbrush.html">QBrush</a> QPainter.brush (<i>self</i>)</h3><p>Returns the painter's current brush.</p>
<p><b>See also</b> <a href="qpainter.html#setBrush">QPainter.setBrush</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="brushOrigin" /><a href="qpoint.html">QPoint</a> QPainter.brushOrigin (<i>self</i>)</h3><p>Returns the currently set brush origin.</p>
<p><b>See also</b> <a href="qpainter.html#setBrushOrigin">setBrushOrigin</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="clipBoundingRect" /><a href="qrectf.html">QRectF</a> QPainter.clipBoundingRect (<i>self</i>)</h3><p>Returns the bounding rectangle of the current clip if there is a
clip; otherwise returns an empty rectangle. Note that the clip
region is given in logical coordinates.</p>
<p>The bounding rectangle is not guaranteed to be tight.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qpainter.html#setClipRect">setClipRect</a>(), <a href="qpainter.html#setClipPath">setClipPath</a>(), and <a href="qpainter.html#setClipRegion">setClipRegion</a>().</p>
<h3 class="fn"><a name="clipPath" /><a href="qpainterpath.html">QPainterPath</a> QPainter.clipPath (<i>self</i>)</h3><p>Returns the currently clip as a path. Note that the clip path is
given in logical coordinates.</p>
<p><b>Warning:</b> <a href="qpainter.html">QPainter</a> does not
store the combined clip explicitly as this is handled by the
underlying <a href="qpaintengine.html">QPaintEngine</a>, so the
path is recreated on demand and transformed to the current logical
coordinate system. This is potentially an expensive operation.</p>
<p><b>See also</b> <a href="qpainter.html#setClipPath">setClipPath</a>(), <a href="qpainter.html#clipRegion">clipRegion</a>(), and <a href="qpainter.html#setClipping">setClipping</a>().</p>
<h3 class="fn"><a name="clipRegion" /><a href="qregion.html">QRegion</a> QPainter.clipRegion (<i>self</i>)</h3><p>Returns the currently set clip region. Note that the clip region
is given in logical coordinates.</p>
<p><b>Warning:</b> <a href="qpainter.html">QPainter</a> does not
store the combined clip explicitly as this is handled by the
underlying <a href="qpaintengine.html">QPaintEngine</a>, so the
path is recreated on demand and transformed to the current logical
coordinate system. This is potentially an expensive operation.</p>
<p><b>See also</b> <a href="qpainter.html#setClipRegion">setClipRegion</a>(), <a href="qpainter.html#clipPath">clipPath</a>(), and <a href="qpainter.html#setClipping">setClipping</a>().</p>
<h3 class="fn"><a name="combinedMatrix" /><a href="qmatrix.html">QMatrix</a> QPainter.combinedMatrix (<i>self</i>)</h3><h3 class="fn"><a name="combinedTransform" /><a href="qtransform.html">QTransform</a> QPainter.combinedTransform (<i>self</i>)</h3><p>Returns the transformation matrix combining the current
window/viewport and world transformation.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>(), <a href="qpainter.html#setWindow">setWindow</a>(), and <a href="qpainter.html#setViewport">setViewport</a>().</p>
<h3 class="fn"><a name="compositionMode" /><a href="qpainter.html#CompositionMode-enum">CompositionMode</a> QPainter.compositionMode (<i>self</i>)</h3><p>Returns the current composition mode.</p>
<p><b>See also</b> <a href="qpainter.html#CompositionMode-enum">CompositionMode</a> and
<a href="qpainter.html#setCompositionMode">setCompositionMode</a>().</p>
<h3 class="fn"><a name="device" /><a href="qpaintdevice.html">QPaintDevice</a> QPainter.device (<i>self</i>)</h3><p>Returns the paint device on which this painter is currently
painting, or 0 if the painter is not active.</p>
<p><b>See also</b> <a href="qpainter.html#isActive">isActive</a>().</p>
<h3 class="fn"><a name="deviceMatrix" /><a href="qmatrix.html">QMatrix</a> QPainter.deviceMatrix (<i>self</i>)</h3><h3 class="fn"><a name="deviceTransform" /><a href="qtransform.html">QTransform</a> QPainter.deviceTransform (<i>self</i>)</h3><p>Returns the matrix that transforms from logical coordinates to
device coordinates of the platform dependent paint device.</p>
<p>This function is <i>only</i> needed when using platform painting
commands on the platform dependent handle (<a href="qt.html#HANDLE-typedef">Qt.HANDLE</a>), and the platform does not
do transformations nativly.</p>
<p>The <a href="qpaintengine.html#PaintEngineFeature-enum">QPaintEngine.PaintEngineFeature</a>
enum can be queried to determine whether the platform performs the
transformations or not.</p>
<p><b>See also</b> <a href="qpainter.html#worldTransform">worldTransform</a>() and <a href="qpaintengine.html#hasFeature">QPaintEngine.hasFeature</a>().</p>
<h3 class="fn"><a name="drawArc" />QPainter.drawArc (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rect</i>, int <i>a</i>, int <i>alen</i>)</h3><p>Draws the arc defined by the given <i>rectangle</i>,
<i>startAngle</i> and <i>spanAngle</i>.</p>
<p>The <i>startAngle</i> and <i>spanAngle</i> must be specified in
1/16th of a degree, i.e. a full circle equals 5760 (16 * 360).
Positive values for the angles mean counter-clockwise while
negative values mean the clockwise direction. Zero degrees is at
the 3 o'clock position.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-arc.png" /></td>
<td>
<pre class="cpp">
<span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
<span class="type">int</span> startAngle <span class="operator">=</span> <span class="number">30</span> <span class="operator">*</span> <span class="number">16</span>;
<span class="type">int</span> spanAngle <span class="operator">=</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">16</span>;
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawArc(rectangle<span class="operator">,</span> startAngle<span class="operator">,</span> spanAngle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawPie">drawPie</a>(),
<a href="qpainter.html#drawChord">drawChord</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="drawArc-2" />QPainter.drawArc (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>, int <i>a</i>, int <i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the arc defined by the given <i>rectangle</i>,
<i>startAngle</i> and <i>spanAngle</i>.</p>
<h3 class="fn"><a name="drawArc-3" />QPainter.drawArc (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>a</i>, int <i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the arc defined by the rectangle beginning at (<i>x</i>,
<i>y</i>) with the specified <i>width</i> and <i>height</i>, and
the given <i>startAngle</i> and <i>spanAngle</i>.</p>
<h3 class="fn"><a name="drawChord" />QPainter.drawChord (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rect</i>, int <i>a</i>, int <i>alen</i>)</h3><p>Draws the chord defined by the given <i>rectangle</i>,
<i>startAngle</i> and <i>spanAngle</i>. The chord is filled with
the current <a href="qpainter.html#brush">brush</a>().</p>
<p>The startAngle and spanAngle must be specified in 1/16th of a
degree, i.e. a full circle equals 5760 (16 * 360). Positive values
for the angles mean counter-clockwise while negative values mean
the clockwise direction. Zero degrees is at the 3 o'clock
position.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-chord.png" /></td>
<td>
<pre class="cpp">
<span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
<span class="type">int</span> startAngle <span class="operator">=</span> <span class="number">30</span> <span class="operator">*</span> <span class="number">16</span>;
<span class="type">int</span> spanAngle <span class="operator">=</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">16</span>;
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawChord(rect<span class="operator">,</span> startAngle<span class="operator">,</span> spanAngle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawArc">drawArc</a>(),
<a href="qpainter.html#drawPie">drawPie</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="drawChord-2" />QPainter.drawChord (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>, int <i>a</i>, int <i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the chord defined by the given <i>rectangle</i>,
<i>startAngle</i> and <i>spanAngle</i>.</p>
<h3 class="fn"><a name="drawChord-3" />QPainter.drawChord (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>a</i>, int <i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the chord defined by the rectangle beginning at (<i>x</i>,
<i>y</i>) with the specified <i>width</i> and <i>height</i>, and
the given <i>startAngle</i> and <i>spanAngle</i>.</p>
<h3 class="fn"><a name="drawConvexPolygon" />QPainter.drawConvexPolygon (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>point</i>, ...)</h3><p>Draws the convex polygon defined by the first <i>pointCount</i>
points in the array <i>points</i> using the current pen.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-polygon.png" /></td>
<td>
<pre class="cpp">
<span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="qpointf.html">QPointF</a></span> points<span class="operator">[</span><span class="number">4</span><span class="operator">]</span> <span class="operator">=</span> {
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span>)<span class="operator">,</span>
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">20.0</span><span class="operator">,</span> <span class="number">10.0</span>)<span class="operator">,</span>
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">80.0</span><span class="operator">,</span> <span class="number">30.0</span>)<span class="operator">,</span>
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">90.0</span><span class="operator">,</span> <span class="number">70.0</span>)
};
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawConvexPolygon(points<span class="operator">,</span> <span class="number">4</span>);
</pre></td>
</tr>
</table>
<p>The first point is implicitly connected to the last point, and
the polygon is filled with the current <a href="qpainter.html#brush">brush</a>(). If the supplied polygon is not
convex, i.e. it contains at least one angle larger than 180
degrees, the results are undefined.</p>
<p>On some platforms (e.g. X11), the drawConvexPolygon() function
can be faster than the <a href="qpainter.html#drawPolygon">drawPolygon</a>() function.</p>
<p><b>See also</b> <a href="qpainter.html#drawPolygon">drawPolygon</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="drawConvexPolygon-2" />QPainter.drawConvexPolygon (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a> <i>poly</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the convex polygon defined by the first <i>pointCount</i>
points in the array <i>points</i> using the current pen.</p>
<h3 class="fn"><a name="drawConvexPolygon-3" />QPainter.drawConvexPolygon (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>point</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the convex polygon defined by <i>polygon</i> using the
current pen and brush.</p>
<h3 class="fn"><a name="drawConvexPolygon-4" />QPainter.drawConvexPolygon (<i>self</i>, <a href="qpolygon.html">QPolygon</a> <i>poly</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the convex polygon defined by <i>polygon</i> using the
current pen and brush.</p>
<h3 class="fn"><a name="drawEllipse" />QPainter.drawEllipse (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>r</i>)</h3><p>Draws the ellipse defined by the given <i>rectangle</i>.</p>
<p>A filled ellipse has a size of <i>rectangle</i>.<a href="qrect.html#size">size()</a>. A stroked ellipse has a size of
<i>rectangle</i>.<a href="qrect.html#size">size()</a> plus the pen
width.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-ellipse.png" /></td>
<td>
<pre class="cpp">
<span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawEllipse(rectangle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawPie">drawPie</a>()
and <a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="drawEllipse-2" />QPainter.drawEllipse (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the ellipse defined by the given <i>rectangle</i>.</p>
<h3 class="fn"><a name="drawEllipse-3" />QPainter.drawEllipse (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the ellipse defined by the rectangle beginning at
(<i>x</i>, <i>y</i>) with the given <i>width</i> and
<i>height</i>.</p>
<h3 class="fn"><a name="drawEllipse-4" />QPainter.drawEllipse (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>center</i>, float <i>rx</i>, float <i>ry</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the ellipse positioned at <i>center</i> with radii
<i>rx</i> and <i>ry</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<h3 class="fn"><a name="drawEllipse-5" />QPainter.drawEllipse (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>center</i>, int <i>rx</i>, int <i>ry</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the ellipse positioned at <i>center</i> with radii
<i>rx</i> and <i>ry</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<h3 class="fn"><a name="drawGlyphRun" />QPainter.drawGlyphRun (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>position</i>, <a href="qglyphrun.html">QGlyphRun</a> <i>glyphRun</i>)</h3><p>Draws the specified <i>glyphs</i> at the given <i>position</i>.
The <i>position</i> gives the edge of the baseline for the string
of glyphs. The glyphs will be retrieved from the font selected by
<i>glyphs</i> and at offsets given by the positions in
<i>glyphs</i>.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qglyphrun.html#setRawFont">QGlyphRun.setRawFont</a>(), <a href="qglyphrun.html#setPositions">QGlyphRun.setPositions</a>(), and
<a href="qglyphrun.html#setGlyphIndexes">QGlyphRun.setGlyphIndexes</a>().</p>
<h3 class="fn"><a name="drawImage" />QPainter.drawImage (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>targetRect</i>, <a href="qimage.html">QImage</a> <i>image</i>, <a href="qrectf.html">QRectF</a> <i>sourceRect</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a> <i>flags</i> = Qt.AutoColor)</h3><p>Draws the rectangular portion <i>source</i> of the given
<i>image</i> into the <i>target</i> rectangle in the paint
device.</p>
<p><b>Note:</b> The image is scaled to fit the rectangle, if both
the image and rectangle size disagree.</p>
<p>If the image needs to be modified to fit in a lower-resolution
result (e.g. converting from 32-bit to 8-bit), use the <i>flags</i>
to specify how you would prefer this to happen.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td>
<pre class="cpp">
<span class="type"><a href="qrectf.html">QRectF</a></span> target(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
<span class="type"><a href="qrectf.html">QRectF</a></span> source(<span class="number">0.0</span><span class="operator">,</span> <span class="number">0.0</span><span class="operator">,</span> <span class="number">70.0</span><span class="operator">,</span> <span class="number">40.0</span>);
<span class="type"><a href="qimage.html">QImage</a></span> image(<span class="string">":/images/myImage.png"</span>);
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawImage(target<span class="operator">,</span> image<span class="operator">,</span> source);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawPixmap">drawPixmap</a>().</p>
<h3 class="fn"><a name="drawImage-2" />QPainter.drawImage (<i>self</i>, <a href="qrect.html">QRect</a> <i>targetRect</i>, <a href="qimage.html">QImage</a> <i>image</i>, <a href="qrect.html">QRect</a> <i>sourceRect</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a> <i>flags</i> = Qt.AutoColor)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>image</i> into the <i>target</i> rectangle in the paint
device.</p>
<p><b>Note:</b> The image is scaled to fit the rectangle, if both
the image and rectangle size disagree.</p>
<h3 class="fn"><a name="drawImage-3" />QPainter.drawImage (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>p</i>, <a href="qimage.html">QImage</a> <i>image</i>, <a href="qrectf.html">QRectF</a> <i>sr</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a> <i>flags</i> = Qt.AutoColor)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> at the given <i>point</i>.</p>
<h3 class="fn"><a name="drawImage-4" />QPainter.drawImage (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>, <a href="qimage.html">QImage</a> <i>image</i>, <a href="qrect.html">QRect</a> <i>sr</i>, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a> <i>flags</i> = Qt.AutoColor)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> at the given <i>point</i>.</p>
<h3 class="fn"><a name="drawImage-5" />QPainter.drawImage (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>r</i>, <a href="qimage.html">QImage</a> <i>image</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>image</i> with its origin at the given <i>point</i>.</p>
<h3 class="fn"><a name="drawImage-6" />QPainter.drawImage (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>, <a href="qimage.html">QImage</a> <i>image</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>image</i> with its origin at the given <i>point</i>.</p>
<h3 class="fn"><a name="drawImage-7" />QPainter.drawImage (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>p</i>, <a href="qimage.html">QImage</a> <i>image</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> into the given
<i>rectangle</i>.</p>
<p><b>Note:</b> The image is scaled to fit the rectangle, if both
the image and rectangle size disagree.</p>
<h3 class="fn"><a name="drawImage-8" />QPainter.drawImage (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>, <a href="qimage.html">QImage</a> <i>image</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>image</i> into the given
<i>rectangle</i>.</p>
<p><b>Note:</b> The image is scaled to fit the rectangle, if both
the image and rectangle size disagree.</p>
<h3 class="fn"><a name="drawImage-9" />QPainter.drawImage (<i>self</i>, int <i>x</i>, int <i>y</i>, <a href="qimage.html">QImage</a> <i>image</i>, int <i>sx</i> = 0, int <i>sy</i> = 0, int <i>sw</i> = -1, int <i>sh</i> = -1, <a href="qt-imageconversionflags.html">Qt.ImageConversionFlags</a> <i>flags</i> = Qt.AutoColor)</h3><p>This is an overloaded function.</p>
<p>Draws an image at (<i>x</i>, <i>y</i>) by copying a part of
<i>image</i> into the paint device.</p>
<p>(<i>x</i>, <i>y</i>) specifies the top-left point in the paint
device that is to be drawn onto. (<i>sx</i>, <i>sy</i>) specifies
the top-left point in <i>image</i> that is to be drawn. The default
is (0, 0).</p>
<p>(<i>sw</i>, <i>sh</i>) specifies the size of the image that is
to be drawn. The default, (0, 0) (and negative) means all the way
to the bottom-right of the image.</p>
<h3 class="fn"><a name="drawLine" />QPainter.drawLine (<i>self</i>, <a href="qlinef.html">QLineF</a> <i>l</i>)</h3><p>Draws a line defined by <i>line</i>.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-line.png" /></td>
<td>
<pre class="cpp">
<span class="type"><a href="qlinef.html">QLineF</a></span> line(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">90.0</span><span class="operator">,</span> <span class="number">20.0</span>);
<span class="type"><a href="qpainter.html">QPainter</a></span>(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawLine(line);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawLines">drawLines</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="drawLine-2" />QPainter.drawLine (<i>self</i>, <a href="qline.html">QLine</a> <i>line</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line defined by <i>line</i>.</p>
<h3 class="fn"><a name="drawLine-3" />QPainter.drawLine (<i>self</i>, int <i>x1</i>, int <i>y1</i>, int <i>x2</i>, int <i>y2</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line from <i>p1</i> to <i>p2</i>.</p>
<h3 class="fn"><a name="drawLine-4" />QPainter.drawLine (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p1</i>, <a href="qpoint.html">QPoint</a> <i>p2</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line from <i>p1</i> to <i>p2</i>.</p>
<h3 class="fn"><a name="drawLine-5" />QPainter.drawLine (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>p1</i>, <a href="qpointf.html">QPointF</a> <i>p2</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line from (<i>x1</i>, <i>y1</i>) to (<i>x2</i>,
<i>y2</i>) and sets the current pen position to (<i>x2</i>,
<i>y2</i>).</p>
<h3 class="fn"><a name="drawLines" />QPainter.drawLines (<i>self</i>, <a href="qlinef.html">QLineF</a> <i>line</i>, ...)</h3><p>Draws the first <i>lineCount</i> lines in the array <i>lines</i>
using the current pen.</p>
<p><b>See also</b> <a href="qpainter.html#drawLine">drawLine</a>()
and <a href="qpainter.html#drawPolyline">drawPolyline</a>().</p>
<h3 class="fn"><a name="drawLines-2" />QPainter.drawLines (<i>self</i>, unknown-type <i>lines</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>lineCount</i> lines in the array <i>lines</i>
using the current pen.</p>
<h3 class="fn"><a name="drawLines-3" />QPainter.drawLines (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>pointPair</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>lineCount</i> lines in the array
<i>pointPairs</i> using the current pen. The lines are specified as
pairs of points so the number of entries in <i>pointPairs</i> must
be at least <i>lineCount</i> * 2.</p>
<h3 class="fn"><a name="drawLines-4" />QPainter.drawLines (<i>self</i>, unknown-type <i>pointPairs</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>lineCount</i> lines in the array
<i>pointPairs</i> using the current pen.</p>
<h3 class="fn"><a name="drawLines-5" />QPainter.drawLines (<i>self</i>, <a href="qline.html">QLine</a> <i>line</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws a line for each pair of points in the vector
<i>pointPairs</i> using the current pen. If there is an odd number
of points in the array, the last point will be ignored.</p>
<h3 class="fn"><a name="drawLines-6" />QPainter.drawLines (<i>self</i>, unknown-type <i>lines</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a line for each pair of points in the vector
<i>pointPairs</i> using the current pen.</p>
<h3 class="fn"><a name="drawLines-7" />QPainter.drawLines (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>pointPair</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the set of lines defined by the list <i>lines</i> using
the current pen and brush.</p>
<h3 class="fn"><a name="drawLines-8" />QPainter.drawLines (<i>self</i>, unknown-type <i>pointPairs</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the set of lines defined by the list <i>lines</i> using
the current pen and brush.</p>
<h3 class="fn"><a name="drawPath" />QPainter.drawPath (<i>self</i>, <a href="qpainterpath.html">QPainterPath</a> <i>path</i>)</h3><p>Draws the given painter <i>path</i> using the current pen for
outline and the current brush for filling.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-path.png" /></td>
<td>
<pre class="cpp">
<span class="type"><a href="qpainterpath.html">QPainterPath</a></span> path;
path<span class="operator">.</span>moveTo(<span class="number">20</span><span class="operator">,</span> <span class="number">80</span>);
path<span class="operator">.</span>lineTo(<span class="number">20</span><span class="operator">,</span> <span class="number">30</span>);
path<span class="operator">.</span>cubicTo(<span class="number">80</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">50</span><span class="operator">,</span> <span class="number">50</span><span class="operator">,</span> <span class="number">80</span><span class="operator">,</span> <span class="number">80</span>);
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawPath(path);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="painting-painterpaths.html">the Painter
Paths example</a> and <a href="demos-deform.html">the Vector
Deformation demo</a>.</p>
<h3 class="fn"><a name="drawPicture" />QPainter.drawPicture (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>p</i>, <a href="qpicture.html">QPicture</a> <i>picture</i>)</h3><p>Replays the given <i>picture</i> at the given <i>point</i>.</p>
<p>The <a href="qpicture.html">QPicture</a> class is a paint device
that records and replays <a href="qpainter.html">QPainter</a>
commands. A picture serializes the painter commands to an IO device
in a platform-independent format. Everything that can be painted on
a widget or pixmap can also be stored in a picture.</p>
<p>This function does exactly the same as <a href="qpicture.html#play">QPicture.play</a>() when called with
<i>point</i> = <a href="qpoint.html">QPoint</a>(0, 0).</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td>
<pre class="cpp">
<span class="type"><a href="qpicture.html">QPicture</a></span> picture;
<span class="type"><a href="qpointf.html">QPointF</a></span> point(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span>)
picture<span class="operator">.</span>load(<span class="string">"drawing.pic"</span>);
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawPicture(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> picture);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpicture.html#play">QPicture.play</a>().</p>
<h3 class="fn"><a name="drawPicture-2" />QPainter.drawPicture (<i>self</i>, int <i>x</i>, int <i>y</i>, <a href="qpicture.html">QPicture</a> <i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Replays the given <i>picture</i> at the given <i>point</i>.</p>
<h3 class="fn"><a name="drawPicture-3" />QPainter.drawPicture (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>pt</i>, <a href="qpicture.html">QPicture</a> <i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>picture</i> at point (<i>x</i>,
<i>y</i>).</p>
<h3 class="fn"><a name="drawPie" />QPainter.drawPie (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rect</i>, int <i>a</i>, int <i>alen</i>)</h3><p>Draws a pie defined by the given <i>rectangle</i>,
<i>startAngle</i> and and <i>spanAngle</i>.</p>
<p>The pie is filled with the current <a href="qpainter.html#brush">brush</a>().</p>
<p>The startAngle and spanAngle must be specified in 1/16th of a
degree, i.e. a full circle equals 5760 (16 * 360). Positive values
for the angles mean counter-clockwise while negative values mean
the clockwise direction. Zero degrees is at the 3 o'clock
position.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-pie.png" /></td>
<td>
<pre class="cpp">
<span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
<span class="type">int</span> startAngle <span class="operator">=</span> <span class="number">30</span> <span class="operator">*</span> <span class="number">16</span>;
<span class="type">int</span> spanAngle <span class="operator">=</span> <span class="number">120</span> <span class="operator">*</span> <span class="number">16</span>;
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawPie(rectangle<span class="operator">,</span> startAngle<span class="operator">,</span> spanAngle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawEllipse">drawEllipse</a>(), <a href="qpainter.html#drawChord">drawChord</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="drawPie-2" />QPainter.drawPie (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>, int <i>a</i>, int <i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a pie defined by the given <i>rectangle</i>,
<i>startAngle</i> and and <i>spanAngle</i>.</p>
<h3 class="fn"><a name="drawPie-3" />QPainter.drawPie (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>a</i>, int <i>alen</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the pie defined by the rectangle beginning at (<i>x</i>,
<i>y</i>) with the specified <i>width</i> and <i>height</i>, and
the given <i>startAngle</i> and <i>spanAngle</i>.</p>
<h3 class="fn"><a name="drawPixmap" />QPainter.drawPixmap (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>targetRect</i>, <a href="qpixmap.html">QPixmap</a> <i>pixmap</i>, <a href="qrectf.html">QRectF</a> <i>sourceRect</i>)</h3><p>Draws the rectangular portion <i>source</i> of the given
<i>pixmap</i> into the given <i>target</i> in the paint device.</p>
<p><b>Note:</b> The pixmap is scaled to fit the rectangle, if both
the pixmap and rectangle size disagree.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td>
<pre class="cpp">
<span class="type"><a href="qrectf.html">QRectF</a></span> target(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
<span class="type"><a href="qrectf.html">QRectF</a></span> source(<span class="number">0.0</span><span class="operator">,</span> <span class="number">0.0</span><span class="operator">,</span> <span class="number">70.0</span><span class="operator">,</span> <span class="number">40.0</span>);
<span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap(<span class="string">":myPixmap.png"</span>);
<span class="type"><a href="qpainter.html">QPainter</a></span>(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawPixmap(target<span class="operator">,</span> image<span class="operator">,</span> source);
</pre></td>
</tr>
</table>
<p>If <i>pixmap</i> is a <a href="qbitmap.html">QBitmap</a> it is
drawn with the bits that are "set" using the pens color. If
backgroundMode is <a href="qt.html#BGMode-enum">Qt.OpaqueMode</a>,
the "unset" bits are drawn using the color of the background brush;
if backgroundMode is <a href="qt.html#BGMode-enum">Qt.TransparentMode</a>, the "unset" bits are
transparent. Drawing bitmaps with gradient or texture colors is not
supported.</p>
<p><b>See also</b> <a href="qpainter.html#drawImage">drawImage</a>().</p>
<h3 class="fn"><a name="drawPixmap-2" />QPainter.drawPixmap (<i>self</i>, <a href="qrect.html">QRect</a> <i>targetRect</i>, <a href="qpixmap.html">QPixmap</a> <i>pixmap</i>, <a href="qrect.html">QRect</a> <i>sourceRect</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>pixmap</i> into the given <i>target</i> in the paint device.</p>
<p><b>Note:</b> The pixmap is scaled to fit the rectangle, if both
the pixmap and rectangle size disagree.</p>
<h3 class="fn"><a name="drawPixmap-3" />QPainter.drawPixmap (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>p</i>, <a href="qpixmap.html">QPixmap</a> <i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>pixmap</i> with its origin at the given <i>point</i>.</p>
<h3 class="fn"><a name="drawPixmap-4" />QPainter.drawPixmap (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>, <a href="qpixmap.html">QPixmap</a> <i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion <i>source</i> of the given
<i>pixmap</i> with its origin at the given <i>point</i>.</p>
<h3 class="fn"><a name="drawPixmap-5" />QPainter.drawPixmap (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>, <a href="qpixmap.html">QPixmap</a> <i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> with its origin at the given
<i>point</i>.</p>
<h3 class="fn"><a name="drawPixmap-6" />QPainter.drawPixmap (<i>self</i>, int <i>x</i>, int <i>y</i>, <a href="qpixmap.html">QPixmap</a> <i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> with its origin at the given
<i>point</i>.</p>
<h3 class="fn"><a name="drawPixmap-7" />QPainter.drawPixmap (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, <a href="qpixmap.html">QPixmap</a> <i>pm</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> at position (<i>x</i>,
<i>y</i>).</p>
<h3 class="fn"><a name="drawPixmap-8" />QPainter.drawPixmap (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, <a href="qpixmap.html">QPixmap</a> <i>pm</i>, int <i>sx</i>, int <i>sy</i>, int <i>sw</i>, int <i>sh</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>pixmap</i> into the given
<i>rectangle</i>.</p>
<p><b>Note:</b> The pixmap is scaled to fit the rectangle, if both
the pixmap and rectangle size disagree.</p>
<h3 class="fn"><a name="drawPixmap-9" />QPainter.drawPixmap (<i>self</i>, int <i>x</i>, int <i>y</i>, <a href="qpixmap.html">QPixmap</a> <i>pm</i>, int <i>sx</i>, int <i>sy</i>, int <i>sw</i>, int <i>sh</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the <i>pixmap</i> into the rectangle at position
(<i>x</i>, <i>y</i>) with the given <i>width</i> and
<i>height</i>.</p>
<h3 class="fn"><a name="drawPixmap-10" />QPainter.drawPixmap (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>p</i>, <a href="qpixmap.html">QPixmap</a> <i>pm</i>, <a href="qrectf.html">QRectF</a> <i>sr</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the rectangular portion with the origin (<i>sx</i>,
<i>sy</i>), width <i>sw</i> and height <i>sh</i>, of the given
<i>pixmap</i> , at the point (<i>x</i>, <i>y</i>), with a width of
<i>w</i> and a height of <i>h</i>. If sw or sh are equal to zero
the width/height of the pixmap is used and adjusted by the offset
sx/sy;</p>
<h3 class="fn"><a name="drawPixmap-11" />QPainter.drawPixmap (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>, <a href="qpixmap.html">QPixmap</a> <i>pm</i>, <a href="qrect.html">QRect</a> <i>sr</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a pixmap at (<i>x</i>, <i>y</i>) by copying a part of the
given <i>pixmap</i> into the paint device.</p>
<p>(<i>x</i>, <i>y</i>) specifies the top-left point in the paint
device that is to be drawn onto. (<i>sx</i>, <i>sy</i>) specifies
the top-left point in <i>pixmap</i> that is to be drawn. The
default is (0, 0).</p>
<p>(<i>sw</i>, <i>sh</i>) specifies the size of the pixmap that is
to be drawn. The default, (0, 0) (and negative) means all the way
to the bottom-right of the pixmap.</p>
<h3 class="fn"><a name="drawPixmapFragments" />QPainter.drawPixmapFragments (<i>self</i>, list <i>fragments</i>, <a href="qpixmap.html">QPixmap</a> <i>pixmap</i>, <a href="qpainter-pixmapfragmenthints.html">PixmapFragmentHints</a> <i>hints</i> = 0)</h3><p>This function is used to draw <i>pixmap</i>, or a sub-rectangle
of <i>pixmap</i>, at multiple positions with different scale,
rotation and opacity. <i>fragments</i> is an array of
<i>fragmentCount</i> elements specifying the parameters used to
draw each pixmap fragment. The <i>hints</i> parameter can be used
to pass in drawing hints.</p>
<p>This function is potentially faster than multiple calls to
<a href="qpainter.html#drawPixmap">drawPixmap</a>(), since the
backend can optimize state changes.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qpainter-pixmapfragment.html">QPainter.PixmapFragment</a> and
<a href="qpainter.html#PixmapFragmentHint-enum">QPainter.PixmapFragmentHint</a>.</p>
<h3 class="fn"><a name="drawPixmapFragments-2" />QPainter.drawPixmapFragments (<i>self</i>, list <i>targetRects</i>, list <i>sourceRects</i>, <a href="qpixmap.html">QPixmap</a> <i>pixmap</i>, <a href="qpainter-pixmapfragmenthints.html">PixmapFragmentHints</a> <i>hints</i> = 0)</h3><p>The <i>sourceRects</i> argument may also be None.</p><p>This function is used to draw the same <i>pixmap</i> with
multiple target and source rectangles specified by
<i>targetRects</i>. If <i>sourceRects</i> is 0, the whole pixmap
will be rendered at each of the target rectangles. The <i>hints</i>
parameter can be used to pass in drawing hints.</p>
<p>This function is potentially faster than multiple calls to
<a href="qpainter.html#drawPixmap">drawPixmap</a>(), since the
backend can optimize state changes.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also</b> <a href="qpainter.html#PixmapFragmentHint-enum">QPainter.PixmapFragmentHint</a>.</p>
<h3 class="fn"><a name="drawPoint" />QPainter.drawPoint (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>p</i>)</h3><p>Draws a single point at the given <i>position</i> using the
current pen's color.</p>
<p><b>See also</b> <a href="coordsys.html">Coordinate
System</a>.</p>
<h3 class="fn"><a name="drawPoint-2" />QPainter.drawPoint (<i>self</i>, int <i>x</i>, int <i>y</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a single point at the given <i>position</i> using the
current pen's color.</p>
<h3 class="fn"><a name="drawPoint-3" />QPainter.drawPoint (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a single point at position (<i>x</i>, <i>y</i>).</p>
<h3 class="fn"><a name="drawPoints" />QPainter.drawPoints (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>point</i>, ...)</h3><p>Draws the first <i>pointCount</i> points in the array
<i>points</i> using the current pen's color.</p>
<p><b>See also</b> <a href="coordsys.html">Coordinate
System</a>.</p>
<h3 class="fn"><a name="drawPoints-2" />QPainter.drawPoints (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a> <i>points</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>pointCount</i> points in the array
<i>points</i> using the current pen's color.</p>
<h3 class="fn"><a name="drawPoints-3" />QPainter.drawPoints (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>point</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the points in the vector <i>points</i>.</p>
<h3 class="fn"><a name="drawPoints-4" />QPainter.drawPoints (<i>self</i>, <a href="qpolygon.html">QPolygon</a> <i>points</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the points in the vector <i>points</i>.</p>
<h3 class="fn"><a name="drawPolygon" />QPainter.drawPolygon (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>point</i>, ...)</h3><p>Draws the polygon defined by the first <i>pointCount</i> points
in the array <i>points</i> using the current pen and brush.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-polygon.png" /></td>
<td>
<pre class="cpp">
<span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="qpointf.html">QPointF</a></span> points<span class="operator">[</span><span class="number">4</span><span class="operator">]</span> <span class="operator">=</span> {
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span>)<span class="operator">,</span>
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">20.0</span><span class="operator">,</span> <span class="number">10.0</span>)<span class="operator">,</span>
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">80.0</span><span class="operator">,</span> <span class="number">30.0</span>)<span class="operator">,</span>
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">90.0</span><span class="operator">,</span> <span class="number">70.0</span>)
};
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawPolygon(points<span class="operator">,</span> <span class="number">4</span>);
</pre></td>
</tr>
</table>
<p>The first point is implicitly connected to the last point, and
the polygon is filled with the current <a href="qpainter.html#brush">brush</a>().</p>
<p>If <i>fillRule</i> is <a href="qt.html#FillRule-enum">Qt.WindingFill</a>, the polygon is filled
using the winding fill algorithm. If <i>fillRule</i> is <a href="qt.html#FillRule-enum">Qt.OddEvenFill</a>, the polygon is filled
using the odd-even fill algorithm. See <a href="qt.html#FillRule-enum">Qt.FillRule</a> for a more detailed
description of these fill rules.</p>
<p><b>See also</b> <a href="qpainter.html#drawConvexPolygon">drawConvexPolygon</a>(), <a href="qpainter.html#drawPolyline">drawPolyline</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="drawPolygon-2" />QPainter.drawPolygon (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a> <i>points</i>, <a href="qt.html#FillRule-enum">Qt.FillRule</a> <i>fillRule</i> = Qt.OddEvenFill)</h3><p>This is an overloaded function.</p>
<p>Draws the polygon defined by the first <i>pointCount</i> points
in the array <i>points</i>.</p>
<h3 class="fn"><a name="drawPolygon-3" />QPainter.drawPolygon (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>point</i>, ...)</h3><h3 class="fn"><a name="drawPolygon-4" />QPainter.drawPolygon (<i>self</i>, <a href="qpolygon.html">QPolygon</a> <i>points</i>, <a href="qt.html#FillRule-enum">Qt.FillRule</a> <i>fillRule</i> = Qt.OddEvenFill)</h3><h3 class="fn"><a name="drawPolyline" />QPainter.drawPolyline (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>point</i>, ...)</h3><p>Draws the polyline defined by the first <i>pointCount</i> points
in <i>points</i> using the current pen.</p>
<p>Note that unlike the <a href="qpainter.html#drawPolygon">drawPolygon</a>() function the last
point is <i>not</i> connected to the first, neither is the polyline
filled.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td>
<pre class="cpp">
<span class="keyword">static</span> <span class="keyword">const</span> <span class="type"><a href="qpointf.html">QPointF</a></span> points<span class="operator">[</span><span class="number">3</span><span class="operator">]</span> <span class="operator">=</span> {
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">10.0</span><span class="operator">,</span> <span class="number">80.0</span>)<span class="operator">,</span>
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">20.0</span><span class="operator">,</span> <span class="number">10.0</span>)<span class="operator">,</span>
<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">80.0</span><span class="operator">,</span> <span class="number">30.0</span>)<span class="operator">,</span>
};
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawPolyline(points<span class="operator">,</span> <span class="number">3</span>);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawLines">drawLines</a>(), <a href="qpainter.html#drawPolygon">drawPolygon</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="drawPolyline-2" />QPainter.drawPolyline (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a> <i>polyline</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the polyline defined by the first <i>pointCount</i> points
in <i>points</i> using the current pen.</p>
<h3 class="fn"><a name="drawPolyline-3" />QPainter.drawPolyline (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>point</i>, ...)</h3><h3 class="fn"><a name="drawPolyline-4" />QPainter.drawPolyline (<i>self</i>, <a href="qpolygon.html">QPolygon</a> <i>polyline</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the polyline defined by the given <i>points</i> using the
current pen.</p>
<h3 class="fn"><a name="drawRect" />QPainter.drawRect (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rect</i>)</h3><p>Draws the current <i>rectangle</i> with the current pen and
brush.</p>
<p>A filled rectangle has a size of <i>rectangle</i>.size(). A
stroked rectangle has a size of <i>rectangle</i>.size() plus the
pen width.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-rectangle.png" /></td>
<td>
<pre class="cpp">
<span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawRect(rectangle);
</pre></td>
</tr>
</table>
<p><b>See also</b> <a href="qpainter.html#drawRects">drawRects</a>(), <a href="qpainter.html#drawPolygon">drawPolygon</a>(), and <a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="drawRect-2" />QPainter.drawRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the current <i>rectangle</i> with the current pen and
brush.</p>
<h3 class="fn"><a name="drawRect-3" />QPainter.drawRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</h3><p>This is an overloaded function.</p>
<p>Draws a rectangle with upper left corner at (<i>x</i>, <i>y</i>)
and with the given <i>width</i> and <i>height</i>.</p>
<h3 class="fn"><a name="drawRects" />QPainter.drawRects (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rect</i>, ...)</h3><p>Draws the first <i>rectCount</i> of the given <i>rectangles</i>
using the current pen and brush.</p>
<p><b>See also</b> <a href="qpainter.html#drawRect">drawRect</a>().</p>
<h3 class="fn"><a name="drawRects-2" />QPainter.drawRects (<i>self</i>, unknown-type <i>rects</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the first <i>rectCount</i> of the given <i>rectangles</i>
using the current pen and brush.</p>
<h3 class="fn"><a name="drawRects-3" />QPainter.drawRects (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>, ...)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>rectangles</i> using the current pen and
brush.</p>
<h3 class="fn"><a name="drawRects-4" />QPainter.drawRects (<i>self</i>, unknown-type <i>rects</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the given <i>rectangles</i> using the current pen and
brush.</p>
<h3 class="fn"><a name="drawRoundedRect" />QPainter.drawRoundedRect (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rect</i>, float <i>xRadius</i>, float <i>yRadius</i>, <a href="qt.html#SizeMode-enum">Qt.SizeMode</a> <i>mode</i> = Qt.AbsoluteSize)</h3><p>Draws the given rectangle <i>rect</i> with rounded corners.</p>
<p>The <i>xRadius</i> and <i>yRadius</i> arguments specify the
radii of the ellipses defining the corners of the rounded
rectangle. When <i>mode</i> is <a href="qt.html#SizeMode-enum">Qt.RelativeSize</a>, <i>xRadius</i> and
<i>yRadius</i> are specified in percentage of half the rectangle's
width and height respectively, and should be in the range 0.0 to
100.0.</p>
<p>A filled rectangle has a size of rect.size(). A stroked
rectangle has a size of rect.size() plus the pen width.</p>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qpainter-roundrect.png" /></td>
<td>
<pre class="cpp">
<span class="type"><a href="qrectf.html">QRectF</a></span> rectangle(<span class="number">10.0</span><span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">80.0</span><span class="operator">,</span> <span class="number">60.0</span>);
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>drawRoundedRect(rectangle<span class="operator">,</span> <span class="number">20.0</span><span class="operator">,</span> <span class="number">15.0</span>);
</pre></td>
</tr>
</table>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qpainter.html#drawRect">drawRect</a>()
and <a href="qpen.html">QPen</a>.</p>
<h3 class="fn"><a name="drawRoundedRect-2" />QPainter.drawRoundedRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, float <i>xRadius</i>, float <i>yRadius</i>, <a href="qt.html#SizeMode-enum">Qt.SizeMode</a> <i>mode</i> = Qt.AbsoluteSize)</h3><p>This is an overloaded function.</p>
<p>Draws the given rectangle <i>rect</i> with rounded corners.</p>
<p>This function was introduced in Qt 4.4.</p>
<h3 class="fn"><a name="drawRoundedRect-3" />QPainter.drawRoundedRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>, float <i>xRadius</i>, float <i>yRadius</i>, <a href="qt.html#SizeMode-enum">Qt.SizeMode</a> <i>mode</i> = Qt.AbsoluteSize)</h3><p>This is an overloaded function.</p>
<p>Draws the given rectangle <i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>
with rounded corners.</p>
<p>This function was introduced in Qt 4.4.</p>
<h3 class="fn"><a name="drawRoundRect" />QPainter.drawRoundRect (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>r</i>, int <i>xRound</i> = 25, int <i>yRound</i> = 25)</h3><h3 class="fn"><a name="drawRoundRect-2" />QPainter.drawRoundRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, int <i>xRound</i> = 25, int <i>yRound</i> = 25)</h3><h3 class="fn"><a name="drawRoundRect-3" />QPainter.drawRoundRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>, int <i>xRound</i> = 25, int <i>yRound</i> = 25)</h3><h3 class="fn"><a name="drawStaticText" />QPainter.drawStaticText (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>topLeftPosition</i>, <a href="qstatictext.html">QStaticText</a> <i>staticText</i>)</h3><p>Draws the given <i>staticText</i> at the given
<i>topLeftPosition</i>.</p>
<p>The text will be drawn using the font and the transformation set
on the painter. If the font and/or transformation set on the
painter are different from the ones used to initialize the layout
of the <a href="qstatictext.html">QStaticText</a>, then the layout
will have to be recalculated. Use <a href="qstatictext.html#prepare">QStaticText.prepare</a>() to initialize
<i>staticText</i> with the font and transformation with which it
will later be drawn.</p>
<p>If <i>topLeftPosition</i> is not the same as when
<i>staticText</i> was initialized, or when it was last drawn, then
there will be a slight overhead when translating the text to its
new position.</p>
<p><b>Note:</b> If the painter's transformation is not affine, then
<i>staticText</i> will be drawn using regular calls to <a href="qpainter.html#drawText">drawText</a>(), losing any potential for
performance improvement.</p>
<p><b>Note:</b> The y-position is used as the top of the font.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qstatictext.html">QStaticText</a>.</p>
<h3 class="fn"><a name="drawStaticText-2" />QPainter.drawStaticText (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>, <a href="qstatictext.html">QStaticText</a> <i>staticText</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the <i>staticText</i> at the <i>topLeftPosition</i>.</p>
<p><b>Note:</b> The y-position is used as the top of the font.</p>
<p>This function was introduced in Qt 4.7.</p>
<h3 class="fn"><a name="drawStaticText-3" />QPainter.drawStaticText (<i>self</i>, int <i>x</i>, int <i>y</i>, <a href="qstatictext.html">QStaticText</a> <i>staticText</i>)</h3><p>This is an overloaded function.</p>
<p>Draws the <i>staticText</i> at coordinates <i>left</i> and
<i>top</i>.</p>
<p><b>Note:</b> The y-position is used as the top of the font.</p>
<p>This function was introduced in Qt 4.7.</p>
<h3 class="fn"><a name="drawText" />QPainter.drawText (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>p</i>, QString <i>s</i>)</h3><p>Draws the given <i>text</i> with the currently defined text
direction, beginning at the given <i>position</i>.</p>
<p>This function does not handle the newline character (\n), as it
cannot break text into multiple lines, and it cannot display the
newline character. Use the QPainter.drawText() overload that takes
a rectangle instead if you want to draw multiple lines of text with
the newline character, or if you want the text to be wrapped.</p>
<p>By default, <a href="qpainter.html">QPainter</a> draws text
anti-aliased.</p>
<p><b>Note:</b> The y-position is used as the baseline of the
font.</p>
<h3 class="fn"><a name="drawText-2" /><a href="qrectf.html">QRectF</a> <i>boundingRect</i> QPainter.drawText (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rectangle</i>, int <i>flags</i>, QString <i>text</i>)</h3><h3 class="fn"><a name="drawText-3" /><a href="qrect.html">QRect</a> <i>boundingRect</i> QPainter.drawText (<i>self</i>, <a href="qrect.html">QRect</a> <i>rectangle</i>, int <i>flags</i>, QString <i>text</i>)</h3><h3 class="fn"><a name="drawText-4" />QPainter.drawText (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rectangle</i>, QString <i>text</i>, <a href="qtextoption.html">QTextOption</a> <i>option</i> = QTextOption())</h3><h3 class="fn"><a name="drawText-5" />QPainter.drawText (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>, QString <i>s</i>)</h3><h3 class="fn"><a name="drawText-6" /><a href="qrect.html">QRect</a> <i>boundingRect</i> QPainter.drawText (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, int <i>flags</i>, QString <i>text</i>)</h3><h3 class="fn"><a name="drawText-7" />QPainter.drawText (<i>self</i>, int <i>x</i>, int <i>y</i>, QString <i>s</i>)</h3><h3 class="fn"><a name="drawTiledPixmap" />QPainter.drawTiledPixmap (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rectangle</i>, <a href="qpixmap.html">QPixmap</a> <i>pixmap</i>, <a href="qpointf.html">QPointF</a> <i>pos</i> = QPointF())</h3><p>Draws a tiled <i>pixmap</i>, inside the given <i>rectangle</i>
with its origin at the given <i>position</i>.</p>
<p>Calling drawTiledPixmap() is similar to calling <a href="qpainter.html#drawPixmap">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>
<p><b>See also</b> <a href="qpainter.html#drawPixmap">drawPixmap</a>().</p>
<h3 class="fn"><a name="drawTiledPixmap-2" />QPainter.drawTiledPixmap (<i>self</i>, <a href="qrect.html">QRect</a> <i>rectangle</i>, <a href="qpixmap.html">QPixmap</a> <i>pixmap</i>, <a href="qpoint.html">QPoint</a> <i>pos</i> = QPoint())</h3><p>This is an overloaded function.</p>
<p>Draws a tiled <i>pixmap</i>, inside the given <i>rectangle</i>
with its origin at the given <i>position</i>.</p>
<h3 class="fn"><a name="drawTiledPixmap-3" />QPainter.drawTiledPixmap (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, <a href="qpixmap.html">QPixmap</a> <i>pixmap</i>, int <i>sx</i> = 0, int <i>sy</i> = 0)</h3><p>This is an overloaded function.</p>
<p>Draws a tiled <i>pixmap</i> in the specified rectangle.</p>
<p>(<i>x</i>, <i>y</i>) specifies the top-left point in the paint
device that is to be drawn onto; with the given <i>width</i> and
<i>height</i>. (<i>sx</i>, <i>sy</i>) specifies the top-left point
in the <i>pixmap</i> that is to be drawn; this defaults to (0,
0).</p>
<h3 class="fn"><a name="end" />bool QPainter.end (<i>self</i>)</h3><p>Ends painting. Any resources used while painting are released.
You don't normally need to call this since it is called by the
destructor.</p>
<p>Returns true if the painter is no longer active; otherwise
returns false.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpainter.html#isActive">isActive</a>().</p>
<h3 class="fn"><a name="endNativePainting" />QPainter.endNativePainting (<i>self</i>)</h3><p>Restores the painter after manually issuing native painting
commands. Lets the painter restore any native state that it relies
on before calling any other painter commands.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qpainter.html#beginNativePainting">beginNativePainting</a>().</p>
<h3 class="fn"><a name="eraseRect" />QPainter.eraseRect (<i>self</i>, <a href="qrectf.html">QRectF</a>)</h3><p>Erases the area inside the given <i>rectangle</i>. Equivalent to
calling</p>
<pre class="cpp">
<a href="qpainter.html#fillRect">fillRect</a>(rectangle<span class="operator">,</span> background())<span class="operator">.</span>
</pre>
<p><b>See also</b> <a href="qpainter.html#fillRect">fillRect</a>().</p>
<h3 class="fn"><a name="eraseRect-2" />QPainter.eraseRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>rect</i>)</h3><p>This is an overloaded function.</p>
<p>Erases the area inside the given <i>rectangle</i>.</p>
<h3 class="fn"><a name="eraseRect-3" />QPainter.eraseRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Erases the area inside the rectangle beginning at (<i>x</i>,
<i>y</i>) with the given <i>width</i> and <i>height</i>.</p>
<h3 class="fn"><a name="fillPath" />QPainter.fillPath (<i>self</i>, <a href="qpainterpath.html">QPainterPath</a> <i>path</i>, <a href="qbrush.html">QBrush</a> <i>brush</i>)</h3><p>Fills the given <i>path</i> using the given <i>brush</i>. The
outline is not drawn.</p>
<p>Alternatively, you can specify a <a href="qcolor.html">QColor</a> instead of a <a href="qbrush.html">QBrush</a>; the <a href="qbrush.html">QBrush</a>
constructor (taking a <a href="qcolor.html">QColor</a> argument)
will automatically create a solid pattern brush.</p>
<p><b>See also</b> <a href="qpainter.html#drawPath">drawPath</a>().</p>
<h3 class="fn"><a name="fillRect" />QPainter.fillRect (<i>self</i>, <a href="qrectf.html">QRectF</a>, <a href="qbrush.html">QBrush</a>)</h3><p>Fills the given <i>rectangle</i> with the <i>brush</i>
specified.</p>
<p>Alternatively, you can specify a <a href="qcolor.html">QColor</a> instead of a <a href="qbrush.html">QBrush</a>; the <a href="qbrush.html">QBrush</a>
constructor (taking a <a href="qcolor.html">QColor</a> argument)
will automatically create a solid pattern brush.</p>
<p><b>See also</b> <a href="qpainter.html#drawRect">drawRect</a>().</p>
<h3 class="fn"><a name="fillRect-2" />QPainter.fillRect (<i>self</i>, <a href="qrect.html">QRect</a>, <a href="qbrush.html">QBrush</a>)</h3><p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the
given <i>width</i> and <i>height</i>, using the brush <i>style</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="fillRect-3" />QPainter.fillRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, <a href="qbrush.html">QBrush</a> <i>b</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the brush <i>style</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="fillRect-4" />QPainter.fillRect (<i>self</i>, <a href="qrectf.html">QRectF</a>, <a href="qcolor.html">QColor</a> <i>color</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the brush <i>style</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="fillRect-5" />QPainter.fillRect (<i>self</i>, <a href="qrect.html">QRect</a>, <a href="qcolor.html">QColor</a> <i>color</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified
<i>brush</i>.</p>
<h3 class="fn"><a name="fillRect-6" />QPainter.fillRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, <a href="qcolor.html">QColor</a> <i>b</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the <i>color</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="fillRect-7" />QPainter.fillRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a> <i>c</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the <i>color</i>
specified.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="fillRect-8" />QPainter.fillRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>, <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a> <i>c</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the
given <i>width</i> and <i>height</i>, using the given
<i>brush</i>.</p>
<h3 class="fn"><a name="fillRect-9" />QPainter.fillRect (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>r</i>, <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a> <i>c</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the
given <i>width</i> and <i>height</i>, using the given
<i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="fillRect-10" />QPainter.fillRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, <a href="qt.html#BrushStyle-enum">Qt.BrushStyle</a> <i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the rectangle beginning at (<i>x</i>, <i>y</i>) with the
given <i>width</i> and <i>height</i>, using the given
<i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="fillRect-11" />QPainter.fillRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>, <a href="qt.html#BrushStyle-enum">Qt.BrushStyle</a> <i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified
<i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="fillRect-12" />QPainter.fillRect (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>r</i>, <a href="qt.html#BrushStyle-enum">Qt.BrushStyle</a> <i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Fills the given <i>rectangle</i> with the specified
<i>color</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<h3 class="fn"><a name="font" /><a href="qfont.html">QFont</a> QPainter.font (<i>self</i>)</h3><p>Returns the currently set font used for drawing text.</p>
<p><b>See also</b> <a href="qpainter.html#setFont">setFont</a>(),
<a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="fontInfo" /><a href="qfontinfo.html">QFontInfo</a> QPainter.fontInfo (<i>self</i>)</h3><p>Returns the font info for the painter if the painter is active.
Otherwise, the return value is undefined.</p>
<p><b>See also</b> <a href="qpainter.html#font">font</a>(),
<a href="qpainter.html#isActive">isActive</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="fontMetrics" /><a href="qfontmetrics.html">QFontMetrics</a> QPainter.fontMetrics (<i>self</i>)</h3><p>Returns the font metrics for the painter if the painter is
active. Otherwise, the return value is undefined.</p>
<p><b>See also</b> <a href="qpainter.html#font">font</a>(),
<a href="qpainter.html#isActive">isActive</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="hasClipping" />bool QPainter.hasClipping (<i>self</i>)</h3><p>Returns true if clipping has been set; otherwise returns
false.</p>
<p><b>See also</b> <a href="qpainter.html#setClipping">setClipping</a>() and <a href="qpainter.html#clipping">Clipping</a>.</p>
<h3 class="fn"><a name="initFrom" />QPainter.initFrom (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>widget</i>)</h3><p>Initializes the painters pen, background and font to the same as
the given <i>widget</i>. This function is called automatically when
the painter is opened on a <a href="qwidget.html">QWidget</a>.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="isActive" />bool QPainter.isActive (<i>self</i>)</h3><p>Returns true if <a href="qpainter.html#begin">begin</a>() has
been called and <a href="qpainter.html#end">end</a>() has not yet
been called; otherwise returns false.</p>
<p><b>See also</b> <a href="qpainter.html#begin">begin</a>() and
<a href="qpaintdevice.html#paintingActive">QPaintDevice.paintingActive</a>().</p>
<h3 class="fn"><a name="layoutDirection" /><a href="qt.html#LayoutDirection-enum">Qt.LayoutDirection</a> QPainter.layoutDirection (<i>self</i>)</h3><p>Returns the layout direction used by the painter when drawing
text.</p>
<p><b>See also</b> <a href="qtextoption.html#textDirection">QTextOption.textDirection</a>(),
<a href="qpainter.html#setLayoutDirection">setLayoutDirection</a>(),
<a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="matrix" /><a href="qmatrix.html">QMatrix</a> QPainter.matrix (<i>self</i>)</h3><h3 class="fn"><a name="matrixEnabled" />bool QPainter.matrixEnabled (<i>self</i>)</h3><h3 class="fn"><a name="opacity" />float QPainter.opacity (<i>self</i>)</h3><p>Returns the opacity of the painter. The default value is 1.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#setOpacity">setOpacity</a>().</p>
<h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QPainter.paintEngine (<i>self</i>)</h3><p>Returns the paint engine that the painter is currently operating
on if the painter is active; otherwise 0.</p>
<p><b>See also</b> <a href="qpainter.html#isActive">isActive</a>().</p>
<h3 class="fn"><a name="pen" /><a href="qpen.html">QPen</a> QPainter.pen (<i>self</i>)</h3><p>Returns the painter's current pen.</p>
<p><b>See also</b> <a href="qpainter.html#setPen">setPen</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="redirected" /><a href="qpaintdevice.html">QPaintDevice</a> QPainter.redirected (<a href="qpaintdevice.html">QPaintDevice</a> <i>device</i>, <a href="qpoint.html">QPoint</a> <i>offset</i> = None)</h3><h3 class="fn"><a name="renderHints" /><a href="qpainter-renderhints.html">RenderHints</a> QPainter.renderHints (<i>self</i>)</h3><p>Returns a flag that specifies the rendering hints that are set
for this painter.</p>
<p><b>See also</b> <a href="qpainter.html#setRenderHints">setRenderHints</a>(), <a href="qpainter.html#testRenderHint">testRenderHint</a>(), and <a href="qpainter.html#rendering-quality">Rendering Quality</a>.</p>
<h3 class="fn"><a name="resetMatrix" />QPainter.resetMatrix (<i>self</i>)</h3><h3 class="fn"><a name="resetTransform" />QPainter.resetTransform (<i>self</i>)</h3><p>Resets any transformations that were made using <a href="qpainter.html#translate">translate</a>(), <a href="qpainter.html#scale">scale</a>(), <a href="qpainter.html#shear">shear</a>(), <a href="qpainter.html#rotate">rotate</a>(), <a href="qpainter.html#setWorldTransform">setWorldTransform</a>(), <a href="qpainter.html#setViewport">setViewport</a>() and <a href="qpainter.html#setWindow">setWindow</a>().</p>
<p><b>See also</b> <a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>
<h3 class="fn"><a name="restore" />QPainter.restore (<i>self</i>)</h3><p>Restores the current painter state (pops a saved state off the
stack).</p>
<p><b>See also</b> <a href="qpainter.html#save">save</a>().</p>
<h3 class="fn"><a name="restoreRedirected" />QPainter.restoreRedirected (<a href="qpaintdevice.html">QPaintDevice</a> <i>device</i>)</h3><h3 class="fn"><a name="rotate" />QPainter.rotate (<i>self</i>, float <i>a</i>)</h3><p>Rotates the coordinate system the given <i>angle</i>
clockwise.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>
<h3 class="fn"><a name="save" />QPainter.save (<i>self</i>)</h3><p>Saves the current painter state (pushes the state onto a stack).
A save() must be followed by a corresponding <a href="qpainter.html#restore">restore</a>(); the <a href="qpainter.html#end">end</a>() function unwinds the stack.</p>
<p><b>See also</b> <a href="qpainter.html#restore">restore</a>().</p>
<h3 class="fn"><a name="scale" />QPainter.scale (<i>self</i>, float <i>sx</i>, float <i>sy</i>)</h3><p>Scales the coordinate system by (<i>sx</i>, <i>sy</i>).</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>
<h3 class="fn"><a name="setBackground" />QPainter.setBackground (<i>self</i>, <a href="qbrush.html">QBrush</a> <i>bg</i>)</h3><p>Sets the background brush of the painter to the given
<i>brush</i>.</p>
<p>The background brush is the brush that is filled in when drawing
opaque text, stippled lines and bitmaps. The background brush has
no effect in transparent background mode (which is the
default).</p>
<p><b>See also</b> <a href="qpainter.html#background">background</a>(), <a href="qpainter.html#setBackgroundMode">setBackgroundMode</a>(), and
<a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="setBackgroundMode" />QPainter.setBackgroundMode (<i>self</i>, <a href="qt.html#BGMode-enum">Qt.BGMode</a> <i>mode</i>)</h3><p>Sets the background mode of the painter to the given
<i>mode</i></p>
<p><a href="qt.html#BGMode-enum">Qt.TransparentMode</a> (the
default) draws stippled lines and text without setting the
background pixels. <a href="qt.html#BGMode-enum">Qt.OpaqueMode</a>
fills these space with the current background color.</p>
<p>Note that in order to draw a bitmap or pixmap transparently, you
must use <a href="qpixmap.html#setMask">QPixmap.setMask</a>().</p>
<p><b>See also</b> <a href="qpainter.html#backgroundMode">backgroundMode</a>(), <a href="qpainter.html#setBackground">setBackground</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="setBrush" />QPainter.setBrush (<i>self</i>, <a href="qbrush.html">QBrush</a> <i>brush</i>)</h3><p>Sets the painter's brush to the given <i>brush</i>.</p>
<p>The painter's brush defines how shapes are filled.</p>
<p><b>See also</b> <a href="qpainter.html#brush">brush</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="setBrush-2" />QPainter.setBrush (<i>self</i>, <a href="qt.html#BrushStyle-enum">Qt.BrushStyle</a> <i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's brush to black color and the specified
<i>style</i>.</p>
<h3 class="fn"><a name="setBrushOrigin" />QPainter.setBrushOrigin (<i>self</i>, <a href="qpointf.html">QPointF</a>)</h3><p>Sets the brush origin to <i>position</i>.</p>
<p>The brush origin specifies the (0, 0) coordinate of the
painter's brush.</p>
<p>Note that while the <a href="qpainter.html#brushOrigin">brushOrigin</a>() was necessary to
adopt the parent's background for a widget in Qt 3, this is no
longer the case since the Qt 4 painter doesn't paint the background
unless you explicitly tell it to do so by setting the widget's
<a href="qwidget.html#autoFillBackground-prop">autoFillBackground</a>
property to true.</p>
<p><b>See also</b> <a href="qpainter.html#brushOrigin">brushOrigin</a>() and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="setBrushOrigin-2" />QPainter.setBrushOrigin (<i>self</i>, int <i>x</i>, int <i>y</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the brush's origin to the given <i>position</i>.</p>
<h3 class="fn"><a name="setBrushOrigin-3" />QPainter.setBrushOrigin (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the brush's origin to point (<i>x</i>, <i>y</i>).</p>
<h3 class="fn"><a name="setClipPath" />QPainter.setClipPath (<i>self</i>, <a href="qpainterpath.html">QPainterPath</a> <i>path</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a> <i>operation</i> = Qt.ReplaceClip)</h3><p>Enables clipping, and sets the clip path for the painter to the
given <i>path</i>, with the clip <i>operation</i>.</p>
<p>Note that the clip path is specified in logical (painter)
coordinates.</p>
<p><b>See also</b> <a href="qpainter.html#clipPath">clipPath</a>(),
<a href="qpainter.html#clipRegion">clipRegion</a>(), and <a href="qpainter.html#clipping">Clipping</a>.</p>
<h3 class="fn"><a name="setClipping" />QPainter.setClipping (<i>self</i>, bool <i>enable</i>)</h3><p>Enables clipping if <i>enable</i> is true, or disables clipping
if <i>enable</i> is false.</p>
<p><b>See also</b> <a href="qpainter.html#hasClipping">hasClipping</a>() and <a href="qpainter.html#clipping">Clipping</a>.</p>
<h3 class="fn"><a name="setClipRect" />QPainter.setClipRect (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rectangle</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a> <i>operation</i> = Qt.ReplaceClip)</h3><p>Enables clipping, and sets the clip region to the given
<i>rectangle</i> using the given clip <i>operation</i>. The default
operation is to replace the current clip rectangle.</p>
<p>Note that the clip rectangle is specified in logical (painter)
coordinates.</p>
<p><b>See also</b> <a href="qpainter.html#clipRegion">clipRegion</a>(), <a href="qpainter.html#setClipping">setClipping</a>(), and <a href="qpainter.html#clipping">Clipping</a>.</p>
<h3 class="fn"><a name="setClipRect-2" />QPainter.setClipRect (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>width</i>, int <i>height</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a> <i>operation</i> = Qt.ReplaceClip)</h3><p>Enables clipping, and sets the clip region to the rectangle
beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and
<i>height</i>.</p>
<h3 class="fn"><a name="setClipRect-3" />QPainter.setClipRect (<i>self</i>, <a href="qrect.html">QRect</a> <i>rectangle</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a> <i>operation</i> = Qt.ReplaceClip)</h3><p>This is an overloaded function.</p>
<p>Enables clipping, and sets the clip region to the given
<i>rectangle</i> using the given clip <i>operation</i>.</p>
<h3 class="fn"><a name="setClipRegion" />QPainter.setClipRegion (<i>self</i>, <a href="qregion.html">QRegion</a> <i>region</i>, <a href="qt.html#ClipOperation-enum">Qt.ClipOperation</a> <i>operation</i> = Qt.ReplaceClip)</h3><p>Sets the clip region to the given <i>region</i> using the
specified clip <i>operation</i>. The default clip operation is to
replace the current clip region.</p>
<p>Note that the clip region is given in logical coordinates.</p>
<p><b>See also</b> <a href="qpainter.html#clipRegion">clipRegion</a>(), <a href="qpainter.html#setClipRect">setClipRect</a>(), and <a href="qpainter.html#clipping">Clipping</a>.</p>
<h3 class="fn"><a name="setCompositionMode" />QPainter.setCompositionMode (<i>self</i>, <a href="qpainter.html#CompositionMode-enum">CompositionMode</a> <i>mode</i>)</h3><p>Sets the composition mode to the given <i>mode</i>.</p>
<p><b>Warning:</b> Only a <a href="qpainter.html">QPainter</a>
operating on a <a href="qimage.html">QImage</a> fully supports all
composition modes. The RasterOp modes are supported for X11 as
described in <a href="qpainter.html#compositionMode">compositionMode</a>().</p>
<p><b>See also</b> <a href="qpainter.html#compositionMode">compositionMode</a>().</p>
<h3 class="fn"><a name="setFont" />QPainter.setFont (<i>self</i>, <a href="qfont.html">QFont</a> <i>f</i>)</h3><p>Sets the painter's font to the given <i>font</i>.</p>
<p>This font is used by subsequent <a href="qpainter.html#drawText">drawText</a>() functions. The text color
is the same as the pen color.</p>
<p>If you set a font that isn't available, Qt finds a close match.
<a href="qpainter.html#font">font</a>() will return what you set
using setFont() and <a href="qpainter.html#fontInfo">fontInfo</a>()
returns the font actually being used (which may be the same).</p>
<p><b>See also</b> <a href="qpainter.html#font">font</a>(),
<a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="setLayoutDirection" />QPainter.setLayoutDirection (<i>self</i>, <a href="qt.html#LayoutDirection-enum">Qt.LayoutDirection</a> <i>direction</i>)</h3><p>Sets the layout direction used by the painter when drawing text,
to the specified <i>direction</i>.</p>
<p>The default is <a href="qt.html#LayoutDirection-enum">Qt.LayoutDirectionAuto</a>, which
will implicitly determine the direction from the text drawn.</p>
<p><b>See also</b> <a href="qtextoption.html#setTextDirection">QTextOption.setTextDirection</a>(),
<a href="qpainter.html#layoutDirection">layoutDirection</a>(),
<a href="qpainter.html#drawText">drawText</a>(), and <a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="setMatrix" />QPainter.setMatrix (<i>self</i>, <a href="qmatrix.html">QMatrix</a> <i>matrix</i>, bool <i>combine</i> = False)</h3><h3 class="fn"><a name="setMatrixEnabled" />QPainter.setMatrixEnabled (<i>self</i>, bool <i>enabled</i>)</h3><h3 class="fn"><a name="setOpacity" />QPainter.setOpacity (<i>self</i>, float <i>opacity</i>)</h3><p>Sets the opacity of the painter to <i>opacity</i>. The value
should be in the range 0.0 to 1.0, where 0.0 is fully transparent
and 1.0 is fully opaque.</p>
<p>Opacity set on the painter will apply to all drawing operations
individually.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#opacity">opacity</a>().</p>
<h3 class="fn"><a name="setPen" />QPainter.setPen (<i>self</i>, <a href="qcolor.html">QColor</a> <i>color</i>)</h3><p>Sets the painter's pen to be the given <i>pen</i>.</p>
<p>The <i>pen</i> defines how to draw lines and outlines, and it
also defines the text color.</p>
<p><b>See also</b> <a href="qpainter.html#pen">pen</a>() and
<a href="qpainter.html#settings">Settings</a>.</p>
<h3 class="fn"><a name="setPen-2" />QPainter.setPen (<i>self</i>, <a href="qpen.html">QPen</a> <i>pen</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's pen to have style <a href="qt.html#PenStyle-enum">Qt.SolidLine</a>, width 0 and the
specified <i>color</i>.</p>
<h3 class="fn"><a name="setPen-3" />QPainter.setPen (<i>self</i>, <a href="qt.html#PenStyle-enum">Qt.PenStyle</a> <i>style</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's pen to have the given <i>style</i>, width 0
and black color.</p>
<h3 class="fn"><a name="setRedirected" />QPainter.setRedirected (<a href="qpaintdevice.html">QPaintDevice</a> <i>device</i>, <a href="qpaintdevice.html">QPaintDevice</a> <i>replacement</i>, <a href="qpoint.html">QPoint</a> <i>offset</i> = QPoint())</h3><h3 class="fn"><a name="setRenderHint" />QPainter.setRenderHint (<i>self</i>, <a href="qpainter.html#RenderHint-enum">RenderHint</a> <i>hint</i>, bool <i>on</i> = True)</h3><p>Sets the given render <i>hint</i> on the painter if <i>on</i> is
true; otherwise clears the render hint.</p>
<p><b>See also</b> <a href="qpainter.html#setRenderHints">setRenderHints</a>(), <a href="qpainter.html#renderHints">renderHints</a>(), and <a href="qpainter.html#rendering-quality">Rendering Quality</a>.</p>
<h3 class="fn"><a name="setRenderHints" />QPainter.setRenderHints (<i>self</i>, <a href="qpainter-renderhints.html">RenderHints</a> <i>hints</i>, bool <i>on</i> = True)</h3><p>Sets the given render <i>hints</i> on the painter if <i>on</i>
is true; otherwise clears the render hints.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#setRenderHint">setRenderHint</a>(), <a href="qpainter.html#renderHints">renderHints</a>(), and <a href="qpainter.html#rendering-quality">Rendering Quality</a>.</p>
<h3 class="fn"><a name="setTransform" />QPainter.setTransform (<i>self</i>, <a href="qtransform.html">QTransform</a> <i>transform</i>, bool <i>combine</i> = False)</h3><p>Sets the world transformation matrix. If <i>combine</i> is true,
the specified <i>transform</i> is combined with the current matrix;
otherwise it replaces the current matrix.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qpainter.html#transform">transform</a>() and <a href="qpainter.html#setWorldTransform">setWorldTransform</a>().</p>
<h3 class="fn"><a name="setViewport" />QPainter.setViewport (<i>self</i>, <a href="qrect.html">QRect</a> <i>viewport</i>)</h3><p>Sets the painter's viewport rectangle to the given
<i>rectangle</i>, and enables view transformations.</p>
<p>The viewport rectangle is part of the view transformation. The
viewport specifies the device coordinate system. Its sister, the
<a href="qpainter.html#window">window</a>(), specifies the logical
coordinate system.</p>
<p>The default viewport rectangle is the same as the device's
rectangle.</p>
<p><b>See also</b> <a href="qpainter.html#viewport">viewport</a>(),
<a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>(),
and <a href="coordsys.html#window-viewport-conversion">Window-Viewport
Conversion</a>.</p>
<h3 class="fn"><a name="setViewport-2" />QPainter.setViewport (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's viewport rectangle to be the rectangle
beginning at (<i>x</i>, <i>y</i>) with the given <i>width</i> and
<i>height</i>.</p>
<h3 class="fn"><a name="setViewTransformEnabled" />QPainter.setViewTransformEnabled (<i>self</i>, bool <i>enable</i>)</h3><p>Enables view transformations if <i>enable</i> is true, or
disables view transformations if <i>enable</i> is false.</p>
<p><b>See also</b> <a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>() and
<a href="coordsys.html#window-viewport-conversion">Window-Viewport
Conversion</a>.</p>
<h3 class="fn"><a name="setWindow" />QPainter.setWindow (<i>self</i>, <a href="qrect.html">QRect</a> <i>window</i>)</h3><p>Sets the painter's window to the given <i>rectangle</i>, and
enables view transformations.</p>
<p>The window rectangle is part of the view transformation. The
window specifies the logical coordinate system. Its sister, the
<a href="qpainter.html#viewport">viewport</a>(), specifies the
device coordinate system.</p>
<p>The default window rectangle is the same as the device's
rectangle.</p>
<p><b>See also</b> <a href="qpainter.html#window">window</a>(),
<a href="qpainter.html#viewTransformEnabled">viewTransformEnabled</a>(),
and <a href="coordsys.html#window-viewport-conversion">Window-Viewport
Conversion</a>.</p>
<h3 class="fn"><a name="setWindow-2" />QPainter.setWindow (<i>self</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the painter's window to the rectangle beginning at
(<i>x</i>, <i>y</i>) and the given <i>width</i> and
<i>height</i>.</p>
<h3 class="fn"><a name="setWorldMatrix" />QPainter.setWorldMatrix (<i>self</i>, <a href="qmatrix.html">QMatrix</a> <i>matrix</i>, bool <i>combine</i> = False)</h3><h3 class="fn"><a name="setWorldMatrixEnabled" />QPainter.setWorldMatrixEnabled (<i>self</i>, bool <i>enabled</i>)</h3><p>Enables transformations if <i>enable</i> is true, or disables
transformations if <i>enable</i> is false. The world transformation
matrix is not changed.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#worldMatrixEnabled">worldMatrixEnabled</a>(),
<a href="qpainter.html#worldTransform">worldTransform</a>(), and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>
<h3 class="fn"><a name="setWorldTransform" />QPainter.setWorldTransform (<i>self</i>, <a href="qtransform.html">QTransform</a> <i>matrix</i>, bool <i>combine</i> = False)</h3><p>Sets the world transformation matrix. If <i>combine</i> is true,
the specified <i>matrix</i> is combined with the current matrix;
otherwise it replaces the current matrix.</p>
<p><b>See also</b> <a href="qpainter.html#worldTransform">worldTransform</a>(), <a href="qpainter.html#transform">transform</a>(), and <a href="qpainter.html#setTransform">setTransform</a>().</p>
<h3 class="fn"><a name="shear" />QPainter.shear (<i>self</i>, float <i>sh</i>, float <i>sv</i>)</h3><p>Shears the coordinate system by (<i>sh</i>, <i>sv</i>).</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>
<h3 class="fn"><a name="strokePath" />QPainter.strokePath (<i>self</i>, <a href="qpainterpath.html">QPainterPath</a> <i>path</i>, <a href="qpen.html">QPen</a> <i>pen</i>)</h3><p>Draws the outline (strokes) the path <i>path</i> with the pen
specified by <i>pen</i></p>
<p><b>See also</b> <a href="qpainter.html#fillPath">fillPath</a>()
and <a href="qpainter.html#drawing">Drawing</a>.</p>
<h3 class="fn"><a name="testRenderHint" />bool QPainter.testRenderHint (<i>self</i>, <a href="qpainter.html#RenderHint-enum">RenderHint</a> <i>hint</i>)</h3><p>Returns true if <i>hint</i> is set; otherwise returns false.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qpainter.html#renderHints">renderHints</a>() and <a href="qpainter.html#setRenderHint">setRenderHint</a>().</p>
<h3 class="fn"><a name="transform" /><a href="qtransform.html">QTransform</a> QPainter.transform (<i>self</i>)</h3><p>Returns the world transformation matrix.</p>
<p><b>See also</b> <a href="qpainter.html#setTransform">setTransform</a>() and <a href="qpainter.html#worldTransform">worldTransform</a>().</p>
<h3 class="fn"><a name="translate" />QPainter.translate (<i>self</i>, <a href="qpointf.html">QPointF</a> <i>offset</i>)</h3><p>Translates the coordinate system by the given <i>offset</i>;
i.e. the given <i>offset</i> is added to points.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>() and
<a href="qpainter.html#coordinate-transformations">Coordinate
Transformations</a>.</p>
<h3 class="fn"><a name="translate-2" />QPainter.translate (<i>self</i>, float <i>dx</i>, float <i>dy</i>)</h3><p>This is an overloaded function.</p>
<p>Translates the coordinate system by the given <i>offset</i>.</p>
<h3 class="fn"><a name="translate-3" />QPainter.translate (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>offset</i>)</h3><p>This is an overloaded function.</p>
<p>Translates the coordinate system by the vector (<i>dx</i>,
<i>dy</i>).</p>
<h3 class="fn"><a name="viewport" /><a href="qrect.html">QRect</a> QPainter.viewport (<i>self</i>)</h3><p>Returns the viewport rectangle.</p>
<p><b>See also</b> <a href="qpainter.html#setViewport">setViewport</a>() and <a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a>().</p>
<h3 class="fn"><a name="viewTransformEnabled" />bool QPainter.viewTransformEnabled (<i>self</i>)</h3><p>Returns true if view transformation is enabled; otherwise
returns false.</p>
<p><b>See also</b> <a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a>()
and <a href="qpainter.html#worldTransform">worldTransform</a>().</p>
<h3 class="fn"><a name="window" /><a href="qrect.html">QRect</a> QPainter.window (<i>self</i>)</h3><p>Returns the window rectangle.</p>
<p><b>See also</b> <a href="qpainter.html#setWindow">setWindow</a>() and <a href="qpainter.html#setViewTransformEnabled">setViewTransformEnabled</a>().</p>
<h3 class="fn"><a name="worldMatrix" /><a href="qmatrix.html">QMatrix</a> QPainter.worldMatrix (<i>self</i>)</h3><h3 class="fn"><a name="worldMatrixEnabled" />bool QPainter.worldMatrixEnabled (<i>self</i>)</h3><p>Returns true if world transformation is enabled; otherwise
returns false.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldMatrixEnabled">setWorldMatrixEnabled</a>(),
<a href="qpainter.html#worldTransform">worldTransform</a>(), and
<a href="coordsys.html">Coordinate System</a>.</p>
<h3 class="fn"><a name="worldTransform" /><a href="qtransform.html">QTransform</a> QPainter.worldTransform (<i>self</i>)</h3><p>Returns the world transformation matrix.</p>
<p><b>See also</b> <a href="qpainter.html#setWorldTransform">setWorldTransform</a>().</p>
<h3 class="fn"><a name="__enter__" />object QPainter.__enter__ (<i>self</i>)</h3><h3 class="fn"><a name="__exit__" />QPainter.__exit__ (<i>self</i>, object <i>type</i>, object <i>value</i>, object <i>traceback</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|