You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/html/qpaintdevicemetrics.html

151 lines
7.3 KiB

<!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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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 &lt;<a href="qpaintdevicemetrics-h.html">qpaintdevicemetrics.h</a>&gt;</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&nbsp;QPaintDevice&nbsp;*&nbsp;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&nbsp;<a href="qpaintdevice.html">QPaintDevice</a>&nbsp;*&nbsp;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 &copy; 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 &copy; 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>