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

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

XMLWordPrintable

    • c0c4be672bd652d29a5c8f52e31ad76a1361e320 (qt/qtbase/dev)

      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

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes