QPrinter different coordinates
Hi, I have a problem with a qt desktop app using QPrinter and Qpainter. My application prints well on pc where I developed the application..when I try to run same program on different computers With Windows, the text printed is not aligned anymore. Can you help me to understand the problem?? I use d qpainter and drawText functions with static position..
Thanks in advance
It is not clear what you mean by "not aligned". Not aligned with what? Parts of the same page no longer align, the output from one machine is not exactly the same as the output from another machine, or no longer aligns with preprinted stationery?
The printable area of the page is driven by the properties of the specific printer selected... So at least this is is going to vary unless you tell Qt to work with the entire page(QPrinter::setFullPage())
Hi, thanks for response..
What I mean is that I have used setFullPage(true); and I programmed the printer used the QPainter. I used for example drawText(200, 200, "something"). This draw correctly in the pc where I developed, but if run this call on different pc with same printer, the offset of text printed is different...For example if I found that 350 is the center of paper, and I printed the text in that point, int he other pc..350 is not the center anymore..Do I have to specify any others attributes?like paperSize a4..?
Take a look at the paperRect() and/ or pageRect() on the two machines and they are probably different. You could define a tranform to give yourself a consistent coordinate system, say a 0.1mm grid, overlaying the page for your painter.
If the two machines are Linux and Windows, and the offset is right and down, then you might search for a Qt bug I reported a long while back. On Windows the setFullPage() call was not being honoured. This was Qt4... Do not know if it exists in Qt5.
Edit: This is the bug, and it seems to still exist in Qt5
Hi thanks for response, I checked and the pageRect and paperRect, was differents infact. So I re-implemented the function that print in "responsive" way, using pageRect for getting the page width and height. After I used that values in percentage.
I guess I solved