File: qpaintdevice.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (107 lines) | stat: -rw-r--r-- 15,407 bytes parent folder | download
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
<?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>QPaintDevice 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">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPaintDevice Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPaintDevice class is the base class of objects that can be painted. <a href="#details">More...</a></p>
<p>Inherited by <a href="qglpixelbuffer.html">QGLPixelBuffer</a>, <a href="qimage.html">QImage</a>, <a href="qpicture.html">QPicture</a>, <a href="qpixmap.html">QPixmap</a>, <a href="qprinter.html">QPrinter</a> and <a href="qwidget.html">QWidget</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qpaintdevice.html#PaintDeviceMetric-enum">PaintDeviceMetric</a></b> { PdmWidth, PdmHeight, PdmWidthMM, PdmHeightMM, ..., PdmPhysicalDpiY }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpaintdevice.html#QPaintDevice">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#depth">depth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#height">height</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#heightMM">heightMM</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#metric">metric</a></b> (<i>self</i>, PaintDeviceMetric&#160;<i>metric</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#numColors">numColors</a></b> (<i>self</i>)</li><li><div class="fn" />QPaintEngine <b><a href="qpaintdevice.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpaintdevice.html#paintingActive">paintingActive</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#width">width</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#widthMM">widthMM</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPaintDevice class is the base class of objects that can be painted.</p>
<p>A paint device is an abstraction of a two-dimensional space that can be drawn using a <a href="qpainter.html">QPainter</a>. Its default coordinate system has its origin located at the top-left position. X increases to the right and Y increases downwards. The unit is one pixel.</p>
<p>The drawing capabilities of QPaintDevice are currently implemented by the <a href="qwidget.html">QWidget</a>, <a href="qimage.html">QImage</a>, <a href="qpixmap.html">QPixmap</a>, <a href="qglpixelbuffer.html">QGLPixelBuffer</a>, <a href="qpicture.html">QPicture</a>, and <a href="qprinter.html">QPrinter</a> subclasses.</p>
<p>To implement support for a new backend, you must derive from QPaintDevice and reimplement the virtual <a href="qpaintdevice.html#paintEngine">paintEngine</a>() function to tell <a href="qpainter.html">QPainter</a> which paint engine should be used to draw on this particular device. Note that you also must create a corresponding paint engine to be able to draw on the device, i.e derive from <a href="qpaintengine.html">QPaintEngine</a> and reimplement its virtual functions.</p>
<p><b>Warning:</b> Qt requires that a <a href="qapplication.html">QApplication</a> object exists before any paint devices can be created. Paint devices access window system resources, and these resources are not initialized before an application object is created.</p>
<p>The QPaintDevice class provides several functions returning the various device metrics: The <a href="qpaintdevice.html#depth">depth</a>() function returns its bit depth (number of bit planes). The <a href="qpaintdevice.html#height">height</a>() function returns its height in default coordinate system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>) while <a href="qpaintdevice.html#heightMM">heightMM</a>() returns the height of the device in millimeters. Similiarily, the <a href="qpaintdevice.html#width">width</a>() and <a href="qpaintdevice.html#widthMM">widthMM</a>() functions return the width of the device in default coordinate system units and in millimeters, respectively. Alternatively, the protected <a href="qpaintdevice.html#metric">metric</a>() function can be used to retrieve the metric information by specifying the desired <a href="qpaintdevice.html#PaintDeviceMetric-enum">PaintDeviceMetric</a> as argument.</p>
<p>The <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>() and <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>() functions return the horizontal and vertical resolution of the device in dots per inch. The <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>() and <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>() functions also return the resolution of the device in dots per inch, but note that if the logical and vertical resolution differ, the corresponding <a href="qpaintengine.html">QPaintEngine</a> must handle the mapping. Finally, the <a href="qpaintdevice.html#numColors">numColors</a>() function returns the number of different colors available for the paint device.</p>
<p>See also <a href="qpaintengine.html">QPaintEngine</a>, <a href="qpainter.html">QPainter</a>, <a href="coordsys.html">The Coordinate System</a>, and <a href="paintsystem.html">The Paint System</a>.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="PaintDeviceMetric-enum" />QPaintDevice.PaintDeviceMetric</h3><p>Describes the various metrics of a paint device.</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmWidth</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
<td valign="top">The width of the paint device in default coordinate system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>). See also <a href="qpaintdevice.html#width">width</a>().</td>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmHeight</tt></td>
<td align="center" valign="top"><tt>2</tt></td>
<td valign="top">The height of the paint device in default coordinate system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>). See also <a href="qpaintdevice.html#height">height</a>().</td>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmWidthMM</tt></td>
<td align="center" valign="top"><tt>3</tt></td>
<td valign="top">The width of the paint device in millimeters. See also <a href="qpaintdevice.html#widthMM">widthMM</a>().</td>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmHeightMM</tt></td>
<td align="center" valign="top"><tt>4</tt></td>
<td valign="top">The height of the paint device in millimeters. See also <a href="qpaintdevice.html#heightMM">heightMM</a>().</td>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmNumColors</tt></td>
<td align="center" valign="top"><tt>5</tt></td>
<td valign="top">The number of different colors available for the paint device. See also <a href="qpaintdevice.html#numColors">numColors</a>().</td>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmDepth</tt></td>
<td align="center" valign="top"><tt>6</tt></td>
<td valign="top">The bit depth (number of bit planes) of the paint device. See also <a href="qpaintdevice.html#depth">depth</a>().</td>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmDpiX</tt></td>
<td align="center" valign="top"><tt>7</tt></td>
<td valign="top">The horizontal resolution of the device in dots per inch. See also <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>().</td>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmDpiY</tt></td>
<td align="center" valign="top"><tt>8</tt></td>
<td valign="top">The vertical resolution of the device in dots per inch. See also <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>().</td>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmPhysicalDpiX</tt></td>
<td align="center" valign="top"><tt>9</tt></td>
<td valign="top">The horizontal resolution of the device in dots per inch. See also <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>().</td>
</tr>
<tr>
<td valign="top"><tt>QPaintDevice.PdmPhysicalDpiY</tt></td>
<td align="center" valign="top"><tt>10</tt></td>
<td valign="top">The vertical resolution of the device in dots per inch. See also <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>().</td>
</tr>
</table>
<br />
<br />
<p>See also <a href="qpaintdevice.html#metric">metric</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPaintDevice" />QPaintDevice.__init__ (<i>self</i>)</h3><p>Constructs a paint device. This constructor can be invoked only from subclasses of <a href="qpaintdevice.html">QPaintDevice</a>.</p>
<h3 class="fn"><a name="depth" />int QPaintDevice.depth (<i>self</i>)</h3><p>Returns the bit depth (number of bit planes) of the paint device.</p>
<h3 class="fn"><a name="height" />int QPaintDevice.height (<i>self</i>)</h3><p>Returns the height of the paint device in default coordinate system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>).</p>
<p>See also <a href="qpaintdevice.html#heightMM">heightMM</a>().</p>
<h3 class="fn"><a name="heightMM" />int QPaintDevice.heightMM (<i>self</i>)</h3><p>Returns the height of the paint device in millimeters.</p>
<p>See also <a href="qpaintdevice.html#height">height</a>().</p>
<h3 class="fn"><a name="logicalDpiX" />int QPaintDevice.logicalDpiX (<i>self</i>)</h3><p>Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from <a href="qpaintdevice.html#widthMM">widthMM</a>(), but it varies on Windows.</p>
<p>Note that if the logicalDpiX() doesn't equal the <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>(), the corresponding <a href="qpaintengine.html">QPaintEngine</a> must handle the resolution mapping.</p>
<p>See also <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>() and <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>().</p>
<h3 class="fn"><a name="logicalDpiY" />int QPaintDevice.logicalDpiY (<i>self</i>)</h3><p>Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from <a href="qpaintdevice.html#heightMM">heightMM</a>(), but it varies on Windows.</p>
<p>Note that if the logicalDpiY() doesn't equal the <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>(), the corresponding <a href="qpaintengine.html">QPaintEngine</a> must handle the resolution mapping.</p>
<p>See also <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>() and <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>().</p>
<h3 class="fn"><a name="metric" />int QPaintDevice.metric (<i>self</i>, <a href="qpaintdevice.html#PaintDeviceMetric-enum">PaintDeviceMetric</a>&#160;<i>metric</i>)</h3><p>Returns the metric information for the given paint device <i>metric</i>.</p>
<p>See also <a href="qpaintdevice.html#PaintDeviceMetric-enum">PaintDeviceMetric</a>.</p>
<h3 class="fn"><a name="numColors" />int QPaintDevice.numColors (<i>self</i>)</h3><p>Returns the number of different colors available for the paint device. Since this value is an int, it will not be sufficient to represent the number of colors on 32 bit displays, in this case INT_MAX is returned instead.</p>
<h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QPaintDevice.paintEngine (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns a pointer to the paint engine used for drawing on the device.</p>
<h3 class="fn"><a name="paintingActive" />bool QPaintDevice.paintingActive (<i>self</i>)</h3><p>Returns true if the device is currently being painted on, i.e. someone has called <a href="qpainter.html#begin">QPainter.begin</a>() but not yet called <a href="qpainter.html#end">QPainter.end</a>() for this device; otherwise returns false.</p>
<p>See also <a href="qpainter.html#isActive">QPainter.isActive</a>().</p>
<h3 class="fn"><a name="physicalDpiX" />int QPaintDevice.physicalDpiX (<i>self</i>)</h3><p>Returns the horizontal resolution of the device in dots per inch.</p>
<p>Note that if the physicalDpiX() doesn't equal the <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>(), the corresponding <a href="qpaintengine.html">QPaintEngine</a> must handle the resolution mapping.</p>
<p>See also <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>() and <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>().</p>
<h3 class="fn"><a name="physicalDpiY" />int QPaintDevice.physicalDpiY (<i>self</i>)</h3><p>Returns the horizontal resolution of the device in dots per inch.</p>
<p>Note that if the physicalDpiY() doesn't equal the <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>(), the corresponding <a href="qpaintengine.html">QPaintEngine</a> must handle the resolution mapping.</p>
<p>See also <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>() and <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>().</p>
<h3 class="fn"><a name="width" />int QPaintDevice.width (<i>self</i>)</h3><p>Returns the width of the paint device in default coordinate system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>).</p>
<p>See also <a href="qpaintdevice.html#widthMM">widthMM</a>().</p>
<h3 class="fn"><a name="widthMM" />int QPaintDevice.widthMM (<i>self</i>)</h3><p>Returns the width of the paint device in millimeters.</p>
<p>See also <a href="qpaintdevice.html#width">width</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>