PDA

View Full Version : How to fixed grid line spacing in different screen



ecisp
9th March 2015, 12:47
I have a requirement to draw major grid lines in 5cm intervals for y-axis on screen.My solution is:
-Get dpi from QScreen:: physicalDotsPerInchY() ,then set the y scale interval to be (0,height * dpi), height is the inches we should draw;
-Inheritance the QwtLinearScaleEngine to build ticks every 5cm/(2.54cm per inch) * dpi;
-draw grid lines based on the built ticks;

the software can draw correct in widescreen display(16:9);but in square screen display(4:3), the grid line spacing is 6cm.I want to know how to make the gird lines fixed 5cm on different display