Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPrinter different coordinates

QPrinter different coordinates

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alexRM
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      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())

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexRM
        wrote on last edited by
        #3

        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..?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          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
          https://bugreports.qt-project.org/browse/QTBUG-5363

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alexRM
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved