Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Setting QSS font-size and varying DPIs
Forum Updated to NodeBB v4.3 + New Features

Setting QSS font-size and varying DPIs

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 4.0k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    J.Andre
    wrote on last edited by
    #1

    Hi,

    I'm wondering how I should be setting the font-size in QSS so that it works well for monitors of any DPI on Windows.

    Currently, I have styles that looks like this:

    QLabel {
        font-size: 12px;
    }
    

    Because the unit is in pixels, it looks small on high DPI monitors.
    Specifying the units using pt makes them look thicker than they should.

    Is there something I'm missing that might be needed?

    Thank you

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      I think pt is the right way.
      I feel 9pt looks the same as 12px in normal DPI.

      JonBJ 1 Reply Last reply
      0
      • B Bonnie

        I think pt is the right way.
        I feel 9pt looks the same as 12px in normal DPI.

        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by JonB
        #3

        @Bonnie
        I've often struggled with this (in HTML/CSS rather than Qt). Is "always specify your font size in pt rather than px" a general/successful rule? But then if text has to fit into somewhere like, say, a box specified in pixels, you have headaches again, correct?

        1 Reply Last reply
        0
        • J Offline
          J Offline
          J.Andre
          wrote on last edited by
          #4

          @Bonnie said in Setting QSS font-size and varying DPIs:

          the right way.
          I feel 9pt looks the same

          It does appear to be the right size but then text looks fuzzy when I switch to using it. I'm not sure how to explain it.

          JonBJ 1 Reply Last reply
          0
          • J J.Andre

            @Bonnie said in Setting QSS font-size and varying DPIs:

            the right way.
            I feel 9pt looks the same

            It does appear to be the right size but then text looks fuzzy when I switch to using it. I'm not sure how to explain it.

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #5

            @J-Andre
            I would imagine specifying in pt has to scale on a monitor hence the fuzziness, where px would fit exactly?

            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