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 998 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.
  • SeeLookS Offline
    SeeLookS Offline
    SeeLook
    wrote on 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
    • SeeLookS Offline
      SeeLookS Offline
      SeeLook
      wrote on 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

      • Login

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