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. Weird QFont and QLabel behaviors
Qt 6.11 is out! See what's new in the release blog

Weird QFont and QLabel behaviors

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 193 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.
  • R Offline
    R Offline
    RyuXnet
    wrote last edited by RyuXnet
    #1

    Hi everyone,
    I ran into a font rendering inconsistency between QLabels with weird conditions.
    Here's a minimal example of my app UI. I thought it was only on the app I'm currently working on, but it seems it's the same in this project too.
    So I'm using Segoe UI font (which comes by default on Win 11, what I'm currently on) and I set it to my QApplication, and then retrieve it in MainWindow, setupUi method, increment the pixel/point size and set it to my QLabels, but the text rendering is incorrect:
    FontTest1.png

    The weird part is when I comment the first title setFont here, the rest renders correctly:
    FontTest2.png

    Did anyone run is a similar situation or am I missing something about QFont usage, or some clash with QLabels ? Advice or even deeper explanations are more than welcome.

    Thanks in advance

    1 Reply Last reply
    0
    • EskilE Offline
      EskilE Offline
      Eskil
      wrote last edited by
      #2

      Hi! Which Qt version is this? I tried your example on my end (also Windows 11) with Qt 6.10 and cannot see any differences between the labels with/without the firstLabel->setFont(titlefont).

      R 1 Reply Last reply
      0
      • EskilE Eskil

        Hi! Which Qt version is this? I tried your example on my end (also Windows 11) with Qt 6.10 and cannot see any differences between the labels with/without the firstLabel->setFont(titlefont).

        R Offline
        R Offline
        RyuXnet
        wrote last edited by
        #3

        @Eskil Hi, thank you for your time, i'm using Qt 5.15.2

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote last edited by
          #4

          Qt 5.15.2 is out of support.
          I tested it with Qt6.12 with fusion, windowsvista and windows11 style and it worked as expected. Also installed 5.15.2 and even there all looked fine.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          R 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            Qt 5.15.2 is out of support.
            I tested it with Qt6.12 with fusion, windowsvista and windows11 style and it worked as expected. Also installed 5.15.2 and even there all looked fine.

            R Offline
            R Offline
            RyuXnet
            wrote last edited by
            #5

            @Christian-Ehrlicher Thanks a lot.
            We already started a couple of years back in this project, and we went for 5.15.2.
            To make things even weird I asked about it in Qt subbreddit here and the answer proposed works fine for this test app, but the actual project is still doing weird stuff.

            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