Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How QML determines default font.pixelSize

How QML determines default font.pixelSize

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 997 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SeeLook
    wrote on 27 Jan 2021, 20:03 last edited by SeeLook
    #1

    Hi.

    I'm trying to figure out how QML determines font.pixelSize, because it is not simply FontMetrics.height (or qApp->fontMetrics().height())
    I. e. for system font size set to 12:
    qApp->font().pointSize() is exactly 12 the same as QML font.pointSize
    qApp->fontMetrics().height() is 19 (the same as QML FontMetrics)
    but
    qApp->font().pixelSize() is -1 mens undefined
    whereas QML font.pixelSize is 16
    So how to obtain this last value, knowing system font size (pointSize) before QML will be initialized?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SeeLook
      wrote on 27 Jan 2021, 21:06 last edited by SeeLook
      #2

      OK. I've got it....

      auto pixelSize = qApp.font().pointSizeF() / 72.0 * qApp->primaryScreen()->logicalDotsPerInch();
      
      1 Reply Last reply
      0

      1/2

      27 Jan 2021, 20:03

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved