I'm new to Qt and exploring QPrinter / QPainter
According to the documentation, in order to print in mm, the coordinates must be translated to the printer's unit, considering it's resolution. So, I wrote the following code:
qreal printInterface::convertFromMM(qreal in)
{
//1 inch = 25.4 mmm so
return in * (1/25.4) * mQPrinter->resolution();
}
This is working fine for printing lines and so.
Now I must measure text, so according to the documentation I used the QFontMetrics() class.
The problem is that Painter->fontMetrics().width(stringToMeasure)
is returning the width, according to the documentation, in pixels. How can I translate this to mm?
Any help will be greatly appreciated!