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

Expose Qt.application.font

    XMLWordPrintable

Details

    • 2b03ab642329d2498eafa35ae7159991db5791e4

    Description

      This is useful in order to specify font sizes that are some multiple of the default size (which is almost always guaranteed to be a sensible, legible size). For example:

      Text {
          text: "Large text"
          font.pixelSize: Qt.application.font.pixelSize * 2
      }
      

      Other options are:

      1. "<h3>Large text</h3>" - adds extra space below the text since it's a HTML element, so not really useful if you want a decent layout.
      2. Hard-coding a pixel size. Works OK when used in combination with Qt::AA_EnableHighDpiScaling, and so long as you guess the correct size that works for each platform you're targeting. Doesn't work without setting Qt::AA_EnableHighDpiScaling.
      3. Using FontMetrics/TextMetrics. Works fine, but is a bit verbose.
      4. Use an empty Text element. Creates an unnecessary item. Was superseded by FontMetrics/TextMetrics.
      5. defaultPixelSize/implicitPixelSize and defaultPointSize/implicitPointSize. There are already font-related properties outside of the font grouped property, so this wouldn't be out of place, but the API is already quite large.

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes