Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-30260

Brush style patterns are not scaled to high resolution correctly when drawn via QTextObjectInterface

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 4.5.1, 4.7.2, 4.8.4
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Reproduced with Qt 4.8.4 on Win7, MacOS 10.7 and Debian 6.
    • Platform/s:
      macOS

      Description

      When using QTextObjectInterface and has a drawObject method overload like this:

      void MyImageHandler::drawObject(QPainter *painter, const QRectF &rect,
      QTextDocument *doc, int posInDocument,
      const QTextFormat &format)
      {
      QBrush br(Qt::red, Qt::FDiagPattern);
      painter->fillRect(rect, br);
      }

      the fill pattern is scaled wrongly when printing to higher resolutions.
      In particular, the distance between the pattern lines is too small. The higher the resolution, the closer the lines. On 600 dpi printers the patterns appear solid.

      I attached patched versions of textedit.cpp and textedit.h of your TextEdit demo application. If you replace the original file by these you should be able to see the issue when you perform print or a print preview.

      I also attached screenshots from the patched demo app. One from the editor itself (looks fine), one from the print preview (looks weird) and one from an exported pdf (looks solid).
      The exported pdf is also attached. Note: If you heavily zoom into the pdf the diagonal pattern lines re-appear.

        Attachments

        1. shot_application.png
          shot_application.png
          78 kB
        2. shot_pdf.png
          shot_pdf.png
          112 kB
        3. shot_printpreview.png
          shot_printpreview.png
          83 kB
        4. test.pdf
          690 kB
        5. textedit.cpp
          24 kB
        6. textedit.h
          3 kB

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              rodal Samuel Rødal
              Reporter:
              knellek Martin Knelleken
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes