<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/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"><!-- h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #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><div class=fn><a href="#QPaintDeviceMetrics"><b>QPaintDeviceMetrics</b></a> ( const QPaintDevice * pd )</div></li> <li><div class=fn>int <a href="#width"><b>width</b></a> () const</div></li> <li><div class=fn>int <a href="#height"><b>height</b></a> () const</div></li> <li><div class=fn>int <a href="#widthMM"><b>widthMM</b></a> () const</div></li> <li><div class=fn>int <a href="#heightMM"><b>heightMM</b></a> () const</div></li> <li><div class=fn>int <a href="#logicalDpiX"><b>logicalDpiX</b></a> () const</div></li> <li><div class=fn>int <a href="#logicalDpiY"><b>logicalDpiY</b></a> () const</div></li> <li><div class=fn>int <a href="#numColors"><b>numColors</b></a> () const</div></li> <li><div class=fn>int <a href="#depth"><b>depth</b></a> () const</div></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 this 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> <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> 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#x2029">action/application.cpp</a>, <a href="simple-application-example.html#x1927">application/application.cpp</a>, <a href="helpviewer-example.html#x1402">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x1159">mdi/application.cpp</a> and <a href="qwerty-example.html#x640">qwerty/qwerty.cpp</a>. <h3 class=fn>int <a name="heightMM"></a>QPaintDeviceMetrics::heightMM () const </h3> 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>Examples: <a href="helpviewer-example.html#x1403">helpviewer/helpwindow.cpp</a> and <a href="qwerty-example.html#x641">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>Example: <a href="helpviewer-example.html#x1404">helpviewer/helpwindow.cpp</a>. <h3 class=fn>int <a name="numColors"></a>QPaintDeviceMetrics::numColors () const </h3> Returns the number of different colors available for the paint device. <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#x2030">action/application.cpp</a>, <a href="simple-application-example.html#x1928">application/application.cpp</a>, <a href="helpviewer-example.html#x1405">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x1160">mdi/application.cpp</a> and <a href="qwerty-example.html#x642">qwerty/qwerty.cpp</a>. <h3 class=fn>int <a name="widthMM"></a>QPaintDeviceMetrics::widthMM () const </h3> 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-2001 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2001 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a> <td align=right><div align=right>Qt version 3.0.2</div> </table></div></address></body> </html>