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

Make QPaintDevice parameters const in constructors of QFont, QFontMetrics and QTextLayout

    XMLWordPrintable

Details

    • c0c4be672bd652d29a5c8f52e31ad76a1361e320 (qt/qtbase/dev)

    Description

      The classes QTextLayout, QFontMetrics, QFontMetricsF and QFont each offer a constructor where you can provide a pointer to a QPaintDevice. In the end, all they ever do is read the dpi settings from the paint device.

      When writing code that performs layout calculations, e.g. for printing, you are forced to keep a lot of methods non-const for the sole reason that the paint device is required as a non-const parameter. Using const_cast is possible, but ugly (triggers warnings in static code analysis, etc.)

      Suggestion: Make these QPaintDevice constructor parameters const

      Attachments

        Issue Links

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

          Activity

            People

              VRonin Luca
              asperamanca Robert Schimkowitsch
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes