Hi,
Does anyone know how to get pixel size with Qt?
Thanks
Hi,
Does anyone know how to get pixel size with Qt?
Thanks
Do you mean the resolution? Take a look at QDesktopWidget and what it offers.
wysota, I just need a pixel or screen width and height in millimeters. I have to draw symbols at the same dimension on defferent screens and resolutions.
The pixel size is in its nature resolution independent (as opposed to point size, or vice versa - in that case revert everything I say here), so if you count everything in logical pixels (and not points) you should get consistent sizes (this especially applies to fonts).
There is solution in QPaintDevice class. Methods widthMM() and heightMM() returns what I have been looking for!
Yes, they return a measurement in millimeters, but you can't actually trust the value that it gives you. Sure it'll be sort of correct, but if you verify it with a ruler it won't match up (unless your monitor has a perfect DPI setting, which is very unlikely, and most people don't).
kodiak (27th August 2008)
Bookmarks