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

QTextDocument: table border scaling broken for print

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.12.5, 5.13.0, 5.13.1
    • Fix Version/s: 5.14.0 Alpha
    • Component/s: GUI: Text handling
    • Labels:
      None
    • Commits:
      4a240bb67e72b34c80af448e0a74846609fa6975 (qt/qtbase/5.14)

      Description

      QTextDocument has no concept of units. So values given for margins, paddings or border width have to be provided in pixels. Internally QTextDocument uses qt_defaultDpi and the QPaintDevice's dpi metrics to calculate a scale factor (see internal QTextDocumentLayout::scaleToDevice method).

      So in order to apply e.g. metric values, one has to calculate a pixel value based on qt_defaultDpi (which is more or less a private function, so you must use QGuiApplication::primaryScreen()->logicalDotsPerInchX() to get that value).

      But while metrics like cellPadding are correctly scaled, some values in QTextFrameFormat are not:

      • [top|left|right|bottom]Margin
      • padding
      • border

      The attached example program tries to set the 'border' value. Attached are the results for on-screen rendering and printing.

      A patch to fix this is being worked on.

        Attachments

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

          Activity

            People

            • Assignee:
              njeisecke Nils Jeisecke
              Reporter:
              njeisecke Nils Jeisecke
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes