QPaintDeviceMetrics(3qt)
π QPaintDeviceMetrics(3qt) π
okay bestie, welcome to qpaintdevicemetrics.3qt β the man page about the class that tells you everything you ever wanted to know about a paint device. and yes, the whole time we're in Qt 3 territory, so hydrate and stretch π«Ά
β¨ NAME β¨
QPaintDeviceMetrics β literally just info about a paint device. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
#include <qpaintdevicemetrics.h>
π Public Members π
QPaintDeviceMetrics ( const QPaintDevice * pd )
int width () const
int height () const
int widthMM () const
int heightMM () const
int logicalDpiX () const
int logicalDpiY () const
int numColors () const
int depth () const
π¦ DESCRIPTION π¦
so, the QPaintDeviceMetrics class gives you info about a paint device. iconic behaviour honestly.
sometimes when you're drawing graphics you need to know the physical characteristics of a paint device β like, the actual real-world physical situation of it. and this class? this class hands you that info. for example, say you wanna compute the aspect ratio of a paint device:
QPaintDeviceMetrics pdm( myWidget );
double aspect = (double)pdm.widthMM() / (double)pdm.heightMM();
see how easy that was. no cap.
QPaintDeviceMetrics contains methods that give you the width and height of a device in both pixels (width() and height()) and millimeters (widthMM() and heightMM()), the number of colors the device supports (numColors()), the number of bit planes (depth()), and the resolution of the device (logicalDpiX() and logicalDpiY()). like, all the numbers. the whole collection. π
okay so listen β it is not always possible for QPaintDeviceMetrics to compute the values you ask for, especially for external devices. the ultimate example, the final boss of "we literally cannot know this": asking for the resolution of aQPrinterthat's set to"print to file". who knows what printer that file will end up on?? nobody. not you, not me, not the class. it's giving mystery. π
see also Graphics Classes and Image Processing Classes.
π MEMBER FUNCTION DOCUMENTATION π
π« QPaintDeviceMetrics::QPaintDeviceMetrics ( const QPaintDevice * pd )
constructs a metric for the paint device pd. that's the constructor, bestie, that's what it does. β¨
π« int QPaintDeviceMetrics::depth () const
returns the bit depth (that's the number of bit planes) of the paint device. π
π« int QPaintDeviceMetrics::height () const
returns the height of the paint device in default coordinate system units β so like, pixels for QPixmap and QWidget. π
Examples:
π« int QPaintDeviceMetrics::heightMM () const
returns the height of the paint device, measured in millimeters. yes, real millimeters. physical. πΈ
π« int QPaintDeviceMetrics::logicalDpiX () const
returns the horizontal resolution of the device in dots per inch, which is what gets used when computing font sizes. for X, this is usually the same as what you could compute from widthMM(), but it varies on Windows. it's giving platform differences, we love that for us. π
Example: qwerty/qwerty.cpp.
π« int QPaintDeviceMetrics::logicalDpiY () const
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 heightMM(), but it varies on Windows. (same energy as its X sibling, just vertical. periodt.)
Examples:
π« int QPaintDeviceMetrics::numColors () const
returns the number of different colors available for the paint device. and here's the tea: since this value is an int, it will not be sufficient to represent the number of colors on 32 bit displays β in which case INT_MAX is returned instead. so if you see INT_MAX staring back at you, that's why. π₯
π« int QPaintDeviceMetrics::width () const
returns the width of the paint device in default coordinate system units β e.g. pixels for QPixmap and QWidget. π
Examples:
π« int QPaintDeviceMetrics::widthMM () const
returns the width of the paint device, measured in millimeters. the horizontal twin of heightMM(). π
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
π§ AUTHOR π§
Generated automatically from the source code. (not me writing it by hand, the machines did that part. i just did the vibes. π )
π BUGS π
if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. thank you. π«Ά (genuinely, thank you, bug reporters are the main characters fr fr)
the definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. this man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. (read that again if you need to, bestie.)
if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qpaintdevicemetrics.3qt) and the Qt version (3.3.8). ty ty ty π
and that's the whole page, bestie β every flag, every method, every warning, nothing skipped, nothing invented. slay. π β¨
mwah π this has been your girl signing off β brought to you by Trolltech AS, dated 2 February 2007, and this little icon is QPaintDeviceMetrics(3qt) saying bye bye for now. go measure something in millimeters. π¦
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms