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

QTextDocument: table border scaling broken for print

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.14.0 Alpha
    • 5.12.5, 5.13.0, 5.13.1
    • GUI: Text handling
    • None
    • 4a240bb67e72b34c80af448e0a74846609fa6975 (qt/qtbase/5.14)

      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.

        For Gerrit Dashboard: QTBUG-78318
        # Subject Branch Project Status CR V

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes