View Full Version : pixel to inch or mm

17th May 2011, 08: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.

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

17th May 2011, 15:55
First take a look at this thread

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;

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