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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpaintdevicemetrics.cpp:40 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QPaintDeviceMetrics Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td 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="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QPaintDeviceMetrics Class Reference</h1>
<p>The QPaintDeviceMetrics class provides information about a
paint device.
<a href="#details">More...</a>
<p><tt>#include <<a href="qpaintdevicemetrics-h.html">qpaintdevicemetrics.h</a>></tt>
<p><a href="qpaintdevicemetrics-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QPaintDeviceMetrics"><b>QPaintDeviceMetrics</b></a> ( const QPaintDevice * pd )</li>
<li class=fn>int <a href="#width"><b>width</b></a> () const</li>
<li class=fn>int <a href="#height"><b>height</b></a> () const</li>
<li class=fn>int <a href="#widthMM"><b>widthMM</b></a> () const</li>
<li class=fn>int <a href="#heightMM"><b>heightMM</b></a> () const</li>
<li class=fn>int <a href="#logicalDpiX"><b>logicalDpiX</b></a> () const</li>
<li class=fn>int <a href="#logicalDpiY"><b>logicalDpiY</b></a> () const</li>
<li class=fn>int <a href="#numColors"><b>numColors</b></a> () const</li>
<li class=fn>int <a href="#depth"><b>depth</b></a> () const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QPaintDeviceMetrics class provides information about a
paint device.
<p>
<p> Sometimes when drawing graphics it is necessary to obtain
information about the physical characteristics of a paint device.
This class provides the information. For example, to compute the
aspect ratio of a paint device:
<p> <pre>
QPaintDeviceMetrics pdm( myWidget );
double aspect = (double)pdm.<a href="#widthMM">widthMM</a>() / (double)pdm.<a href="#heightMM">heightMM</a>();
</pre>
<p> QPaintDeviceMetrics contains methods to provide the width and
height of a device in both pixels (<a href="#width">width</a>() and <a href="#height">height</a>()) and
millimeters (<a href="#widthMM">widthMM</a>() and <a href="#heightMM">heightMM</a>()), the number of colors the
device supports (<a href="#numColors">numColors</a>()), the number of bit planes (<a href="#depth">depth</a>()),
and the resolution of the device (<a href="#logicalDpiX">logicalDpiX</a>() and
<a href="#logicalDpiY">logicalDpiY</a>()).
<p> It is not always possible for QPaintDeviceMetrics to compute the
values you ask for, particularly for external devices. The
ultimate example is asking for the resolution of of a <a href="qprinter.html">QPrinter</a>
that is set to "print to file": who knows what printer that file
will end up on?
<p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QPaintDeviceMetrics"></a>QPaintDeviceMetrics::QPaintDeviceMetrics ( const <a href="qpaintdevice.html">QPaintDevice</a> * pd )
</h3>
Constructs a metric for the paint device <em>pd</em>.
<h3 class=fn>int <a name="depth"></a>QPaintDeviceMetrics::depth () const
</h3>
<p> Returns the bit depth (number of bit planes) of the paint device.
<h3 class=fn>int <a name="height"></a>QPaintDeviceMetrics::height () const
</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>Examples: <a href="qaction-application-example.html#x1141">action/application.cpp</a>, <a href="simple-application-example.html#x1559">application/application.cpp</a>, <a href="helpviewer-example.html#x996">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2040">mdi/application.cpp</a>, and <a href="qwerty-example.html#x378">qwerty/qwerty.cpp</a>.
<h3 class=fn>int <a name="heightMM"></a>QPaintDeviceMetrics::heightMM () const
</h3>
<p> Returns the height of the paint device, measured in millimeters.
<h3 class=fn>int <a name="logicalDpiX"></a>QPaintDeviceMetrics::logicalDpiX () const
</h3>
<p> Returns the horizontal resolution of the device in dots per inch,
which is used when computing font sizes. For X, this is usually
the same as could be computed from <a href="#widthMM">widthMM</a>(), but it varies on
Windows.
<p>Example: <a href="qwerty-example.html#x379">qwerty/qwerty.cpp</a>.
<h3 class=fn>int <a name="logicalDpiY"></a>QPaintDeviceMetrics::logicalDpiY () const
</h3>
<p> Returns the vertical resolution of the device in dots per inch,
which is used when computing font sizes. For X, this is usually
the same as could be computed from <a href="#heightMM">heightMM</a>(), but it varies on
Windows.
<p>Examples: <a href="qaction-application-example.html#x1142">action/application.cpp</a>, <a href="simple-application-example.html#x1560">application/application.cpp</a>, <a href="helpviewer-example.html#x997">helpviewer/helpwindow.cpp</a>, and <a href="mdi-example.html#x2041">mdi/application.cpp</a>.
<h3 class=fn>int <a name="numColors"></a>QPaintDeviceMetrics::numColors () const
</h3>
<p> Returns the number of different colors available for the paint
device. Since this value is an int will not be sufficient to represent
the number of colors on 32 bit displays, in which case INT_MAX is
returned instead.
<h3 class=fn>int <a name="width"></a>QPaintDeviceMetrics::width () const
</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>Examples: <a href="qaction-application-example.html#x1143">action/application.cpp</a>, <a href="simple-application-example.html#x1561">application/application.cpp</a>, <a href="helpviewer-example.html#x998">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x2042">mdi/application.cpp</a>, and <a href="qwerty-example.html#x380">qwerty/qwerty.cpp</a>.
<h3 class=fn>int <a name="widthMM"></a>QPaintDeviceMetrics::widthMM () const
</h3>
<p> Returns the width of the paint device, measured in millimeters.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>
|