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

QLabel::setFont() strange behavior

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.3, 5.15.0
    • GUI: Font handling
    • None
    • Windows 10 1809 Pro x64
      Qt 5.12.3 MSVC 2017 x64, Qt 5.12.3 mingw 7.3 x64
    • Windows

    Description

      QLabel::setFont() has different behavior depending on how and when  it called. It works correctly only after selecting font using QFontDialog, in other cases (font was deserialized from config, for example) - it looses some font attributes even these attributes are present in deserialized font.

      Applying deserialized font (read from config) from constructor looses `styleName` font attribute, but doing the same on button click (but NOT doing it from constructor, i.e. label has default font) lead to visually correct effect, but QLabel::font() reports NO styleName field set...

      see comments in attached sample app and screenshots.

      Attachments

        1. 1-set-in-constructor.png
          26 kB
          Nick Korotysh
        2. 2-set-by-parse-after-constructor.png
          35 kB
          Nick Korotysh
        3. 3-set-by-select-font.png
          68 kB
          Nick Korotysh
        4. 4-set-by-parse-no-constructor.png
          45 kB
          Nick Korotysh
        5. set_font_bug.zip
          3 kB
          Nick Korotysh
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            nick-korotysh Nick Korotysh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes