1QPaintDeviceMetrics(3qt) QPaintDeviceMetrics(3qt)
2
3
4
6 QPaintDeviceMetrics - Information about a paint device
7
9 #include <qpaintdevicemetrics.h>
10
11 Public Members
12 QPaintDeviceMetrics ( const QPaintDevice * pd )
13 int width () const
14 int height () const
15 int widthMM () const
16 int heightMM () const
17 int logicalDpiX () const
18 int logicalDpiY () const
19 int numColors () const
20 int depth () const
21
23 The QPaintDeviceMetrics class provides information about a paint
24 device.
25
26 Sometimes when drawing graphics it is necessary to obtain information
27 about the physical characteristics of a paint device. This class
28 provides the information. For example, to compute the aspect ratio of a
29 paint device:
30
31 QPaintDeviceMetrics pdm( myWidget );
32 double aspect = (double)pdm.widthMM() / (double)pdm.heightMM();
33
34 QPaintDeviceMetrics contains methods to provide the width and height of
35 a device in both pixels (width() and height()) and millimeters
36 (widthMM() and heightMM()), the number of colors the device supports
37 (numColors()), the number of bit planes (depth()), and the resolution
38 of the device (logicalDpiX() and logicalDpiY()).
39
40 It is not always possible for QPaintDeviceMetrics to compute the values
41 you ask for, particularly for external devices. The ultimate example is
42 asking for the resolution of of a QPrinter that is set to "print to
43 file": who knows what printer that file will end up on?
44
45 See also Graphics Classes and Image Processing Classes.
46
49 Constructs a metric for the paint device pd.
50
52 Returns the bit depth (number of bit planes) of the paint device.
53
55 Returns the height of the paint device in default coordinate system
56 units (e.g. pixels for QPixmap and QWidget).
57
58 Examples:
59
61 Returns the height of the paint device, measured in millimeters.
62
64 Returns the horizontal resolution of the device in dots per inch, which
65 is used when computing font sizes. For X, this is usually the same as
66 could be computed from widthMM(), but it varies on Windows.
67
68 Example: qwerty/qwerty.cpp.
69
71 Returns the vertical resolution of the device in dots per inch, which
72 is used when computing font sizes. For X, this is usually the same as
73 could be computed from heightMM(), but it varies on Windows.
74
75 Examples:
76
78 Returns the number of different colors available for the paint device.
79 Since this value is an int will not be sufficient to represent the
80 number of colors on 32 bit displays, in which case INT_MAX is returned
81 instead.
82
84 Returns the width of the paint device in default coordinate system
85 units (e.g. pixels for QPixmap and QWidget).
86
87 Examples:
88
90 Returns the width of the paint device, measured in millimeters.
91
92
94 http://doc.trolltech.com/qpaintdevicemetrics.html
95 http://www.trolltech.com/faq/tech.html
96
98 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
99 license file included in the distribution for a complete license
100 statement.
101
103 Generated automatically from the source code.
104
106 If you find a bug in Qt, please report it as described in
107 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
108 help you. Thank you.
109
110 The definitive Qt documentation is provided in HTML format; it is
111 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
112 web browser. This man page is provided as a convenience for those users
113 who prefer man pages, although this format is not officially supported
114 by Trolltech.
115
116 If you find errors in this manual page, please report them to qt-
117 bugs@trolltech.com. Please include the name of the manual page
118 (qpaintdevicemetrics.3qt) and the Qt version (3.3.8).
119
120
121
122Trolltech AS 2 February 2007 QPaintDeviceMetrics(3qt)