PDA

View Full Version : pixel to inch or mm



lzpmail
17th May 2011, 07:35
hi, in qt embeded, have an function change pixel to inch or mm. before i check qt assisent, i find a QScreen class, it have some information about screen, but i don't know how to use it, anyone have an exam. thanks.

ChrisW67
17th May 2011, 08:22
Use the QPainter to get the QPaintDevice and then use the various metrics it provides. These may not be entirely reliable though.

JoZCaVaLLo
17th May 2011, 14:55
First take a look at this thread
http://www.qtcentre.org/threads/15598-how-to-get-screen-pixel-size

then if you can't get it



int PixelWidthDimension = myWidget->logicalDpiX(); //width dots per inch
int PixelHeightDimesion = myWidget->logicalDpiY(); //width dots per inch

double inch = (double)myWidthInPixel / (double)PixelWidthDimension;

lzpmail
18th May 2011, 02:39
thank you, i have finish my program, thanks your help.